From a253cff784f16b8676270093ddbff48d934d6228 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 24 Mar 2026 16:35:50 +0900 Subject: [PATCH 001/151] gradle 26.1 --- build.gradle | 26 ++++++++---------------- common/build.gradle | 2 +- gradle.properties | 11 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 1 + 5 files changed, 17 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 088dd8d99..56a528bfe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.13-SNAPSHOT" apply false - id 'com.matthewprenger.cursegradle' version '1.+' + id "dev.architectury.loom" version "1.14-SNAPSHOT" apply false + id 'com.matthewprenger.cursegradle' version '1.5.0' id "com.modrinth.minotaur" version "2.+" } @@ -33,7 +33,7 @@ subprojects { base { // Set up a suffixed format for the mod jar names, e.g. `example-fabric`. - archivesBaseName = info.archives_base_name + archivesName = info.archives_base_name } loom { @@ -48,14 +48,6 @@ subprojects { dependencies { minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" - // The following line declares the mojmap mappings, you may use other mappings as well - // mappings loom.officialMojangMappings() - // The following line declares the yarn mappings you may select this one as well. - //mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2" - mappings loom.layered() { - it.mappings("net.fabricmc:yarn:${rootProject.yarn_mappings}:v2") - it.mappings file("../mappings/121-1fix.tiny") - } // https://mvnrepository.com/artifact/org.yaml/snakeyaml implementation 'org.yaml:snakeyaml:2.0' @@ -80,15 +72,15 @@ subprojects { if (modLoader == "neoforge") { addGameVersion "NeoForge" } - addGameVersion '1.21.11' + addGameVersion '26.1' relations { if (modLoader == "fabric") { requiredDependency "fabric-api" } - requiredDependency 'architectury-api' - embeddedLibrary 'cloth-config' +// requiredDependency 'architectury-api' +// embeddedLibrary 'cloth-config' embeddedLibrary 'compatdatapacks' embeddedLibrary 'legacyitemmodels' } @@ -107,7 +99,7 @@ subprojects { token = System.getenv("MODRINTH_TOKEN") projectId = 'mcpitanlibarch' versionNumber = info.mod_version + "-" + modLoader - gameVersions = ['1.21.11'] + gameVersions = ['26.1'] versionType = 'beta' uploadFile = tasks.remapJar changelog = info.changelog @@ -116,8 +108,8 @@ subprojects { if (modLoader == "fabric") { required.project "fabric-api" // Fabric API } - required.project "architectury-api" - embedded.project "cloth-config" +// required.project "architectury-api" +// embedded.project "cloth-config" embedded.project "compatdatapacks" embedded.project "legacyitemmodels" } diff --git a/common/build.gradle b/common/build.gradle index b6e594192..0c17b9439 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -3,7 +3,7 @@ dependencies { // Do NOT use other classes from fabric loader modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" // Remove the next line if you don't want to depend on the API - modApi "dev.architectury:architectury:${rootProject.architectury_version}" +// modApi "dev.architectury:architectury:${rootProject.architectury_version}" } architectury { diff --git a/gradle.properties b/gradle.properties index f0c200bf7..8692e7921 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,26 +1,25 @@ org.gradle.jvmargs=-Xmx3G -minecraft_version=1.21.11 +minecraft_version=26.1-rc-3 # https://www.curseforge.com/minecraft/mc-mods/architectury-api -architectury_version=19.0.1 +#architectury_version=19.0.1 # https://fabricmc.net/develop/ fabric_loader_version=0.18.4 -yarn_mappings=1.21.11+build.4 -fabric_api_version=0.141.3+1.21.11 +fabric_api_version=0.144.0+26.1 # https://projects.neoforged.net/neoforged/neoforge neoforge_version=21.11.38-beta -cloth_config_version=20.0.148 +#cloth_config_version=20.0.148 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.14.2111 legacyitemmodels_version=1.0.2.2111 fabricEnabled=true -neoforgeEnabled=true +neoforgeEnabled=false org.gradle.parallel=true org.gradle.workers.max=4 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e382118b0..d706aba60 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.12.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index f6a9cf553..cd6bd15df 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,6 +3,7 @@ pluginManagement { maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.architectury.dev/" } maven { url "https://maven.minecraftforge.net/" } + maven { url "https://maven.pitan76.net/" } gradlePluginPortal() } } From 5cd6a8d174112b370dc99397f82ef5a47abbcaba Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 24 Mar 2026 17:11:19 +0900 Subject: [PATCH 002/151] [cp] feat: add utility methods for converting BlockPos to Vector3i and Vector3d --- .../event/listener/ItemTooltipContext.java | 10 ++++ .../api/event/block/BlockUseEvent.java | 14 +++++ .../event/item/ItemAppendTooltipEvent.java | 5 ++ .../api/event/item/ItemFinishUsingEvent.java | 18 +++++++ .../api/event/item/ItemUseEvent.java | 14 +++++ .../api/event/item/ItemUseOnBlockEvent.java | 18 +++++++ .../api/event/item/ItemUseOnEntityEvent.java | 18 +++++++ .../mcpitanlib/api/event/nbt/NbtRWArgs.java | 4 ++ .../mcpitanlib/api/event/nbt/ReadNbtArgs.java | 8 +++ .../api/event/nbt/WriteNbtArgs.java | 8 +++ .../api/util/entity/ItemEntityUtil.java | 51 +++++++++++++++++++ .../mcpitanlib/midohra/nbt/NbtCompound.java | 9 ++++ .../midohra/util/math/BlockPos.java | 12 +++++ .../midohra/util/math/Vector3i.java | 4 ++ .../mcpitanlib/midohra/world/World.java | 9 ++++ .../mcpitanlib/midohra/world/WorldAccess.java | 4 ++ 16 files changed, 206 insertions(+) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java index 296fd2778..f2ac0da2e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java @@ -4,6 +4,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.tooltip.TooltipType; import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.TextUtil; import java.util.List; @@ -55,4 +57,12 @@ public boolean isAdvanced() { public boolean isCreative() { return type.isCreative(); } + + public void addTooltip(TextComponent textComponent) { + addTooltip(textComponent.getText()); + } + + public void addTooltip(String text) { + addTooltip(TextUtil.literal(text)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java index f6d29de43..9d3b86a2c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java @@ -3,6 +3,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -14,6 +15,7 @@ import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import net.pitan76.mcpitanlib.midohra.world.IWorldView; public class BlockUseEvent extends BaseEvent { @@ -126,4 +128,16 @@ public BlockWrapper getBlockWrapper() { public BlockEntityWrapper getBlockEntityWrapper() { return BlockEntityWrapper.of(getBlockEntity()); } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java index 42cdd42dd..e695b5369 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java @@ -10,6 +10,7 @@ import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; +import net.pitan76.mcpitanlib.api.util.TextUtil; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -92,4 +93,8 @@ public CompatRegistryLookup getRegistryLookup() { public void addTooltip(TextComponent textComponent) { addTooltip(textComponent.getText()); } + + public void addTooltip(String text) { + addTooltip(TextUtil.literal(text)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java index 27f74b53b..6aa476db8 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java @@ -1,9 +1,11 @@ package net.pitan76.mcpitanlib.api.event.item; import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; public class ItemFinishUsingEvent extends BaseEvent { public ItemStack stack; @@ -31,4 +33,20 @@ public LivingEntity getUser() { public boolean isClient() { return world.isClient(); } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public net.pitan76.mcpitanlib.midohra.world.World getWorldM() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java index 66337f066..2f76d9aa6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.api.event.item; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; import net.minecraft.world.World; @@ -10,6 +11,7 @@ import net.pitan76.mcpitanlib.api.util.StackActionResult; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import net.pitan76.mcpitanlib.midohra.world.IWorldView; public class ItemUseEvent extends BaseEvent { @@ -107,4 +109,16 @@ public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { public IWorldView getWorldView() { return getMidohraWorld(); } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java index 65ca89f1d..06e5b9c6b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java @@ -3,6 +3,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsageContext; import net.minecraft.util.Hand; @@ -17,6 +18,7 @@ import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import net.pitan76.mcpitanlib.midohra.world.IWorldView; import org.jetbrains.annotations.Nullable; @@ -137,4 +139,20 @@ public BlockWrapper getBlockWrapper() { public BlockEntityWrapper getBlockEntityWrapper() { return BlockEntityWrapper.of(getBlockEntity()); } + + public boolean isSneaking() { + return player.isSneaking(); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java index 53c2822f4..e2675e4db 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java @@ -2,11 +2,13 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; public class ItemUseOnEntityEvent extends BaseEvent { @@ -64,4 +66,20 @@ public CompatActionResult pass() { public CompatActionResult consume() { return CompatActionResult.CONSUME; } + + public boolean isSneaking() { + return user.isSneaking(); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java index 598e5fa03..7f935aa41 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java @@ -57,4 +57,8 @@ public boolean isEmpty() { public NbtRWArgs copy() { return new NbtRWArgs(nbt.copy(), registryLookup); } + + public net.pitan76.mcpitanlib.midohra.nbt.NbtCompound getNbtM() { + return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(nbt); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java index cc52772e3..70f6e57a3 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java @@ -49,4 +49,12 @@ public boolean isViewEmpty() { public NbtRWArgs copy() { return new ReadNbtArgs(nbt.copy(), view, registryLookup); } + + public ReadNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, CompatRegistryLookup registryLookup) { + this(nbt.toMinecraft(), registryLookup); + } + + public ReadNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { + this(nbt.toMinecraft()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java index 3fbf77b71..1403f1bb9 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java @@ -46,4 +46,12 @@ public boolean isViewEmpty() { public NbtRWArgs copy() { return new WriteNbtArgs(nbt.copy(), view, registryLookup); } + + public WriteNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, CompatRegistryLookup registryLookup) { + this(nbt.toMinecraft(), registryLookup); + } + + public WriteNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { + this(nbt.toMinecraft()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java index 4562d3619..0061565a4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java @@ -8,6 +8,8 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3i; import java.util.List; @@ -65,4 +67,53 @@ public static ItemEntity createWithSpawn(World world, ItemStack stack, double x, public static ItemEntity createWithSpawn(World world, ItemStack stack, BlockPos pos) { return createWithSpawn(world, stack, pos.getX(), pos.getY(), pos.getZ()); } + + public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3d pos) { + return createWithSpawn(world, stack, pos.x, pos.y, pos.z); + } + + public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3i pos) { + return createWithSpawn(world, stack, pos.toCenter()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, double x, double y, double z) { + return createWithSpawn(world.getRaw(), stack, x, y, z); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, BlockPos pos) { + return createWithSpawn(world, stack, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, Vector3i pos) { + return createWithSpawn(world, stack, pos.toCenter()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3d pos) { + return createWithSpawn(world.getRaw(), stack, pos.x, pos.y, pos.z); + } + + public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return createWithSpawn(world, stack, pos.toCenterVector3d()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, double x, double y, double z) { + return createWithSpawn(world.getRaw(), stack.toMinecraft(), x, y, z); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return createWithSpawn(world.getRaw(), stack.toMinecraft(), pos.toRaw()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3d pos) { + return createWithSpawn(world.getRaw(), stack.toMinecraft(), pos.x, pos.y, pos.z); + } + + public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return createWithSpawn(world, stack, pos.toCenterVector3d()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3i pos) { + return createWithSpawn(world, stack, pos.toCenter()); + } + } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java index 6615a06be..38dff8af8 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java @@ -4,6 +4,7 @@ import net.pitan76.mcpitanlib.api.util.NbtUtil; import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import java.util.Optional; import java.util.UUID; @SuppressWarnings("deprecation") @@ -143,4 +144,12 @@ public String toString() { public NbtElement toElement() { return NbtElement.of(nbt); } + + public void putSimpleItemStack(String key, ItemStack stack) { + NbtUtil.putSimpleItemStack(nbt, key, stack.toMinecraft()); + } + + public Optional getSimpleItemStack(String key) { + return NbtUtil.getSimpleItemStack(nbt, key).map(ItemStack::of); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java index bbabe5fe0..657c37939 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java @@ -123,4 +123,16 @@ public BlockPos next() { public long asLong() { return blockPos.asLong(); } + + public Vector3i toVector3i() { + return new Vector3i(getX(), getY(), getZ()); + } + + public Vector3d toVector3d() { + return new Vector3d(getX(), getY(), getZ()); + } + + public Vector3d toCenterVector3d() { + return new Vector3d(getX() + 0.5, getY() + 0.5, getZ() + 0.5); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java index aea2d5ebf..c38d48cf0 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java @@ -224,4 +224,8 @@ public long asLong() { public net.pitan76.mcpitanlib.midohra.util.math.BlockPos toPos() { return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(x, y, z); } + + public Vector3d toCenter() { + return new Vector3d(x + 0.5, y + 0.5, z + 0.5); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java index 3a94bf8ba..ff3bf1da9 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.midohra.world; +import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; @@ -155,4 +156,12 @@ public Optional toServerWorld() { public CompatRegistryLookup getRegistryLookup() { return RegistryLookupUtil.getRegistryLookup(getRaw()); } + + public boolean isAir(BlockPos pos) { + return WorldUtil.isAir(getRaw(), pos.toMinecraft()); + } + + public Block getBlock(BlockPos pos) { + return WorldUtil.getBlock(getRaw(), pos.toMinecraft()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java index 41e35731f..41b4612eb 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -157,4 +157,8 @@ public List getEntitiesByClass(Class entityClass, Box b public List getEntitiesByType(EntityType entityType, Box box) { return getEntitiesByType(entityType, box, EntityPredicates.VALID_ENTITY); } + + public boolean breakBlock(BlockPos pos, boolean drop, Player player) { + return breakBlock(pos, drop, player.getEntity()); + } } From ee79634b0a6cd5e42ca2f3b43279312218e03ebd Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 24 Mar 2026 22:41:31 +0900 Subject: [PATCH 003/151] [cp] feat: add EntityWrapper and ItemEntityWrapper classes with utility methods for entity manipulation --- .../mcpitanlib/api/util/EntityUtil.java | 55 +++ .../api/util/entity/ItemEntityUtil.java | 1 - .../midohra/block/BlockWrapper.java | 30 ++ .../block/entity/BlockEntityWrapper.java | 36 ++ .../midohra/entity/EntityTypeWrapper.java | 26 ++ .../midohra/entity/EntityWrapper.java | 334 ++++++++++++++++++ .../midohra/entity/ItemEntityWrapper.java | 79 +++++ .../midohra/entity/SpawnReason.java | 50 +++ .../mcpitanlib/midohra/item/ItemStack.java | 45 +++ .../mcpitanlib/midohra/item/ItemWrapper.java | 50 +++ .../mcpitanlib/midohra/world/WorldAccess.java | 27 ++ 11 files changed, 732 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java index eaf347e08..a6732a34a 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java @@ -3,6 +3,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.network.packet.s2c.play.PositionFlag; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.Text; import net.minecraft.util.BlockRotation; @@ -306,4 +307,58 @@ public static void addVelocity(Entity entity, Vector3d velocity) { addVelocity(entity, velocity.toMinecraft()); } + public static void setVelocity(Entity entity, Vector3d velocity) { + entity.setVelocity(velocity.toMinecraft()); + } + + public static void setPos(Entity entity, BlockPos pos) { + setPos(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void setPos(Entity entity, Vector3d pos) { + setPos(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + entity.teleport(world, x, y, z, PositionFlag.VALUES, yaw, pitch, resetCamera); + } + + public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch) { + teleport(entity, world, x, y, z, yaw, pitch, true); + } + + public static void teleport(Entity entity, ServerWorld world, double x, double y, double z) { + teleport(entity, world, x, y, z, entity.getYaw(), entity.getPitch(), true); + } + + public static void teleport(Entity entity, ServerWorld world, Vector3d pos) { + teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, ServerWorld world, BlockPos pos) { + teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, double x, double y, double z) { + if (entity.getEntityWorld() instanceof ServerWorld) + return; + + teleport(entity, (ServerWorld) entity.getEntityWorld(), x, y, z, entity.getYaw(), entity.getPitch()); + } + + public static void teleport(Entity entity, Vector3d pos) { + teleport(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, BlockPos pos) { + teleport(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, ServerWorld world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { + teleport(entity, world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); + } + + public static void teleport(Entity entity, ServerWorld raw, BlockPos pos, float yaw, float pitch, boolean resetCamera) { + teleport(entity, raw, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java index 0061565a4..5686c1bee 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java @@ -115,5 +115,4 @@ public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra. public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3i pos) { return createWithSpawn(world, stack, pos.toCenter()); } - } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java index 9b0a7b54a..d54771d9e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -1,10 +1,14 @@ package net.pitan76.mcpitanlib.midohra.block; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.block.BlockUtil; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlock; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import org.jetbrains.annotations.Nullable; +import java.util.Optional; + public class BlockWrapper { private final net.minecraft.block.Block block; @@ -103,4 +107,30 @@ public boolean equals(Object obj) { BlockWrapper other = (BlockWrapper) obj; return rawEquals(other); } + + public static BlockWrapper of(String id) { + return of(CompatIdentifier.of(id)); + } + + public static BlockWrapper of(String namespace, String path) { + return of(CompatIdentifier.of(namespace, path)); + } + + public static BlockWrapper of(CompatBlock block) { + return of((net.minecraft.block.Block) block); + } + + public Optional toCompatBlock() { + if (get() instanceof CompatBlock) { + return Optional.of((CompatBlock) get()); + } + return Optional.empty(); + } + + public Optional toBuiltBlock() { + if (get() instanceof BuiltBlock) { + return Optional.of((BuiltBlock) get()); + } + return Optional.empty(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java index 5b3ab35a0..7b3ac02d8 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java @@ -1,14 +1,18 @@ package net.pitan76.mcpitanlib.midohra.block.entity; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockEntity; import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.world.World; +import java.util.Optional; + public class BlockEntityWrapper { private final net.minecraft.block.entity.BlockEntity blockEntity; @@ -94,4 +98,36 @@ public void writeNbt(NbtCompound nbt) { public void readNbt(NbtCompound nbt) { readNbt(nbt, RegistryLookupUtil.getRegistryLookup(get())); } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + BlockEntityWrapper blockEntity = (BlockEntityWrapper) obj; + return get() == blockEntity.get(); + } + + public static BlockEntityWrapper of(BlockPos pos, World world) { + net.minecraft.block.entity.BlockEntity blockEntity = BlockEntityUtil.getBlockEntity(world.toMinecraft(), pos.toMinecraft()); + return of(blockEntity); + } + + public Optional toCompatBlockEntity() { + if (get() instanceof CompatBlockEntity) { + return Optional.of((CompatBlockEntity) get()); + } + return Optional.empty(); + } + + public Optional toBuiltBlockEntity() { + if (get() instanceof BuiltBlockEntity) { + return Optional.of((BuiltBlockEntity) get()); + } + return Optional.empty(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java index af0d640c8..d8a931e3c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java @@ -1,8 +1,14 @@ package net.pitan76.mcpitanlib.midohra.entity; +import net.minecraft.entity.Entity; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.EntityTypeUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import org.jspecify.annotations.Nullable; + +import java.util.function.Consumer; public class EntityTypeWrapper { private final net.minecraft.entity.EntityType entityType; @@ -66,4 +72,24 @@ public boolean equals(Object obj) { EntityTypeWrapper other = (EntityTypeWrapper) obj; return rawEquals(other); } + + public EntityWrapper createEntity(ServerWorld world, SpawnReason spawnReason) { + if (isEmpty()) return EntityWrapper.of(); + return EntityWrapper.of(get().create(world.getRaw(), spawnReason.getRaw())); + } + + public EntityWrapper createEntity(ServerWorld world) { + return createEntity(world, SpawnReason.NATURAL); + } + + public EntityWrapper createEntity(ServerWorld world, @Nullable Consumer afterConsumer, BlockPos pos, SpawnReason reason, boolean alignPosition, boolean invertY) { + if (isEmpty()) return EntityWrapper.of(); + + Consumer consumer = afterConsumer != null ? entity -> { + EntityWrapper wrapper = EntityWrapper.of((Entity) entity); + afterConsumer.accept(wrapper); + } : null; + + return EntityWrapper.of(get().create(world.getRaw(), consumer, pos.toMinecraft(), reason.getRaw(), alignPosition, invertY)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java new file mode 100644 index 000000000..5a019773e --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java @@ -0,0 +1,334 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.pitan76.mcpitanlib.api.entity.CompatEntity; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.EntityUtil; +import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import net.pitan76.mcpitanlib.midohra.world.World; + +import java.util.Optional; +import java.util.UUID; + +public class EntityWrapper { + private final net.minecraft.entity.Entity entity; + + public static final EntityWrapper EMPTY = new EntityWrapper(null); + + protected EntityWrapper() { + this.entity = null; + } + + protected EntityWrapper(net.minecraft.entity.Entity entity) { + this.entity = entity; + } + + public static EntityWrapper of(net.minecraft.entity.Entity entity) { + return new EntityWrapper(entity); + } + + public static EntityWrapper of() { + return EMPTY; + } + + public boolean isPresent() { + return !isEmpty(); + } + + public boolean isEmpty() { + return get() == null; + } + + public net.minecraft.entity.Entity get() { + return entity; + } + + public EntityTypeWrapper getType() { + return EntityTypeWrapper.of(get().getType()); + } + + public Vector3d getPos() { + return EntityUtil.getPosM(get()); + } + + public void setPos(double x, double y, double z) { + EntityUtil.setPos(get(), x, y, z); + } + + public void setPos(Vector3d pos) { + EntityUtil.setPos(get(), pos); + } + + public void setPos(BlockPos pos) { + EntityUtil.setPos(get(), pos); + } + + public void teleport(double x, double y, double z) { + EntityUtil.teleport(get(), x, y, z); + } + + public void teleport(Vector3d pos) { + EntityUtil.teleport(get(), pos); + } + + public void teleport(BlockPos pos) { + EntityUtil.teleport(get(), pos); + } + + public void teleport(ServerWorld world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + EntityUtil.teleport(get(), world.getRaw(), x, y, z, yaw, pitch, resetCamera); + } + + public void teleport(ServerWorld world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { + EntityUtil.teleport(get(), world.getRaw(), pos, yaw, pitch, resetCamera); + } + + public void teleport(ServerWorld world, BlockPos pos, float yaw, float pitch, boolean resetCamera) { + EntityUtil.teleport(get(), world.getRaw(), pos, yaw, pitch, resetCamera); + } + + public void teleport(ServerWorld world, double x, double y, double z) { + EntityUtil.teleport(get(), world.getRaw(), x, y, z); + } + + public void teleport(ServerWorld world, Vector3d pos) { + EntityUtil.teleport(get(), world.getRaw(), pos); + } + + public void teleport(ServerWorld world, BlockPos pos) { + EntityUtil.teleport(get(), world.getRaw(), pos); + } + + public BlockPos getBlockPos() { + return BlockPos.of(get().getBlockPos()); + } + + public World getWorld() { + return World.of(EntityUtil.getWorld(get())); + } + + public boolean isRemoved() { + return get().isRemoved(); + } + + public void discard() { + EntityUtil.discard(get()); + } + + public void kill() { + EntityUtil.kill(get()); + } + + public float getPitch() { + return EntityUtil.getPitch(get()); + } + + public float getYaw() { + return EntityUtil.getYaw(get()); + } + + public float getSpeed() { + return EntityUtil.getSpeed(get()); + } + + public TextComponent getCustomName() { + return new TextComponent(EntityUtil.getCustomName(get())); + } + + public TextComponent getName() { + return new TextComponent(EntityUtil.getName(get())); + } + + public String getNameAsString() { + return EntityUtil.getNameAsString(get()); + } + + public String getCustomNameAsString() { + return EntityUtil.getCustomNameAsString(get()); + } + + public UUID getUuid() { + return EntityUtil.getUuid(get()); + } + + public String getUuidString() { + return EntityUtil.getUuidString(get()); + } + + public boolean isSneaking() { + return EntityUtil.isSneaking(get()); + } + + public boolean isSprinting() { + return EntityUtil.isSprinting(get()); + } + + public boolean isSwimming() { + return EntityUtil.isSwimming(get()); + } + + public boolean isAlive() { + return EntityUtil.isAlive(get()); + } + + public boolean isOnGround() { + return EntityUtil.isOnGround(get()); + } + + public boolean isGlowing() { + return EntityUtil.isGlowing(get()); + } + + public boolean isInvisible() { + return EntityUtil.isInvisible(get()); + } + + public boolean isInvulnerable() { + return EntityUtil.isInvulnerable(get()); + } + + public boolean isSilent() { + return EntityUtil.isSilent(get()); + } + + public boolean isOnFire() { + return EntityUtil.isOnFire(get()); + } + + public boolean isRiding() { + return EntityUtil.isRiding(get()); + } + + public boolean isVelocityModified() { + return EntityUtil.isVelocityModified(get()); + } + + public boolean isCustomNameVisible() { + return EntityUtil.isCustomNameVisible(get()); + } + + public TextComponent getDisplayName() { + return new TextComponent(EntityUtil.getDisplayName(get())); + } + + public double getFallDistance() { + return EntityUtil.getFallDistance(get()); + } + + public boolean isLivingEntity() { + return get() instanceof LivingEntity; + } + + public boolean damageByMobAttack(float damageAmount, EntityWrapper source, EntityWrapper attacker) { + return EntityUtil.damageWithMobAttack(get(), damageAmount, source.get(), (LivingEntity) attacker.get()); + } + + public boolean damageByPlayerAttack(float damageAmount, EntityWrapper source, Player attacker) { + return EntityUtil.damageWithPlayerAttack(get(), damageAmount, source.get(), attacker); + } + + public boolean damageWithThrownProjectile(float damageAmount, EntityWrapper source, EntityWrapper projectile) { + return EntityUtil.damageWithThrownProjectile(get(), damageAmount, source.get(), projectile.get()); + } + + public boolean damageWithMobProjectile(float damageAmount, EntityWrapper projectile, EntityWrapper attacker) { + return EntityUtil.damageWithMobProjectile(get(), damageAmount, projectile.get(), (LivingEntity) attacker.get()); + } + + public boolean setVelocity(double x, double y, double z) { + EntityUtil.setVelocity(get(), x, y, z); + return true; + } + + public void setVelocity(Vector3d velocity) { + EntityUtil.setVelocity(get(), velocity); + } + + public void addVelocity(double x, double y, double z) { + EntityUtil.addVelocity(get(), x, y, z); + } + + public void addVelocity(Vector3d velocity) { + EntityUtil.addVelocity(get(), velocity); + } + + public Vector3d getVelocity() { + return Vector3d.of(EntityUtil.getVelocity(get())); + } + + public boolean setCustomName(TextComponent name) { + EntityUtil.setCustomName(get(), name.getText()); + return true; + } + + public boolean setInvulnerable(boolean invulnerable) { + EntityUtil.setInvulnerable(get(), invulnerable); + return true; + } + + public boolean setNoGravity(boolean noGravity) { + EntityUtil.setNoGravity(get(), noGravity); + return true; + } + + public boolean setGlowing(boolean glowing) { + EntityUtil.setGlowing(get(), glowing); + return true; + } + + public boolean setInvisible(boolean invisible) { + EntityUtil.setInvisible(get(), invisible); + return true; + } + + public boolean setSilent(boolean silent) { + EntityUtil.setSilent(get(), silent); + return true; + } + + public boolean setFire(int seconds) { + EntityUtil.setFire(get(), seconds); + return true; + } + + public boolean setCustomNameVisible(boolean visible) { + EntityUtil.setCustomNameVisible(get(), visible); + return true; + } + + public EntityWrapper getVehicle() { + return EntityWrapper.of(get().getVehicle()); + } + + public EntityWrapper getRootVehicle() { + return EntityWrapper.of(get().getRootVehicle()); + } + + public EntityWrapper getPassenger(int index) { + return EntityWrapper.of(get().getPassengerList().get(index)); + } + + public int getPassengerCount() { + return get().getPassengerList().size(); + } + + public Class getEntityClass() { + return get().getClass(); + } + + public Optional toCompatEntity() { + if (get() instanceof CompatEntity) { + return Optional.of((CompatEntity) get()); + } + return Optional.empty(); + } + + public void spawn(World world) { + world.spawnEntity(this); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java new file mode 100644 index 000000000..0336723b2 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java @@ -0,0 +1,79 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class ItemEntityWrapper extends EntityWrapper { + public ItemEntityWrapper(net.minecraft.entity.ItemEntity entity) { + super(entity); + } + + public static ItemEntityWrapper of(net.minecraft.entity.ItemEntity entity) { + return new ItemEntityWrapper(entity); + } + + @Override + public net.minecraft.entity.ItemEntity get() { + return (net.minecraft.entity.ItemEntity) super.get(); + } + + public net.minecraft.item.ItemStack getStackRaw() { + return ItemEntityUtil.getStack(get()); + } + + public ItemStack getStack() { + return ItemStack.of(getStackRaw()); + } + + public void setStack(net.minecraft.item.ItemStack stack) { + get().setStack(stack); + } + + public void setStack(ItemStack stack) { + setStack(stack.toMinecraft()); + } + + public ItemWrapper getItem() { + return getStack().getItem(); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, double x, double y, double z) { + return of(ItemEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft())); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, Vector3d pos) { + return create(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + return of(ItemEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft(), velocityX, velocityY, velocityZ)); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, Vector3d pos, Vector3d velocity) { + return create(stack, world, pos.getX(), pos.getY(), pos.getZ(), velocity.getX(), velocity.getY(), velocity.getZ()); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, BlockPos pos) { + return create(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, double x, double y, double z) { + return of(ItemEntityUtil.createWithSpawn(world.toMinecraft(), stack.toMinecraft(), x, y, z)); + } + + public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, Vector3d pos) { + return createWithSpawn(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, BlockPos pos) { + return createWithSpawn(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public void setToDefaultPickupDelay() { + ItemEntityUtil.setToDefaultPickupDelay(get()); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java new file mode 100644 index 000000000..c5fe6a6d3 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +public class SpawnReason { + private final net.minecraft.entity.SpawnReason raw; + + public static final SpawnReason NATURAL = of(net.minecraft.entity.SpawnReason.NATURAL); + public static final SpawnReason CHUNK_GENERATION = of(net.minecraft.entity.SpawnReason.CHUNK_GENERATION); + public static final SpawnReason SPAWNER = of(net.minecraft.entity.SpawnReason.SPAWNER); + public static final SpawnReason STRUCTURE = of(net.minecraft.entity.SpawnReason.STRUCTURE); + public static final SpawnReason BREEDING = of(net.minecraft.entity.SpawnReason.BREEDING); + public static final SpawnReason MOB_SUMMONED = of(net.minecraft.entity.SpawnReason.MOB_SUMMONED); + public static final SpawnReason JOCKEY = of(net.minecraft.entity.SpawnReason.JOCKEY); + public static final SpawnReason EVENT = of(net.minecraft.entity.SpawnReason.EVENT); + public static final SpawnReason CONVERSION = of(net.minecraft.entity.SpawnReason.CONVERSION); + public static final SpawnReason REINFORCEMENT = of(net.minecraft.entity.SpawnReason.REINFORCEMENT); + public static final SpawnReason TRIGGERED = of(net.minecraft.entity.SpawnReason.TRIGGERED); + public static final SpawnReason BUCKET = of(net.minecraft.entity.SpawnReason.BUCKET); + public static final SpawnReason SPAWN_ITEM_USE = of(net.minecraft.entity.SpawnReason.SPAWN_ITEM_USE); + public static final SpawnReason COMMAND = of(net.minecraft.entity.SpawnReason.COMMAND); + public static final SpawnReason DISPENSER = of(net.minecraft.entity.SpawnReason.DISPENSER); + public static final SpawnReason PATROL = of(net.minecraft.entity.SpawnReason.PATROL); + public static final SpawnReason TRIAL_SPAWNER = of(net.minecraft.entity.SpawnReason.TRIAL_SPAWNER); + public static final SpawnReason LOAD = of(net.minecraft.entity.SpawnReason.LOAD); + public static final SpawnReason DIMENSION_TRAVEL = of(net.minecraft.entity.SpawnReason.DIMENSION_TRAVEL); + + protected SpawnReason(net.minecraft.entity.SpawnReason raw) { + this.raw = raw; + } + + public static SpawnReason of(net.minecraft.entity.SpawnReason raw) { + return new SpawnReason(raw); + } + + public net.minecraft.entity.SpawnReason getRaw() { + return raw; + } + + @Override + public int hashCode() { + return raw.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + SpawnReason other = (SpawnReason) obj; + return raw == other.raw; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java index 5081a2cb0..4bf936e58 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java @@ -7,6 +7,7 @@ import net.minecraft.world.World; import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.*; import org.jetbrains.annotations.Nullable; @@ -174,4 +175,48 @@ public ItemStack build() { public String toString() { return stack.toString(); } + + public void increment(int amount) { + ItemStackUtil.incrementCount(stack, amount); + } + + public void decrement(int amount) { + ItemStackUtil.decrementCount(stack, amount); + } + + public void increment() { + increment(1); + } + + public void decrement() { + decrement(1); + } + + public boolean is(ItemWrapper item) { + return getRawItem() == item.get(); + } + + public boolean is(CompatIdentifier id) { + return getItemId().equals(id); + } + + public boolean isBlockItem() { + return getItem().isBlock(); + } + + public net.pitan76.mcpitanlib.midohra.nbt.NbtCompound getCustomNbtM() { + return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(getCustomNbt()); + } + + public void setCustomNbt(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { + setCustomNbt(nbt.toMinecraft()); + } + + public void setLoreM(List lore) { + LoreUtil.setLore(stack, lore.stream().map(TextComponent::getText).toList()); + } + + public List getLoreM() { + return getLore().stream().map(TextComponent::new).toList(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java index c16fc5f0f..1476e2b26 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java @@ -1,11 +1,15 @@ package net.pitan76.mcpitanlib.midohra.item; +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import net.pitan76.mcpitanlib.api.util.item.ItemUtil; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltItem; import org.jetbrains.annotations.Nullable; +import java.util.Optional; + public class ItemWrapper { private final net.minecraft.item.Item item; @@ -108,4 +112,50 @@ public BlockWrapper asBlock() { public boolean rawEquals(ItemWrapper item) { return get() == item.get(); } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + ItemWrapper item = (ItemWrapper) obj; + return rawEquals(item); + } + + public static ItemWrapper of(BlockWrapper block) { + if (block.isEmpty()) + return of(); + + return of(block.asItem().get()); + } + + public static ItemWrapper of(String id) { + return of(CompatIdentifier.of(id)); + } + + public static ItemWrapper of(String namespace, String path) { + return of(CompatIdentifier.of(namespace, path)); + } + + public static ItemWrapper of(CompatItem item) { + return of((net.minecraft.item.Item) item); + } + + public Optional toCompatItem() { + if (get() instanceof CompatItem) { + return Optional.of((CompatItem) get()); + } + return Optional.empty(); + } + + public Optional toBuiltItem() { + if (get() instanceof BuiltItem) { + return Optional.of((BuiltItem) get()); + } + return Optional.empty(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java index 41b4612eb..5635acba5 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -18,6 +18,7 @@ import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; import net.pitan76.mcpitanlib.midohra.server.MCServer; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.util.math.Box; @@ -161,4 +162,30 @@ public List getEntitiesByType(EntityType entityType, Bo public boolean breakBlock(BlockPos pos, boolean drop, Player player) { return breakBlock(pos, drop, player.getEntity()); } + + public List getEntitiesByTypeM(EntityTypeWrapper entityType, Box box, Predicate predicate) { + return getEntitiesByType(entityType.get(), box, (e) -> predicate.test(EntityWrapper.of(e))) + .stream().map(EntityWrapper::of).toList(); + } + + public List getEntitiesByTypeM(EntityTypeWrapper entityType, Box box) { + return getEntitiesByType(entityType.get(), box).stream().map(EntityWrapper::of).toList(); + } + + public List getEntitiesByClassM(Class entityClass, Box box, Predicate predicate) { + return getEntitiesByClass((Class) entityClass, box, (e) -> predicate.test(EntityWrapper.of(e))) + .stream().map(EntityWrapper::of).toList(); + } + + public List getEntitiesByClassM(Class entityClass, Box box) { + return getEntitiesByClass((Class) entityClass, box).stream().map(EntityWrapper::of).toList(); + } + + public void spawnEntity(Entity entity) { + getRaw().spawnEntity(entity); + } + + public void spawnEntity(EntityWrapper entity) { + spawnEntity(entity.get()); + } } From 3560fbdfc2c25ab980c0bf05a532342b6ce1eaac Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 24 Mar 2026 23:06:29 +0900 Subject: [PATCH 004/151] [cp] feat: add Blocks, Items --- .../mcpitanlib/midohra/block/Blocks.java | 771 ++++++++++++++ .../mcpitanlib/midohra/item/Items.java | 976 +++++++++++++++++- 2 files changed, 1741 insertions(+), 6 deletions(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java new file mode 100644 index 000000000..d74b93eba --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java @@ -0,0 +1,771 @@ +package net.pitan76.mcpitanlib.midohra.block; + +public class Blocks { + public static BlockWrapper AIR = of(net.minecraft.block.Blocks.AIR); + public static BlockWrapper STONE = of(net.minecraft.block.Blocks.STONE); + public static BlockWrapper GRANITE = of(net.minecraft.block.Blocks.GRANITE); + public static BlockWrapper POLISHED_GRANITE = of(net.minecraft.block.Blocks.POLISHED_GRANITE); + public static BlockWrapper DIORITE = of(net.minecraft.block.Blocks.DIORITE); + public static BlockWrapper POLISHED_DIORITE = of(net.minecraft.block.Blocks.POLISHED_DIORITE); + public static BlockWrapper ANDESITE = of(net.minecraft.block.Blocks.ANDESITE); + public static BlockWrapper POLISHED_ANDESITE = of(net.minecraft.block.Blocks.POLISHED_ANDESITE); + public static BlockWrapper GRASS_BLOCK = of(net.minecraft.block.Blocks.GRASS_BLOCK); + public static BlockWrapper DIRT = of(net.minecraft.block.Blocks.DIRT); + public static BlockWrapper COARSE_DIRT = of(net.minecraft.block.Blocks.COARSE_DIRT); + public static BlockWrapper PODZOL = of(net.minecraft.block.Blocks.PODZOL); + public static BlockWrapper COBBLESTONE = of(net.minecraft.block.Blocks.COBBLESTONE); + public static BlockWrapper OAK_PLANKS = of(net.minecraft.block.Blocks.OAK_PLANKS); + public static BlockWrapper SPRUCE_PLANKS = of(net.minecraft.block.Blocks.SPRUCE_PLANKS); + public static BlockWrapper BIRCH_PLANKS = of(net.minecraft.block.Blocks.BIRCH_PLANKS); + public static BlockWrapper JUNGLE_PLANKS = of(net.minecraft.block.Blocks.JUNGLE_PLANKS); + public static BlockWrapper ACACIA_PLANKS = of(net.minecraft.block.Blocks.ACACIA_PLANKS); + public static BlockWrapper DARK_OAK_PLANKS = of(net.minecraft.block.Blocks.DARK_OAK_PLANKS); + public static BlockWrapper OAK_SAPLING = of(net.minecraft.block.Blocks.OAK_SAPLING); + public static BlockWrapper SPRUCE_SAPLING = of(net.minecraft.block.Blocks.SPRUCE_SAPLING); + public static BlockWrapper BIRCH_SAPLING = of(net.minecraft.block.Blocks.BIRCH_SAPLING); + public static BlockWrapper JUNGLE_SAPLING = of(net.minecraft.block.Blocks.JUNGLE_SAPLING); + public static BlockWrapper ACACIA_SAPLING = of(net.minecraft.block.Blocks.ACACIA_SAPLING); + public static BlockWrapper DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.DARK_OAK_SAPLING); + public static BlockWrapper BEDROCK = of(net.minecraft.block.Blocks.BEDROCK); + public static BlockWrapper WATER = of(net.minecraft.block.Blocks.WATER); + public static BlockWrapper LAVA = of(net.minecraft.block.Blocks.LAVA); + public static BlockWrapper SAND = of(net.minecraft.block.Blocks.SAND); + public static BlockWrapper RED_SAND = of(net.minecraft.block.Blocks.RED_SAND); + public static BlockWrapper GRAVEL = of(net.minecraft.block.Blocks.GRAVEL); + public static BlockWrapper GOLD_ORE = of(net.minecraft.block.Blocks.GOLD_ORE); + public static BlockWrapper IRON_ORE = of(net.minecraft.block.Blocks.IRON_ORE); + public static BlockWrapper COAL_ORE = of(net.minecraft.block.Blocks.COAL_ORE); + public static BlockWrapper NETHER_GOLD_ORE = of(net.minecraft.block.Blocks.NETHER_GOLD_ORE); + public static BlockWrapper OAK_LOG = of(net.minecraft.block.Blocks.OAK_LOG); + public static BlockWrapper SPRUCE_LOG = of(net.minecraft.block.Blocks.SPRUCE_LOG); + public static BlockWrapper BIRCH_LOG = of(net.minecraft.block.Blocks.BIRCH_LOG); + public static BlockWrapper JUNGLE_LOG = of(net.minecraft.block.Blocks.JUNGLE_LOG); + public static BlockWrapper ACACIA_LOG = of(net.minecraft.block.Blocks.ACACIA_LOG); + public static BlockWrapper DARK_OAK_LOG = of(net.minecraft.block.Blocks.DARK_OAK_LOG); + public static BlockWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_LOG); + public static BlockWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_LOG); + public static BlockWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_LOG); + public static BlockWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_LOG); + public static BlockWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_LOG); + public static BlockWrapper STRIPPED_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_OAK_LOG); + public static BlockWrapper OAK_WOOD = of(net.minecraft.block.Blocks.OAK_WOOD); + public static BlockWrapper SPRUCE_WOOD = of(net.minecraft.block.Blocks.SPRUCE_WOOD); + public static BlockWrapper BIRCH_WOOD = of(net.minecraft.block.Blocks.BIRCH_WOOD); + public static BlockWrapper JUNGLE_WOOD = of(net.minecraft.block.Blocks.JUNGLE_WOOD); + public static BlockWrapper ACACIA_WOOD = of(net.minecraft.block.Blocks.ACACIA_WOOD); + public static BlockWrapper DARK_OAK_WOOD = of(net.minecraft.block.Blocks.DARK_OAK_WOOD); + public static BlockWrapper STRIPPED_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_OAK_WOOD); + public static BlockWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_WOOD); + public static BlockWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_WOOD); + public static BlockWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_WOOD); + public static BlockWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_WOOD); + public static BlockWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_WOOD); + public static BlockWrapper OAK_LEAVES = of(net.minecraft.block.Blocks.OAK_LEAVES); + public static BlockWrapper SPRUCE_LEAVES = of(net.minecraft.block.Blocks.SPRUCE_LEAVES); + public static BlockWrapper BIRCH_LEAVES = of(net.minecraft.block.Blocks.BIRCH_LEAVES); + public static BlockWrapper JUNGLE_LEAVES = of(net.minecraft.block.Blocks.JUNGLE_LEAVES); + public static BlockWrapper ACACIA_LEAVES = of(net.minecraft.block.Blocks.ACACIA_LEAVES); + public static BlockWrapper DARK_OAK_LEAVES = of(net.minecraft.block.Blocks.DARK_OAK_LEAVES); + public static BlockWrapper SPONGE = of(net.minecraft.block.Blocks.SPONGE); + public static BlockWrapper WET_SPONGE = of(net.minecraft.block.Blocks.WET_SPONGE); + public static BlockWrapper GLASS = of(net.minecraft.block.Blocks.GLASS); + public static BlockWrapper LAPIS_ORE = of(net.minecraft.block.Blocks.LAPIS_ORE); + public static BlockWrapper LAPIS_BLOCK = of(net.minecraft.block.Blocks.LAPIS_BLOCK); + public static BlockWrapper DISPENSER = of(net.minecraft.block.Blocks.DISPENSER); + public static BlockWrapper SANDSTONE = of(net.minecraft.block.Blocks.SANDSTONE); + public static BlockWrapper CHISELED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_SANDSTONE); + public static BlockWrapper CUT_SANDSTONE = of(net.minecraft.block.Blocks.CUT_SANDSTONE); + public static BlockWrapper NOTE_BLOCK = of(net.minecraft.block.Blocks.NOTE_BLOCK); + public static BlockWrapper WHITE_BED = of(net.minecraft.block.Blocks.WHITE_BED); + public static BlockWrapper ORANGE_BED = of(net.minecraft.block.Blocks.ORANGE_BED); + public static BlockWrapper MAGENTA_BED = of(net.minecraft.block.Blocks.MAGENTA_BED); + public static BlockWrapper LIGHT_BLUE_BED = of(net.minecraft.block.Blocks.LIGHT_BLUE_BED); + public static BlockWrapper YELLOW_BED = of(net.minecraft.block.Blocks.YELLOW_BED); + public static BlockWrapper LIME_BED = of(net.minecraft.block.Blocks.LIME_BED); + public static BlockWrapper PINK_BED = of(net.minecraft.block.Blocks.PINK_BED); + public static BlockWrapper GRAY_BED = of(net.minecraft.block.Blocks.GRAY_BED); + public static BlockWrapper LIGHT_GRAY_BED = of(net.minecraft.block.Blocks.LIGHT_GRAY_BED); + public static BlockWrapper CYAN_BED = of(net.minecraft.block.Blocks.CYAN_BED); + public static BlockWrapper PURPLE_BED = of(net.minecraft.block.Blocks.PURPLE_BED); + public static BlockWrapper BLUE_BED = of(net.minecraft.block.Blocks.BLUE_BED); + public static BlockWrapper BROWN_BED = of(net.minecraft.block.Blocks.BROWN_BED); + public static BlockWrapper GREEN_BED = of(net.minecraft.block.Blocks.GREEN_BED); + public static BlockWrapper RED_BED = of(net.minecraft.block.Blocks.RED_BED); + public static BlockWrapper BLACK_BED = of(net.minecraft.block.Blocks.BLACK_BED); + public static BlockWrapper POWERED_RAIL = of(net.minecraft.block.Blocks.POWERED_RAIL); + public static BlockWrapper DETECTOR_RAIL = of(net.minecraft.block.Blocks.DETECTOR_RAIL); + public static BlockWrapper STICKY_PISTON = of(net.minecraft.block.Blocks.STICKY_PISTON); + public static BlockWrapper COBWEB = of(net.minecraft.block.Blocks.COBWEB); + public static BlockWrapper GRASS = of(net.minecraft.block.Blocks.GRASS); + public static BlockWrapper FERN = of(net.minecraft.block.Blocks.FERN); + public static BlockWrapper DEAD_BUSH = of(net.minecraft.block.Blocks.DEAD_BUSH); + public static BlockWrapper SEAGRASS = of(net.minecraft.block.Blocks.SEAGRASS); + public static BlockWrapper TALL_SEAGRASS = of(net.minecraft.block.Blocks.TALL_SEAGRASS); + public static BlockWrapper PISTON = of(net.minecraft.block.Blocks.PISTON); + public static BlockWrapper PISTON_HEAD = of(net.minecraft.block.Blocks.PISTON_HEAD); + public static BlockWrapper WHITE_WOOL = of(net.minecraft.block.Blocks.WHITE_WOOL); + public static BlockWrapper ORANGE_WOOL = of(net.minecraft.block.Blocks.ORANGE_WOOL); + public static BlockWrapper MAGENTA_WOOL = of(net.minecraft.block.Blocks.MAGENTA_WOOL); + public static BlockWrapper LIGHT_BLUE_WOOL = of(net.minecraft.block.Blocks.LIGHT_BLUE_WOOL); + public static BlockWrapper YELLOW_WOOL = of(net.minecraft.block.Blocks.YELLOW_WOOL); + public static BlockWrapper LIME_WOOL = of(net.minecraft.block.Blocks.LIME_WOOL); + public static BlockWrapper PINK_WOOL = of(net.minecraft.block.Blocks.PINK_WOOL); + public static BlockWrapper GRAY_WOOL = of(net.minecraft.block.Blocks.GRAY_WOOL); + public static BlockWrapper LIGHT_GRAY_WOOL = of(net.minecraft.block.Blocks.LIGHT_GRAY_WOOL); + public static BlockWrapper CYAN_WOOL = of(net.minecraft.block.Blocks.CYAN_WOOL); + public static BlockWrapper PURPLE_WOOL = of(net.minecraft.block.Blocks.PURPLE_WOOL); + public static BlockWrapper BLUE_WOOL = of(net.minecraft.block.Blocks.BLUE_WOOL); + public static BlockWrapper BROWN_WOOL = of(net.minecraft.block.Blocks.BROWN_WOOL); + public static BlockWrapper GREEN_WOOL = of(net.minecraft.block.Blocks.GREEN_WOOL); + public static BlockWrapper RED_WOOL = of(net.minecraft.block.Blocks.RED_WOOL); + public static BlockWrapper BLACK_WOOL = of(net.minecraft.block.Blocks.BLACK_WOOL); + public static BlockWrapper MOVING_PISTON = of(net.minecraft.block.Blocks.MOVING_PISTON); + public static BlockWrapper DANDELION = of(net.minecraft.block.Blocks.DANDELION); + public static BlockWrapper POPPY = of(net.minecraft.block.Blocks.POPPY); + public static BlockWrapper BLUE_ORCHID = of(net.minecraft.block.Blocks.BLUE_ORCHID); + public static BlockWrapper ALLIUM = of(net.minecraft.block.Blocks.ALLIUM); + public static BlockWrapper AZURE_BLUET = of(net.minecraft.block.Blocks.AZURE_BLUET); + public static BlockWrapper RED_TULIP = of(net.minecraft.block.Blocks.RED_TULIP); + public static BlockWrapper ORANGE_TULIP = of(net.minecraft.block.Blocks.ORANGE_TULIP); + public static BlockWrapper WHITE_TULIP = of(net.minecraft.block.Blocks.WHITE_TULIP); + public static BlockWrapper PINK_TULIP = of(net.minecraft.block.Blocks.PINK_TULIP); + public static BlockWrapper OXEYE_DAISY = of(net.minecraft.block.Blocks.OXEYE_DAISY); + public static BlockWrapper CORNFLOWER = of(net.minecraft.block.Blocks.CORNFLOWER); + public static BlockWrapper WITHER_ROSE = of(net.minecraft.block.Blocks.WITHER_ROSE); + public static BlockWrapper LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.LILY_OF_THE_VALLEY); + public static BlockWrapper BROWN_MUSHROOM = of(net.minecraft.block.Blocks.BROWN_MUSHROOM); + public static BlockWrapper RED_MUSHROOM = of(net.minecraft.block.Blocks.RED_MUSHROOM); + public static BlockWrapper GOLD_BLOCK = of(net.minecraft.block.Blocks.GOLD_BLOCK); + public static BlockWrapper IRON_BLOCK = of(net.minecraft.block.Blocks.IRON_BLOCK); + public static BlockWrapper BRICKS = of(net.minecraft.block.Blocks.BRICKS); + public static BlockWrapper TNT = of(net.minecraft.block.Blocks.TNT); + public static BlockWrapper BOOKSHELF = of(net.minecraft.block.Blocks.BOOKSHELF); + public static BlockWrapper MOSSY_COBBLESTONE = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE); + public static BlockWrapper OBSIDIAN = of(net.minecraft.block.Blocks.OBSIDIAN); + public static BlockWrapper TORCH = of(net.minecraft.block.Blocks.TORCH); + public static BlockWrapper WALL_TORCH = of(net.minecraft.block.Blocks.WALL_TORCH); + public static BlockWrapper FIRE = of(net.minecraft.block.Blocks.FIRE); + public static BlockWrapper SOUL_FIRE = of(net.minecraft.block.Blocks.SOUL_FIRE); + public static BlockWrapper SPAWNER = of(net.minecraft.block.Blocks.SPAWNER); + public static BlockWrapper OAK_STAIRS = of(net.minecraft.block.Blocks.OAK_STAIRS); + public static BlockWrapper CHEST = of(net.minecraft.block.Blocks.CHEST); + public static BlockWrapper REDSTONE_WIRE = of(net.minecraft.block.Blocks.REDSTONE_WIRE); + public static BlockWrapper DIAMOND_ORE = of(net.minecraft.block.Blocks.DIAMOND_ORE); + public static BlockWrapper DIAMOND_BLOCK = of(net.minecraft.block.Blocks.DIAMOND_BLOCK); + public static BlockWrapper CRAFTING_TABLE = of(net.minecraft.block.Blocks.CRAFTING_TABLE); + public static BlockWrapper WHEAT = of(net.minecraft.block.Blocks.WHEAT); + public static BlockWrapper FARMLAND = of(net.minecraft.block.Blocks.FARMLAND); + public static BlockWrapper FURNACE = of(net.minecraft.block.Blocks.FURNACE); + public static BlockWrapper OAK_SIGN = of(net.minecraft.block.Blocks.OAK_SIGN); + public static BlockWrapper SPRUCE_SIGN = of(net.minecraft.block.Blocks.SPRUCE_SIGN); + public static BlockWrapper BIRCH_SIGN = of(net.minecraft.block.Blocks.BIRCH_SIGN); + public static BlockWrapper ACACIA_SIGN = of(net.minecraft.block.Blocks.ACACIA_SIGN); + public static BlockWrapper JUNGLE_SIGN = of(net.minecraft.block.Blocks.JUNGLE_SIGN); + public static BlockWrapper DARK_OAK_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_SIGN); + public static BlockWrapper OAK_DOOR = of(net.minecraft.block.Blocks.OAK_DOOR); + public static BlockWrapper LADDER = of(net.minecraft.block.Blocks.LADDER); + public static BlockWrapper RAIL = of(net.minecraft.block.Blocks.RAIL); + public static BlockWrapper COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.COBBLESTONE_STAIRS); + public static BlockWrapper OAK_WALL_SIGN = of(net.minecraft.block.Blocks.OAK_WALL_SIGN); + public static BlockWrapper SPRUCE_WALL_SIGN = of(net.minecraft.block.Blocks.SPRUCE_WALL_SIGN); + public static BlockWrapper BIRCH_WALL_SIGN = of(net.minecraft.block.Blocks.BIRCH_WALL_SIGN); + public static BlockWrapper ACACIA_WALL_SIGN = of(net.minecraft.block.Blocks.ACACIA_WALL_SIGN); + public static BlockWrapper JUNGLE_WALL_SIGN = of(net.minecraft.block.Blocks.JUNGLE_WALL_SIGN); + public static BlockWrapper DARK_OAK_WALL_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_WALL_SIGN); + public static BlockWrapper LEVER = of(net.minecraft.block.Blocks.LEVER); + public static BlockWrapper STONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.STONE_PRESSURE_PLATE); + public static BlockWrapper IRON_DOOR = of(net.minecraft.block.Blocks.IRON_DOOR); + public static BlockWrapper OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.OAK_PRESSURE_PLATE); + public static BlockWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.SPRUCE_PRESSURE_PLATE); + public static BlockWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.block.Blocks.BIRCH_PRESSURE_PLATE); + public static BlockWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.JUNGLE_PRESSURE_PLATE); + public static BlockWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.block.Blocks.ACACIA_PRESSURE_PLATE); + public static BlockWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.DARK_OAK_PRESSURE_PLATE); + public static BlockWrapper REDSTONE_ORE = of(net.minecraft.block.Blocks.REDSTONE_ORE); + public static BlockWrapper REDSTONE_TORCH = of(net.minecraft.block.Blocks.REDSTONE_TORCH); + public static BlockWrapper REDSTONE_WALL_TORCH = of(net.minecraft.block.Blocks.REDSTONE_WALL_TORCH); + public static BlockWrapper STONE_BUTTON = of(net.minecraft.block.Blocks.STONE_BUTTON); + public static BlockWrapper SNOW = of(net.minecraft.block.Blocks.SNOW); + public static BlockWrapper ICE = of(net.minecraft.block.Blocks.ICE); + public static BlockWrapper SNOW_BLOCK = of(net.minecraft.block.Blocks.SNOW_BLOCK); + public static BlockWrapper CACTUS = of(net.minecraft.block.Blocks.CACTUS); + public static BlockWrapper CLAY = of(net.minecraft.block.Blocks.CLAY); + public static BlockWrapper SUGAR_CANE = of(net.minecraft.block.Blocks.SUGAR_CANE); + public static BlockWrapper JUKEBOX = of(net.minecraft.block.Blocks.JUKEBOX); + public static BlockWrapper OAK_FENCE = of(net.minecraft.block.Blocks.OAK_FENCE); + public static BlockWrapper PUMPKIN = of(net.minecraft.block.Blocks.PUMPKIN); + public static BlockWrapper NETHERRACK = of(net.minecraft.block.Blocks.NETHERRACK); + public static BlockWrapper SOUL_SAND = of(net.minecraft.block.Blocks.SOUL_SAND); + public static BlockWrapper SOUL_SOIL = of(net.minecraft.block.Blocks.SOUL_SOIL); + public static BlockWrapper BASALT = of(net.minecraft.block.Blocks.BASALT); + public static BlockWrapper POLISHED_BASALT = of(net.minecraft.block.Blocks.POLISHED_BASALT); + public static BlockWrapper SOUL_TORCH = of(net.minecraft.block.Blocks.SOUL_TORCH); + public static BlockWrapper SOUL_WALL_TORCH = of(net.minecraft.block.Blocks.SOUL_WALL_TORCH); + public static BlockWrapper GLOWSTONE = of(net.minecraft.block.Blocks.GLOWSTONE); + public static BlockWrapper NETHER_PORTAL = of(net.minecraft.block.Blocks.NETHER_PORTAL); + public static BlockWrapper CARVED_PUMPKIN = of(net.minecraft.block.Blocks.CARVED_PUMPKIN); + public static BlockWrapper JACK_O_LANTERN = of(net.minecraft.block.Blocks.JACK_O_LANTERN); + public static BlockWrapper CAKE = of(net.minecraft.block.Blocks.CAKE); + public static BlockWrapper REPEATER = of(net.minecraft.block.Blocks.REPEATER); + public static BlockWrapper WHITE_STAINED_GLASS = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS); + public static BlockWrapper ORANGE_STAINED_GLASS = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS); + public static BlockWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS); + public static BlockWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS); + public static BlockWrapper YELLOW_STAINED_GLASS = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS); + public static BlockWrapper LIME_STAINED_GLASS = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS); + public static BlockWrapper PINK_STAINED_GLASS = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS); + public static BlockWrapper GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS); + public static BlockWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS); + public static BlockWrapper CYAN_STAINED_GLASS = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS); + public static BlockWrapper PURPLE_STAINED_GLASS = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS); + public static BlockWrapper BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS); + public static BlockWrapper BROWN_STAINED_GLASS = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS); + public static BlockWrapper GREEN_STAINED_GLASS = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS); + public static BlockWrapper RED_STAINED_GLASS = of(net.minecraft.block.Blocks.RED_STAINED_GLASS); + public static BlockWrapper BLACK_STAINED_GLASS = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS); + public static BlockWrapper OAK_TRAPDOOR = of(net.minecraft.block.Blocks.OAK_TRAPDOOR); + public static BlockWrapper SPRUCE_TRAPDOOR = of(net.minecraft.block.Blocks.SPRUCE_TRAPDOOR); + public static BlockWrapper BIRCH_TRAPDOOR = of(net.minecraft.block.Blocks.BIRCH_TRAPDOOR); + public static BlockWrapper JUNGLE_TRAPDOOR = of(net.minecraft.block.Blocks.JUNGLE_TRAPDOOR); + public static BlockWrapper ACACIA_TRAPDOOR = of(net.minecraft.block.Blocks.ACACIA_TRAPDOOR); + public static BlockWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.block.Blocks.DARK_OAK_TRAPDOOR); + public static BlockWrapper STONE_BRICKS = of(net.minecraft.block.Blocks.STONE_BRICKS); + public static BlockWrapper MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICKS); + public static BlockWrapper CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_STONE_BRICKS); + public static BlockWrapper CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.CHISELED_STONE_BRICKS); + public static BlockWrapper INFESTED_STONE = of(net.minecraft.block.Blocks.INFESTED_STONE); + public static BlockWrapper INFESTED_COBBLESTONE = of(net.minecraft.block.Blocks.INFESTED_COBBLESTONE); + public static BlockWrapper INFESTED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_STONE_BRICKS); + public static BlockWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_MOSSY_STONE_BRICKS); + public static BlockWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CRACKED_STONE_BRICKS); + public static BlockWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CHISELED_STONE_BRICKS); + public static BlockWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.BROWN_MUSHROOM_BLOCK); + public static BlockWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.RED_MUSHROOM_BLOCK); + public static BlockWrapper MUSHROOM_STEM = of(net.minecraft.block.Blocks.MUSHROOM_STEM); + public static BlockWrapper IRON_BARS = of(net.minecraft.block.Blocks.IRON_BARS); + public static BlockWrapper CHAIN = of(net.minecraft.block.Blocks.CHAIN); + public static BlockWrapper GLASS_PANE = of(net.minecraft.block.Blocks.GLASS_PANE); + public static BlockWrapper MELON = of(net.minecraft.block.Blocks.MELON); + public static BlockWrapper ATTACHED_PUMPKIN_STEM = of(net.minecraft.block.Blocks.ATTACHED_PUMPKIN_STEM); + public static BlockWrapper ATTACHED_MELON_STEM = of(net.minecraft.block.Blocks.ATTACHED_MELON_STEM); + public static BlockWrapper PUMPKIN_STEM = of(net.minecraft.block.Blocks.PUMPKIN_STEM); + public static BlockWrapper MELON_STEM = of(net.minecraft.block.Blocks.MELON_STEM); + public static BlockWrapper VINE = of(net.minecraft.block.Blocks.VINE); + public static BlockWrapper OAK_FENCE_GATE = of(net.minecraft.block.Blocks.OAK_FENCE_GATE); + public static BlockWrapper BRICK_STAIRS = of(net.minecraft.block.Blocks.BRICK_STAIRS); + public static BlockWrapper STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.STONE_BRICK_STAIRS); + public static BlockWrapper MYCELIUM = of(net.minecraft.block.Blocks.MYCELIUM); + public static BlockWrapper LILY_PAD = of(net.minecraft.block.Blocks.LILY_PAD); + public static BlockWrapper NETHER_BRICKS = of(net.minecraft.block.Blocks.NETHER_BRICKS); + public static BlockWrapper NETHER_BRICK_FENCE = of(net.minecraft.block.Blocks.NETHER_BRICK_FENCE); + public static BlockWrapper NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.NETHER_BRICK_STAIRS); + public static BlockWrapper NETHER_WART = of(net.minecraft.block.Blocks.NETHER_WART); + public static BlockWrapper ENCHANTING_TABLE = of(net.minecraft.block.Blocks.ENCHANTING_TABLE); + public static BlockWrapper BREWING_STAND = of(net.minecraft.block.Blocks.BREWING_STAND); + public static BlockWrapper CAULDRON = of(net.minecraft.block.Blocks.CAULDRON); + public static BlockWrapper END_PORTAL = of(net.minecraft.block.Blocks.END_PORTAL); + public static BlockWrapper END_PORTAL_FRAME = of(net.minecraft.block.Blocks.END_PORTAL_FRAME); + public static BlockWrapper END_STONE = of(net.minecraft.block.Blocks.END_STONE); + public static BlockWrapper DRAGON_EGG = of(net.minecraft.block.Blocks.DRAGON_EGG); + public static BlockWrapper REDSTONE_LAMP = of(net.minecraft.block.Blocks.REDSTONE_LAMP); + public static BlockWrapper COCOA = of(net.minecraft.block.Blocks.COCOA); + public static BlockWrapper SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SANDSTONE_STAIRS); + public static BlockWrapper EMERALD_ORE = of(net.minecraft.block.Blocks.EMERALD_ORE); + public static BlockWrapper ENDER_CHEST = of(net.minecraft.block.Blocks.ENDER_CHEST); + public static BlockWrapper TRIPWIRE_HOOK = of(net.minecraft.block.Blocks.TRIPWIRE_HOOK); + public static BlockWrapper TRIPWIRE = of(net.minecraft.block.Blocks.TRIPWIRE); + public static BlockWrapper EMERALD_BLOCK = of(net.minecraft.block.Blocks.EMERALD_BLOCK); + public static BlockWrapper SPRUCE_STAIRS = of(net.minecraft.block.Blocks.SPRUCE_STAIRS); + public static BlockWrapper BIRCH_STAIRS = of(net.minecraft.block.Blocks.BIRCH_STAIRS); + public static BlockWrapper JUNGLE_STAIRS = of(net.minecraft.block.Blocks.JUNGLE_STAIRS); + public static BlockWrapper COMMAND_BLOCK = of(net.minecraft.block.Blocks.COMMAND_BLOCK); + public static BlockWrapper BEACON = of(net.minecraft.block.Blocks.BEACON); + public static BlockWrapper COBBLESTONE_WALL = of(net.minecraft.block.Blocks.COBBLESTONE_WALL); + public static BlockWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_WALL); + public static BlockWrapper FLOWER_POT = of(net.minecraft.block.Blocks.FLOWER_POT); + public static BlockWrapper POTTED_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_OAK_SAPLING); + public static BlockWrapper POTTED_SPRUCE_SAPLING = of(net.minecraft.block.Blocks.POTTED_SPRUCE_SAPLING); + public static BlockWrapper POTTED_BIRCH_SAPLING = of(net.minecraft.block.Blocks.POTTED_BIRCH_SAPLING); + public static BlockWrapper POTTED_JUNGLE_SAPLING = of(net.minecraft.block.Blocks.POTTED_JUNGLE_SAPLING); + public static BlockWrapper POTTED_ACACIA_SAPLING = of(net.minecraft.block.Blocks.POTTED_ACACIA_SAPLING); + public static BlockWrapper POTTED_DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_DARK_OAK_SAPLING); + public static BlockWrapper POTTED_FERN = of(net.minecraft.block.Blocks.POTTED_FERN); + public static BlockWrapper POTTED_DANDELION = of(net.minecraft.block.Blocks.POTTED_DANDELION); + public static BlockWrapper POTTED_POPPY = of(net.minecraft.block.Blocks.POTTED_POPPY); + public static BlockWrapper POTTED_BLUE_ORCHID = of(net.minecraft.block.Blocks.POTTED_BLUE_ORCHID); + public static BlockWrapper POTTED_ALLIUM = of(net.minecraft.block.Blocks.POTTED_ALLIUM); + public static BlockWrapper POTTED_AZURE_BLUET = of(net.minecraft.block.Blocks.POTTED_AZURE_BLUET); + public static BlockWrapper POTTED_RED_TULIP = of(net.minecraft.block.Blocks.POTTED_RED_TULIP); + public static BlockWrapper POTTED_ORANGE_TULIP = of(net.minecraft.block.Blocks.POTTED_ORANGE_TULIP); + public static BlockWrapper POTTED_WHITE_TULIP = of(net.minecraft.block.Blocks.POTTED_WHITE_TULIP); + public static BlockWrapper POTTED_PINK_TULIP = of(net.minecraft.block.Blocks.POTTED_PINK_TULIP); + public static BlockWrapper POTTED_OXEYE_DAISY = of(net.minecraft.block.Blocks.POTTED_OXEYE_DAISY); + public static BlockWrapper POTTED_CORNFLOWER = of(net.minecraft.block.Blocks.POTTED_CORNFLOWER); + public static BlockWrapper POTTED_LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.POTTED_LILY_OF_THE_VALLEY); + public static BlockWrapper POTTED_WITHER_ROSE = of(net.minecraft.block.Blocks.POTTED_WITHER_ROSE); + public static BlockWrapper POTTED_RED_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_RED_MUSHROOM); + public static BlockWrapper POTTED_BROWN_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_BROWN_MUSHROOM); + public static BlockWrapper POTTED_DEAD_BUSH = of(net.minecraft.block.Blocks.POTTED_DEAD_BUSH); + public static BlockWrapper POTTED_CACTUS = of(net.minecraft.block.Blocks.POTTED_CACTUS); + public static BlockWrapper CARROTS = of(net.minecraft.block.Blocks.CARROTS); + public static BlockWrapper POTATOES = of(net.minecraft.block.Blocks.POTATOES); + public static BlockWrapper OAK_BUTTON = of(net.minecraft.block.Blocks.OAK_BUTTON); + public static BlockWrapper SPRUCE_BUTTON = of(net.minecraft.block.Blocks.SPRUCE_BUTTON); + public static BlockWrapper BIRCH_BUTTON = of(net.minecraft.block.Blocks.BIRCH_BUTTON); + public static BlockWrapper JUNGLE_BUTTON = of(net.minecraft.block.Blocks.JUNGLE_BUTTON); + public static BlockWrapper ACACIA_BUTTON = of(net.minecraft.block.Blocks.ACACIA_BUTTON); + public static BlockWrapper DARK_OAK_BUTTON = of(net.minecraft.block.Blocks.DARK_OAK_BUTTON); + public static BlockWrapper SKELETON_SKULL = of(net.minecraft.block.Blocks.SKELETON_SKULL); + public static BlockWrapper SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.SKELETON_WALL_SKULL); + public static BlockWrapper WITHER_SKELETON_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_SKULL); + public static BlockWrapper WITHER_SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_WALL_SKULL); + public static BlockWrapper ZOMBIE_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_HEAD); + public static BlockWrapper ZOMBIE_WALL_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_WALL_HEAD); + public static BlockWrapper PLAYER_HEAD = of(net.minecraft.block.Blocks.PLAYER_HEAD); + public static BlockWrapper PLAYER_WALL_HEAD = of(net.minecraft.block.Blocks.PLAYER_WALL_HEAD); + public static BlockWrapper CREEPER_HEAD = of(net.minecraft.block.Blocks.CREEPER_HEAD); + public static BlockWrapper CREEPER_WALL_HEAD = of(net.minecraft.block.Blocks.CREEPER_WALL_HEAD); + public static BlockWrapper DRAGON_HEAD = of(net.minecraft.block.Blocks.DRAGON_HEAD); + public static BlockWrapper DRAGON_WALL_HEAD = of(net.minecraft.block.Blocks.DRAGON_WALL_HEAD); + public static BlockWrapper ANVIL = of(net.minecraft.block.Blocks.ANVIL); + public static BlockWrapper CHIPPED_ANVIL = of(net.minecraft.block.Blocks.CHIPPED_ANVIL); + public static BlockWrapper DAMAGED_ANVIL = of(net.minecraft.block.Blocks.DAMAGED_ANVIL); + public static BlockWrapper TRAPPED_CHEST = of(net.minecraft.block.Blocks.TRAPPED_CHEST); + public static BlockWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE); + public static BlockWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE); + public static BlockWrapper COMPARATOR = of(net.minecraft.block.Blocks.COMPARATOR); + public static BlockWrapper DAYLIGHT_DETECTOR = of(net.minecraft.block.Blocks.DAYLIGHT_DETECTOR); + public static BlockWrapper REDSTONE_BLOCK = of(net.minecraft.block.Blocks.REDSTONE_BLOCK); + public static BlockWrapper NETHER_QUARTZ_ORE = of(net.minecraft.block.Blocks.NETHER_QUARTZ_ORE); + public static BlockWrapper HOPPER = of(net.minecraft.block.Blocks.HOPPER); + public static BlockWrapper QUARTZ_BLOCK = of(net.minecraft.block.Blocks.QUARTZ_BLOCK); + public static BlockWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.block.Blocks.CHISELED_QUARTZ_BLOCK); + public static BlockWrapper QUARTZ_PILLAR = of(net.minecraft.block.Blocks.QUARTZ_PILLAR); + public static BlockWrapper QUARTZ_STAIRS = of(net.minecraft.block.Blocks.QUARTZ_STAIRS); + public static BlockWrapper ACTIVATOR_RAIL = of(net.minecraft.block.Blocks.ACTIVATOR_RAIL); + public static BlockWrapper DROPPER = of(net.minecraft.block.Blocks.DROPPER); + public static BlockWrapper WHITE_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_TERRACOTTA); + public static BlockWrapper ORANGE_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_TERRACOTTA); + public static BlockWrapper MAGENTA_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_TERRACOTTA); + public static BlockWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_TERRACOTTA); + public static BlockWrapper YELLOW_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_TERRACOTTA); + public static BlockWrapper LIME_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_TERRACOTTA); + public static BlockWrapper PINK_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_TERRACOTTA); + public static BlockWrapper GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_TERRACOTTA); + public static BlockWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_TERRACOTTA); + public static BlockWrapper CYAN_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_TERRACOTTA); + public static BlockWrapper PURPLE_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_TERRACOTTA); + public static BlockWrapper BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_TERRACOTTA); + public static BlockWrapper BROWN_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_TERRACOTTA); + public static BlockWrapper GREEN_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_TERRACOTTA); + public static BlockWrapper RED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_TERRACOTTA); + public static BlockWrapper BLACK_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_TERRACOTTA); + public static BlockWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS_PANE); + public static BlockWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS_PANE); + public static BlockWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS_PANE); + public static BlockWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS_PANE); + public static BlockWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS_PANE); + public static BlockWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS_PANE); + public static BlockWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS_PANE); + public static BlockWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS_PANE); + public static BlockWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS_PANE); + public static BlockWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS_PANE); + public static BlockWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS_PANE); + public static BlockWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS_PANE); + public static BlockWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS_PANE); + public static BlockWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS_PANE); + public static BlockWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.RED_STAINED_GLASS_PANE); + public static BlockWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS_PANE); + public static BlockWrapper ACACIA_STAIRS = of(net.minecraft.block.Blocks.ACACIA_STAIRS); + public static BlockWrapper DARK_OAK_STAIRS = of(net.minecraft.block.Blocks.DARK_OAK_STAIRS); + public static BlockWrapper SLIME_BLOCK = of(net.minecraft.block.Blocks.SLIME_BLOCK); + public static BlockWrapper BARRIER = of(net.minecraft.block.Blocks.BARRIER); + public static BlockWrapper IRON_TRAPDOOR = of(net.minecraft.block.Blocks.IRON_TRAPDOOR); + public static BlockWrapper PRISMARINE = of(net.minecraft.block.Blocks.PRISMARINE); + public static BlockWrapper PRISMARINE_BRICKS = of(net.minecraft.block.Blocks.PRISMARINE_BRICKS); + public static BlockWrapper DARK_PRISMARINE = of(net.minecraft.block.Blocks.DARK_PRISMARINE); + public static BlockWrapper PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_STAIRS); + public static BlockWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_STAIRS); + public static BlockWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.DARK_PRISMARINE_STAIRS); + public static BlockWrapper PRISMARINE_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_SLAB); + public static BlockWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_SLAB); + public static BlockWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.block.Blocks.DARK_PRISMARINE_SLAB); + public static BlockWrapper SEA_LANTERN = of(net.minecraft.block.Blocks.SEA_LANTERN); + public static BlockWrapper HAY_BLOCK = of(net.minecraft.block.Blocks.HAY_BLOCK); + public static BlockWrapper WHITE_CARPET = of(net.minecraft.block.Blocks.WHITE_CARPET); + public static BlockWrapper ORANGE_CARPET = of(net.minecraft.block.Blocks.ORANGE_CARPET); + public static BlockWrapper MAGENTA_CARPET = of(net.minecraft.block.Blocks.MAGENTA_CARPET); + public static BlockWrapper LIGHT_BLUE_CARPET = of(net.minecraft.block.Blocks.LIGHT_BLUE_CARPET); + public static BlockWrapper YELLOW_CARPET = of(net.minecraft.block.Blocks.YELLOW_CARPET); + public static BlockWrapper LIME_CARPET = of(net.minecraft.block.Blocks.LIME_CARPET); + public static BlockWrapper PINK_CARPET = of(net.minecraft.block.Blocks.PINK_CARPET); + public static BlockWrapper GRAY_CARPET = of(net.minecraft.block.Blocks.GRAY_CARPET); + public static BlockWrapper LIGHT_GRAY_CARPET = of(net.minecraft.block.Blocks.LIGHT_GRAY_CARPET); + public static BlockWrapper CYAN_CARPET = of(net.minecraft.block.Blocks.CYAN_CARPET); + public static BlockWrapper PURPLE_CARPET = of(net.minecraft.block.Blocks.PURPLE_CARPET); + public static BlockWrapper BLUE_CARPET = of(net.minecraft.block.Blocks.BLUE_CARPET); + public static BlockWrapper BROWN_CARPET = of(net.minecraft.block.Blocks.BROWN_CARPET); + public static BlockWrapper GREEN_CARPET = of(net.minecraft.block.Blocks.GREEN_CARPET); + public static BlockWrapper RED_CARPET = of(net.minecraft.block.Blocks.RED_CARPET); + public static BlockWrapper BLACK_CARPET = of(net.minecraft.block.Blocks.BLACK_CARPET); + public static BlockWrapper TERRACOTTA = of(net.minecraft.block.Blocks.TERRACOTTA); + public static BlockWrapper COAL_BLOCK = of(net.minecraft.block.Blocks.COAL_BLOCK); + public static BlockWrapper PACKED_ICE = of(net.minecraft.block.Blocks.PACKED_ICE); + public static BlockWrapper SUNFLOWER = of(net.minecraft.block.Blocks.SUNFLOWER); + public static BlockWrapper LILAC = of(net.minecraft.block.Blocks.LILAC); + public static BlockWrapper ROSE_BUSH = of(net.minecraft.block.Blocks.ROSE_BUSH); + public static BlockWrapper PEONY = of(net.minecraft.block.Blocks.PEONY); + public static BlockWrapper TALL_GRASS = of(net.minecraft.block.Blocks.TALL_GRASS); + public static BlockWrapper LARGE_FERN = of(net.minecraft.block.Blocks.LARGE_FERN); + public static BlockWrapper WHITE_BANNER = of(net.minecraft.block.Blocks.WHITE_BANNER); + public static BlockWrapper ORANGE_BANNER = of(net.minecraft.block.Blocks.ORANGE_BANNER); + public static BlockWrapper MAGENTA_BANNER = of(net.minecraft.block.Blocks.MAGENTA_BANNER); + public static BlockWrapper LIGHT_BLUE_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_BANNER); + public static BlockWrapper YELLOW_BANNER = of(net.minecraft.block.Blocks.YELLOW_BANNER); + public static BlockWrapper LIME_BANNER = of(net.minecraft.block.Blocks.LIME_BANNER); + public static BlockWrapper PINK_BANNER = of(net.minecraft.block.Blocks.PINK_BANNER); + public static BlockWrapper GRAY_BANNER = of(net.minecraft.block.Blocks.GRAY_BANNER); + public static BlockWrapper LIGHT_GRAY_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_BANNER); + public static BlockWrapper CYAN_BANNER = of(net.minecraft.block.Blocks.CYAN_BANNER); + public static BlockWrapper PURPLE_BANNER = of(net.minecraft.block.Blocks.PURPLE_BANNER); + public static BlockWrapper BLUE_BANNER = of(net.minecraft.block.Blocks.BLUE_BANNER); + public static BlockWrapper BROWN_BANNER = of(net.minecraft.block.Blocks.BROWN_BANNER); + public static BlockWrapper GREEN_BANNER = of(net.minecraft.block.Blocks.GREEN_BANNER); + public static BlockWrapper RED_BANNER = of(net.minecraft.block.Blocks.RED_BANNER); + public static BlockWrapper BLACK_BANNER = of(net.minecraft.block.Blocks.BLACK_BANNER); + public static BlockWrapper WHITE_WALL_BANNER = of(net.minecraft.block.Blocks.WHITE_WALL_BANNER); + public static BlockWrapper ORANGE_WALL_BANNER = of(net.minecraft.block.Blocks.ORANGE_WALL_BANNER); + public static BlockWrapper MAGENTA_WALL_BANNER = of(net.minecraft.block.Blocks.MAGENTA_WALL_BANNER); + public static BlockWrapper LIGHT_BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_WALL_BANNER); + public static BlockWrapper YELLOW_WALL_BANNER = of(net.minecraft.block.Blocks.YELLOW_WALL_BANNER); + public static BlockWrapper LIME_WALL_BANNER = of(net.minecraft.block.Blocks.LIME_WALL_BANNER); + public static BlockWrapper PINK_WALL_BANNER = of(net.minecraft.block.Blocks.PINK_WALL_BANNER); + public static BlockWrapper GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.GRAY_WALL_BANNER); + public static BlockWrapper LIGHT_GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_WALL_BANNER); + public static BlockWrapper CYAN_WALL_BANNER = of(net.minecraft.block.Blocks.CYAN_WALL_BANNER); + public static BlockWrapper PURPLE_WALL_BANNER = of(net.minecraft.block.Blocks.PURPLE_WALL_BANNER); + public static BlockWrapper BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.BLUE_WALL_BANNER); + public static BlockWrapper BROWN_WALL_BANNER = of(net.minecraft.block.Blocks.BROWN_WALL_BANNER); + public static BlockWrapper GREEN_WALL_BANNER = of(net.minecraft.block.Blocks.GREEN_WALL_BANNER); + public static BlockWrapper RED_WALL_BANNER = of(net.minecraft.block.Blocks.RED_WALL_BANNER); + public static BlockWrapper BLACK_WALL_BANNER = of(net.minecraft.block.Blocks.BLACK_WALL_BANNER); + public static BlockWrapper RED_SANDSTONE = of(net.minecraft.block.Blocks.RED_SANDSTONE); + public static BlockWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_RED_SANDSTONE); + public static BlockWrapper CUT_RED_SANDSTONE = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE); + public static BlockWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.RED_SANDSTONE_STAIRS); + public static BlockWrapper OAK_SLAB = of(net.minecraft.block.Blocks.OAK_SLAB); + public static BlockWrapper SPRUCE_SLAB = of(net.minecraft.block.Blocks.SPRUCE_SLAB); + public static BlockWrapper BIRCH_SLAB = of(net.minecraft.block.Blocks.BIRCH_SLAB); + public static BlockWrapper JUNGLE_SLAB = of(net.minecraft.block.Blocks.JUNGLE_SLAB); + public static BlockWrapper ACACIA_SLAB = of(net.minecraft.block.Blocks.ACACIA_SLAB); + public static BlockWrapper DARK_OAK_SLAB = of(net.minecraft.block.Blocks.DARK_OAK_SLAB); + public static BlockWrapper STONE_SLAB = of(net.minecraft.block.Blocks.STONE_SLAB); + public static BlockWrapper SMOOTH_STONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_STONE_SLAB); + public static BlockWrapper SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SANDSTONE_SLAB); + public static BlockWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_SANDSTONE_SLAB); + public static BlockWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.block.Blocks.PETRIFIED_OAK_SLAB); + public static BlockWrapper COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.COBBLESTONE_SLAB); + public static BlockWrapper BRICK_SLAB = of(net.minecraft.block.Blocks.BRICK_SLAB); + public static BlockWrapper STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.STONE_BRICK_SLAB); + public static BlockWrapper NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.NETHER_BRICK_SLAB); + public static BlockWrapper QUARTZ_SLAB = of(net.minecraft.block.Blocks.QUARTZ_SLAB); + public static BlockWrapper RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.RED_SANDSTONE_SLAB); + public static BlockWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE_SLAB); + public static BlockWrapper PURPUR_SLAB = of(net.minecraft.block.Blocks.PURPUR_SLAB); + public static BlockWrapper SMOOTH_STONE = of(net.minecraft.block.Blocks.SMOOTH_STONE); + public static BlockWrapper SMOOTH_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE); + public static BlockWrapper SMOOTH_QUARTZ = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ); + public static BlockWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE); + public static BlockWrapper SPRUCE_FENCE_GATE = of(net.minecraft.block.Blocks.SPRUCE_FENCE_GATE); + public static BlockWrapper BIRCH_FENCE_GATE = of(net.minecraft.block.Blocks.BIRCH_FENCE_GATE); + public static BlockWrapper JUNGLE_FENCE_GATE = of(net.minecraft.block.Blocks.JUNGLE_FENCE_GATE); + public static BlockWrapper ACACIA_FENCE_GATE = of(net.minecraft.block.Blocks.ACACIA_FENCE_GATE); + public static BlockWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE_GATE); + public static BlockWrapper SPRUCE_FENCE = of(net.minecraft.block.Blocks.SPRUCE_FENCE); + public static BlockWrapper BIRCH_FENCE = of(net.minecraft.block.Blocks.BIRCH_FENCE); + public static BlockWrapper JUNGLE_FENCE = of(net.minecraft.block.Blocks.JUNGLE_FENCE); + public static BlockWrapper ACACIA_FENCE = of(net.minecraft.block.Blocks.ACACIA_FENCE); + public static BlockWrapper DARK_OAK_FENCE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE); + public static BlockWrapper SPRUCE_DOOR = of(net.minecraft.block.Blocks.SPRUCE_DOOR); + public static BlockWrapper BIRCH_DOOR = of(net.minecraft.block.Blocks.BIRCH_DOOR); + public static BlockWrapper JUNGLE_DOOR = of(net.minecraft.block.Blocks.JUNGLE_DOOR); + public static BlockWrapper ACACIA_DOOR = of(net.minecraft.block.Blocks.ACACIA_DOOR); + public static BlockWrapper DARK_OAK_DOOR = of(net.minecraft.block.Blocks.DARK_OAK_DOOR); + public static BlockWrapper END_ROD = of(net.minecraft.block.Blocks.END_ROD); + public static BlockWrapper CHORUS_PLANT = of(net.minecraft.block.Blocks.CHORUS_PLANT); + public static BlockWrapper CHORUS_FLOWER = of(net.minecraft.block.Blocks.CHORUS_FLOWER); + public static BlockWrapper PURPUR_BLOCK = of(net.minecraft.block.Blocks.PURPUR_BLOCK); + public static BlockWrapper PURPUR_PILLAR = of(net.minecraft.block.Blocks.PURPUR_PILLAR); + public static BlockWrapper PURPUR_STAIRS = of(net.minecraft.block.Blocks.PURPUR_STAIRS); + public static BlockWrapper END_STONE_BRICKS = of(net.minecraft.block.Blocks.END_STONE_BRICKS); + public static BlockWrapper BEETROOTS = of(net.minecraft.block.Blocks.BEETROOTS); + public static BlockWrapper GRASS_PATH = of(net.minecraft.block.Blocks.GRASS_PATH); + public static BlockWrapper END_GATEWAY = of(net.minecraft.block.Blocks.END_GATEWAY); + public static BlockWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.block.Blocks.REPEATING_COMMAND_BLOCK); + public static BlockWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.block.Blocks.CHAIN_COMMAND_BLOCK); + public static BlockWrapper FROSTED_ICE = of(net.minecraft.block.Blocks.FROSTED_ICE); + public static BlockWrapper MAGMA_BLOCK = of(net.minecraft.block.Blocks.MAGMA_BLOCK); + public static BlockWrapper NETHER_WART_BLOCK = of(net.minecraft.block.Blocks.NETHER_WART_BLOCK); + public static BlockWrapper RED_NETHER_BRICKS = of(net.minecraft.block.Blocks.RED_NETHER_BRICKS); + public static BlockWrapper BONE_BLOCK = of(net.minecraft.block.Blocks.BONE_BLOCK); + public static BlockWrapper STRUCTURE_VOID = of(net.minecraft.block.Blocks.STRUCTURE_VOID); + public static BlockWrapper OBSERVER = of(net.minecraft.block.Blocks.OBSERVER); + public static BlockWrapper SHULKER_BOX = of(net.minecraft.block.Blocks.SHULKER_BOX); + public static BlockWrapper WHITE_SHULKER_BOX = of(net.minecraft.block.Blocks.WHITE_SHULKER_BOX); + public static BlockWrapper ORANGE_SHULKER_BOX = of(net.minecraft.block.Blocks.ORANGE_SHULKER_BOX); + public static BlockWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.block.Blocks.MAGENTA_SHULKER_BOX); + public static BlockWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_BLUE_SHULKER_BOX); + public static BlockWrapper YELLOW_SHULKER_BOX = of(net.minecraft.block.Blocks.YELLOW_SHULKER_BOX); + public static BlockWrapper LIME_SHULKER_BOX = of(net.minecraft.block.Blocks.LIME_SHULKER_BOX); + public static BlockWrapper PINK_SHULKER_BOX = of(net.minecraft.block.Blocks.PINK_SHULKER_BOX); + public static BlockWrapper GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.GRAY_SHULKER_BOX); + public static BlockWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_GRAY_SHULKER_BOX); + public static BlockWrapper CYAN_SHULKER_BOX = of(net.minecraft.block.Blocks.CYAN_SHULKER_BOX); + public static BlockWrapper PURPLE_SHULKER_BOX = of(net.minecraft.block.Blocks.PURPLE_SHULKER_BOX); + public static BlockWrapper BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.BLUE_SHULKER_BOX); + public static BlockWrapper BROWN_SHULKER_BOX = of(net.minecraft.block.Blocks.BROWN_SHULKER_BOX); + public static BlockWrapper GREEN_SHULKER_BOX = of(net.minecraft.block.Blocks.GREEN_SHULKER_BOX); + public static BlockWrapper RED_SHULKER_BOX = of(net.minecraft.block.Blocks.RED_SHULKER_BOX); + public static BlockWrapper BLACK_SHULKER_BOX = of(net.minecraft.block.Blocks.BLACK_SHULKER_BOX); + public static BlockWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_GLAZED_TERRACOTTA); + public static BlockWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_GLAZED_TERRACOTTA); + public static BlockWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_GLAZED_TERRACOTTA); + public static BlockWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA); + public static BlockWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_GLAZED_TERRACOTTA); + public static BlockWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_GLAZED_TERRACOTTA); + public static BlockWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_GLAZED_TERRACOTTA); + public static BlockWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_GLAZED_TERRACOTTA); + public static BlockWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA); + public static BlockWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_GLAZED_TERRACOTTA); + public static BlockWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_GLAZED_TERRACOTTA); + public static BlockWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_GLAZED_TERRACOTTA); + public static BlockWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_GLAZED_TERRACOTTA); + public static BlockWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_GLAZED_TERRACOTTA); + public static BlockWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_GLAZED_TERRACOTTA); + public static BlockWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_GLAZED_TERRACOTTA); + public static BlockWrapper WHITE_CONCRETE = of(net.minecraft.block.Blocks.WHITE_CONCRETE); + public static BlockWrapper ORANGE_CONCRETE = of(net.minecraft.block.Blocks.ORANGE_CONCRETE); + public static BlockWrapper MAGENTA_CONCRETE = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE); + public static BlockWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE); + public static BlockWrapper YELLOW_CONCRETE = of(net.minecraft.block.Blocks.YELLOW_CONCRETE); + public static BlockWrapper LIME_CONCRETE = of(net.minecraft.block.Blocks.LIME_CONCRETE); + public static BlockWrapper PINK_CONCRETE = of(net.minecraft.block.Blocks.PINK_CONCRETE); + public static BlockWrapper GRAY_CONCRETE = of(net.minecraft.block.Blocks.GRAY_CONCRETE); + public static BlockWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE); + public static BlockWrapper CYAN_CONCRETE = of(net.minecraft.block.Blocks.CYAN_CONCRETE); + public static BlockWrapper PURPLE_CONCRETE = of(net.minecraft.block.Blocks.PURPLE_CONCRETE); + public static BlockWrapper BLUE_CONCRETE = of(net.minecraft.block.Blocks.BLUE_CONCRETE); + public static BlockWrapper BROWN_CONCRETE = of(net.minecraft.block.Blocks.BROWN_CONCRETE); + public static BlockWrapper GREEN_CONCRETE = of(net.minecraft.block.Blocks.GREEN_CONCRETE); + public static BlockWrapper RED_CONCRETE = of(net.minecraft.block.Blocks.RED_CONCRETE); + public static BlockWrapper BLACK_CONCRETE = of(net.minecraft.block.Blocks.BLACK_CONCRETE); + public static BlockWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.WHITE_CONCRETE_POWDER); + public static BlockWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.ORANGE_CONCRETE_POWDER); + public static BlockWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE_POWDER); + public static BlockWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE_POWDER); + public static BlockWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.block.Blocks.YELLOW_CONCRETE_POWDER); + public static BlockWrapper LIME_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIME_CONCRETE_POWDER); + public static BlockWrapper PINK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PINK_CONCRETE_POWDER); + public static BlockWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GRAY_CONCRETE_POWDER); + public static BlockWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE_POWDER); + public static BlockWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.CYAN_CONCRETE_POWDER); + public static BlockWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PURPLE_CONCRETE_POWDER); + public static BlockWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLUE_CONCRETE_POWDER); + public static BlockWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BROWN_CONCRETE_POWDER); + public static BlockWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GREEN_CONCRETE_POWDER); + public static BlockWrapper RED_CONCRETE_POWDER = of(net.minecraft.block.Blocks.RED_CONCRETE_POWDER); + public static BlockWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLACK_CONCRETE_POWDER); + public static BlockWrapper KELP = of(net.minecraft.block.Blocks.KELP); + public static BlockWrapper KELP_PLANT = of(net.minecraft.block.Blocks.KELP_PLANT); + public static BlockWrapper DRIED_KELP_BLOCK = of(net.minecraft.block.Blocks.DRIED_KELP_BLOCK); + public static BlockWrapper TURTLE_EGG = of(net.minecraft.block.Blocks.TURTLE_EGG); + public static BlockWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_BLOCK); + public static BlockWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_BLOCK); + public static BlockWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_BLOCK); + public static BlockWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_BLOCK); + public static BlockWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_BLOCK); + public static BlockWrapper TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.TUBE_CORAL_BLOCK); + public static BlockWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.BRAIN_CORAL_BLOCK); + public static BlockWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.BUBBLE_CORAL_BLOCK); + public static BlockWrapper FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.FIRE_CORAL_BLOCK); + public static BlockWrapper HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.HORN_CORAL_BLOCK); + public static BlockWrapper DEAD_TUBE_CORAL = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL); + public static BlockWrapper DEAD_BRAIN_CORAL = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL); + public static BlockWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL); + public static BlockWrapper DEAD_FIRE_CORAL = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL); + public static BlockWrapper DEAD_HORN_CORAL = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL); + public static BlockWrapper TUBE_CORAL = of(net.minecraft.block.Blocks.TUBE_CORAL); + public static BlockWrapper BRAIN_CORAL = of(net.minecraft.block.Blocks.BRAIN_CORAL); + public static BlockWrapper BUBBLE_CORAL = of(net.minecraft.block.Blocks.BUBBLE_CORAL); + public static BlockWrapper FIRE_CORAL = of(net.minecraft.block.Blocks.FIRE_CORAL); + public static BlockWrapper HORN_CORAL = of(net.minecraft.block.Blocks.HORN_CORAL); + public static BlockWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_FAN); + public static BlockWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_FAN); + public static BlockWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_FAN); + public static BlockWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_FAN); + public static BlockWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_FAN); + public static BlockWrapper TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_FAN); + public static BlockWrapper BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_FAN); + public static BlockWrapper BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_FAN); + public static BlockWrapper FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_FAN); + public static BlockWrapper HORN_CORAL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_FAN); + public static BlockWrapper DEAD_TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_WALL_FAN); + public static BlockWrapper DEAD_BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_WALL_FAN); + public static BlockWrapper TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_WALL_FAN); + public static BlockWrapper BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_WALL_FAN); + public static BlockWrapper BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_WALL_FAN); + public static BlockWrapper FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_WALL_FAN); + public static BlockWrapper HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_WALL_FAN); + public static BlockWrapper SEA_PICKLE = of(net.minecraft.block.Blocks.SEA_PICKLE); + public static BlockWrapper BLUE_ICE = of(net.minecraft.block.Blocks.BLUE_ICE); + public static BlockWrapper CONDUIT = of(net.minecraft.block.Blocks.CONDUIT); + public static BlockWrapper BAMBOO_SAPLING = of(net.minecraft.block.Blocks.BAMBOO_SAPLING); + public static BlockWrapper BAMBOO = of(net.minecraft.block.Blocks.BAMBOO); + public static BlockWrapper POTTED_BAMBOO = of(net.minecraft.block.Blocks.POTTED_BAMBOO); + public static BlockWrapper VOID_AIR = of(net.minecraft.block.Blocks.VOID_AIR); + public static BlockWrapper CAVE_AIR = of(net.minecraft.block.Blocks.CAVE_AIR); + public static BlockWrapper BUBBLE_COLUMN = of(net.minecraft.block.Blocks.BUBBLE_COLUMN); + public static BlockWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_GRANITE_STAIRS); + public static BlockWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_STAIRS); + public static BlockWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_STAIRS); + public static BlockWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_DIORITE_STAIRS); + public static BlockWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_STAIRS); + public static BlockWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.END_STONE_BRICK_STAIRS); + public static BlockWrapper STONE_STAIRS = of(net.minecraft.block.Blocks.STONE_STAIRS); + public static BlockWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_STAIRS); + public static BlockWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_STAIRS); + public static BlockWrapper GRANITE_STAIRS = of(net.minecraft.block.Blocks.GRANITE_STAIRS); + public static BlockWrapper ANDESITE_STAIRS = of(net.minecraft.block.Blocks.ANDESITE_STAIRS); + public static BlockWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_STAIRS); + public static BlockWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_STAIRS); + public static BlockWrapper DIORITE_STAIRS = of(net.minecraft.block.Blocks.DIORITE_STAIRS); + public static BlockWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_GRANITE_SLAB); + public static BlockWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_SLAB); + public static BlockWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_SLAB); + public static BlockWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_DIORITE_SLAB); + public static BlockWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_SLAB); + public static BlockWrapper END_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.END_STONE_BRICK_SLAB); + public static BlockWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_SLAB); + public static BlockWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_SLAB); + public static BlockWrapper GRANITE_SLAB = of(net.minecraft.block.Blocks.GRANITE_SLAB); + public static BlockWrapper ANDESITE_SLAB = of(net.minecraft.block.Blocks.ANDESITE_SLAB); + public static BlockWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_SLAB); + public static BlockWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_SLAB); + public static BlockWrapper DIORITE_SLAB = of(net.minecraft.block.Blocks.DIORITE_SLAB); + public static BlockWrapper BRICK_WALL = of(net.minecraft.block.Blocks.BRICK_WALL); + public static BlockWrapper PRISMARINE_WALL = of(net.minecraft.block.Blocks.PRISMARINE_WALL); + public static BlockWrapper RED_SANDSTONE_WALL = of(net.minecraft.block.Blocks.RED_SANDSTONE_WALL); + public static BlockWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_WALL); + public static BlockWrapper GRANITE_WALL = of(net.minecraft.block.Blocks.GRANITE_WALL); + public static BlockWrapper STONE_BRICK_WALL = of(net.minecraft.block.Blocks.STONE_BRICK_WALL); + public static BlockWrapper NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.NETHER_BRICK_WALL); + public static BlockWrapper ANDESITE_WALL = of(net.minecraft.block.Blocks.ANDESITE_WALL); + public static BlockWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_WALL); + public static BlockWrapper SANDSTONE_WALL = of(net.minecraft.block.Blocks.SANDSTONE_WALL); + public static BlockWrapper END_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.END_STONE_BRICK_WALL); + public static BlockWrapper DIORITE_WALL = of(net.minecraft.block.Blocks.DIORITE_WALL); + public static BlockWrapper SCAFFOLDING = of(net.minecraft.block.Blocks.SCAFFOLDING); + public static BlockWrapper LOOM = of(net.minecraft.block.Blocks.LOOM); + public static BlockWrapper BARREL = of(net.minecraft.block.Blocks.BARREL); + public static BlockWrapper SMOKER = of(net.minecraft.block.Blocks.SMOKER); + public static BlockWrapper BLAST_FURNACE = of(net.minecraft.block.Blocks.BLAST_FURNACE); + public static BlockWrapper CARTOGRAPHY_TABLE = of(net.minecraft.block.Blocks.CARTOGRAPHY_TABLE); + public static BlockWrapper FLETCHING_TABLE = of(net.minecraft.block.Blocks.FLETCHING_TABLE); + public static BlockWrapper GRINDSTONE = of(net.minecraft.block.Blocks.GRINDSTONE); + public static BlockWrapper LECTERN = of(net.minecraft.block.Blocks.LECTERN); + public static BlockWrapper SMITHING_TABLE = of(net.minecraft.block.Blocks.SMITHING_TABLE); + public static BlockWrapper STONECUTTER = of(net.minecraft.block.Blocks.STONECUTTER); + public static BlockWrapper BELL = of(net.minecraft.block.Blocks.BELL); + public static BlockWrapper LANTERN = of(net.minecraft.block.Blocks.LANTERN); + public static BlockWrapper SOUL_LANTERN = of(net.minecraft.block.Blocks.SOUL_LANTERN); + public static BlockWrapper CAMPFIRE = of(net.minecraft.block.Blocks.CAMPFIRE); + public static BlockWrapper SOUL_CAMPFIRE = of(net.minecraft.block.Blocks.SOUL_CAMPFIRE); + public static BlockWrapper SWEET_BERRY_BUSH = of(net.minecraft.block.Blocks.SWEET_BERRY_BUSH); + public static BlockWrapper WARPED_STEM = of(net.minecraft.block.Blocks.WARPED_STEM); + public static BlockWrapper STRIPPED_WARPED_STEM = of(net.minecraft.block.Blocks.STRIPPED_WARPED_STEM); + public static BlockWrapper WARPED_HYPHAE = of(net.minecraft.block.Blocks.WARPED_HYPHAE); + public static BlockWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_WARPED_HYPHAE); + public static BlockWrapper WARPED_NYLIUM = of(net.minecraft.block.Blocks.WARPED_NYLIUM); + public static BlockWrapper WARPED_FUNGUS = of(net.minecraft.block.Blocks.WARPED_FUNGUS); + public static BlockWrapper WARPED_WART_BLOCK = of(net.minecraft.block.Blocks.WARPED_WART_BLOCK); + public static BlockWrapper WARPED_ROOTS = of(net.minecraft.block.Blocks.WARPED_ROOTS); + public static BlockWrapper NETHER_SPROUTS = of(net.minecraft.block.Blocks.NETHER_SPROUTS); + public static BlockWrapper CRIMSON_STEM = of(net.minecraft.block.Blocks.CRIMSON_STEM); + public static BlockWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_STEM); + public static BlockWrapper CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.CRIMSON_HYPHAE); + public static BlockWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_HYPHAE); + public static BlockWrapper CRIMSON_NYLIUM = of(net.minecraft.block.Blocks.CRIMSON_NYLIUM); + public static BlockWrapper CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.CRIMSON_FUNGUS); + public static BlockWrapper SHROOMLIGHT = of(net.minecraft.block.Blocks.SHROOMLIGHT); + public static BlockWrapper WEEPING_VINES = of(net.minecraft.block.Blocks.WEEPING_VINES); + public static BlockWrapper WEEPING_VINES_PLANT = of(net.minecraft.block.Blocks.WEEPING_VINES_PLANT); + public static BlockWrapper TWISTING_VINES = of(net.minecraft.block.Blocks.TWISTING_VINES); + public static BlockWrapper TWISTING_VINES_PLANT = of(net.minecraft.block.Blocks.TWISTING_VINES_PLANT); + public static BlockWrapper CRIMSON_ROOTS = of(net.minecraft.block.Blocks.CRIMSON_ROOTS); + public static BlockWrapper CRIMSON_PLANKS = of(net.minecraft.block.Blocks.CRIMSON_PLANKS); + public static BlockWrapper WARPED_PLANKS = of(net.minecraft.block.Blocks.WARPED_PLANKS); + public static BlockWrapper CRIMSON_SLAB = of(net.minecraft.block.Blocks.CRIMSON_SLAB); + public static BlockWrapper WARPED_SLAB = of(net.minecraft.block.Blocks.WARPED_SLAB); + public static BlockWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.block.Blocks.CRIMSON_PRESSURE_PLATE); + public static BlockWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.WARPED_PRESSURE_PLATE); + public static BlockWrapper CRIMSON_FENCE = of(net.minecraft.block.Blocks.CRIMSON_FENCE); + public static BlockWrapper WARPED_FENCE = of(net.minecraft.block.Blocks.WARPED_FENCE); + public static BlockWrapper CRIMSON_TRAPDOOR = of(net.minecraft.block.Blocks.CRIMSON_TRAPDOOR); + public static BlockWrapper WARPED_TRAPDOOR = of(net.minecraft.block.Blocks.WARPED_TRAPDOOR); + public static BlockWrapper CRIMSON_FENCE_GATE = of(net.minecraft.block.Blocks.CRIMSON_FENCE_GATE); + public static BlockWrapper WARPED_FENCE_GATE = of(net.minecraft.block.Blocks.WARPED_FENCE_GATE); + public static BlockWrapper CRIMSON_STAIRS = of(net.minecraft.block.Blocks.CRIMSON_STAIRS); + public static BlockWrapper WARPED_STAIRS = of(net.minecraft.block.Blocks.WARPED_STAIRS); + public static BlockWrapper CRIMSON_BUTTON = of(net.minecraft.block.Blocks.CRIMSON_BUTTON); + public static BlockWrapper WARPED_BUTTON = of(net.minecraft.block.Blocks.WARPED_BUTTON); + public static BlockWrapper CRIMSON_DOOR = of(net.minecraft.block.Blocks.CRIMSON_DOOR); + public static BlockWrapper WARPED_DOOR = of(net.minecraft.block.Blocks.WARPED_DOOR); + public static BlockWrapper CRIMSON_SIGN = of(net.minecraft.block.Blocks.CRIMSON_SIGN); + public static BlockWrapper WARPED_SIGN = of(net.minecraft.block.Blocks.WARPED_SIGN); + public static BlockWrapper CRIMSON_WALL_SIGN = of(net.minecraft.block.Blocks.CRIMSON_WALL_SIGN); + public static BlockWrapper WARPED_WALL_SIGN = of(net.minecraft.block.Blocks.WARPED_WALL_SIGN); + public static BlockWrapper STRUCTURE_BLOCK = of(net.minecraft.block.Blocks.STRUCTURE_BLOCK); + public static BlockWrapper JIGSAW = of(net.minecraft.block.Blocks.JIGSAW); + public static BlockWrapper COMPOSTER = of(net.minecraft.block.Blocks.COMPOSTER); + public static BlockWrapper TARGET = of(net.minecraft.block.Blocks.TARGET); + public static BlockWrapper BEE_NEST = of(net.minecraft.block.Blocks.BEE_NEST); + public static BlockWrapper BEEHIVE = of(net.minecraft.block.Blocks.BEEHIVE); + public static BlockWrapper HONEY_BLOCK = of(net.minecraft.block.Blocks.HONEY_BLOCK); + public static BlockWrapper HONEYCOMB_BLOCK = of(net.minecraft.block.Blocks.HONEYCOMB_BLOCK); + public static BlockWrapper NETHERITE_BLOCK = of(net.minecraft.block.Blocks.NETHERITE_BLOCK); + public static BlockWrapper ANCIENT_DEBRIS = of(net.minecraft.block.Blocks.ANCIENT_DEBRIS); + public static BlockWrapper CRYING_OBSIDIAN = of(net.minecraft.block.Blocks.CRYING_OBSIDIAN); + public static BlockWrapper RESPAWN_ANCHOR = of(net.minecraft.block.Blocks.RESPAWN_ANCHOR); + public static BlockWrapper POTTED_CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_FUNGUS); + public static BlockWrapper POTTED_WARPED_FUNGUS = of(net.minecraft.block.Blocks.POTTED_WARPED_FUNGUS); + public static BlockWrapper POTTED_CRIMSON_ROOTS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_ROOTS); + public static BlockWrapper POTTED_WARPED_ROOTS = of(net.minecraft.block.Blocks.POTTED_WARPED_ROOTS); + public static BlockWrapper LODESTONE = of(net.minecraft.block.Blocks.LODESTONE); + public static BlockWrapper BLACKSTONE = of(net.minecraft.block.Blocks.BLACKSTONE); + public static BlockWrapper BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.BLACKSTONE_STAIRS); + public static BlockWrapper BLACKSTONE_WALL = of(net.minecraft.block.Blocks.BLACKSTONE_WALL); + public static BlockWrapper BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.BLACKSTONE_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICKS); + public static BlockWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_POLISHED_BLACKSTONE_BRICKS); + public static BlockWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.CHISELED_POLISHED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_WALL); + public static BlockWrapper GILDED_BLACKSTONE = of(net.minecraft.block.Blocks.GILDED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_STAIRS); + public static BlockWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_PRESSURE_PLATE); + public static BlockWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BUTTON); + public static BlockWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_WALL); + public static BlockWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CHISELED_NETHER_BRICKS); + public static BlockWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CRACKED_NETHER_BRICKS); + public static BlockWrapper QUARTZ_BRICKS = of(net.minecraft.block.Blocks.QUARTZ_BRICKS); + + public static BlockWrapper of(net.minecraft.block.Block block) { + return BlockWrapper.of(block); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java index 07adf908a..3795ed003 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java @@ -1,18 +1,982 @@ package net.pitan76.mcpitanlib.midohra.item; public class Items { - public static ItemWrapper AIR = of(net.minecraft.item.Items.AIR); - public static ItemWrapper DIRT = of(net.minecraft.item.Items.DIRT); - public static ItemWrapper GRASS_BLOCK = of(net.minecraft.item.Items.GRASS_BLOCK); public static ItemWrapper STONE = of(net.minecraft.item.Items.STONE); - public static ItemWrapper SAND = of(net.minecraft.item.Items.SAND); + public static ItemWrapper GRANITE = of(net.minecraft.item.Items.GRANITE); + public static ItemWrapper POLISHED_GRANITE = of(net.minecraft.item.Items.POLISHED_GRANITE); + public static ItemWrapper DIORITE = of(net.minecraft.item.Items.DIORITE); + public static ItemWrapper POLISHED_DIORITE = of(net.minecraft.item.Items.POLISHED_DIORITE); + public static ItemWrapper ANDESITE = of(net.minecraft.item.Items.ANDESITE); + public static ItemWrapper POLISHED_ANDESITE = of(net.minecraft.item.Items.POLISHED_ANDESITE); + public static ItemWrapper GRASS_BLOCK = of(net.minecraft.item.Items.GRASS_BLOCK); + public static ItemWrapper DIRT = of(net.minecraft.item.Items.DIRT); + public static ItemWrapper COARSE_DIRT = of(net.minecraft.item.Items.COARSE_DIRT); + public static ItemWrapper PODZOL = of(net.minecraft.item.Items.PODZOL); + public static ItemWrapper CRIMSON_NYLIUM = of(net.minecraft.item.Items.CRIMSON_NYLIUM); + public static ItemWrapper WARPED_NYLIUM = of(net.minecraft.item.Items.WARPED_NYLIUM); public static ItemWrapper COBBLESTONE = of(net.minecraft.item.Items.COBBLESTONE); - public static ItemWrapper OAK_LOG = of(net.minecraft.item.Items.OAK_LOG); public static ItemWrapper OAK_PLANKS = of(net.minecraft.item.Items.OAK_PLANKS); + public static ItemWrapper SPRUCE_PLANKS = of(net.minecraft.item.Items.SPRUCE_PLANKS); + public static ItemWrapper BIRCH_PLANKS = of(net.minecraft.item.Items.BIRCH_PLANKS); + public static ItemWrapper JUNGLE_PLANKS = of(net.minecraft.item.Items.JUNGLE_PLANKS); + public static ItemWrapper ACACIA_PLANKS = of(net.minecraft.item.Items.ACACIA_PLANKS); + public static ItemWrapper DARK_OAK_PLANKS = of(net.minecraft.item.Items.DARK_OAK_PLANKS); + public static ItemWrapper CRIMSON_PLANKS = of(net.minecraft.item.Items.CRIMSON_PLANKS); + public static ItemWrapper WARPED_PLANKS = of(net.minecraft.item.Items.WARPED_PLANKS); + public static ItemWrapper OAK_SAPLING = of(net.minecraft.item.Items.OAK_SAPLING); + public static ItemWrapper SPRUCE_SAPLING = of(net.minecraft.item.Items.SPRUCE_SAPLING); + public static ItemWrapper BIRCH_SAPLING = of(net.minecraft.item.Items.BIRCH_SAPLING); + public static ItemWrapper JUNGLE_SAPLING = of(net.minecraft.item.Items.JUNGLE_SAPLING); + public static ItemWrapper ACACIA_SAPLING = of(net.minecraft.item.Items.ACACIA_SAPLING); + public static ItemWrapper DARK_OAK_SAPLING = of(net.minecraft.item.Items.DARK_OAK_SAPLING); + public static ItemWrapper BEDROCK = of(net.minecraft.item.Items.BEDROCK); + public static ItemWrapper SAND = of(net.minecraft.item.Items.SAND); + public static ItemWrapper RED_SAND = of(net.minecraft.item.Items.RED_SAND); + public static ItemWrapper GRAVEL = of(net.minecraft.item.Items.GRAVEL); + public static ItemWrapper GOLD_ORE = of(net.minecraft.item.Items.GOLD_ORE); + public static ItemWrapper IRON_ORE = of(net.minecraft.item.Items.IRON_ORE); + public static ItemWrapper COAL_ORE = of(net.minecraft.item.Items.COAL_ORE); + public static ItemWrapper NETHER_GOLD_ORE = of(net.minecraft.item.Items.NETHER_GOLD_ORE); + public static ItemWrapper OAK_LOG = of(net.minecraft.item.Items.OAK_LOG); + public static ItemWrapper SPRUCE_LOG = of(net.minecraft.item.Items.SPRUCE_LOG); + public static ItemWrapper BIRCH_LOG = of(net.minecraft.item.Items.BIRCH_LOG); + public static ItemWrapper JUNGLE_LOG = of(net.minecraft.item.Items.JUNGLE_LOG); + public static ItemWrapper ACACIA_LOG = of(net.minecraft.item.Items.ACACIA_LOG); + public static ItemWrapper DARK_OAK_LOG = of(net.minecraft.item.Items.DARK_OAK_LOG); + public static ItemWrapper CRIMSON_STEM = of(net.minecraft.item.Items.CRIMSON_STEM); + public static ItemWrapper WARPED_STEM = of(net.minecraft.item.Items.WARPED_STEM); + public static ItemWrapper STRIPPED_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_OAK_LOG); + public static ItemWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.item.Items.STRIPPED_SPRUCE_LOG); + public static ItemWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.item.Items.STRIPPED_BIRCH_LOG); + public static ItemWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.item.Items.STRIPPED_JUNGLE_LOG); + public static ItemWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.item.Items.STRIPPED_ACACIA_LOG); + public static ItemWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_LOG); + public static ItemWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.item.Items.STRIPPED_CRIMSON_STEM); + public static ItemWrapper STRIPPED_WARPED_STEM = of(net.minecraft.item.Items.STRIPPED_WARPED_STEM); + public static ItemWrapper STRIPPED_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_OAK_WOOD); + public static ItemWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.item.Items.STRIPPED_SPRUCE_WOOD); + public static ItemWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.item.Items.STRIPPED_BIRCH_WOOD); + public static ItemWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.item.Items.STRIPPED_JUNGLE_WOOD); + public static ItemWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.item.Items.STRIPPED_ACACIA_WOOD); + public static ItemWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_WOOD); + public static ItemWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.item.Items.STRIPPED_CRIMSON_HYPHAE); + public static ItemWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.item.Items.STRIPPED_WARPED_HYPHAE); + public static ItemWrapper OAK_WOOD = of(net.minecraft.item.Items.OAK_WOOD); + public static ItemWrapper SPRUCE_WOOD = of(net.minecraft.item.Items.SPRUCE_WOOD); + public static ItemWrapper BIRCH_WOOD = of(net.minecraft.item.Items.BIRCH_WOOD); + public static ItemWrapper JUNGLE_WOOD = of(net.minecraft.item.Items.JUNGLE_WOOD); + public static ItemWrapper ACACIA_WOOD = of(net.minecraft.item.Items.ACACIA_WOOD); + public static ItemWrapper DARK_OAK_WOOD = of(net.minecraft.item.Items.DARK_OAK_WOOD); + public static ItemWrapper CRIMSON_HYPHAE = of(net.minecraft.item.Items.CRIMSON_HYPHAE); + public static ItemWrapper WARPED_HYPHAE = of(net.minecraft.item.Items.WARPED_HYPHAE); public static ItemWrapper OAK_LEAVES = of(net.minecraft.item.Items.OAK_LEAVES); - public static ItemWrapper WHITE_WOOL = of(net.minecraft.item.Items.WHITE_WOOL); + public static ItemWrapper SPRUCE_LEAVES = of(net.minecraft.item.Items.SPRUCE_LEAVES); + public static ItemWrapper BIRCH_LEAVES = of(net.minecraft.item.Items.BIRCH_LEAVES); + public static ItemWrapper JUNGLE_LEAVES = of(net.minecraft.item.Items.JUNGLE_LEAVES); + public static ItemWrapper ACACIA_LEAVES = of(net.minecraft.item.Items.ACACIA_LEAVES); + public static ItemWrapper DARK_OAK_LEAVES = of(net.minecraft.item.Items.DARK_OAK_LEAVES); + public static ItemWrapper SPONGE = of(net.minecraft.item.Items.SPONGE); + public static ItemWrapper WET_SPONGE = of(net.minecraft.item.Items.WET_SPONGE); public static ItemWrapper GLASS = of(net.minecraft.item.Items.GLASS); + public static ItemWrapper LAPIS_ORE = of(net.minecraft.item.Items.LAPIS_ORE); + public static ItemWrapper LAPIS_BLOCK = of(net.minecraft.item.Items.LAPIS_BLOCK); + public static ItemWrapper DISPENSER = of(net.minecraft.item.Items.DISPENSER); + public static ItemWrapper SANDSTONE = of(net.minecraft.item.Items.SANDSTONE); + public static ItemWrapper CHISELED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_SANDSTONE); + public static ItemWrapper CUT_SANDSTONE = of(net.minecraft.item.Items.CUT_SANDSTONE); + public static ItemWrapper NOTE_BLOCK = of(net.minecraft.item.Items.NOTE_BLOCK); + public static ItemWrapper POWERED_RAIL = of(net.minecraft.item.Items.POWERED_RAIL); + public static ItemWrapper DETECTOR_RAIL = of(net.minecraft.item.Items.DETECTOR_RAIL); + public static ItemWrapper STICKY_PISTON = of(net.minecraft.item.Items.STICKY_PISTON); + public static ItemWrapper COBWEB = of(net.minecraft.item.Items.COBWEB); + public static ItemWrapper GRASS = of(net.minecraft.item.Items.GRASS); + public static ItemWrapper FERN = of(net.minecraft.item.Items.FERN); + public static ItemWrapper DEAD_BUSH = of(net.minecraft.item.Items.DEAD_BUSH); + public static ItemWrapper SEAGRASS = of(net.minecraft.item.Items.SEAGRASS); + public static ItemWrapper SEA_PICKLE = of(net.minecraft.item.Items.SEA_PICKLE); + public static ItemWrapper PISTON = of(net.minecraft.item.Items.PISTON); + public static ItemWrapper WHITE_WOOL = of(net.minecraft.item.Items.WHITE_WOOL); + public static ItemWrapper ORANGE_WOOL = of(net.minecraft.item.Items.ORANGE_WOOL); + public static ItemWrapper MAGENTA_WOOL = of(net.minecraft.item.Items.MAGENTA_WOOL); + public static ItemWrapper LIGHT_BLUE_WOOL = of(net.minecraft.item.Items.LIGHT_BLUE_WOOL); + public static ItemWrapper YELLOW_WOOL = of(net.minecraft.item.Items.YELLOW_WOOL); + public static ItemWrapper LIME_WOOL = of(net.minecraft.item.Items.LIME_WOOL); + public static ItemWrapper PINK_WOOL = of(net.minecraft.item.Items.PINK_WOOL); + public static ItemWrapper GRAY_WOOL = of(net.minecraft.item.Items.GRAY_WOOL); + public static ItemWrapper LIGHT_GRAY_WOOL = of(net.minecraft.item.Items.LIGHT_GRAY_WOOL); + public static ItemWrapper CYAN_WOOL = of(net.minecraft.item.Items.CYAN_WOOL); + public static ItemWrapper PURPLE_WOOL = of(net.minecraft.item.Items.PURPLE_WOOL); + public static ItemWrapper BLUE_WOOL = of(net.minecraft.item.Items.BLUE_WOOL); + public static ItemWrapper BROWN_WOOL = of(net.minecraft.item.Items.BROWN_WOOL); + public static ItemWrapper GREEN_WOOL = of(net.minecraft.item.Items.GREEN_WOOL); + public static ItemWrapper RED_WOOL = of(net.minecraft.item.Items.RED_WOOL); + public static ItemWrapper BLACK_WOOL = of(net.minecraft.item.Items.BLACK_WOOL); + public static ItemWrapper DANDELION = of(net.minecraft.item.Items.DANDELION); + public static ItemWrapper POPPY = of(net.minecraft.item.Items.POPPY); + public static ItemWrapper BLUE_ORCHID = of(net.minecraft.item.Items.BLUE_ORCHID); + public static ItemWrapper ALLIUM = of(net.minecraft.item.Items.ALLIUM); + public static ItemWrapper AZURE_BLUET = of(net.minecraft.item.Items.AZURE_BLUET); + public static ItemWrapper RED_TULIP = of(net.minecraft.item.Items.RED_TULIP); + public static ItemWrapper ORANGE_TULIP = of(net.minecraft.item.Items.ORANGE_TULIP); + public static ItemWrapper WHITE_TULIP = of(net.minecraft.item.Items.WHITE_TULIP); + public static ItemWrapper PINK_TULIP = of(net.minecraft.item.Items.PINK_TULIP); + public static ItemWrapper OXEYE_DAISY = of(net.minecraft.item.Items.OXEYE_DAISY); + public static ItemWrapper CORNFLOWER = of(net.minecraft.item.Items.CORNFLOWER); + public static ItemWrapper LILY_OF_THE_VALLEY = of(net.minecraft.item.Items.LILY_OF_THE_VALLEY); + public static ItemWrapper WITHER_ROSE = of(net.minecraft.item.Items.WITHER_ROSE); + public static ItemWrapper BROWN_MUSHROOM = of(net.minecraft.item.Items.BROWN_MUSHROOM); + public static ItemWrapper RED_MUSHROOM = of(net.minecraft.item.Items.RED_MUSHROOM); + public static ItemWrapper CRIMSON_FUNGUS = of(net.minecraft.item.Items.CRIMSON_FUNGUS); + public static ItemWrapper WARPED_FUNGUS = of(net.minecraft.item.Items.WARPED_FUNGUS); + public static ItemWrapper CRIMSON_ROOTS = of(net.minecraft.item.Items.CRIMSON_ROOTS); + public static ItemWrapper WARPED_ROOTS = of(net.minecraft.item.Items.WARPED_ROOTS); + public static ItemWrapper NETHER_SPROUTS = of(net.minecraft.item.Items.NETHER_SPROUTS); + public static ItemWrapper WEEPING_VINES = of(net.minecraft.item.Items.WEEPING_VINES); + public static ItemWrapper TWISTING_VINES = of(net.minecraft.item.Items.TWISTING_VINES); + public static ItemWrapper SUGAR_CANE = of(net.minecraft.item.Items.SUGAR_CANE); + public static ItemWrapper KELP = of(net.minecraft.item.Items.KELP); + public static ItemWrapper BAMBOO = of(net.minecraft.item.Items.BAMBOO); + public static ItemWrapper GOLD_BLOCK = of(net.minecraft.item.Items.GOLD_BLOCK); + public static ItemWrapper IRON_BLOCK = of(net.minecraft.item.Items.IRON_BLOCK); + public static ItemWrapper OAK_SLAB = of(net.minecraft.item.Items.OAK_SLAB); + public static ItemWrapper SPRUCE_SLAB = of(net.minecraft.item.Items.SPRUCE_SLAB); + public static ItemWrapper BIRCH_SLAB = of(net.minecraft.item.Items.BIRCH_SLAB); + public static ItemWrapper JUNGLE_SLAB = of(net.minecraft.item.Items.JUNGLE_SLAB); + public static ItemWrapper ACACIA_SLAB = of(net.minecraft.item.Items.ACACIA_SLAB); + public static ItemWrapper DARK_OAK_SLAB = of(net.minecraft.item.Items.DARK_OAK_SLAB); + public static ItemWrapper CRIMSON_SLAB = of(net.minecraft.item.Items.CRIMSON_SLAB); + public static ItemWrapper WARPED_SLAB = of(net.minecraft.item.Items.WARPED_SLAB); + public static ItemWrapper STONE_SLAB = of(net.minecraft.item.Items.STONE_SLAB); + public static ItemWrapper SMOOTH_STONE_SLAB = of(net.minecraft.item.Items.SMOOTH_STONE_SLAB); + public static ItemWrapper SANDSTONE_SLAB = of(net.minecraft.item.Items.SANDSTONE_SLAB); + public static ItemWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_SANDSTONE_SLAB); + public static ItemWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.item.Items.PETRIFIED_OAK_SLAB); + public static ItemWrapper COBBLESTONE_SLAB = of(net.minecraft.item.Items.COBBLESTONE_SLAB); + public static ItemWrapper BRICK_SLAB = of(net.minecraft.item.Items.BRICK_SLAB); + public static ItemWrapper STONE_BRICK_SLAB = of(net.minecraft.item.Items.STONE_BRICK_SLAB); + public static ItemWrapper NETHER_BRICK_SLAB = of(net.minecraft.item.Items.NETHER_BRICK_SLAB); + public static ItemWrapper QUARTZ_SLAB = of(net.minecraft.item.Items.QUARTZ_SLAB); + public static ItemWrapper RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.RED_SANDSTONE_SLAB); + public static ItemWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_RED_SANDSTONE_SLAB); + public static ItemWrapper PURPUR_SLAB = of(net.minecraft.item.Items.PURPUR_SLAB); + public static ItemWrapper PRISMARINE_SLAB = of(net.minecraft.item.Items.PRISMARINE_SLAB); + public static ItemWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.item.Items.PRISMARINE_BRICK_SLAB); + public static ItemWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.item.Items.DARK_PRISMARINE_SLAB); + public static ItemWrapper SMOOTH_QUARTZ = of(net.minecraft.item.Items.SMOOTH_QUARTZ); + public static ItemWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE); + public static ItemWrapper SMOOTH_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_SANDSTONE); + public static ItemWrapper SMOOTH_STONE = of(net.minecraft.item.Items.SMOOTH_STONE); + public static ItemWrapper BRICKS = of(net.minecraft.item.Items.BRICKS); + public static ItemWrapper TNT = of(net.minecraft.item.Items.TNT); + public static ItemWrapper BOOKSHELF = of(net.minecraft.item.Items.BOOKSHELF); + public static ItemWrapper MOSSY_COBBLESTONE = of(net.minecraft.item.Items.MOSSY_COBBLESTONE); + public static ItemWrapper OBSIDIAN = of(net.minecraft.item.Items.OBSIDIAN); + public static ItemWrapper TORCH = of(net.minecraft.item.Items.TORCH); + public static ItemWrapper END_ROD = of(net.minecraft.item.Items.END_ROD); + public static ItemWrapper CHORUS_PLANT = of(net.minecraft.item.Items.CHORUS_PLANT); + public static ItemWrapper CHORUS_FLOWER = of(net.minecraft.item.Items.CHORUS_FLOWER); + public static ItemWrapper PURPUR_BLOCK = of(net.minecraft.item.Items.PURPUR_BLOCK); + public static ItemWrapper PURPUR_PILLAR = of(net.minecraft.item.Items.PURPUR_PILLAR); + public static ItemWrapper PURPUR_STAIRS = of(net.minecraft.item.Items.PURPUR_STAIRS); + public static ItemWrapper SPAWNER = of(net.minecraft.item.Items.SPAWNER); + public static ItemWrapper OAK_STAIRS = of(net.minecraft.item.Items.OAK_STAIRS); + public static ItemWrapper CHEST = of(net.minecraft.item.Items.CHEST); + public static ItemWrapper DIAMOND_ORE = of(net.minecraft.item.Items.DIAMOND_ORE); + public static ItemWrapper DIAMOND_BLOCK = of(net.minecraft.item.Items.DIAMOND_BLOCK); + public static ItemWrapper CRAFTING_TABLE = of(net.minecraft.item.Items.CRAFTING_TABLE); + public static ItemWrapper FARMLAND = of(net.minecraft.item.Items.FARMLAND); + public static ItemWrapper FURNACE = of(net.minecraft.item.Items.FURNACE); + public static ItemWrapper LADDER = of(net.minecraft.item.Items.LADDER); + public static ItemWrapper RAIL = of(net.minecraft.item.Items.RAIL); + public static ItemWrapper COBBLESTONE_STAIRS = of(net.minecraft.item.Items.COBBLESTONE_STAIRS); + public static ItemWrapper LEVER = of(net.minecraft.item.Items.LEVER); + public static ItemWrapper STONE_PRESSURE_PLATE = of(net.minecraft.item.Items.STONE_PRESSURE_PLATE); + public static ItemWrapper OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.OAK_PRESSURE_PLATE); + public static ItemWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.item.Items.SPRUCE_PRESSURE_PLATE); + public static ItemWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.item.Items.BIRCH_PRESSURE_PLATE); + public static ItemWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.item.Items.JUNGLE_PRESSURE_PLATE); + public static ItemWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.item.Items.ACACIA_PRESSURE_PLATE); + public static ItemWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.DARK_OAK_PRESSURE_PLATE); + public static ItemWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.item.Items.CRIMSON_PRESSURE_PLATE); + public static ItemWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.item.Items.WARPED_PRESSURE_PLATE); + public static ItemWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_PRESSURE_PLATE); + public static ItemWrapper REDSTONE_ORE = of(net.minecraft.item.Items.REDSTONE_ORE); + public static ItemWrapper REDSTONE_TORCH = of(net.minecraft.item.Items.REDSTONE_TORCH); + public static ItemWrapper SNOW = of(net.minecraft.item.Items.SNOW); + public static ItemWrapper ICE = of(net.minecraft.item.Items.ICE); + public static ItemWrapper SNOW_BLOCK = of(net.minecraft.item.Items.SNOW_BLOCK); + public static ItemWrapper CACTUS = of(net.minecraft.item.Items.CACTUS); + public static ItemWrapper CLAY = of(net.minecraft.item.Items.CLAY); + public static ItemWrapper JUKEBOX = of(net.minecraft.item.Items.JUKEBOX); + public static ItemWrapper OAK_FENCE = of(net.minecraft.item.Items.OAK_FENCE); + public static ItemWrapper SPRUCE_FENCE = of(net.minecraft.item.Items.SPRUCE_FENCE); + public static ItemWrapper BIRCH_FENCE = of(net.minecraft.item.Items.BIRCH_FENCE); + public static ItemWrapper JUNGLE_FENCE = of(net.minecraft.item.Items.JUNGLE_FENCE); + public static ItemWrapper ACACIA_FENCE = of(net.minecraft.item.Items.ACACIA_FENCE); + public static ItemWrapper DARK_OAK_FENCE = of(net.minecraft.item.Items.DARK_OAK_FENCE); + public static ItemWrapper CRIMSON_FENCE = of(net.minecraft.item.Items.CRIMSON_FENCE); + public static ItemWrapper WARPED_FENCE = of(net.minecraft.item.Items.WARPED_FENCE); + public static ItemWrapper PUMPKIN = of(net.minecraft.item.Items.PUMPKIN); + public static ItemWrapper CARVED_PUMPKIN = of(net.minecraft.item.Items.CARVED_PUMPKIN); + public static ItemWrapper NETHERRACK = of(net.minecraft.item.Items.NETHERRACK); + public static ItemWrapper SOUL_SAND = of(net.minecraft.item.Items.SOUL_SAND); + public static ItemWrapper SOUL_SOIL = of(net.minecraft.item.Items.SOUL_SOIL); + public static ItemWrapper BASALT = of(net.minecraft.item.Items.BASALT); + public static ItemWrapper POLISHED_BASALT = of(net.minecraft.item.Items.POLISHED_BASALT); + public static ItemWrapper SOUL_TORCH = of(net.minecraft.item.Items.SOUL_TORCH); + public static ItemWrapper GLOWSTONE = of(net.minecraft.item.Items.GLOWSTONE); + public static ItemWrapper JACK_O_LANTERN = of(net.minecraft.item.Items.JACK_O_LANTERN); + public static ItemWrapper OAK_TRAPDOOR = of(net.minecraft.item.Items.OAK_TRAPDOOR); + public static ItemWrapper SPRUCE_TRAPDOOR = of(net.minecraft.item.Items.SPRUCE_TRAPDOOR); + public static ItemWrapper BIRCH_TRAPDOOR = of(net.minecraft.item.Items.BIRCH_TRAPDOOR); + public static ItemWrapper JUNGLE_TRAPDOOR = of(net.minecraft.item.Items.JUNGLE_TRAPDOOR); + public static ItemWrapper ACACIA_TRAPDOOR = of(net.minecraft.item.Items.ACACIA_TRAPDOOR); + public static ItemWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.item.Items.DARK_OAK_TRAPDOOR); + public static ItemWrapper CRIMSON_TRAPDOOR = of(net.minecraft.item.Items.CRIMSON_TRAPDOOR); + public static ItemWrapper WARPED_TRAPDOOR = of(net.minecraft.item.Items.WARPED_TRAPDOOR); + public static ItemWrapper INFESTED_STONE = of(net.minecraft.item.Items.INFESTED_STONE); + public static ItemWrapper INFESTED_COBBLESTONE = of(net.minecraft.item.Items.INFESTED_COBBLESTONE); + public static ItemWrapper INFESTED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_STONE_BRICKS); + public static ItemWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_MOSSY_STONE_BRICKS); + public static ItemWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CRACKED_STONE_BRICKS); + public static ItemWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CHISELED_STONE_BRICKS); + public static ItemWrapper STONE_BRICKS = of(net.minecraft.item.Items.STONE_BRICKS); + public static ItemWrapper MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.MOSSY_STONE_BRICKS); + public static ItemWrapper CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.CRACKED_STONE_BRICKS); + public static ItemWrapper CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.CHISELED_STONE_BRICKS); + public static ItemWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.item.Items.BROWN_MUSHROOM_BLOCK); + public static ItemWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.item.Items.RED_MUSHROOM_BLOCK); + public static ItemWrapper MUSHROOM_STEM = of(net.minecraft.item.Items.MUSHROOM_STEM); + public static ItemWrapper IRON_BARS = of(net.minecraft.item.Items.IRON_BARS); + public static ItemWrapper CHAIN = of(net.minecraft.item.Items.CHAIN); + public static ItemWrapper GLASS_PANE = of(net.minecraft.item.Items.GLASS_PANE); + public static ItemWrapper MELON = of(net.minecraft.item.Items.MELON); + public static ItemWrapper VINE = of(net.minecraft.item.Items.VINE); + public static ItemWrapper OAK_FENCE_GATE = of(net.minecraft.item.Items.OAK_FENCE_GATE); + public static ItemWrapper SPRUCE_FENCE_GATE = of(net.minecraft.item.Items.SPRUCE_FENCE_GATE); + public static ItemWrapper BIRCH_FENCE_GATE = of(net.minecraft.item.Items.BIRCH_FENCE_GATE); + public static ItemWrapper JUNGLE_FENCE_GATE = of(net.minecraft.item.Items.JUNGLE_FENCE_GATE); + public static ItemWrapper ACACIA_FENCE_GATE = of(net.minecraft.item.Items.ACACIA_FENCE_GATE); + public static ItemWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.item.Items.DARK_OAK_FENCE_GATE); + public static ItemWrapper CRIMSON_FENCE_GATE = of(net.minecraft.item.Items.CRIMSON_FENCE_GATE); + public static ItemWrapper WARPED_FENCE_GATE = of(net.minecraft.item.Items.WARPED_FENCE_GATE); + public static ItemWrapper BRICK_STAIRS = of(net.minecraft.item.Items.BRICK_STAIRS); + public static ItemWrapper STONE_BRICK_STAIRS = of(net.minecraft.item.Items.STONE_BRICK_STAIRS); + public static ItemWrapper MYCELIUM = of(net.minecraft.item.Items.MYCELIUM); + public static ItemWrapper LILY_PAD = of(net.minecraft.item.Items.LILY_PAD); + public static ItemWrapper NETHER_BRICKS = of(net.minecraft.item.Items.NETHER_BRICKS); + public static ItemWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.item.Items.CRACKED_NETHER_BRICKS); + public static ItemWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.item.Items.CHISELED_NETHER_BRICKS); + public static ItemWrapper NETHER_BRICK_FENCE = of(net.minecraft.item.Items.NETHER_BRICK_FENCE); + public static ItemWrapper NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.NETHER_BRICK_STAIRS); + public static ItemWrapper ENCHANTING_TABLE = of(net.minecraft.item.Items.ENCHANTING_TABLE); + public static ItemWrapper END_PORTAL_FRAME = of(net.minecraft.item.Items.END_PORTAL_FRAME); + public static ItemWrapper END_STONE = of(net.minecraft.item.Items.END_STONE); + public static ItemWrapper END_STONE_BRICKS = of(net.minecraft.item.Items.END_STONE_BRICKS); + public static ItemWrapper DRAGON_EGG = of(net.minecraft.item.Items.DRAGON_EGG); + public static ItemWrapper REDSTONE_LAMP = of(net.minecraft.item.Items.REDSTONE_LAMP); + public static ItemWrapper SANDSTONE_STAIRS = of(net.minecraft.item.Items.SANDSTONE_STAIRS); + public static ItemWrapper EMERALD_ORE = of(net.minecraft.item.Items.EMERALD_ORE); + public static ItemWrapper ENDER_CHEST = of(net.minecraft.item.Items.ENDER_CHEST); + public static ItemWrapper TRIPWIRE_HOOK = of(net.minecraft.item.Items.TRIPWIRE_HOOK); + public static ItemWrapper EMERALD_BLOCK = of(net.minecraft.item.Items.EMERALD_BLOCK); + public static ItemWrapper SPRUCE_STAIRS = of(net.minecraft.item.Items.SPRUCE_STAIRS); + public static ItemWrapper BIRCH_STAIRS = of(net.minecraft.item.Items.BIRCH_STAIRS); + public static ItemWrapper JUNGLE_STAIRS = of(net.minecraft.item.Items.JUNGLE_STAIRS); + public static ItemWrapper CRIMSON_STAIRS = of(net.minecraft.item.Items.CRIMSON_STAIRS); + public static ItemWrapper WARPED_STAIRS = of(net.minecraft.item.Items.WARPED_STAIRS); + public static ItemWrapper COMMAND_BLOCK = of(net.minecraft.item.Items.COMMAND_BLOCK); + public static ItemWrapper BEACON = of(net.minecraft.item.Items.BEACON); + public static ItemWrapper COBBLESTONE_WALL = of(net.minecraft.item.Items.COBBLESTONE_WALL); + public static ItemWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_WALL); + public static ItemWrapper BRICK_WALL = of(net.minecraft.item.Items.BRICK_WALL); + public static ItemWrapper PRISMARINE_WALL = of(net.minecraft.item.Items.PRISMARINE_WALL); + public static ItemWrapper RED_SANDSTONE_WALL = of(net.minecraft.item.Items.RED_SANDSTONE_WALL); + public static ItemWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_WALL); + public static ItemWrapper GRANITE_WALL = of(net.minecraft.item.Items.GRANITE_WALL); + public static ItemWrapper STONE_BRICK_WALL = of(net.minecraft.item.Items.STONE_BRICK_WALL); + public static ItemWrapper NETHER_BRICK_WALL = of(net.minecraft.item.Items.NETHER_BRICK_WALL); + public static ItemWrapper ANDESITE_WALL = of(net.minecraft.item.Items.ANDESITE_WALL); + public static ItemWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.item.Items.RED_NETHER_BRICK_WALL); + public static ItemWrapper SANDSTONE_WALL = of(net.minecraft.item.Items.SANDSTONE_WALL); + public static ItemWrapper END_STONE_BRICK_WALL = of(net.minecraft.item.Items.END_STONE_BRICK_WALL); + public static ItemWrapper DIORITE_WALL = of(net.minecraft.item.Items.DIORITE_WALL); + public static ItemWrapper BLACKSTONE_WALL = of(net.minecraft.item.Items.BLACKSTONE_WALL); + public static ItemWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_WALL); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_WALL); + public static ItemWrapper STONE_BUTTON = of(net.minecraft.item.Items.STONE_BUTTON); + public static ItemWrapper OAK_BUTTON = of(net.minecraft.item.Items.OAK_BUTTON); + public static ItemWrapper SPRUCE_BUTTON = of(net.minecraft.item.Items.SPRUCE_BUTTON); + public static ItemWrapper BIRCH_BUTTON = of(net.minecraft.item.Items.BIRCH_BUTTON); + public static ItemWrapper JUNGLE_BUTTON = of(net.minecraft.item.Items.JUNGLE_BUTTON); + public static ItemWrapper ACACIA_BUTTON = of(net.minecraft.item.Items.ACACIA_BUTTON); + public static ItemWrapper DARK_OAK_BUTTON = of(net.minecraft.item.Items.DARK_OAK_BUTTON); + public static ItemWrapper CRIMSON_BUTTON = of(net.minecraft.item.Items.CRIMSON_BUTTON); + public static ItemWrapper WARPED_BUTTON = of(net.minecraft.item.Items.WARPED_BUTTON); + public static ItemWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BUTTON); + public static ItemWrapper ANVIL = of(net.minecraft.item.Items.ANVIL); + public static ItemWrapper CHIPPED_ANVIL = of(net.minecraft.item.Items.CHIPPED_ANVIL); + public static ItemWrapper DAMAGED_ANVIL = of(net.minecraft.item.Items.DAMAGED_ANVIL); + public static ItemWrapper TRAPPED_CHEST = of(net.minecraft.item.Items.TRAPPED_CHEST); + public static ItemWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.LIGHT_WEIGHTED_PRESSURE_PLATE); + public static ItemWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.HEAVY_WEIGHTED_PRESSURE_PLATE); + public static ItemWrapper DAYLIGHT_DETECTOR = of(net.minecraft.item.Items.DAYLIGHT_DETECTOR); + public static ItemWrapper REDSTONE_BLOCK = of(net.minecraft.item.Items.REDSTONE_BLOCK); + public static ItemWrapper NETHER_QUARTZ_ORE = of(net.minecraft.item.Items.NETHER_QUARTZ_ORE); + public static ItemWrapper HOPPER = of(net.minecraft.item.Items.HOPPER); + public static ItemWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.item.Items.CHISELED_QUARTZ_BLOCK); + public static ItemWrapper QUARTZ_BLOCK = of(net.minecraft.item.Items.QUARTZ_BLOCK); + public static ItemWrapper QUARTZ_BRICKS = of(net.minecraft.item.Items.QUARTZ_BRICKS); + public static ItemWrapper QUARTZ_PILLAR = of(net.minecraft.item.Items.QUARTZ_PILLAR); + public static ItemWrapper QUARTZ_STAIRS = of(net.minecraft.item.Items.QUARTZ_STAIRS); + public static ItemWrapper ACTIVATOR_RAIL = of(net.minecraft.item.Items.ACTIVATOR_RAIL); + public static ItemWrapper DROPPER = of(net.minecraft.item.Items.DROPPER); + public static ItemWrapper WHITE_TERRACOTTA = of(net.minecraft.item.Items.WHITE_TERRACOTTA); + public static ItemWrapper ORANGE_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_TERRACOTTA); + public static ItemWrapper MAGENTA_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_TERRACOTTA); + public static ItemWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_TERRACOTTA); + public static ItemWrapper YELLOW_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_TERRACOTTA); + public static ItemWrapper LIME_TERRACOTTA = of(net.minecraft.item.Items.LIME_TERRACOTTA); + public static ItemWrapper PINK_TERRACOTTA = of(net.minecraft.item.Items.PINK_TERRACOTTA); + public static ItemWrapper GRAY_TERRACOTTA = of(net.minecraft.item.Items.GRAY_TERRACOTTA); + public static ItemWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_TERRACOTTA); + public static ItemWrapper CYAN_TERRACOTTA = of(net.minecraft.item.Items.CYAN_TERRACOTTA); + public static ItemWrapper PURPLE_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_TERRACOTTA); + public static ItemWrapper BLUE_TERRACOTTA = of(net.minecraft.item.Items.BLUE_TERRACOTTA); + public static ItemWrapper BROWN_TERRACOTTA = of(net.minecraft.item.Items.BROWN_TERRACOTTA); + public static ItemWrapper GREEN_TERRACOTTA = of(net.minecraft.item.Items.GREEN_TERRACOTTA); + public static ItemWrapper RED_TERRACOTTA = of(net.minecraft.item.Items.RED_TERRACOTTA); + public static ItemWrapper BLACK_TERRACOTTA = of(net.minecraft.item.Items.BLACK_TERRACOTTA); + public static ItemWrapper BARRIER = of(net.minecraft.item.Items.BARRIER); + public static ItemWrapper IRON_TRAPDOOR = of(net.minecraft.item.Items.IRON_TRAPDOOR); + public static ItemWrapper HAY_BLOCK = of(net.minecraft.item.Items.HAY_BLOCK); + public static ItemWrapper WHITE_CARPET = of(net.minecraft.item.Items.WHITE_CARPET); + public static ItemWrapper ORANGE_CARPET = of(net.minecraft.item.Items.ORANGE_CARPET); + public static ItemWrapper MAGENTA_CARPET = of(net.minecraft.item.Items.MAGENTA_CARPET); + public static ItemWrapper LIGHT_BLUE_CARPET = of(net.minecraft.item.Items.LIGHT_BLUE_CARPET); + public static ItemWrapper YELLOW_CARPET = of(net.minecraft.item.Items.YELLOW_CARPET); + public static ItemWrapper LIME_CARPET = of(net.minecraft.item.Items.LIME_CARPET); + public static ItemWrapper PINK_CARPET = of(net.minecraft.item.Items.PINK_CARPET); + public static ItemWrapper GRAY_CARPET = of(net.minecraft.item.Items.GRAY_CARPET); + public static ItemWrapper LIGHT_GRAY_CARPET = of(net.minecraft.item.Items.LIGHT_GRAY_CARPET); + public static ItemWrapper CYAN_CARPET = of(net.minecraft.item.Items.CYAN_CARPET); + public static ItemWrapper PURPLE_CARPET = of(net.minecraft.item.Items.PURPLE_CARPET); + public static ItemWrapper BLUE_CARPET = of(net.minecraft.item.Items.BLUE_CARPET); + public static ItemWrapper BROWN_CARPET = of(net.minecraft.item.Items.BROWN_CARPET); + public static ItemWrapper GREEN_CARPET = of(net.minecraft.item.Items.GREEN_CARPET); + public static ItemWrapper RED_CARPET = of(net.minecraft.item.Items.RED_CARPET); + public static ItemWrapper BLACK_CARPET = of(net.minecraft.item.Items.BLACK_CARPET); + public static ItemWrapper TERRACOTTA = of(net.minecraft.item.Items.TERRACOTTA); + public static ItemWrapper COAL_BLOCK = of(net.minecraft.item.Items.COAL_BLOCK); + public static ItemWrapper PACKED_ICE = of(net.minecraft.item.Items.PACKED_ICE); + public static ItemWrapper ACACIA_STAIRS = of(net.minecraft.item.Items.ACACIA_STAIRS); + public static ItemWrapper DARK_OAK_STAIRS = of(net.minecraft.item.Items.DARK_OAK_STAIRS); + public static ItemWrapper SLIME_BLOCK = of(net.minecraft.item.Items.SLIME_BLOCK); + public static ItemWrapper GRASS_PATH = of(net.minecraft.item.Items.GRASS_PATH); + public static ItemWrapper SUNFLOWER = of(net.minecraft.item.Items.SUNFLOWER); + public static ItemWrapper LILAC = of(net.minecraft.item.Items.LILAC); + public static ItemWrapper ROSE_BUSH = of(net.minecraft.item.Items.ROSE_BUSH); + public static ItemWrapper PEONY = of(net.minecraft.item.Items.PEONY); + public static ItemWrapper TALL_GRASS = of(net.minecraft.item.Items.TALL_GRASS); + public static ItemWrapper LARGE_FERN = of(net.minecraft.item.Items.LARGE_FERN); + public static ItemWrapper WHITE_STAINED_GLASS = of(net.minecraft.item.Items.WHITE_STAINED_GLASS); + public static ItemWrapper ORANGE_STAINED_GLASS = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS); + public static ItemWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS); + public static ItemWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS); + public static ItemWrapper YELLOW_STAINED_GLASS = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS); + public static ItemWrapper LIME_STAINED_GLASS = of(net.minecraft.item.Items.LIME_STAINED_GLASS); + public static ItemWrapper PINK_STAINED_GLASS = of(net.minecraft.item.Items.PINK_STAINED_GLASS); + public static ItemWrapper GRAY_STAINED_GLASS = of(net.minecraft.item.Items.GRAY_STAINED_GLASS); + public static ItemWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS); + public static ItemWrapper CYAN_STAINED_GLASS = of(net.minecraft.item.Items.CYAN_STAINED_GLASS); + public static ItemWrapper PURPLE_STAINED_GLASS = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS); + public static ItemWrapper BLUE_STAINED_GLASS = of(net.minecraft.item.Items.BLUE_STAINED_GLASS); + public static ItemWrapper BROWN_STAINED_GLASS = of(net.minecraft.item.Items.BROWN_STAINED_GLASS); + public static ItemWrapper GREEN_STAINED_GLASS = of(net.minecraft.item.Items.GREEN_STAINED_GLASS); + public static ItemWrapper RED_STAINED_GLASS = of(net.minecraft.item.Items.RED_STAINED_GLASS); + public static ItemWrapper BLACK_STAINED_GLASS = of(net.minecraft.item.Items.BLACK_STAINED_GLASS); + public static ItemWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.WHITE_STAINED_GLASS_PANE); + public static ItemWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS_PANE); + public static ItemWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS_PANE); + public static ItemWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS_PANE); + public static ItemWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS_PANE); + public static ItemWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIME_STAINED_GLASS_PANE); + public static ItemWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PINK_STAINED_GLASS_PANE); + public static ItemWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GRAY_STAINED_GLASS_PANE); + public static ItemWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS_PANE); + public static ItemWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.CYAN_STAINED_GLASS_PANE); + public static ItemWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS_PANE); + public static ItemWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLUE_STAINED_GLASS_PANE); + public static ItemWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BROWN_STAINED_GLASS_PANE); + public static ItemWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GREEN_STAINED_GLASS_PANE); + public static ItemWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.item.Items.RED_STAINED_GLASS_PANE); + public static ItemWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLACK_STAINED_GLASS_PANE); + public static ItemWrapper PRISMARINE = of(net.minecraft.item.Items.PRISMARINE); + public static ItemWrapper PRISMARINE_BRICKS = of(net.minecraft.item.Items.PRISMARINE_BRICKS); + public static ItemWrapper DARK_PRISMARINE = of(net.minecraft.item.Items.DARK_PRISMARINE); + public static ItemWrapper PRISMARINE_STAIRS = of(net.minecraft.item.Items.PRISMARINE_STAIRS); + public static ItemWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.item.Items.PRISMARINE_BRICK_STAIRS); + public static ItemWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.item.Items.DARK_PRISMARINE_STAIRS); + public static ItemWrapper SEA_LANTERN = of(net.minecraft.item.Items.SEA_LANTERN); + public static ItemWrapper RED_SANDSTONE = of(net.minecraft.item.Items.RED_SANDSTONE); + public static ItemWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_RED_SANDSTONE); + public static ItemWrapper CUT_RED_SANDSTONE = of(net.minecraft.item.Items.CUT_RED_SANDSTONE); + public static ItemWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.RED_SANDSTONE_STAIRS); + public static ItemWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.item.Items.REPEATING_COMMAND_BLOCK); + public static ItemWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.item.Items.CHAIN_COMMAND_BLOCK); + public static ItemWrapper MAGMA_BLOCK = of(net.minecraft.item.Items.MAGMA_BLOCK); + public static ItemWrapper NETHER_WART_BLOCK = of(net.minecraft.item.Items.NETHER_WART_BLOCK); + public static ItemWrapper WARPED_WART_BLOCK = of(net.minecraft.item.Items.WARPED_WART_BLOCK); + public static ItemWrapper RED_NETHER_BRICKS = of(net.minecraft.item.Items.RED_NETHER_BRICKS); + public static ItemWrapper BONE_BLOCK = of(net.minecraft.item.Items.BONE_BLOCK); + public static ItemWrapper STRUCTURE_VOID = of(net.minecraft.item.Items.STRUCTURE_VOID); + public static ItemWrapper OBSERVER = of(net.minecraft.item.Items.OBSERVER); + public static ItemWrapper SHULKER_BOX = of(net.minecraft.item.Items.SHULKER_BOX); + public static ItemWrapper WHITE_SHULKER_BOX = of(net.minecraft.item.Items.WHITE_SHULKER_BOX); + public static ItemWrapper ORANGE_SHULKER_BOX = of(net.minecraft.item.Items.ORANGE_SHULKER_BOX); + public static ItemWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.item.Items.MAGENTA_SHULKER_BOX); + public static ItemWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_BLUE_SHULKER_BOX); + public static ItemWrapper YELLOW_SHULKER_BOX = of(net.minecraft.item.Items.YELLOW_SHULKER_BOX); + public static ItemWrapper LIME_SHULKER_BOX = of(net.minecraft.item.Items.LIME_SHULKER_BOX); + public static ItemWrapper PINK_SHULKER_BOX = of(net.minecraft.item.Items.PINK_SHULKER_BOX); + public static ItemWrapper GRAY_SHULKER_BOX = of(net.minecraft.item.Items.GRAY_SHULKER_BOX); + public static ItemWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_GRAY_SHULKER_BOX); + public static ItemWrapper CYAN_SHULKER_BOX = of(net.minecraft.item.Items.CYAN_SHULKER_BOX); + public static ItemWrapper PURPLE_SHULKER_BOX = of(net.minecraft.item.Items.PURPLE_SHULKER_BOX); + public static ItemWrapper BLUE_SHULKER_BOX = of(net.minecraft.item.Items.BLUE_SHULKER_BOX); + public static ItemWrapper BROWN_SHULKER_BOX = of(net.minecraft.item.Items.BROWN_SHULKER_BOX); + public static ItemWrapper GREEN_SHULKER_BOX = of(net.minecraft.item.Items.GREEN_SHULKER_BOX); + public static ItemWrapper RED_SHULKER_BOX = of(net.minecraft.item.Items.RED_SHULKER_BOX); + public static ItemWrapper BLACK_SHULKER_BOX = of(net.minecraft.item.Items.BLACK_SHULKER_BOX); + public static ItemWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.WHITE_GLAZED_TERRACOTTA); + public static ItemWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_GLAZED_TERRACOTTA); + public static ItemWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_GLAZED_TERRACOTTA); + public static ItemWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_GLAZED_TERRACOTTA); + public static ItemWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_GLAZED_TERRACOTTA); + public static ItemWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIME_GLAZED_TERRACOTTA); + public static ItemWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PINK_GLAZED_TERRACOTTA); + public static ItemWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GRAY_GLAZED_TERRACOTTA); + public static ItemWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_GLAZED_TERRACOTTA); + public static ItemWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.CYAN_GLAZED_TERRACOTTA); + public static ItemWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_GLAZED_TERRACOTTA); + public static ItemWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLUE_GLAZED_TERRACOTTA); + public static ItemWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BROWN_GLAZED_TERRACOTTA); + public static ItemWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GREEN_GLAZED_TERRACOTTA); + public static ItemWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.RED_GLAZED_TERRACOTTA); + public static ItemWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLACK_GLAZED_TERRACOTTA); + public static ItemWrapper WHITE_CONCRETE = of(net.minecraft.item.Items.WHITE_CONCRETE); + public static ItemWrapper ORANGE_CONCRETE = of(net.minecraft.item.Items.ORANGE_CONCRETE); + public static ItemWrapper MAGENTA_CONCRETE = of(net.minecraft.item.Items.MAGENTA_CONCRETE); + public static ItemWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE); + public static ItemWrapper YELLOW_CONCRETE = of(net.minecraft.item.Items.YELLOW_CONCRETE); + public static ItemWrapper LIME_CONCRETE = of(net.minecraft.item.Items.LIME_CONCRETE); + public static ItemWrapper PINK_CONCRETE = of(net.minecraft.item.Items.PINK_CONCRETE); + public static ItemWrapper GRAY_CONCRETE = of(net.minecraft.item.Items.GRAY_CONCRETE); + public static ItemWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE); + public static ItemWrapper CYAN_CONCRETE = of(net.minecraft.item.Items.CYAN_CONCRETE); + public static ItemWrapper PURPLE_CONCRETE = of(net.minecraft.item.Items.PURPLE_CONCRETE); + public static ItemWrapper BLUE_CONCRETE = of(net.minecraft.item.Items.BLUE_CONCRETE); + public static ItemWrapper BROWN_CONCRETE = of(net.minecraft.item.Items.BROWN_CONCRETE); + public static ItemWrapper GREEN_CONCRETE = of(net.minecraft.item.Items.GREEN_CONCRETE); + public static ItemWrapper RED_CONCRETE = of(net.minecraft.item.Items.RED_CONCRETE); + public static ItemWrapper BLACK_CONCRETE = of(net.minecraft.item.Items.BLACK_CONCRETE); + public static ItemWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.item.Items.WHITE_CONCRETE_POWDER); + public static ItemWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.item.Items.ORANGE_CONCRETE_POWDER); + public static ItemWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.item.Items.MAGENTA_CONCRETE_POWDER); + public static ItemWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE_POWDER); + public static ItemWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.item.Items.YELLOW_CONCRETE_POWDER); + public static ItemWrapper LIME_CONCRETE_POWDER = of(net.minecraft.item.Items.LIME_CONCRETE_POWDER); + public static ItemWrapper PINK_CONCRETE_POWDER = of(net.minecraft.item.Items.PINK_CONCRETE_POWDER); + public static ItemWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.GRAY_CONCRETE_POWDER); + public static ItemWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE_POWDER); + public static ItemWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.item.Items.CYAN_CONCRETE_POWDER); + public static ItemWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.item.Items.PURPLE_CONCRETE_POWDER); + public static ItemWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.BLUE_CONCRETE_POWDER); + public static ItemWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.item.Items.BROWN_CONCRETE_POWDER); + public static ItemWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.item.Items.GREEN_CONCRETE_POWDER); + public static ItemWrapper RED_CONCRETE_POWDER = of(net.minecraft.item.Items.RED_CONCRETE_POWDER); + public static ItemWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.item.Items.BLACK_CONCRETE_POWDER); + public static ItemWrapper TURTLE_EGG = of(net.minecraft.item.Items.TURTLE_EGG); + public static ItemWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_BLOCK); + public static ItemWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_BLOCK); + public static ItemWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_BLOCK); + public static ItemWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_BLOCK); + public static ItemWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_HORN_CORAL_BLOCK); + public static ItemWrapper TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.TUBE_CORAL_BLOCK); + public static ItemWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.BRAIN_CORAL_BLOCK); + public static ItemWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.BUBBLE_CORAL_BLOCK); + public static ItemWrapper FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.FIRE_CORAL_BLOCK); + public static ItemWrapper HORN_CORAL_BLOCK = of(net.minecraft.item.Items.HORN_CORAL_BLOCK); + public static ItemWrapper TUBE_CORAL = of(net.minecraft.item.Items.TUBE_CORAL); + public static ItemWrapper BRAIN_CORAL = of(net.minecraft.item.Items.BRAIN_CORAL); + public static ItemWrapper BUBBLE_CORAL = of(net.minecraft.item.Items.BUBBLE_CORAL); + public static ItemWrapper FIRE_CORAL = of(net.minecraft.item.Items.FIRE_CORAL); + public static ItemWrapper HORN_CORAL = of(net.minecraft.item.Items.HORN_CORAL); + public static ItemWrapper DEAD_BRAIN_CORAL = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL); + public static ItemWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL); + public static ItemWrapper DEAD_FIRE_CORAL = of(net.minecraft.item.Items.DEAD_FIRE_CORAL); + public static ItemWrapper DEAD_HORN_CORAL = of(net.minecraft.item.Items.DEAD_HORN_CORAL); + public static ItemWrapper DEAD_TUBE_CORAL = of(net.minecraft.item.Items.DEAD_TUBE_CORAL); + public static ItemWrapper TUBE_CORAL_FAN = of(net.minecraft.item.Items.TUBE_CORAL_FAN); + public static ItemWrapper BRAIN_CORAL_FAN = of(net.minecraft.item.Items.BRAIN_CORAL_FAN); + public static ItemWrapper BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.BUBBLE_CORAL_FAN); + public static ItemWrapper FIRE_CORAL_FAN = of(net.minecraft.item.Items.FIRE_CORAL_FAN); + public static ItemWrapper HORN_CORAL_FAN = of(net.minecraft.item.Items.HORN_CORAL_FAN); + public static ItemWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_FAN); + public static ItemWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_FAN); + public static ItemWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_FAN); + public static ItemWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_FAN); + public static ItemWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_HORN_CORAL_FAN); + public static ItemWrapper BLUE_ICE = of(net.minecraft.item.Items.BLUE_ICE); + public static ItemWrapper CONDUIT = of(net.minecraft.item.Items.CONDUIT); + public static ItemWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.item.Items.POLISHED_GRANITE_STAIRS); + public static ItemWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_STAIRS); + public static ItemWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_STAIRS); + public static ItemWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.item.Items.POLISHED_DIORITE_STAIRS); + public static ItemWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_STAIRS); + public static ItemWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.END_STONE_BRICK_STAIRS); + public static ItemWrapper STONE_STAIRS = of(net.minecraft.item.Items.STONE_STAIRS); + public static ItemWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_STAIRS); + public static ItemWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.item.Items.SMOOTH_QUARTZ_STAIRS); + public static ItemWrapper GRANITE_STAIRS = of(net.minecraft.item.Items.GRANITE_STAIRS); + public static ItemWrapper ANDESITE_STAIRS = of(net.minecraft.item.Items.ANDESITE_STAIRS); + public static ItemWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.RED_NETHER_BRICK_STAIRS); + public static ItemWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.item.Items.POLISHED_ANDESITE_STAIRS); + public static ItemWrapper DIORITE_STAIRS = of(net.minecraft.item.Items.DIORITE_STAIRS); + public static ItemWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.item.Items.POLISHED_GRANITE_SLAB); + public static ItemWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_SLAB); + public static ItemWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_SLAB); + public static ItemWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.item.Items.POLISHED_DIORITE_SLAB); + public static ItemWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_SLAB); + public static ItemWrapper END_STONE_BRICK_SLAB = of(net.minecraft.item.Items.END_STONE_BRICK_SLAB); + public static ItemWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_SLAB); + public static ItemWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.item.Items.SMOOTH_QUARTZ_SLAB); + public static ItemWrapper GRANITE_SLAB = of(net.minecraft.item.Items.GRANITE_SLAB); + public static ItemWrapper ANDESITE_SLAB = of(net.minecraft.item.Items.ANDESITE_SLAB); + public static ItemWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.item.Items.RED_NETHER_BRICK_SLAB); + public static ItemWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.item.Items.POLISHED_ANDESITE_SLAB); + public static ItemWrapper DIORITE_SLAB = of(net.minecraft.item.Items.DIORITE_SLAB); + public static ItemWrapper SCAFFOLDING = of(net.minecraft.item.Items.SCAFFOLDING); + public static ItemWrapper IRON_DOOR = of(net.minecraft.item.Items.IRON_DOOR); + public static ItemWrapper OAK_DOOR = of(net.minecraft.item.Items.OAK_DOOR); + public static ItemWrapper SPRUCE_DOOR = of(net.minecraft.item.Items.SPRUCE_DOOR); + public static ItemWrapper BIRCH_DOOR = of(net.minecraft.item.Items.BIRCH_DOOR); + public static ItemWrapper JUNGLE_DOOR = of(net.minecraft.item.Items.JUNGLE_DOOR); + public static ItemWrapper ACACIA_DOOR = of(net.minecraft.item.Items.ACACIA_DOOR); + public static ItemWrapper DARK_OAK_DOOR = of(net.minecraft.item.Items.DARK_OAK_DOOR); + public static ItemWrapper CRIMSON_DOOR = of(net.minecraft.item.Items.CRIMSON_DOOR); + public static ItemWrapper WARPED_DOOR = of(net.minecraft.item.Items.WARPED_DOOR); + public static ItemWrapper REPEATER = of(net.minecraft.item.Items.REPEATER); + public static ItemWrapper COMPARATOR = of(net.minecraft.item.Items.COMPARATOR); + public static ItemWrapper STRUCTURE_BLOCK = of(net.minecraft.item.Items.STRUCTURE_BLOCK); + public static ItemWrapper JIGSAW = of(net.minecraft.item.Items.JIGSAW); + public static ItemWrapper TURTLE_HELMET = of(net.minecraft.item.Items.TURTLE_HELMET); + public static ItemWrapper SCUTE = of(net.minecraft.item.Items.SCUTE); + public static ItemWrapper FLINT_AND_STEEL = of(net.minecraft.item.Items.FLINT_AND_STEEL); + public static ItemWrapper APPLE = of(net.minecraft.item.Items.APPLE); + public static ItemWrapper BOW = of(net.minecraft.item.Items.BOW); + public static ItemWrapper ARROW = of(net.minecraft.item.Items.ARROW); + public static ItemWrapper COAL = of(net.minecraft.item.Items.COAL); + public static ItemWrapper CHARCOAL = of(net.minecraft.item.Items.CHARCOAL); + public static ItemWrapper DIAMOND = of(net.minecraft.item.Items.DIAMOND); + public static ItemWrapper IRON_INGOT = of(net.minecraft.item.Items.IRON_INGOT); + public static ItemWrapper GOLD_INGOT = of(net.minecraft.item.Items.GOLD_INGOT); + public static ItemWrapper NETHERITE_INGOT = of(net.minecraft.item.Items.NETHERITE_INGOT); + public static ItemWrapper NETHERITE_SCRAP = of(net.minecraft.item.Items.NETHERITE_SCRAP); + public static ItemWrapper WOODEN_SWORD = of(net.minecraft.item.Items.WOODEN_SWORD); + public static ItemWrapper WOODEN_SHOVEL = of(net.minecraft.item.Items.WOODEN_SHOVEL); + public static ItemWrapper WOODEN_PICKAXE = of(net.minecraft.item.Items.WOODEN_PICKAXE); + public static ItemWrapper WOODEN_AXE = of(net.minecraft.item.Items.WOODEN_AXE); + public static ItemWrapper WOODEN_HOE = of(net.minecraft.item.Items.WOODEN_HOE); + public static ItemWrapper STONE_SWORD = of(net.minecraft.item.Items.STONE_SWORD); + public static ItemWrapper STONE_SHOVEL = of(net.minecraft.item.Items.STONE_SHOVEL); + public static ItemWrapper STONE_PICKAXE = of(net.minecraft.item.Items.STONE_PICKAXE); + public static ItemWrapper STONE_AXE = of(net.minecraft.item.Items.STONE_AXE); + public static ItemWrapper STONE_HOE = of(net.minecraft.item.Items.STONE_HOE); + public static ItemWrapper GOLDEN_SWORD = of(net.minecraft.item.Items.GOLDEN_SWORD); + public static ItemWrapper GOLDEN_SHOVEL = of(net.minecraft.item.Items.GOLDEN_SHOVEL); + public static ItemWrapper GOLDEN_PICKAXE = of(net.minecraft.item.Items.GOLDEN_PICKAXE); + public static ItemWrapper GOLDEN_AXE = of(net.minecraft.item.Items.GOLDEN_AXE); + public static ItemWrapper GOLDEN_HOE = of(net.minecraft.item.Items.GOLDEN_HOE); + public static ItemWrapper IRON_SWORD = of(net.minecraft.item.Items.IRON_SWORD); + public static ItemWrapper IRON_SHOVEL = of(net.minecraft.item.Items.IRON_SHOVEL); + public static ItemWrapper IRON_PICKAXE = of(net.minecraft.item.Items.IRON_PICKAXE); + public static ItemWrapper IRON_AXE = of(net.minecraft.item.Items.IRON_AXE); + public static ItemWrapper IRON_HOE = of(net.minecraft.item.Items.IRON_HOE); + public static ItemWrapper DIAMOND_SWORD = of(net.minecraft.item.Items.DIAMOND_SWORD); + public static ItemWrapper DIAMOND_SHOVEL = of(net.minecraft.item.Items.DIAMOND_SHOVEL); + public static ItemWrapper DIAMOND_PICKAXE = of(net.minecraft.item.Items.DIAMOND_PICKAXE); + public static ItemWrapper DIAMOND_AXE = of(net.minecraft.item.Items.DIAMOND_AXE); + public static ItemWrapper DIAMOND_HOE = of(net.minecraft.item.Items.DIAMOND_HOE); + public static ItemWrapper NETHERITE_SWORD = of(net.minecraft.item.Items.NETHERITE_SWORD); + public static ItemWrapper NETHERITE_SHOVEL = of(net.minecraft.item.Items.NETHERITE_SHOVEL); + public static ItemWrapper NETHERITE_PICKAXE = of(net.minecraft.item.Items.NETHERITE_PICKAXE); + public static ItemWrapper NETHERITE_AXE = of(net.minecraft.item.Items.NETHERITE_AXE); + public static ItemWrapper NETHERITE_HOE = of(net.minecraft.item.Items.NETHERITE_HOE); + public static ItemWrapper STICK = of(net.minecraft.item.Items.STICK); + public static ItemWrapper BOWL = of(net.minecraft.item.Items.BOWL); + public static ItemWrapper MUSHROOM_STEW = of(net.minecraft.item.Items.MUSHROOM_STEW); + public static ItemWrapper STRING = of(net.minecraft.item.Items.STRING); + public static ItemWrapper FEATHER = of(net.minecraft.item.Items.FEATHER); + public static ItemWrapper GUNPOWDER = of(net.minecraft.item.Items.GUNPOWDER); + public static ItemWrapper WHEAT_SEEDS = of(net.minecraft.item.Items.WHEAT_SEEDS); + public static ItemWrapper WHEAT = of(net.minecraft.item.Items.WHEAT); + public static ItemWrapper BREAD = of(net.minecraft.item.Items.BREAD); + public static ItemWrapper LEATHER_HELMET = of(net.minecraft.item.Items.LEATHER_HELMET); + public static ItemWrapper LEATHER_CHESTPLATE = of(net.minecraft.item.Items.LEATHER_CHESTPLATE); + public static ItemWrapper LEATHER_LEGGINGS = of(net.minecraft.item.Items.LEATHER_LEGGINGS); + public static ItemWrapper LEATHER_BOOTS = of(net.minecraft.item.Items.LEATHER_BOOTS); + public static ItemWrapper CHAINMAIL_HELMET = of(net.minecraft.item.Items.CHAINMAIL_HELMET); + public static ItemWrapper CHAINMAIL_CHESTPLATE = of(net.minecraft.item.Items.CHAINMAIL_CHESTPLATE); + public static ItemWrapper CHAINMAIL_LEGGINGS = of(net.minecraft.item.Items.CHAINMAIL_LEGGINGS); + public static ItemWrapper CHAINMAIL_BOOTS = of(net.minecraft.item.Items.CHAINMAIL_BOOTS); + public static ItemWrapper IRON_HELMET = of(net.minecraft.item.Items.IRON_HELMET); + public static ItemWrapper IRON_CHESTPLATE = of(net.minecraft.item.Items.IRON_CHESTPLATE); + public static ItemWrapper IRON_LEGGINGS = of(net.minecraft.item.Items.IRON_LEGGINGS); + public static ItemWrapper IRON_BOOTS = of(net.minecraft.item.Items.IRON_BOOTS); + public static ItemWrapper DIAMOND_HELMET = of(net.minecraft.item.Items.DIAMOND_HELMET); + public static ItemWrapper DIAMOND_CHESTPLATE = of(net.minecraft.item.Items.DIAMOND_CHESTPLATE); + public static ItemWrapper DIAMOND_LEGGINGS = of(net.minecraft.item.Items.DIAMOND_LEGGINGS); + public static ItemWrapper DIAMOND_BOOTS = of(net.minecraft.item.Items.DIAMOND_BOOTS); + public static ItemWrapper GOLDEN_HELMET = of(net.minecraft.item.Items.GOLDEN_HELMET); + public static ItemWrapper GOLDEN_CHESTPLATE = of(net.minecraft.item.Items.GOLDEN_CHESTPLATE); + public static ItemWrapper GOLDEN_LEGGINGS = of(net.minecraft.item.Items.GOLDEN_LEGGINGS); + public static ItemWrapper GOLDEN_BOOTS = of(net.minecraft.item.Items.GOLDEN_BOOTS); + public static ItemWrapper NETHERITE_HELMET = of(net.minecraft.item.Items.NETHERITE_HELMET); + public static ItemWrapper NETHERITE_CHESTPLATE = of(net.minecraft.item.Items.NETHERITE_CHESTPLATE); + public static ItemWrapper NETHERITE_LEGGINGS = of(net.minecraft.item.Items.NETHERITE_LEGGINGS); + public static ItemWrapper NETHERITE_BOOTS = of(net.minecraft.item.Items.NETHERITE_BOOTS); + public static ItemWrapper FLINT = of(net.minecraft.item.Items.FLINT); + public static ItemWrapper PORKCHOP = of(net.minecraft.item.Items.PORKCHOP); + public static ItemWrapper COOKED_PORKCHOP = of(net.minecraft.item.Items.COOKED_PORKCHOP); + public static ItemWrapper PAINTING = of(net.minecraft.item.Items.PAINTING); + public static ItemWrapper GOLDEN_APPLE = of(net.minecraft.item.Items.GOLDEN_APPLE); + public static ItemWrapper ENCHANTED_GOLDEN_APPLE = of(net.minecraft.item.Items.ENCHANTED_GOLDEN_APPLE); + public static ItemWrapper OAK_SIGN = of(net.minecraft.item.Items.OAK_SIGN); + public static ItemWrapper SPRUCE_SIGN = of(net.minecraft.item.Items.SPRUCE_SIGN); + public static ItemWrapper BIRCH_SIGN = of(net.minecraft.item.Items.BIRCH_SIGN); + public static ItemWrapper JUNGLE_SIGN = of(net.minecraft.item.Items.JUNGLE_SIGN); + public static ItemWrapper ACACIA_SIGN = of(net.minecraft.item.Items.ACACIA_SIGN); + public static ItemWrapper DARK_OAK_SIGN = of(net.minecraft.item.Items.DARK_OAK_SIGN); + public static ItemWrapper CRIMSON_SIGN = of(net.minecraft.item.Items.CRIMSON_SIGN); + public static ItemWrapper WARPED_SIGN = of(net.minecraft.item.Items.WARPED_SIGN); + public static ItemWrapper BUCKET = of(net.minecraft.item.Items.BUCKET); + public static ItemWrapper WATER_BUCKET = of(net.minecraft.item.Items.WATER_BUCKET); + public static ItemWrapper LAVA_BUCKET = of(net.minecraft.item.Items.LAVA_BUCKET); + public static ItemWrapper MINECART = of(net.minecraft.item.Items.MINECART); + public static ItemWrapper SADDLE = of(net.minecraft.item.Items.SADDLE); + public static ItemWrapper REDSTONE = of(net.minecraft.item.Items.REDSTONE); + public static ItemWrapper SNOWBALL = of(net.minecraft.item.Items.SNOWBALL); + public static ItemWrapper OAK_BOAT = of(net.minecraft.item.Items.OAK_BOAT); + public static ItemWrapper LEATHER = of(net.minecraft.item.Items.LEATHER); + public static ItemWrapper MILK_BUCKET = of(net.minecraft.item.Items.MILK_BUCKET); + public static ItemWrapper PUFFERFISH_BUCKET = of(net.minecraft.item.Items.PUFFERFISH_BUCKET); + public static ItemWrapper SALMON_BUCKET = of(net.minecraft.item.Items.SALMON_BUCKET); + public static ItemWrapper COD_BUCKET = of(net.minecraft.item.Items.COD_BUCKET); + public static ItemWrapper TROPICAL_FISH_BUCKET = of(net.minecraft.item.Items.TROPICAL_FISH_BUCKET); + public static ItemWrapper BRICK = of(net.minecraft.item.Items.BRICK); + public static ItemWrapper CLAY_BALL = of(net.minecraft.item.Items.CLAY_BALL); + public static ItemWrapper DRIED_KELP_BLOCK = of(net.minecraft.item.Items.DRIED_KELP_BLOCK); + public static ItemWrapper PAPER = of(net.minecraft.item.Items.PAPER); + public static ItemWrapper BOOK = of(net.minecraft.item.Items.BOOK); + public static ItemWrapper SLIME_BALL = of(net.minecraft.item.Items.SLIME_BALL); + public static ItemWrapper CHEST_MINECART = of(net.minecraft.item.Items.CHEST_MINECART); + public static ItemWrapper FURNACE_MINECART = of(net.minecraft.item.Items.FURNACE_MINECART); + public static ItemWrapper EGG = of(net.minecraft.item.Items.EGG); + public static ItemWrapper COMPASS = of(net.minecraft.item.Items.COMPASS); + public static ItemWrapper FISHING_ROD = of(net.minecraft.item.Items.FISHING_ROD); + public static ItemWrapper CLOCK = of(net.minecraft.item.Items.CLOCK); + public static ItemWrapper GLOWSTONE_DUST = of(net.minecraft.item.Items.GLOWSTONE_DUST); + public static ItemWrapper COD = of(net.minecraft.item.Items.COD); + public static ItemWrapper SALMON = of(net.minecraft.item.Items.SALMON); + public static ItemWrapper TROPICAL_FISH = of(net.minecraft.item.Items.TROPICAL_FISH); + public static ItemWrapper PUFFERFISH = of(net.minecraft.item.Items.PUFFERFISH); + public static ItemWrapper COOKED_COD = of(net.minecraft.item.Items.COOKED_COD); + public static ItemWrapper COOKED_SALMON = of(net.minecraft.item.Items.COOKED_SALMON); + public static ItemWrapper INK_SAC = of(net.minecraft.item.Items.INK_SAC); + public static ItemWrapper COCOA_BEANS = of(net.minecraft.item.Items.COCOA_BEANS); + public static ItemWrapper LAPIS_LAZULI = of(net.minecraft.item.Items.LAPIS_LAZULI); + public static ItemWrapper WHITE_DYE = of(net.minecraft.item.Items.WHITE_DYE); + public static ItemWrapper ORANGE_DYE = of(net.minecraft.item.Items.ORANGE_DYE); + public static ItemWrapper MAGENTA_DYE = of(net.minecraft.item.Items.MAGENTA_DYE); + public static ItemWrapper LIGHT_BLUE_DYE = of(net.minecraft.item.Items.LIGHT_BLUE_DYE); + public static ItemWrapper YELLOW_DYE = of(net.minecraft.item.Items.YELLOW_DYE); + public static ItemWrapper LIME_DYE = of(net.minecraft.item.Items.LIME_DYE); + public static ItemWrapper PINK_DYE = of(net.minecraft.item.Items.PINK_DYE); + public static ItemWrapper GRAY_DYE = of(net.minecraft.item.Items.GRAY_DYE); + public static ItemWrapper LIGHT_GRAY_DYE = of(net.minecraft.item.Items.LIGHT_GRAY_DYE); + public static ItemWrapper CYAN_DYE = of(net.minecraft.item.Items.CYAN_DYE); + public static ItemWrapper PURPLE_DYE = of(net.minecraft.item.Items.PURPLE_DYE); + public static ItemWrapper BLUE_DYE = of(net.minecraft.item.Items.BLUE_DYE); + public static ItemWrapper BROWN_DYE = of(net.minecraft.item.Items.BROWN_DYE); + public static ItemWrapper GREEN_DYE = of(net.minecraft.item.Items.GREEN_DYE); + public static ItemWrapper RED_DYE = of(net.minecraft.item.Items.RED_DYE); + public static ItemWrapper BLACK_DYE = of(net.minecraft.item.Items.BLACK_DYE); + public static ItemWrapper BONE_MEAL = of(net.minecraft.item.Items.BONE_MEAL); + public static ItemWrapper BONE = of(net.minecraft.item.Items.BONE); + public static ItemWrapper SUGAR = of(net.minecraft.item.Items.SUGAR); + public static ItemWrapper CAKE = of(net.minecraft.item.Items.CAKE); + public static ItemWrapper WHITE_BED = of(net.minecraft.item.Items.WHITE_BED); + public static ItemWrapper ORANGE_BED = of(net.minecraft.item.Items.ORANGE_BED); + public static ItemWrapper MAGENTA_BED = of(net.minecraft.item.Items.MAGENTA_BED); + public static ItemWrapper LIGHT_BLUE_BED = of(net.minecraft.item.Items.LIGHT_BLUE_BED); + public static ItemWrapper YELLOW_BED = of(net.minecraft.item.Items.YELLOW_BED); + public static ItemWrapper LIME_BED = of(net.minecraft.item.Items.LIME_BED); + public static ItemWrapper PINK_BED = of(net.minecraft.item.Items.PINK_BED); + public static ItemWrapper GRAY_BED = of(net.minecraft.item.Items.GRAY_BED); + public static ItemWrapper LIGHT_GRAY_BED = of(net.minecraft.item.Items.LIGHT_GRAY_BED); + public static ItemWrapper CYAN_BED = of(net.minecraft.item.Items.CYAN_BED); + public static ItemWrapper PURPLE_BED = of(net.minecraft.item.Items.PURPLE_BED); + public static ItemWrapper BLUE_BED = of(net.minecraft.item.Items.BLUE_BED); + public static ItemWrapper BROWN_BED = of(net.minecraft.item.Items.BROWN_BED); + public static ItemWrapper GREEN_BED = of(net.minecraft.item.Items.GREEN_BED); + public static ItemWrapper RED_BED = of(net.minecraft.item.Items.RED_BED); + public static ItemWrapper BLACK_BED = of(net.minecraft.item.Items.BLACK_BED); + public static ItemWrapper COOKIE = of(net.minecraft.item.Items.COOKIE); + public static ItemWrapper FILLED_MAP = of(net.minecraft.item.Items.FILLED_MAP); + public static ItemWrapper SHEARS = of(net.minecraft.item.Items.SHEARS); + public static ItemWrapper MELON_SLICE = of(net.minecraft.item.Items.MELON_SLICE); + public static ItemWrapper DRIED_KELP = of(net.minecraft.item.Items.DRIED_KELP); + public static ItemWrapper PUMPKIN_SEEDS = of(net.minecraft.item.Items.PUMPKIN_SEEDS); + public static ItemWrapper MELON_SEEDS = of(net.minecraft.item.Items.MELON_SEEDS); + public static ItemWrapper BEEF = of(net.minecraft.item.Items.BEEF); + public static ItemWrapper COOKED_BEEF = of(net.minecraft.item.Items.COOKED_BEEF); + public static ItemWrapper CHICKEN = of(net.minecraft.item.Items.CHICKEN); + public static ItemWrapper COOKED_CHICKEN = of(net.minecraft.item.Items.COOKED_CHICKEN); + public static ItemWrapper ROTTEN_FLESH = of(net.minecraft.item.Items.ROTTEN_FLESH); + public static ItemWrapper ENDER_PEARL = of(net.minecraft.item.Items.ENDER_PEARL); + public static ItemWrapper BLAZE_ROD = of(net.minecraft.item.Items.BLAZE_ROD); + public static ItemWrapper GHAST_TEAR = of(net.minecraft.item.Items.GHAST_TEAR); + public static ItemWrapper GOLD_NUGGET = of(net.minecraft.item.Items.GOLD_NUGGET); + public static ItemWrapper NETHER_WART = of(net.minecraft.item.Items.NETHER_WART); + public static ItemWrapper POTION = of(net.minecraft.item.Items.POTION); + public static ItemWrapper GLASS_BOTTLE = of(net.minecraft.item.Items.GLASS_BOTTLE); + public static ItemWrapper SPIDER_EYE = of(net.minecraft.item.Items.SPIDER_EYE); + public static ItemWrapper FERMENTED_SPIDER_EYE = of(net.minecraft.item.Items.FERMENTED_SPIDER_EYE); + public static ItemWrapper BLAZE_POWDER = of(net.minecraft.item.Items.BLAZE_POWDER); + public static ItemWrapper MAGMA_CREAM = of(net.minecraft.item.Items.MAGMA_CREAM); + public static ItemWrapper BREWING_STAND = of(net.minecraft.item.Items.BREWING_STAND); + public static ItemWrapper CAULDRON = of(net.minecraft.item.Items.CAULDRON); + public static ItemWrapper ENDER_EYE = of(net.minecraft.item.Items.ENDER_EYE); + public static ItemWrapper GLISTERING_MELON_SLICE = of(net.minecraft.item.Items.GLISTERING_MELON_SLICE); + public static ItemWrapper BAT_SPAWN_EGG = of(net.minecraft.item.Items.BAT_SPAWN_EGG); + public static ItemWrapper BEE_SPAWN_EGG = of(net.minecraft.item.Items.BEE_SPAWN_EGG); + public static ItemWrapper BLAZE_SPAWN_EGG = of(net.minecraft.item.Items.BLAZE_SPAWN_EGG); + public static ItemWrapper CAT_SPAWN_EGG = of(net.minecraft.item.Items.CAT_SPAWN_EGG); + public static ItemWrapper CAVE_SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.CAVE_SPIDER_SPAWN_EGG); + public static ItemWrapper CHICKEN_SPAWN_EGG = of(net.minecraft.item.Items.CHICKEN_SPAWN_EGG); + public static ItemWrapper COD_SPAWN_EGG = of(net.minecraft.item.Items.COD_SPAWN_EGG); + public static ItemWrapper COW_SPAWN_EGG = of(net.minecraft.item.Items.COW_SPAWN_EGG); + public static ItemWrapper CREEPER_SPAWN_EGG = of(net.minecraft.item.Items.CREEPER_SPAWN_EGG); + public static ItemWrapper DOLPHIN_SPAWN_EGG = of(net.minecraft.item.Items.DOLPHIN_SPAWN_EGG); + public static ItemWrapper DONKEY_SPAWN_EGG = of(net.minecraft.item.Items.DONKEY_SPAWN_EGG); + public static ItemWrapper DROWNED_SPAWN_EGG = of(net.minecraft.item.Items.DROWNED_SPAWN_EGG); + public static ItemWrapper ELDER_GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.ELDER_GUARDIAN_SPAWN_EGG); + public static ItemWrapper ENDERMAN_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMAN_SPAWN_EGG); + public static ItemWrapper ENDERMITE_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMITE_SPAWN_EGG); + public static ItemWrapper EVOKER_SPAWN_EGG = of(net.minecraft.item.Items.EVOKER_SPAWN_EGG); + public static ItemWrapper FOX_SPAWN_EGG = of(net.minecraft.item.Items.FOX_SPAWN_EGG); + public static ItemWrapper GHAST_SPAWN_EGG = of(net.minecraft.item.Items.GHAST_SPAWN_EGG); + public static ItemWrapper GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.GUARDIAN_SPAWN_EGG); + public static ItemWrapper HOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.HOGLIN_SPAWN_EGG); + public static ItemWrapper HORSE_SPAWN_EGG = of(net.minecraft.item.Items.HORSE_SPAWN_EGG); + public static ItemWrapper HUSK_SPAWN_EGG = of(net.minecraft.item.Items.HUSK_SPAWN_EGG); + public static ItemWrapper LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.LLAMA_SPAWN_EGG); + public static ItemWrapper MAGMA_CUBE_SPAWN_EGG = of(net.minecraft.item.Items.MAGMA_CUBE_SPAWN_EGG); + public static ItemWrapper MOOSHROOM_SPAWN_EGG = of(net.minecraft.item.Items.MOOSHROOM_SPAWN_EGG); + public static ItemWrapper MULE_SPAWN_EGG = of(net.minecraft.item.Items.MULE_SPAWN_EGG); + public static ItemWrapper OCELOT_SPAWN_EGG = of(net.minecraft.item.Items.OCELOT_SPAWN_EGG); + public static ItemWrapper PANDA_SPAWN_EGG = of(net.minecraft.item.Items.PANDA_SPAWN_EGG); + public static ItemWrapper PARROT_SPAWN_EGG = of(net.minecraft.item.Items.PARROT_SPAWN_EGG); + public static ItemWrapper PHANTOM_SPAWN_EGG = of(net.minecraft.item.Items.PHANTOM_SPAWN_EGG); + public static ItemWrapper PIG_SPAWN_EGG = of(net.minecraft.item.Items.PIG_SPAWN_EGG); + public static ItemWrapper PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_SPAWN_EGG); + public static ItemWrapper PIGLIN_BRUTE_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_BRUTE_SPAWN_EGG); + public static ItemWrapper PILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.PILLAGER_SPAWN_EGG); + public static ItemWrapper POLAR_BEAR_SPAWN_EGG = of(net.minecraft.item.Items.POLAR_BEAR_SPAWN_EGG); + public static ItemWrapper PUFFERFISH_SPAWN_EGG = of(net.minecraft.item.Items.PUFFERFISH_SPAWN_EGG); + public static ItemWrapper RABBIT_SPAWN_EGG = of(net.minecraft.item.Items.RABBIT_SPAWN_EGG); + public static ItemWrapper RAVAGER_SPAWN_EGG = of(net.minecraft.item.Items.RAVAGER_SPAWN_EGG); + public static ItemWrapper SALMON_SPAWN_EGG = of(net.minecraft.item.Items.SALMON_SPAWN_EGG); + public static ItemWrapper SHEEP_SPAWN_EGG = of(net.minecraft.item.Items.SHEEP_SPAWN_EGG); + public static ItemWrapper SHULKER_SPAWN_EGG = of(net.minecraft.item.Items.SHULKER_SPAWN_EGG); + public static ItemWrapper SILVERFISH_SPAWN_EGG = of(net.minecraft.item.Items.SILVERFISH_SPAWN_EGG); + public static ItemWrapper SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_SPAWN_EGG); + public static ItemWrapper SKELETON_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_HORSE_SPAWN_EGG); + public static ItemWrapper SLIME_SPAWN_EGG = of(net.minecraft.item.Items.SLIME_SPAWN_EGG); + public static ItemWrapper SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.SPIDER_SPAWN_EGG); + public static ItemWrapper SQUID_SPAWN_EGG = of(net.minecraft.item.Items.SQUID_SPAWN_EGG); + public static ItemWrapper STRAY_SPAWN_EGG = of(net.minecraft.item.Items.STRAY_SPAWN_EGG); + public static ItemWrapper STRIDER_SPAWN_EGG = of(net.minecraft.item.Items.STRIDER_SPAWN_EGG); + public static ItemWrapper TRADER_LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.TRADER_LLAMA_SPAWN_EGG); + public static ItemWrapper TROPICAL_FISH_SPAWN_EGG = of(net.minecraft.item.Items.TROPICAL_FISH_SPAWN_EGG); + public static ItemWrapper TURTLE_SPAWN_EGG = of(net.minecraft.item.Items.TURTLE_SPAWN_EGG); + public static ItemWrapper VEX_SPAWN_EGG = of(net.minecraft.item.Items.VEX_SPAWN_EGG); + public static ItemWrapper VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.VILLAGER_SPAWN_EGG); + public static ItemWrapper VINDICATOR_SPAWN_EGG = of(net.minecraft.item.Items.VINDICATOR_SPAWN_EGG); + public static ItemWrapper WANDERING_TRADER_SPAWN_EGG = of(net.minecraft.item.Items.WANDERING_TRADER_SPAWN_EGG); + public static ItemWrapper WITCH_SPAWN_EGG = of(net.minecraft.item.Items.WITCH_SPAWN_EGG); + public static ItemWrapper WITHER_SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.WITHER_SKELETON_SPAWN_EGG); + public static ItemWrapper WOLF_SPAWN_EGG = of(net.minecraft.item.Items.WOLF_SPAWN_EGG); + public static ItemWrapper ZOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOGLIN_SPAWN_EGG); + public static ItemWrapper ZOMBIE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_SPAWN_EGG); + public static ItemWrapper ZOMBIE_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_HORSE_SPAWN_EGG); + public static ItemWrapper ZOMBIE_VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_VILLAGER_SPAWN_EGG); + public static ItemWrapper ZOMBIFIED_PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIFIED_PIGLIN_SPAWN_EGG); + public static ItemWrapper EXPERIENCE_BOTTLE = of(net.minecraft.item.Items.EXPERIENCE_BOTTLE); + public static ItemWrapper FIRE_CHARGE = of(net.minecraft.item.Items.FIRE_CHARGE); + public static ItemWrapper WRITABLE_BOOK = of(net.minecraft.item.Items.WRITABLE_BOOK); + public static ItemWrapper WRITTEN_BOOK = of(net.minecraft.item.Items.WRITTEN_BOOK); + public static ItemWrapper EMERALD = of(net.minecraft.item.Items.EMERALD); + public static ItemWrapper ITEM_FRAME = of(net.minecraft.item.Items.ITEM_FRAME); + public static ItemWrapper FLOWER_POT = of(net.minecraft.item.Items.FLOWER_POT); + public static ItemWrapper CARROT = of(net.minecraft.item.Items.CARROT); + public static ItemWrapper POTATO = of(net.minecraft.item.Items.POTATO); + public static ItemWrapper BAKED_POTATO = of(net.minecraft.item.Items.BAKED_POTATO); + public static ItemWrapper POISONOUS_POTATO = of(net.minecraft.item.Items.POISONOUS_POTATO); + public static ItemWrapper MAP = of(net.minecraft.item.Items.MAP); + public static ItemWrapper GOLDEN_CARROT = of(net.minecraft.item.Items.GOLDEN_CARROT); + public static ItemWrapper SKELETON_SKULL = of(net.minecraft.item.Items.SKELETON_SKULL); + public static ItemWrapper WITHER_SKELETON_SKULL = of(net.minecraft.item.Items.WITHER_SKELETON_SKULL); + public static ItemWrapper PLAYER_HEAD = of(net.minecraft.item.Items.PLAYER_HEAD); + public static ItemWrapper ZOMBIE_HEAD = of(net.minecraft.item.Items.ZOMBIE_HEAD); + public static ItemWrapper CREEPER_HEAD = of(net.minecraft.item.Items.CREEPER_HEAD); + public static ItemWrapper DRAGON_HEAD = of(net.minecraft.item.Items.DRAGON_HEAD); + public static ItemWrapper CARROT_ON_A_STICK = of(net.minecraft.item.Items.CARROT_ON_A_STICK); + public static ItemWrapper WARPED_FUNGUS_ON_A_STICK = of(net.minecraft.item.Items.WARPED_FUNGUS_ON_A_STICK); + public static ItemWrapper NETHER_STAR = of(net.minecraft.item.Items.NETHER_STAR); + public static ItemWrapper PUMPKIN_PIE = of(net.minecraft.item.Items.PUMPKIN_PIE); + public static ItemWrapper FIREWORK_ROCKET = of(net.minecraft.item.Items.FIREWORK_ROCKET); + public static ItemWrapper FIREWORK_STAR = of(net.minecraft.item.Items.FIREWORK_STAR); + public static ItemWrapper ENCHANTED_BOOK = of(net.minecraft.item.Items.ENCHANTED_BOOK); + public static ItemWrapper NETHER_BRICK = of(net.minecraft.item.Items.NETHER_BRICK); + public static ItemWrapper QUARTZ = of(net.minecraft.item.Items.QUARTZ); + public static ItemWrapper TNT_MINECART = of(net.minecraft.item.Items.TNT_MINECART); + public static ItemWrapper HOPPER_MINECART = of(net.minecraft.item.Items.HOPPER_MINECART); + public static ItemWrapper PRISMARINE_SHARD = of(net.minecraft.item.Items.PRISMARINE_SHARD); + public static ItemWrapper PRISMARINE_CRYSTALS = of(net.minecraft.item.Items.PRISMARINE_CRYSTALS); + public static ItemWrapper RABBIT = of(net.minecraft.item.Items.RABBIT); + public static ItemWrapper COOKED_RABBIT = of(net.minecraft.item.Items.COOKED_RABBIT); + public static ItemWrapper RABBIT_STEW = of(net.minecraft.item.Items.RABBIT_STEW); + public static ItemWrapper RABBIT_FOOT = of(net.minecraft.item.Items.RABBIT_FOOT); + public static ItemWrapper RABBIT_HIDE = of(net.minecraft.item.Items.RABBIT_HIDE); + public static ItemWrapper ARMOR_STAND = of(net.minecraft.item.Items.ARMOR_STAND); + public static ItemWrapper IRON_HORSE_ARMOR = of(net.minecraft.item.Items.IRON_HORSE_ARMOR); + public static ItemWrapper GOLDEN_HORSE_ARMOR = of(net.minecraft.item.Items.GOLDEN_HORSE_ARMOR); + public static ItemWrapper DIAMOND_HORSE_ARMOR = of(net.minecraft.item.Items.DIAMOND_HORSE_ARMOR); + public static ItemWrapper LEATHER_HORSE_ARMOR = of(net.minecraft.item.Items.LEATHER_HORSE_ARMOR); + public static ItemWrapper LEAD = of(net.minecraft.item.Items.LEAD); + public static ItemWrapper NAME_TAG = of(net.minecraft.item.Items.NAME_TAG); + public static ItemWrapper COMMAND_BLOCK_MINECART = of(net.minecraft.item.Items.COMMAND_BLOCK_MINECART); + public static ItemWrapper MUTTON = of(net.minecraft.item.Items.MUTTON); + public static ItemWrapper COOKED_MUTTON = of(net.minecraft.item.Items.COOKED_MUTTON); + public static ItemWrapper WHITE_BANNER = of(net.minecraft.item.Items.WHITE_BANNER); + public static ItemWrapper ORANGE_BANNER = of(net.minecraft.item.Items.ORANGE_BANNER); + public static ItemWrapper MAGENTA_BANNER = of(net.minecraft.item.Items.MAGENTA_BANNER); + public static ItemWrapper LIGHT_BLUE_BANNER = of(net.minecraft.item.Items.LIGHT_BLUE_BANNER); + public static ItemWrapper YELLOW_BANNER = of(net.minecraft.item.Items.YELLOW_BANNER); + public static ItemWrapper LIME_BANNER = of(net.minecraft.item.Items.LIME_BANNER); + public static ItemWrapper PINK_BANNER = of(net.minecraft.item.Items.PINK_BANNER); + public static ItemWrapper GRAY_BANNER = of(net.minecraft.item.Items.GRAY_BANNER); + public static ItemWrapper LIGHT_GRAY_BANNER = of(net.minecraft.item.Items.LIGHT_GRAY_BANNER); + public static ItemWrapper CYAN_BANNER = of(net.minecraft.item.Items.CYAN_BANNER); + public static ItemWrapper PURPLE_BANNER = of(net.minecraft.item.Items.PURPLE_BANNER); + public static ItemWrapper BLUE_BANNER = of(net.minecraft.item.Items.BLUE_BANNER); + public static ItemWrapper BROWN_BANNER = of(net.minecraft.item.Items.BROWN_BANNER); + public static ItemWrapper GREEN_BANNER = of(net.minecraft.item.Items.GREEN_BANNER); + public static ItemWrapper RED_BANNER = of(net.minecraft.item.Items.RED_BANNER); + public static ItemWrapper BLACK_BANNER = of(net.minecraft.item.Items.BLACK_BANNER); + public static ItemWrapper END_CRYSTAL = of(net.minecraft.item.Items.END_CRYSTAL); + public static ItemWrapper CHORUS_FRUIT = of(net.minecraft.item.Items.CHORUS_FRUIT); + public static ItemWrapper POPPED_CHORUS_FRUIT = of(net.minecraft.item.Items.POPPED_CHORUS_FRUIT); + public static ItemWrapper BEETROOT = of(net.minecraft.item.Items.BEETROOT); + public static ItemWrapper BEETROOT_SEEDS = of(net.minecraft.item.Items.BEETROOT_SEEDS); + public static ItemWrapper BEETROOT_SOUP = of(net.minecraft.item.Items.BEETROOT_SOUP); + public static ItemWrapper DRAGON_BREATH = of(net.minecraft.item.Items.DRAGON_BREATH); + public static ItemWrapper SPLASH_POTION = of(net.minecraft.item.Items.SPLASH_POTION); + public static ItemWrapper SPECTRAL_ARROW = of(net.minecraft.item.Items.SPECTRAL_ARROW); + public static ItemWrapper TIPPED_ARROW = of(net.minecraft.item.Items.TIPPED_ARROW); + public static ItemWrapper LINGERING_POTION = of(net.minecraft.item.Items.LINGERING_POTION); + public static ItemWrapper SHIELD = of(net.minecraft.item.Items.SHIELD); + public static ItemWrapper ELYTRA = of(net.minecraft.item.Items.ELYTRA); + public static ItemWrapper SPRUCE_BOAT = of(net.minecraft.item.Items.SPRUCE_BOAT); + public static ItemWrapper BIRCH_BOAT = of(net.minecraft.item.Items.BIRCH_BOAT); + public static ItemWrapper JUNGLE_BOAT = of(net.minecraft.item.Items.JUNGLE_BOAT); + public static ItemWrapper ACACIA_BOAT = of(net.minecraft.item.Items.ACACIA_BOAT); + public static ItemWrapper DARK_OAK_BOAT = of(net.minecraft.item.Items.DARK_OAK_BOAT); + public static ItemWrapper TOTEM_OF_UNDYING = of(net.minecraft.item.Items.TOTEM_OF_UNDYING); + public static ItemWrapper SHULKER_SHELL = of(net.minecraft.item.Items.SHULKER_SHELL); + public static ItemWrapper IRON_NUGGET = of(net.minecraft.item.Items.IRON_NUGGET); + public static ItemWrapper KNOWLEDGE_BOOK = of(net.minecraft.item.Items.KNOWLEDGE_BOOK); + public static ItemWrapper DEBUG_STICK = of(net.minecraft.item.Items.DEBUG_STICK); + public static ItemWrapper MUSIC_DISC_13 = of(net.minecraft.item.Items.MUSIC_DISC_13); + public static ItemWrapper MUSIC_DISC_CAT = of(net.minecraft.item.Items.MUSIC_DISC_CAT); + public static ItemWrapper MUSIC_DISC_BLOCKS = of(net.minecraft.item.Items.MUSIC_DISC_BLOCKS); + public static ItemWrapper MUSIC_DISC_CHIRP = of(net.minecraft.item.Items.MUSIC_DISC_CHIRP); + public static ItemWrapper MUSIC_DISC_FAR = of(net.minecraft.item.Items.MUSIC_DISC_FAR); + public static ItemWrapper MUSIC_DISC_MALL = of(net.minecraft.item.Items.MUSIC_DISC_MALL); + public static ItemWrapper MUSIC_DISC_MELLOHI = of(net.minecraft.item.Items.MUSIC_DISC_MELLOHI); + public static ItemWrapper MUSIC_DISC_STAL = of(net.minecraft.item.Items.MUSIC_DISC_STAL); + public static ItemWrapper MUSIC_DISC_STRAD = of(net.minecraft.item.Items.MUSIC_DISC_STRAD); + public static ItemWrapper MUSIC_DISC_WARD = of(net.minecraft.item.Items.MUSIC_DISC_WARD); + public static ItemWrapper MUSIC_DISC_11 = of(net.minecraft.item.Items.MUSIC_DISC_11); + public static ItemWrapper MUSIC_DISC_WAIT = of(net.minecraft.item.Items.MUSIC_DISC_WAIT); + public static ItemWrapper MUSIC_DISC_PIGSTEP = of(net.minecraft.item.Items.MUSIC_DISC_PIGSTEP); + public static ItemWrapper TRIDENT = of(net.minecraft.item.Items.TRIDENT); + public static ItemWrapper PHANTOM_MEMBRANE = of(net.minecraft.item.Items.PHANTOM_MEMBRANE); + public static ItemWrapper NAUTILUS_SHELL = of(net.minecraft.item.Items.NAUTILUS_SHELL); + public static ItemWrapper HEART_OF_THE_SEA = of(net.minecraft.item.Items.HEART_OF_THE_SEA); + public static ItemWrapper CROSSBOW = of(net.minecraft.item.Items.CROSSBOW); + public static ItemWrapper SUSPICIOUS_STEW = of(net.minecraft.item.Items.SUSPICIOUS_STEW); + public static ItemWrapper LOOM = of(net.minecraft.item.Items.LOOM); + public static ItemWrapper FLOWER_BANNER_PATTERN = of(net.minecraft.item.Items.FLOWER_BANNER_PATTERN); + public static ItemWrapper CREEPER_BANNER_PATTERN = of(net.minecraft.item.Items.CREEPER_BANNER_PATTERN); + public static ItemWrapper SKULL_BANNER_PATTERN = of(net.minecraft.item.Items.SKULL_BANNER_PATTERN); + public static ItemWrapper MOJANG_BANNER_PATTERN = of(net.minecraft.item.Items.MOJANG_BANNER_PATTERN); + public static ItemWrapper GLOBE_BANNER_PATTERN = of(net.minecraft.item.Items.GLOBE_BANNER_PATTERN); + public static ItemWrapper PIGLIN_BANNER_PATTERN = of(net.minecraft.item.Items.PIGLIN_BANNER_PATTERN); + public static ItemWrapper COMPOSTER = of(net.minecraft.item.Items.COMPOSTER); + public static ItemWrapper BARREL = of(net.minecraft.item.Items.BARREL); + public static ItemWrapper SMOKER = of(net.minecraft.item.Items.SMOKER); + public static ItemWrapper BLAST_FURNACE = of(net.minecraft.item.Items.BLAST_FURNACE); + public static ItemWrapper CARTOGRAPHY_TABLE = of(net.minecraft.item.Items.CARTOGRAPHY_TABLE); + public static ItemWrapper FLETCHING_TABLE = of(net.minecraft.item.Items.FLETCHING_TABLE); + public static ItemWrapper GRINDSTONE = of(net.minecraft.item.Items.GRINDSTONE); + public static ItemWrapper LECTERN = of(net.minecraft.item.Items.LECTERN); + public static ItemWrapper SMITHING_TABLE = of(net.minecraft.item.Items.SMITHING_TABLE); + public static ItemWrapper STONECUTTER = of(net.minecraft.item.Items.STONECUTTER); + public static ItemWrapper BELL = of(net.minecraft.item.Items.BELL); + public static ItemWrapper LANTERN = of(net.minecraft.item.Items.LANTERN); + public static ItemWrapper SOUL_LANTERN = of(net.minecraft.item.Items.SOUL_LANTERN); + public static ItemWrapper SWEET_BERRIES = of(net.minecraft.item.Items.SWEET_BERRIES); + public static ItemWrapper CAMPFIRE = of(net.minecraft.item.Items.CAMPFIRE); + public static ItemWrapper SOUL_CAMPFIRE = of(net.minecraft.item.Items.SOUL_CAMPFIRE); + public static ItemWrapper SHROOMLIGHT = of(net.minecraft.item.Items.SHROOMLIGHT); + public static ItemWrapper HONEYCOMB = of(net.minecraft.item.Items.HONEYCOMB); + public static ItemWrapper BEE_NEST = of(net.minecraft.item.Items.BEE_NEST); + public static ItemWrapper BEEHIVE = of(net.minecraft.item.Items.BEEHIVE); + public static ItemWrapper HONEY_BOTTLE = of(net.minecraft.item.Items.HONEY_BOTTLE); + public static ItemWrapper HONEY_BLOCK = of(net.minecraft.item.Items.HONEY_BLOCK); + public static ItemWrapper HONEYCOMB_BLOCK = of(net.minecraft.item.Items.HONEYCOMB_BLOCK); + public static ItemWrapper LODESTONE = of(net.minecraft.item.Items.LODESTONE); + public static ItemWrapper NETHERITE_BLOCK = of(net.minecraft.item.Items.NETHERITE_BLOCK); + public static ItemWrapper ANCIENT_DEBRIS = of(net.minecraft.item.Items.ANCIENT_DEBRIS); + public static ItemWrapper TARGET = of(net.minecraft.item.Items.TARGET); + public static ItemWrapper CRYING_OBSIDIAN = of(net.minecraft.item.Items.CRYING_OBSIDIAN); + public static ItemWrapper BLACKSTONE = of(net.minecraft.item.Items.BLACKSTONE); + public static ItemWrapper BLACKSTONE_SLAB = of(net.minecraft.item.Items.BLACKSTONE_SLAB); + public static ItemWrapper BLACKSTONE_STAIRS = of(net.minecraft.item.Items.BLACKSTONE_STAIRS); + public static ItemWrapper GILDED_BLACKSTONE = of(net.minecraft.item.Items.GILDED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_SLAB); + public static ItemWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_STAIRS); + public static ItemWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.item.Items.CHISELED_POLISHED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICKS); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_SLAB); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_STAIRS); + public static ItemWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.CRACKED_POLISHED_BLACKSTONE_BRICKS); + public static ItemWrapper RESPAWN_ANCHOR = of(net.minecraft.item.Items.RESPAWN_ANCHOR); public static ItemWrapper of(net.minecraft.item.Item item) { return ItemWrapper.of(item); From 89cf1b6e3f5c1a4675418d0e175f41cdd37163f6 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 24 Mar 2026 23:08:56 +0900 Subject: [PATCH 005/151] [cp] feat: update Block and Item wrappers for GRASS and CHAIN to use correct variants --- .../java/net/pitan76/mcpitanlib/midohra/block/Blocks.java | 6 +++--- .../java/net/pitan76/mcpitanlib/midohra/item/Items.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java index d74b93eba..4841d1b52 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java @@ -96,7 +96,7 @@ public class Blocks { public static BlockWrapper DETECTOR_RAIL = of(net.minecraft.block.Blocks.DETECTOR_RAIL); public static BlockWrapper STICKY_PISTON = of(net.minecraft.block.Blocks.STICKY_PISTON); public static BlockWrapper COBWEB = of(net.minecraft.block.Blocks.COBWEB); - public static BlockWrapper GRASS = of(net.minecraft.block.Blocks.GRASS); + public static BlockWrapper GRASS = of(net.minecraft.block.Blocks.SHORT_GRASS); public static BlockWrapper FERN = of(net.minecraft.block.Blocks.FERN); public static BlockWrapper DEAD_BUSH = of(net.minecraft.block.Blocks.DEAD_BUSH); public static BlockWrapper SEAGRASS = of(net.minecraft.block.Blocks.SEAGRASS); @@ -243,7 +243,7 @@ public class Blocks { public static BlockWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.RED_MUSHROOM_BLOCK); public static BlockWrapper MUSHROOM_STEM = of(net.minecraft.block.Blocks.MUSHROOM_STEM); public static BlockWrapper IRON_BARS = of(net.minecraft.block.Blocks.IRON_BARS); - public static BlockWrapper CHAIN = of(net.minecraft.block.Blocks.CHAIN); + public static BlockWrapper CHAIN = of(net.minecraft.block.Blocks.IRON_CHAIN); public static BlockWrapper GLASS_PANE = of(net.minecraft.block.Blocks.GLASS_PANE); public static BlockWrapper MELON = of(net.minecraft.block.Blocks.MELON); public static BlockWrapper ATTACHED_PUMPKIN_STEM = of(net.minecraft.block.Blocks.ATTACHED_PUMPKIN_STEM); @@ -499,7 +499,7 @@ public class Blocks { public static BlockWrapper PURPUR_STAIRS = of(net.minecraft.block.Blocks.PURPUR_STAIRS); public static BlockWrapper END_STONE_BRICKS = of(net.minecraft.block.Blocks.END_STONE_BRICKS); public static BlockWrapper BEETROOTS = of(net.minecraft.block.Blocks.BEETROOTS); - public static BlockWrapper GRASS_PATH = of(net.minecraft.block.Blocks.GRASS_PATH); + public static BlockWrapper GRASS_PATH = of(net.minecraft.block.Blocks.DIRT_PATH); public static BlockWrapper END_GATEWAY = of(net.minecraft.block.Blocks.END_GATEWAY); public static BlockWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.block.Blocks.REPEATING_COMMAND_BLOCK); public static BlockWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.block.Blocks.CHAIN_COMMAND_BLOCK); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java index 3795ed003..c79f22ff6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java @@ -90,7 +90,7 @@ public class Items { public static ItemWrapper DETECTOR_RAIL = of(net.minecraft.item.Items.DETECTOR_RAIL); public static ItemWrapper STICKY_PISTON = of(net.minecraft.item.Items.STICKY_PISTON); public static ItemWrapper COBWEB = of(net.minecraft.item.Items.COBWEB); - public static ItemWrapper GRASS = of(net.minecraft.item.Items.GRASS); + public static ItemWrapper GRASS = of(net.minecraft.item.Items.SHORT_GRASS); public static ItemWrapper FERN = of(net.minecraft.item.Items.FERN); public static ItemWrapper DEAD_BUSH = of(net.minecraft.item.Items.DEAD_BUSH); public static ItemWrapper SEAGRASS = of(net.minecraft.item.Items.SEAGRASS); @@ -249,7 +249,7 @@ public class Items { public static ItemWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.item.Items.RED_MUSHROOM_BLOCK); public static ItemWrapper MUSHROOM_STEM = of(net.minecraft.item.Items.MUSHROOM_STEM); public static ItemWrapper IRON_BARS = of(net.minecraft.item.Items.IRON_BARS); - public static ItemWrapper CHAIN = of(net.minecraft.item.Items.CHAIN); + public static ItemWrapper CHAIN = of(net.minecraft.item.Items.IRON_CHAIN); public static ItemWrapper GLASS_PANE = of(net.minecraft.item.Items.GLASS_PANE); public static ItemWrapper MELON = of(net.minecraft.item.Items.MELON); public static ItemWrapper VINE = of(net.minecraft.item.Items.VINE); @@ -373,7 +373,7 @@ public class Items { public static ItemWrapper ACACIA_STAIRS = of(net.minecraft.item.Items.ACACIA_STAIRS); public static ItemWrapper DARK_OAK_STAIRS = of(net.minecraft.item.Items.DARK_OAK_STAIRS); public static ItemWrapper SLIME_BLOCK = of(net.minecraft.item.Items.SLIME_BLOCK); - public static ItemWrapper GRASS_PATH = of(net.minecraft.item.Items.GRASS_PATH); + public static ItemWrapper GRASS_PATH = of(net.minecraft.item.Items.DIRT_PATH); public static ItemWrapper SUNFLOWER = of(net.minecraft.item.Items.SUNFLOWER); public static ItemWrapper LILAC = of(net.minecraft.item.Items.LILAC); public static ItemWrapper ROSE_BUSH = of(net.minecraft.item.Items.ROSE_BUSH); @@ -572,7 +572,7 @@ public class Items { public static ItemWrapper STRUCTURE_BLOCK = of(net.minecraft.item.Items.STRUCTURE_BLOCK); public static ItemWrapper JIGSAW = of(net.minecraft.item.Items.JIGSAW); public static ItemWrapper TURTLE_HELMET = of(net.minecraft.item.Items.TURTLE_HELMET); - public static ItemWrapper SCUTE = of(net.minecraft.item.Items.SCUTE); + public static ItemWrapper SCUTE = of(net.minecraft.item.Items.TURTLE_SCUTE); public static ItemWrapper FLINT_AND_STEEL = of(net.minecraft.item.Items.FLINT_AND_STEEL); public static ItemWrapper APPLE = of(net.minecraft.item.Items.APPLE); public static ItemWrapper BOW = of(net.minecraft.item.Items.BOW); From a1ce1a393e1c1884949a69de3af7f68964118990 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 24 Mar 2026 23:11:36 +0900 Subject: [PATCH 006/151] [cp] fix: invert condition in teleport method to ensure entity is only teleported in ServerWorld --- .../main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java index a6732a34a..8872d9f4a 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java @@ -340,7 +340,7 @@ public static void teleport(Entity entity, ServerWorld world, BlockPos pos) { } public static void teleport(Entity entity, double x, double y, double z) { - if (entity.getEntityWorld() instanceof ServerWorld) + if (!(entity.getEntityWorld() instanceof ServerWorld)) return; teleport(entity, (ServerWorld) entity.getEntityWorld(), x, y, z, entity.getYaw(), entity.getPitch()); From e7a748b210877fa61ba4b7ca63d8dd0b964549c2 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 09:15:59 +0900 Subject: [PATCH 007/151] port to 26.1 --- build.gradle | 179 +- common/build.gradle | 37 - .../java/net/pitan76/easyapi/FileControl.java | 173 -- .../net/pitan76/easyapi/config/Config.java | 456 ----- .../net/pitan76/easyapi/config/IConfig.java | 37 - .../pitan76/easyapi/config/JsonConfig.java | 102 -- .../pitan76/easyapi/config/YamlConfig.java | 114 -- .../pitan76/easyapi/config/package-info.java | 4 - .../net/pitan76/mcpitanlib/MCPitanLib.java | 127 -- .../mcpitanlib/api/CommonModInitializer.java | 66 - .../api/block/BlockItemByExtendBlock1215.java | 36 - .../api/block/CompatBlockRenderType.java | 25 - .../mcpitanlib/api/block/CompatBlocks.java | 96 - .../api/block/CompatChestBlock.java | 47 - .../api/block/CompatPillarBlock.java | 80 - .../mcpitanlib/api/block/CompatSlabBlock.java | 100 - .../api/block/CompatStairsBlock.java | 129 -- .../api/block/CompatWaterloggable.java | 21 - .../api/block/CompatibleBlockSettings.java | 253 --- .../api/block/CompatibleMaterial.java | 206 --- .../mcpitanlib/api/block/ExtendBlock.java | 369 ---- .../api/block/ExtendBlockEntityProvider.java | 79 - .../api/block/ExtendBlockProvider.java | 161 -- .../api/block/args/RenderTypeArgs.java | 21 - .../mcpitanlib/api/block/args/RotateArgs.java | 38 - .../api/block/args/SideInvisibleArgs.java | 46 - .../api/block/args/v2/CanPlaceAtArgs.java | 54 - .../block/args/v2/CollisionShapeEvent.java | 17 - .../args/v2/GetComparatorOutputArgs.java | 60 - .../args/v2/HasComparatorOutputArgs.java | 16 - .../api/block/args/v2/OutlineShapeEvent.java | 64 - .../api/block/args/v2/PlacementStateArgs.java | 175 -- .../args/v2/StateForNeighborUpdateArgs.java | 109 -- .../api/block/v2/BlockSettingsBuilder.java | 170 -- .../mcpitanlib/api/block/v2/CompatBlock.java | 179 -- .../api/block/v2/CompatBlockProvider.java | 91 - .../api/block/v2/CompatStairsBlock.java | 69 - .../api/block/v2/CompatibleBlockSettings.java | 292 --- .../api/client/CompatInventoryScreen.java | 22 - .../api/client/SimpleHandledScreen.java | 317 ---- .../api/client/SimpleInventoryScreen.java | 39 - .../api/client/SimpleOptionsScreen.java | 27 - .../mcpitanlib/api/client/SimpleScreen.java | 191 -- .../api/client/color/BlockColorEvent.java | 83 - .../color/CompatBlockColorProvider.java | 15 - .../api/client/event/ItemTooltipRegistry.java | 10 - .../api/client/event/WorldRenderRegistry.java | 35 - .../listener/BeforeBlockOutlineEvent.java | 122 -- .../listener/BeforeBlockOutlineListener.java | 11 - .../event/listener/ItemTooltipContext.java | 68 - .../event/listener/ItemTooltipListener.java | 17 - .../event/listener/WorldRenderContext.java | 140 -- .../listener/WorldRenderContextImpl.java | 113 -- .../listener/WorldRenderContextListener.java | 10 - .../gui/screen/CompatInventoryScreen.java | 33 - .../api/client/gui/screen/ScreenTexts.java | 21 - .../gui/screen/SimpleHandledScreen.java | 364 ---- .../gui/screen/SimpleInventoryScreen.java | 38 - .../gui/widget/CompatTextFieldWidget.java | 145 -- .../CompatibleTexturedButtonWidget.java | 74 - .../RedrawableTexturedButtonWidget.java | 51 - .../client/gui/widget/SimpleListWidget.java | 114 -- .../client/gui/widget/SimpleSliderWidget.java | 82 - .../api/client/option/CompatKeyBinding.java | 78 - .../api/client/option/GameOptionsWrapper.java | 19 - .../api/client/option/KeyCodes.java | 127 -- .../client/registry/ArchRegistryClient.java | 189 -- .../client/registry/CompatRegistryClient.java | 278 --- .../registry/EntityRendererRegistry.java | 13 - .../client/registry/KeybindingRegistry.java | 38 - .../registry/v2/KeybindingRegistry.java | 24 - .../registry/v3/KeybindingRegistry.java | 37 - .../api/client/render/CompatRenderLayer.java | 46 - .../api/client/render/DrawObjectDM.java | 101 - .../api/client/render/DrawObjectMV.java | 119 -- .../render/EntityModelLayerContext.java | 27 - .../entity/CompatBlockEntityRenderer.java | 45 - .../entity/event/BlockEntityRenderEvent.java | 200 -- ...ompatBlockEntityRendererConstructArgs.java | 16 - .../entity/v2/CompatBlockEntityRenderer.java | 25 - .../handledscreen/DrawBackgroundArgs.java | 48 - .../handledscreen/DrawForegroundArgs.java | 38 - .../DrawMouseoverTooltipArgs.java | 38 - .../render/handledscreen/KeyEventArgs.java | 35 - .../render/handledscreen/RenderArgs.java | 48 - .../screen/RenderBackgroundTextureArgs.java | 34 - .../api/command/AbstractCommand.java | 47 - .../api/command/CommandRegistry.java | 125 -- .../api/command/CommandSettings.java | 43 - .../mcpitanlib/api/command/ConfigCommand.java | 173 -- .../api/command/LiteralCommand.java | 7 - .../api/command/argument/BlockCommand.java | 21 - .../api/command/argument/BooleanCommand.java | 19 - .../api/command/argument/DoubleCommand.java | 19 - .../api/command/argument/EntitiesCommand.java | 20 - .../api/command/argument/EntityCommand.java | 20 - .../api/command/argument/FloatCommand.java | 19 - .../command/argument/GreedyStringCommand.java | 10 - .../api/command/argument/IntegerCommand.java | 19 - .../api/command/argument/ItemCommand.java | 21 - .../api/command/argument/LongCommand.java | 19 - .../api/command/argument/PlayerCommand.java | 20 - .../api/command/argument/PlayersCommand.java | 20 - .../api/command/argument/RequiredCommand.java | 10 - .../api/command/argument/StringCommand.java | 19 - .../api/datafixer/ItemStackFixer.java | 52 - .../api/enchantment/CompatEnchantment.java | 69 - .../api/entity/CompatContainerUser.java | 34 - .../mcpitanlib/api/entity/CompatEntity.java | 135 -- .../api/entity/CompatThrownItemEntity.java | 159 -- .../api/entity/EntityTypeBuilder.java | 133 -- .../mcpitanlib/api/entity/ExtendEntity.java | 102 -- .../api/entity/ExtendEntityType.java | 41 - .../pitan76/mcpitanlib/api/entity/Player.java | 547 ------ .../attribute/AttrModifierOperation.java | 54 - .../AttributeModifiersComponentBuilder.java | 26 - .../CompatAttributeModifierSlot.java | 64 - .../CompatAttributeModifiersComponent.java | 34 - .../attribute/CompatEntityAttribute.java | 49 - .../CompatEntityAttributeInstance.java | 70 - .../CompatEntityAttributeModifier.java | 57 - .../attribute/CompatEntityAttributes.java | 28 - .../api/entity/effect/CompatStatusEffect.java | 62 - .../effect/CompatStatusEffectInstance.java | 74 - .../mcpitanlib/api/event/BaseEvent.java | 4 - .../api/event/BlockCommandEvent.java | 11 - .../api/event/BooleanCommandEvent.java | 10 - .../mcpitanlib/api/event/CommandEvent.java | 38 - .../api/event/DoubleCommandEvent.java | 10 - .../api/event/EntitiesCommandEvent.java | 16 - .../api/event/EntityCommandEvent.java | 16 - .../api/event/FloatCommandEvent.java | 10 - .../api/event/IntegerCommandEvent.java | 10 - .../api/event/ItemCommandEvent.java | 11 - .../api/event/LongCommandEvent.java | 10 - .../api/event/PlayerCommandEvent.java | 16 - .../api/event/PlayersCommandEvent.java | 16 - .../api/event/RequiredCommandEvent.java | 5 - .../api/event/ServerCommandEvent.java | 134 -- .../api/event/StringCommandEvent.java | 10 - .../api/event/block/AppendPropertiesArgs.java | 35 - .../api/event/block/BlockBreakEvent.java | 79 - .../api/event/block/BlockBreakStartEvent.java | 61 - .../api/event/block/BlockPlacedEvent.java | 82 - .../event/block/BlockScheduledTickEvent.java | 50 - .../api/event/block/BlockUseEvent.java | 143 -- .../event/block/CanPathfindThroughArgs.java | 50 - .../api/event/block/CollisionShapeEvent.java | 13 - .../api/event/block/DroppedStacksArgs.java | 30 - .../api/event/block/EntityCollisionEvent.java | 112 -- .../api/event/block/FluidStateArgs.java | 19 - .../api/event/block/ItemScattererUtil.java | 50 - .../api/event/block/NeighborUpdateEvent.java | 98 - .../api/event/block/OutlineShapeEvent.java | 63 - .../api/event/block/PickStackEvent.java | 93 - .../api/event/block/PlacementStateArgs.java | 125 -- .../event/block/ScreenHandlerCreateEvent.java | 56 - .../api/event/block/ShapesForStatesArgs.java | 22 - .../block/StateForNeighborUpdateArgs.java | 86 - .../api/event/block/StateReplacedEvent.java | 132 -- .../api/event/block/TileCreateEvent.java | 66 - .../event/block/result/BlockBreakResult.java | 15 - .../container/factory/DisplayNameArgs.java | 9 - .../container/factory/ExtraDataArgs.java | 55 - .../api/event/entity/CollisionEvent.java | 34 - .../api/event/entity/EntityHitEvent.java | 26 - .../api/event/entity/InitDataTrackerArgs.java | 47 - .../api/event/item/BonusAttackDamageArgs.java | 29 - .../api/event/item/CanMineArgs.java | 76 - .../api/event/item/CanRepairArgs.java | 22 - .../mcpitanlib/api/event/item/CraftEvent.java | 48 - .../api/event/item/EnchantabilityArgs.java | 7 - .../api/event/item/EnchantableArgs.java | 16 - .../api/event/item/InventoryTickEvent.java | 81 - .../event/item/ItemAppendTooltipEvent.java | 100 - .../api/event/item/ItemBarColorArgs.java | 16 - .../api/event/item/ItemBarStepArgs.java | 16 - .../api/event/item/ItemBarVisibleArgs.java | 16 - .../api/event/item/ItemFinishUsingEvent.java | 52 - .../api/event/item/ItemUseEvent.java | 124 -- .../api/event/item/ItemUseOnBlockEvent.java | 158 -- .../api/event/item/ItemUseOnEntityEvent.java | 85 - .../api/event/item/PostHitEvent.java | 39 - .../api/event/item/PostMineEvent.java | 118 -- .../mcpitanlib/api/event/nbt/NbtRWArgs.java | 64 - .../mcpitanlib/api/event/nbt/ReadNbtArgs.java | 60 - .../api/event/nbt/WriteNbtArgs.java | 57 - .../api/event/result/EventResult.java | 48 - .../api/event/result/TypedEventResult.java | 60 - .../api/event/tile/TileTickEvent.java | 92 - .../event/v0/AttackEntityEventRegistry.java | 26 - .../api/event/v0/ClientTickEventRegistry.java | 35 - .../api/event/v0/EventRegistry.java | 87 - .../event/v0/InteractionEventRegistry.java | 80 - .../api/event/v0/LivingHurtEventRegistry.java | 21 - .../api/event/v0/event/ClickBlockEvent.java | 78 - .../event/v0/event/ItemStackActionEvent.java | 34 - .../api/event/v0/event/LivingHurtEvent.java | 83 - .../event/v0/event/RecipeManagerEvent.java | 59 - .../event/v0/event/ServerConnectionEvent.java | 15 - .../event/v1/AttackEntityEventRegistry.java | 26 - .../api/event/v1/BlockEventRegistry.java | 26 - .../api/event/v1/LivingHurtEventRegistry.java | 23 - .../api/event/v1/RecipeManagerRegistry.java | 19 - .../api/event/v1/event/AttackEntityEvent.java | 73 - .../api/event/v1/listener/BlockBreakTask.java | 9 - .../event/v1/listener/BlockPlacedTask.java | 8 - .../api/event/v2/AbstractEvent.java | 18 - .../api/event/v2/BlockEventRegistry.java | 25 - .../api/event/v2/ItemEventRegistry.java | 7 - .../mcpitanlib/api/event/v2/OrderedEvent.java | 167 -- .../event/v2/listener/InventoryTickTask.java | 8 - .../mcpitanlib/api/gen/OreRegistry.java | 42 - .../ExtendedNamedScreenHandlerFactory.java | 46 - .../api/gui/ExtendedScreenHandler.java | 15 - .../api/gui/ExtendedScreenHandlerFactory.java | 24 - .../gui/ExtendedScreenHandlerTypeBuilder.java | 40 - .../api/gui/SimpleScreenHandler.java | 276 --- .../gui/SimpleScreenHandlerTypeBuilder.java | 39 - .../api/gui/args/CreateMenuEvent.java | 58 - .../api/gui/args/SlotClickEvent.java | 67 - .../api/gui/inventory/IInventory.java | 77 - .../sided/ChestStyleSidedInventory.java | 10 - .../inventory/sided/CompatSidedInventory.java | 35 - .../sided/VanillaStyleSidedInventory.java | 20 - .../sided/args/AvailableSlotsArgs.java | 38 - .../inventory/sided/args/CanExtractArgs.java | 32 - .../inventory/sided/args/CanInsertArgs.java | 35 - .../api/gui/slot/CompatSlotActionType.java | 50 - .../api/gui/slot/CompatibleSlot.java | 125 -- .../gui/v2/ExtendedScreenHandlerFactory.java | 17 - .../gui/v2/SimpleScreenHandlerFactory.java | 25 - .../mcpitanlib/api/helper/SimpleRegister.java | 69 - .../api/item/ArmorEquipmentType.java | 75 - .../api/item/CompatFoodComponent.java | 120 -- .../mcpitanlib/api/item/CompatItems.java | 69 - .../api/item/CompatibleArmorItem.java | 41 - .../api/item/CompatibleArmorMaterial.java | 64 - .../api/item/CompatibleItemSettings.java | 111 -- .../api/item/CreativeTabBuilder.java | 112 -- .../api/item/CreativeTabManager.java | 112 -- .../api/item/DefaultItemGroups.java | 28 - .../mcpitanlib/api/item/ExtendBlockItem.java | 138 -- .../mcpitanlib/api/item/ExtendItem.java | 262 --- .../api/item/ExtendItemProvider.java | 136 -- .../mcpitanlib/api/item/ExtendSettings.java | 34 - .../api/item/FixedRecipeRemainderItem.java | 7 - .../pitan76/mcpitanlib/api/item/FoodItem.java | 28 - .../mcpitanlib/api/item/args/RarityArgs.java | 19 - .../api/item/args/StoppedUsingArgs.java | 80 - .../api/item/args/UseActionArgs.java | 27 - .../api/item/consume/CompatUseAction.java | 45 - .../item/equipment/CompatEquipmentAsset.java | 50 - .../equipment/CompatEquippableComponent.java | 36 - .../equipment/EquippableComponentBuilder.java | 94 - .../mcpitanlib/api/item/stack/LoreUtil.java | 46 - .../api/item/tool/CompatibleAxeItem.java | 90 - .../api/item/tool/CompatibleHoeItem.java | 90 - .../item/tool/CompatibleMiningToolItem.java | 125 -- .../api/item/tool/CompatiblePickaxeItem.java | 90 - .../api/item/tool/CompatibleShearsItem.java | 89 - .../api/item/tool/CompatibleShovelItem.java | 90 - .../api/item/tool/CompatibleSwordItem.java | 90 - .../api/item/tool/CompatibleToolItem.java | 86 - .../api/item/tool/CompatibleToolMaterial.java | 85 - .../api/item/v2/CompatArmorMaterial.java | 25 - .../mcpitanlib/api/item/v2/CompatItem.java | 103 -- .../api/item/v2/CompatItemProvider.java | 48 - .../api/item/v2/CompatibleItemSettings.java | 202 -- .../api/item/v2/ExtendBlockItem.java | 75 - .../api/item/v2/ItemSettingsBuilder.java | 153 -- .../api/item/v3/CompatArmorMaterial.java | 16 - .../api/item/v3/CompatToolMaterial.java | 16 - .../item/v3/VanillaCompatToolMaterial.java | 72 - .../pitan76/mcpitanlib/api/nbt/NbtTag.java | 102 -- .../mcpitanlib/api/nbt/NbtTypeBytes.java | 20 - .../api/network/ClientNetworking.java | 61 - .../api/network/PacketByteUtil.java | 259 --- .../api/network/ServerNetworking.java | 65 - .../api/network/v2/ClientNetworking.java | 29 - .../api/network/v2/ServerNetworking.java | 97 - .../network/v2/args/ClientReceiveEvent.java | 50 - .../network/v2/args/ServerReceiveEvent.java | 59 - .../api/offlineplayer/OfflinePlayer.java | 37 - .../offlineplayer/OfflinePlayerManager.java | 229 --- .../api/packet/UpdatePacketType.java | 26 - .../api/recipe/CompatRecipeType.java | 57 - .../api/recipe/CompatibleRecipeEntry.java | 76 - .../mcpitanlib/api/recipe/MatchGetter.java | 14 - .../api/recipe/input/CompatRecipeInput.java | 32 - .../api/recipe/v2/CompatRecipeEntry.java | 76 - .../api/recipe/v2/CompatRecipeNonEntry.java | 25 - .../api/recipe/v3/CompatRecipe.java | 87 - .../api/registry/CompatRegistry.java | 191 -- .../api/registry/CompatRegistryLookup.java | 42 - .../mcpitanlib/api/registry/FuelRegistry.java | 31 - .../api/registry/WorldGenRegistry.java | 107 -- .../api/registry/result/RegistryResult.java | 31 - .../api/registry/result/SupplierResult.java | 52 - .../api/registry/v2/CompatRegistryV2.java | 179 -- .../api/simple/block/SimpleGuiBlock.java | 28 - .../api/simple/item/SimpleGuiItem.java | 61 - .../api/sound/CompatBlockSoundGroup.java | 221 --- .../api/sound/CompatSoundCategory.java | 35 - .../api/sound/CompatSoundEvent.java | 55 - .../api/sound/CompatSoundEvents.java | 1625 ----------------- .../sound/RegistryResultCompatSoundEvent.java | 26 - .../api/state/property/BooleanProperty.java | 27 - .../api/state/property/CompatProperties.java | 117 -- .../api/state/property/DirectionProperty.java | 50 - .../api/state/property/EnumProperty.java | 40 - .../api/state/property/IProperty.java | 49 - .../api/state/property/IntProperty.java | 35 - .../api/state/property/UnknownProperty.java | 21 - .../mcpitanlib/api/tag/MineableToolTags.java | 11 - .../pitan76/mcpitanlib/api/tag/TagKey.java | 57 - .../api/tag/item/RepairIngredientTag.java | 64 - .../mcpitanlib/api/tag/v2/CompatTagKey.java | 29 - .../api/tag/v2/CompatTagKeyType.java | 48 - .../api/tag/v2/typed/BlockTagKey.java | 25 - .../api/tag/v2/typed/EntityTagKey.java | 20 - .../api/tag/v2/typed/FluidTagKey.java | 18 - .../api/tag/v2/typed/ItemTagKey.java | 31 - .../mcpitanlib/api/text/CompatFormatting.java | 86 - .../mcpitanlib/api/text/CompatStyle.java | 105 -- .../mcpitanlib/api/text/CompatTextColor.java | 79 - .../mcpitanlib/api/text/TextComponent.java | 130 -- .../mcpitanlib/api/text/TextConverter.java | 102 -- .../api/text/VariableTextComponent.java | 19 - .../api/tile/BlockEntityTypeBuilder.java | 66 - .../api/tile/CompatBlockEntity.java | 198 -- .../api/tile/CompatChestBlockEntity.java | 111 -- .../api/tile/ExtendBlockEntity.java | 26 - .../api/tile/ExtendBlockEntityTicker.java | 17 - .../api/tile/RenderDataBlockEntity.java | 14 - .../api/tile/v2/BlockEntityTypeBuilder.java | 69 - .../api/timer/MinecraftServerTimerAccess.java | 7 - .../api/timer/ServerWorldTimerAccess.java | 7 - .../mcpitanlib/api/timer/TimerItem.java | 14 - .../transfer/fluid/v1/FluidStorageUtil.java | 16 - .../api/transfer/fluid/v1/IFluidStorage.java | 104 -- .../api/transfer/fluid/v1/IFluidVariant.java | 29 - .../api/util/ArmorMaterialUtil.java | 138 -- .../api/util/BlockEntityDataUtil.java | 49 - .../api/util/BlockEntityTypeUtil.java | 39 - .../mcpitanlib/api/util/BlockEntityUtil.java | 115 -- .../mcpitanlib/api/util/BlockStateUtil.java | 169 -- .../mcpitanlib/api/util/BlockUtil.java | 258 --- .../mcpitanlib/api/util/BlockViewUtil.java | 24 - .../api/util/CommandManagerUtil.java | 87 - .../mcpitanlib/api/util/CommandUtil.java | 53 - .../api/util/CompatActionResult.java | 123 -- .../mcpitanlib/api/util/CompatIdentifier.java | 173 -- .../mcpitanlib/api/util/CompatRarity.java | 54 - .../api/util/CompatStringIdentifiable.java | 17 - .../api/util/CompatibleRecipeEntryUtil.java | 27 - .../mcpitanlib/api/util/CustomDataUtil.java | 175 -- .../mcpitanlib/api/util/DamageSourceUtil.java | 44 - .../api/util/DirectionBoolPropertyUtil.java | 68 - .../mcpitanlib/api/util/EnchantmentUtil.java | 82 - .../mcpitanlib/api/util/EntityTypeUtil.java | 48 - .../mcpitanlib/api/util/EntityUtil.java | 364 ---- .../api/util/EquipMaterialUtil.java | 46 - .../api/util/FeatureConfigUtil.java | 81 - .../mcpitanlib/api/util/FluidStateUtil.java | 48 - .../mcpitanlib/api/util/FluidUtil.java | 109 -- .../pitan76/mcpitanlib/api/util/HandUtil.java | 38 - .../mcpitanlib/api/util/IdentifierUtil.java | 32 - .../mcpitanlib/api/util/IngredientUtil.java | 96 - .../mcpitanlib/api/util/InteractUtil.java | 56 - .../mcpitanlib/api/util/InventoryUtil.java | 202 -- .../mcpitanlib/api/util/ItemStackUtil.java | 193 -- .../pitan76/mcpitanlib/api/util/ItemUtil.java | 275 --- .../pitan76/mcpitanlib/api/util/Logger.java | 190 -- .../mcpitanlib/api/util/LoggerUtil.java | 38 - .../mcpitanlib/api/util/MCVersionUtil.java | 19 - .../pitan76/mcpitanlib/api/util/MathUtil.java | 33 - .../pitan76/mcpitanlib/api/util/NbtUtil.java | 560 ------ .../api/util/ParticleEffectUtil.java | 13 - .../api/util/PersistentStateUtil.java | 55 - .../mcpitanlib/api/util/PlacedFutureUtil.java | 38 - .../mcpitanlib/api/util/PlatformUtil.java | 80 - .../api/util/PlayerManagerUtil.java | 130 -- .../mcpitanlib/api/util/PlayerUtil.java | 98 - .../mcpitanlib/api/util/PropertyUtil.java | 161 -- .../mcpitanlib/api/util/RecipeUtil.java | 223 --- .../api/util/RegistryLookupUtil.java | 40 - .../mcpitanlib/api/util/ResourceUtil.java | 27 - .../api/util/ScreenHandlerUtil.java | 54 - .../mcpitanlib/api/util/ServerUtil.java | 64 - .../api/util/SimpleInventoryUtil.java | 35 - .../pitan76/mcpitanlib/api/util/SlotUtil.java | 44 - .../mcpitanlib/api/util/SoundEventUtil.java | 35 - .../api/util/StackActionResult.java | 107 -- .../mcpitanlib/api/util/StateManagerUtil.java | 15 - .../mcpitanlib/api/util/StatusEffectUtil.java | 27 - .../mcpitanlib/api/util/StyleUtil.java | 61 - .../pitan76/mcpitanlib/api/util/TextUtil.java | 72 - .../mcpitanlib/api/util/TimerUtil.java | 18 - .../mcpitanlib/api/util/ToolMaterialUtil.java | 55 - .../mcpitanlib/api/util/VoxelShapeUtil.java | 43 - .../mcpitanlib/api/util/WorldRandomUtil.java | 37 - .../mcpitanlib/api/util/WorldUtil.java | 482 ----- .../api/util/block/BlockHitResultUtil.java | 33 - .../mcpitanlib/api/util/block/BlockUtil.java | 235 --- .../api/util/block/entity/FurnaceUtil.java | 44 - .../util/client/BlockEntityRendererUtil.java | 14 - .../api/util/client/ClientUtil.java | 117 -- .../api/util/client/LanguageUtil.java | 47 - .../api/util/client/MatrixStackUtil.java | 32 - .../mcpitanlib/api/util/client/MouseUtil.java | 46 - .../api/util/client/RenderUtil.java | 32 - .../api/util/client/ScreenUtil.java | 224 --- .../api/util/client/WindowUtil.java | 42 - .../render/CompatItemDisplayContext.java | 40 - .../client/render/CompatItemRenderUtil.java | 36 - .../client/render/VertexConsumerUtil.java | 203 -- .../client/render/VertexRenderingUtil.java | 114 -- .../util/client/render/WorldRendererUtil.java | 15 - .../api/util/client/v2/RenderUtil.java | 9 - .../api/util/client/v2/ScreenUtil.java | 35 - .../client/widget/ClickableWidgetUtil.java | 10 - .../api/util/client/widget/TextFieldUtil.java | 79 - .../util/collection/ClippedItemStackList.java | 100 - .../util/collection/DefaultedListUtil.java | 15 - .../api/util/collection/ItemStackList.java | 214 --- .../api/util/color/CompatBrightness.java | 40 - .../api/util/color/CompatDyeColor.java | 46 - .../api/util/color/CompatMapColor.java | 94 - .../mcpitanlib/api/util/debug/OutputUtil.java | 69 - .../api/util/entity/ArrowEntityUtil.java | 26 - .../api/util/entity/EquipmentSlotUtil.java | 55 - .../api/util/entity/ItemEntityUtil.java | 118 -- .../api/util/entity/LivingEntityUtil.java | 57 - .../api/util/entity/ProjectileEntityUtil.java | 14 - .../api/util/entity/ServerPlayerUtil.java | 102 -- .../util/entity/SmallFireballEntityUtil.java | 29 - .../api/util/entity/SnowballEntityUtil.java | 28 - .../util/entity/SpectralArrowEntityUtil.java | 26 - .../api/util/entity/ThrownItemEntityUtil.java | 36 - .../api/util/event/BlockEventGenerator.java | 21 - .../api/util/event/ItemEventGenerator.java | 11 - .../api/util/inventory/ClippedInventory.java | 91 - .../api/util/inventory/CompatInventory.java | 229 --- .../util/inventory/CompatPlayerInventory.java | 42 - .../util/inventory/ContainerInventory.java | 17 - .../api/util/inventory/ICompatInventory.java | 60 - .../util/inventory/PlayerInventoryUtil.java | 47 - .../util/inventory/args/CanInsertArgs.java | 23 - .../mcpitanlib/api/util/item/FuelUtil.java | 16 - .../api/util/item/ItemGroupUtil.java | 40 - .../mcpitanlib/api/util/item/ItemUtil.java | 263 --- .../api/util/math/BlockRotations.java | 19 - .../mcpitanlib/api/util/math/BoxUtil.java | 54 - .../api/util/math/DirectionUtil.java | 34 - .../mcpitanlib/api/util/math/PointUtil.java | 15 - .../mcpitanlib/api/util/math/PosUtil.java | 116 -- .../mcpitanlib/api/util/math/Vec3dUtil.java | 69 - .../mcpitanlib/api/util/math/Vec3iUtil.java | 33 - .../api/util/math/random/CompatRandom.java | 140 -- .../mcpitanlib/api/util/nbt/InvRWUtil.java | 26 - .../mcpitanlib/api/util/nbt/NbtListUtil.java | 88 - .../mcpitanlib/api/util/nbt/NbtRWUtil.java | 141 -- .../mcpitanlib/api/util/nbt/v2/NbtRWUtil.java | 126 -- .../api/util/particle/CompatParticleType.java | 34 - .../util/particle/CompatParticleTypes.java | 121 -- .../effect/ItemStackParticleEffectUtil.java | 22 - .../api/util/recipe/RecipeMatcherUtil.java | 43 - .../api/util/recipe/RecipeUtil.java | 101 - .../recipe/input/CraftingRecipeInputUtil.java | 97 - .../input/SingleStackRecipeInputUtil.java | 32 - .../api/util/screen/ScreenHandlerUtil.java | 28 - .../mcpitanlib/api/util/v1/BlockUtilV1.java | 73 - .../mcpitanlib/api/util/v1/ItemUtilV1.java | 92 - .../mcpitanlib/api/util/v2/BlockUtilV2.java | 125 -- .../api/util/v2/CustomNameUtil.java | 50 - .../mcpitanlib/api/util/v2/ItemUtilV2.java | 94 - .../api/util/world/ChunkManagerUtil.java | 26 - .../api/util/world/ServerWorldUtil.java | 44 - .../mcpitanlib/api/util/world/TickerUtil.java | 53 - .../api/util/world/WorldAccessUtil.java | 52 - .../api/util/world/WorldViewUtil.java | 104 -- .../api/world/CompatiblePersistentState.java | 47 - .../mcpitanlib/api/world/ExtendWorld.java | 48 - .../net/pitan76/mcpitanlib/core/Dummy.java | 4 - .../core/command/CommandResult.java | 73 - .../mcpitanlib/core/datafixer/Pair.java | 43 - .../core/mc1216/NbtDataConverter.java | 198 -- .../mcpitanlib/core/network/BufPayload.java | 67 - .../mcpitanlib/core/player/ItemCooldown.java | 31 - .../core/registry/FuelRegistry.java | 28 - .../core/registry/MCPLRegistry.java | 95 - .../core/registry/MCPLRegistry1_20.java | 43 - .../core/registry/MCPLRegistry1_21.java | 39 - .../core/serialization/CompatMapCodec.java | 76 - .../codecs/CompatBlockMapCodecUtil.java | 57 - .../pitan76/mcpitanlib/debug/DebugTool.java | 27 - .../mcpitanlib/guilib/GuiRegistry.java | 46 - .../mcpitanlib/guilib/GuiTextures.java | 9 - .../mcpitanlib/guilib/MGLClientNetworks.java | 23 - .../pitan76/mcpitanlib/guilib/MPLGuiLib.java | 31 - .../mcpitanlib/guilib/api/IScreenInfo.java | 38 - .../guilib/api/ISimpleScreenInfo.java | 14 - .../mcpitanlib/guilib/api/NetworkDefines.java | 8 - .../entity/BlockEntityWithContainer.java | 40 - .../ExtendedBlockEntityWithContainer.java | 59 - .../container/BlockEntityContainerGui.java | 11 - .../guilib/api/container/ContainerGui.java | 66 - .../ExtendedBlockEntityContainerGui.java | 39 - .../api/container/SimpleContainerGui.java | 16 - .../guilib/api/render/PartsRenderer.java | 72 - .../guilib/api/render/SlotRenderer.java | 27 - .../guilib/api/screen/ContainerGuiScreen.java | 86 - .../api/screen/SimpleContainerGuiScreen.java | 16 - .../mcpitanlib/guilib/test/TestContainer.java | 55 - .../pitan76/mcpitanlib/midohra/Midohra.java | 160 -- .../mcpitanlib/midohra/MidohraAPI.java | 13 - .../mcpitanlib/midohra/block/BlockState.java | 159 -- .../midohra/block/BlockWrapper.java | 136 -- .../mcpitanlib/midohra/block/Blocks.java | 771 -------- .../midohra/block/SupplierBlockWrapper.java | 27 - .../block/entity/BlockEntityTypeWrapper.java | 58 - .../block/entity/BlockEntityWrapper.java | 133 -- .../RewritableBlockEntityTypeWrapper.java | 32 - .../SupplierBlockEntityTypeWrapper.java | 27 - .../entity/SupplierBlockEntityWrapper.java | 27 - .../midohra/client/render/CameraWrapper.java | 72 - .../midohra/component/ItemComponentTypes.java | 132 -- .../item/CustomNameComponentType.java | 31 - .../component/item/ItemComponentType.java | 31 - .../component/item/RarityComponentType.java | 31 - .../midohra/easybuilder/BlockBuilder.java | 308 ---- .../easybuilder/BlockEntityBuilder.java | 88 - .../BlockWithBlockEntityBuilder.java | 107 -- .../midohra/easybuilder/ItemBuilder.java | 198 -- .../midohra/easybuilder/built/BuiltBlock.java | 146 -- .../easybuilder/built/BuiltBlockEntity.java | 65 - .../built/BuiltBlockWithEntity.java | 40 - .../midohra/easybuilder/built/BuiltItem.java | 91 - .../midohra/entity/EntityTypeWrapper.java | 95 - .../midohra/entity/EntityTypes.java | 75 - .../midohra/entity/EntityWrapper.java | 334 ---- .../midohra/entity/ItemEntityWrapper.java | 79 - .../midohra/entity/SpawnReason.java | 50 - .../midohra/fluid/FluidWrapper.java | 100 - .../mcpitanlib/midohra/fluid/Fluids.java | 9 - .../holder/BlockStatePropertyHolder.java | 35 - .../midohra/item/ItemGroupWrapper.java | 57 - .../mcpitanlib/midohra/item/ItemGroups.java | 30 - .../mcpitanlib/midohra/item/ItemStack.java | 222 --- .../mcpitanlib/midohra/item/ItemWrapper.java | 161 -- .../mcpitanlib/midohra/item/Items.java | 984 ---------- .../midohra/item/SupplierItemWrapper.java | 22 - .../midohra/nbt/ElementConvertible.java | 9 - .../mcpitanlib/midohra/nbt/NbtCompound.java | 155 -- .../mcpitanlib/midohra/nbt/NbtElement.java | 49 - .../mcpitanlib/midohra/nbt/NbtList.java | 110 -- .../midohra/network/CompatPacketByteBuf.java | 116 -- .../midohra/recipe/CraftingRecipe.java | 74 - .../mcpitanlib/midohra/recipe/Ingredient.java | 95 - .../mcpitanlib/midohra/recipe/Recipe.java | 91 - .../midohra/recipe/RecipeManager.java | 21 - .../mcpitanlib/midohra/recipe/RecipeType.java | 57 - .../midohra/recipe/ServerRecipeManager.java | 157 -- .../midohra/recipe/ShapedRecipe.java | 60 - .../midohra/recipe/ShapelessRecipe.java | 52 - .../recipe/entry/CraftingRecipeEntry.java | 55 - .../midohra/recipe/entry/RecipeEntry.java | 87 - .../recipe/entry/ShapedRecipeEntry.java | 55 - .../recipe/entry/ShapelessRecipeEntry.java | 55 - .../input/CraftingRecipeInputOrInventory.java | 67 - .../recipe/input/RecipeInputOrInventory.java | 80 - .../input/TypedRecipeInputOrInventory.java | 56 - .../mcpitanlib/midohra/resource/Resource.java | 74 - .../midohra/resource/ResourceManager.java | 84 - .../mcpitanlib/midohra/server/MCServer.java | 96 - .../midohra/server/PlayerManager.java | 152 -- .../midohra/util/hit/BlockHitResult.java | 59 - .../midohra/util/hit/HitResult.java | 106 -- .../midohra/util/hit/HitResultType.java | 36 - .../midohra/util/math/BlockPos.java | 138 -- .../mcpitanlib/midohra/util/math/Box.java | 144 -- .../midohra/util/math/ChunkPos.java | 154 -- .../midohra/util/math/Direction.java | 133 -- .../midohra/util/math/Vector3d.java | 223 --- .../midohra/util/math/Vector3f.java | 212 --- .../midohra/util/math/Vector3i.java | 231 --- .../midohra/util/math/v0/BlockPos.java | 90 - .../midohra/util/shape/VoxelShape.java | 76 - .../mcpitanlib/midohra/world/BlockView.java | 41 - .../mcpitanlib/midohra/world/IWorldView.java | 28 - .../midohra/world/RedstoneView.java | 41 - .../mcpitanlib/midohra/world/ServerWorld.java | 63 - .../mcpitanlib/midohra/world/World.java | 167 -- .../mcpitanlib/midohra/world/WorldAccess.java | 191 -- .../mcpitanlib/midohra/world/WorldView.java | 85 - .../midohra/world/chunk/ChunkManager.java | 41 - .../midohra/world/chunk/ChunkTicketType.java | 87 - .../world/chunk/ServerChunkManager.java | 51 - .../midohra/world/tick/ScheduledTickView.java | 47 - .../AbstractBlock4CompatProviderMixin.java | 97 - .../mcpitanlib/mixin/AbstractBlockMixin.java | 139 -- .../mixin/Block4CompatProviderMixin.java | 28 - .../mcpitanlib/mixin/BlockInvoker.java | 12 - .../pitan76/mcpitanlib/mixin/BlockMixin.java | 100 - .../mcpitanlib/mixin/CraftingRecipeMixin.java | 28 - .../pitan76/mcpitanlib/mixin/ItemMixin.java | 255 --- .../ItemStackComponentizationFixMixin.java | 40 - .../mcpitanlib/mixin/ItemStackMixin.java | 25 - .../mixin/ItemUsageContextMixin.java | 12 - .../mixin/MinecraftServerTimer.java | 38 - .../mcpitanlib/mixin/RecipeManagerMixin.java | 27 - .../mcpitanlib/mixin/ServerWorldTimer.java | 38 - .../mcpitanlib/mixin/WorldRendererMixin.java | 84 - .../mcpitanlib/test/ExampleCommand.java | 50 - .../mcpitanlib/test/ExampleContainerGui.java | 26 - .../test/ExampleContainerGuiScreen.java | 30 - .../mcpitanlib/test/ExampleGuiBlock.java | 36 - .../mcpitanlib/test/ExampleGuiItem.java | 37 - .../pitan76/mcpitanlib/test/ExampleMod.java | 88 - .../mcpitanlib/test/ExampleModClient.java | 12 - .../mcpitanlib/test/ExampleScreen.java | 30 - .../mcpitanlib/test/ExampleScreenHandler.java | 24 - .../mplguilib/textures/container/base.png | Bin 802 -> 0 bytes .../textures/container/base_furnace.png | Bin 1637 -> 0 bytes .../textures/container/gui_parts.png | Bin 1515 -> 0 bytes fabric/build.gradle | 129 -- gradle.properties | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- mappings/121-1fix.tiny | 5 - mappings/yarnpatch.tiny | 3 - neoforge/build.gradle | 112 -- neoforge/gradle.properties | 1 - .../neoforge/WorldRenderRegistryImpl.java | 227 --- .../neoforge/CompatRegistryClientImpl.java | 32 - .../neoforge/BlockEntityTypeBuilderImpl.java | 14 - .../v1/neoforge/FluidStorageUtilImpl.java | 17 - .../v1/neoforge/NeoForgeFluidStorage.java | 89 - .../v1/neoforge/NeoForgeFluidVariant.java | 33 - .../api/util/neoforge/PlatformUtilImpl.java | 26 - .../neoforge/MCPitanLibNeoForge.java | 29 - .../client/MCPitanLibNeoForgeClient.java | 10 - .../resources/META-INF/neoforge.mods.toml | 42 - neoforge/src/main/resources/pack.mcmeta | 8 - settings.gradle | 10 +- .../pitan76}/fabric/ExtendModInitializer.java | 2 +- .../net/pitan76}/fabric/MCPitanLibFabric.java | 2 +- .../pitan76}/fabric/mixin/RecipeMixin.java | 1 + .../fabric/CompatRegistryClientImpl.java | 25 + .../extra/transfer/util/FluidStorageUtil.java | 99 + .../block/BlockApiLookupWithDirection.java | 56 + .../lookup/block/BlockApiLookupWrapper.java | 57 + .../api/tile/RenderAttachmentBlockEntity.java | 21 + .../transfer/fluid/v1/FabricFluidStorage.java | 79 + .../transfer/fluid/v1/FabricFluidVariant.java | 33 + src/main/resources/fabric.mod.json | 42 + {common/src => src}/main/resources/icon.png | Bin .../resources/mcpitanlib-common.mixins.json | 0 .../main/resources/mcpitanlib.accesswidener | 0 .../main/resources/mcpitanlib.mixins.json | 3 +- 660 files changed, 503 insertions(+), 49650 deletions(-) delete mode 100644 common/build.gradle delete mode 100644 common/src/main/java/net/pitan76/easyapi/FileControl.java delete mode 100644 common/src/main/java/net/pitan76/easyapi/config/Config.java delete mode 100644 common/src/main/java/net/pitan76/easyapi/config/IConfig.java delete mode 100644 common/src/main/java/net/pitan76/easyapi/config/JsonConfig.java delete mode 100644 common/src/main/java/net/pitan76/easyapi/config/YamlConfig.java delete mode 100644 common/src/main/java/net/pitan76/easyapi/config/package-info.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java delete mode 100644 common/src/main/resources/assets/mplguilib/textures/container/base.png delete mode 100644 common/src/main/resources/assets/mplguilib/textures/container/base_furnace.png delete mode 100644 common/src/main/resources/assets/mplguilib/textures/container/gui_parts.png delete mode 100644 fabric/build.gradle delete mode 100644 mappings/121-1fix.tiny delete mode 100644 mappings/yarnpatch.tiny delete mode 100644 neoforge/build.gradle delete mode 100644 neoforge/gradle.properties delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java delete mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java delete mode 100644 neoforge/src/main/resources/META-INF/neoforge.mods.toml delete mode 100644 neoforge/src/main/resources/pack.mcmeta rename {fabric/src/main/java/net/pitan76/mcpitanlib => src/main/java/net/pitan76}/fabric/ExtendModInitializer.java (97%) rename {fabric/src/main/java/net/pitan76/mcpitanlib => src/main/java/net/pitan76}/fabric/MCPitanLibFabric.java (91%) rename {fabric/src/main/java/net/pitan76/mcpitanlib => src/main/java/net/pitan76}/fabric/mixin/RecipeMixin.java (94%) create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java create mode 100644 src/main/resources/fabric.mod.json rename {common/src => src}/main/resources/icon.png (100%) rename {common/src => src}/main/resources/mcpitanlib-common.mixins.json (100%) rename {common/src => src}/main/resources/mcpitanlib.accesswidener (100%) rename {neoforge/src => src}/main/resources/mcpitanlib.mixins.json (70%) diff --git a/build.gradle b/build.gradle index 56a528bfe..7cf5edc2c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,6 @@ plugins { - id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.14-SNAPSHOT" apply false - id 'com.matthewprenger.cursegradle' version '1.5.0' - id "com.modrinth.minotaur" version "2.+" -} - -architectury { - minecraft = rootProject.minecraft_version + id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' + id 'maven-publish' } def loadProperties(filename) { @@ -19,112 +13,99 @@ def loadProperties(filename) { ext.info = loadProperties("$rootDir/info.properties") -allprojects { - version = info.mod_version + "-" + rootProject.minecraft_version - group = info.maven_group +version = info.mod_version +group = info.maven_group + +base { + archivesName = info.archives_base_name } -subprojects { - apply plugin: "architectury-plugin" - apply plugin: "dev.architectury.loom" - apply plugin: "maven-publish" - apply plugin: "com.modrinth.minotaur" - apply plugin: "com.matthewprenger.cursegradle" - base { - // Set up a suffixed format for the mod jar names, e.g. `example-fabric`. - archivesName = info.archives_base_name - } +repositories { + maven { url "https://maven.pitan76.net/" } + maven { url "https://maven.shedaniel.me/" } +} - loom { - silentMojangMappingsLicense() - } +dependencies { + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + implementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}" - repositories { - maven { url "https://maven.pitan76.net/" } - maven { url "https://maven.neoforged.net/releases/" } - maven { url "https://maven.shedaniel.me/" } + implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" + +// include 'org.yaml:snakeyaml:2.0' + +// api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { +// exclude(group: "net.fabricmc.fabric-api") +// } +// include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") + + implementation("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { + exclude(group: "net.fabricmc.fabric-api") } + include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") + include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") +} - dependencies { - minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" +processResources { + inputs.property "version", info.version + inputs.property "minecraft_version", project.minecraft_version + inputs.property "loader_version", project.fabric_loader_version + filteringCharset "UTF-8" - // https://mvnrepository.com/artifact/org.yaml/snakeyaml - implementation 'org.yaml:snakeyaml:2.0' + filesMatching("fabric.mod.json") { + expand "version": info.version, + "minecraft_version": project.minecraft_version, + "loader_version": project.fabric_loader_version } +} - if (name in "fabric,neoforge".split(",")) { - var modLoader = name - - if (System.getenv("CURSEFORGE_TOKEN") != null) { - curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") - project { - id = '682213' - changelog = info.changelog - releaseType = 'beta' - if (modLoader == "fabric") { - addGameVersion "Fabric" - } - if (modLoader == "forge") { - addGameVersion "Forge" - } - if (modLoader == "neoforge") { - addGameVersion "NeoForge" - } - addGameVersion '26.1' - - relations { - if (modLoader == "fabric") { - requiredDependency "fabric-api" - } - -// requiredDependency 'architectury-api' -// embeddedLibrary 'cloth-config' - embeddedLibrary 'compatdatapacks' - embeddedLibrary 'legacyitemmodels' - } - - mainArtifact(tasks.remapJar) - } - options { - forgeGradleIntegration = false - } - } +def targetJavaVersion = 25 +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { + it.options.release.set(targetJavaVersion) + } +} - } +java { + def javaVersion = JavaVersion.toVersion(targetJavaVersion) + if (JavaVersion.current() < javaVersion) { + toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) + } + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() +} - if (System.getenv("MODRINTH_TOKEN") != null) { - modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = 'mcpitanlibarch' - versionNumber = info.mod_version + "-" + modLoader - gameVersions = ['26.1'] - versionType = 'beta' - uploadFile = tasks.remapJar - changelog = info.changelog - loaders = [modLoader] - dependencies { - if (modLoader == "fabric") { - required.project "fabric-api" // Fabric API - } -// required.project "architectury-api" -// embedded.project "cloth-config" - embedded.project "compatdatapacks" - embedded.project "legacyitemmodels" - } - } - } +jar { + from("LICENSE") { + rename { "${it}_${info.archives_base_name}" } } +} - tasks.withType(JavaCompile).configureEach { - options.encoding = "UTF-8" - options.release = 21 - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 +// configure the maven publication +publishing { + publications { + register("mavenJava", MavenPublication) { + artifactId = info.archives_base_name + from components.java + } } - java { - withSourcesJar() + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. } } diff --git a/common/build.gradle b/common/build.gradle deleted file mode 100644 index 0c17b9439..000000000 --- a/common/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -dependencies { - // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies - // Do NOT use other classes from fabric loader - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - // Remove the next line if you don't want to depend on the API -// modApi "dev.architectury:architectury:${rootProject.architectury_version}" -} - -architectury { - common("fabric", "neoforge") -} - -loom { - accessWidenerPath = file("src/main/resources/mcpitanlib.accesswidener") -} - -publishing { - publications { - mavenCommon(MavenPublication) { - artifactId = info.archives_base_name + "-" + project.name + "-" + rootProject.minecraft_version - version = info.mod_version - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/PTOM76/maven") - credentials { - username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") - password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") - } - } - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/easyapi/FileControl.java b/common/src/main/java/net/pitan76/easyapi/FileControl.java deleted file mode 100644 index 673c29ab2..000000000 --- a/common/src/main/java/net/pitan76/easyapi/FileControl.java +++ /dev/null @@ -1,173 +0,0 @@ -package net.pitan76.easyapi; - -import java.io.*; -import java.nio.channels.FileChannel; - -public class FileControl { - - public static boolean fileWriteContents(String pathName, String contents){ return fileWriteContents(new File(pathName), contents); } - - public static String fileReadContents(String pathName) { return fileReadContents(new File(pathName)); } - - public static boolean fileCopy(String inPathName, String outPathName) { return fileCopy(new File(inPathName), new File(outPathName)); } - - public static boolean fileExists(String pathName) { return fileExists(new File(pathName)); } - - public static long getFileTime(String pathName) { return getFileTime(new File(pathName)); } - - public static boolean setFileTime(String pathName, long time) { return setFileTime(new File(pathName), time); } - - public static boolean fileRename(String pathName, String renamedPathName) { return fileRename(new File(pathName), new File(renamedPathName)); } - - public static String basename(String pathName) { return basename(new File(pathName)); } - - public static String dirname(String pathName) { return dirname(new File(pathName)); } - - public static String dirname(String pathName, int levels) { return dirname(new File(pathName), levels); } - - /** - * ファイルにデータを書き込みます。 - * 失敗した場合falseを返します。 - * - * @param file ファイル - * @param contents データ - */ - public static boolean fileWriteContents(File file, String contents) { - try { - PrintWriter writer = new PrintWriter( - new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"))); - writer.println(contents); - writer.close(); - return true; - } catch (IOException e) { - e.printStackTrace(); - return false; - } - } - - /** - * ファイルからデータを読み込みます。 - * 失敗した場合nullを返します。 - * - * @param file ファイル - * @return ファイルのデータ or null - */ - public static String fileReadContents(File file) { - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); - String line = ""; - String contents = ""; - while ((line = reader.readLine()) != null) { - contents += line + "\n"; - } - reader.close(); - return contents; - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - /** - * ファイルからデータを読み込みます。 - * 失敗した場合falseを返します。 - * - * @param inFile コピー元ファイル - * @param outFile コピー先ファイル - */ - public static boolean fileCopy(File inFile, File outFile) { - try { - FileChannel inCh, outCh = null; - FileInputStream inStream = new FileInputStream(inFile); - FileOutputStream outStream = new FileOutputStream(outFile); - inCh = inStream.getChannel(); - outCh = outStream.getChannel(); - outCh.transferFrom(inCh, 0, inCh.size()); - inCh.close(); - outCh.close(); - inStream.close(); - outStream.close(); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * File.exists()のエイリアス関数です。 - * - * @param file 確認するファイル - */ - public static boolean fileExists(File file) { - return file.exists(); - } - - /** - * File.lastModified()のエイリアス関数です。 - * - * @param file 更新日時を取得するファイル - * @return ファイルの更新日時 - */ - public static long getFileTime(File file) { - return file.lastModified(); - } - - - /** - * File.setLastModified()のエイリアス関数です。 - * - * @param file 日時変更されるファイル - * @param time 変更後の更新日時 - */ - public static boolean setFileTime(File file, long time) { - return file.setLastModified(time); - } - - /** - * File.renameTo()のエイリアス関数です。 - * - * @param file 名前変更されるファイル - * @param renamedFile 名前変更後のファイル - */ - public static boolean fileRename(File file, File renamedFile) { - return file.renameTo(renamedFile); - } - - /** - * StringからFileへ変換します。 - * - * @param pathName ファイルのパス - * @return File - */ - public static File stringToFile(String pathName) { - return new File(pathName); - } - - public static String basename(File file) { - return file.getName(); - } - - public static String dirname(File file) { - return file.getParent(); - } - - public static String dirname(File file, int levels) { - for (int i = 0; i < levels; i++) { - file = dirfile(file); - } - return file.toString(); - } - - public static File dirfile(File file) { - return file.getParentFile(); - } - - public static File dirfile(File file, int count) { - for (int i = 0; i > count; i++) { - file = dirfile(file); - } - return file; - } - -} diff --git a/common/src/main/java/net/pitan76/easyapi/config/Config.java b/common/src/main/java/net/pitan76/easyapi/config/Config.java deleted file mode 100644 index cdbabbcc1..000000000 --- a/common/src/main/java/net/pitan76/easyapi/config/Config.java +++ /dev/null @@ -1,456 +0,0 @@ -package net.pitan76.easyapi.config; - -import java.io.File; -import java.util.LinkedHashMap; -import java.util.Map; - -public class Config implements IConfig { - public Map configMap = new LinkedHashMap<>(); - - /** - * 任意ファイルを読み込み、Mapへ変換 - * - * @param file ファイル - */ - public Config(File file) { - load(file); - } - - /** - * 任意ファイルを読み込み、Mapへ変換 - * - * @param file ファイル名 - */ - public Config(String file) { - this(new File(file)); - } - - public Config() {}; - - /** - * Configの変換 - * - * @param config Config - */ - public Config(Config config) { - configMap = config.configMap; - }; - - public boolean has(String key) { - if (configMap == null) - return false; - - return configMap.containsKey(key); - } - - /** - * マップのキーから値を取得 - * "."でパスを区切る - * - * @param key キー - * @return 取得した値 - */ - @SuppressWarnings("unchecked") - public Object get(String key) { - try { - key = key.replace("\\.", "$\$"); - String[] keyList = key.split("\\."); - if (keyList.length == 1) { - key = key.replace("$\$", "."); - return configMap.get(key); - } - int i = 0; - Map inMap = new LinkedHashMap<>(); - for (String k : keyList) { - i++; - k = k.replace("$\$", "."); - if (keyList.length == i) { - return inMap.get(k); - } - if (i == 1) { - inMap = (Map) configMap.get(k); - continue; - } - inMap = (Map) inMap.get(k); - } - return null; - } catch (Exception e) { - return null; - } - - } - - /** - * マップのキーから値(文字列)を取得 - * "."でパスを区切る - * - * @param key キー - * @return 取得した値 - */ - public String getString(String key) { - return (String) get(key); - } - - /** - * マップのキーから値(整数)を取得 - * "."でパスを区切る - * - * @param key キー - * @return 取得した値 - */ - public int getInt(String key) { - Object obj = get(key); - if (obj instanceof Double) { - return ((Double)obj).intValue(); - } - if (obj instanceof Short) { - return ((Short)obj).intValue(); - } - if (obj instanceof Long) { - return ((Long)obj).intValue(); - } - return (Integer) obj; - } - - /** - * マップのキーから値(数値)を取得 - * "."でパスを区切る - * - * @param key キー - * @return 取得した値 - */ - public double getDouble(String key) { - return (Double) get(key); - } - - /** - * マップのキーから値(真偽値)を取得 - * "."でパスを区切る - * - * @param key キー - * @return 取得した値 - */ - public boolean getBoolean(String key) { - try { - return (Boolean) get(key); - } catch (Exception e) { - return false; - } - } - - /** - * マップのキーから値を取得、存在しない場合はデフォルト値を返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public Object getOrDefault(String key, Object defaultValue) { - if (has(key)) { - return get(key); - } - return defaultValue; - } - - /** - * マップのキーから値(文字列)を取得、存在しない場合はデフォルト値を返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public String getStringOrDefault(String key, String defaultValue) { - if (has(key)) { - return getString(key); - } - return defaultValue; - } - - /** - * マップのキーから値(整数)を取得、存在しない場合はデフォルト値を返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public int getIntOrDefault(String key, int defaultValue) { - if (has(key)) { - return getInt(key); - } - return defaultValue; - } - - /** - * マップのキーから値(数値)を取得、存在しない場合はデフォルト値を返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public double getDoubleOrDefault(String key, double defaultValue) { - if (has(key)) { - return getDouble(key); - } - return defaultValue; - } - /** - * マップのキーから値(真偽値)を取得、存在しない場合はデフォルト値を返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public boolean getBooleanOrDefault(String key, boolean defaultValue) { - if (has(key)) { - return getBoolean(key); - } - return defaultValue; - } - - /** - * マップのキーから値を取得、存在しない場合はデフォルト値を保存して返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public Object getOrCreate(String key, Object defaultValue) { - if (has(key)) return get(key); - - set(key, defaultValue); - return defaultValue; - } - - /** - * マップのキーから値(文字列)を取得、存在しない場合はデフォルト値を保存して返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public String getStringOrCreate(String key, String defaultValue) { - if (has(key)) return getString(key); - - setString(key, defaultValue); - return defaultValue; - } - - /** - * マップのキーから値(整数)を取得、存在しない場合はデフォルト値を保存して返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public int getIntOrCreate(String key, int defaultValue) { - if (has(key)) return getInt(key); - - setInt(key, defaultValue); - return defaultValue; - } - - /** - * マップのキーから値(数値)を取得、存在しない場合はデフォルト値を保存して返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public double getDoubleOrCreate(String key, double defaultValue) { - if (has(key)) return getDouble(key); - - setDouble(key, defaultValue); - return defaultValue; - } - - /** - * マップのキーから値(真偽値)を取得、存在しない場合はデフォルト値を保存して返す - * "."でパスを区切る - * - * @param key キー - * @param defaultValue デフォルト値 - * @return 取得した値 - */ - public boolean getBooleanOrCreate(String key, boolean defaultValue) { - if (has(key)) return getBoolean(key); - - setBoolean(key, defaultValue); - return defaultValue; - } - - /** - * マップのキーに値をセット - * "."でパスを区切る - * 失敗するとfalseを返す - * - * @param key キー - * @param value 値 - * @return 真偽値 - */ - @SuppressWarnings("unchecked") - public boolean set(String key, Object value) { - try { - key = key.replace("\\.", "$\$"); - String[] keyList = key.split("\\."); - if (keyList.length == 1) { - key = key.replace("$\$", "."); - configMap.put(key, value); - return true; - } - int i = 0; - Map inMap = new LinkedHashMap<>(); - for (String k : keyList) { - i++; - k = k.replace("$\$", "."); - if (keyList.length == i) { - inMap.put(k, value); - continue; - } - Map beforeInMap = inMap; - if (configMap.containsKey(k) && i == 1) { - inMap = (LinkedHashMap) configMap.get(k); - }else if (beforeInMap.containsKey(k)){ - inMap = (LinkedHashMap) beforeInMap.get(k); - }else { - inMap = new LinkedHashMap(); - } - if (i == 1) { - configMap.put(k, inMap); - continue; - } - beforeInMap.put(k, inMap); - } - return true; - } catch (Exception e) { - return false; - } - } - - /** - * マップのキーに値(文字列)をセット - * "."でパスを区切る - * 失敗するとfalseを返す - * - * @param key キー - * @param value 値 - * @return 真偽値 - */ - public boolean setString(String key, String value) { - return set(key, value); - } - - /** - * マップのキーに値(整数)をセット - * "."でパスを区切る - * 失敗するとfalseを返す - * - * @param key キー - * @param value 値 - * @return 真偽値 - */ - public boolean setInt(String key, int value) { - return set(key, value); - } - - /** - * マップのキーに値(数値)をセット - * "."でパスを区切る - * 失敗するとfalseを返す - * - * @param key キー - * @param value 値 - * @return 真偽値 - */ - public boolean setDouble(String key, double value) { - return set(key, value); - } - - /** - * マップのキーに値(真偽値)をセット - * "."でパスを区切る - * 失敗するとfalseを返す - * - * @param key キー - * @param value 値 - * @return 真偽値 - */ - public boolean setBoolean(String key, boolean value) { - return set(key, value); - } - - /** - * マップのキーから値を削除 - * "."でパスを区切る - * - * @param key キー - * @return 真偽値 - */ - public boolean remove(String key) { - return configMap.remove(key) != null; - } - - /** - * StringをFileにして読み込み、継承先で処理 - * - * @param file ファイル名 - */ - public boolean load(String file) { - return load(new File(file)); - } - - /** - * この関数は継承先で定義 - * - * @param file ファイル - */ - public boolean load(File file) { - return false; - } - - /** - * StringをFileにし、継承先で処理して保存 - * - * @param file ファイル名 - */ - public boolean save(String file) { - return save(new File(file)); - } - - /** - * ファイルを継承先で処理して保存 - * - * @param file ファイル - */ - public boolean save(File file) { - return save(file, true); - } - - /** - * ファイルを継承先で処理して保存 - * - * @param file ファイル名 - * @param pretty 整形 - */ - public boolean save(String file, boolean pretty) { - return save(new File(file), pretty); - } - - /** - * この関数は継承先で定義 - * - * @param file ファイル - * @param pretty 整形 - */ - public boolean save(File file, boolean pretty) { - return false; - } -} diff --git a/common/src/main/java/net/pitan76/easyapi/config/IConfig.java b/common/src/main/java/net/pitan76/easyapi/config/IConfig.java deleted file mode 100644 index 09d0b68e8..000000000 --- a/common/src/main/java/net/pitan76/easyapi/config/IConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.pitan76.easyapi.config; - -import java.io.File; -import java.util.LinkedHashMap; -import java.util.Map; - -public interface IConfig { - Map configMap = new LinkedHashMap<>(); - - Object get(String key); - - String getString(String key); - - int getInt(String key); - - boolean getBoolean(String key); - - boolean set(String key, Object value); - - boolean setString(String key, String value); - - boolean setInt(String key, int value); - - boolean setBoolean(String key, boolean value); - - boolean load(String file); - - boolean load(File file); - - boolean save(String file); - - boolean save(File file); - - boolean save(String file, boolean pretty); - - boolean save(File file, boolean pretty); -} diff --git a/common/src/main/java/net/pitan76/easyapi/config/JsonConfig.java b/common/src/main/java/net/pitan76/easyapi/config/JsonConfig.java deleted file mode 100644 index c549f09da..000000000 --- a/common/src/main/java/net/pitan76/easyapi/config/JsonConfig.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.pitan76.easyapi.config; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import net.pitan76.easyapi.FileControl; - -import java.io.File; -import java.lang.reflect.Type; -import java.util.LinkedHashMap; - -public class JsonConfig extends Config { - /** - * - * @param file ファイル - */ - public JsonConfig(File file) { - super(file); - } - - /** - * - * @param file ファイル名 - */ - public JsonConfig(String file) { - super(file); - } - - public JsonConfig() { - super(); - } - - /** - * Config→JsonConfigへ変換 - * - * @param config Config - */ - public JsonConfig(Config config) { - super(config); - } - - /** - * Jsonファイルを読み込んでMapへ変換 - * - * @param file ファイル - * @return 成功→true / 失敗→false - */ - public boolean load(File file) { - if (!file.exists()) { - configMap = new LinkedHashMap<>(); - return false; - } - - try { - String configData = FileControl.fileReadContents(file); - Gson gson = new Gson(); - Type jsonMap = new TypeToken>() { - }.getType(); - configMap = gson.fromJson(configData, jsonMap); - return true; - } catch (Exception e) { - configMap = new LinkedHashMap<>(); - return false; - } - } - - /** - * MapをJsonへ変換し、Jsonファイルとして保存 - * - * @param file ファイル - * @param pretty 整形 - * @return 成功→true / 失敗→false - */ - public boolean save(File file, boolean pretty) { - try { - String configData = this.toJson(pretty); - FileControl.fileWriteContents(file, configData); - return true; - } catch (Exception e) { - return false; - } - } - - /** - * MapをJsonへ変換 失敗した場合はnullを返す - * - * @param pretty 整形 - * @return Jsonの文字列 - */ - public String toJson(boolean pretty) { - try { - Gson gson = new Gson(); - if (pretty) { - gson = new GsonBuilder().setPrettyPrinting().create(); - } - String configData = gson.toJson(configMap); - return configData; - } catch (Exception e) { - return null; - } - } -} diff --git a/common/src/main/java/net/pitan76/easyapi/config/YamlConfig.java b/common/src/main/java/net/pitan76/easyapi/config/YamlConfig.java deleted file mode 100644 index cc3774746..000000000 --- a/common/src/main/java/net/pitan76/easyapi/config/YamlConfig.java +++ /dev/null @@ -1,114 +0,0 @@ -package net.pitan76.easyapi.config; - -import net.pitan76.easyapi.FileControl; -import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.Yaml; - -import java.io.File; -import java.util.LinkedHashMap; -import java.util.Map; - -public class YamlConfig extends Config { - - /** - * - * @param file ファイル - */ - public YamlConfig(File file) { - super(file); - } - - /** - * - * @param file ファイル名 - */ - public YamlConfig(String file) { - super(file); - } - - public YamlConfig() { - super(); - } - - /** - * Config→JsonConfigへ変換 - * - * @param config Config - */ - public YamlConfig(Config config) { - super(config); - } - - private DumperOptions.FlowStyle style = DumperOptions.FlowStyle.BLOCK; - - /** - * 出力するYamlのスタイルの設定 - * - * @param flowStyle FlowStyle - */ - public void setStyle(DumperOptions.FlowStyle flowStyle) { - style = flowStyle; - } - - /** - * Yamlファイルを読み込んでMapへ変換 - * - * @param file ファイル - * @return 成功→true / 失敗→false - */ - @SuppressWarnings("unchecked") - public boolean load(File file) { - if (!file.exists()) { - configMap = new LinkedHashMap<>(); - return false; - } - - try { - String configData = FileControl.fileReadContents(file); - Yaml yaml = new Yaml(); - configMap = (Map) yaml.load(configData); - return true; - } catch (Exception e) { - configMap = new LinkedHashMap<>(); - return false; - } - } - - /** - * MapをYamlへ変換し、Yamlファイルとして保存 - * - * @param file ファイル - * @param pretty 整形 - * @return 成功→true / 失敗→false - */ - public boolean save(File file, boolean pretty) { - try { - String configData = this.toYaml(pretty); - FileControl.fileWriteContents(file, configData); - return true; - } catch (Exception e) { - return false; - } - } - - /** - * MapをYamlへ変換 失敗した場合はnullを返す - * - * @param pretty 整形 - * @return Yamlの文字列 - */ - public String toYaml(boolean pretty) { - try { - DumperOptions options = new DumperOptions(); - options.setDefaultFlowStyle(style); - if (pretty) { - options.setPrettyFlow(true); - } - Yaml yaml = new Yaml(options); - String configData = yaml.dump(configMap); - return configData; - } catch (Exception e) { - return null; - } - } -} diff --git a/common/src/main/java/net/pitan76/easyapi/config/package-info.java b/common/src/main/java/net/pitan76/easyapi/config/package-info.java deleted file mode 100644 index 88238e2bc..000000000 --- a/common/src/main/java/net/pitan76/easyapi/config/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Config関連のクラスが入っているパッケージ - */ -package net.pitan76.easyapi.config; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java b/common/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java deleted file mode 100644 index d91c5ce9b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java +++ /dev/null @@ -1,127 +0,0 @@ -/* -Copyright (C) 2022-2024 Pitan - -MCPitanLib is under the MIT license. For more information, please refer to the LICENSE file at the root of the repository. -MCPitanLibはMITライセンスです。ライセンスについてはリポジトリ直下のLICENSEファイルを参照してください。 - */ - -package net.pitan76.mcpitanlib; - -import net.minecraft.util.Identifier; -import net.pitan76.easyapi.config.Config; -import net.pitan76.easyapi.config.JsonConfig; -import net.pitan76.mcpitanlib.api.registry.CompatRegistry; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; -import net.pitan76.mcpitanlib.api.util.PlatformUtil; -import net.pitan76.mcpitanlib.debug.DebugTool; -import net.pitan76.mcpitanlib.guilib.MPLGuiLib; -import net.pitan76.mcpitanlib.test.ExampleMod; -import net.pitan76.mcpitanlib.test.ExampleModClient; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class MCPitanLib { - public static final String MOD_ID = "mcpitanlib"; - - private static final File configFile = new File(PlatformUtil.getConfigFolder().toFile(), "mcpitanlib/blacklist.json"); - private static final File oldConfigFile = new File(PlatformUtil.getConfigFolder().toFile(), "mcpitanlibarch/blacklist.json"); - - public static Config config = new JsonConfig(); - private static boolean configLoaded = false; - - public static List itemBlackList = new ArrayList<>(); - public static List blockBlackList = new ArrayList<>(); - - // MCPitanLibのアイテム、ブロック、タイルエンティティの登録 - public static CompatRegistry registry; - - /** - * MCPitanLibの初期化 - */ - public static void init() { - configInit(); - MPLGuiLib.init(); - - if (PlatformUtil.isDevelopmentEnvironment() || (config.has("debugMode") && config.getBoolean("debugMode"))) { - System.out.println("MCPitanLib: Debug Mode"); - - registry = CompatRegistry.createRegistry(MOD_ID); - DebugTool.register(); - registry.allRegister(); - - new ExampleMod(); - if (PlatformUtil.isClient()) - ExampleModClient.init(); - } - } - - /** - * Configの初期化 - */ - public static void configInit() { - if (oldConfigFile.exists() && !configFile.exists()) { - oldConfigFile.renameTo(configFile); - } - - try { - if (configLoaded) return; - configLoaded = true; - if (!configFile.getParentFile().exists()) - if (!configFile.getParentFile().mkdirs()) - return; - - config.setString("item", "examplemod:hogehoge_item,examplemod:fuga_item"); - config.setString("block", "examplemod:hogehoge_block,examplemod:fuga_block"); - config.setBoolean("debugMode", false); - - if (configFile.exists()) - config.load(configFile); - - if (!config.has("debugMode")) - config.setBoolean("debugMode", false); - - if (config.has("item")) - itemBlackList.addAll(Arrays.asList(config.getString("item").split(","))); - - if (config.has("block")) - blockBlackList.addAll(Arrays.asList(config.getString("block").split(","))); - - config.save(configFile); - } catch (Exception e) { - System.out.println("MCPitanLib: Cannot save config file"); - } - } - - /** - * Identifierを生成 - * @param path パス - * @return Identifier - */ - public static Identifier id(String path) { - return IdentifierUtil.id(MOD_ID, path); - } - - public static CompatIdentifier compatId(String path) { - return CompatIdentifier.fromMinecraft(id(path)); - } - - public static boolean isItemBlackListed(Identifier id) { - try { - return itemBlackList.contains(id.toString()); - } catch (Exception e) { - return false; - } - } - - public static boolean isBlockBlackListed(Identifier id) { - try { - return blockBlackList.contains(id.toString()); - } catch (Exception e) { - return false; - } - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java deleted file mode 100644 index 148772679..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java +++ /dev/null @@ -1,66 +0,0 @@ -package net.pitan76.mcpitanlib.api; - -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; -import net.pitan76.mcpitanlib.api.util.Logger; - -public abstract class CommonModInitializer { - - public final String MOD_ID; - public final String MOD_NAME; - - public final CompatRegistryV2 registry; - public final Logger logger; - - public CommonModInitializer() { - this.MOD_ID = getId(); - this.MOD_NAME = getName(); - - this.registry = CompatRegistryV2.create(MOD_ID); - this.logger = new Logger(MOD_ID); - - logger.initializeMessage(); - init(); - registry.allRegister(); - } - - public abstract void init(); - - public abstract String getId(); - - public String getName() { - return getId(); - } - - - // Utilities - public Identifier id(String path) { - return IdentifierUtil.id(MOD_ID, path); - } - - public CompatIdentifier compatId(String path) { - return CompatIdentifier.of(MOD_ID, path); - } - - public void info(String message) { - logger.info(message); - } - - public void warn(String message) { - logger.warn(message); - } - - public void error(String message) { - logger.error(message); - } - - public void debug(String message) { - logger.debug(message); - } - - public void trace(String message) { - logger.trace(message); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java deleted file mode 100644 index 62b2c94d6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.Block; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; - -import java.util.function.Consumer; - -@Deprecated -public class BlockItemByExtendBlock1215 extends BlockItem { - private ExtendBlock block; - private ExtendBlockProvider provider; - - public BlockItemByExtendBlock1215(ExtendBlock block, Settings settings) { - super(block, settings); - this.block = block; - } - - public BlockItemByExtendBlock1215(ExtendBlockProvider provider, Settings settings) { - super((Block) provider, settings); - this.provider = provider; - } - - @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { - if (block != null) - block.appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); - - if (provider != null) - provider.appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type), new ExtendBlockProvider.Options()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java deleted file mode 100644 index 982396018..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.BlockRenderType; - -public class CompatBlockRenderType { - - public static final CompatBlockRenderType MODEL = of(BlockRenderType.MODEL); - public static final CompatBlockRenderType ENTITYBLOCK_ANIMATED = of(BlockRenderType.MODEL); - public static final CompatBlockRenderType INVISIBLE = of(BlockRenderType.INVISIBLE); - - @Deprecated - public final BlockRenderType renderType; - - public CompatBlockRenderType(BlockRenderType renderType) { - this.renderType = renderType; - } - - public static CompatBlockRenderType of(BlockRenderType renderType) { - return new CompatBlockRenderType(renderType); - } - - public BlockRenderType toMinecraft() { - return renderType; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java deleted file mode 100644 index e855ccf32..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java +++ /dev/null @@ -1,96 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - -public class CompatBlocks { - public static final Block AIR = Blocks.AIR; - public static final Block STONE = Blocks.STONE; - public static final Block COBBLESTONE = Blocks.COBBLESTONE; - public static final Block GRASS_BLOCK = Blocks.GRASS_BLOCK; - public static final Block DIRT = Blocks.DIRT; - public static final Block SAND = Blocks.SAND; - public static final Block RED_SAND = Blocks.RED_SAND; - public static final Block GRANITE = Blocks.GRANITE; - public static final Block POLISHED_GRANITE = Blocks.POLISHED_GRANITE; - public static final Block DIORITE = Blocks.DIORITE; - public static final Block POLISHED_DIORITE = Blocks.POLISHED_DIORITE; - public static final Block ANDESITE = Blocks.ANDESITE; - public static final Block POLISHED_ANDESITE = Blocks.POLISHED_ANDESITE; - public static final Block COARSE_DIRT = Blocks.COARSE_DIRT; - public static final Block PODZOL = Blocks.PODZOL; - - public static final Block OAK_LOG = Blocks.OAK_LOG; - public static final Block SPRUCE_LOG = Blocks.SPRUCE_LOG; - public static final Block BIRCH_LOG = Blocks.BIRCH_LOG; - public static final Block JUNGLE_LOG = Blocks.JUNGLE_LOG; - public static final Block ACACIA_LOG = Blocks.ACACIA_LOG; - public static final Block DARK_OAK_LOG = Blocks.DARK_OAK_LOG; - public static final Block OAK_PLANKS = Blocks.OAK_PLANKS; - public static final Block SPRUCE_PLANKS = Blocks.SPRUCE_PLANKS; - public static final Block BIRCH_PLANKS = Blocks.BIRCH_PLANKS; - public static final Block JUNGLE_PLANKS = Blocks.JUNGLE_PLANKS; - public static final Block ACACIA_PLANKS = Blocks.ACACIA_PLANKS; - public static final Block DARK_OAK_PLANKS = Blocks.DARK_OAK_PLANKS; - public static final Block OAK_SAPLING = Blocks.OAK_SAPLING; - public static final Block SPRUCE_SAPLING = Blocks.SPRUCE_SAPLING; - public static final Block BIRCH_SAPLING = Blocks.BIRCH_SAPLING; - public static final Block JUNGLE_SAPLING = Blocks.JUNGLE_SAPLING; - public static final Block ACACIA_SAPLING = Blocks.ACACIA_SAPLING; - public static final Block DARK_OAK_SAPLING = Blocks.DARK_OAK_SAPLING; - - public static final Block SANDSTONE = Blocks.SANDSTONE; - public static final Block CHISELED_SANDSTONE = Blocks.CHISELED_SANDSTONE; - public static final Block CUT_SANDSTONE = Blocks.CUT_SANDSTONE; - public static final Block NOTE_BLOCK = Blocks.NOTE_BLOCK; - public static final Block POWERED_RAIL = Blocks.POWERED_RAIL; - public static final Block DETECTOR_RAIL = Blocks.DETECTOR_RAIL; - public static final Block PISTON = Blocks.PISTON; - public static final Block STICKY_PISTON = Blocks.STICKY_PISTON; - public static final Block COBWEB = Blocks.COBWEB; - public static final Block GRAVEL = Blocks.GRAVEL; - public static final Block GLASS = Blocks.GLASS; - public static final Block DISPENSER = Blocks.DISPENSER; - - public static final Block COAL_ORE = Blocks.COAL_ORE; - public static final Block IRON_ORE = Blocks.IRON_ORE; - public static final Block COPPER_ORE = Blocks.COPPER_ORE; - public static final Block GOLD_ORE = Blocks.GOLD_ORE; - public static final Block DIAMOND_ORE = Blocks.DIAMOND_ORE; - public static final Block REDSTONE_ORE = Blocks.REDSTONE_ORE; - public static final Block EMERALD_ORE = Blocks.EMERALD_ORE; - public static final Block LAPIS_ORE = Blocks.LAPIS_ORE; - public static final Block NETHER_QUARTZ_ORE = Blocks.NETHER_QUARTZ_ORE; - - public static final Block COAL_BLOCK = Blocks.COAL_BLOCK; - public static final Block IRON_BLOCK = Blocks.IRON_BLOCK; - public static final Block COPPER_BLOCK = Blocks.COPPER_BLOCK; - public static final Block GOLD_BLOCK = Blocks.GOLD_BLOCK; - public static final Block DIAMOND_BLOCK = Blocks.DIAMOND_BLOCK; - public static final Block REDSTONE_BLOCK = Blocks.REDSTONE_BLOCK; - public static final Block EMERALD_BLOCK = Blocks.EMERALD_BLOCK; - public static final Block LAPIS_BLOCK = Blocks.LAPIS_BLOCK; - public static final Block QUARTZ_BLOCK = Blocks.QUARTZ_BLOCK; - - public static final Block TNT = Blocks.TNT; - public static final Block BOOKSHELF = Blocks.BOOKSHELF; - public static final Block OBSIDIAN = Blocks.OBSIDIAN; - public static final Block TORCH = Blocks.TORCH; - public static final Block WALL_TORCH = Blocks.WALL_TORCH; - public static final Block FIRE = Blocks.FIRE; - public static final Block SOUL_FIRE = Blocks.SOUL_FIRE; - public static final Block SPAWNER = Blocks.SPAWNER; - public static final Block OAK_STAIRS = Blocks.OAK_STAIRS; - public static final Block CHEST = Blocks.CHEST; - public static final Block REDSTONE_WIRE = Blocks.REDSTONE_WIRE; - - public static final Block WATER = Blocks.WATER; - public static final Block LAVA = Blocks.LAVA; - public static final Block BEDROCK = Blocks.BEDROCK; - - // ---- - - public static boolean isExist(Block block) { - return block != null && block != Blocks.AIR; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java deleted file mode 100644 index 66fe3f21b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvents; - -import java.util.function.Supplier; - -public class CompatChestBlock extends ChestBlock implements CompatBlockProvider { - public CompatChestBlock(Settings settings, Supplier> supplier) { - super(supplier, CompatSoundEvents.BLOCK_CHEST_OPEN.get(), CompatSoundEvents.BLOCK_CHEST_CLOSE.get(), settings); - } - - public CompatibleBlockSettings compatSettings; - - public CompatChestBlock(CompatibleBlockSettings settings, Supplier> supplier) { - this(settings.build(), supplier); - } - - /** - * @deprecated Use {@link #createBlockEntity(TileCreateEvent)} instead. - */ - @Deprecated - @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return createBlockEntity(new TileCreateEvent(pos, state)); - } - - /** - * @see ExtendBlockEntityProvider#createBlockEntity(TileCreateEvent) - */ - public BlockEntity createBlockEntity(TileCreateEvent event) { - return super.createBlockEntity(event.getBlockPos(), event.getBlockState()); - } - - @Override - public CompatibleBlockSettings getCompatSettings() { - return compatSettings; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java deleted file mode 100644 index d2bf93a5a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.PillarBlock; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.util.math.Direction; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; -import net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs; -import net.pitan76.mcpitanlib.api.state.property.CompatProperties; -import net.pitan76.mcpitanlib.api.state.property.EnumProperty; -import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; - -public class CompatPillarBlock extends PillarBlock implements CompatBlockProvider { - - public static final EnumProperty AXIS = CompatProperties.of(PillarBlock.AXIS); - - public CompatibleBlockSettings settings; - - @Override - public CompatibleBlockSettings getCompatSettings() { - return settings; - } - - public CompatPillarBlock(Settings settings) { - super(settings); - } - - public CompatPillarBlock(CompatibleBlockSettings settings) { - this(settings.build()); - this.settings = settings; - } - - public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); - } - - public BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); - } - - @Deprecated - @Override - public void appendProperties(StateManager.Builder builder) { - appendProperties(new AppendPropertiesArgs(builder)); - } - - @Deprecated - @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return getPlacementState(new PlacementStateArgs(ctx)); - } - - // ExtendBlockProvider - @Deprecated - @Override - public void appendProperties(AppendPropertiesArgs args, Options options) { - CompatBlockProvider.super.appendProperties(args, options); - } - - @Deprecated - @Override - public BlockState getPlacementState(PlacementStateArgs args, Options options) { - return CompatBlockProvider.super.getPlacementState(args, options); - } - - @Deprecated - @Override - public MapCodec getCodec() { - return getCompatCodec().getCodec(); - } - - public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java deleted file mode 100644 index ac7284995..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SlabBlock; -import net.minecraft.block.enums.SlabType; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; -import net.pitan76.mcpitanlib.api.event.block.CanPathfindThroughArgs; -import net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs; -import net.pitan76.mcpitanlib.api.state.property.BooleanProperty; -import net.pitan76.mcpitanlib.api.state.property.CompatProperties; -import net.pitan76.mcpitanlib.api.state.property.EnumProperty; -import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; - -public class CompatSlabBlock extends SlabBlock implements CompatBlockProvider { - - public static final EnumProperty TYPE = CompatProperties.of(SlabBlock.TYPE); - public static final BooleanProperty WATERLOGGED = CompatProperties.of(SlabBlock.WATERLOGGED); - - public CompatibleBlockSettings settings; - - @Override - public CompatibleBlockSettings getCompatSettings() { - return settings; - } - - public CompatSlabBlock(Settings settings) { - super(settings); - } - - public CompatSlabBlock(CompatibleBlockSettings settings) { - this(settings.build()); - } - - public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); - } - - public BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); - } - - @Deprecated - @Override - public void appendProperties(StateManager.Builder builder) { - appendProperties(new AppendPropertiesArgs(builder)); - } - - @Deprecated - @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return getPlacementState(new PlacementStateArgs(ctx)); - } - - // ExtendBlockProvider - @Deprecated - @Override - public void appendProperties(AppendPropertiesArgs args, Options options) { - CompatBlockProvider.super.appendProperties(args, options); - } - - @Deprecated - @Override - public BlockState getPlacementState(PlacementStateArgs args, Options options) { - return CompatBlockProvider.super.getPlacementState(args, options); - } - - @Deprecated - @Override - public MapCodec getCodec() { - return getCompatCodec().getCodec(); - } - - public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); - } - - @Deprecated - @Override - public boolean canPathfindThrough(BlockState state, NavigationType type) { - return canPathfindThrough(new CanPathfindThroughArgs(state, type)); - } - - public boolean canPathfindThrough(CanPathfindThroughArgs args) { - return super.canPathfindThrough(args.state, args.type); - } - - @Override - public Boolean canPathfindThrough(CanPathfindThroughArgs args, Options options) { - return CompatBlockProvider.super.canPathfindThrough(args, options); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java deleted file mode 100644 index 6ad2e57ab..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java +++ /dev/null @@ -1,129 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.block.enums.StairShape; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; -import net.pitan76.mcpitanlib.api.event.block.CanPathfindThroughArgs; -import net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs; -import net.pitan76.mcpitanlib.api.state.property.CompatProperties; -import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; -import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; - -public class CompatStairsBlock extends StairsBlock implements CompatBlockProvider { - - public static final DirectionProperty FACING = CompatProperties.HORIZONTAL_FACING; - public static final EnumProperty HALF = StairsBlock.HALF; - public static final EnumProperty SHAPE = StairsBlock.SHAPE; - public static final BooleanProperty WATERLOGGED = StairsBlock.WATERLOGGED; - - public CompatibleBlockSettings compatSettings; - - /** - * get compatible block settings - * @return CompatibleBlockSettings - */ - @Override - public CompatibleBlockSettings getCompatSettings() { - return compatSettings; - } - - public CompatStairsBlock(BlockState baseBlockState, Settings settings) { - super(baseBlockState, settings); - } - - public CompatStairsBlock(BlockState baseBlockState, CompatibleBlockSettings settings) { - this(baseBlockState, settings.build()); - this.compatSettings = settings; - } - - public VoxelShape getOutlineShape(OutlineShapeEvent event) { - return super.getOutlineShape(event.state, event.world, event.pos, event.context); - } - - public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); - } - - public BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); - } - - @Deprecated - @Override - public void appendProperties(StateManager.Builder builder) { - appendProperties(new AppendPropertiesArgs(builder)); - } - - @Deprecated - @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return getPlacementState(new PlacementStateArgs(ctx)); - } - - @Deprecated - @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); - } - - // ExtendBlockProvider - @Deprecated - @Override - public void appendProperties(AppendPropertiesArgs args, Options options) { - CompatBlockProvider.super.appendProperties(args, options); - } - - @Deprecated - @Override - public BlockState getPlacementState(PlacementStateArgs args, Options options) { - return CompatBlockProvider.super.getPlacementState(args, options); - } - - @Deprecated - @Override - public VoxelShape getOutlineShape(OutlineShapeEvent event, Options options) { - return CompatBlockProvider.super.getOutlineShape(event, options); - } - - @Deprecated - @Override - public MapCodec getCodec() { - return getCompatCodec().getCodec(); - } - - public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); - } - - @Deprecated - @Override - public boolean canPathfindThrough(BlockState state, NavigationType type) { - return canPathfindThrough(new CanPathfindThroughArgs(state, type)); - } - - public boolean canPathfindThrough(CanPathfindThroughArgs args) { - return super.canPathfindThrough(args.state, args.type); - } - - @Override - public Boolean canPathfindThrough(CanPathfindThroughArgs args, Options options) { - return CompatBlockProvider.super.canPathfindThrough(args, options); - } - - public BlockState getBaseBlockState() { - return super.baseBlockState; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java deleted file mode 100644 index 0402b719d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.Waterloggable; -import net.minecraft.sound.SoundEvent; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; - -import java.util.Optional; - -public interface CompatWaterloggable extends Waterloggable { - - @Override - default Optional getBucketFillSound() { - return getCompactBucketFillSound() - .map(CompatSoundEvent::get); - } - - default Optional getCompactBucketFillSound() { - return Waterloggable.super.getBucketFillSound() - .map(CompatSoundEvent::of); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java deleted file mode 100644 index 7a07599bf..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java +++ /dev/null @@ -1,253 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.MapCodec; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.MapColor; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.util.DyeColor; -import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; - -import java.util.function.Function; -import java.util.function.ToIntFunction; - -@Deprecated -public class CompatibleBlockSettings { - public static final Codec CODEC = MapCodec.unitCodec(CompatibleBlockSettings::of); - - protected final AbstractBlock.Settings settings; - - public CompatibleBlockSettings() { - this.settings = AbstractBlock.Settings.create(); - } - - @Deprecated - public static CompatibleBlockSettings of() { - return new CompatibleBlockSettings(); - } - - @Deprecated - private static CompatibleBlockSettings copyCompatibleMaterial(CompatibleMaterial material, CompatibleBlockSettings settings) { - settings.mapColor(material.getColor()); - if (material.isLiquid()) - settings.settings.liquid(); - if (material.isSolid()) - settings.settings.solid(); - if (material.isReplaceable()) - settings.settings.replaceable(); - if (material.isSolid()) - settings.settings.solid(); - if (material.isBurnable()) - settings.settings.burnable(); - settings.settings.pistonBehavior(material.getPistonBehavior()); - return settings; - } - - public CompatibleBlockSettings(CompatibleMaterial material, MapColor mapColor) { - this.settings = AbstractBlock.Settings.create(); - copyCompatibleMaterial(material, this); - mapColor(mapColor); - } - - public CompatibleBlockSettings(CompatibleMaterial material, DyeColor dyeColor) { - this.settings = AbstractBlock.Settings.create(); - copyCompatibleMaterial(material, this); - mapColor(dyeColor); - } - - public CompatibleBlockSettings(CompatibleMaterial material) { - this.settings = AbstractBlock.Settings.create(); - copyCompatibleMaterial(material, this); - } - - public CompatibleBlockSettings(CompatibleMaterial material, Function mapColor) { - this.settings = AbstractBlock.Settings.create(); - copyCompatibleMaterial(material, this); - mapColor(mapColor); - } - - @Deprecated - public static CompatibleBlockSettings of(CompatibleMaterial material, MapColor mapColor) { - return new CompatibleBlockSettings(material, mapColor); - } - - @Deprecated - public static CompatibleBlockSettings of(CompatibleMaterial material, DyeColor dyeColor) { - return new CompatibleBlockSettings(material, dyeColor); - } - - @Deprecated - public static CompatibleBlockSettings of(CompatibleMaterial material) { - return new CompatibleBlockSettings(material); - } - - @Deprecated - public static CompatibleBlockSettings of(CompatibleMaterial material, Function mapColor) { - return new CompatibleBlockSettings(material, mapColor); - } - - public CompatibleBlockSettings(AbstractBlock block) { - this.settings = AbstractBlock.Settings.copy(block); - } - - @Deprecated - public static CompatibleBlockSettings copy(AbstractBlock block) { - return new CompatibleBlockSettings(block); - } - - public CompatibleBlockSettings air() { - settings.air(); - return this; - } - - public CompatibleBlockSettings blockVision(AbstractBlock.ContextPredicate predicate) { - settings.blockVision(predicate); - return this; - } - - public CompatibleBlockSettings postProcess(AbstractBlock.ContextPredicate predicate) { - settings.postProcess(predicate); - return this; - } - - public CompatibleBlockSettings solidBlock(AbstractBlock.ContextPredicate predicate) { - settings.solidBlock(predicate); - return this; - } - - public CompatibleBlockSettings suffocates(AbstractBlock.ContextPredicate predicate) { - settings.suffocates(predicate); - return this; - } - - public CompatibleBlockSettings mapColor(MapColor color) { - settings.mapColor(color); - return this; - } - - public CompatibleBlockSettings mapColor(DyeColor color) { - settings.mapColor(color); - return this; - } - - public CompatibleBlockSettings mapColor(Function color) { - settings.mapColor(color); - return this; - } - - @Deprecated - public CompatibleBlockSettings dropsLike(Block source) { - return this; - } - - public CompatibleBlockSettings breakInstantly() { - settings.breakInstantly(); - return this; - } - - public CompatibleBlockSettings dropsNothing() { - settings.dropsNothing(); - return this; - } - - public CompatibleBlockSettings dynamicBounds() { - settings.dynamicBounds(); - return this; - } - - public CompatibleBlockSettings hardness(float hardness) { - settings.hardness(hardness); - return this; - } - - public CompatibleBlockSettings noBlockBreakParticles() { - settings.noBlockBreakParticles(); - return this; - } - - public CompatibleBlockSettings requiresTool() { - settings.requiresTool(); - return this; - } - - public CompatibleBlockSettings noCollision() { - settings.noCollision(); - return this; - } - - public CompatibleBlockSettings nonOpaque() { - settings.nonOpaque(); - return this; - } - - public CompatibleBlockSettings resistance(float resistance) { - settings.resistance(resistance); - return this; - } - - public CompatibleBlockSettings strength(float strength) { - settings.strength(strength); - return this; - } - - public CompatibleBlockSettings strength(float hardness, float resistance) { - settings.strength(hardness, resistance); - return this; - } - - public CompatibleBlockSettings ticksRandomly() { - settings.ticksRandomly(); - return this; - } - - public CompatibleBlockSettings sounds(BlockSoundGroup blockSoundGroup) { - settings.sounds(blockSoundGroup); - return this; - } - - public CompatibleBlockSettings sounds(CompatBlockSoundGroup blockSoundGroup) { - return sounds(blockSoundGroup.get()); - } - - public CompatibleBlockSettings luminance(ToIntFunction luminance) { - settings.luminance(luminance); - return this; - } - - public CompatibleBlockSettings jumpVelocityMultiplier(float jumpVelocityMultiplier) { - settings.jumpVelocityMultiplier(jumpVelocityMultiplier); - return this; - } - - public CompatibleBlockSettings slipperiness(float slipperiness) { - settings.slipperiness(slipperiness); - return this; - } - - public CompatibleBlockSettings velocityMultiplier(float velocityMultiplier) { - settings.velocityMultiplier(velocityMultiplier); - return this; - } - - public CompatibleBlockSettings emissiveLighting(AbstractBlock.ContextPredicate predicate) { - settings.emissiveLighting(predicate); - return this; - } - - public CompatibleBlockSettings offset(AbstractBlock.OffsetType offsetType) { - settings.offset(offsetType); - return this; - } - - public CompatibleBlockSettings allowsSpawning(AbstractBlock.TypedContextPredicate> predicate) { - settings.allowsSpawning(predicate); - return this; - } - - public AbstractBlock.Settings build() { - return settings; - - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java deleted file mode 100644 index e39962a99..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java +++ /dev/null @@ -1,206 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.MapColor; -import net.minecraft.block.piston.PistonBehavior; - -public final class CompatibleMaterial { - public static final CompatibleMaterial AIR; - public static final CompatibleMaterial STRUCTURE_VOID; - public static final CompatibleMaterial PORTAL; - public static final CompatibleMaterial CARPET; - public static final CompatibleMaterial PLANT; - public static final CompatibleMaterial UNDERWATER_PLANT; - public static final CompatibleMaterial REPLACEABLE_PLANT; - public static final CompatibleMaterial NETHER_SHOOTS; - public static final CompatibleMaterial REPLACEABLE_UNDERWATER_PLANT; - public static final CompatibleMaterial WATER; - public static final CompatibleMaterial BUBBLE_COLUMN; - public static final CompatibleMaterial LAVA; - public static final CompatibleMaterial SNOW_LAYER; - public static final CompatibleMaterial FIRE; - public static final CompatibleMaterial DECORATION; - public static final CompatibleMaterial COBWEB; - public static final CompatibleMaterial SCULK; - public static final CompatibleMaterial REDSTONE_LAMP; - public static final CompatibleMaterial ORGANIC_PRODUCT; - public static final CompatibleMaterial SOIL; - public static final CompatibleMaterial SOLID_ORGANIC; - public static final CompatibleMaterial DENSE_ICE; - public static final CompatibleMaterial AGGREGATE; - public static final CompatibleMaterial SPONGE; - public static final CompatibleMaterial SHULKER_BOX; - public static final CompatibleMaterial WOOD; - public static final CompatibleMaterial NETHER_WOOD; - public static final CompatibleMaterial BAMBOO_SAPLING; - public static final CompatibleMaterial BAMBOO; - public static final CompatibleMaterial WOOL; - public static final CompatibleMaterial TNT; - public static final CompatibleMaterial LEAVES; - public static final CompatibleMaterial GLASS; - public static final CompatibleMaterial ICE; - public static final CompatibleMaterial CACTUS; - public static final CompatibleMaterial STONE; - public static final CompatibleMaterial METAL; - public static final CompatibleMaterial SNOW_BLOCK; - public static final CompatibleMaterial REPAIR_STATION; - public static final CompatibleMaterial BARRIER; - public static final CompatibleMaterial PISTON; - public static final CompatibleMaterial MOSS_BLOCK; - public static final CompatibleMaterial GOURD; - public static final CompatibleMaterial EGG; - public static final CompatibleMaterial CAKE; - public static final CompatibleMaterial AMETHYST; - public static final CompatibleMaterial POWDER_SNOW; - private final MapColor color; - private final PistonBehavior pistonBehavior; - private final boolean burnable; - private final boolean liquid; - private final boolean replaceable; - private final boolean solid; - - public CompatibleMaterial(MapColor color, boolean liquid, boolean solid, boolean burnable, boolean replaceable, PistonBehavior pistonBehavior) { - this.color = color; - this.liquid = liquid; - this.solid = solid; - this.burnable = burnable; - this.replaceable = replaceable; - this.pistonBehavior = pistonBehavior; - } - - public boolean isLiquid() { - return this.liquid; - } - - public boolean isSolid() { - return this.solid; - } - - public boolean isBurnable() { - return this.burnable; - } - - public boolean isReplaceable() { - return this.replaceable; - } - - public PistonBehavior getPistonBehavior() { - return this.pistonBehavior; - } - - public MapColor getColor() { - return this.color; - } - - static { - AIR = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); - STRUCTURE_VOID = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); - PORTAL = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().blocksPistons().build(); - CARPET = (new Builder(MapColor.WHITE_GRAY)).allowsMovement().lightPassesThrough().notSolid().burnable().build(); - PLANT = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); - UNDERWATER_PLANT = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); - REPLACEABLE_PLANT = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().burnable().build(); - NETHER_SHOOTS = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - REPLACEABLE_UNDERWATER_PLANT = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - WATER = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); - BUBBLE_COLUMN = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); - LAVA = (new Builder(MapColor.BRIGHT_RED)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); - SNOW_LAYER = (new Builder(MapColor.WHITE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - FIRE = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - DECORATION = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); - COBWEB = (new Builder(MapColor.WHITE_GRAY)).allowsMovement().lightPassesThrough().destroyedByPiston().build(); - SCULK = (new Builder(MapColor.BLACK)).build(); - REDSTONE_LAMP = (new Builder(MapColor.CLEAR)).build(); - ORGANIC_PRODUCT = (new Builder(MapColor.LIGHT_BLUE_GRAY)).build(); - SOIL = (new Builder(MapColor.DIRT_BROWN)).build(); - SOLID_ORGANIC = (new Builder(MapColor.PALE_GREEN)).build(); - DENSE_ICE = (new Builder(MapColor.PALE_PURPLE)).build(); - AGGREGATE = (new Builder(MapColor.PALE_YELLOW)).build(); - SPONGE = (new Builder(MapColor.YELLOW)).build(); - SHULKER_BOX = (new Builder(MapColor.PURPLE)).build(); - WOOD = (new Builder(MapColor.OAK_TAN)).burnable().build(); - NETHER_WOOD = (new Builder(MapColor.OAK_TAN)).build(); - BAMBOO_SAPLING = (new Builder(MapColor.OAK_TAN)).burnable().destroyedByPiston().allowsMovement().build(); - BAMBOO = (new Builder(MapColor.OAK_TAN)).burnable().destroyedByPiston().build(); - WOOL = (new Builder(MapColor.WHITE_GRAY)).burnable().build(); - TNT = (new Builder(MapColor.BRIGHT_RED)).burnable().lightPassesThrough().build(); - LEAVES = (new Builder(MapColor.DARK_GREEN)).burnable().lightPassesThrough().destroyedByPiston().build(); - GLASS = (new Builder(MapColor.CLEAR)).lightPassesThrough().build(); - ICE = (new Builder(MapColor.PALE_PURPLE)).lightPassesThrough().build(); - CACTUS = (new Builder(MapColor.DARK_GREEN)).lightPassesThrough().destroyedByPiston().build(); - STONE = (new Builder(MapColor.STONE_GRAY)).build(); - METAL = (new Builder(MapColor.IRON_GRAY)).build(); - SNOW_BLOCK = (new Builder(MapColor.WHITE)).build(); - REPAIR_STATION = (new Builder(MapColor.IRON_GRAY)).blocksPistons().build(); - BARRIER = (new Builder(MapColor.CLEAR)).blocksPistons().build(); - PISTON = (new Builder(MapColor.STONE_GRAY)).blocksPistons().build(); - MOSS_BLOCK = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); - GOURD = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); - EGG = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); - CAKE = (new Builder(MapColor.CLEAR)).destroyedByPiston().build(); - AMETHYST = (new Builder(MapColor.PURPLE)).build(); - POWDER_SNOW = (new Builder(MapColor.WHITE)).notSolid().allowsMovement().build(); - } - - public static class Builder { - private PistonBehavior pistonBehavior; - private boolean blocksMovement; - private boolean burnable; - private boolean liquid; - private boolean replaceable; - private boolean solid; - private final MapColor color; - private boolean blocksLight; - - public Builder(MapColor color) { - this.pistonBehavior = PistonBehavior.NORMAL; - this.blocksMovement = true; - this.solid = true; - this.blocksLight = true; - this.color = color; - } - - public Builder liquid() { - this.liquid = true; - return this; - } - - public Builder notSolid() { - this.solid = false; - return this; - } - - public Builder allowsMovement() { - this.blocksMovement = false; - return this; - } - - Builder lightPassesThrough() { - this.blocksLight = false; - return this; - } - - protected Builder burnable() { - this.burnable = true; - return this; - } - - public Builder replaceable() { - this.replaceable = true; - return this; - } - - protected Builder destroyedByPiston() { - this.pistonBehavior = PistonBehavior.DESTROY; - return this; - } - - protected Builder blocksPistons() { - this.pistonBehavior = PistonBehavior.BLOCK; - return this; - } - - public CompatibleMaterial build() { - return new CompatibleMaterial(this.color, this.liquid, this.solid, this.burnable, this.replaceable, this.pistonBehavior); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java deleted file mode 100644 index 89e9d54aa..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java +++ /dev/null @@ -1,369 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.SimpleNamedScreenHandlerFactory; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.block.WireOrientation; -import net.minecraft.world.tick.ScheduledTickView; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.block.*; -import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; -import net.pitan76.mcpitanlib.api.event.block.StateForNeighborUpdateArgs; -import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -public class ExtendBlock extends Block { - public CompatibleBlockSettings compatSettings; - - public ExtendBlock(Settings settings) { - super(settings); - } - - public ExtendBlock(CompatibleBlockSettings settings) { - super(settings.build()); - this.compatSettings = settings; - } - - /** - * get compatible block settings - * @return CompatibleBlockSettings - */ - public CompatibleBlockSettings getCompatSettings() { - return compatSettings; - } - - /** - * get collision voxel shape - * @param event CollisionShapeEvent - * @return VoxelShape - */ - public VoxelShape getCollisionShape(CollisionShapeEvent event) { - return super.getCollisionShape(event.state, event.world, event.pos, event.context); - } - - @Deprecated - @Override - public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); - } - - /** - * get outline voxel shape - * @param event OutlineShapeEvent - * @return VoxelShape - */ - public VoxelShape getOutlineShape(OutlineShapeEvent event) { - return super.getOutlineShape(event.state, event.world, event.pos, event.context); - } - - @Deprecated - @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); - } - - /** - * block scheduled tick event - * @param event BlockScheduledTickEvent - */ - public void scheduledTick(BlockScheduledTickEvent event) { - super.scheduledTick(event.state, event.world, event.pos, event.random.getMcRandom()); - } - - @Override - @Deprecated - public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - scheduledTick(new BlockScheduledTickEvent(state, world, pos, random)); - } - - @Override - @Deprecated - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - return onRightClick(new BlockUseEvent(state, world, pos, player, player.getActiveHand(), hit)).toActionResult(); - } - - /** - * block right click event - * @param event ActionResultType - * @return BlockUseEvent - */ - public CompatActionResult onRightClick(BlockUseEvent event) { - return CompatActionResult.create(super.onUse(event.state, event.world, event.pos, event.player.getPlayerEntity(), event.hit)); - } - - @Deprecated - @Nullable - @Override - public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) { - return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> - createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player)), getScreenTitle() - ); - } - - /** - * screen handler create event - * @param event ScreenHandlerCreateEvent - * @return ScreenHandler - */ - @Nullable - public ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event) { - return null; - } - - /** - * get screen title - * @return Text - */ - @Nullable - public Text getScreenTitle() { - return TextUtil.literal(""); - } - - @Override - @Deprecated - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - onPlaced(new BlockPlacedEvent(world, pos, state, placer, itemStack)); - } - - /** - * block placed event - * @param event BlockPlacedEvent - */ - public void onPlaced(BlockPlacedEvent event) { - super.onPlaced(event.world, event.pos, event.state, event.placer, event.stack); - } - - @Override - @Deprecated - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { - return onBreak(new BlockBreakEvent(world, pos, state, player)).state; - } - - /** - * block break event - * @param event BlockBreakEvent - * @return BlockBreakResult - */ - public BlockBreakResult onBreak(BlockBreakEvent event) { - BlockState state = super.onBreak(event.world, event.pos, event.state, event.getPlayerEntity()); - return new BlockBreakResult(state); - } - - @Override - @Deprecated - public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { - PickStackEvent event = new PickStackEvent(world, pos, state); - event.setIncludeData(includeData); - return getPickStack(event); - } - - /** - * block pick stack event - * @param event PickStackEvent - * @return ItemStack - */ - public ItemStack getPickStack(PickStackEvent event) { - return super.getPickStack(event.worldView, event.pos, event.state, event.includeData); - } - - @Override - @Deprecated - public void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved) { - onStateReplaced(new StateReplacedEvent(state, world, pos, world.getBlockState(pos), moved)); - } - - /** - * block state replaced event - * @param event StateReplacedEvent - */ - public void onStateReplaced(StateReplacedEvent event) { - super.onStateReplaced(event.state, (ServerWorld) event.world, event.pos, event.moved); - } - - @Deprecated - @Override - public List getDroppedStacks(BlockState state, LootWorldContext.Builder builder) { - return getDroppedStacks(new DroppedStacksArgs(state, builder)); - } - - /** - * block dropped stacks event - * @param args DroppedStacksArgs - * @return List - */ - public List getDroppedStacks(DroppedStacksArgs args) { - return super.getDroppedStacks(args.state, args.builder); - } - - @Deprecated - @Override - public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, WireOrientation wireOrientation, boolean notify) { - neighborUpdate(new NeighborUpdateEvent(state, world, pos, sourceBlock, wireOrientation, notify)); - } - - /** - * block neighbor update event - * @param event NeighborUpdateEvent - */ - public void neighborUpdate(NeighborUpdateEvent event) { - super.neighborUpdate(event.state, event.world, event.pos, event.sourceBlock, event.wireOrientation, event.notify); - } - - @Deprecated - @Override - public void appendProperties(StateManager.Builder builder) { - appendProperties(new AppendPropertiesArgs(builder)); - } - - /** - * append properties event - * @param args AppendPropertiesArgs - */ - public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); - } - - /** - * Compatible for getDefaultState() - * @return default block state - */ - public BlockState getNewDefaultState() { - return super.getDefaultState(); - } - - /** - * Compatible for setDefaultState() - * @param state BlockState - */ - public void setNewDefaultState(BlockState state) { - super.setDefaultState(state); - } - - @Deprecated - @Override - public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getPlacementState(new PlacementStateArgs(ctx, this)); - } - - /** - * get placement state - * @param args PlacementStateArgs - * @return BlockState - */ - public @Nullable BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); - } - - /** - * append tooltip to item - * @param event ItemAppendTooltipEvent - */ - public void appendTooltip(ItemAppendTooltipEvent event) { - - } - - @Deprecated - @Override - public boolean canPathfindThrough(BlockState state, NavigationType type) { - return canPathfindThrough(new CanPathfindThroughArgs(state, type)); - } - - public boolean canPathfindThrough(CanPathfindThroughArgs args) { - return super.canPathfindThrough(args.state, args.type); - } - - @Deprecated - @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler, boolean bl) { - onEntityCollision(new EntityCollisionEvent(state, world, pos, entity, handler, bl)); - } - - public void onEntityCollision(EntityCollisionEvent e) { - super.onEntityCollision(e.state, e.world, e.pos, e.entity, e.handler, e.bl); - } - - @Deprecated - @Override - public void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) { - onBlockBreakStart(new BlockBreakStartEvent(state, world, pos, new Player(player))); - } - - public void onBlockBreakStart(BlockBreakStartEvent e) { - super.onBlockBreakStart(e.state, e.world, e.pos, e.player.getPlayerEntity()); - } - - @Deprecated - @Override - protected MapCodec getCodec() { - return getCompatCodec().getCodec(); - } - - public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); - } - - @Deprecated - @Override - protected FluidState getFluidState(BlockState state) { - return getFluidState(new FluidStateArgs(state)); - } - - public FluidState getFluidState(FluidStateArgs args) { - return super.getFluidState(args.getState()); - } - - @Deprecated - @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random))); - } - - public BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { - return super.getStateForNeighborUpdate(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom()); - } - -// @Deprecated -// @Override -// protected ImmutableMap getShapesForStates(Function stateToShape) { -// return getShapesForStates(new ShapesForStatesArgs(stateToShape)); -// } -// -// public ImmutableMap getShapesForStates(ShapesForStatesArgs args) { -// return super.(args.stateToShape); -// } - - public StateManager callGetStateManager() { - return super.getStateManager(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java deleted file mode 100644 index 2b9481a95..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.BlockEntityProvider; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.tile.ExtendBlockEntityTicker; -import org.jetbrains.annotations.Nullable; - -public interface ExtendBlockEntityProvider extends BlockEntityProvider { - - /** - * @deprecated Use {@link #createBlockEntity(TileCreateEvent)} instead. - */ - @Deprecated - @Nullable - default BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return createBlockEntity(new TileCreateEvent(pos, state)); - } - - /** - * create instance of BlockEntity - * @param event TileCreateEvent - * @return BlockEntity - * - *
{@code
-     * public BlockEntity createBlockEntity(TileCreateEvent e) {
-     *    return new ExampleBlockEntity(e); // ExampleBlockEntity extends CompatBlockEntity
-     * }
- */ - @Nullable - default BlockEntity createBlockEntity(TileCreateEvent event) { - if (getBlockEntityType() == null) return null; - - // return new ...BlockEntity(pos, state) - return getBlockEntityType().instantiate(event.getBlockPos(), event.getBlockState()); - } - - @Nullable - default BlockEntityType getBlockEntityType() { - return null; - } - - @Nullable - @Override - default BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (isTick()) { - return ((world1, pos, state1, blockEntity) -> { - if (getBlockEntityType() == null || blockEntity == getBlockEntityType().get(world, pos)) { - if (blockEntity instanceof ExtendBlockEntityTicker) { - ExtendBlockEntityTicker ticker = (ExtendBlockEntityTicker) blockEntity; - ticker.tick(world, pos, state, blockEntity); - } else if (blockEntity instanceof BlockEntityTicker) { - BlockEntityTicker ticker = (BlockEntityTicker) blockEntity; - ticker.tick(world, pos, state, blockEntity); - } - } - }); - } - return BlockEntityProvider.super.getTicker(world, state, type); - } - - @Nullable - default ExtendBlockEntityTicker getCompatibleTicker(World world, BlockState state, BlockEntityType type) { - BlockEntityTicker ticker = getTicker(world, state, type); - if (ticker instanceof ExtendBlockEntityTicker) - return (ExtendBlockEntityTicker) ticker; - - return null; - } - - default boolean isTick() { - return false; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java deleted file mode 100644 index 996661e2f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.pitan76.mcpitanlib.api.block; - -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.shape.VoxelShape; -import net.pitan76.mcpitanlib.api.event.block.*; -import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; -import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -import java.util.List; - -public interface ExtendBlockProvider { - - /** - * get collision voxel shape - * @param event CollisionShapeEvent - * @param options Options - * @return VoxelShape - */ - default VoxelShape getCollisionShape(CollisionShapeEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * get outline voxel shape - * @param event OutlineShapeEvent - * @param options Options - * @return VoxelShape - */ - default VoxelShape getOutlineShape(OutlineShapeEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * block scheduled tick event - * @param event BlockScheduledTickEvent - * @param options Options - */ - default void scheduledTick(BlockScheduledTickEvent event, Options options) { - options.cancel = false; - } - - /** - * block right click event - * @param event BlockUseEvent - * @param options Options - * @return ActionResult - */ - default CompatActionResult onRightClick(BlockUseEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * screen handler create event - * @param event ScreenHandlerCreateEvent - * @param options Options - * @return ScreenHandler - */ - default ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * get screen title - * @return Text - */ - default Text getScreenTitle() { - return TextUtil.literal(""); - } - - /** - * block placed event - * @param event BlockPlacedEvent - * @param options Options - */ - default void onPlaced(BlockPlacedEvent event, Options options) { - options.cancel = false; - } - - /** - * block break event - * @param event BlockBreakEvent - * @param options Options - * @return BlockBreakResult - */ - default BlockBreakResult onBreak(BlockBreakEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * block state replaced event - * @param event StateReplacedEvent - * @param options Options - */ - default void onStateReplaced(StateReplacedEvent event, Options options) { - options.cancel = false; - } - - /** - * get pick stack - * @param event PickStackEvent - * @param options Options - * @return ItemStack - */ - default ItemStack getPickStack(PickStackEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * get placement state - * @param args PlacementStateArgs - * @param options Options - */ - default BlockState getPlacementState(PlacementStateArgs args, Options options) { - options.cancel = false; - return null; - } - - /** - * append properties - * @param args AppendPropertiesArgs - * @param options Options - */ - default void appendProperties(AppendPropertiesArgs args, Options options) { - options.cancel = false; - } - - /** - * get dropped stacks - * @param args DroppedStacksArgs - * @param options Options - * @return List - */ - default List getDroppedStacks(DroppedStacksArgs args, Options options) { - options.cancel = false; - return null; - } - - default void appendTooltip(ItemAppendTooltipEvent event, Options options) { - options.cancel = false; - } - - default Boolean canPathfindThrough(CanPathfindThroughArgs args, Options options) { - options.cancel = false; - return null; - } - - public static class Options { - public boolean cancel = true; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java deleted file mode 100644 index 645b17745..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args; - -import net.minecraft.block.BlockState; -import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; - -public class RenderTypeArgs implements BlockStatePropertyHolder { - public BlockState state; - - public RenderTypeArgs(BlockState state) { - this.state = state; - } - - public BlockState getRawBlockState() { - return state; - } - - @Override - public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getRawBlockState()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java deleted file mode 100644 index 0b4e6339e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args; - -import net.minecraft.block.BlockState; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.Direction; -import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; - -public class RotateArgs implements BlockStatePropertyHolder { - - public BlockState state; - public BlockRotation rotation; - - public RotateArgs(BlockState state, BlockRotation rotation) { - this.state = state; - this.rotation = rotation; - } - - public BlockState getRawBlockState() { - return state; - } - - public BlockRotation getRawRotation() { - return rotation; - } - - @Override - public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public Direction rotate(Direction direction) { - return rotation.rotate(direction); - } - - public net.pitan76.mcpitanlib.midohra.util.math.Direction rotate(net.pitan76.mcpitanlib.midohra.util.math.Direction direction) { - return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(rotation.rotate(direction.toMinecraft())); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java deleted file mode 100644 index 503136183..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.Direction; - -public class SideInvisibleArgs { - public BlockState state; - public BlockState stateFrom; - public Direction direction; - - public SideInvisibleArgs(BlockState state, BlockState stateFrom, Direction direction) { - this.state = state; - this.stateFrom = stateFrom; - this.direction = direction; - } - - public SideInvisibleArgs(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.block.BlockState stateFrom, net.pitan76.mcpitanlib.midohra.util.math.Direction direction) { - this.state = state.toMinecraft(); - this.stateFrom = stateFrom.toMinecraft(); - this.direction = direction.toMinecraft(); - } - - public BlockState getState() { - return state; - } - - public BlockState getStateFrom() { - return stateFrom; - } - - public Direction getDirection() { - return direction; - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getState()); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraStateFrom() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getStateFrom()); - } - - public net.pitan76.mcpitanlib.midohra.util.math.Direction getMidohraDirection() { - return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(getDirection()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java deleted file mode 100644 index c111c0aa3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args.v2; - -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.WorldView; - -public class CanPlaceAtArgs extends BaseEvent { - public final net.minecraft.block.BlockState state; - public final net.minecraft.world.WorldView world; - public final net.minecraft.util.math.BlockPos pos; - - public CanPlaceAtArgs(net.minecraft.block.BlockState state, net.minecraft.world.WorldView world, net.minecraft.util.math.BlockPos pos) { - this.state = state; - this.world = world; - this.pos = pos; - } - - public CanPlaceAtArgs(BlockState state, WorldView world, BlockPos pos) { - this(state.toMinecraft(), world.toMinecraft(), pos.toMinecraft()); - } - - public net.minecraft.block.BlockState getState() { - return state; - } - - public net.minecraft.world.WorldView getWorld() { - return world; - } - - public net.minecraft.util.math.BlockPos getPos() { - return pos; - } - - public BlockState getMidohraState() { - return BlockState.of(state); - } - - public WorldView getMidohraWorld() { - return WorldView.of(world); - } - - public BlockPos getMidohraPos() { - return BlockPos.of(pos); - } - - public boolean isClient() { - return world.isClient(); - } - - public boolean isServer() { - return !world.isClient(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java deleted file mode 100644 index a5544b4db..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args.v2; - -import net.minecraft.block.ShapeContext; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.BlockView; - -public class CollisionShapeEvent extends OutlineShapeEvent { - - public CollisionShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - super(state, world, pos, context); - } - - public CollisionShapeEvent(net.minecraft.block.BlockState state, net.minecraft.world.BlockView world, net.minecraft.util.math.BlockPos pos, ShapeContext context) { - super(BlockState.of(state), BlockView.of(world), BlockPos.of(pos), context); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java deleted file mode 100644 index 07aad3fef..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args.v2; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.api.util.screen.ScreenHandlerUtil; - -public class GetComparatorOutputArgs extends BaseEvent { - public BlockState state; - public World world; - public BlockPos pos; - public Direction direction; - - public GetComparatorOutputArgs(BlockState state, World world, BlockPos pos) { - this(state, world, pos, Direction.NORTH); - } - - public GetComparatorOutputArgs(BlockState state, World world, BlockPos pos, Direction direction) { - this.state = state; - this.world = world; - this.pos = pos; - this.direction = direction; - } - - public BlockState getState() { - return state; - } - - public World getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(world, pos); - } - - public int calcComparatorOutputFromBlockEntity() { - return ScreenHandlerUtil.calcComparatorOutput(getBlockEntity()); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java deleted file mode 100644 index 2fe77f18a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args.v2; - -import net.minecraft.block.BlockState; -import net.pitan76.mcpitanlib.api.event.BaseEvent; - -public class HasComparatorOutputArgs extends BaseEvent { - public BlockState state; - - public HasComparatorOutputArgs(BlockState state) { - this.state = state; - } - - public BlockState getState() { - return state; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java deleted file mode 100644 index 225949458..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args.v2; - -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.BlockView; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class OutlineShapeEvent extends BaseEvent implements BlockStatePropertyHolder { - public BlockState state; - public BlockView world; - public BlockPos pos; - public ShapeContext context; - - public OutlineShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - this.state = state; - this.world = world; - this.pos = pos; - this.context = context; - } - - public OutlineShapeEvent(net.minecraft.block.BlockState state, net.minecraft.world.BlockView world, net.minecraft.util.math.BlockPos pos, net.minecraft.block.ShapeContext context) { - this(BlockState.of(state), BlockView.of(world), BlockPos.of(pos), context); - } - - @Override - public BlockState getBlockState() { - return state; - } - - public BlockEntityWrapper getBlockEntity() { - return world.getBlockEntity(pos); - } - - public BlockEntity getRawBlockEntity() { - return getBlockEntity().get(); - } - - public IWorldView getWorldView() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public ShapeContext getContext() { - return context; - } - - public boolean isHolding(Item item) { - return getContext().isHolding(item); - } - - public boolean isHolding(ItemWrapper item) { - return isHolding(item.get()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java deleted file mode 100644 index ebc3d207b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java +++ /dev/null @@ -1,175 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args.v2; - -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.property.Property; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; -import net.pitan76.mcpitanlib.api.util.BlockStateUtil; -import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; -import net.pitan76.mcpitanlib.midohra.util.math.Direction; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; -import net.pitan76.mcpitanlib.midohra.world.World; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; -import org.jetbrains.annotations.Nullable; - -public class PlacementStateArgs extends BaseEvent implements BlockStatePropertyHolder { - public ItemPlacementContext ctx; - - @Nullable - public Block block; - - public PlacementStateArgs(ItemPlacementContext ctx) { - this.ctx = ctx; - } - - public PlacementStateArgs(ItemPlacementContext ctx, @Nullable Block block) { - this.ctx = ctx; - this.block = block; - } - - public boolean canPlace() { - return ctx.canPlace(); - } - - public BlockPos getRawPos() { - return ctx.getBlockPos(); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getRawPos()); - } - - public Player getPlayer() { - return new Player(ctx.getPlayer()); - } - - public Direction[] getPlacementDirections() { - net.minecraft.util.math.Direction[] rawDirs = getRawPlacementDirections(); - Direction[] directions = new Direction[rawDirs.length]; - for (int i = 0; i < directions.length; i++) { - directions[i] = Direction.of(rawDirs[i]); - } - - return directions; - } - - public net.minecraft.util.math.Direction[] getRawPlacementDirections() { - return ctx.getPlacementDirections(); - } - - public Hand getHand() { - return ctx.getHand(); - } - - public Direction getSide() { - return Direction.of(getRawSide()); - } - - public net.minecraft.util.math.Direction getRawSide() { - return ctx.getSide(); - } - - public Direction getHorizontalPlayerFacing() { - return Direction.of(getRawHorizontalPlayerFacing()); - } - - public net.minecraft.util.math.Direction getRawHorizontalPlayerFacing() { - return ctx.getHorizontalPlayerFacing(); - } - - public float getPlayerYaw() { - return ctx.getPlayerYaw(); - } - - public World getWorld() { - return World.of(ctx.getWorld()); - } - - public IWorldView getWorldView() { - return getWorld(); - } - - public boolean isClient() { - return getWorld().isClient(); - } - - public Vec3d getHitPos() { - return ctx.getHitPos(); - } - - public boolean canReplaceExisting() { - return ctx.canReplaceExisting(); - } - - @Deprecated - public ItemUsageContextMixin getIUCAccessor() { - return (ItemUsageContextMixin) ctx; - } - - public BlockHitResult getHitResult() { - return getIUCAccessor().getHit(); - } - - public ItemUseOnBlockEvent toItemUseOnBlockEvent() { - return new ItemUseOnBlockEvent(getWorld().getRaw(), getPlayer().getPlayerEntity(), getHand(), ctx.getStack(), getHitResult()); - } - - public ItemPlacementContext getCtx() { - return ctx; - } - - public @Nullable Block getRawBlock() { - return block; - } - - public boolean isBlockExist() { - return block != null; - } - - public net.minecraft.block.BlockState getRawBlockState() { - return BlockStateUtil.getDefaultState(block); - } - - public BlockEntity getRawBlockEntity() { - return getWorld().getBlockEntity(getRawPos()); - } - - public BlockWrapper getBlock() { - return BlockWrapper.of(block); - } - - public , V extends T> net.minecraft.block.BlockState with(Property property, V value) { - if (block == null) - return null; - - return BlockStateUtil.with(BlockStateUtil.getDefaultState(block), property, value); - } - - @Override - public BlockState getBlockState() { - return BlockState.of(getRawBlockState()); - } - - public BlockEntityWrapper getBlockEntity() { - return getWorld().getBlockEntity(getPos()); - } - - public net.pitan76.mcpitanlib.midohra.util.hit.BlockHitResult getHitResultM() { - return net.pitan76.mcpitanlib.midohra.util.hit.BlockHitResult.of(getHitResult()); - } - - public HitResultType getHitResultTypeM() { - return HitResultType.from(getHitResult().getType()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java deleted file mode 100644 index 1c4972fe8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java +++ /dev/null @@ -1,109 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.args.v2; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class StateForNeighborUpdateArgs implements BlockStatePropertyHolder { - public BlockState state; - public Direction direction; - public BlockState neighborState; - public WorldView world; - public BlockPos pos; - public BlockPos neighborPos; - public ScheduledTickView tickView; - public CompatRandom random; - - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { - this.state = state; - this.direction = direction; - this.neighborState = neighborState; - this.world = world; - this.pos = pos; - this.neighborPos = neighborPos; - } - - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldView world, BlockPos pos, BlockPos neighborPos, ScheduledTickView tickView, CompatRandom random) { - this.state = state; - this.direction = direction; - this.neighborState = neighborState; - this.world = world; - this.pos = pos; - this.neighborPos = neighborPos; - this.tickView = tickView; - this.random = random; - } - - public Direction getDirection() { - return direction; - } - - public BlockState getRawNeighborState() { - return neighborState; - } - - public WorldView getRawWorld() { - return world; - } - - public BlockPos getRawPos() { - return pos; - } - - public BlockPos getRawNeighborPos() { - return neighborPos; - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getNeighborState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getRawNeighborState()); - } - - public net.pitan76.mcpitanlib.midohra.world.WorldView getWorld() { - return net.pitan76.mcpitanlib.midohra.world.WorldView.of(getRawWorld()); - } - - public IWorldView getWorldView() { - return getWorld(); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getRawPos()); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getNeighborPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getRawNeighborPos()); - } - - public CompatRandom getRandom() { - return random; - } - - public net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView getTickView() { - return net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView.of(tickView); - } - - @Override - public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public BlockEntityWrapper getBlockEntity() { - return getWorld().getBlockEntity(getPos()); - } - - public BlockEntity getRawBlockEntity() { - return world.getBlockEntity(pos); - } - - public boolean isClient() { - return world.isClient(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java deleted file mode 100644 index 95b2afca6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java +++ /dev/null @@ -1,170 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.v2; - -import net.minecraft.block.AbstractBlock; -import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; -import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.color.CompatDyeColor; -import net.pitan76.mcpitanlib.api.util.color.CompatMapColor; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; - -import java.util.function.ToIntFunction; - -public class BlockSettingsBuilder { - - public CompatIdentifier id; - public float hardness = -1; - public float resistance = -1; - public CompatBlockSoundGroup blockSoundGroup; - public CompatibleMaterial material; - public CompatMapColor mapColor; - public CompatDyeColor dyeColor; - public boolean requiresTool; - public boolean dropsNothing; - public ToIntFunction luminance; - - protected BlockWrapper copyFromBlock = null; - - public BlockSettingsBuilder(CompatIdentifier id) { - this.id = id; - } - - public BlockSettingsBuilder() { - - } - - public BlockSettingsBuilder hardness(float hardness) { - this.hardness = hardness; - return this; - } - - public BlockSettingsBuilder resistance(float resistance) { - this.resistance = resistance; - return this; - } - - public BlockSettingsBuilder strength(float hardness, float resistance) { - this.hardness = hardness; - this.resistance = resistance; - return this; - } - - public BlockSettingsBuilder sounds(CompatBlockSoundGroup blockSoundGroup) { - this.blockSoundGroup = blockSoundGroup; - return this; - } - - public BlockSettingsBuilder material(CompatibleMaterial material) { - this.material = material; - return this; - } - - public BlockSettingsBuilder mapColor(CompatMapColor mapColor) { - this.mapColor = mapColor; - return this; - } - - public BlockSettingsBuilder dyeColor(CompatDyeColor dyeColor) { - this.dyeColor = dyeColor; - return this; - } - - public BlockSettingsBuilder requiresTool() { - this.requiresTool = true; - return this; - } - - public BlockSettingsBuilder dropsNothing() { - this.dropsNothing = true; - return this; - } - - public BlockSettingsBuilder luminance(ToIntFunction luminance) { - this.luminance = luminance; - return this; - } - - public CompatibleBlockSettings build() { - return build(id); - } - - public AbstractBlock.Settings _build() { - return build().build(); - } - - public CompatibleBlockSettings build(CompatIdentifier id) { - CompatibleBlockSettings settings; - - if (copyFromBlock != null) { - settings = CompatibleBlockSettings.copy(id, copyFromBlock.get()); - } else { - settings = CompatibleBlockSettings.of(id); - } - - if (material != null) - settings = CompatibleBlockSettings.of(id, material); - - if (mapColor != null) { - settings = settings.mapColor(mapColor.getColor()); - } else if (dyeColor != null) { - settings = settings.mapColor(dyeColor.getColor().getMapColor()); - } - - if (requiresTool) settings.requiresTool(); - if (dropsNothing) settings.dropsNothing(); - if (luminance != null) settings.luminance((state) -> luminance.applyAsInt(BlockState.of(state))); - - if (hardness != -1 && resistance != -1) settings.strength(hardness, resistance); - else if (hardness != -1) settings.strength(hardness); - - if (blockSoundGroup != null) settings.sounds(blockSoundGroup); - - return settings; - } - - public AbstractBlock.Settings _build(CompatIdentifier id) { - return build(id).build(); - } - - public BlockSettingsBuilder copy(CompatIdentifier id) { - BlockSettingsBuilder builder = new BlockSettingsBuilder(); - - builder.copyFromBlock = this.copyFromBlock; - - builder.id = id; - builder.hardness = this.hardness; - builder.resistance = this.resistance; - builder.blockSoundGroup = this.blockSoundGroup; - builder.material = this.material; - builder.mapColor = this.mapColor; - builder.dyeColor = this.dyeColor; - builder.requiresTool = this.requiresTool; - builder.dropsNothing = this.dropsNothing; - builder.luminance = this.luminance; - return builder; - } - - public BlockSettingsBuilder copy() { - return copy(this.id); - } - - public static BlockSettingsBuilder of(CompatIdentifier id) { - return new BlockSettingsBuilder(id); - } - - public static BlockSettingsBuilder of() { - return new BlockSettingsBuilder(); - } - - public static BlockSettingsBuilder copyBlock(BlockWrapper block) { - BlockSettingsBuilder builder = new BlockSettingsBuilder(block.getId()); - builder.copyFromBlock = block; - - return builder; - } - - public static BlockSettingsBuilder copyBlock(CompatIdentifier id) { - return copyBlock(BlockWrapper.of(id)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java deleted file mode 100644 index 3b4b160a1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java +++ /dev/null @@ -1,179 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.v2; - -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; -import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; -import net.pitan76.mcpitanlib.api.block.args.RotateArgs; -import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.*; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import org.jetbrains.annotations.Nullable; - -public class CompatBlock extends ExtendBlock { - - public CompatibleBlockSettings settings; - - public CompatBlock(CompatibleBlockSettings settings) { - super(settings); - this.settings = settings; - } - - public CompatibleBlockSettings getCompatSettings() { - return settings; - } - - public BlockWrapper getWrapper() { - return BlockWrapper.of(this); - } - - @Override - @Deprecated - protected BlockRenderType getRenderType(BlockState state) { - return getRenderType(new RenderTypeArgs(state)).renderType; - } - - public CompatBlockRenderType getRenderType(RenderTypeArgs args) { - return new CompatBlockRenderType(super.getRenderType(args.state)); - } - - @Override - @Deprecated - protected BlockState rotate(BlockState state, BlockRotation rotation) { - return rotate(new RotateArgs(state, rotation)).toMinecraft(); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState rotate(RotateArgs args) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.rotate(args.state, args.rotation)); - } - - @Override - @Deprecated - protected boolean isSideInvisible(BlockState state, BlockState stateFrom, Direction direction) { - return isSideInvisible(new SideInvisibleArgs(state, stateFrom, direction)); - } - - public boolean isSideInvisible(SideInvisibleArgs args) { - return super.isSideInvisible(args.state, args.stateFrom, args.direction); - } - - /** - * Compatible for getDefaultState() - * @return default block state - */ - public net.pitan76.mcpitanlib.midohra.block.BlockState getDefaultMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getNewDefaultState()); - } - - /** - * Compatible for setDefaultState() - * @param state BlockState - */ - public void setDefaultState(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - setNewDefaultState(state.toMinecraft()); - } - - public @Nullable net.pitan76.mcpitanlib.midohra.block.BlockState getPlacementState(PlacementStateArgs args) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.getPlacementState(args.ctx)); - } - - @Override - public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { - return getPlacementState(new PlacementStateArgs(ctx)).toMinecraft(); - } - - @Deprecated - @Override - public @Nullable BlockState getPlacementState(net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs args) { - return super.getPlacementState(args); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.getStateForNeighborUpdate(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom())); - } - - @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random))).toMinecraft(); - } - - @Deprecated - @Override - public BlockState getStateForNeighborUpdate(net.pitan76.mcpitanlib.api.event.block.StateForNeighborUpdateArgs args) { - return super.getStateForNeighborUpdate((args)); - } - - public VoxelShape getOutlineShape(OutlineShapeEvent e) { - return super.getOutlineShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); - } - - @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); - } - - @Deprecated - @Override - public VoxelShape getOutlineShape(net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent e) { - return super.getOutlineShape(e); - } - - public VoxelShape getCollisionShape(CollisionShapeEvent e) { - return super.getCollisionShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); - } - - @Deprecated - @Override - public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); - } - - @Deprecated - @Override - public VoxelShape getCollisionShape(net.pitan76.mcpitanlib.api.event.block.CollisionShapeEvent e) { - return super.getCollisionShape(e); - } - - @Deprecated - @Override - public boolean hasComparatorOutput(BlockState state) { - return hasComparatorOutput(new HasComparatorOutputArgs(state)); - } - - public boolean hasComparatorOutput(HasComparatorOutputArgs args) { - return super.hasComparatorOutput(args.state); - } - - @Deprecated - @Override - public int getComparatorOutput(BlockState state, World world, BlockPos pos, Direction direction) { - return getComparatorOutput(new GetComparatorOutputArgs(state, world, pos, direction)); - } - - public int getComparatorOutput(GetComparatorOutputArgs args) { - return super.getComparatorOutput(args.state, args.world, args.pos, args.direction); - } - - @Deprecated - @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return canPlaceAt(new CanPlaceAtArgs(state, world, pos)); - } - - public boolean canPlaceAt(CanPlaceAtArgs args) { - return super.canPlaceAt(args.state, args.world, args.pos); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java deleted file mode 100644 index 368be8ddc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.v2; - -import net.minecraft.block.Block; -import net.minecraft.util.shape.VoxelShape; -import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; -import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; -import net.pitan76.mcpitanlib.api.block.args.RotateArgs; -import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.mixin.BlockInvoker; - -public interface CompatBlockProvider extends ExtendBlockProvider { - CompatibleBlockSettings getCompatSettings(); - - default BlockWrapper getWrapper() { - return this instanceof Block ? BlockWrapper.of((Block) this) : BlockWrapper.of(); - } - - default CompatBlockRenderType getRenderType(RenderTypeArgs args, Options options) { - options.cancel = false; - return null; - } - - default BlockState rotate(RotateArgs args, Options options) { - options.cancel = false; - return null; - } - - default Boolean isSideInvisible(SideInvisibleArgs args, Options options) { - options.cancel = false; - return null; - } - - default BlockState getDefaultMidohraState() { - if (this instanceof Block) { - return BlockState.of(((Block) this).getDefaultState()); - } - - return null; - } - - default void setDefaultState(BlockState state) { - if (this instanceof Block) { - ((BlockInvoker) this).setDefaultState_invoke(state.toMinecraft()); - } - } - - @Override - @Deprecated - default net.minecraft.block.BlockState getPlacementState(net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs args, Options options) { - return ExtendBlockProvider.super.getPlacementState(args, options); - } - - default BlockState getPlacementState(PlacementStateArgs args, Options options) { - options.cancel = false; - return null; - } - - default BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args, Options options) { - options.cancel = false; - return null; - } - - @Override - @Deprecated - default VoxelShape getOutlineShape(net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent event, Options options) { - return ExtendBlockProvider.super.getOutlineShape(event, options); - } - - default VoxelShape getOutlineShape(OutlineShapeEvent event, Options options) { - options.cancel = false; - return null; - } - - @Deprecated - @Override - default VoxelShape getCollisionShape(net.pitan76.mcpitanlib.api.event.block.CollisionShapeEvent event, Options options) { - return ExtendBlockProvider.super.getCollisionShape(event, options); - } - - default VoxelShape getCollisionShape(CollisionShapeEvent event, Options options) { - options.cancel = false; - return null; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java deleted file mode 100644 index f92115a8a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.v2; - -import net.minecraft.block.ShapeContext; -import net.minecraft.block.StairsBlock; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.block.enums.StairShape; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.state.property.BooleanProperty; -import net.pitan76.mcpitanlib.api.state.property.CompatProperties; -import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; -import net.pitan76.mcpitanlib.api.state.property.EnumProperty; -import net.pitan76.mcpitanlib.midohra.block.BlockState; - -public class CompatStairsBlock extends net.pitan76.mcpitanlib.api.block.CompatStairsBlock { - - public static final DirectionProperty FACING = CompatProperties.ofDir(StairsBlock.FACING); - public static final EnumProperty HALF = CompatProperties.of(StairsBlock.HALF); - public static final EnumProperty SHAPE = CompatProperties.of(StairsBlock.SHAPE); - public static final BooleanProperty WATERLOGGED = CompatProperties.of(StairsBlock.WATERLOGGED); - - public CompatStairsBlock(net.minecraft.block.BlockState baseBlockState, CompatibleBlockSettings settings) { - super(baseBlockState, settings); - } - - public CompatStairsBlock(BlockState baseBlockState, CompatibleBlockSettings settings) { - this(baseBlockState.toMinecraft(), settings); - } - - public VoxelShape getOutlineShape(OutlineShapeEvent e) { - return super.getOutlineShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); - } - - public VoxelShape getCollisionShape(CollisionShapeEvent e) { - return super.getCollisionShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); - } - - @Deprecated - @Override - public VoxelShape getOutlineShape(net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent e) { - return getOutlineShape(new OutlineShapeEvent(e.state, e.world, e.pos, e.context)); - } - - @Deprecated - @Override - public VoxelShape getOutlineShape(net.minecraft.block.BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); - } - - @Deprecated - @Override - public VoxelShape getOutlineShape(OutlineShapeEvent e, Options options) { - return super.getOutlineShape(e, options); - } - - @Override - public VoxelShape getCollisionShape(net.minecraft.block.BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); - } - - @Deprecated - @Override - public VoxelShape getCollisionShape(CollisionShapeEvent event, Options options) { - return super.getCollisionShape(event, options); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java deleted file mode 100644 index 95d43c70f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java +++ /dev/null @@ -1,292 +0,0 @@ -package net.pitan76.mcpitanlib.api.block.v2; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.MapCodec; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.MapColor; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.util.DyeColor; -import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; -import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.color.CompatDyeColor; -import net.pitan76.mcpitanlib.api.util.color.CompatMapColor; - -import java.util.function.Function; -import java.util.function.ToIntFunction; - -@SuppressWarnings("deprecation") -public class CompatibleBlockSettings extends net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings { - protected CompatIdentifier identifier = null; - public boolean changedTranslationKey = false; - - public static final Codec CODEC = MapCodec.unitCodec(CompatibleBlockSettings::new); - - @Deprecated - protected CompatibleBlockSettings() { - super(); - } - - public CompatibleBlockSettings(CompatIdentifier identifier) { - super(); - setId(identifier); - } - - public static CompatibleBlockSettings of(CompatIdentifier id) { - return new CompatibleBlockSettings(id); - } - - @Deprecated - public CompatibleBlockSettings setId(CompatIdentifier identifier) { - this.identifier = identifier; - return this; - } - - private static CompatibleBlockSettings copy(CompatibleMaterial material, CompatibleBlockSettings settings) { - settings.mapColor(material.getColor()); - if (material.isLiquid()) - settings.settings.liquid(); - if (material.isSolid()) - settings.settings.solid(); - if (material.isReplaceable()) - settings.settings.replaceable(); - if (material.isSolid()) - settings.settings.solid(); - if (material.isBurnable()) - settings.settings.burnable(); - settings.settings.pistonBehavior(material.getPistonBehavior()); - return settings; - } - - public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material, MapColor mapColor) { - this(id); - copy(material, this); - mapColor(mapColor); - } - - public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material, DyeColor dyeColor) { - this(id); - copy(material, this); - mapColor(dyeColor); - } - - public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material) { - this(id); - copy(material, this); - } - - public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material, Function mapColor) { - this(id); - copy(material, this); - mapColor(mapColor); - } - - public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material, MapColor mapColor) { - return new CompatibleBlockSettings(id, material, mapColor); - } - - public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material, DyeColor dyeColor) { - return new CompatibleBlockSettings(id, material, dyeColor); - } - - public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material) { - return new CompatibleBlockSettings(id, material); - } - - public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material, Function mapColor) { - return new CompatibleBlockSettings(id, material, mapColor); - } - - public CompatibleBlockSettings(CompatIdentifier id, AbstractBlock block) { - super(block); - setId(id); - } - - public static CompatibleBlockSettings copy(CompatIdentifier id, AbstractBlock block) { - return new CompatibleBlockSettings(id, block); - } - - public CompatibleBlockSettings air() { - super.air(); - return this; - } - - public CompatibleBlockSettings blockVision(AbstractBlock.ContextPredicate predicate) { - super.blockVision(predicate); - return this; - } - - public CompatibleBlockSettings postProcess(AbstractBlock.ContextPredicate predicate) { - super.postProcess(predicate); - return this; - } - - public CompatibleBlockSettings solidBlock(AbstractBlock.ContextPredicate predicate) { - super.solidBlock(predicate); - return this; - } - - public CompatibleBlockSettings suffocates(AbstractBlock.ContextPredicate predicate) { - super.suffocates(predicate); - return this; - } - - public CompatibleBlockSettings mapColor(MapColor color) { - super.mapColor(color); - return this; - } - - public CompatibleBlockSettings mapColor(DyeColor color) { - super.mapColor(color); - return this; - } - - public CompatibleBlockSettings mapColor(CompatMapColor color) { - super.mapColor(color.getColor()); - return this; - } - - public CompatibleBlockSettings mapColor(CompatDyeColor color) { - super.mapColor(color.getColor()); - return this; - } - - public CompatibleBlockSettings mapColor(Function color) { - super.mapColor(color); - return this; - } - - public CompatibleBlockSettings compatMapColor(Function color) { - super.mapColor(state -> color.apply(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state)).getColor()); - return this; - } - - @Deprecated - public CompatibleBlockSettings dropsLike(Block source) { - super.dropsLike(source); - return this; - } - - public CompatibleBlockSettings breakInstantly() { - super.breakInstantly(); - return this; - } - - public CompatibleBlockSettings dropsNothing() { - super.dropsNothing(); - return this; - } - - public CompatibleBlockSettings dynamicBounds() { - super.dynamicBounds(); - return this; - } - - public CompatibleBlockSettings hardness(float hardness) { - super.hardness(hardness); - return this; - } - - public CompatibleBlockSettings noBlockBreakParticles() { - super.noBlockBreakParticles(); - return this; - } - - public CompatibleBlockSettings requiresTool() { - super.requiresTool(); - return this; - } - - public CompatibleBlockSettings noCollision() { - super.noCollision(); - return this; - } - - public CompatibleBlockSettings nonOpaque() { - super.nonOpaque(); - return this; - } - - public CompatibleBlockSettings resistance(float resistance) { - super.resistance(resistance); - return this; - } - - public CompatibleBlockSettings strength(float strength) { - super.strength(strength); - return this; - } - - public CompatibleBlockSettings strength(float hardness, float resistance) { - super.strength(hardness, resistance); - return this; - } - - public CompatibleBlockSettings ticksRandomly() { - super.ticksRandomly(); - return this; - } - - public CompatibleBlockSettings sounds(CompatBlockSoundGroup blockSoundGroup) { - super.sounds(blockSoundGroup); - return this; - } - - public CompatibleBlockSettings luminance(ToIntFunction luminance) { - super.luminance(luminance); - return this; - } - - public CompatibleBlockSettings jumpVelocityMultiplier(float jumpVelocityMultiplier) { - super.jumpVelocityMultiplier(jumpVelocityMultiplier); - return this; - } - - public CompatibleBlockSettings slipperiness(float slipperiness) { - super.slipperiness(slipperiness); - return this; - } - - public CompatibleBlockSettings velocityMultiplier(float velocityMultiplier) { - super.velocityMultiplier(velocityMultiplier); - return this; - } - - public CompatibleBlockSettings emissiveLighting(AbstractBlock.ContextPredicate predicate) { - super.emissiveLighting(predicate); - return this; - } - - public CompatibleBlockSettings offset(AbstractBlock.OffsetType offsetType) { - super.offset(offsetType); - return this; - } - - public CompatibleBlockSettings allowsSpawning(AbstractBlock.TypedContextPredicate> predicate) { - super.allowsSpawning(predicate); - return this; - } - - public AbstractBlock.Settings build() { - super.build(); - - if (identifier != null) { - settings.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier.toMinecraft())); - } - - return settings; - } - - @Deprecated - @Override - public CompatibleBlockSettings sounds(BlockSoundGroup blockSoundGroup) { - super.sounds(blockSoundGroup); - return this; - } - - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java deleted file mode 100644 index 28fd67071..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.pitan76.mcpitanlib.api.client; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -@Deprecated -public abstract class CompatInventoryScreen extends SimpleInventoryScreen { - - public CompatInventoryScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - public abstract CompatIdentifier getCompatTexture(); - - @Override - public Identifier getTexture() { - return getCompatTexture().toMinecraft(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java deleted file mode 100644 index c9346749d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java +++ /dev/null @@ -1,317 +0,0 @@ -package net.pitan76.mcpitanlib.api.client; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.input.KeyInput; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.*; -import net.pitan76.mcpitanlib.api.client.render.screen.RenderBackgroundTextureArgs; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; -import net.pitan76.mcpitanlib.api.util.client.RenderUtil; -import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; -import net.pitan76.mcpitanlib.core.datafixer.Pair; - -@Deprecated -public abstract class SimpleHandledScreen extends HandledScreen { - - public int width, height, backgroundWidth, backgroundHeight, x, y; - public ScreenHandler handler; - public TextRenderer textRenderer; - public ItemRenderer itemRenderer; - - public Text title; - public MinecraftClient client; - public SimpleHandledScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - fixScreen(); - this.handler = handler; - this.title = title; - - } - - public T addDrawableChild_compatibility(T drawableElement) { - return super.addDrawableChild(drawableElement); - // addButton - } - - public T addSelectableChild_compatibility(T selectableElement) { - return super.addSelectableChild(selectableElement); - } - - public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { - return addDrawableChild_compatibility(widget); - } - - @Deprecated - @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { - DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); - drawBackgroundOverride(new DrawBackgroundArgs(drawObjectDM, delta, mouseX, mouseY)); - } - - public abstract void drawBackgroundOverride(DrawBackgroundArgs args); - - @Deprecated - @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { - DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); - drawForegroundOverride(new DrawForegroundArgs(drawObjectDM, mouseX, mouseY)); - } - - protected void drawForegroundOverride(DrawForegroundArgs args) { - super.drawForeground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); - } - - public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { - ScreenUtil.RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height, 256, 256); - } - - public void callDrawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, int u, int v, int width, int height) { - callDrawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); - } - - @Deprecated - public void callRenderBackground(DrawObjectDM drawObjectDM) { - callRenderBackground(new RenderArgs(drawObjectDM, 0, 0, 0)); - } - - - public void callRenderBackground(RenderArgs args) { - super.renderBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { - super.drawMouseoverTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); - } - - public void renderOverride(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public void resizeOverride(MinecraftClient client, int width, int height) { - } - - public void initOverride() { - } - - @Deprecated - @Override - protected void init() { - super.init(); - fixScreen(); - initOverride(); - } - - @Deprecated - @Override - public void resize(int width, int height) { - super.resize(width, height); - fixScreen(); - resizeOverride(MinecraftClient.getInstance(), width, height); - } - - public void fixScreen() { - this.backgroundWidth = getBackgroundWidth(); - this.backgroundHeight = getBackgroundHeight(); - this.x = super.x; //(this.width - this.backgroundWidth) / 2; - this.y = super.y; //(this.height - this.backgroundHeight) / 2; - this.textRenderer = super.textRenderer; - this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); - this.width = super.width; - this.height = super.height; - if (super.client == null) - this.client = MinecraftClient.getInstance(); - else - this.client = super.client; - } - - public void setX(int x) { - this.x = x; - super.x = x; - } - - public void setY(int y) { - this.y = y; - super.y = y; - } - - public void setTextRenderer(TextRenderer textRenderer) { - this.textRenderer = textRenderer; - } - - public void setItemRenderer(ItemRenderer itemRenderer) { - this.itemRenderer = itemRenderer; - } - - public void setWidth(int width) { - this.width = width; - super.width = width; - } - - public void setBackgroundWidth(int backgroundWidth) { - this.backgroundWidth = backgroundWidth; - super.backgroundWidth = backgroundWidth; - } - - public void setBackgroundHeight(int backgroundHeight) { - this.backgroundHeight = backgroundHeight; - super.backgroundHeight = backgroundHeight; - } - - public void setHeight(int height) { - this.height = height; - super.height = height; - } - - public int getBackgroundWidth() { - return super.backgroundWidth; - } - - public int getBackgroundHeight() { - return super.backgroundHeight; - } - - @Deprecated - @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); - renderOverride(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); - } - - public boolean keyReleased(KeyEventArgs args) { - return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); - } - - public boolean keyPressed(KeyEventArgs args) { - return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); - } - - public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { - if (getBackgroundTexture() != null) - Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); - - RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); - } - - @Deprecated - @Override - public boolean keyReleased(KeyInput input) { - return this.keyReleased(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); - } - - @Deprecated - @Override - public boolean keyPressed(KeyInput input) { - return this.keyPressed(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); - } - - @Deprecated - @Override - public void renderDarkening(DrawContext context) { - this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); - } - - public void closeOverride() { - super.close(); - } - - public void removedOverride() { - super.removed(); - } - - @Override - public void close() { - closeOverride(); - } - - @Override - public void removed() { - removedOverride(); - } - - public Identifier getBackgroundTexture() { - return IdentifierUtil.from(getCompatBackgroundTexture()); - } - - public CompatIdentifier getCompatBackgroundTexture() { - return null; - } - - public void setTitleX(int x) { - this.titleX = x; - } - - public void setTitleY(int y) { - this.titleY = y; - } - - public void setTitlePos(int x, int y) { - setTitleX(x); - setTitleY(y); - } - - public void setTitleXCenter() { - if (textRenderer == null) - textRenderer = ClientUtil.getTextRenderer(); - - setTitleX(backgroundWidth / 2 - textRenderer.getWidth(title) / 2); - } - - public int getTitleX() { - return titleX; - } - - public int getTitleY() { - return titleY; - } - - @Deprecated - @Override - public Text getTitle() { - return callGetTitle(); - } - - public Text callGetTitle() { - return super.getTitle(); - } - - public Pair getTitlePosP() { - return new Pair<>(getTitleX(), getTitleY()); - } - - public int getPlayerInvTitleX() { - return playerInventoryTitleX; - } - - public int getPlayerInvTitleY() { - return playerInventoryTitleY; - } - - public void setPlayerInvTitleX(int x) { - playerInventoryTitleX = x; - } - - public void setPlayerInvTitleY(int y) { - playerInventoryTitleY = y; - } - - public void setPlayerInvTitle(int x, int y) { - setPlayerInvTitleX(x); - setPlayerInvTitleY(y); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java deleted file mode 100644 index de34a65fc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.pitan76.mcpitanlib.api.client; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawMouseoverTooltipArgs; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; -import net.pitan76.mcpitanlib.api.util.client.RenderUtil; - -@Deprecated -public abstract class SimpleInventoryScreen extends SimpleHandledScreen { - - public SimpleInventoryScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - public abstract Identifier getTexture(); - - @Override - public Identifier getBackgroundTexture() { - return getTexture(); - } - - @Override - public void drawBackgroundOverride(DrawBackgroundArgs args) { - RenderUtil.setShaderToPositionTexProgram(); - RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - callDrawTexture(args.drawObjectDM, getTexture(), x, y, 0, 0, backgroundWidth, backgroundHeight); - } - - @Override - public void renderOverride(RenderArgs args) { - this.callRenderBackground(args); - super.renderOverride(args); - this.callDrawMouseoverTooltip(new DrawMouseoverTooltipArgs(args.drawObjectDM, args.mouseX, args.mouseY)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java deleted file mode 100644 index 572621b5a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.api.client; - -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.option.GameOptions; -import net.minecraft.text.Text; - -public class SimpleOptionsScreen extends SimpleScreen { - - protected final Screen parent; - protected final GameOptions gameOptions; - - public SimpleOptionsScreen(Text title, Screen parent, GameOptions gameOptions) { - super(title); - this.parent = parent; - this.gameOptions = gameOptions; - } - - @Override - public void removed() { - client.options.write(); - } - - @Override - public void close() { - client.setScreen(this.parent); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java deleted file mode 100644 index fccd2db65..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java +++ /dev/null @@ -1,191 +0,0 @@ -package net.pitan76.mcpitanlib.api.client; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.input.KeyInput; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.*; -import net.pitan76.mcpitanlib.api.client.render.screen.RenderBackgroundTextureArgs; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; -import net.pitan76.mcpitanlib.api.util.client.RenderUtil; -import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; - -public abstract class SimpleScreen extends Screen { - - public int width, height; - public TextRenderer textRenderer; - public ItemRenderer itemRenderer; - - public Text title; - public MinecraftClient client; - - public SimpleScreen(Text title) { - super(title); - fixScreen(); - this.title = title; - } - - public T addDrawableChild_compatibility(T drawableElement) { - return super.addDrawableChild(drawableElement); - // addButton - } - - public T addSelectableChild_compatibility(T selectableElement) { - return super.addSelectableChild(selectableElement); - } - - public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { - return addDrawableChild_compatibility(widget); - } - - public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { - ScreenUtil.RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); - } - - public void callDrawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, int u, int v, int width, int height) { - callDrawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); - } - - @Deprecated - @Override - public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) { - renderBackground(new RenderArgs(new DrawObjectDM(context, this), mouseX, mouseY, delta)); - } - - - public void renderBackground(RenderArgs args) { - super.renderBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public void render(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public void resizeOverride(MinecraftClient client, int width, int height) { - } - - public void initOverride() { - } - - @Deprecated - @Override - protected void init() { - super.init(); - fixScreen(); - initOverride(); - } - - @Deprecated - @Override - public void resize(int width, int height) { - super.resize(width, height); - fixScreen(); - resizeOverride(MinecraftClient.getInstance(), width, height); - } - - public void fixScreen() { - this.textRenderer = super.textRenderer; - this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); - this.width = super.width; - this.height = super.height; - if (super.client == null) - this.client = MinecraftClient.getInstance(); - else - this.client = super.client; - } - - public void setTextRenderer(TextRenderer textRenderer) { - this.textRenderer = textRenderer; - } - - public void setItemRenderer(ItemRenderer itemRenderer) { - this.itemRenderer = itemRenderer; - } - - public void setWidth(int width) { - this.width = width; - super.width = width; - } - - public void setHeight(int height) { - this.height = height; - super.height = height; - } - - @Deprecated - @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); - render(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); - } - - public boolean keyReleased(KeyEventArgs args) { - return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); - } - - public boolean keyPressed(KeyEventArgs args) { - return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); - } - - public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { - if (getBackgroundTexture() != null) - Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), 0, 0, 0, 0, this.width, this.height); - - RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); - } - - @Deprecated - @Override - public boolean keyReleased(KeyInput keyInput) { - return this.keyReleased(new KeyEventArgs(keyInput.key(), keyInput.scancode(), keyInput.modifiers())); - } - - @Deprecated - @Override - public boolean keyPressed(KeyInput keyInput) { - return this.keyPressed(new KeyEventArgs(keyInput.key(), keyInput.scancode(), keyInput.modifiers())); - } - - @Deprecated - @Override - public void renderDarkening(DrawContext context) { - this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); - } - - public void closeOverride() { - super.close(); - } - - public void removedOverride() { - super.removed(); - } - - @Override - public void close() { - closeOverride(); - } - - @Override - public void removed() { - removedOverride(); - } - - public Identifier getBackgroundTexture() { - return IdentifierUtil.from(getCompatBackgroundTexture()); - } - - public CompatIdentifier getCompatBackgroundTexture() { - return null; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java deleted file mode 100644 index 7e2873166..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.color; - -import dev.architectury.injectables.annotations.ExpectPlatform; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import net.pitan76.mcpitanlib.midohra.world.BlockView; -import org.jetbrains.annotations.Nullable; - -public class BlockColorEvent { - private final BlockState state; - private final BlockRenderView world; - private final BlockPos pos; - private final int tintIndex; - - public BlockColorEvent(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { - this.state = state; - this.world = world; - this.pos = pos; - this.tintIndex = tintIndex; - } - - public BlockState getState() { - return state; - } - - public BlockRenderView getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public int getTintIndex() { - return tintIndex; - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getPos()); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getState()); - } - - public boolean hasWorld() { - return getWorld() != null; - } - - public boolean hasPos() { - return getPos() != null; - } - - public BlockView getMidohraWorld() { - if (!hasWorld()) return null; - return net.pitan76.mcpitanlib.midohra.world.BlockView.of(getWorld()); - } - - public BlockEntity getBlockEntity() { - if (!hasWorld() || !hasPos()) return null; - return getWorld().getBlockEntity(getPos()); - } - - public int getDefaultColor() { - return 0xFFFFFF; - } - - public Object getRenderData() { - if (!hasWorld() || !hasPos()) return null; - return getRenderDataD(getBlockEntity()); - } - - @ExpectPlatform - protected static Object getRenderDataD(BlockEntity blockEntity) { - if (blockEntity instanceof net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) { - return ((net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) blockEntity).getCompatRenderData(); - } - - return null; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java deleted file mode 100644 index 50ceb12f4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.color; - -import net.minecraft.block.BlockState; -import net.minecraft.client.color.block.BlockColorProvider; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; -import org.jetbrains.annotations.Nullable; - -public interface CompatBlockColorProvider extends BlockColorProvider { - default int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { - return getColor(new BlockColorEvent(state, world, pos, tintIndex)); - } - - int getColor(BlockColorEvent e); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java deleted file mode 100644 index 8166f7406..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event; - -import dev.architectury.event.events.client.ClientTooltipEvent; -import net.pitan76.mcpitanlib.api.client.event.listener.ItemTooltipListener; - -public class ItemTooltipRegistry { - public static void registerItemTooltip(ItemTooltipListener listener) { - ClientTooltipEvent.ITEM.register(listener::onTooltip); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java deleted file mode 100644 index b8b0821a6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event; - -//import dev.architectury.injectables.annotations.ExpectPlatform; -import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineListener; -import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContextListener; - -import java.util.ArrayList; -import java.util.List; - -public class WorldRenderRegistry { - - public static List beforeBlockOutlineListeners = new ArrayList<>(); - public static List worldRenderAfterLevelListeners = new ArrayList<>(); - - public static boolean isEmptyBlockOutlineListeners = true; - public static boolean isEmptyWorldRenderAfterLevelListeners = true; - - public WorldRenderRegistry() { - - } - - //@ExpectPlatform - public static void registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { - beforeBlockOutlineListeners.add(listener); - isEmptyBlockOutlineListeners = false; - //throw new AssertionError(); - } - - //@ExpectPlatform - public static void registerWorldRenderAfterLevel(WorldRenderContextListener listener) { - worldRenderAfterLevelListeners.add(listener); - isEmptyWorldRenderAfterLevelListeners = false; - //throw new AssertionError(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java deleted file mode 100644 index 3b189df69..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java +++ /dev/null @@ -1,122 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.listener; - -import net.minecraft.block.BlockState; -import net.minecraft.client.render.Camera; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.render.state.OutlineRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; -import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; - -import java.util.Optional; - -public class BeforeBlockOutlineEvent { - public WorldRenderContext context; - public HitResult hitResult; - - public BeforeBlockOutlineEvent(WorldRenderContext context, OutlineRenderState renderState) { - this.context = context; - this.hitResult = context.getHitResult(); - } - - public BeforeBlockOutlineEvent(WorldRenderContext context, HitResult hitResult) { - this.context = context; - this.hitResult = hitResult; - } - - public HitResult getHitResult() { - return hitResult; - } - - public WorldRenderContext getContext() { - return context; - } - - public WorldRenderer getWorldRenderer() { - return context.getWorldRenderer(); - } - - public Optional getBlockState() { - return Optional.ofNullable(getWorld().getBlockState(getBlockPos().orElse(null))); - } - - public World getWorld() { - return context.getWorld(); - } - - public Optional getBlockPos() { - return Optional.ofNullable(((BlockHitResult) hitResult).getBlockPos()); - } - - public boolean isBlockType() { - return getHitResultType() == HitResult.Type.BLOCK; - } - - public HitResult.Type getHitResultType() { - return hitResult.getType(); - } - - @Deprecated - public Camera getCamera() { - return context.getCamera(); - } - - public CameraWrapper getCameraWrapper() { - return CameraWrapper.of(getCamera()); - } - - public Optional getOutlineShape() { - return context.getOutlineShape(); - } - - public MatrixStack getMatrixStack() { - return context.getMatrixStack(); - } - - public void push() { - context.push(); - } - - public void translate(double x, double y, double z) { - context.translate(x, y, z); - } - - public void pop() { - context.pop(); - } - - public Optional getVertexConsumer() { - return context.getVertexConsumer(); - } - - public void drawBox(float red, float green, float blue, float alpha) { - context.drawBox(red, green, blue, alpha); - } - - public void drawBox(Box box, float red, float green, float blue, float alpha) { - context.drawBox(box, red, green, blue, alpha); - } - - public net.pitan76.mcpitanlib.midohra.util.hit.HitResult getHitResultM() { - return net.pitan76.mcpitanlib.midohra.util.hit.HitResult.of(hitResult); - } - - public HitResultType getHitResultTypeM() { - return HitResultType.from(hitResult.getType()); - } - - public BlockState getBlockState2() { - return getWorld().getBlockState(getHitResultM().asBlockHitResult().get().getBlockPos()); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockStateM() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState2()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java deleted file mode 100644 index 881ee7b11..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.listener; - - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -@Environment(EnvType.CLIENT) -@FunctionalInterface -public interface BeforeBlockOutlineListener { - boolean beforeBlockOutline(BeforeBlockOutlineEvent event); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java deleted file mode 100644 index f2ac0da2e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java +++ /dev/null @@ -1,68 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.listener; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -import java.util.List; - -public class ItemTooltipContext { - - public ItemStack stack; - public List texts; - public Item.TooltipContext tooltipContext; - - @Deprecated - public TooltipType type; - - public ItemTooltipContext(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipType type) { - this.stack = stack; - this.texts = texts; - this.tooltipContext = tooltipContext; - this.type = type; - } - - public ItemStack getStack() { - return stack; - } - - public List getTexts() { - return texts; - } - - public Item.TooltipContext getTooltipContext() { - return tooltipContext; - } - - @Deprecated - public TooltipType getType() { - return type; - } - - public void addTooltip(Text text) { - texts.add(text); - } - - public void addTooltip(List texts) { - this.texts.addAll(texts); - } - - public boolean isAdvanced() { - return type.isAdvanced(); - } - - public boolean isCreative() { - return type.isCreative(); - } - - public void addTooltip(TextComponent textComponent) { - addTooltip(textComponent.getText()); - } - - public void addTooltip(String text) { - addTooltip(TextUtil.literal(text)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java deleted file mode 100644 index d86227934..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.listener; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; - -import java.util.List; - -@FunctionalInterface -public interface ItemTooltipListener { - void onTooltip(ItemTooltipContext context); - - default void onTooltip(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipType type) { - onTooltip(new ItemTooltipContext(stack, texts, tooltipContext, type)); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java deleted file mode 100644 index 2f67d7776..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java +++ /dev/null @@ -1,140 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.listener; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.Entity; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; -import net.pitan76.mcpitanlib.api.util.VoxelShapeUtil; -import net.pitan76.mcpitanlib.api.util.client.render.VertexRenderingUtil; -import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; -import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; - -import java.util.Objects; -import java.util.Optional; - -public interface WorldRenderContext { - - WorldRenderer getWorldRenderer(); - - MatrixStack getMatrixStack(); - - float getTickDelta(); - - Camera getCamera(); - - GameRenderer getGameRenderer(); - - LightmapTextureManager getLightmapTextureManager(); - - @Deprecated - Matrix4f getProjectionMatrix(); - - ClientWorld getWorld(); - - @Deprecated - boolean isAdvancedTranslucency(); - - @Nullable VertexConsumerProvider getConsumers(); - @Nullable Frustum getFrustum(); - - @Environment(EnvType.CLIENT) - interface BlockOutlineContext { - @Deprecated - VertexConsumer vertexConsumer(); - - Entity entity(); - - double cameraX(); - - double cameraY(); - - double cameraZ(); - - BlockPos blockPos(); - - BlockState blockState(); - } - - default HitResult getHitResult() { - return MinecraftClient.getInstance().crosshairTarget; - } - - default Optional getBlockState() { - return Optional.ofNullable(getWorld().getBlockState(getBlockPos().orElse(null))); - } - - default Optional getBlockPos() { - return Optional.ofNullable(((BlockHitResult) getHitResult()).getBlockPos()); - } - - default boolean isBlockType() { - return getHitResultType() == HitResult.Type.BLOCK; - } - - default HitResult.Type getHitResultType() { - return getHitResult().getType(); - } - - default Optional getOutlineShape() { - return getBlockState().map(blockState -> blockState.getOutlineShape(getWorld(), - getBlockPos().orElse(null))); - } - - default void push() { - getMatrixStack().push(); - } - - default void translate(double x, double y, double z) { - getMatrixStack().translate(x, y, z); - } - - default void pop() { - getMatrixStack().pop(); - } - - default Optional getVertexConsumer() { - if (getConsumers() == null) - return Optional.empty(); - - return Optional.of(Objects.requireNonNull(getConsumers()).getBuffer(RenderLayers.lines())); - } - - default void drawBox(float red, float green, float blue, float alpha) { - Optional outlineShape = getOutlineShape(); - if (!outlineShape.isPresent()) return; - - drawBox(VoxelShapeUtil.getBoundingBox(outlineShape.get()), red, green, blue, alpha); - } - - default void drawBox(Box box, float red, float green, float blue, float alpha) { - Optional vertexConsumer = getVertexConsumer(); - - if (!vertexConsumer.isPresent()) - return; - - VertexConsumer consumer = vertexConsumer.get(); - - double x1 = box.minX; - double y1 = box.minY; - double z1 = box.minZ; - double x2 = box.maxX; - double y2 = box.maxY; - double z2 = box.maxZ; - - VertexRenderingUtil.drawBox(getMatrixStack(), consumer, x1, y1, z1, x2, y2, z2, red, green, blue, alpha); - } - - default CameraWrapper getCameraWrapper() { - return CameraWrapper.of(getCamera()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java deleted file mode 100644 index dbe5fcd85..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.listener; - -import net.minecraft.client.render.*; -import net.minecraft.client.render.state.WorldRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; -import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; - -public class WorldRenderContextImpl implements WorldRenderContext { - - public WorldRenderer worldRenderer; - public MatrixStack matrixStack; - public float tickDelta; - public Camera camera; - public GameRenderer gameRenderer; - public LightmapTextureManager lightmapTextureManager; - public Matrix4f projectionMatrix; - public ClientWorld world; - public boolean advancedTranslucency; - public @Nullable VertexConsumerProvider consumers; - public @Nullable Frustum frustum; - - @Override - public WorldRenderer getWorldRenderer() { - return worldRenderer; - } - - @Override - public MatrixStack getMatrixStack() { - return matrixStack; - } - - @Override - public float getTickDelta() { - return tickDelta; - } - - @Override - public Camera getCamera() { - if (camera == null) { - return getGameRenderer().getCamera(); - } - return camera; - } - - @Override - public GameRenderer getGameRenderer() { - if (gameRenderer == null) { - return ClientUtil.getGameRenderer(); - } - return gameRenderer; - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return lightmapTextureManager; - } - - @Override - public Matrix4f getProjectionMatrix() { - return projectionMatrix; - } - - @Override - public ClientWorld getWorld() { - if (world == null) { - return ClientUtil.getWorld(); - } - return world; - } - - @Override - public boolean isAdvancedTranslucency() { - return advancedTranslucency; - } - - @Override - public @Nullable VertexConsumerProvider getConsumers() { - return consumers; - } - - @Override - public @Nullable Frustum getFrustum() { - return frustum; - } - - public void prepare(GameRenderer gameRenderer, WorldRenderer worldRenderer, WorldRenderState worldRenderState, @Nullable ClientWorld world, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix) { - this.gameRenderer = gameRenderer; - this.worldRenderer = worldRenderer; - this.world = world; - this.camera = camera; - this.matrixStack = new MatrixStack(); - this.matrixStack.multiplyPositionMatrix(projectionMatrix); - this.matrixStack.push(); - - matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw())); - matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); - - Vec3d camPos = camera.getCameraPos(); - matrixStack.translate(-camPos.x, -camPos.y, -camPos.z); - - this.matrixStack.pop(); - - this.projectionMatrix = projectionMatrix;; - this.tickDelta = tickCounter.getDynamicDeltaTicks(); - this.lightmapTextureManager = gameRenderer.getLightmapTextureManager(); - this.frustum = worldRenderer.getCapturedFrustum(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java deleted file mode 100644 index 7025eae59..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.listener; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -@Environment(EnvType.CLIENT) -@FunctionalInterface -public interface WorldRenderContextListener { - void render(WorldRenderContext context); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java deleted file mode 100644 index 675de4d31..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.screen; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; - -public abstract class CompatInventoryScreen extends SimpleInventoryScreen { - - public CompatInventoryScreen(S handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - public abstract CompatIdentifier getCompatTexture(); - - @Deprecated - @Override - public Identifier getTexture() { - return getCompatTexture().toMinecraft(); - } - - public void drawSlot(DrawObjectDM drawObjectDM, Slot slot) { - SlotRenderer.drawSlot(drawObjectDM, slot, x, y); - } - - public void drawSlots(DrawObjectDM drawObjectDM) { - SlotRenderer.drawSlots(drawObjectDM, handler, x, y); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java deleted file mode 100644 index da47fb543..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.screen; - -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -public class ScreenTexts { - public static final Text ON = TextUtil.translatable("options.on"); - public static final Text OFF = TextUtil.translatable("options.off"); - public static final Text DONE = TextUtil.translatable("gui.done"); - public static final Text CANCEL = TextUtil.translatable("gui.cancel"); - public static final Text YES = TextUtil.translatable("gui.yes"); - public static final Text NO = TextUtil.translatable("gui.no"); - public static final Text PROCEED = TextUtil.translatable("gui.proceed"); - public static final Text BACK = TextUtil.translatable("gui.back"); - public static final Text CONNECT_FAILED = TextUtil.translatable("connect.failed"); - public static final Text LINE_BREAK = TextUtil.literal("\n"); - public static final Text SENTENCE_SEPARATOR = TextUtil.literal(". "); - - public ScreenTexts() { - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java deleted file mode 100644 index 23e378e3f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +++ /dev/null @@ -1,364 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.screen; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.input.KeyInput; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.*; -import net.pitan76.mcpitanlib.api.client.render.screen.RenderBackgroundTextureArgs; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; -import net.pitan76.mcpitanlib.api.util.client.RenderUtil; -import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; -import net.pitan76.mcpitanlib.core.datafixer.Pair; - -public abstract class SimpleHandledScreen extends HandledScreen { - - public int width, height, backgroundWidth, backgroundHeight, x, y; - public S handler; - public TextRenderer textRenderer; - public ItemRenderer itemRenderer; - - public Text title; - public MinecraftClient client; - public SimpleHandledScreen(S handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - fixScreen(); - this.handler = handler; - this.title = title; - - } - - @Deprecated - @Override - public S getScreenHandler() { - return getScreenHandlerOverride(); - } - - public S getScreenHandlerOverride() { - return super.getScreenHandler(); - } - - public T addDrawableChild_compatibility(T drawableElement) { - return super.addDrawableChild(drawableElement); - // addButton - } - - public T addSelectableChild_compatibility(T selectableElement) { - return super.addSelectableChild(selectableElement); - } - - public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { - return addDrawableChild_compatibility(widget); - } - - @Deprecated - @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { - DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); - drawBackgroundOverride(new DrawBackgroundArgs(drawObjectDM, delta, mouseX, mouseY)); - } - - public abstract void drawBackgroundOverride(DrawBackgroundArgs args); - - @Deprecated - @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { - DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); - drawForegroundOverride(new DrawForegroundArgs(drawObjectDM, mouseX, mouseY)); - } - - protected void drawForegroundOverride(DrawForegroundArgs args) { - super.drawForeground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); - } - - public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { - ScreenUtil.RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); - } - - public void callDrawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, int u, int v, int width, int height) { - callDrawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); - } - - @Deprecated - public void callRenderBackground(DrawObjectDM drawObjectDM) { - callRenderBackground(new RenderArgs(drawObjectDM, 0, 0, 0)); - } - - - public void callRenderBackground(RenderArgs args) { - super.renderBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { - super.drawMouseoverTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); - } - - public void renderOverride(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public void resizeOverride(MinecraftClient client, int width, int height) { - } - - public void initOverride() { - } - - @Deprecated - @Override - protected void init() { - super.init(); - fixScreen(); - initOverride(); - } - - @Deprecated - @Override - public void resize(int width, int height) { - super.resize(width, height); - fixScreen(); - resizeOverride(MinecraftClient.getInstance(), width, height); - } - - public void fixScreen() { - this.backgroundWidth = getBackgroundWidth(); - this.backgroundHeight = getBackgroundHeight(); - this.x = super.x; //(this.width - this.backgroundWidth) / 2; - this.y = super.y; //(this.height - this.backgroundHeight) / 2; - this.textRenderer = super.textRenderer; - this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); - this.width = super.width; - this.height = super.height; - if (super.client == null) - this.client = MinecraftClient.getInstance(); - else - this.client = super.client; - } - - public void setX(int x) { - this.x = x; - super.x = x; - } - - public void setY(int y) { - this.y = y; - super.y = y; - } - - public void setTextRenderer(TextRenderer textRenderer) { - this.textRenderer = textRenderer; - } - - public void setItemRenderer(ItemRenderer itemRenderer) { - this.itemRenderer = itemRenderer; - } - - public void setWidth(int width) { - this.width = width; - super.width = width; - } - - public void setBackgroundWidth(int backgroundWidth) { - this.backgroundWidth = backgroundWidth; - super.backgroundWidth = backgroundWidth; - } - - public void setBackgroundHeight(int backgroundHeight) { - this.backgroundHeight = backgroundHeight; - super.backgroundHeight = backgroundHeight; - } - - public void setHeight(int height) { - this.height = height; - super.height = height; - } - - public int getBackgroundWidth() { - return super.backgroundWidth; - } - - public int getBackgroundHeight() { - return super.backgroundHeight; - } - - @Deprecated - @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); - renderOverride(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); - } - - public boolean keyReleased(KeyEventArgs args) { - return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); - } - - public boolean keyPressed(KeyEventArgs args) { - return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); - } - - public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { - if (getBackgroundTexture() != null) - Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); - - RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); - } - - @Deprecated - @Override - public boolean keyReleased(KeyInput input) { - return this.keyReleased(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); - } - - @Deprecated - @Override - public boolean keyPressed(KeyInput input) { - return this.keyPressed(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); - } - - @Deprecated - @Override - public void renderDarkening(DrawContext context) { - this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); - } - - public void closeOverride() { - super.close(); - } - - public void removedOverride() { - super.removed(); - } - - @Override - public void close() { - closeOverride(); - } - - @Override - public void removed() { - removedOverride(); - } - - public Identifier getBackgroundTexture() { - return IdentifierUtil.from(getCompatBackgroundTexture()); - } - - public CompatIdentifier getCompatBackgroundTexture() { - return null; - } - - public void setTitleX(int x) { - this.titleX = x; - } - - public void setTitleY(int y) { - this.titleY = y; - } - - public void setTitlePos(int x, int y) { - setTitleX(x); - setTitleY(y); - } - - public void setTitleXCenter() { - if (textRenderer == null) - textRenderer = ClientUtil.getTextRenderer(); - - setTitleX(backgroundWidth / 2 - textRenderer.getWidth(title) / 2); - } - - public int getTitleX() { - return titleX; - } - - public int getTitleY() { - return titleY; - } - - public void drawText(DrawObjectDM drawObjectDM, Text text, int x, int y, int color) { - ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y, color); - } - - public void drawText(DrawObjectDM drawObjectDM, TextComponent text, int x, int y, int color) { - ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y, color); - } - - public void drawText(DrawObjectDM drawObjectDM, Text text, int x, int y) { - ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y); - } - - public void drawText(DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { - ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y); - } - - @Deprecated - @Override - public Text getTitle() { - return callGetTitle(); - } - - public Text callGetTitle() { - return super.getTitle(); - } - - public Pair getTitlePosP() { - return new Pair<>(getTitleX(), getTitleY()); - } - - public int getPlayerInvTitleX() { - return playerInventoryTitleX; - } - - public int getPlayerInvTitleY() { - return playerInventoryTitleY; - } - - public void setPlayerInvTitleX(int x) { - playerInventoryTitleX = x; - } - - public void setPlayerInvTitleY(int y) { - playerInventoryTitleY = y; - } - - public void setPlayerInvTitle(int x, int y) { - setPlayerInvTitleX(x); - setPlayerInvTitleY(y); - } - - public TextRenderer callGetTextRenderer() { - if (textRenderer != null) - return textRenderer; - - if (super.getTextRenderer() != null) - return super.getTextRenderer(); - - return ClientUtil.getTextRenderer(); - } - - public ItemRenderer callGetItemRenderer() { - if (itemRenderer != null) - return itemRenderer; - - return ClientUtil.getItemRenderer(); - } - - public Text getPlayerInvTitle() { - return playerInventoryTitle; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java deleted file mode 100644 index daa47269d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.screen; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawMouseoverTooltipArgs; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; -import net.pitan76.mcpitanlib.api.util.client.RenderUtil; - -public abstract class SimpleInventoryScreen extends SimpleHandledScreen { - - public SimpleInventoryScreen(S handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - public abstract Identifier getTexture(); - - @Override - public Identifier getBackgroundTexture() { - return getTexture(); - } - - @Override - public void drawBackgroundOverride(DrawBackgroundArgs args) { - RenderUtil.setShaderToPositionTexProgram(); - RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - callDrawTexture(args.drawObjectDM, getTexture(), x, y, 0, 0, backgroundWidth, backgroundHeight); - } - - @Override - public void renderOverride(RenderArgs args) { - this.callRenderBackground(args); - super.renderOverride(args); - this.callDrawMouseoverTooltip(new DrawMouseoverTooltipArgs(args.drawObjectDM, args.mouseX, args.mouseY)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java deleted file mode 100644 index 4c0d379cd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java +++ /dev/null @@ -1,145 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.widget; - -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.input.CharInput; -import net.minecraft.client.input.KeyInput; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import org.jetbrains.annotations.Nullable; - -public class CompatTextFieldWidget extends TextFieldWidget { - public CompatTextFieldWidget(TextRenderer textRenderer, int width, int height) { - this(textRenderer, width, height, TextUtil.empty()); - } - - public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height) { - this(textRenderer, x, y, width, height, TextUtil.empty()); - } - - // ---- - - public CompatTextFieldWidget(TextRenderer textRenderer, int width, int height, Text text) { - super(textRenderer, width, height, text); - } - - public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text text) { - super(textRenderer, x, y, width, height, text); - } - - public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, @Nullable TextFieldWidget copyFrom, Text text) { - super(textRenderer, x, y, width, height, copyFrom, text); - } - - // ---- - - @Deprecated - @Override - public void setDrawsBackground(boolean drawsBackground) { - callSetDrawsBackground(drawsBackground); - } - - public void callSetDrawsBackground(boolean drawsBackground) { - super.setDrawsBackground(drawsBackground); - } - - @Deprecated - @Override - public void setFocused(boolean focused) { - callSetFocused(focused); - } - - public void callSetFocused(boolean focused) { - super.setFocused(focused); - } - - @Deprecated - @Override - public void setFocusUnlocked(boolean focusUnlocked) { - callSetFocusUnlocked(focusUnlocked); - } - - public void callSetFocusUnlocked(boolean focusUnlocked) { - super.setFocusUnlocked(focusUnlocked); - } - - @Deprecated - @Override - public void setMaxLength(int maxLength) { - callSetMaxLength(maxLength); - } - - public void callSetMaxLength(int maxLength) { - super.setMaxLength(maxLength); - } - - @Deprecated - @Override - public void setText(String text) { - callSetText(text); - } - - public void callSetText(String text) { - super.setText(text); - } - - @Deprecated - @Override - public String getText() { - return callGetText(); - } - - public String callGetText() { - return super.getText(); - } - - @Deprecated - @Override - public void setEditable(boolean editable) { - callSetEditable(editable); - } - - public void callSetEditable(boolean editable) { - super.setEditable(editable); - } - - @Deprecated - @Override - public boolean isFocused() { - return callIsFocused(); - } - - public boolean callIsFocused() { - return super.isFocused(); - } - - @Deprecated - @Override - public boolean keyPressed(KeyInput input) { - return callKeyPressed(input.key(), input.scancode(), input.modifiers()); - } - - public boolean callKeyPressed(int keyCode, int scanCode, int modifiers) { - return super.keyPressed(new KeyInput(keyCode, scanCode, modifiers)); - } - - @Deprecated - @Override - public boolean keyReleased(KeyInput input) { - return callKeyReleased(input.key(), input.scancode(), input.modifiers()); - } - - public boolean callKeyReleased(int keyCode, int scanCode, int modifiers) { - return super.keyReleased(new KeyInput(keyCode, scanCode, modifiers)); - } - - @Deprecated - @Override - public boolean charTyped(CharInput input) { - return callCharTyped((char) input.codepoint(), input.modifiers()); - } - - public boolean callCharTyped(char chr, int modifiers) { - return super.charTyped(new CharInput(chr, modifiers)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java deleted file mode 100644 index b2a073e27..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java +++ /dev/null @@ -1,74 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.widget; - -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ButtonTextures; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.gui.widget.TexturedButtonWidget; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -public class CompatibleTexturedButtonWidget extends TexturedButtonWidget { - private final Identifier texture; - private final int u; - private final int v; - private final int hoveredVOffset; - private final int textureWidth; - private final int textureHeight; - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { - this(x, y, width, height, u, v, height, texture, 256, 256, pressAction); - } - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { - this(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); - } - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { - this(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, TextUtil.empty()); - } - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, net.minecraft.text.Text text) { - super(x, y, width, height, new ButtonTextures(texture, texture), pressAction, text); - this.textureWidth = textureWidth; - this.textureHeight = textureHeight; - this.u = u; - this.v = v; - this.hoveredVOffset = hoveredVOffset; - this.texture = texture; - } - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { - this(x, y, width, height, u, v, texture.toMinecraft(), pressAction); - } - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { - this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); - } - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { - this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); - } - - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, net.minecraft.text.Text text) { - this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, text); - } - - public void setPos(int x, int y) { - setX(x); - setY(y); - } - - @Override - public void drawIcon(DrawContext context, int mouseX, int mouseY, float delta) { - int i = v; - if (this.getNarrationMessage().toString().isEmpty()) { - i = v + hoveredVOffset * 2; - } else if (this.isHovered()) { - i += hoveredVOffset; - } - - context.drawTexture(RenderPipelines.GUI_TEXTURED, texture, this.getX(), this.getY(), u, i, this.width, this.height, textureWidth, textureHeight); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java deleted file mode 100644 index dfd1a5692..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java +++ /dev/null @@ -1,51 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.widget; - -import net.minecraft.client.gui.DrawContext; -import net.minecraft.util.Identifier; - -public class RedrawableTexturedButtonWidget extends CompatibleTexturedButtonWidget { - public Identifier texture; - public int u; - public int v; - public int hoveredVOffset; - public int textureWidth; - public int textureHeight; - - public RedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, PressAction pressAction, net.minecraft.text.Text message) { - super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); - this.textureWidth = textureWidth; - this.textureHeight = textureHeight; - this.u = u; - this.v = v; - this.hoveredVOffset = hoveredVOffset; - this.texture = texture; - } - - public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) { - super.renderWidget(context, mouseX, mouseY, delta); - } - - public void setTexture(Identifier texture) { - this.texture = texture; - } - - public void setU(int u) { - this.u = u; - } - - public void setV(int v) { - this.v = v; - } - - public void setHoveredVOffset(int hoveredVOffset) { - this.hoveredVOffset = hoveredVOffset; - } - - public void setTextureWidth(int textureWidth) { - this.textureWidth = textureWidth; - } - - public void setTextureHeight(int textureHeight) { - this.textureHeight = textureHeight; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java deleted file mode 100644 index 330f1e2b0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java +++ /dev/null @@ -1,114 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.widget; - -import com.google.common.collect.ImmutableList; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.widget.ClickableWidget; -import net.minecraft.client.gui.widget.ElementListWidget; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Optional; - -@Environment(EnvType.CLIENT) -public class SimpleListWidget extends ElementListWidget { - - public SimpleListWidget(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) { - this(client, width, bottom - top, top, itemHeight); - } - - public SimpleListWidget(MinecraftClient client, int width, int height, int y, int itemHeight) { - super(client, width, height, y, itemHeight); - this.centerListVertically = false; - } - - public void add(ClickableWidget widget) { - super.addEntry(WidgetEntry.create(widget)); - } - - @Override - public int getRowWidth() { - return 400; - } - - public int getWidth() { - return this.width; - } - - public int getHeight() { - return this.height; - } - - @Override - protected int getScrollbarX() { - return super.getScrollbarX() + 32; - } - - @Nullable - public ClickableWidget getWidget(int index) { - if (index < 0 || index >= this.children().size()) { - return null; - } - return this.children().get(index).getWidget(); - } - - public Optional getHoveredWidget(double mouseX, double mouseY) { - for (WidgetEntry entry : this.children()) { - if (entry.getWidget().isMouseOver(mouseX, mouseY)) { - return Optional.of(entry.getWidget()); - } - } - return Optional.empty(); - } - - /* - @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - this.render(new RenderArgs(new DrawObjectDM(context), mouseX, mouseY, delta)); - } - */ - - public void render(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - @Environment(EnvType.CLIENT) - public static class WidgetEntry extends Entry { - protected final ClickableWidget widget; - - public WidgetEntry(ClickableWidget widget) { - this.widget = widget; - } - - public static WidgetEntry create(ClickableWidget widget) { - return new WidgetEntry(widget); - } - - @Deprecated - @Override - public void render(DrawContext context, int mouseX, int mouseY, boolean hovered, float deltaTicks) { - widget.render(context, mouseX, mouseY, deltaTicks); - } - - @Deprecated - @Override - public List children() { - return ImmutableList.of(widget); - } - - @Deprecated - @Override - public List selectableChildren() { - return ImmutableList.of(widget); - } - - public ClickableWidget getWidget() { - return widget; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java deleted file mode 100644 index 7c4b87d68..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java +++ /dev/null @@ -1,82 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.gui.widget; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.widget.SliderWidget; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -import java.util.function.Consumer; -import java.util.function.Function; - -@Environment(EnvType.CLIENT) -public class SimpleSliderWidget extends SliderWidget { - protected final Function textGetter; - protected final Consumer changeCallback; - public SimpleListWidget listWidget = null; - - public SimpleSliderWidget(int x, int y, int width, int height, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { - super(x, y, width, height, text, defaultValue); - this.textGetter = (Double value) -> valueTextGetter.get(text, value); - this.changeCallback = changeCallback; - this.updateMessage(); - } - public SimpleSliderWidget(int x, int y, int width, int height, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { - this(x, y, width, height, TextUtil.empty(), defaultValue, valueTextGetter, changeCallback); - } - - public SimpleSliderWidget(int x, int y, int width, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { - this(x, y, width, 20, text, defaultValue, valueTextGetter, changeCallback); - } - - public SimpleSliderWidget(int x, int y, int width, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { - this(x, y, width, 20, defaultValue, valueTextGetter, changeCallback); - } - - public SimpleSliderWidget(SimpleListWidget listWidget, int width, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { - this(listWidget.getWidth() / 2 - 155, 0, width, 20, text, defaultValue, valueTextGetter, changeCallback); - this.listWidget = listWidget; - } - - public SimpleSliderWidget(SimpleListWidget listWidget, int width, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { - this(listWidget, width, TextUtil.empty(), defaultValue, valueTextGetter, changeCallback); - } - - /* - @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - this.render(new RenderArgs(new DrawObjectDM(context), mouseX, mouseY, delta)); - } - */ - - public void render(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public void setValue(double value) { - super.value = value; - } - - public double getValue() { - return super.value; - } - - @Override - protected void updateMessage() { - this.setMessage(this.textGetter.apply(this.getValue())); - } - - @Override - protected void applyValue() { - this.changeCallback.accept(this.getValue()); - } - - @Environment(EnvType.CLIENT) - @FunctionalInterface - public interface ValueTextGetter { - Text get(Text optionText, Double value); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java deleted file mode 100644 index 79e18403f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.option; - -import net.minecraft.client.option.KeyBinding; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -public class CompatKeyBinding { - private final KeyBinding keyBinding; - public static final Map categories = new HashMap<>(); - - public CompatKeyBinding(KeyBinding keyBinding) { - this.keyBinding = keyBinding; - } - - public CompatKeyBinding(String translationKey, int defaultKeyCode, CompatIdentifier category) { - KeyBinding.Category cat; - - if (categories.containsKey(category)) { - cat = categories.get(category); - } else { - cat = KeyBinding.Category.create(category.toMinecraft()); - categories.put(category, cat); - } - - this.keyBinding = new KeyBinding(translationKey, defaultKeyCode, cat); - } - - public CompatKeyBinding(String translationKey, int defaultKeyCode) { - String[] parts = translationKey.split("\\."); - if (Objects.equals(parts[0], "key") && parts.length == 3) { - CompatIdentifier category = CompatIdentifier.of(parts[1], "main"); - KeyBinding.Category cat; - - if (categories.containsKey(category)) { - cat = categories.get(category); - } else { - cat = KeyBinding.Category.create(category.toMinecraft()); - categories.put(category, cat); - } - - this.keyBinding = new KeyBinding(translationKey, defaultKeyCode, cat); - } else { - throw new IllegalArgumentException("Cannot infer category from translation key: " + translationKey); - } - } - - public String getTranslationKey() { - return keyBinding.getBoundKeyTranslationKey(); - } - - public Text getBoundKeyLocalizedText() { - return keyBinding.getBoundKeyLocalizedText(); - } - - public int getDefaultKeyCode() { - return keyBinding.getDefaultKey().getCode(); - } - - public static CompatKeyBinding of(String translationKey, int defaultKeyCode, CompatIdentifier category) { - return new CompatKeyBinding(translationKey, defaultKeyCode, category); - } - - public static CompatKeyBinding of(String translationKey, int defaultKeyCode) { - return new CompatKeyBinding(translationKey, defaultKeyCode); - } - - public KeyBinding toMinecraft() { - return keyBinding; - } - - public KeyBinding getRaw() { - return keyBinding; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java deleted file mode 100644 index 3bdfa6bfe..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.option; - -import net.minecraft.client.option.GameOptions; - -public class GameOptionsWrapper { - public final GameOptions raw; - - public GameOptionsWrapper(GameOptions options) { - this.raw = options; - } - - public GameOptions getRaw() { - return raw; - } - - public void write() { - raw.write(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java deleted file mode 100644 index 27187f69f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java +++ /dev/null @@ -1,127 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.option; - -import org.lwjgl.glfw.GLFW; - -public class KeyCodes { - public static final int KEY_UNKNOWN = GLFW.GLFW_KEY_UNKNOWN, - KEY_SPACE = GLFW.GLFW_KEY_SPACE, - KEY_APOSTROPHE = GLFW.GLFW_KEY_APOSTROPHE, - KEY_COMMA = GLFW.GLFW_KEY_COMMA, - KEY_MINUS = GLFW.GLFW_KEY_MINUS, - KEY_PERIOD = GLFW.GLFW_KEY_PERIOD, - KEY_SLASH = GLFW.GLFW_KEY_SLASH, - KEY_0 = GLFW.GLFW_KEY_0, - KEY_1 = GLFW.GLFW_KEY_1, - KEY_2 = GLFW.GLFW_KEY_2, - KEY_3 = GLFW.GLFW_KEY_3, - KEY_4 = GLFW.GLFW_KEY_4, - KEY_5 = GLFW.GLFW_KEY_5, - KEY_6 = GLFW.GLFW_KEY_6, - KEY_7 = GLFW.GLFW_KEY_7, - KEY_8 = GLFW.GLFW_KEY_8, - KEY_9 = GLFW.GLFW_KEY_9, - KEY_SEMICOLON = GLFW.GLFW_KEY_SEMICOLON, - KEY_EQUAL = GLFW.GLFW_KEY_EQUAL, - KEY_A = GLFW.GLFW_KEY_A, - KEY_B = GLFW.GLFW_KEY_B, - KEY_C = GLFW.GLFW_KEY_C, - KEY_D = GLFW.GLFW_KEY_D, - KEY_E = GLFW.GLFW_KEY_E, - KEY_F = GLFW.GLFW_KEY_F, - KEY_G = GLFW.GLFW_KEY_G, - KEY_H = GLFW.GLFW_KEY_H, - KEY_I = GLFW.GLFW_KEY_I, - KEY_J = GLFW.GLFW_KEY_J, - KEY_K = GLFW.GLFW_KEY_K, - KEY_L = GLFW.GLFW_KEY_L, - KEY_M = GLFW.GLFW_KEY_M, - KEY_N = GLFW.GLFW_KEY_N, - KEY_O = GLFW.GLFW_KEY_O, - KEY_P = GLFW.GLFW_KEY_P, - KEY_Q = GLFW.GLFW_KEY_Q, - KEY_R = GLFW.GLFW_KEY_R, - KEY_S = GLFW.GLFW_KEY_S, - KEY_T = GLFW.GLFW_KEY_T, - KEY_U = GLFW.GLFW_KEY_U, - KEY_V = GLFW.GLFW_KEY_V, - KEY_W = GLFW.GLFW_KEY_W, - KEY_X = GLFW.GLFW_KEY_X, - KEY_Y = GLFW.GLFW_KEY_Y, - KEY_Z = GLFW.GLFW_KEY_Z, - KEY_LEFT_BRACKET = GLFW.GLFW_KEY_LEFT_BRACKET, - KEY_BACKSLASH = GLFW.GLFW_KEY_BACKSLASH, - KEY_RIGHT_BRACKET = GLFW.GLFW_KEY_RIGHT_BRACKET, - KEY_GRAVE_ACCENT = GLFW.GLFW_KEY_GRAVE_ACCENT, - KEY_WORLD_1 = GLFW.GLFW_KEY_WORLD_1, - KEY_WORLD_2 = GLFW.GLFW_KEY_WORLD_2, - KEY_ESCAPE = GLFW.GLFW_KEY_ESCAPE, - KEY_ENTER = GLFW.GLFW_KEY_ENTER, - KEY_TAB = GLFW.GLFW_KEY_TAB, - KEY_BACKSPACE = GLFW.GLFW_KEY_BACKSPACE, - KEY_INSERT = GLFW.GLFW_KEY_INSERT, - KEY_DELETE = GLFW.GLFW_KEY_DELETE, - KEY_RIGHT = GLFW.GLFW_KEY_RIGHT, - KEY_LEFT = GLFW.GLFW_KEY_LEFT, - KEY_DOWN = GLFW.GLFW_KEY_DOWN, - KEY_UP = GLFW.GLFW_KEY_UP, - KEY_PAGE_UP = GLFW.GLFW_KEY_PAGE_UP, - KEY_PAGE_DOWN = GLFW.GLFW_KEY_PAGE_DOWN, - KEY_HOME = GLFW.GLFW_KEY_HOME, - KEY_END = GLFW.GLFW_KEY_END, - KEY_CAPS_LOCK = GLFW.GLFW_KEY_CAPS_LOCK, - KEY_SCROLL_LOCK = GLFW.GLFW_KEY_SCROLL_LOCK, - KEY_NUM_LOCK = GLFW.GLFW_KEY_NUM_LOCK, - KEY_PRINT_SCREEN = GLFW.GLFW_KEY_PRINT_SCREEN, - KEY_PAUSE = GLFW.GLFW_KEY_PAUSE, - KEY_F1 = GLFW.GLFW_KEY_F1, - KEY_F2 = GLFW.GLFW_KEY_F2, - KEY_F3 = GLFW.GLFW_KEY_F3, - KEY_F4 = GLFW.GLFW_KEY_F4, - KEY_F5 = GLFW.GLFW_KEY_F5, - KEY_F6 = GLFW.GLFW_KEY_F6, - KEY_F7 = GLFW.GLFW_KEY_F7, - KEY_F8 = GLFW.GLFW_KEY_F8, - KEY_F9 = GLFW.GLFW_KEY_F9, - KEY_F10 = GLFW.GLFW_KEY_F10, - KEY_F11 = GLFW.GLFW_KEY_F11, - KEY_F12 = GLFW.GLFW_KEY_F12, - KEY_F13 = GLFW.GLFW_KEY_F13, - KEY_F14 = GLFW.GLFW_KEY_F14, - KEY_F15 = GLFW.GLFW_KEY_F15, - KEY_F16 = GLFW.GLFW_KEY_F16, - KEY_F17 = GLFW.GLFW_KEY_F17, - KEY_F18 = GLFW.GLFW_KEY_F18, - KEY_F19 = GLFW.GLFW_KEY_F19, - KEY_F20 = GLFW.GLFW_KEY_F20, - KEY_F21 = GLFW.GLFW_KEY_F21, - KEY_F22 = GLFW.GLFW_KEY_F22, - KEY_F23 = GLFW.GLFW_KEY_F23, - KEY_F24 = GLFW.GLFW_KEY_F24, - KEY_F25 = GLFW.GLFW_KEY_F25, - KEY_KP_0 = GLFW.GLFW_KEY_KP_0, - KEY_KP_1 = GLFW.GLFW_KEY_KP_1, - KEY_KP_2 = GLFW.GLFW_KEY_KP_2, - KEY_KP_3 = GLFW.GLFW_KEY_KP_3, - KEY_KP_4 = GLFW.GLFW_KEY_KP_4, - KEY_KP_5 = GLFW.GLFW_KEY_KP_5, - KEY_KP_6 = GLFW.GLFW_KEY_KP_6, - KEY_KP_7 = GLFW.GLFW_KEY_KP_7, - KEY_KP_8 = GLFW.GLFW_KEY_KP_8, - KEY_KP_9 = GLFW.GLFW_KEY_KP_9, - KEY_KP_DECIMAL = GLFW.GLFW_KEY_KP_DECIMAL, - KEY_KP_DIVIDE = GLFW.GLFW_KEY_KP_DIVIDE, - KEY_KP_MULTIPLY = GLFW.GLFW_KEY_KP_MULTIPLY, - KEY_KP_SUBTRACT = GLFW.GLFW_KEY_KP_SUBTRACT, - KEY_KP_ADD = GLFW.GLFW_KEY_KP_ADD, - KEY_KP_ENTER = GLFW.GLFW_KEY_KP_ENTER, - KEY_KP_EQUAL = GLFW.GLFW_KEY_KP_EQUAL, - KEY_LEFT_SHIFT = GLFW.GLFW_KEY_LEFT_SHIFT, - KEY_LEFT_CONTROL = GLFW.GLFW_KEY_LEFT_CONTROL, - KEY_LEFT_ALT = GLFW.GLFW_KEY_LEFT_ALT, - KEY_LEFT_SUPER = GLFW.GLFW_KEY_LEFT_SUPER, - KEY_RIGHT_SHIFT = GLFW.GLFW_KEY_RIGHT_SHIFT, - KEY_RIGHT_CONTROL = GLFW.GLFW_KEY_RIGHT_CONTROL, - KEY_RIGHT_ALT = GLFW.GLFW_KEY_RIGHT_ALT, - KEY_RIGHT_SUPER = GLFW.GLFW_KEY_RIGHT_SUPER, - KEY_MENU = GLFW.GLFW_KEY_MENU; -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java deleted file mode 100644 index 944ce9a3b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java +++ /dev/null @@ -1,189 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry; - -import dev.architectury.event.events.client.ClientLifecycleEvent; -import dev.architectury.registry.client.gui.MenuScreenRegistry; -import dev.architectury.registry.client.level.entity.EntityRendererRegistry; -import dev.architectury.registry.client.particle.ParticleProviderRegistry; -import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.particle.ParticleFactory; -import net.minecraft.client.particle.SpriteProvider; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.block.BlockRenderManager; -import net.minecraft.client.render.block.entity.BlockEntityRenderManager; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.minecraft.client.render.entity.EntityRenderManager; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.fluid.Fluid; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleType; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.random.Random; - -import java.util.List; -import java.util.function.Supplier; - -@Deprecated -@Environment(EnvType.CLIENT) -public class ArchRegistryClient { - public static > void registerScreen(ScreenHandlerType type, ScreenFactory factory) { - ClientLifecycleEvent.CLIENT_SETUP.register((state) -> { - - }); - MenuScreenRegistry.registerScreenFactory(type, factory::create); - } - - public interface ScreenFactory> { - S create(H handler, PlayerInventory inventory, Text text); - } - - public static void registerParticle(ParticleType type, ParticleFactory factory) { - ParticleProviderRegistry.register(type, factory); - } - - public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { - ParticleProviderRegistry.register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { - @Override - public SpriteAtlasTexture getAtlas() { - return spriteSet.getAtlas(); - } - - @Override - public List getSprites() { - return spriteSet.getSprites(); - } - - @Override - public Sprite getSprite(int age, int maxAge) { - return spriteSet.getSprite(age, maxAge); - } - - @Override - public Sprite getSprite(Random random) { - return spriteSet.getSprite(random); - } - - @Override - public Sprite getFirst() { - return spriteSet.getFirst(); - } - })); - } - - public static void registerEntityRenderer(Supplier> type, EntityRendererFactory provider) { - EntityRendererRegistry.register(type, provider); - } - - @FunctionalInterface - public interface DeferredParticleProvider { - ParticleFactory create(ExtendedSpriteSet spriteSet); - } - - public interface ExtendedSpriteSet extends SpriteProvider { - SpriteAtlasTexture getAtlas(); - - List getSprites(); - } - - public static void registryClientSpriteAtlasTexture(Identifier identifier) { - //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, identifier); - } - - public static void registryClientSpriteAtlasTexture(Sprite sprite) { - //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, sprite); - } - - public static void registryClientSprite(Identifier atlasId, Identifier identifier) { - // ~1.19.2 - } - - public static void registryClientSprite(Identifier atlasId, Sprite sprite) { - // ~1.19.2 - } - - public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.renderDispatcher(), ctx.renderManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer() - ))); - } - - @FunctionalInterface - public interface BlockEntityRendererFactory { - BlockEntityRenderer create(BlockEntityRendererFactory.Context ctx); - - class Context { - private final BlockEntityRenderManager renderDispatcher; - private final BlockRenderManager renderManager; - private final ItemRenderer itemRenderer; - private final EntityRenderManager entityRenderDispatcher; - private final LoadedEntityModels layerRenderDispatcher; - private final TextRenderer textRenderer; - - public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager renderManager, ItemRenderer itemRenderer, EntityRenderManager entityRenderDispatcher, LoadedEntityModels layerRenderDispatcher, TextRenderer textRenderer) { - this.renderDispatcher = renderDispatcher; - this.renderManager = renderManager; - this.itemRenderer = itemRenderer; - this.entityRenderDispatcher = entityRenderDispatcher; - this.layerRenderDispatcher = layerRenderDispatcher; - this.textRenderer = textRenderer; - } - - public BlockEntityRenderManager getRenderDispatcher() { - return this.renderDispatcher; - } - - public BlockRenderManager getRenderManager() { - return this.renderManager; - } - - public EntityRenderManager getEntityRenderDispatcher() { - return this.entityRenderDispatcher; - } - - public ItemRenderer getItemRenderer() { - return this.itemRenderer; - } - - public LoadedEntityModels getLayerRenderDispatcher() { - return this.layerRenderDispatcher; - } - - public ModelPart getLayerModelPart(EntityModelLayer modelLayer) { - return this.layerRenderDispatcher.getModelPart(modelLayer); - } - - public TextRenderer getTextRenderer() { - return this.textRenderer; - } - } - } - - - public static void registerRenderTypeBlock(RenderLayer layer, Block block) { - CompatRegistryClient.registerRenderTypeBlock(layer, block); - } - - public static void registerRenderTypeFluid(RenderLayer layer, Fluid fluid) { - CompatRegistryClient.registerRenderTypeFluid(layer, fluid); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java deleted file mode 100644 index d25dd96ee..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java +++ /dev/null @@ -1,278 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry; - -import dev.architectury.injectables.annotations.ExpectPlatform; -import dev.architectury.registry.client.gui.MenuScreenRegistry; -import dev.architectury.registry.client.level.entity.EntityModelLayerRegistry; -import dev.architectury.registry.client.level.entity.EntityRendererRegistry; -import dev.architectury.registry.client.particle.ParticleProviderRegistry; -import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry; -import dev.architectury.registry.client.rendering.RenderTypeRegistry; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.client.color.block.BlockColorProvider; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.client.item.ItemModelManager; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.model.TexturedModelData; -import net.minecraft.client.particle.ParticleFactory; -import net.minecraft.client.particle.SpriteProvider; -import net.minecraft.client.render.BlockRenderLayer; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.RenderLayers; -import net.minecraft.client.render.block.BlockRenderManager; -import net.minecraft.client.render.block.entity.BlockEntityRenderManager; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.minecraft.client.render.entity.EntityRenderManager; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.texture.PlayerSkinCache; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.texture.SpriteHolder; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.fluid.Fluid; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleType; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.random.Random; -import net.pitan76.mcpitanlib.MCPitanLib; -import net.pitan76.mcpitanlib.api.client.color.CompatBlockColorProvider; -import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; -import net.pitan76.mcpitanlib.api.client.render.EntityModelLayerContext; - -import java.util.List; -import java.util.function.Supplier; - -@Environment(EnvType.CLIENT) -public class CompatRegistryClient { - public static > void registerScreen(ScreenHandlerType type, ScreenFactory factory) { - registerScreen(MCPitanLib.MOD_ID, type, factory); - } - - public static > void registerScreen(String modId, ScreenHandlerType type, ScreenFactory factory) { - MenuScreenRegistry.registerScreenFactory(type, factory::create); - } - - public interface ScreenFactory> { - S create(H handler, PlayerInventory inventory, Text text); - } - - public static void registerParticle(ParticleType type, ParticleFactory factory) { - ParticleProviderRegistry.register(type, factory); - } - - public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { - ParticleProviderRegistry.register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { - @Override - public SpriteAtlasTexture getAtlas() { - return spriteSet.getAtlas(); - } - - @Override - public List getSprites() { - return spriteSet.getSprites(); - } - - @Override - public Sprite getSprite(int age, int maxAge) { - return spriteSet.getSprite(age, maxAge); - } - - @Override - public Sprite getSprite(Random random) { - return spriteSet.getSprite(random); - } - - @Override - public Sprite getFirst() { - return spriteSet.getFirst(); - } - })); - } - - public static void registerEntityModelLayer(EntityModelLayer layer, EntityModelLayerContext context) { - EntityModelLayerRegistry.register(layer, () -> TexturedModelData.of(context.getData(), context.getWidth(), context.getHeight())); - } - - public static void registerEntityRenderer(Supplier> type, EntityRendererFactory provider) { - EntityRendererRegistry.register(type, provider); - } - - @FunctionalInterface - public interface DeferredParticleProvider { - ParticleFactory create(ExtendedSpriteSet spriteSet); - } - - public interface ExtendedSpriteSet extends SpriteProvider { - SpriteAtlasTexture getAtlas(); - - List getSprites(); - } - - public static void registryClientSpriteAtlasTexture(Identifier identifier) { - //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, identifier); - } - - public static void registryClientSpriteAtlasTexture(Sprite sprite) { - //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, sprite); - } - - public static void registryClientSprite(Identifier atlasId, Identifier identifier) { - // ~1.19.2 - } - - public static void registryClientSprite(Identifier atlasId, Sprite sprite) { - // ~1.19.2 - } - - public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache() - ))); - } - - @FunctionalInterface - public interface BlockEntityRendererFactory { - BlockEntityRenderer create(Context ctx); - - class Context { - private final BlockEntityRenderManager renderDispatcher; - private final BlockRenderManager renderManager; - private final ItemModelManager itemModelManager; - private final ItemRenderer itemRenderer; - private final EntityRenderManager entityRenderDispatcher; - private final LoadedEntityModels layerRenderDispatcher; - private final TextRenderer textRenderer; - private final SpriteHolder spriteHolder; - - private final PlayerSkinCache playerSkinRenderCache; - - public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager renderManager, ItemModelManager itemModelManager, ItemRenderer itemRenderer, EntityRenderManager entityRenderDispatcher, LoadedEntityModels layerRenderDispatcher, TextRenderer textRenderer, SpriteHolder spriteHolder, PlayerSkinCache playerSkinRenderCache) { - this.renderDispatcher = renderDispatcher; - this.renderManager = renderManager; - this.itemModelManager = itemModelManager; - this.itemRenderer = itemRenderer; - this.entityRenderDispatcher = entityRenderDispatcher; - this.layerRenderDispatcher = layerRenderDispatcher; - this.textRenderer = textRenderer; - this.spriteHolder = spriteHolder; - this.playerSkinRenderCache = playerSkinRenderCache; - } - - public BlockEntityRenderManager getRenderDispatcher() { - return this.renderDispatcher; - } - - public BlockRenderManager getRenderManager() { - return this.renderManager; - } - - public EntityRenderManager getEntityRenderDispatcher() { - return this.entityRenderDispatcher; - } - - public ItemModelManager getItemModelManager() { - return itemModelManager; - } - - public ItemRenderer getItemRenderer() { - return this.itemRenderer; - } - - public LoadedEntityModels getLayerRenderDispatcher() { - return this.layerRenderDispatcher; - } - - public ModelPart getLayerModelPart(EntityModelLayer modelLayer) { - return this.layerRenderDispatcher.getModelPart(modelLayer); - } - - public TextRenderer getTextRenderer() { - return this.textRenderer; - } - - public SpriteHolder getSpriteHolder() { - return spriteHolder; - } - - public PlayerSkinCache getPlayerSkinRenderCache() { - return playerSkinRenderCache; - } - } - } - - - public static void registerRenderTypeBlock(RenderLayer layer, Block block) { - BlockRenderLayer blockRenderLayer = null; - if (layer == RenderLayers.cutout()) { - blockRenderLayer = BlockRenderLayer.CUTOUT; - } else if (layer == RenderLayers.glintTranslucent()) { - blockRenderLayer = BlockRenderLayer.TRANSLUCENT; - } else if (layer == RenderLayers.solid()) { - blockRenderLayer = BlockRenderLayer.SOLID; - } else if (layer == RenderLayers.tripwire()) { - blockRenderLayer = BlockRenderLayer.TRIPWIRE; - } - - if (blockRenderLayer == null) return; - - RenderTypeRegistry.register(blockRenderLayer, block); - } - - public static void registerRenderTypeFluid(RenderLayer layer, Fluid fluid) { - BlockRenderLayer blockRenderLayer = null; - if (layer == RenderLayers.cutout()) { - blockRenderLayer = BlockRenderLayer.CUTOUT; - } else if (layer == RenderLayers.glintTranslucent()) { - blockRenderLayer = BlockRenderLayer.TRANSLUCENT; - } else if (layer == RenderLayers.solid()) { - blockRenderLayer = BlockRenderLayer.SOLID; - } else if (layer == RenderLayers.tripwire()) { - blockRenderLayer = BlockRenderLayer.TRIPWIRE; - } - - if (blockRenderLayer == null) return; - - RenderTypeRegistry.register(blockRenderLayer, fluid); - } - - public static void registerCutoutBlock(Block block) { - registerRenderTypeBlock(RenderLayers.cutout(), block); - } - - public static void registerCompatBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache() - ))); - } - - public static void registerRenderTypeBlock(CompatRenderLayer layer, Block block) { - registerRenderTypeBlock(layer.layer, block); - } - - public static void registerRenderTypeFluid(CompatRenderLayer layer, Fluid fluid) { - registerRenderTypeFluid(layer.layer, fluid); - } - - @ExpectPlatform - public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { - throw new AssertionError("This method should be replaced by the platform implementation"); - } - - public static void registerColorProviderBlock(CompatBlockColorProvider provider, Block... blocks) { - registerColorProviderBlock((BlockColorProvider) provider, blocks); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java deleted file mode 100644 index 7fa99982f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry; - -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.FlyingItemEntityRenderer; -import net.minecraft.entity.EntityType; - -import java.util.function.Supplier; - -public class EntityRendererRegistry { - public static void registerEntityRendererAsFlyingItem(Supplier> entityType) { - CompatRegistryClient.registerEntityRenderer(entityType, (ctx -> (EntityRenderer) new FlyingItemEntityRenderer<>(ctx))); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java deleted file mode 100644 index 771f39bc4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry; - -import dev.architectury.registry.client.keymappings.KeyMappingRegistry; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; -import net.pitan76.mcpitanlib.api.network.ClientNetworking; -import net.pitan76.mcpitanlib.api.network.PacketByteUtil; - -public class KeybindingRegistry { - public static void register(KeyBinding keyBinding) { - KeyMappingRegistry.register(keyBinding); - } - - public static void register(KeyBinding keyBinding, ClientTickEventRegistry.Client client) { - register(keyBinding); - ClientTickEventRegistry.registerPost(client); - } - - public static void registerOnLevel(KeyBinding keyBinding, ClientTickEventRegistry.ClientLevel level) { - register(keyBinding); - ClientTickEventRegistry.registerLevelPost(level); - } - - public static void registerWithNetwork(KeyBinding keyBinding, Identifier identifier) { - register(keyBinding, client -> { - if (keyBinding.wasPressed()) - ClientNetworking.send(identifier, PacketByteUtil.create()); - }); - } - - public static void registerOnLevelWithNetwork(KeyBinding keyBinding, Identifier identifier) { - registerOnLevel(keyBinding, client -> { - if (keyBinding.wasPressed()) - ClientNetworking.send(identifier, PacketByteUtil.create()); - }); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java deleted file mode 100644 index e1c746e02..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry.v2; - -import net.minecraft.client.option.KeyBinding; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class KeybindingRegistry extends net.pitan76.mcpitanlib.api.client.registry.KeybindingRegistry { - - public static void registerWithNetwork(KeyBinding keyBinding, CompatIdentifier identifier) { - registerWithNetwork(keyBinding, identifier.toMinecraft()); - } - - public static void registerOnLevelWithNetwork(KeyBinding keyBinding, CompatIdentifier identifier) { - registerOnLevelWithNetwork(keyBinding, identifier.toMinecraft()); - } - - public static void registerWithNetwork(String translationKey, int code, String category, CompatIdentifier identifier) { - registerWithNetwork(new KeyBinding(translationKey, code, KeyBinding.Category.create(CompatIdentifier.of(category).toMinecraft())), identifier); - } - - public static void registerOnLevelWithNetwork(String translationKey, int code, String category, CompatIdentifier identifier) { - // TODO: categoryの互換性 - registerOnLevelWithNetwork(new KeyBinding(translationKey, code, KeyBinding.Category.create(CompatIdentifier.of(category).toMinecraft())), identifier); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java deleted file mode 100644 index 91f382b28..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry.v3; - -import net.pitan76.mcpitanlib.api.client.option.CompatKeyBinding; -import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class KeybindingRegistry { - public static void registerWithNetwork(CompatKeyBinding keyBinding, CompatIdentifier networkId) { - net.pitan76.mcpitanlib.api.client.registry.v2.KeybindingRegistry.registerWithNetwork(keyBinding.toMinecraft(), networkId.toMinecraft()); - } - - public static void registerOnLevelWithNetwork(CompatKeyBinding keyBinding, CompatIdentifier networkId) { - net.pitan76.mcpitanlib.api.client.registry.v2.KeybindingRegistry.registerOnLevelWithNetwork(keyBinding.toMinecraft(), networkId.toMinecraft()); - } - - public static void registerWithNetwork(String translationKey, int code, CompatIdentifier category, CompatIdentifier networkId) { - registerWithNetwork(CompatKeyBinding.of(translationKey, code, category), networkId); - } - - public static void registerOnLevelWithNetwork(String translationKey, int code, CompatIdentifier category, CompatIdentifier networkId) { - registerOnLevelWithNetwork(CompatKeyBinding.of(translationKey, code, category), networkId); - } - - public static void register(CompatKeyBinding keyBinding) { - net.pitan76.mcpitanlib.api.client.registry.KeybindingRegistry.register(keyBinding.toMinecraft()); - } - - public static void register(CompatKeyBinding keyBinding, ClientTickEventRegistry.Client client) { - register(keyBinding); - ClientTickEventRegistry.registerPost(client); - } - - public static void registerOnLevel(CompatKeyBinding keyBinding, ClientTickEventRegistry.ClientLevel level) { - register(keyBinding); - ClientTickEventRegistry.registerLevelPost(level); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java deleted file mode 100644 index 6961e1ffd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render; - -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.RenderLayers; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class CompatRenderLayer { - public static final CompatRenderLayer CUTOUT = new CompatRenderLayer(RenderLayers.cutout()); - public static final CompatRenderLayer CUTOUT_MIPPED = new CompatRenderLayer(RenderLayers.cutout()); - public static final CompatRenderLayer TRANSLUCENT = new CompatRenderLayer(RenderLayers.glintTranslucent()); - public static final CompatRenderLayer TRANSLUCENT_MOVING_BLOCK = new CompatRenderLayer(RenderLayers.translucentMovingBlock()); - public static final CompatRenderLayer SOLID = new CompatRenderLayer(RenderLayers.solid()); - public static final CompatRenderLayer LINES = new CompatRenderLayer(RenderLayers.lines()); - public static final CompatRenderLayer LINE_STRIP = new CompatRenderLayer(RenderLayers.linesTranslucent()); - public static final CompatRenderLayer GLINT = new CompatRenderLayer(RenderLayers.glint()); - - public final RenderLayer layer; - - public CompatRenderLayer(RenderLayer layer) { - this.layer = layer; - } - - public RenderLayer raw() { - return layer; - } - - public static CompatRenderLayer getEntityCutout(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entityCutout(id.toMinecraft())); - } - - public static CompatRenderLayer getEntityCutoutNoCull(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entityCutoutNoCull(id.toMinecraft())); - } - - public static CompatRenderLayer getEntityTranslucent(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entityTranslucent(id.toMinecraft())); - } - - public static CompatRenderLayer getArmorCutoutNoCull(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.armorCutoutNoCull(id.toMinecraft())); - } - - public static CompatRenderLayer getEntitySolid(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entitySolid(id.toMinecraft())); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java deleted file mode 100644 index e262ba0a3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java +++ /dev/null @@ -1,101 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render; - -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; -import org.joml.Matrix3x2f; -import org.joml.Matrix3x2fStack; - -public class DrawObjectDM { - private MatrixStack stack; - private Matrix3x2fStack matrix3x2fStack; - private DrawContext context; - - private Screen screen = null; - - public DrawObjectDM(DrawContext context) { - this.context = context; - this.matrix3x2fStack = context.getMatrices(); - } - - public DrawObjectDM(Matrix3x2fStack matrix3x2fStack) { - this.matrix3x2fStack = matrix3x2fStack; - } - - public DrawObjectDM(MatrixStack stack) { - this.stack = stack; - } - - public DrawObjectDM(DrawContext context, Screen screen) { - this(context); - this.screen = screen; - } - - public DrawContext getContext() { - return context; - } - - public MatrixStack getStack() { - return stack; - } - - public Screen getScreen() { - return screen; - } - - public void setContext(DrawContext context) { - this.context = context; - } - - public void setStack(MatrixStack stack) { - this.stack = stack; - } - - public void setScreen(Screen screen) { - this.screen = screen; - } - - public boolean hasScreen() { - return screen != null; - } - - public void drawTexture(CompatIdentifier texture, int x, int y, float u, float v, int width, int height) { - RendererUtil.drawTexture(this, texture, x, y, u, v, width, height); - } - - public void drawTexture(CompatIdentifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { - RendererUtil.drawTexture(this, texture, x, y, u, v, width, height, textureWidth, textureHeight); - } - - public void drawText(Text text, int x, int y) { - RendererUtil.drawText(RendererUtil.getTextRenderer(), this, text, x, y); - } - - public void drawTooltip(Text text, int x, int y) { - RendererUtil.drawTooltip(this, text, x, y); - } - - public void drawText(TextComponent text, int x, int y) { - RendererUtil.drawText(RendererUtil.getTextRenderer(), this, text, x, y); - } - - public void drawTooltip(TextComponent text, int x, int y) { - RendererUtil.drawTooltip(this, text, x, y); - } - - public void drawBorder(int x, int y, int width, int height, int color) { - RendererUtil.drawBorder(this, x, y, width, height, color); - } - - public int getWidth() { - return hasScreen() ? screen.width : -1; - } - - public int getHeight() { - return hasScreen() ? screen.height : -1; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java deleted file mode 100644 index 37e2df47d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java +++ /dev/null @@ -1,119 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render; - -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; -import net.pitan76.mcpitanlib.api.util.client.render.VertexConsumerUtil; -import org.joml.Matrix3f; -import org.joml.Matrix4f; - -public class DrawObjectMV { - private final MatrixStack stack; - private final VertexConsumer buffer; - - public DrawObjectMV(MatrixStack stack, VertexConsumer buffer) { - this.stack = stack; - this.buffer = buffer; - } - - public DrawObjectMV(MatrixStack stack) { - this(stack, null); - } - - public DrawObjectMV(VertexConsumer buffer) { - this(null, buffer); - } - - public MatrixStack getStack() { - return stack; - } - - public VertexConsumer getBuffer() { - return buffer; - } - - public DrawObjectMV vertex(float x, float y, float z) { - return VertexConsumerUtil.vertex(this, x, y, z); - } - - public DrawObjectMV normal(float x, float y, float z) { - return VertexConsumerUtil.normal(this, x, y, z); - } - - public DrawObjectMV color(float red, float green, float blue, float alpha) { - return VertexConsumerUtil.color(this, red, green, blue, alpha); - } - - public DrawObjectMV color(int red, int green, int blue, int alpha) { - return VertexConsumerUtil.color(this, red, green, blue, alpha); - } - - public DrawObjectMV colorARGB(int argb) { - return VertexConsumerUtil.colorARGB(this, argb); - } - - public DrawObjectMV colorRGB(int rgb) { - return VertexConsumerUtil.colorRGB(this, rgb); - } - - public DrawObjectMV light(int light) { - return VertexConsumerUtil.light(this, light); - } - - public DrawObjectMV overlay(int overlay) { - return VertexConsumerUtil.overlay(this, overlay); - } - - public DrawObjectMV overlayDefaultUV() { - return VertexConsumerUtil.overlayDefaultUV(this); - } - - public Matrix4f matrix4f; - public Matrix3f matrix3f; - - public Matrix4f getMatrix4f() { - if (matrix4f == null) - matrix4f = stack.peek().getPositionMatrix(); - - return matrix4f; - } - - public Matrix3f getMatrix3f() { - if (matrix3f == null) - matrix3f = stack.peek().getNormalMatrix(); - - return matrix3f; - } - - public DrawObjectMV vertexWithMatrix4f(float x, float y, float z) { - VertexConsumerUtil.vertex(buffer, getMatrix4f(), x, y, z); - return this; - } - - public DrawObjectMV vertexWithMatrix(float x, float y, float z) { - VertexConsumerUtil.vertex(buffer, stack, x, y, z); - return this; - } - - public DrawObjectMV normalWithMatrix(float x, float y, float z) { - VertexConsumerUtil.normal(buffer, stack, x, y, z); - return this; - } - - public DrawObjectMV texture(float u, float v) { - VertexConsumerUtil.texture(buffer, u, v); - return this; - } - - public DrawObjectMV next() { - VertexConsumerUtil.next(buffer); - return this; - } - - public void renderQuad(float x1, float y1, float z1, float x2, float y2, float z2, - float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { - VertexConsumerUtil.renderQuad(buffer, stack, getMatrix4f(), getMatrix3f(), - x1, y1, z1, x2, y2, z2, - normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java deleted file mode 100644 index d1d343924..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render; - -import net.minecraft.client.model.ModelData; - -public class EntityModelLayerContext { - private final ModelData data; - private final int width; - private final int height; - - public EntityModelLayerContext(ModelData data, int width, int height) { - this.data = data; - this.width = width; - this.height = height; - } - - public int getHeight() { - return height; - } - - public int getWidth() { - return width; - } - - public ModelData getData() { - return data; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java deleted file mode 100644 index 7e70f8046..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java +++ /dev/null @@ -1,45 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.block.entity; - -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.minecraft.client.render.command.OrderedRenderCommandQueue; -import net.minecraft.client.render.state.CameraRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Vec3d; -import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; - -@Deprecated -public interface CompatBlockEntityRenderer extends BlockEntityRenderer { - void render(BlockEntityRenderEvent event); - - default void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - render(new BlockEntityRenderEvent<>(this, entity, tickProgress, matrices, vertexConsumers, light, overlay)); - } - - @Override - default void render(S state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { - render(new BlockEntityRenderEvent<>(this, state, matrices, queue, cameraState)); - } - - default boolean rendersOutsideBoundingBoxOverride(T blockEntity) { - return BlockEntityRenderer.super.rendersOutsideBoundingBox(); - } - - default int getRenderDistanceOverride() { - return BlockEntityRenderer.super.getRenderDistance(); - } - - @Deprecated - @Override - default boolean rendersOutsideBoundingBox() { - return rendersOutsideBoundingBoxOverride(null); - } - - @Deprecated - @Override - default int getRenderDistance() { - return getRenderDistanceOverride(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java deleted file mode 100644 index 67ed76f71..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java +++ /dev/null @@ -1,200 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.block.entity.event; - -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.BlockRenderLayer; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.minecraft.client.render.command.OrderedRenderCommandQueue; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.render.state.CameraRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; -import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; -import net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; -import net.pitan76.mcpitanlib.api.util.MathUtil; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; -import net.pitan76.mcpitanlib.api.util.client.MatrixStackUtil; -import net.pitan76.mcpitanlib.api.util.client.render.CompatItemRenderUtil; -import org.joml.Matrix3f; -import org.joml.Matrix4f; - -public class BlockEntityRenderEvent { - public T blockEntity; - public float tickDelta; - public MatrixStack matrices; - public VertexConsumerProvider vertexConsumers; - int light; - int overlay; - - public BlockEntityRenderEvent(T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { - this.blockEntity = blockEntity; - this.tickDelta = tickDelta; - this.matrices = matrices; - this.vertexConsumers = vertexConsumers; - this.light = light; - this.overlay = overlay; - } - - private BlockEntityRenderState state; - private OrderedRenderCommandQueue queue; - private CameraRenderState cameraState; - - - public BlockEntityRenderEvent(S state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { - this.state = state; - this.queue = queue; - this.cameraState = cameraState; - - this.matrices = matrices; - this.queue = queue; - this.cameraState = cameraState; - this.tickDelta = MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); - BlockEntity blockEntity = state.type.get(MinecraftClient.getInstance().world, state.pos); - if (blockEntity instanceof CompatBlockEntity) { - this.blockEntity = (T) blockEntity; - } else { - //throw new IllegalArgumentException("BlockEntityRenderEvent: BlockEntity is not an instance of CompatBlockEntity"); - } - - this.vertexConsumers = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers(); - this.light = state.lightmapCoordinates; - if (state.crumblingOverlay != null) - this.overlay = state.crumblingOverlay.progress(); - else - this.overlay = 0; - } - - public T getBlockEntity() { - return blockEntity; - } - - public MatrixStack getMatrices() { - return matrices; - } - - public float getTickDelta() { - return tickDelta; - } - - public int getLight() { - return light; - } - - public int getOverlay() { - return overlay; - } - - public VertexConsumer getVertexConsumer(RenderLayer layer) { - return vertexConsumers.getBuffer(layer); - } - - public VertexConsumer getVertexConsumer(CompatRenderLayer layer) { - return getVertexConsumer(layer.raw()); - } - - public VertexConsumerProvider getVertexConsumers() { - return vertexConsumers; - } - - public void push() { - MatrixStackUtil.push(matrices); - } - - public void translate(double x, double y, double z) { - MatrixStackUtil.translate(matrices, x, y, z); - } - - public void pop() { - MatrixStackUtil.pop(matrices); - } - - public void multiply(MathUtil.RotationAxisType type, float deg) { - MatrixStackUtil.multiply(matrices, type, deg); - } - - public void scale(float x, float y, float z) { - MatrixStackUtil.scale(matrices, x, y, z); - } - - public ItemRenderer getItemRenderer() { - return ClientUtil.getItemRenderer(); - } - - public boolean isRemoved() { - return blockEntity.isRemoved(); - } - - public DrawObjectMV getDrawObject(CompatRenderLayer layer) { - return new DrawObjectMV(getMatrices(), getVertexConsumer(layer)); - } - - public Matrix4f matrix4f; - public Matrix3f matrix3f; - - public Matrix4f getMatrix4f() { - if (matrix4f == null) - matrix4f = matrices.peek().getPositionMatrix(); - - return matrix4f; - } - - public Matrix3f getMatrix3f() { - if (matrix3f == null) - matrix3f = matrices.peek().getNormalMatrix(); - - return matrix3f; - } - - public BlockPos getPos() { - return state.pos; - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getPos()); - } - - //---- - - @Deprecated - public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; - - public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { - this(blockEntity, tickDelta, matrices, vertexConsumers, light, overlay); - if (renderer instanceof net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) { - this.ctx = ((net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) renderer).ctx; - } - } - - public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, BlockEntityRenderState state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { - this(state, matrices, queue, cameraState); - if (renderer instanceof net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) { - this.ctx = ((net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) renderer).ctx; - } - } - - public void renderItemFixed(ItemStack stack) { - CompatItemRenderUtil.renderItemFixed(stack, this, blockEntity.callGetWorld()); - } - - @Deprecated - public OrderedRenderCommandQueue getQueue() { - return queue; - } - - @Deprecated - public BlockEntityRenderState getState() { - return state; - } - - @Deprecated - public CameraRenderState getCameraState() { - return cameraState; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java deleted file mode 100644 index 8af118910..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.block.entity.event; - -import net.minecraft.client.render.block.entity.BlockEntityRenderManager; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; - -public class CompatBlockEntityRendererConstructArgs { - public final BlockEntityRenderManager dispatcher; - - public CompatBlockEntityRendererConstructArgs(BlockEntityRenderManager dispatcher) { - this.dispatcher = dispatcher; - } - - public CompatBlockEntityRendererConstructArgs() { - this(ClientUtil.getClient().getBlockEntityRenderDispatcher()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java deleted file mode 100644 index c28f891a7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.block.entity.v2; - -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; -import net.pitan76.mcpitanlib.api.client.render.block.entity.event.CompatBlockEntityRendererConstructArgs; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; - -public abstract class CompatBlockEntityRenderer implements net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer { - - @Deprecated - public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; - - public CompatBlockEntityRenderer(CompatBlockEntityRendererConstructArgs args) { - - } - - public CompatBlockEntityRenderer(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { - this.ctx = ctx; - } - - @Override - public BlockEntityRenderState createRenderState() { - return new BlockEntityRenderState(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java deleted file mode 100644 index 4c0a4ab27..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.handledscreen; - -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; - -public class DrawBackgroundArgs { - public DrawObjectDM drawObjectDM; - public float delta; - public int mouseX, mouseY; - - public DrawBackgroundArgs(DrawObjectDM drawObjectDM, float delta, int mouseX, int mouseY) { - setDrawObjectDM(drawObjectDM); - setDelta(delta); - setMouseX(mouseX); - setMouseY(mouseY); - } - - public void setDrawObjectDM(DrawObjectDM drawObjectDM) { - this.drawObjectDM = drawObjectDM; - } - - public void setDelta(float delta) { - this.delta = delta; - } - - public void setMouseX(int mouseX) { - this.mouseX = mouseX; - } - - public void setMouseY(int mouseY) { - this.mouseY = mouseY; - } - - public DrawObjectDM getDrawObjectDM() { - return drawObjectDM; - } - - public float getDelta() { - return delta; - } - - public int getMouseX() { - return mouseX; - } - - public int getMouseY() { - return mouseY; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java deleted file mode 100644 index 643a5bf80..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.handledscreen; - -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; - -public class DrawForegroundArgs { - public DrawObjectDM drawObjectDM; - public int mouseX, mouseY; - - public DrawForegroundArgs(DrawObjectDM drawObjectDM, int mouseX, int mouseY) { - setDrawObjectDM(drawObjectDM); - setMouseX(mouseX); - setMouseY(mouseY); - } - - public void setDrawObjectDM(DrawObjectDM drawObjectDM) { - this.drawObjectDM = drawObjectDM; - } - - public void setMouseX(int mouseX) { - this.mouseX = mouseX; - } - - public void setMouseY(int mouseY) { - this.mouseY = mouseY; - } - - public DrawObjectDM getDrawObjectDM() { - return drawObjectDM; - } - - public int getMouseX() { - return mouseX; - } - - public int getMouseY() { - return mouseY; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java deleted file mode 100644 index 652c5ed68..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.handledscreen; - -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; - -public class DrawMouseoverTooltipArgs { - public DrawObjectDM drawObjectDM; - public int mouseX, mouseY; - - public DrawMouseoverTooltipArgs(DrawObjectDM drawObjectDM, int mouseX, int mouseY) { - setDrawObjectDM(drawObjectDM); - setMouseX(mouseX); - setMouseY(mouseY); - } - - public void setDrawObjectDM(DrawObjectDM drawObjectDM) { - this.drawObjectDM = drawObjectDM; - } - - public void setMouseX(int mouseX) { - this.mouseX = mouseX; - } - - public void setMouseY(int mouseY) { - this.mouseY = mouseY; - } - - public DrawObjectDM getDrawObjectDM() { - return drawObjectDM; - } - - public int getMouseX() { - return mouseX; - } - - public int getMouseY() { - return mouseY; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java deleted file mode 100644 index 45c4ceeed..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.handledscreen; - -public class KeyEventArgs { - public int keyCode, scanCode, modifiers; - - public KeyEventArgs(int keyCode, int scanCode, int modifiers) { - setKeyCode(keyCode); - setScanCode(scanCode); - setModifiers(modifiers); - } - - public void setKeyCode(int keyCode) { - this.keyCode = keyCode; - } - - public void setModifiers(int modifiers) { - this.modifiers = modifiers; - } - - public void setScanCode(int scanCode) { - this.scanCode = scanCode; - } - - public int getKeyCode() { - return keyCode; - } - - public int getModifiers() { - return modifiers; - } - - public int getScanCode() { - return scanCode; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java deleted file mode 100644 index 8b4905d78..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.handledscreen; - -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; - -public class RenderArgs { - public DrawObjectDM drawObjectDM; - public float delta; - public int mouseX, mouseY; - - public RenderArgs(DrawObjectDM drawObjectDM, int mouseX, int mouseY, float delta) { - setDrawObjectDM(drawObjectDM); - setDelta(delta); - setMouseX(mouseX); - setMouseY(mouseY); - } - - public void setDrawObjectDM(DrawObjectDM drawObjectDM) { - this.drawObjectDM = drawObjectDM; - } - - public void setDelta(float delta) { - this.delta = delta; - } - - public void setMouseX(int mouseX) { - this.mouseX = mouseX; - } - - public void setMouseY(int mouseY) { - this.mouseY = mouseY; - } - - public DrawObjectDM getDrawObjectDM() { - return drawObjectDM; - } - - public float getDelta() { - return delta; - } - - public int getMouseX() { - return mouseX; - } - - public int getMouseY() { - return mouseY; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java deleted file mode 100644 index 610b56280..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.render.screen; - -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; - -public class RenderBackgroundTextureArgs { - public DrawObjectDM drawObjectDM; - int vOffset; - - public RenderBackgroundTextureArgs(DrawObjectDM drawObjectDM, int vOffset) { - this.drawObjectDM = drawObjectDM; - this.vOffset = vOffset; - } - - public RenderBackgroundTextureArgs(RenderArgs args) { - this(args.drawObjectDM, 0); - } - - public DrawObjectDM getDrawObjectDM() { - return drawObjectDM; - } - - public int getvOffset() { - return vOffset; - } - - public void setDrawObjectDM(DrawObjectDM drawObjectDM) { - this.drawObjectDM = drawObjectDM; - } - - public void setvOffset(int vOffset) { - this.vOffset = vOffset; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java deleted file mode 100644 index 5b2fbdf00..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.pitan76.mcpitanlib.api.command; - -import net.pitan76.mcpitanlib.api.command.argument.RequiredCommand; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -import java.util.HashMap; -import java.util.Map; - -public abstract class AbstractCommand { - - private Map> argumentCommands = new HashMap<>(); - public int isSuccess = 1; - - public void init() { - - } - - public void init(CommandSettings settings) { - init(); - } - - public void success() { - isSuccess = 1; - } - - public void failure() { - isSuccess = 0; - } - - public Map> getArgumentCommands() { - return argumentCommands; - } - - public void setArgumentCommands(Map> argumentCommands) { - this.argumentCommands = argumentCommands; - } - - public void addArgumentCommand(String name, AbstractCommand command) { - getArgumentCommands().put(name, command); - } - - public void addArgumentCommand(RequiredCommand command) { - getArgumentCommands().put(command.getArgumentName(), command); - } - - public abstract void execute(ServerCommandEvent event); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java deleted file mode 100644 index 03467b2a7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java +++ /dev/null @@ -1,125 +0,0 @@ -package net.pitan76.mcpitanlib.api.command; - -import com.mojang.brigadier.builder.ArgumentBuilder; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import dev.architectury.event.events.common.CommandRegistrationEvent; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.pitan76.mcpitanlib.api.command.argument.*; -import net.pitan76.mcpitanlib.api.event.*; - -import java.util.Map; - -public class CommandRegistry { - - @Deprecated - public static CommandRegistryAccess latestCommandRegistryAccess; - - public static void register(String name, LiteralCommand command) { - CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { - latestCommandRegistryAccess = registry; - - CommandSettings settings = new CommandSettings(); - command.init(settings); - - LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(name).requires(settings::requires) - .executes(context -> { - ServerCommandEvent event = new ServerCommandEvent(); - event.setContext(context); - command.execute(event); - return command.isSuccess; - }); - - forArgsCmd(command, builder); - - //register(builder); - dispatcher.register(builder); - }); - } - - public static void register(LiteralArgumentBuilder builder) { - CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { - latestCommandRegistryAccess = registry; - dispatcher.register(builder); - } - ); - } - - private static > void forArgsCmd(AbstractCommand absCmd, ArgumentBuilder builder) { - - if (!absCmd.getArgumentCommands().isEmpty()) { - // 引数コマンド - for (Map.Entry> argCmd : absCmd.getArgumentCommands().entrySet()) { - ArgumentBuilder nextBuilder = null; - argCmd.getValue().init(new CommandSettings()); - - if (argCmd.getValue() instanceof LiteralCommand) { - LiteralCommand command = (LiteralCommand) argCmd.getValue(); - nextBuilder = CommandManager.literal(argCmd.getKey()) - .executes(context -> { - ServerCommandEvent event = new ServerCommandEvent(); - event.setContext(context); - event.setCommand(command); - command.execute(event); - return command.isSuccess; - } - ); - } - - if (argCmd.getValue() instanceof RequiredCommand) { - RequiredCommand command = (RequiredCommand) argCmd.getValue(); - - nextBuilder = CommandManager.argument(argCmd.getKey(), command.getArgumentType()) - .executes(context -> { - ServerCommandEvent event = new ServerCommandEvent(); - if (command instanceof IntegerCommand) { - event = new IntegerCommandEvent(); - } - if (command instanceof DoubleCommand) { - event = new DoubleCommandEvent(); - } - if (command instanceof FloatCommand) { - event = new FloatCommandEvent(); - } - if (command instanceof LongCommand) { - event = new LongCommandEvent(); - } - if (command instanceof BooleanCommand) { - event = new BooleanCommandEvent(); - } - if (command instanceof StringCommand) { - event = new StringCommandEvent(); - } - if (command instanceof EntityCommand) { - event = new EntityCommandEvent(); - } - if (command instanceof EntitiesCommand) { - event = new EntitiesCommandEvent(); - } - if (command instanceof PlayerCommand) { - event = new PlayerCommandEvent(); - } - if (command instanceof PlayersCommand) { - event = new PlayersCommandEvent(); - } - if (command instanceof ItemCommand) { - event = new ItemCommandEvent(); - } - if (command instanceof BlockCommand) { - event = new BlockCommandEvent(); - } - - event.setContext(context); - event.setCommand(command); - command.execute(event); - return command.isSuccess; - } - ); - } - forArgsCmd(argCmd.getValue(), nextBuilder); - builder.then(nextBuilder); - } - } - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java deleted file mode 100644 index 724a3615a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.pitan76.mcpitanlib.api.command; - -import net.minecraft.command.permission.Permission; -import net.minecraft.command.permission.PermissionLevel; -import net.minecraft.server.command.ServerCommandSource; - -public class CommandSettings { - private int permissionLevel = -1; - private ICustom iCustom = null; - - private Permission.Level _level = null; - - public boolean requires(ServerCommandSource source) { - if (customRequires(source)) { - if (permissionLevel == -1) return true; - if (_level == null) - _level = new Permission.Level(PermissionLevel.fromLevel(permissionLevel)); - - return source.getPermissions().hasPermission(_level); - } - return false; - } - - private boolean customRequires(ServerCommandSource source) { - if (iCustom == null) return true; - return iCustom.custom(source); - } - - public CommandSettings permissionLevel(int level) { - this.permissionLevel = level; - return this; - } - - public CommandSettings custom(ICustom iCustom) { - this.iCustom = iCustom; - return this; - } - - @FunctionalInterface - public interface ICustom { - boolean custom(ServerCommandSource source); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java deleted file mode 100644 index 0c4a9fb54..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java +++ /dev/null @@ -1,173 +0,0 @@ -package net.pitan76.mcpitanlib.api.command; - -import com.mojang.brigadier.arguments.StringArgumentType; -import net.pitan76.easyapi.config.Config; -import net.pitan76.mcpitanlib.api.command.argument.StringCommand; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; -import net.pitan76.mcpitanlib.api.event.StringCommandEvent; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.util.function.Supplier; - -public class ConfigCommand extends LiteralCommand { - - public final Config config; - public File file; - public Supplier defaultConfigFunction; - public String prefix = "[MCPitanLib]"; - - public ConfigCommand(Config config, File file, String prefix) { - this.config = config; - this.file = file; - this.prefix = prefix; - } - - public ConfigCommand(Config config, File file, String prefix, @Nullable Supplier supplier) { - this.config = config; - this.file = file; - this.defaultConfigFunction = supplier; - this.prefix = prefix; - } - - public ConfigCommand(Config config, File file, @Nullable Supplier supplier) { - this.config = config; - this.file = file; - this.defaultConfigFunction = supplier; - } - - public ConfigCommand(Config config, File file) { - this.config = config; - this.file = file; - } - - public ConfigCommand(Config config) { - this.config = config; - } - - @Override - public void init(CommandSettings settings) { - settings.permissionLevel(3); - - addArgumentCommand("set", new LiteralCommand() { - @Override - public void init(CommandSettings settings) { - - addArgumentCommand("key", new StringCommand() { - @Override - public String getArgumentName() { - return "key"; - } - - - @Override - public void init(CommandSettings settings) { - - addArgumentCommand("value", new StringCommand() { - @Override - public String getArgumentName() { - return "value"; - } - - @Override - public void execute(StringCommandEvent event) { - String key = StringArgumentType.getString(event.context, "key"); - String value = StringArgumentType.getString(event.context, "value"); - if (config.get(key) == null) { - event.sendFailure(TextUtil.literal(prefix + " Key not found.")); - return; - } - if (config.get(key).getClass() == String.class) { - config.setString(key, value); - event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); - - } else if (config.get(key).getClass() == Integer.class) { - config.setInt(key, Integer.parseInt(value)); - event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); - - } else if (config.get(key).getClass() == Double.class) { - config.setDouble(key, Double.parseDouble(value)); - event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); - - } else if (config.get(key).getClass() == Boolean.class) { - config.setBoolean(key, Boolean.parseBoolean(value)); - event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); - - } else { - event.sendFailure(TextUtil.literal(prefix + " Not supported type.")); - } - if (file != null) - config.save(file); - } - }); - } - - @Override - public void execute(StringCommandEvent event) { - } - }); - } - - @Override - public void execute(ServerCommandEvent event) { - - } - }); - - addArgumentCommand("get", new LiteralCommand() { - @Override - public void init(CommandSettings settings) { - addArgumentCommand("key", new StringCommand() { - @Override - public String getArgumentName() { - return "key"; - } - - @Override - public void execute(StringCommandEvent event) { - String key = StringArgumentType.getString(event.context, "key"); - if (config.get(key) == null) { - event.sendFailure(TextUtil.literal(prefix + " Key not found.")); - return; - } - event.sendSuccess(TextUtil.literal(prefix + " " + key + ": " + config.get(key).toString()), false); - } - }); - } - - @Override - public void execute(ServerCommandEvent event) { - - } - }); - - addArgumentCommand("list", new LiteralCommand() { - @Override - public void execute(ServerCommandEvent event) { - event.sendSuccess(TextUtil.literal(prefix + " Config List"), false); - for (String key : config.configMap.keySet()) { - event.sendSuccess(TextUtil.literal(" - " + key + ": " + config.get(key).toString()), false); - } - } - }); - - if (defaultConfigFunction != null) { - addArgumentCommand("reset", new LiteralCommand() { - @Override - public void execute(ServerCommandEvent event) { - config.configMap.clear(); - defaultConfigFunction.get(); - if (file != null) - config.save(file); - event.sendSuccess(TextUtil.literal(prefix + " Reset config."), false); - } - }); - } - } - - @Override - public void execute(ServerCommandEvent event) { - - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java deleted file mode 100644 index f382775a9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.pitan76.mcpitanlib.api.command; - -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class LiteralCommand extends AbstractCommand { - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java deleted file mode 100644 index 452c85dac..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import net.minecraft.block.Block; -import net.minecraft.command.argument.BlockStateArgumentType; -import net.pitan76.mcpitanlib.api.command.CommandRegistry; -import net.pitan76.mcpitanlib.api.event.BlockCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class BlockCommand extends RequiredCommand { - @Override - public BlockStateArgumentType getArgumentType() { - return BlockStateArgumentType.blockState(CommandRegistry.latestCommandRegistryAccess); - } - - public abstract void execute(BlockCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((BlockCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java deleted file mode 100644 index 32687d804..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.BoolArgumentType; -import net.pitan76.mcpitanlib.api.event.BooleanCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class BooleanCommand extends RequiredCommand { - @Override - public BoolArgumentType getArgumentType() { - return BoolArgumentType.bool(); - } - - public abstract void execute(BooleanCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((BooleanCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java deleted file mode 100644 index b8ede9b0d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.DoubleArgumentType; -import net.pitan76.mcpitanlib.api.event.DoubleCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class DoubleCommand extends RequiredCommand { - @Override - public DoubleArgumentType getArgumentType() { - return DoubleArgumentType.doubleArg(); - } - - public abstract void execute(DoubleCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((DoubleCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java deleted file mode 100644 index 4157c76d3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.event.EntitiesCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class EntitiesCommand extends RequiredCommand { - @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.entities(); - } - - public abstract void execute(EntitiesCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((EntitiesCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java deleted file mode 100644 index cf0c76ec6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.event.EntityCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class EntityCommand extends RequiredCommand { - @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.entity(); - } - - public abstract void execute(EntityCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((EntityCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java deleted file mode 100644 index 1b178e01b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.FloatArgumentType; -import net.pitan76.mcpitanlib.api.event.FloatCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class FloatCommand extends RequiredCommand { - @Override - public FloatArgumentType getArgumentType() { - return FloatArgumentType.floatArg(); - } - - public abstract void execute(FloatCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((FloatCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java deleted file mode 100644 index afff6b7e8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.StringArgumentType; - -public abstract class GreedyStringCommand extends StringCommand { - @Override - public StringArgumentType getArgumentType() { - return StringArgumentType.greedyString(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java deleted file mode 100644 index bfcdec912..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.IntegerArgumentType; -import net.pitan76.mcpitanlib.api.event.IntegerCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class IntegerCommand extends RequiredCommand { - @Override - public IntegerArgumentType getArgumentType() { - return IntegerArgumentType.integer(); - } - - public abstract void execute(IntegerCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((IntegerCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java deleted file mode 100644 index 2d24871bc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import net.minecraft.command.argument.ItemStackArgumentType; -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.command.CommandRegistry; -import net.pitan76.mcpitanlib.api.event.ItemCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class ItemCommand extends RequiredCommand { - @Override - public ItemStackArgumentType getArgumentType() { - return ItemStackArgumentType.itemStack(CommandRegistry.latestCommandRegistryAccess); - } - - public abstract void execute(ItemCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((ItemCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java deleted file mode 100644 index 45bd3b622..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.LongArgumentType; -import net.pitan76.mcpitanlib.api.event.LongCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class LongCommand extends RequiredCommand { - @Override - public LongArgumentType getArgumentType() { - return LongArgumentType.longArg(); - } - - public abstract void execute(LongCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((LongCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java deleted file mode 100644 index 3a674b908..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.event.PlayerCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class PlayerCommand extends RequiredCommand { - @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.player(); - } - - public abstract void execute(PlayerCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((PlayerCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java deleted file mode 100644 index 195d81d3b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.event.PlayersCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public abstract class PlayersCommand extends RequiredCommand { - @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.players(); - } - - public abstract void execute(PlayersCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((PlayersCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java deleted file mode 100644 index a3428290f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.ArgumentType; -import net.pitan76.mcpitanlib.api.command.AbstractCommand; - -public abstract class RequiredCommand extends AbstractCommand { - public abstract String getArgumentName(); - - public abstract ArgumentType getArgumentType(); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java deleted file mode 100644 index 008bfefaf..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.command.argument; - -import com.mojang.brigadier.arguments.StringArgumentType; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; -import net.pitan76.mcpitanlib.api.event.StringCommandEvent; - -public abstract class StringCommand extends RequiredCommand { - @Override - public StringArgumentType getArgumentType() { - return StringArgumentType.string(); - } - - public abstract void execute(StringCommandEvent event); - - @Override - public void execute(ServerCommandEvent event) { - execute((StringCommandEvent) event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java deleted file mode 100644 index a3b041b01..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.pitan76.mcpitanlib.api.datafixer; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -public class ItemStackFixer { - private static final Map> nbt2componentMapIfItemEqualMap = new HashMap<>(); - private static final Map, Map> nbt2componentMapIfitemMatchesMap = new HashMap<>(); - private static final Map nbt2componentMap = new HashMap<>(); - - public static void nbt2componentIfItemEquals(String itemId, String nbtKey, String componentId) { - Map nbt2componentMap; - if (nbt2componentMapIfItemEqualMap.containsKey(itemId)) { - nbt2componentMap = nbt2componentMapIfItemEqualMap.get(itemId); - } else { - nbt2componentMap = new HashMap<>(); - nbt2componentMapIfItemEqualMap.put(itemId, nbt2componentMap); - } - - nbt2componentMap.put(nbtKey, componentId); - } - - public static void nbt2componentIfItemMatches(Set itemId, String nbtKey, String componentId) { - Map nbt2componentMap; - if (nbt2componentMapIfitemMatchesMap.containsKey(itemId)) { - nbt2componentMap = nbt2componentMapIfitemMatchesMap.get(itemId); - } else { - nbt2componentMap = new HashMap<>(); - nbt2componentMapIfitemMatchesMap.put(itemId, nbt2componentMap); - } - - nbt2componentMap.put(nbtKey, componentId); - } - - public static void nbt2component(String nbtKey, String componentId) { - if (nbt2componentMap.containsKey(nbtKey)) return; - nbt2componentMap.put(nbtKey, componentId); - } - - public static Map> getNbt2componentMapIfItemEqualMap() { - return nbt2componentMapIfItemEqualMap; - } - - public static Map, Map> getNbt2componentMapIfitemMatchesMap() { - return nbt2componentMapIfitemMatchesMap; - } - - public static Map getNbt2componentMap() { - return nbt2componentMap; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java b/common/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java deleted file mode 100644 index 9a685a047..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.pitan76.mcpitanlib.api.enchantment; - -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.EnchantmentUtil; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; - -public class CompatEnchantment { - private final RegistryKey registryKey; - - @Deprecated - public CompatEnchantment(RegistryKey registryKey) { - this.registryKey = registryKey; - } - - public CompatEnchantment of(Identifier identifier) { - return EnchantmentUtil.getEnchantment(identifier); - } - - public Identifier getId() { - return registryKey.getRegistry(); - } - - @Deprecated - public RegistryKey getRegistryKey() { - return registryKey; - } - - public String toString() { - return getId().toString(); - } - - public boolean equals(Object obj) { - if (obj instanceof CompatEnchantment) { - return ((CompatEnchantment) obj).getId().equals(getId()); - } - return false; - } - - @Deprecated - public RegistryEntry getEntry(@Nullable World world) { - Optional> optionalEntry; - if (world == null) { - optionalEntry = BuiltinRegistries.createWrapperLookup() - .getOptionalEntry(registryKey); - } else { - optionalEntry = world.getRegistryManager().getOptionalEntry(registryKey); - } - - return optionalEntry.orElseThrow(); - } - - public Enchantment getEnchantment(@Nullable World world) { - return getEntry(world).value(); - } - - public int getLevel(ItemStack stack, @Nullable World world) { - return EnchantmentHelper.getLevel(getEntry(world), stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java deleted file mode 100644 index 2dab01c35..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity; - -import net.minecraft.entity.ContainerUser; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; - -public class CompatContainerUser { - protected ContainerUser containerUser; - - public CompatContainerUser(ContainerUser containerUser) { - this.containerUser = containerUser; - } - - public double getContainerInteractionRange() { - return containerUser.getContainerInteractionRange(); - } - - public LivingEntity asLivingEntity() { - return containerUser.asLivingEntity(); - } - - public boolean isPlayer() { - return containerUser instanceof PlayerEntity; - } - - public Player asPlayer() { - return new Player((PlayerEntity) containerUser); - } - - @Deprecated - public ContainerUser getRaw() { - return containerUser; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java deleted file mode 100644 index a5963fa7b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java +++ /dev/null @@ -1,135 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.entity.InitDataTrackerArgs; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; - -public class CompatEntity extends Entity { - public CompatEntity(EntityType type, World world) { - super(type, world); - } - - @Deprecated - @Override - public void initDataTracker(DataTracker.Builder builder) { - initDataTracker(new InitDataTrackerArgs(builder)); - } - - @Override - public boolean damage(ServerWorld world, DamageSource source, float amount) { - return false; - } - - public void initDataTracker(InitDataTrackerArgs args) { - - } - - public void readCustomDataFromNbt(ReadNbtArgs nbt) { - readCustomData(nbt.view); - } - - public void writeCustomDataToNbt(WriteNbtArgs nbt) { - writeCustomData(nbt.view); - } - - @Deprecated - @Override - protected void readCustomData(ReadView view) { - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readCustomDataFromNbt(new ReadNbtArgs(nbt, view)); - } - - @Deprecated - @Override - protected void writeCustomData(WriteView view) { - NbtCompound nbt = new NbtCompound(); - writeCustomDataToNbt(new WriteNbtArgs(nbt, view)); - NbtDataConverter.nbt2writeData(nbt, view); - } - - public Packet createSpawnPacket() { - return null; - } - - public void writeNbt(WriteNbtArgs args) { - writeData(args.view); - } - - public void readNbt(ReadNbtArgs args) { - readData(args.view); - } - - @Deprecated - @Override - public void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = new NbtCompound(); - writeNbt(new WriteNbtArgs(nbt, view)); - NbtDataConverter.nbt2writeData(nbt, view); - } - - @Deprecated - @Override - public void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readNbt(new ReadNbtArgs(nbt, view)); - } - - @Deprecated - @Override - public World getEntityWorld() { - return callGetWorld(); - } - - public World callGetWorld() { - return super.getEntityWorld(); - } - - public BlockPos callGetBlockPos() { - return getBlockPos(); - } - - public Vec3d callGetPos() { - return getEntityPos(); - } - - public boolean hasServerWorld() { - return callGetWorld() instanceof ServerWorld; - } - - public ServerWorld getServerWorld() { - return (ServerWorld) getEntityWorld(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(callGetWorld()); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraBlockPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(callGetBlockPos()); - } - - public Vector3d getMidohraPos() { - return Vector3d.of(callGetPos()); - } - - public net.pitan76.mcpitanlib.midohra.world.ServerWorld getMidohraServerWorld() { - return net.pitan76.mcpitanlib.midohra.world.ServerWorld.of(getServerWorld()); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java deleted file mode 100644 index 128049f42..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java +++ /dev/null @@ -1,159 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity; - -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.projectile.thrown.ThrownItemEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.entity.CollisionEvent; -import net.pitan76.mcpitanlib.api.event.entity.EntityHitEvent; -import net.pitan76.mcpitanlib.api.event.entity.InitDataTrackerArgs; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; - -public abstract class CompatThrownItemEntity extends ThrownItemEntity { - - public CompatThrownItemEntity(EntityType entityType, World world) { - super(entityType, world); - } - - public CompatThrownItemEntity(EntityType entityType, double d, double e, double f, World world) { - super(entityType, d, e, f, world, ItemStackUtil.empty()); - } - - public CompatThrownItemEntity(EntityType entityType, LivingEntity livingEntity, World world) { - super(entityType, livingEntity, world, ItemStackUtil.empty()); - } - - public abstract Item getDefaultItemOverride(); - - @Deprecated - @Override - protected Item getDefaultItem() { - return getDefaultItemOverride(); - } - - public ItemStack callGetItem() { - return super.getStack(); - } - - @Deprecated - @Override - public ItemStack getStack() { - return callGetItem(); - } - - public void callSetItem(ItemStack stack) { - super.setItem(stack); - } - - @Deprecated - @Override - public void setItem(ItemStack stack) { - callSetItem(stack); - } - - public void callHandleStatus(byte status) { - super.handleStatus(status); - } - - @Deprecated - @Override - public void handleStatus(byte status) { - callHandleStatus(status); - } - - public void onEntityHit(EntityHitEvent event) { - super.onEntityHit(event.entityHitResult); - } - - @Deprecated - @Override - protected void onEntityHit(EntityHitResult entityHitResult) { - onEntityHit(new EntityHitEvent(entityHitResult)); - } - - public void onCollision(CollisionEvent event) { - super.onCollision(event.hitResult); - } - - @Deprecated - @Override - protected void onCollision(HitResult hitResult) { - onCollision(new CollisionEvent(hitResult)); - } - - // ------------------ ExtendEntity ------------------ - - @Deprecated - @Override - public void initDataTracker(DataTracker.Builder builder) { - initDataTracker(new InitDataTrackerArgs(builder, dataTracker)); - } - - public void initDataTracker(InitDataTrackerArgs args) { - super.initDataTracker(args.getBuilder()); - } - - public void readCustomDataFromNbt(ReadNbtArgs nbt) { - super.readCustomData(nbt.view); - } - - public void writeCustomDataToNbt(WriteNbtArgs nbt) { - super.writeCustomData(nbt.view); - } - - @Deprecated - @Override - protected void readCustomData(ReadView view) { - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readCustomDataFromNbt(new ReadNbtArgs(nbt, view)); - } - - @Deprecated - @Override - protected void writeCustomData(WriteView view) { - NbtCompound nbt = new NbtCompound(); - writeCustomDataToNbt(new WriteNbtArgs(nbt, view)); - NbtDataConverter.nbt2writeData(nbt, view); - } - - public void writeNbt(WriteNbtArgs args) { - super.writeData(args.view); - } - - public void readNbt(ReadNbtArgs args) { - super.readData(args.view); - } - - @Deprecated - @Override - public void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = new NbtCompound(); - writeNbt(new WriteNbtArgs(nbt, view)); - NbtDataConverter.nbt2writeData(nbt, view); - } - - @Deprecated - @Override - public void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readNbt(new ReadNbtArgs(nbt, view)); - } - - @Override - public World getEntityWorld() { - return super.getEntityWorld(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java deleted file mode 100644 index 933e0d8fc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java +++ /dev/null @@ -1,133 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity; - -import com.google.common.collect.ImmutableSet; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.loot.LootTable; -import net.minecraft.registry.RegistryKey; -import net.pitan76.mcpitanlib.MCPitanLib; - -import java.util.Optional; - -public class EntityTypeBuilder { - - private SpawnGroup spawnGroup; - private ExtendEntityType.EntityFactory factory; - private EntityDimensions entityDimensions; - private boolean saveable; - private boolean summonable; - private boolean fireImmune; - private boolean spawnableFarFromPlayer; - private ImmutableSet canSpawnBlocks; - private int maxTrackDistance; - private int trackTickInterval; - private Boolean alwaysUpdateVelocity = null; - private String translationKey = "entity." + MCPitanLib.MOD_ID; - private Optional> lootTable = Optional.empty(); - - @Deprecated - // Recommend: create() - public EntityTypeBuilder() { - setSaveable(true); - setSummonable(true); - setFireImmune(false); - setChangingDimensions(-1.0f, -1.0f); - spawnableFarFromPlayer = false; - maxTrackDistance = 5; - trackTickInterval = 3; - canSpawnBlocks = ImmutableSet.of(); - } - - @Deprecated - public EntityTypeBuilder(SpawnGroup spawnGroup, ExtendEntityType.EntityFactory factory) { - this(); - this.spawnGroup = spawnGroup; - this.factory = factory; - } - - public static EntityTypeBuilder create() { - return new EntityTypeBuilder<>(); - } - - public static EntityTypeBuilder create(SpawnGroup spawnGroup, ExtendEntityType.EntityFactory factory) { - return new EntityTypeBuilder<>(spawnGroup, factory); - } - - public EntityType build() { - return new ExtendEntityType<>(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, maxTrackDistance, trackTickInterval, translationKey, lootTable, alwaysUpdateVelocity); - } - - public EntityTypeBuilder setSpawnGroup(SpawnGroup spawnGroup) { - this.spawnGroup = spawnGroup; - return this; - } - - public EntityTypeBuilder setEntityFactory(ExtendEntityType.EntityFactory factory) { - this.factory = factory; - return this; - } - - public EntityTypeBuilder setDimensions(EntityDimensions entityDimensions) { - this.entityDimensions = entityDimensions; - return this; - } - - public EntityTypeBuilder setFixedDimensions(float width, float height) { - return setDimensions(EntityDimensions.fixed(width, height)); - } - - public EntityTypeBuilder setChangingDimensions(float width, float height) { - return setDimensions(EntityDimensions.changing(width, height)); - } - - public EntityTypeBuilder setSaveable(boolean saveable) { - this.saveable = saveable; - return this; - } - - public EntityTypeBuilder setSummonable(boolean summonable) { - this.summonable = summonable; - return this; - } - - public EntityTypeBuilder setFireImmune(boolean fireImmune) { - this.fireImmune = fireImmune; - return this; - } - - public EntityTypeBuilder setSpawnableFarFromPlayer(boolean spawnableFarFromPlayer) { - this.spawnableFarFromPlayer = spawnableFarFromPlayer; - return this; - } - - public EntityTypeBuilder setCanSpawnBlocks(ImmutableSet canSpawnBlocks) { - this.canSpawnBlocks = canSpawnBlocks; - return this; - } - - public EntityTypeBuilder setMaxTrackDistance(int maxTrackDistance) { - this.maxTrackDistance = maxTrackDistance; - return this; - } - - public EntityTypeBuilder setTrackTickInterval(int trackTickInterval) { - this.trackTickInterval = trackTickInterval; - return this; - } - - public EntityTypeBuilder setAlwaysUpdateVelocity(Boolean alwaysUpdateVelocity) { - this.alwaysUpdateVelocity = alwaysUpdateVelocity; - return this; - } - - public void setTranslationKey(String translationKey) { - this.translationKey = translationKey; - } - - public void setLootTable(RegistryKey lootTable) { - this.lootTable = Optional.ofNullable(lootTable); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java deleted file mode 100644 index 29245d975..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.nbt.NbtTag; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; - -public class ExtendEntity extends Entity { - public ExtendEntity(EntityType type, World world) { - super(type, world); - } - - @Deprecated - @Override - public void initDataTracker(DataTracker.Builder builder) { - initDataTracker(); - } - - @Override - public boolean damage(ServerWorld world, DamageSource source, float amount) { - return false; - } - - public void initDataTracker() { - } - - public void readCustomDataFromNbt(NbtCompound nbt) { - - } - - public void writeCustomDataToNbt(NbtCompound nbt) { - - } - - public Packet createSpawnPacket() { - return null; - } - - // 互換性用 (NbtTag型をOverrideすること) - public void writeNbt(NbtTag nbt) { - - } - - public void readNbt(NbtTag nbt) { - - } - - @Deprecated - @Override - public void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = new NbtCompound(); - writeNbt(NbtTag.from(nbt)); - NbtDataConverter.nbt2writeData(nbt, view); - } - - @Deprecated - @Override - public void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readNbt(NbtTag.from(nbt)); - } - - @Override - protected void readCustomData(ReadView view) { - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readCustomDataFromNbt(nbt); - } - - @Override - protected void writeCustomData(WriteView view) { - NbtCompound nbt = new NbtCompound(); - writeCustomDataToNbt(nbt); - NbtDataConverter.nbt2writeData(nbt, view); - } - - // 1.14 - public NbtCompound toTag(NbtCompound nbt) { - this.writeNbt(NbtTag.from(nbt)); - return nbt; - } - - public NbtCompound fromTag(NbtCompound nbt) { - this.readNbt(NbtTag.from(nbt)); - return nbt; - } - - @Override - public World getEntityWorld() { - return super.getEntityWorld(); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java deleted file mode 100644 index 207e9c949..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity; - -import com.google.common.collect.ImmutableSet; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.loot.LootTable; -import net.minecraft.registry.RegistryKey; -import net.minecraft.resource.featuretoggle.FeatureFlags; -import net.minecraft.world.World; - -import java.util.Optional; - -public class ExtendEntityType extends EntityType { - private final Boolean alwaysUpdateVelocity; - - @Deprecated - public ExtendEntityType(EntityFactory factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { - super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_ENABLED_FEATURES, spawnGroup.isPeaceful()); - this.alwaysUpdateVelocity = alwaysUpdateVelocity; - } - - public ExtendEntityType(EntityFactory factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { - super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, 5, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_ENABLED_FEATURES, spawnGroup.isPeaceful()); - this.alwaysUpdateVelocity = alwaysUpdateVelocity; - } - - @Override - public boolean alwaysUpdateVelocity() { - if (alwaysUpdateVelocity != null) - return alwaysUpdateVelocity; - - return super.alwaysUpdateVelocity(); - } - - public interface EntityFactory { - T create(EntityType type, World world); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java deleted file mode 100644 index 7b2076bd1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ /dev/null @@ -1,547 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity; - -import dev.architectury.registry.menu.ExtendedMenuProvider; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.NbtComponent; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.player.ItemCooldownManager; -import net.minecraft.entity.player.PlayerAbilities; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayNetworkHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.stat.Stat; -import net.minecraft.stat.StatType; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.text.Text; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; -import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; -import net.pitan76.mcpitanlib.api.gui.ExtendedNamedScreenHandlerFactory; -import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; -import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.NbtUtil; -import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import net.pitan76.mcpitanlib.core.player.ItemCooldown; - -import java.util.*; -import java.util.function.Consumer; - -/* -PlayerEntity helper - */ -public class Player { - private final PlayerEntity entity; - - public PlayerEntity getEntity() { - return entity; - } - - public PlayerEntity getPlayerEntity() { - return getEntity(); - } - - public Player(PlayerEntity playerEntity) { - this.entity = playerEntity; - } - - /** - * Get player inventory - * @return PlayerInventory - */ - public PlayerInventory getInv() { - return getEntity().getInventory(); - } - - /** - * Alias of getInv() - * @return PlayerInventory - */ - public PlayerInventory getInventory() { - return getInv(); - } - - /** - * Get armor's item stack list - * @return DefaultedList - */ - public DefaultedList getArmor() { - DefaultedList stacks = DefaultedList.ofSize(4, ItemStack.EMPTY); - stacks.set(0, getInv().getStack(36)); - stacks.set(1, getInv().getStack(37)); - stacks.set(2, getInv().getStack(38)); - stacks.set(3, getInv().getStack(39)); - return stacks; - } - - /** - * Get main's item stack list - * @return DefaultedList - */ - public DefaultedList getMain() { - return getInv().getMainStacks(); - } - - /** - * Get off hand's item stack list - * @return DefaultedList - */ - public DefaultedList getOffHand() { - DefaultedList stacks = DefaultedList.ofSize(1, ItemStack.EMPTY); - stacks.set(0, getInv().getStack(PlayerInventory.OFF_HAND_SLOT)); - return stacks; - } - - /** - * Get select slot integer - * @return int - */ - public int getSelectSlot() { - return getInv().getSelectedSlot(); - } - - /** - * Get player inventory size - * @return player inventory size - */ - public int getInvSize() { - return getInv().size(); - } - - public OptionalInt openGuiScreen(NamedScreenHandlerFactory factory) { - return getEntity().openHandledScreen(factory); - } - - public OptionalInt openGuiScreen(World world, BlockState state, BlockPos pos) { - return openGuiScreen(state.createScreenHandlerFactory(world, pos)); - } - - public boolean isServerPlayerEntity() { - return this.getEntity() instanceof ServerPlayerEntity; - } - - public void openExtendedMenu(NamedScreenHandlerFactory provider, Consumer bufWriter) { - if (isServerPlayerEntity()) - ScreenHandlerUtil.openExtendedMenu((ServerPlayerEntity) this.getPlayerEntity(), provider, bufWriter); - } - - public void openExtendedMenu(ExtendedMenuProvider provider) { - if (isServerPlayerEntity()) - ScreenHandlerUtil.openExtendedMenu((ServerPlayerEntity) this.getPlayerEntity(), provider); - } - - public void openExtendedMenu(ExtendedNamedScreenHandlerFactory provider) { - this.openExtendedMenu((ExtendedMenuProvider) provider); - } - - public void openMenu(NamedScreenHandlerFactory provider) { - if (isServerPlayerEntity()) - ScreenHandlerUtil.openMenu((ServerPlayerEntity) this.getPlayerEntity(), provider); - } - - public void insertStack(ItemStack stack) { - getInv().insertStack(stack); - } - - public void insertStack(int slot, ItemStack stack) { - getInv().insertStack(slot, stack); - } - - public void offerOrDrop(ItemStack itemStack) { - getInv().offerOrDrop(itemStack); - } - - public void giveStack(ItemStack stack) { - getEntity().giveItemStack(stack); - } - - public String getName() { - return getEntity().getName().getString(); - } - - public UUID getUUID() { - return getEntity().getUuid(); - } - - public PlayerAbilities getAbilities() { - return getEntity().getAbilities(); - } - - /** - * Returns whether this player is in creative mode. - */ - public boolean isCreative() { - return getAbilities().creativeMode; - } - - public boolean isFlying() { - return getAbilities().flying; - } - - public boolean isInvulnerable() { - return getAbilities().invulnerable; - } - - public World getWorld() { - return getEntity().getEntityWorld(); - } - - public ScreenHandler getCurrentScreenHandler() { - return getEntity().currentScreenHandler; - } - - public boolean isSneaking() { - return getEntity().isSneaking(); - } - - public ItemStack getCursorStack() { - return getCurrentScreenHandler().getCursorStack(); - } - - public boolean isClient() { - return getWorld().isClient(); - } - public boolean isServer() { - return !isClient(); - } - - public void readCustomDataFromNbt(NbtCompound nbt) { - getEntity().setComponent(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt)); - } - - public void writeCustomDataToNbt(NbtCompound nbt) { - NbtCompound source = getEntity().get(DataComponentTypes.CUSTOM_DATA).copyNbt(); - NbtUtil.copyFrom(source, nbt); - } - - public void sendMessage(Text text) { - getEntity().sendMessage(text, false); - } - - public void sendActionBar(Text text) { - getEntity().sendMessage(text, true); - } - - public void equipStack(EquipmentSlot slot, ItemStack stack) { - getEntity().equipStack(slot, stack); - } - - public void dropStack(ItemStack stack, boolean throwRandomly, boolean retainOwnership) { - getEntity().dropItem(stack, throwRandomly, retainOwnership); - } - - public void dropStack(ItemStack stack, boolean retainOwnership) { - dropStack(stack, false, retainOwnership); - } - - public void dropStack(ItemStack stack) { - dropStack(stack, false, false); - } - - public BlockPos getBlockPos() { - return getEntity().getBlockPos(); - } - - public Vec3d getPos() { - return getEntity().getEntityPos(); - } - - public ItemStack getStackInHand(Hand hand) { - return this.getEntity().getStackInHand(hand); - } - - public void heal(float amount) { - this.getEntity().heal(amount); - } - - public float getYaw() { - return this.getEntity().getYaw(); - } - - public float getPitch() { - return this.getEntity().getPitch(); - } - - public void playSound(SoundEvent event, SoundCategory category, float volume, float pitch) { - if (isServerPlayerEntity()) { - Optional player = getServerPlayer(); - if (player.isPresent()) { - player.get().playSound(event, volume, pitch); - return; - } - } - - playSound(event, volume, pitch); - } - - public void playSound(SoundEvent event, float volume, float pitch) { - if (isServerPlayerEntity()) { - Optional player = getServerPlayer(); - if (player.isPresent()) { - player.get().playSound(event, volume, pitch); - return; - } - } - - getEntity().playSound(event, volume, pitch); - } - - public void playSound(CompatSoundEvent event, CompatSoundCategory category, float volume, float pitch) { - playSound(event.get(), category.get(), volume, pitch); - } - - public void playSound(CompatSoundEvent event, float volume, float pitch) { - playSound(event.get(), volume, pitch); - } - - public ItemCooldown itemCooldown = new ItemCooldown(this); - - public ItemCooldown getItemCooldown() { - return itemCooldown; - } - - public ItemCooldownManager getItemCooldownManager() { - return getEntity().getItemCooldownManager(); - } - - public void incrementStat(Stat stat) { - getEntity().incrementStat(stat); - } - - public void incrementStat(StatType type, T object) { - getEntity().incrementStat(type.getOrCreateStat(object)); - } - - public void incrementStat(Identifier id) { - getEntity().incrementStat(id); - } - - public void incrementStat(CompatIdentifier id) { - getEntity().incrementStat(id.toMinecraft()); - } - - public void teleport(double x, double y, double z) { - getEntity().teleport(x, y, z, false); - } - - public ItemStack getMainHandStack() { - return getStackInHand(Hand.MAIN_HAND); - } - - public ItemStack getOffHandStack() { - return getStackInHand(Hand.OFF_HAND); - } - - public Direction getHorizontalFacing() { - return getEntity().getHorizontalFacing(); - } - - public double getX() { - return getEntity().getX(); - } - - public double getY() { - return getEntity().getY(); - } - - public double getZ() { - return getEntity().getZ(); - } - - public boolean isServerPlayer() { - return getEntity() instanceof ServerPlayerEntity; - } - - public Optional getServerPlayer() { - if (isServerPlayer()) - return Optional.of((ServerPlayerEntity) getEntity()); - - return Optional.empty(); - } - - @Environment(EnvType.CLIENT) - public Optional getClientPlayer() { - if (getEntity() instanceof ClientPlayerEntity) - return Optional.of((ClientPlayerEntity) getEntity()); - - return Optional.empty(); - } - - public void setVelocity(double x, double y, double z) { - getEntity().setVelocity(x, y, z); - } - - public void setVelocity(Vec3d velocity) { - getEntity().setVelocity(velocity); - } - - public Vec3d getVelocity() { - return getEntity().getVelocity(); - } - - public Optional getNetworkHandler() { - Optional player = getServerPlayer(); - return player.map(sp -> sp.networkHandler); - } - - public boolean hasNetworkHandler() { - return getNetworkHandler().isPresent(); - } - - public boolean isSpectator() { - return getEntity().isSpectator(); - } - - /** - * Returns the current {@link ItemStack} in the {@link Player}'s hand, or offhand if the - * main hand is empty. - * - * @return {@code ItemStack} that the {@link Player} is holding. Can be {@link null}. - */ - public Optional getCurrentHandItem() { - boolean playerIsHoldingInMainHand = !getMainHandStack().isEmpty(); - if (playerIsHoldingInMainHand) - return Optional.ofNullable(getMainHandStack()); - - boolean playerIsHoldingInOffHand = !getOffHandStack().isEmpty(); - - if (playerIsHoldingInOffHand) - return Optional.ofNullable(getOffHandStack()); - - return Optional.empty(); - } - - public void addStatusEffect(CompatStatusEffectInstance effect) { - getEntity().addStatusEffect(effect.getInstance()); - } - - public void removeStatusEffect(CompatStatusEffect effect) { - getEntity().removeStatusEffect(effect.getEntry(getWorld())); - } - - public List getStatusEffects() { - List compatEffects = new ArrayList<>(); - - for (StatusEffectInstance effect : getEntity().getStatusEffects()) { - compatEffects.add(new CompatStatusEffectInstance(effect)); - } - - return compatEffects; - } - - public void addExperience(int experience) { - getEntity().addExperience(experience); - } - - public int getExperienceLevel() { - return getEntity().experienceLevel; - } - - public void addExperienceLevels(int levels) { - getEntity().addExperienceLevels(levels); - } - - public void setExperienceLevel(int level) { - getEntity().experienceLevel = level; - } - - public void addScore(int score) { - getEntity().addScore(score); - } - - public int getScore() { - return getEntity().getScore(); - } - - public void setScore(int score) { - getEntity().setScore(score); - } - - public int getTotalExperience() { - return getEntity().totalExperience; - } - - public void setTotalExperience(int experience) { - getEntity().totalExperience = experience; - } - - public boolean isSwimming() { - return getEntity().isSwimming(); - } - - public void setStackInHand(Hand hand, ItemStack stack) { - getEntity().setStackInHand(hand, stack); - } - - public void setStackInHand(Hand hand, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - setStackInHand(hand, stack.toMinecraft()); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStackInHand(Hand hand) { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStackInHand(hand)); - } - - public Hand getActiveHand() { - return getEntity().getActiveHand(); - } - - public float getBlockBreakingSpeed(BlockState state) { - return getEntity().getBlockBreakingSpeed(state); - } - - public boolean canHarvest(BlockState state) { - return getEntity().canHarvest(state); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); - } - - public void eatFood(ItemStack stack, CompatFoodComponent foodComponent) { - getEntity().getHungerManager().eat(foodComponent.build()); - } - - public void sendMessage(String message) { - sendMessage(TextUtil.of(message)); - } - - public void sendActionBar(String message) { - sendActionBar(TextUtil.of(message)); - } - - public void sendMessagef(String format, Object... args) { - sendMessage(TextUtil.of(String.format(format, args))); - } - - public void sendMessage(TextComponent textComponent) { - sendMessage(textComponent.getText()); - } - - public void sendActionBar(TextComponent textComponent) { - sendActionBar(textComponent.getText()); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java deleted file mode 100644 index dd71d5eb8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.minecraft.entity.attribute.EntityAttributeModifier; - -public class AttrModifierOperation { - private final EntityAttributeModifier.Operation raw; - - public static final AttrModifierOperation ADD = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_VALUE); - public static final AttrModifierOperation MUL_TOTAL = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL); - public static final AttrModifierOperation MUL_BASE = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE); - - @Deprecated - public AttrModifierOperation(EntityAttributeModifier.Operation raw) { - this.raw = raw; - } - - public static AttrModifierOperation of(EntityAttributeModifier.Operation raw) { - if (raw == EntityAttributeModifier.Operation.ADD_VALUE) { - return ADD; - } else if (raw == EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL) { - return MUL_TOTAL; - } else if (raw == EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE) { - return MUL_BASE; - } - - return new AttrModifierOperation(raw); - } - - public EntityAttributeModifier.Operation raw() { - return raw; - } - - public String getName() { - return raw().name(); - } - - public int getId() { - return raw().getId(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof AttrModifierOperation)) return false; - AttrModifierOperation that = (AttrModifierOperation) obj; - return raw().equals(that.raw()); - } - - @Override - public int hashCode() { - if (raw() == null) return super.hashCode(); - return raw().hashCode(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java deleted file mode 100644 index 120a75040..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.minecraft.component.type.AttributeModifiersComponent; - -public class AttributeModifiersComponentBuilder { - - public final AttributeModifiersComponent.Builder builder = AttributeModifiersComponent.builder(); - - public AttributeModifiersComponentBuilder() { - - } - - public AttributeModifiersComponentBuilder add(CompatEntityAttribute attribute, CompatEntityAttributeModifier modifier, CompatAttributeModifierSlot slot) { - builder.add(attribute.raw(), modifier.raw(), slot.raw()); - return this; - } - - @Deprecated - public AttributeModifiersComponent build_raw() { - return builder.build(); - } - - public CompatAttributeModifiersComponent build() { - return CompatAttributeModifiersComponent.of(build_raw()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java deleted file mode 100644 index 43595c06b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.minecraft.component.type.AttributeModifierSlot; -import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; - -public class CompatAttributeModifierSlot implements CompatStringIdentifiable { - - private final AttributeModifierSlot raw; - - public static final CompatAttributeModifierSlot ANY = new CompatAttributeModifierSlot(AttributeModifierSlot.ANY); - public static final CompatAttributeModifierSlot MAIN_HAND = new CompatAttributeModifierSlot(AttributeModifierSlot.MAINHAND); - public static final CompatAttributeModifierSlot OFF_HAND = new CompatAttributeModifierSlot(AttributeModifierSlot.OFFHAND); - public static final CompatAttributeModifierSlot HEAD = new CompatAttributeModifierSlot(AttributeModifierSlot.HEAD); - public static final CompatAttributeModifierSlot FEET = new CompatAttributeModifierSlot(AttributeModifierSlot.FEET); - public static final CompatAttributeModifierSlot LEGS = new CompatAttributeModifierSlot(AttributeModifierSlot.LEGS); - public static final CompatAttributeModifierSlot CHEST = new CompatAttributeModifierSlot(AttributeModifierSlot.CHEST); - public static final CompatAttributeModifierSlot ARMOR = new CompatAttributeModifierSlot(AttributeModifierSlot.ARMOR); - public static final CompatAttributeModifierSlot BODY = new CompatAttributeModifierSlot(AttributeModifierSlot.BODY); - public static final CompatAttributeModifierSlot SADDLE = new CompatAttributeModifierSlot(AttributeModifierSlot.SADDLE); - - @Deprecated - public CompatAttributeModifierSlot(AttributeModifierSlot raw) { - this.raw = raw; - } - - public static CompatAttributeModifierSlot of(AttributeModifierSlot slot) { - if (slot == AttributeModifierSlot.ANY) return ANY; - if (slot == AttributeModifierSlot.MAINHAND) return MAIN_HAND; - if (slot == AttributeModifierSlot.OFFHAND) return OFF_HAND; - if (slot == AttributeModifierSlot.HEAD) return HEAD; - if (slot == AttributeModifierSlot.FEET) return FEET; - if (slot == AttributeModifierSlot.LEGS) return LEGS; - if (slot == AttributeModifierSlot.CHEST) return CHEST; - if (slot == AttributeModifierSlot.ARMOR) return ARMOR; - if (slot == AttributeModifierSlot.BODY) return BODY; - if (slot == AttributeModifierSlot.SADDLE) return SADDLE; - - return new CompatAttributeModifierSlot(slot); - } - - @Deprecated - public AttributeModifierSlot raw() { - return raw; - } - - @Override - public String asString_compat() { - return raw().asString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof CompatAttributeModifierSlot)) return false; - CompatAttributeModifierSlot that = (CompatAttributeModifierSlot) obj; - return raw().equals(that.raw()); - } - - @Override - public int hashCode() { - if (raw() == null) return super.hashCode(); - return raw().hashCode(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java deleted file mode 100644 index ec9b8318c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.minecraft.component.type.AttributeModifiersComponent; - -public class CompatAttributeModifiersComponent { - private final AttributeModifiersComponent raw; - - @Deprecated - public CompatAttributeModifiersComponent(AttributeModifiersComponent component) { - this.raw = component; - } - - @Deprecated - public AttributeModifiersComponent raw() { - return raw; - } - - public static CompatAttributeModifiersComponent of(AttributeModifiersComponent component) { - return new CompatAttributeModifiersComponent(component); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - CompatAttributeModifiersComponent that = (CompatAttributeModifiersComponent) obj; - return raw.equals(that.raw); - } - - @Override - public int hashCode() { - return raw.hashCode(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java deleted file mode 100644 index 0b116dc14..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java +++ /dev/null @@ -1,49 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.registry.entry.RegistryEntry; - -public class CompatEntityAttribute { - public final RegistryEntry raw; - - @Deprecated - public CompatEntityAttribute(RegistryEntry attribute) { - this.raw = attribute; - } - - @Deprecated - public RegistryEntry raw() { - return raw; - } - - public String getId() { - return raw.getIdAsString(); - } - - public EntityAttribute getValue() { - return raw.value(); - } - - public boolean isNull() { - return raw == null; - } - - @Deprecated - public static CompatEntityAttribute of(RegistryEntry attribute) { - return new CompatEntityAttribute(attribute); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof CompatEntityAttribute)) return false; - CompatEntityAttribute that = (CompatEntityAttribute) obj; - return raw.equals(that.raw); - } - - @Override - public int hashCode() { - if (raw == null) return super.hashCode(); - return raw.hashCode(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java deleted file mode 100644 index e170013ca..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java +++ /dev/null @@ -1,70 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.attribute.EntityAttributeInstance; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -import java.util.function.Consumer; - -public class CompatEntityAttributeInstance { - private final net.minecraft.entity.attribute.EntityAttributeInstance raw; - - @Deprecated - public CompatEntityAttributeInstance(net.minecraft.entity.attribute.EntityAttributeInstance instance) { - this.raw = instance; - } - - @Deprecated - public net.minecraft.entity.attribute.EntityAttributeInstance raw() { - return raw; - } - - @Deprecated - public static CompatEntityAttributeInstance of(net.minecraft.entity.attribute.EntityAttributeInstance instance) { - return new CompatEntityAttributeInstance(instance); - } - - public static CompatEntityAttributeInstance create(CompatEntityAttribute type, Consumer updateCallback) { - return of(new EntityAttributeInstance(type.raw(), modifier -> { - if (updateCallback != null) - updateCallback.accept(of(modifier)); - })); - } - - public static CompatEntityAttributeInstance get(LivingEntity entity, CompatEntityAttribute attribute) { - return new CompatEntityAttributeInstance(entity.getAttributeInstance(attribute.raw())); - } - - public static CompatEntityAttributeInstance get(Player player, CompatEntityAttribute attribute) { - return get(player.getEntity(), attribute); - } - - public boolean hasModifier(CompatIdentifier id) { - return raw().hasModifier(id.toMinecraft()); - } - - public double getValue() { - return raw().getValue(); - } - - public void setBaseValue(double value) { - raw().setBaseValue(value); - } - - public void addPersistentModifier(CompatEntityAttributeModifier modifier) { - raw().addPersistentModifier(modifier.raw()); - } - - public void removeModifier(CompatIdentifier id) { - raw().removeModifier(id.toMinecraft()); - } - - public CompatEntityAttribute getAttribute() { - return CompatEntityAttribute.of(raw().getAttribute()); - } - - public boolean isNull() { - return raw() == null; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java deleted file mode 100644 index 59b4f2b74..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class CompatEntityAttributeModifier { - private final net.minecraft.entity.attribute.EntityAttributeModifier raw; - - @Deprecated - public CompatEntityAttributeModifier(net.minecraft.entity.attribute.EntityAttributeModifier raw) { - this.raw = raw; - } - - @Deprecated - public static CompatEntityAttributeModifier of(net.minecraft.entity.attribute.EntityAttributeModifier raw) { - return new CompatEntityAttributeModifier(raw); - } - - public static CompatEntityAttributeModifier of(CompatIdentifier id, double value, AttrModifierOperation operation) { - return new CompatEntityAttributeModifier(new net.minecraft.entity.attribute.EntityAttributeModifier(id.toMinecraft(), value, operation.raw())); - } - - @Deprecated - public net.minecraft.entity.attribute.EntityAttributeModifier raw() { - return raw; - } - - public AttrModifierOperation getOperation() { - return AttrModifierOperation.of(raw().operation()); - } - - public double getValue() { - return raw().value(); - } - - public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(raw().id()); - } - - @Override - public String toString() { - return raw().toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof CompatEntityAttributeModifier)) return false; - CompatEntityAttributeModifier that = (CompatEntityAttributeModifier) obj; - return raw().equals(that.raw()); - } - - @Override - public int hashCode() { - if (raw() == null) return super.hashCode(); - return raw().hashCode(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java deleted file mode 100644 index d0c1f595f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.attribute; - -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.registry.entry.RegistryEntry; - -public class CompatEntityAttributes { - - public static final CompatEntityAttribute ARMOR = of(EntityAttributes.ARMOR); - public static final CompatEntityAttribute ARMOR_TOUGHNESS = of(EntityAttributes.ARMOR_TOUGHNESS); - public static final CompatEntityAttribute ATTACK_DAMAGE = of(EntityAttributes.ATTACK_DAMAGE); - public static final CompatEntityAttribute ATTACK_KNOCKBACK = of(EntityAttributes.ATTACK_KNOCKBACK); - public static final CompatEntityAttribute ATTACK_SPEED = of(EntityAttributes.ATTACK_SPEED); - public static final CompatEntityAttribute FOLLOW_RANGE = of(EntityAttributes.FOLLOW_RANGE); - public static final CompatEntityAttribute KNOCKBACK_RESISTANCE = of(EntityAttributes.KNOCKBACK_RESISTANCE); - public static final CompatEntityAttribute LUCK = of(EntityAttributes.LUCK); - public static final CompatEntityAttribute MOVEMENT_SPEED = of(EntityAttributes.MOVEMENT_SPEED); - public static final CompatEntityAttribute MAX_HEALTH = of(EntityAttributes.MAX_HEALTH); - public static final CompatEntityAttribute JUMP_STRENGTH = of(EntityAttributes.JUMP_STRENGTH); - public static final CompatEntityAttribute GRAVITY = of(EntityAttributes.GRAVITY); - public static final CompatEntityAttribute FLYING_SPEED = of(EntityAttributes.FLYING_SPEED); - public static final CompatEntityAttribute BLOCK_BREAK_SPEED = of(EntityAttributes.BLOCK_BREAK_SPEED); - public static final CompatEntityAttribute BLOCK_INTERACTION_RANGE = of(EntityAttributes.BLOCK_INTERACTION_RANGE); - - public static CompatEntityAttribute of(RegistryEntry attribute) { - return CompatEntityAttribute.of(attribute); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java deleted file mode 100644 index 3b0b77435..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java +++ /dev/null @@ -1,62 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.effect; - -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.StatusEffectUtil; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; - -public class CompatStatusEffect { - private final RegistryKey registryKey; - - @Deprecated - public CompatStatusEffect(RegistryKey registryKey) { - this.registryKey = registryKey; - } - - public CompatStatusEffect of(Identifier identifier) { - return StatusEffectUtil.getStatusEffect(identifier); - } - - public Identifier getId() { - return registryKey.getRegistry(); - } - - @Deprecated - public RegistryKey getRegistryKey() { - return registryKey; - } - - public String toString() { - return getId().toString(); - } - - public boolean equals(Object obj) { - if (obj instanceof CompatStatusEffect) { - return ((CompatStatusEffect) obj).getId().equals(getId()); - } - return false; - } - - @Deprecated - public RegistryEntry getEntry(@Nullable World world) { - Optional> optionalEntry; - if (world == null) { - optionalEntry = BuiltinRegistries.createWrapperLookup() - .getOptionalEntry(registryKey); - } else { - optionalEntry = world.getRegistryManager().getOptionalEntry(registryKey); - } - - return optionalEntry.orElseThrow(); - } - - public StatusEffect getStatusEffect(@Nullable World world) { - return getEntry(world).value(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java deleted file mode 100644 index fe23894f3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java +++ /dev/null @@ -1,74 +0,0 @@ -package net.pitan76.mcpitanlib.api.entity.effect; - -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.registry.RegistryKey; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; - -public class CompatStatusEffectInstance { - private final StatusEffectInstance instance; - - @Deprecated - public CompatStatusEffectInstance(StatusEffectInstance instance) { - this.instance = instance; - } - - public StatusEffectInstance getInstance() { - return instance; - } - - public Optional getCompatStatusEffect() { - Optional> optional = instance.getEffectType().getKey(); - return optional.map(CompatStatusEffect::new); - } - - public CompatStatusEffectInstance(CompatStatusEffect effect) { - this(effect, 0, 0); - } - - public CompatStatusEffectInstance(CompatStatusEffect effect, int duration) { - this(effect, duration, 0); - } - - public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier) { - this(effect, duration, amplifier, false, true); - } - - public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean visible) { - this(effect, duration, amplifier, ambient, visible, visible); - } - - public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon) { - this(effect, duration, amplifier, ambient, showParticles, showIcon, null); - } - - public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable StatusEffectInstance hiddenEffect) { - this.instance = new StatusEffectInstance(effect.getEntry(null), duration, amplifier, ambient, showParticles, showIcon, hiddenEffect); - } - - public int getDuration() { - return instance.getDuration(); - } - - public int getAmplifier() { - return instance.getAmplifier(); - } - - public boolean isAmbient() { - return instance.isAmbient(); - } - - public boolean showParticles() { - return instance.shouldShowParticles(); - } - - public boolean showIcon() { - return instance.shouldShowIcon(); - } - - public boolean isInfinite() { - return instance.isInfinite(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java deleted file mode 100644 index 4e770c96c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -public class BaseEvent { -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java deleted file mode 100644 index b54933766..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import net.minecraft.block.Block; -import net.minecraft.command.argument.BlockStateArgumentType; -import net.pitan76.mcpitanlib.api.command.argument.BlockCommand; - -public class BlockCommandEvent extends RequiredCommandEvent { - public Block getValue() { - return BlockStateArgumentType.getBlockState(context, ((BlockCommand) getCommand()).getArgumentName()).getBlockState().getBlock(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java deleted file mode 100644 index e465945ee..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.arguments.BoolArgumentType; -import net.pitan76.mcpitanlib.api.command.argument.BooleanCommand; - -public class BooleanCommandEvent extends RequiredCommandEvent { - public Boolean getValue() { - return BoolArgumentType.getBool(context, ((BooleanCommand) getCommand()).getArgumentName()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java deleted file mode 100644 index 7b000c562..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.context.StringRange; -import net.pitan76.mcpitanlib.api.command.AbstractCommand; - -public class CommandEvent { - public CommandContext context; - public AbstractCommand command; - - public CommandContext getContext() { - return context; - } - - public void setContext(CommandContext context) { - this.context = context; - } - - public String getInput() { - return getContext().getInput(); - } - - public StringRange getRange() { - return getContext().getRange(); - } - - public void setCommand(AbstractCommand command) { - this.command = command; - } - - public AbstractCommand getCommand() { - return command; - } - - public V getArgument(String name, Class clazz) { - return getContext().getArgument(name, clazz); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java deleted file mode 100644 index b67d482a7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.arguments.DoubleArgumentType; -import net.pitan76.mcpitanlib.api.command.argument.DoubleCommand; - -public class DoubleCommandEvent extends RequiredCommandEvent { - public Double getValue() { - return DoubleArgumentType.getDouble(context, ((DoubleCommand) getCommand()).getArgumentName()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java deleted file mode 100644 index 38110c090..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.command.argument.EntitiesCommand; - -public class EntitiesCommandEvent extends RequiredCommandEvent { - public Entity getValue() { - try { - return EntityArgumentType.getEntity(context, ((EntitiesCommand) getCommand()).getArgumentName()); - } catch (CommandSyntaxException e) { - throw new RuntimeException(e); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java deleted file mode 100644 index ea90b106e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.command.argument.EntityCommand; - -public class EntityCommandEvent extends RequiredCommandEvent { - public Entity getValue() { - try { - return EntityArgumentType.getEntity(context, ((EntityCommand) getCommand()).getArgumentName()); - } catch (CommandSyntaxException e) { - throw new RuntimeException(e); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java deleted file mode 100644 index 931d4e194..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.arguments.FloatArgumentType; -import net.pitan76.mcpitanlib.api.command.argument.FloatCommand; - -public class FloatCommandEvent extends RequiredCommandEvent { - public Float getValue() { - return FloatArgumentType.getFloat(context, ((FloatCommand) getCommand()).getArgumentName()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java deleted file mode 100644 index 240e325d3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.arguments.IntegerArgumentType; -import net.pitan76.mcpitanlib.api.command.argument.IntegerCommand; - -public class IntegerCommandEvent extends RequiredCommandEvent { - public Integer getValue() { - return IntegerArgumentType.getInteger(context, ((IntegerCommand) getCommand()).getArgumentName()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java deleted file mode 100644 index 1888aa422..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import net.minecraft.command.argument.ItemStackArgumentType; -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.command.argument.ItemCommand; - -public class ItemCommandEvent extends RequiredCommandEvent { - public Item getValue() { - return ItemStackArgumentType.getItemStackArgument(context, ((ItemCommand) getCommand()).getArgumentName()).getItem(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java deleted file mode 100644 index 744678f01..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.arguments.LongArgumentType; -import net.pitan76.mcpitanlib.api.command.argument.LongCommand; - -public class LongCommandEvent extends RequiredCommandEvent { - public Long getValue() { - return LongArgumentType.getLong(context, ((LongCommand) getCommand()).getArgumentName()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java deleted file mode 100644 index 7fad3ba41..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.command.argument.PlayerCommand; - -public class PlayerCommandEvent extends RequiredCommandEvent { - public Entity getValue() { - try { - return EntityArgumentType.getPlayer(context, ((PlayerCommand) getCommand()).getArgumentName()); - } catch (CommandSyntaxException e) { - throw new RuntimeException(e); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java deleted file mode 100644 index aa845fd17..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.command.argument.PlayersCommand; - -public class PlayersCommandEvent extends RequiredCommandEvent { - public Entity getValue() { - try { - return EntityArgumentType.getPlayer(context, ((PlayersCommand) getCommand()).getArgumentName()); - } catch (CommandSyntaxException e) { - throw new RuntimeException(e); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java deleted file mode 100644 index 0ac500819..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -public abstract class RequiredCommandEvent extends ServerCommandEvent { - public abstract Object getValue(); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java deleted file mode 100644 index 8cf6a1860..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.context.CommandContext; -import com.mojang.brigadier.context.StringRange; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.Text; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; - -public class ServerCommandEvent extends CommandEvent { - - public CommandContext getContext() { - return context; - } - - public void setContext(CommandContext context) { - this.context = context; - } - - public ServerCommandSource getSource() { - return getContext().getSource(); - } - - public PlayerEntity getPlayerEntity() throws CommandSyntaxException { - return getSource().getPlayer(); - } - - public Player getPlayer() throws CommandSyntaxException { - return new Player(getPlayerEntity()); - } - - public World getWorld() { - return getSource().getWorld(); - } - - public Entity getEntity() { - return getSource().getEntity(); - } - - public String getInput() { - return getContext().getInput(); - } - - public Command getContextCommand() { - return getContext().getCommand(); - } - - public CommandContext getChild() { - return getContext().getChild(); - } - - public CommandContext getLastChild() { - return getContext().getLastChild(); - } - - public StringRange getRange() { - return getContext().getRange(); - } - - // Text - public void sendSuccess(Text message, boolean broadcastToOps) { - getSource().sendFeedback(() -> message, broadcastToOps); - } - - public void sendFailure(Text message) { - getSource().sendError(message); - } - - public void sendSuccess(Text message) { - sendSuccess(message, false); - } - - // String (Formatted) - public void sendSuccess(String message, boolean broadcastToOps) { - sendSuccess(TextUtil.convert(message), broadcastToOps); - } - - public void sendSuccess(String message) { - sendSuccess(message, false); - } - - public void sendFailure(String message) { - sendFailure(TextUtil.convert(message)); - } - - // Translatable - public void sendSuccessWithTranslatable(String message, boolean broadcastToOps) { - sendSuccess(TextUtil.convertWithTranslatable(message), broadcastToOps); - } - - public void sendSuccessWithTranslatable(String message) { - sendSuccessWithTranslatable(message, false); - } - - public void sendFailureWithTranslatable(String message) { - sendFailure(TextUtil.convertWithTranslatable(message)); - } - - // Raw - public void sendSuccessRaw(String message, boolean broadcastToOps) { - sendSuccess(TextUtil.literal(message), broadcastToOps); - } - - public void sendSuccessRaw(String message) { - sendSuccessRaw(message, false); - } - - public void sendFailureRaw(String message) { - sendFailure(TextUtil.literal(message)); - } - - public boolean isClient() { - return WorldUtil.isClient(getWorld()); - } - - public void sendSuccess(TextComponent message, boolean broadcastToOps) { - sendSuccess(message.getText(), broadcastToOps); - } - - public void sendSuccess(TextComponent message) { - sendSuccess(message.getText()); - } - - public void sendFailure(TextComponent message) { - sendFailure(message.getText()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java deleted file mode 100644 index 35042c8f6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.event; - -import com.mojang.brigadier.arguments.StringArgumentType; -import net.pitan76.mcpitanlib.api.command.argument.StringCommand; - -public class StringCommandEvent extends RequiredCommandEvent { - public String getValue() { - return StringArgumentType.getString(context, ((StringCommand) getCommand()).getArgumentName()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java deleted file mode 100644 index 087efa37b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.Property; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.state.property.IProperty; -import net.pitan76.mcpitanlib.api.util.DirectionBoolPropertyUtil; - -public class AppendPropertiesArgs extends BaseEvent { - public StateManager.Builder builder; - - public AppendPropertiesArgs(StateManager.Builder builder) { - this.builder = builder; - } - - public StateManager.Builder getBuilder() { - return builder; - } - - public void addProperty(Property... properties) { - builder.add(properties); - } - - public void addProperty(IProperty... properties) { - for (IProperty property : properties) { - builder.add(property.getProperty()); - } - } - - public void addAllDirectionBoolProperties() { - DirectionBoolPropertyUtil.addProperties(this); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java deleted file mode 100644 index a5351d2aa..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class BlockBreakEvent extends BaseEvent { - public World world; - public BlockPos pos; - public BlockState state; - public Player player; - - public BlockBreakEvent(World world, BlockPos pos, BlockState state, PlayerEntity player) { - this.world = world; - this.pos = pos; - this.state = state; - this.player = new Player(player); - } - - public BlockPos getPos() { - return pos; - } - - public BlockState getState() { - return state; - } - - public Player getPlayer() { - return player; - } - - public PlayerEntity getPlayerEntity() { - return player.getPlayerEntity(); - } - - public World getWorld() { - return world; - } - - public boolean isClient() { - return world.isClient(); - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(getWorld(), getPos()); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public IWorldView getWorldView() { - return getMidohraWorld(); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); - } - - public BlockWrapper getBlockWrapper() { - return BlockWrapper.of(state.getBlock()); - } - - public BlockEntityWrapper getBlockEntityWrapper() { - return BlockEntityWrapper.of(getBlockEntity()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java deleted file mode 100644 index c50170a81..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; - -public class BlockBreakStartEvent extends BaseEvent { - - public BlockState state; - public World world; - public BlockPos pos; - public Player player; - - public BlockBreakStartEvent(BlockState state, World world, BlockPos pos, Player player) { - this.state = state; - this.world = world; - this.pos = pos; - this.player = player; - } - - public boolean isClient() { - return WorldUtil.isClient(world); - } - - public BlockState getState() { - return state; - } - - public World getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public Player getPlayer() { - return player; - } - - public BlockPos getPlayerPos() { - return player.getBlockPos(); - } - - public ItemStack getPlayerMainHandStack() { - return player.getMainHandStack(); - } - - public ItemStack getPlayerOffHandStack() { - return player.getOffHandStack(); - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(getWorld(), getPos()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java deleted file mode 100644 index c0b365e0a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class BlockPlacedEvent extends BaseEvent { - - public World world; - public BlockPos pos; - public BlockState state; - public LivingEntity placer; - public ItemStack stack; - - public BlockPlacedEvent(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - this.world = world; - this.pos = pos; - this.state = state; - this.placer = placer; - this.stack = itemStack; - } - - public BlockState getState() { - return state; - } - - public BlockPos getPos() { - return pos; - } - - public World getWorld() { - return world; - } - - public ItemStack getStack() { - return stack; - } - - public LivingEntity getPlacer() { - return placer; - } - - public boolean isClient() { - return world.isClient(); - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(getWorld(), getPos()); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public IWorldView getWorldView() { - return getMidohraWorld(); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); - } - - public BlockWrapper getBlockWrapper() { - return BlockWrapper.of(state.getBlock()); - } - - public BlockEntityWrapper getBlockEntityWrapper() { - return BlockEntityWrapper.of(getBlockEntity()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java deleted file mode 100644 index f80420f5b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; - -public class BlockScheduledTickEvent extends BaseEvent implements BlockStatePropertyHolder { - public BlockState state; - public ServerWorld world; - public BlockPos pos; - public CompatRandom random; - - public BlockScheduledTickEvent(BlockState state, ServerWorld world, BlockPos pos, Random random) { - this.state = state; - this.world = world; - this.pos = pos; - this.random = new CompatRandom(random); - } - - public BlockState getState() { - return state; - } - - public BlockPos getPos() { - return pos; - } - - public ServerWorld getWorld() { - return world; - } - - public CompatRandom getRandom() { - return random; - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(getWorld(), getPos()); - } - - @Override - public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java deleted file mode 100644 index 9d3b86a2c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java +++ /dev/null @@ -1,143 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class BlockUseEvent extends BaseEvent { - public BlockState state; - public World world; - public BlockPos pos; - public Player player; - public Hand hand; - public BlockHitResult hit; - public ItemStack stack; - - public BlockUseEvent(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - this.state = state; - this.world = world; - this.pos = pos; - this.player = new Player(player); - this.hand = hand; - this.hit = hit; - this.stack = this.player.getStackInHand(hand); - } - - public BlockHitResult getHit() { - return hit; - } - - public ItemStack getStack() { - return stack; - } - - public Player getPlayer() { - return player; - } - - public Hand getHand() { - return hand; - } - - public World getWorld() { - return world; - } - - public BlockState getState() { - return state; - } - - public BlockPos getPos() { - return pos; - } - - public boolean isClient() { - return world.isClient(); - } - - public CompatActionResult success() { - return CompatActionResult.SUCCESS; - } - - public CompatActionResult fail() { - return CompatActionResult.FAIL; - } - - public CompatActionResult pass() { - return CompatActionResult.PASS; - } - - public CompatActionResult consume() { - return CompatActionResult.CONSUME; - } - - /** - * check if the block has a block entity - * @return true if the block has a block entity - */ - public boolean hasBlockEntity() { - return WorldUtil.hasBlockEntity(world, pos); - } - - /** - * get the block entity of the block - * @return the block entity of the block - */ - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(world, pos); - } - - public boolean isSneaking() { - return player.isSneaking(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public IWorldView getWorldView() { - return getMidohraWorld(); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); - } - - public BlockWrapper getBlockWrapper() { - return BlockWrapper.of(state.getBlock()); - } - - public BlockEntityWrapper getBlockEntityWrapper() { - return BlockEntityWrapper.of(getBlockEntity()); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } - - public Item getItem() { - return stack.getItem(); - } - - public ItemWrapper getItemWrapper() { - return ItemWrapper.of(getItem()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java deleted file mode 100644 index eb92b3f7f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.fluid.FluidState; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.FluidStateUtil; - -public class CanPathfindThroughArgs extends BaseEvent { - public BlockState state; - public NavigationType type; - - public CanPathfindThroughArgs(BlockState state, NavigationType type) { - this.state = state; - - this.type = type; - } - - public BlockState getState() { - return state; - } - - public NavigationType getType() { - return type; - } - - public FluidState getFluidState() { - return state.getFluidState(); - } - - public boolean isWaterNavigationType() { - return type == NavigationType.WATER; - } - - public boolean isAirNavigationType() { - return type == NavigationType.AIR; - } - - public boolean isLandNavigationType() { - return type == NavigationType.LAND; - } - - public boolean isWaterState() { - return FluidStateUtil.isWater(getFluidState()); - } - - public boolean isLavaState() { - return FluidStateUtil.isLava(getFluidState()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java deleted file mode 100644 index 43fab8bc5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; - -public class CollisionShapeEvent extends OutlineShapeEvent { - - public CollisionShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - super(state, world, pos, context); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java deleted file mode 100644 index b2d322b87..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.loot.context.LootContextParameters; -import net.minecraft.loot.context.LootWorldContext; -import net.pitan76.mcpitanlib.api.event.BaseEvent; - -public class DroppedStacksArgs extends BaseEvent { - public BlockState state; - public LootWorldContext.Builder builder; - - public DroppedStacksArgs(BlockState state, LootWorldContext.Builder builder) { - this.state = state; - this.builder = builder; - } - - public BlockState getState() { - return state; - } - - @Deprecated - public LootWorldContext.Builder getBuilder() { - return builder; - } - - public BlockEntity getBlockEntity() { - return builder.get(LootContextParameters.BLOCK_ENTITY); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java deleted file mode 100644 index d5b17a6ba..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java +++ /dev/null @@ -1,112 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.SoundEventUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; - -import java.util.Optional; - -public class EntityCollisionEvent extends BaseEvent { - - public BlockState state; - public World world; - public BlockPos pos; - public Entity entity; - public EntityCollisionHandler handler; - public boolean bl = false; - - public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity) { - this.state = state; - this.world = world; - this.pos = pos; - this.entity = entity; - } - - public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - this.state = state; - this.world = world; - this.pos = pos; - this.entity = entity; - this.handler = handler; - } - - public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler, boolean bl) { - this.state = state; - this.world = world; - this.pos = pos; - this.entity = entity; - this.handler = handler; - this.bl = bl; - } - - public boolean isClient() { - return WorldUtil.isClient(world); - } - - public BlockPos getEntityPos() { - return entity.getBlockPos(); - } - - public BlockPos getBlockPos() { - return pos; - } - - public BlockState getState() { - return state; - } - - public Entity getEntity() { - return entity; - } - - public World getWorld() { - return world; - } - - public void playSound(SoundEvent event, SoundCategory category, float volume, float pitch) { - WorldUtil.playSound(world, null, entity.getBlockPos(), event, category, volume, pitch); - } - - public void playSound(SoundEvent event, float volume, float pitch) { - playSound(event, SoundCategory.BLOCKS, volume, pitch); - } - - public void playSound(SoundEvent event) { - playSound(event, 1f, 1f); - } - - public void playSound(SoundEvent event, SoundCategory category) { - playSound(event, category, 1f, 1f); - } - - public void playSound(CompatIdentifier id, SoundCategory category, float volume, float pitch) { - playSound(SoundEventUtil.getSoundEvent(id), category, volume, pitch); - } - - public boolean hasPlayerEntity() { - return entity instanceof PlayerEntity; - } - - public Optional getPlayerEntity() { - if (!hasPlayerEntity()) return Optional.empty(); - return Optional.of((PlayerEntity) entity); - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(getWorld(), getBlockPos()); - } - - public EntityCollisionHandler getHandler() { - return handler; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java deleted file mode 100644 index 9bcda6872..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; - -public class FluidStateArgs { - public BlockState state; - - public FluidStateArgs(BlockState state) { - this.state = state; - } - - public BlockState getState() { - return state; - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java deleted file mode 100644 index cb8c81462..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ItemScatterer; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class ItemScattererUtil { - public static void spawn(World world, BlockPos pos, BlockEntity blockEntity) { - if (blockEntity instanceof Inventory) { - spawn(world, pos, (Inventory) blockEntity); - } - } - - public static void spawn(World world, BlockPos pos, Inventory inventory) { - ItemScatterer.spawn(world, pos, inventory); - } - - public static void spawn(World world, BlockPos pos, ItemStack stack) { - ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), stack); - } - - public static void spawn(World world, BlockPos pos, DefaultedList stacks) { - ItemScatterer.spawn(world, pos, stacks); - } - - public static void onStateReplaced(StateReplacedEvent e) { - onStateReplaced(e.getState(), e.getNewState(), e.getWorld(), e.getPos()); - } - - public static void onStateReplaced(BlockState state, BlockState newState, World world, BlockPos pos) { - ItemScatterer.onStateReplaced(state, world, pos); - } - - public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, ItemStack stack) { - spawn(world.getRaw(), pos.toMinecraft(), stack); - } - - public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, DefaultedList stacks) { - spawn(world.getRaw(), pos.toMinecraft(), stacks); - } - - public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, Inventory inventory) { - spawn(world.getRaw(), pos.toMinecraft(), inventory); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java deleted file mode 100644 index 4617ce6bc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java +++ /dev/null @@ -1,98 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.block.WireOrientation; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import org.jetbrains.annotations.Nullable; - -public class NeighborUpdateEvent extends BaseEvent { - public BlockState state; - public World world; - public BlockPos pos; - public Block sourceBlock; - - @Nullable - public BlockPos sourcePos; - - @Nullable - public WireOrientation wireOrientation; - - public boolean notify; - - public NeighborUpdateEvent(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable BlockPos sourcePos, boolean notify) { - this.state = state; - this.world = world; - this.pos = pos; - this.sourceBlock = sourceBlock; - this.sourcePos = sourcePos; - this.notify = notify; - } - - public NeighborUpdateEvent(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) { - this(state, world, pos, sourceBlock, (BlockPos) null, notify); - this.wireOrientation = wireOrientation; - } - - public BlockState getState() { - return state; - } - - public World getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public Block getSourceBlock() { - return sourceBlock; - } - - public @Nullable BlockPos getSourcePos() { - return sourcePos; - } - - public boolean isNotify() { - return notify; - } - - public boolean isReceivingRedstonePower() { - return WorldUtil.isReceivingRedstonePower(world, pos); - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(world, pos); - } - - public boolean hasBlockEntity() { - return WorldUtil.hasBlockEntity(world, pos); - } - - @Deprecated - public @Nullable WireOrientation getWireOrientation() { - return wireOrientation; - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public BlockEntityWrapper getBlockEntityWrapper() { - return BlockEntityWrapper.of(getBlockEntity()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java deleted file mode 100644 index 7131ee630..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.state.property.Property; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.state.property.IProperty; - -public class OutlineShapeEvent extends BaseEvent { - public BlockState state; - public BlockView world; - public BlockPos pos; - public ShapeContext context; - - public OutlineShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - this.state = state; - this.world = world; - this.pos = pos; - this.context = context; - } - - public BlockPos getPos() { - return pos; - } - - public BlockState getState() { - return state; - } - - public BlockView getWorld() { - return world; - } - - public ShapeContext getContext() { - return context; - } - - public > T getProperty(Property property) { - return state.get(property); - } - - public > boolean containsProperty(Property property) { - return state.contains(property); - } - - public , V extends T> BlockState with(Property property, V value) { - return state.with(property, value); - } - - public > T get(IProperty property) { - return getProperty(property.getProperty()); - } - - public > boolean contains(IProperty property) { - return containsProperty(property.getProperty()); - } - - public , V extends T> net.pitan76.mcpitanlib.midohra.block.BlockState with(IProperty property, V value) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(with(property.getProperty(), value)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java deleted file mode 100644 index 762907be8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java +++ /dev/null @@ -1,93 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import org.jetbrains.annotations.Nullable; - -public class PickStackEvent { - - @Deprecated - public WorldView worldView; - - @Deprecated - public BlockView blockView; - - public BlockPos pos; - public BlockState state; - - public boolean includeData = true; - - public PickStackEvent(WorldView world, BlockPos pos, BlockState state) { - this.worldView = world; - this.pos = pos; - this.state = state; - } - - public PickStackEvent(BlockView world, BlockPos pos, BlockState state) { - this.blockView = world; - this.pos = pos; - this.state = state; - } - - public BlockState getState() { - return state; - } - - public BlockPos getPos() { - return pos; - } - - @Nullable - public BlockView getBlockView() { - return blockView; - } - - @Nullable - public WorldView getWorldView() { - return worldView; - } - - /** - * check if the block has a block entity - * @return boolean - */ - public boolean hasBlockEntity() { - return getBlockEntity() != null; - } - - /** - * @return BlockEntity - */ - public BlockEntity getBlockEntity() { - if (blockView != null) - return blockView.getBlockEntity(pos); - if (worldView != null) - return worldView.getBlockEntity(pos); - return null; - } - - public boolean isClient() { - if (blockView != null) - return getBlockEntity().getWorld().isClient(); - if (worldView != null) - return worldView.isClient(); - - try { - net.minecraft.client.MinecraftClient.getInstance(); - return true; - } catch (Error e) { - return false; - } - } - - public void setIncludeData(boolean includeData) { - this.includeData = includeData; - } - - public boolean isIncludeData() { - return includeData; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java deleted file mode 100644 index 63df37634..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java +++ /dev/null @@ -1,125 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.property.Property; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; -import net.pitan76.mcpitanlib.api.state.property.IProperty; -import net.pitan76.mcpitanlib.api.util.BlockStateUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; -import org.jetbrains.annotations.Nullable; - -public class PlacementStateArgs extends BaseEvent { - public ItemPlacementContext ctx; - - @Nullable - public Block block; - - public PlacementStateArgs(ItemPlacementContext ctx) { - this.ctx = ctx; - } - - public PlacementStateArgs(ItemPlacementContext ctx, @Nullable Block block) { - this.ctx = ctx; - this.block = block; - } - - public boolean canPlace() { - return ctx.canPlace(); - } - - public BlockPos getPos() { - return ctx.getBlockPos(); - } - - public Player getPlayer() { - return new Player(ctx.getPlayer()); - } - - public Direction[] getPlacementDirections() { - return ctx.getPlacementDirections(); - } - - public Hand getHand() { - return ctx.getHand(); - } - - public Direction getSide() { - return ctx.getSide(); - } - - public Direction getHorizontalPlayerFacing() { - return ctx.getHorizontalPlayerFacing(); - } - - public float getPlayerYaw() { - return ctx.getPlayerYaw(); - } - - public World getWorld() { - return ctx.getWorld(); - } - - public boolean isClient() { - return getWorld().isClient(); - } - - public Vec3d getHitPos() { - return ctx.getHitPos(); - } - - public boolean canReplaceExisting() { - return ctx.canReplaceExisting(); - } - - @Deprecated - public ItemUsageContextMixin getIUCAccessor() { - return (ItemUsageContextMixin) ctx; - } - - public BlockHitResult getHitResult() { - return getIUCAccessor().getHit(); - } - - public ItemUseOnBlockEvent toItemUseOnBlockEvent() { - return new ItemUseOnBlockEvent(getWorld(), getPlayer().getPlayerEntity(), getHand(), ctx.getStack(), getHitResult()); - } - - public ItemPlacementContext getCtx() { - return ctx; - } - - public , V extends T> BlockState withBlockState(Property property, V value) { - if (block == null) - return null; - - return BlockStateUtil.with(BlockStateUtil.getDefaultState(block), property, value); - } - - public , V extends T> net.pitan76.mcpitanlib.midohra.block.BlockState with(IProperty property, V value) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(withBlockState(property.getProperty(), value)); - } - - public BlockState getBlockState() { - return BlockStateUtil.getDefaultState(block); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState()); - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(getWorld(), getPos()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java deleted file mode 100644 index bc140e4cd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; - -public class ScreenHandlerCreateEvent extends BaseEvent { - - public BlockState state; - public World world; - public BlockPos pos; - public int syncId; - public PlayerInventory inventory; - public Player player; - - public ScreenHandlerCreateEvent(BlockState state, World world, BlockPos pos, int syncId, PlayerInventory inventory, PlayerEntity player) { - this.state = state; - this.world = world; - this.pos = pos; - this.syncId = syncId; - this.inventory = inventory; - this.player = new Player(player); - } - - public BlockState getState() { - return state; - } - - public BlockPos getPos() { - return pos; - } - - public World getWorld() { - return world; - } - - public int getSyncId() { - return syncId; - } - - public PlayerInventory getInventory() { - return inventory; - } - - public Player getPlayer() { - return player; - } - - public boolean isClient() { - return world.isClient(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java deleted file mode 100644 index 75cacef6a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.util.shape.VoxelShape; - -import java.util.function.Function; - -public class ShapesForStatesArgs { - public Function stateToShape; - - public ShapesForStatesArgs(Function stateToShape) { - this.stateToShape = stateToShape; - } - - public Function getStateToShape() { - return stateToShape; - } - - public VoxelShape getShape(BlockState state) { - return stateToShape.apply(state); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java deleted file mode 100644 index 034355d4c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java +++ /dev/null @@ -1,86 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; - -public class StateForNeighborUpdateArgs { - public BlockState state; - public Direction direction; - public BlockState neighborState; - public WorldView world; - public BlockPos pos; - public BlockPos neighborPos; - public ScheduledTickView tickView; - public CompatRandom random; - - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { - this.state = state; - this.direction = direction; - this.neighborState = neighborState; - this.world = world; - this.pos = pos; - this.neighborPos = neighborPos; - } - - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldView world, BlockPos pos, BlockPos neighborPos, ScheduledTickView tickView, CompatRandom random) { - this.state = state; - this.direction = direction; - this.neighborState = neighborState; - this.world = world; - this.pos = pos; - this.neighborPos = neighborPos; - this.tickView = tickView; - this.random = random; - } - - public BlockState getState() { - return state; - } - - public BlockEntity getBlockEntity() { - return world.getBlockEntity(pos); - } - - public BlockState getBlockState(BlockPos pos) { - return world.getBlockState(pos); - } - - public BlockEntity getBlockEntity(BlockPos pos) { - return world.getBlockEntity(pos); - } - - public Direction getDirection() { - return direction; - } - - public BlockState getNeighborState() { - return neighborState; - } - - public WorldView getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public BlockPos getNeighborPos() { - return neighborPos; - } - - public CompatRandom getRandom() { - return random; - } - - @Deprecated - public ScheduledTickView getTickView() { - return tickView; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java deleted file mode 100644 index 4be061fb6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java +++ /dev/null @@ -1,132 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class StateReplacedEvent extends BaseEvent { - - public BlockState state; - public World world; - public BlockPos pos; - public BlockState newState; - public boolean moved; - - // Captured at construction time so getBlockEntity() works even after the world (1.21.x) - private final BlockEntity cachedBlockEntity; - - public StateReplacedEvent(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { - this.state = state; - this.world = world; - this.pos = pos; - this.newState = newState; - this.moved = moved; - - this.cachedBlockEntity = WorldUtil.hasBlockEntity(world, pos) ? WorldUtil.getBlockEntity(world, pos) : null; - } - - public BlockState getState() { - return state; - } - - public World getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public BlockState getNewState() { - return newState; - } - - public boolean isMoved() { - return moved; - } - - public boolean isClient() { - return world.isClient(); - } - - /** - * check if the block is the same state - * @return boolean - */ - public boolean isSameState() { - return state.isOf(newState.getBlock()); - } - - /** - * check if the block has a block entity - * @return boolean - */ - public boolean hasBlockEntity() { - return getBlockEntity() != null; - } - - /** - * get the block entity - *

- * The block entity is captured at event creation time, so this returns a valid - * reference even in MC 1.21.x where the world removes the BE before - * onStateReplaced is invoked. - * @return BlockEntity - */ - public BlockEntity getBlockEntity() { - if (cachedBlockEntity != null) return cachedBlockEntity; - return WorldUtil.getBlockEntity(world, pos); - } - - /** - * spawn the drops in the container - */ - public void spawnDropsInContainer() { - if (isSameState() || !hasInventory()) return; - - ItemScattererUtil.spawn(getWorld(), getPos(), getBlockEntity()); - updateComparators(); - } - - public boolean hasInventory() { - return getBlockEntity() instanceof Inventory; - } - - /** - * update the comparators - */ - public void updateComparators() { - WorldUtil.updateComparators(getWorld(), getPos(), getState().getBlock()); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public IWorldView getWorldView() { - return getMidohraWorld(); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); - } - - public BlockWrapper getBlockWrapper() { - return BlockWrapper.of(state.getBlock()); - } - - public BlockEntityWrapper getBlockEntityWrapper() { - return BlockEntityWrapper.of(getBlockEntity()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java deleted file mode 100644 index ff0ad3ed9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block; - -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.pitan76.mcpitanlib.api.event.BaseEvent; - -public class TileCreateEvent extends BaseEvent { - - // ~1.16.5 - private BlockView blockView; - - public TileCreateEvent(BlockView blockView) { - this.blockView = blockView; - this.blockPos = null; - this.blockState = null; - } - - public BlockView getBlockView() { - return blockView; - } - - public void setBlockView(BlockView blockView) { - this.blockView = blockView; - } - - public boolean hasBlockView() { - return (blockView != null); - } - // ---- - - // 1.17~ - private BlockPos blockPos; - private BlockState blockState; - - public TileCreateEvent(BlockPos blockPos, BlockState blockState) { - this.blockView = null; - this.blockPos = blockPos; - this.blockState = blockState; - } - - public BlockPos getBlockPos() { - return blockPos; - } - - public void setBlockPos(BlockPos blockPos) { - this.blockPos = blockPos; - } - - public boolean hasBlockPos() { - return (blockPos != null); - } - - public BlockState getBlockState() { - return blockState; - } - - public void setBlockState(BlockState blockState) { - this.blockState = blockState; - } - - public boolean hasBlockState() { - return (blockState != null); - } - // ---- -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java deleted file mode 100644 index 4973eee09..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.block.result; - -import net.minecraft.block.BlockState; - -public class BlockBreakResult { - public BlockState state; - - public BlockBreakResult(BlockState state) { - this.state = state; - } - - public BlockState getState() { - return state; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java deleted file mode 100644 index b82cfe48a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.container.factory; - -import net.pitan76.mcpitanlib.api.event.BaseEvent; - -public class DisplayNameArgs extends BaseEvent { - public DisplayNameArgs() { - super(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java deleted file mode 100644 index 2b8c2d729..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.container.factory; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.network.ServerPlayerEntity; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.network.PacketByteUtil; - -public class ExtraDataArgs extends BaseEvent { - public PacketByteBuf buf; - public ServerPlayerEntity player; - - public ExtraDataArgs(PacketByteBuf buf, ServerPlayerEntity player) { - super(); - this.buf = buf; - this.player = player; - } - - public ExtraDataArgs() { - super(); - } - - public ExtraDataArgs(PacketByteBuf buf) { - super(); - this.buf = buf; - } - - public boolean hasPlayer() { - return player != null; - } - - public boolean hasBuf() { - return buf != null; - } - - public PacketByteBuf getBuf() { - return buf; - } - - public ServerPlayerEntity getPlayer() { - return player; - } - - public Player getCompatPlayer() { - return new Player(player); - } - - /** - * @param obj The object to write - * @see PacketByteUtil#writeVar(PacketByteBuf, Object) - */ - public void writeVar(Object obj) { - PacketByteUtil.writeVar(getBuf(), obj); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java deleted file mode 100644 index 0ea55b691..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.entity; - -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.Vec3d; -import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; - -public class CollisionEvent { - - public HitResult hitResult; - - public CollisionEvent(HitResult hitResult) { - this.hitResult = hitResult; - } - - public HitResult getHitResult() { - return hitResult; - } - - public HitResult.Type getType() { - return hitResult.getType(); - } - - public Vec3d getPos() { - return hitResult.getPos(); - } - - public net.pitan76.mcpitanlib.midohra.util.hit.HitResult getHitResultM() { - return net.pitan76.mcpitanlib.midohra.util.hit.HitResult.of(getHitResult()); - } - - public HitResultType getHitResultTypeM() { - return HitResultType.from(getType()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java deleted file mode 100644 index 048b496ed..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.entity; - -import net.minecraft.entity.Entity; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; - -public class EntityHitEvent { - - public EntityHitResult entityHitResult; - - public EntityHitEvent(EntityHitResult result) { - this.entityHitResult = result; - } - - public EntityHitResult getEntityHitResult() { - return entityHitResult; - } - - public Entity getEntity() { - return entityHitResult.getEntity(); - } - - public HitResult.Type getType() { - return entityHitResult.getType(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java deleted file mode 100644 index 875b6a939..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.entity; - -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import org.jetbrains.annotations.Nullable; - -public class InitDataTrackerArgs { - public DataTracker.Builder builder; - public DataTracker tracker; - - public InitDataTrackerArgs(DataTracker.Builder builder) { - this.builder = builder; - } - - public InitDataTrackerArgs(DataTracker tracker) { - this.tracker = tracker; - } - - public InitDataTrackerArgs(DataTracker.Builder builder, @Nullable DataTracker tracker) { - this.builder = builder; - this.tracker = tracker; - } - - public DataTracker.Builder getBuilder() { - return builder; - } - - public DataTracker.Builder add(TrackedData data, T value) { - return builder.add(data, value); - } - - public void set(TrackedData data, T value) { - tracker.set(data, value); - } - - public void addTracking(TrackedData data, T value) { - if (builder != null) { - add(data, value); - return; - } - - if (tracker != null) { - set(data, value); - return; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java deleted file mode 100644 index 769b66b63..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.damage.DamageSource; - -public class BonusAttackDamageArgs { - - public Entity target; - public float baseAttackDamage; - public DamageSource damageSource; - - public BonusAttackDamageArgs(Entity target, float baseAttackDamage, DamageSource damageSource) { - this.target = target; - this.baseAttackDamage = baseAttackDamage; - this.damageSource = damageSource; - } - - public Entity getTarget() { - return target; - } - - public float getBaseAttackDamage() { - return baseAttackDamage; - } - - public DamageSource getDamageSource() { - return damageSource; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java deleted file mode 100644 index 8456d4488..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.util.WorldUtil; - -public class CanMineArgs { - public BlockState state; - public World world; - public BlockPos pos; - - @Deprecated - public Player miner; - - @Deprecated - public ItemStack stack; - - public LivingEntity entity; - - public CanMineArgs(BlockState state, World world, BlockPos pos, PlayerEntity miner) { - this.state = state; - this.world = world; - this.pos = pos; - this.miner = new Player(miner); - this.entity = miner; - } - - public CanMineArgs(ItemStack stack, BlockState state, World world, BlockPos pos, LivingEntity entity) { - this.stack = stack; - this.state = state; - this.world = world; - this.pos = pos; - this.entity = entity; - - if (entity instanceof PlayerEntity) { - this.miner = new Player((PlayerEntity) entity); - } - } - - public BlockState getState() { - return state; - } - - public World getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public Player getMiner() { - return miner; - } - - public boolean isExistMiner() { - return miner.getEntity() != null; - } - - public boolean isClient() { - return WorldUtil.isClient(world); - } - - public ItemStack getStack() { - return stack != null ? stack : entity.getMainHandStack(); - } - - public LivingEntity getEntity() { - return entity; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java deleted file mode 100644 index 2bd98d890..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.event.BaseEvent; - -public class CanRepairArgs extends BaseEvent { - public ItemStack stack; - public ItemStack ingredient; - - public CanRepairArgs(ItemStack stack, ItemStack ingredient) { - this.stack = stack; - this.ingredient = ingredient; - } - - public ItemStack getStack() { - return stack; - } - - public ItemStack getIngredient() { - return ingredient; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java deleted file mode 100644 index a80abdbba..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import org.jetbrains.annotations.Nullable; - -public class CraftEvent { - - public ItemStack stack; - public World world; - public Player player; - - public CraftEvent(ItemStack stack, World world, Player player) { - this.stack = stack; - this.world = world; - this.player = player; - } - - public CraftEvent(ItemStack stack, World world, PlayerEntity player) { - this.stack = stack; - this.world = world; - this.player = new Player(player); - } - - public CraftEvent(ItemStack stack, World world) { - this.stack = stack; - this.world = world; - } - - public ItemStack getStack() { - return stack; - } - - public World getWorld() { - return world; - } - - @Nullable - public Player getPlayer() { - return player; - } - - public boolean isClient() { - return world.isClient(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java deleted file mode 100644 index 17392a835..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -public class EnchantabilityArgs { - public EnchantabilityArgs() { - - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java deleted file mode 100644 index d466f2a51..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.item.ItemStack; - -public class EnchantableArgs { - - public ItemStack stack; - - public EnchantableArgs(ItemStack stack) { - this.stack = stack; - } - - public ItemStack getStack() { - return stack; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java deleted file mode 100644 index 58b0913e9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.api.util.entity.EquipmentSlotUtil; -import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; - -public class InventoryTickEvent extends BaseEvent { - public ItemStack stack; - public World world; - public Entity entity; - public int slot; - public boolean selected; - public EquipmentSlot equipmentSlot; - - public InventoryTickEvent(ItemStack stack, World world, Entity entity, int slot, boolean selected) { - this.stack = stack; - this.world = world; - this.entity = entity; - this.slot = slot; - this.selected = selected; - this.equipmentSlot = EquipmentSlotUtil.fromEntitySlotId(slot); - } - - public InventoryTickEvent(ItemStack stack, ServerWorld world, Entity entity, EquipmentSlot slot) { - this(stack, world, entity, EquipmentSlotUtil.getEntitySlotId(slot), isSelected(entity, slot, stack)); - this.equipmentSlot = slot; - } - - private static boolean isSelected(Entity entity, EquipmentSlot slot, ItemStack stack) { - if (entity instanceof LivingEntity) { - LivingEntity livingEntity = (LivingEntity) entity; - ItemStack equippedStack = LivingEntityUtil.getEquippedStack(livingEntity, slot); - return equippedStack.isOf(stack.getItem()) && equippedStack.getCount() == stack.getCount(); - } else { - return false; - } - } - - public ItemStack getStack() { - return stack; - } - - public World getWorld() { - return world; - } - - public boolean isServer() { - return !isClient(); - } - - public ServerWorld getServerWorld() { - return (ServerWorld) world; - } - - public Entity getEntity() { - return entity; - } - - public int getSlot() { - return slot; - } - - public boolean isSelected() { - return selected; - } - - public boolean isClient() { - return WorldUtil.isClient(world); - } - - public EquipmentSlot getEquipmentSlot() { - return equipmentSlot; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java deleted file mode 100644 index e695b5369..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - -public class ItemAppendTooltipEvent extends BaseEvent { - public ItemStack stack; - - @Deprecated - public World world; - - @Deprecated - public List tooltip; - - public TooltipType type; - public Item.TooltipContext context; - - public TooltipDisplayComponent displayComponent; - public Consumer textConsumer; - - public ItemAppendTooltipEvent(ItemStack stack, @Nullable World world, List tooltip, TooltipType type, Item.TooltipContext context) { - this.stack = stack; - this.world = world; - this.tooltip = tooltip; - this.type = type; - this.context = context; - } - - public ItemAppendTooltipEvent(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { - this.stack = stack; - this.context = context; - this.displayComponent = displayComponent; - this.textConsumer = textConsumer; - this.type = type; - } - - public ItemStack getStack() { - return stack; - } - - public World getWorld() { - return world; - } - - public List getTooltip() { - return new ArrayList<>(); - } - - public Item.TooltipContext getContext() { - return context; - } - - public void addTooltip(Text text) { - textConsumer.accept(text); - } - - public void addTooltip(List texts) { - for (Text text : texts) { - addTooltip(text); - } - } - - public boolean removeTooltip(Text text) { - return false; - } - - public boolean isCreative() { - return type.isCreative(); - } - - public boolean isAdvanced() { - return type.isAdvanced(); - } - - public CompatRegistryLookup getRegistryLookup() { - return RegistryLookupUtil.getRegistryLookup(this); - } - - public void addTooltip(TextComponent textComponent) { - addTooltip(textComponent.getText()); - } - - public void addTooltip(String text) { - addTooltip(TextUtil.literal(text)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java deleted file mode 100644 index aae12a9a0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.item.ItemStack; - -public class ItemBarColorArgs { - - public ItemStack stack; - - public ItemBarColorArgs(ItemStack stack) { - this.stack = stack; - } - - public ItemStack getStack() { - return stack; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java deleted file mode 100644 index 86742fa45..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.item.ItemStack; - -public class ItemBarStepArgs { - - public ItemStack stack; - - public ItemBarStepArgs(ItemStack stack) { - this.stack = stack; - } - - public ItemStack getStack() { - return stack; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java deleted file mode 100644 index 509bb4634..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.item.ItemStack; - -public class ItemBarVisibleArgs { - - public ItemStack stack; - - public ItemBarVisibleArgs(ItemStack stack) { - this.stack = stack; - } - - public ItemStack getStack() { - return stack; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java deleted file mode 100644 index 6aa476db8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; - -public class ItemFinishUsingEvent extends BaseEvent { - public ItemStack stack; - public World world; - public LivingEntity user; - - public ItemFinishUsingEvent(ItemStack stack, World world, LivingEntity user) { - this.stack = stack; - this.world = world; - this.user = user; - } - - public ItemStack getStack() { - return stack; - } - - public World getWorld() { - return world; - } - - public LivingEntity getUser() { - return user; - } - - public boolean isClient() { - return world.isClient(); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } - - public net.pitan76.mcpitanlib.midohra.world.World getWorldM() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public Item getItem() { - return stack.getItem(); - } - - public ItemWrapper getItemWrapper() { - return ItemWrapper.of(getItem()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java deleted file mode 100644 index 2f76d9aa6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java +++ /dev/null @@ -1,124 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.StackActionResult; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class ItemUseEvent extends BaseEvent { - - public World world; - public Player user; - public Hand hand; - public ItemStack stack; - - public ItemUseEvent(World world, PlayerEntity user, Hand hand) { - this.world = world; - this.user = new Player(user); - this.hand = hand; - this.stack = user.getStackInHand(hand); - } - - public ItemStack getStack() { - return stack; - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } - - public Hand getHand() { - return hand; - } - - public World getWorld() { - return world; - } - - public Player getUser() { - return user; - } - - public boolean isClient() { - return world.isClient(); - } - - public StackActionResult success(ItemStack stack) { - if (getStack() != stack) - StackActionResult.success(stack); - - return success(); - } - - public StackActionResult success(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return success(stack.toMinecraft()); - } - - public StackActionResult success() { - return StackActionResult.create(CompatActionResult.SUCCESS); - } - - public StackActionResult fail() { - return StackActionResult.fail(); - } - - public StackActionResult fail(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return StackActionResult.fail(stack.toMinecraft()); - } - - public StackActionResult pass() { - return StackActionResult.pass(); - } - - public StackActionResult pass(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return StackActionResult.pass(stack.toMinecraft()); - } - - public StackActionResult consume(ItemStack stack) { - if (getStack() != stack) - StackActionResult.consume(stack); - - return consume(); - } - - public CompatActionResult consume(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return consume(stack.toMinecraft()); - } - - public StackActionResult consume() { - return StackActionResult.create(CompatActionResult.CONSUME); - } - - public boolean isSneaking() { - return user.isSneaking(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public IWorldView getWorldView() { - return getMidohraWorld(); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); - } - - public Item getItem() { - return stack.getItem(); - } - - public ItemWrapper getItemWrapper() { - return ItemWrapper.of(getItem()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java deleted file mode 100644 index 06e5b9c6b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java +++ /dev/null @@ -1,158 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; -import org.jetbrains.annotations.Nullable; - -public class ItemUseOnBlockEvent extends BaseEvent { - public Player player; - public Hand hand; - public BlockHitResult hit; - public ItemStack stack; - public World world; - public BlockPos blockPos; - - public ItemUseOnBlockEvent(PlayerEntity player, Hand hand, BlockHitResult hit) { - this(player.getEntityWorld(), player, hand, player.getStackInHand(hand), hit); - } - - public ItemUseOnBlockEvent(World world, @Nullable PlayerEntity player, Hand hand, ItemStack stack, BlockHitResult hit) { - if (player != null) - this.player = new Player(player); - this.hand = hand; - this.hit = hit; - this.stack = stack; - this.world = world; - this.blockPos = hit.getBlockPos(); - } - - public ItemUseOnBlockEvent(Player player, Hand hand, BlockHitResult hit) { - this(player.getWorld(), player.getEntity(), hand, player.getStackInHand(hand), hit); - } - - public ItemUsageContext toIUC() { - return new ItemUsageContext(player.getPlayerEntity(), hand, hit); - } - - public boolean isClient() { - return world.isClient(); - } - - public Player getPlayer() { - return player; - } - - public World getWorld() { - return world; - } - - public BlockHitResult getHit() { - return hit; - } - - public BlockPos getBlockPos() { - return blockPos; - } - - public Hand getHand() { - return hand; - } - - public ItemStack getStack() { - return stack; - } - - public CompatActionResult success() { - return CompatActionResult.SUCCESS; - } - - public CompatActionResult fail() { - return CompatActionResult.FAIL; - } - - public CompatActionResult pass() { - return CompatActionResult.PASS; - } - - public CompatActionResult consume() { - return CompatActionResult.CONSUME; - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(world, blockPos); - } - - public boolean hasBlockEntity() { - return WorldUtil.hasBlockEntity(world, blockPos); - } - - public BlockState getBlockState() { - return WorldUtil.getBlockState(world, blockPos); - } - - public Vec3d getPos() { - return hit.getPos(); - } - - public Direction getSide() { - return hit.getSide(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public IWorldView getWorldView() { - return getMidohraWorld(); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState()); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getBlockPos()); - } - - public BlockWrapper getBlockWrapper() { - return getMidohraState().getBlock(); - } - - public BlockEntityWrapper getBlockEntityWrapper() { - return BlockEntityWrapper.of(getBlockEntity()); - } - - public boolean isSneaking() { - return player.isSneaking(); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } - - public Item getItem() { - return stack.getItem(); - } - - public ItemWrapper getItemWrapper() { - return ItemWrapper.of(getItem()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java deleted file mode 100644 index e2675e4db..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; - -public class ItemUseOnEntityEvent extends BaseEvent { - - public ItemStack stack; - public Player user; - public LivingEntity entity; - public Hand hand; - - public ItemUseOnEntityEvent(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { - this.stack = stack; - this.user = new Player(user); - this.hand = hand; - this.entity = entity; - } - - public ItemUseOnEntityEvent(ItemStack stack, Player user, LivingEntity entity, Hand hand) { - this.stack = stack; - this.user = user; - this.hand = hand; - this.entity = entity; - } - - public ItemStack getStack() { - return stack; - } - - public Hand getHand() { - return hand; - } - - public Player getUser() { - return user; - } - - public LivingEntity getEntity() { - return entity; - } - - public boolean isClient() { - return user.isClient(); - } - - public CompatActionResult success() { - return CompatActionResult.SUCCESS; - } - - public CompatActionResult fail() { - return CompatActionResult.FAIL; - } - - public CompatActionResult pass() { - return CompatActionResult.PASS; - } - - public CompatActionResult consume() { - return CompatActionResult.CONSUME; - } - - public boolean isSneaking() { - return user.isSneaking(); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } - - public Item getItem() { - return stack.getItem(); - } - - public ItemWrapper getItemWrapper() { - return ItemWrapper.of(getItem()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java deleted file mode 100644 index 1f5083152..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.event.BaseEvent; - -public class PostHitEvent extends BaseEvent { - public ItemStack stack; - public LivingEntity target; - public LivingEntity attacker; - - public PostHitEvent(ItemStack stack, LivingEntity target, LivingEntity attacker) { - this.stack = stack; - this.target = target; - this.attacker = attacker; - } - - public ItemStack getStack() { - return stack; - } - - public LivingEntity getAttacker() { - return attacker; - } - - public LivingEntity getTarget() { - return target; - } - - /** - * Damages the stack in the given slot - * @param amount the amount of damage to deal - * @param slot the slot to damage - */ - public void damageStack(int amount, EquipmentSlot slot) { - stack.damage(amount, attacker, slot); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java deleted file mode 100644 index 73ca209bc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java +++ /dev/null @@ -1,118 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.item; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.BaseEvent; -import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.BlockUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; - -public class PostMineEvent extends BaseEvent { - public ItemStack stack; - public World world; - public BlockState state; - public BlockPos pos; - public LivingEntity miner; - - public PostMineEvent(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - this.stack = stack; - this.world = world; - this.state = state; - this.pos = pos; - this.miner = miner; - } - - public BlockState getState() { - return state; - } - - public BlockPos getPos() { - return pos; - } - - public World getWorld() { - return world; - } - - public ItemStack getStack() { - return stack; - } - - public LivingEntity getMiner() { - return miner; - } - - public BlockEntity getBlockEntity() { - return WorldUtil.getBlockEntity(world, pos); - } - - public boolean isClient() { - return world.isClient(); - } - - public boolean stateIsIn(TagKey tagKey) { - return BlockUtil.isIn(state.getBlock(), tagKey); - } - - public boolean stateIsOf(Block block) { - return BlockUtil.isEqual(state.getBlock(), block); - } - - /** - * Damages the stack in the given slot - * @param amount the amount of damage to deal - * @param slot the slot to damage - */ - public void damageStack(int amount, EquipmentSlot slot) { - stack.damage(amount, miner, slot); - } - - /** - * Damages the stack in the given slot - * @param amount the amount of damage to deal - * @param type the type of armor equipment - */ - public void damageStack(int amount, ArmorEquipmentType type) { - stack.damage(amount, miner, type.getSlot()); - } - - /** - * Damages the stack in the main hand - * @param amount the amount of damage to deal - */ - public void damageStack(int amount) { - stack.damage(amount, miner, EquipmentSlot.MAINHAND); - } - - public boolean isPlayer() { - return miner instanceof PlayerEntity; - } - - public Player getPlayer() { - if (isPlayer()) - return new Player((PlayerEntity) miner); - - return null; - } - - public boolean isCreative() { - return isPlayer() && getPlayer().isCreative(); - } - - public boolean isSneaking() { - return miner.isSneaking(); - } - - public ItemStack getMainHandStack() { - return miner.getMainHandStack(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java deleted file mode 100644 index 7f935aa41..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.nbt; - -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; - -public class NbtRWArgs { - public NbtCompound nbt; - public CompatRegistryLookup registryLookup; - - public NbtRWArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { - this.nbt = nbt; - this.registryLookup = registryLookup; - } - - @Deprecated - public NbtRWArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { - this(nbt, new CompatRegistryLookup(wrapperLookup)); - } - - public NbtRWArgs(NbtCompound nbt) { - this(nbt, (CompatRegistryLookup) null); - } - - public NbtCompound getNbt() { - return nbt; - } - - public CompatRegistryLookup getRegistryLookup() { - return registryLookup; - } - - public boolean hasRegistryLookup() { - return registryLookup != null; - } - - @Deprecated - public RegistryWrapper.WrapperLookup getWrapperLookup() { - if (registryLookup == null) - registryLookup = new CompatRegistryLookup(); - - return registryLookup.getRegistryLookup(); - } - - public boolean isNbtEmpty() { - return nbt != null && !nbt.isEmpty(); - } - - public boolean isViewEmpty() { - return false; - } - - public boolean isEmpty() { - return isNbtEmpty() || isViewEmpty(); - } - - public NbtRWArgs copy() { - return new NbtRWArgs(nbt.copy(), registryLookup); - } - - public net.pitan76.mcpitanlib.midohra.nbt.NbtCompound getNbtM() { - return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(nbt); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java deleted file mode 100644 index 70f6e57a3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.nbt; - -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.ReadView; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; - -public class ReadNbtArgs extends NbtRWArgs { - @Deprecated - public ReadView view; - - @Deprecated - public ReadNbtArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { - super(nbt, wrapperLookup); - } - - public ReadNbtArgs(NbtCompound nbt) { - super(nbt); - if (registryLookup == null) - registryLookup = new CompatRegistryLookup(); - view = NbtDataConverter.nbt2readData(nbt, registryLookup); - } - - public ReadNbtArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { - super(nbt, registryLookup); - view = NbtDataConverter.nbt2readData(nbt, registryLookup); - } - - @Deprecated - public ReadNbtArgs(NbtCompound nbt, ReadView view) { - this(nbt); - this.view = view; - } - - @Deprecated - public ReadNbtArgs(NbtCompound nbt, ReadView view, CompatRegistryLookup registryLookup) { - this(nbt, registryLookup); - this.view = view; - } - - @Override - public boolean isViewEmpty() { - return view == null; - } - - @Override - public NbtRWArgs copy() { - return new ReadNbtArgs(nbt.copy(), view, registryLookup); - } - - public ReadNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, CompatRegistryLookup registryLookup) { - this(nbt.toMinecraft(), registryLookup); - } - - public ReadNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { - this(nbt.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java deleted file mode 100644 index 1403f1bb9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.nbt; - -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.storage.WriteView; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; - -public class WriteNbtArgs extends NbtRWArgs { - @Deprecated - public WriteView view; - - @Deprecated - public WriteNbtArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { - super(nbt, wrapperLookup); - } - - public WriteNbtArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { - super(nbt, registryLookup); - view = NbtDataConverter.nbt2writeData(nbt, registryLookup); - } - - public WriteNbtArgs(NbtCompound nbt) { - super(nbt); - view = NbtDataConverter.nbt2writeData(nbt, (CompatRegistryLookup) null); - } - - @Deprecated - public WriteNbtArgs(NbtCompound nbt, WriteView view) { - this(nbt); - this.view = view; - } - - @Deprecated - public WriteNbtArgs(NbtCompound nbt, WriteView view, CompatRegistryLookup registryLookup) { - this(nbt, registryLookup); - this.view = view; - } - - @Override - public boolean isViewEmpty() { - return view == null; - } - - @Override - public NbtRWArgs copy() { - return new WriteNbtArgs(nbt.copy(), view, registryLookup); - } - - public WriteNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, CompatRegistryLookup registryLookup) { - this(nbt.toMinecraft(), registryLookup); - } - - public WriteNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { - this(nbt.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java deleted file mode 100644 index 67dcae814..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.result; - -import net.minecraft.util.ActionResult; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; - -public class EventResult { - - protected final dev.architectury.event.EventResult result; - - private static final EventResult TRUE = new EventResult(dev.architectury.event.EventResult.interruptTrue()); - private static final EventResult STOP = new EventResult(dev.architectury.event.EventResult.interruptDefault()); - private static final EventResult PASS = new EventResult(dev.architectury.event.EventResult.pass()); - private static final EventResult FALSE = new EventResult(dev.architectury.event.EventResult.interruptFalse()); - - - protected EventResult(dev.architectury.event.EventResult result) { - this.result = result; - } - - public static EventResult success() { - return TRUE; - } - - public static EventResult stop() { - return STOP; - } - - public static EventResult pass() { - return PASS; - } - - public static EventResult fail() { - return FALSE; - } - - @Deprecated - public dev.architectury.event.EventResult getResult() { - return result; - } - - public ActionResult toActionResult() { - return result.asMinecraft(); - } - - public CompatActionResult toCompatActionResult() { - return CompatActionResult.create(toActionResult()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java deleted file mode 100644 index dacb8ca36..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.result; - -import dev.architectury.event.CompoundEventResult; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; - -public class TypedEventResult { - protected final dev.architectury.event.CompoundEventResult result; - - protected TypedEventResult(dev.architectury.event.CompoundEventResult result) { - this.result = result; - } - - public static TypedEventResult success(T value) { - return new TypedEventResult<>(CompoundEventResult.interruptTrue(value)); - } - - public static TypedEventResult stop(T value) { - return new TypedEventResult<>(CompoundEventResult.interruptDefault(value)); - } - - public static TypedEventResult pass() { - return new TypedEventResult<>(CompoundEventResult.pass()); - } - - public static TypedEventResult fail(T value) { - return new TypedEventResult<>(CompoundEventResult.interruptFalse(value)); - } - - @Deprecated - public dev.architectury.event.CompoundEventResult getResult() { - return result; - } - - public ActionResult toActionResult() { - return result.result().asMinecraft(); - } - - public CompatActionResult toCompatActionResult() { - return CompatActionResult.of(result.result().asMinecraft()); - } - - public CompatActionResult toCompatActionResult(ItemStack stack) { - if (result.object() != stack) - return toCompatActionResult(); - - if (toActionResult() instanceof ActionResult.Success) { - ActionResult.Success success = (ActionResult.Success) toActionResult(); - - return CompatActionResult.create(success.withNewHandStack(stack)); - } - - return toCompatActionResult(); - } - - public CompatActionResult toCompatActionResult(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return toCompatActionResult(stack.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java deleted file mode 100644 index 4dea5f138..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java +++ /dev/null @@ -1,92 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.tile; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; - -public class TileTickEvent implements BlockStatePropertyHolder { - public World world; - public BlockPos pos; - public BlockState state; - public T blockEntity; - - public TileTickEvent(World world, BlockPos pos, BlockState state, T blockEntity) { - this.world = world; - this.pos = pos; - this.state = state; - this.blockEntity = blockEntity; - } - - public boolean isClient() { - return world.isClient(); - } - - public boolean isServer() { - return !isClient(); - } - - public boolean hasWorld() { - return world != null; - } - - public World getWorld() { - return world; - } - - public BlockPos getPos() { - return pos; - } - - public BlockState getState() { - if (state == null) - state = getWorldView().getBlockState(getPos()); - - return state; - } - - public T getBlockEntity() { - return blockEntity; - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getPos()); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { - if (state == null) - return getWorldView().getBlockState(getMidohraPos()); - - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getState()); - } - - public BlockEntityWrapper getBlockEntityWrapper() { - return BlockEntityWrapper.of(getBlockEntity()); - } - - public IWorldView getWorldView() { - return getMidohraWorld(); - } - - @Override - public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { - return getMidohraState(); - } - - public Block getBlock() { - return getState().getBlock(); - } - - public BlockWrapper getBlockWrapper() { - return BlockWrapper.of(getBlock()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java deleted file mode 100644 index 466ac1f70..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0; - -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.PlayerEvent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import org.jetbrains.annotations.Nullable; - -@Deprecated -public class AttackEntityEventRegistry { - public static void register(AttackEntity attackEntity) { - PlayerEvent.ATTACK_ENTITY.register(attackEntity::attack); - } - - public interface AttackEntity { - default EventResult attack(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { - return attack(new Player(player), level, target, hand, result); - } - - EventResult attack(Player player, World level, Entity target, Hand hand, @Nullable EntityHitResult result); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java deleted file mode 100644 index 4c4efbe16..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0; - -import dev.architectury.event.events.client.ClientTickEvent; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.world.ClientWorld; - -public class ClientTickEventRegistry { - public static void registerPost(Client client) { - ClientTickEvent.CLIENT_POST.register(client::tick); - } - - public static void registerPre(Client client) { - ClientTickEvent.CLIENT_PRE.register(client::tick); - } - - public static void registerLevelPost(ClientLevel world) { - ClientTickEvent.CLIENT_LEVEL_POST.register(world::tick); - } - - public static void registerLevelPre(ClientLevel world) { - ClientTickEvent.CLIENT_LEVEL_PRE.register(world::tick); - } - - @Environment(EnvType.CLIENT) - public interface Client { - void tick(MinecraftClient instance); - } - - @Environment(EnvType.CLIENT) - public interface ClientLevel { - void tick(ClientWorld instance); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java deleted file mode 100644 index 17b2fa79d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0; - -import dev.architectury.event.events.common.LifecycleEvent; -import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.v0.event.ItemStackActionEvent; -import net.pitan76.mcpitanlib.api.event.v0.event.ServerConnectionEvent; - -public class EventRegistry { - - public static class ServerConnection { - // Architectury: PlayerEvent - public static void join(PlayerJoin state) { - ServerConnectionEvent.join(state); - } - - public static void quit(PlayerQuit state) { - ServerConnectionEvent.quit(state); - } - - public interface PlayerJoin { - void join(ServerPlayerEntity player); - } - - public interface PlayerQuit { - void quit(ServerPlayerEntity player); - } - } - - public static class ItemStackAction { - public static void damage(ItemStackDamageState state) { - ItemStackActionEvent.register(state); - } - - public interface ItemStackDamageState { - void onDamage(ItemStack stack); - } - } - - public static class ServerLifecycle { - // Architectury: LifecycleEvent - public static void serverStarted(ServerState state) { - LifecycleEvent.SERVER_STARTED.register(state::stateChanged); - } - - public static void serverStarting(ServerState state) { - LifecycleEvent.SERVER_STARTING.register(state::stateChanged); - } - - public static void serverStopped(ServerState state) { - LifecycleEvent.SERVER_STOPPED.register(state::stateChanged); - } - - public static void serverStopping(ServerState state) { - LifecycleEvent.SERVER_STOPPING.register(state::stateChanged); - } - - public static void serverWorldLoad(ServerWorldState state) { - LifecycleEvent.SERVER_LEVEL_LOAD.register(state::act); - } - - public static void serverWorldSave(ServerWorldState state) { - LifecycleEvent.SERVER_LEVEL_SAVE.register(state::act); - } - - public static void serverWorldUnload(ServerWorldState state) { - LifecycleEvent.SERVER_LEVEL_UNLOAD.register(state::act); - } - - public interface ServerState extends InstanceState { - } - - public interface InstanceState { - void stateChanged(T instance); - } - - public interface WorldState { - void act(T world); - } - - public interface ServerWorldState extends WorldState { - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java deleted file mode 100644 index 65a8d74b9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0; - -import dev.architectury.event.events.common.InteractionEvent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.result.EventResult; -import net.pitan76.mcpitanlib.api.event.v0.event.ClickBlockEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; - -public class InteractionEventRegistry { - public static void registerRightClickBlock(RightClickBlock rightClickBlock) { - InteractionEvent.RIGHT_CLICK_BLOCK.register((player, hand, pos, direction) -> rightClickBlock.click(new ClickBlockEvent(player, hand, pos, direction)).toActionResult()); - } - - public static void registerLeftClickBlock(LeftClickBlock leftClickBlock) { - InteractionEvent.LEFT_CLICK_BLOCK.register((player, hand, pos, direction) -> leftClickBlock.click(new ClickBlockEvent(player, hand, pos, direction)).toActionResult()); - } - - public static void registerRightClickItem(RightClickItem rightClickItem) { - InteractionEvent.RIGHT_CLICK_ITEM.register(rightClickItem::click); - } - - public static void registerClientLeftClickAir(ClientLeftClickAir clientLeftClickAir) { - InteractionEvent.CLIENT_LEFT_CLICK_AIR.register(clientLeftClickAir::click); - } - - public static void registerClientRightClickAir(ClientRightClickAir clientRightClickAir) { - InteractionEvent.CLIENT_RIGHT_CLICK_AIR.register(clientRightClickAir::click); - } - - public static void registerInteractEntity(InteractEntity interactEntity) { - InteractionEvent.INTERACT_ENTITY.register(interactEntity::interact); - } - - // ---- - - public interface LeftClickBlock { - EventResult click(ClickBlockEvent event); - } - - public interface RightClickBlock { - EventResult click(ClickBlockEvent event); - } - - public interface RightClickItem { - default ActionResult click(PlayerEntity var1, Hand var2) { - return click(new Player(var1), var2).toActionResult(); - } - - CompatActionResult click(Player player, Hand hand); - } - - public interface ClientLeftClickAir { - default void click(PlayerEntity var1, Hand var2) { - click(new Player(var1), var2); - } - - void click(Player player, Hand hand); - } - - public interface ClientRightClickAir { - default void click(PlayerEntity var1, Hand var2) { - click(new Player(var1), var2); - } - - void click(Player player, Hand hand); - } - - public interface InteractEntity { - @SuppressWarnings("deprecation") - default dev.architectury.event.EventResult interact(PlayerEntity var1, Entity var2, Hand var3) { - return interact(new Player(var1), var2, var3).toEventResult().getResult(); - } - - CompatActionResult interact(Player player, Entity entity, Hand hand); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java deleted file mode 100644 index 3777e195e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0; - -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.EntityEvent; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; - -public class LivingHurtEventRegistry { - public static void register(LivingHurt livingHurt) { - EntityEvent.LIVING_HURT.register(livingHurt::hurt); - } - - public interface LivingHurt { - default EventResult hurt(LivingEntity var1, DamageSource var2, float var3) { - return hurt(new LivingHurtEvent(var1, var2, var3)); - } - - EventResult hurt(LivingHurtEvent event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java deleted file mode 100644 index 231235154..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0.event; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.util.BlockStateUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; - -public class ClickBlockEvent { - public Player player; - public Hand hand; - public BlockPos pos; - public Direction direction; - - public ClickBlockEvent(Player player, Hand hand, BlockPos pos, Direction direction) { - this.player = player; - this.hand = hand; - this.pos = pos; - this.direction = direction; - } - - public ClickBlockEvent(PlayerEntity player, Hand hand, BlockPos pos, Direction direction) { - this.player = new Player(player); - this.hand = hand; - this.pos = pos; - this.direction = direction; - } - - public Player getPlayer() { - return player; - } - - public Hand getHand() { - return hand; - } - - public BlockPos getPos() { - return pos; - } - - public Direction getDirection() { - return direction; - } - - public boolean isExistPlayer() { - return player.getEntity() != null; - } - - public ItemStack getStackInHand() { - return player.getStackInHand(hand); - } - - public boolean isEmptyStackInHand() { - return getStackInHand().isEmpty(); - } - - public World getWorld() { - return player.getWorld(); - } - - public BlockState getBlockState() { - return WorldUtil.getBlockState(getWorld(), getPos()); - } - - public Block getBlock() { - return BlockStateUtil.getBlock(getBlockState()); - } - - - - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java deleted file mode 100644 index f8872ead7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0.event; - -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; - -import java.util.ArrayList; -import java.util.List; - -public class ItemStackActionEvent { - - public static Boolean returnValue = null; - - public static void setReturnValue(boolean setReturnValue) { - ItemStackActionEvent.returnValue = setReturnValue; - } - - private static final List states = new ArrayList<>(); - - public static void register(EventRegistry.ItemStackAction.ItemStackDamageState state) { - states.add(state); - } - - public static void call(ItemStack stack) { - if (states.isEmpty()) return; - for (EventRegistry.ItemStackAction.ItemStackDamageState state : states) { - state.onDamage(stack); - } - } - - public static void unregister(EventRegistry.ItemStackAction.ItemStackDamageState state) { - states.remove(state); - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java deleted file mode 100644 index 078061cb0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0.event; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class LivingHurtEvent { - public LivingEntity entity; - public DamageSource damageSource; - public float damageAmount; - - public LivingHurtEvent(LivingEntity entity, DamageSource damageSource, float damageAmount) { - this.entity = entity; - this.damageSource = damageSource; - this.damageAmount = damageAmount; - } - - public LivingEntity getEntity() { - return entity; - } - - public DamageSource getDamageSource() { - return damageSource; - } - - public float getDamageAmount() { - return damageAmount; - } - - public Entity getAttacker() { - return damageSource.getAttacker(); - } - - public Entity getSource() { - return damageSource.getSource(); - } - - public boolean isDirect() { - return damageSource.isDirect(); - } - - public boolean isPlayerAttacker() { - return getAttacker() instanceof PlayerEntity; - } - - public PlayerEntity getPlayerEntityAttacker() { - return (PlayerEntity) getAttacker(); - } - - public Player getPlayerAttacker() { - return new Player(getPlayerEntityAttacker()); - } - - public World getWorld() { - return entity.getEntityWorld(); - } - - public boolean isClient() { - return getWorld().isClient(); - } - - public ItemStack getWeaponStack() { - return getAttacker().getWeaponStack(); - } - - public Item getWeaponItem() { - return getWeaponStack().getItem(); - } - - public boolean isWeaponEmpty() { - return getWeaponStack().isEmpty(); - } - - public boolean isWeaponItemEqual(Item item) { - if (isWeaponEmpty()) return false; - return getWeaponItem() == item; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java deleted file mode 100644 index e2c33ae81..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0.event; - -import net.minecraft.recipe.Recipe; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.Identifier; -import net.minecraft.util.profiler.Profiler; -import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; -import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; -import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; -import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; - -import java.util.SortedMap; - -public class RecipeManagerEvent { - - @Deprecated - private SortedMap> sortedMap; - - public ResourceManager resourceManager; - public Profiler profiler; - - public RecipeManagerEvent(SortedMap> sortedMap, ResourceManager resourceManager, Profiler profiler) { - this.sortedMap = sortedMap; - this.resourceManager = resourceManager; - this.profiler = profiler; - } - - public Profiler getProfiler() { - return profiler; - } - - public ResourceManager getResourceManager() { - return resourceManager; - } - - public net.pitan76.mcpitanlib.midohra.resource.ResourceManager getResourceManagerM() { - return net.pitan76.mcpitanlib.midohra.resource.ResourceManager.of(resourceManager); - } - - public void putCompatibleRecipeEntry(Identifier id, CompatibleRecipeEntry entry) { - putCompatibleRecipeEntry(entry); - } - - public void putCompatibleRecipeEntry(CompatibleRecipeEntry entry) { - sortedMap.put(entry.getId(), entry.getRecipe()); - } - - public > void putCompatibleRecipeEntry(CompatRecipeEntry entry) { - sortedMap.put(entry.getId(), entry.getRecipe()); - } - - public void putRecipeEntry(RecipeEntry entry) { - sortedMap.put(entry.getId().toMinecraft(), entry.getRawRecipe()); - } - - public void putRecipe(CompatRecipe recipe) { - sortedMap.put(recipe.getId(), recipe.getRecipe()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java deleted file mode 100644 index ec21cc0e7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v0.event; - -import dev.architectury.event.events.common.PlayerEvent; -import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; - -public class ServerConnectionEvent { - // Architectury: PlayerEvent - public static void join(EventRegistry.ServerConnection.PlayerJoin state) { - PlayerEvent.PLAYER_JOIN.register(state::join); - } - - public static void quit(EventRegistry.ServerConnection.PlayerQuit state) { - PlayerEvent.PLAYER_QUIT.register(state::quit); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java deleted file mode 100644 index 894a89cd8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v1; - -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.PlayerEvent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.v1.event.AttackEntityEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import org.jetbrains.annotations.Nullable; - -public class AttackEntityEventRegistry { - public static void register(AttackEntity attackEntity) { - PlayerEvent.ATTACK_ENTITY.register(attackEntity::attack); - } - - public interface AttackEntity { - default EventResult attack(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { - return attack(new AttackEntityEvent(player, level, target, hand, result)).toEventResult().getResult(); - } - - CompatActionResult attack(AttackEntityEvent event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java deleted file mode 100644 index cfc8397de..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v1; - -import net.pitan76.mcpitanlib.api.event.v1.listener.BlockBreakTask; -import net.pitan76.mcpitanlib.api.event.v1.listener.BlockPlacedTask; - -@Deprecated -public class BlockEventRegistry { - @Deprecated - public static void register(BlockPlacedTask listener) { - net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_PLACED.register(listener); - } - - @Deprecated - public static void register(BlockBreakTask listener) { - net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_BREAK.register(listener); - } - - public static void registerPlacedListener(BlockPlacedTask listener) { - net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_PLACED.register(listener); - - } - - public static void registerBreakListener(BlockBreakTask listener) { - net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_BREAK.register(listener); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java deleted file mode 100644 index a95a7e9be..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v1; - -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.EntityEvent; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; - -public class LivingHurtEventRegistry { - public static void register(LivingHurt livingHurt) { - EntityEvent.LIVING_HURT.register(livingHurt::hurt); - } - - public interface LivingHurt { - - @SuppressWarnings("deprecation") - default EventResult hurt(LivingEntity var1, DamageSource var2, float var3) { - return hurt(new LivingHurtEvent(var1, var2, var3)).getResult(); - } - - net.pitan76.mcpitanlib.api.event.result.EventResult hurt(LivingHurtEvent event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java deleted file mode 100644 index 840b0f04e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v1; - -import net.pitan76.mcpitanlib.api.event.v0.event.RecipeManagerEvent; - -import java.util.ArrayList; -import java.util.List; - -public class RecipeManagerRegistry { - public static List managers = new ArrayList<>(); - - public static void register(CustomRecipeManager manager) { - managers.add(manager); - } - - @FunctionalInterface - public interface CustomRecipeManager { - void apply(RecipeManagerEvent event); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java deleted file mode 100644 index 4748c9ca4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v1.event; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import org.jetbrains.annotations.Nullable; - -public class AttackEntityEvent { - - public Player player; - public World world; - public Entity target; - public Hand hand; - public EntityHitResult result; - - public AttackEntityEvent(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { - this(new Player(player), level, target, hand, result); - } - - public AttackEntityEvent(Player player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { - this.player = player; - this.world = level; - this.target = target; - this.hand = hand; - this.result = result; - } - - public Player getPlayer() { - return player; - } - - public World getWorld() { - return world; - } - - public Entity getTarget() { - return target; - } - - public EntityHitResult getResult() { - return result; - } - - public Hand getHand() { - return hand; - } - - public ItemStack getStackInPlayer() { - return player.getStackInHand(hand); - } - - public Item getItemInPlayer() { - return getStackInPlayer().getItem(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getWorldAsMidohra() { - return net.pitan76.mcpitanlib.midohra.world.World.of(world); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackInPlayerAsMidohra() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStackInPlayer()); - } - - public ItemWrapper getItemWrapperInPlayer() { - return ItemWrapper.of(getItemInPlayer()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java deleted file mode 100644 index ae0300d00..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v1.listener; - -import net.pitan76.mcpitanlib.api.event.block.BlockBreakEvent; -import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; - -@FunctionalInterface -public interface BlockBreakTask { - BlockBreakResult onBreak(BlockBreakEvent event); -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java deleted file mode 100644 index eca682318..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v1.listener; - -import net.pitan76.mcpitanlib.api.event.block.BlockPlacedEvent; - -@FunctionalInterface -public interface BlockPlacedTask { - void onPlaced(BlockPlacedEvent event); -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java deleted file mode 100644 index 4ad62500e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v2; - -import java.util.List; - -public abstract class AbstractEvent { - - public abstract void register(T listener); - - public abstract void unregister(T listener); - - public abstract T getListener(int index); - - public abstract List getListenersAsList(); - - public int getListenerCount() { - return getListenersAsList().size(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java deleted file mode 100644 index 50f50a605..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v2; - -import net.pitan76.mcpitanlib.api.event.v1.listener.BlockBreakTask; -import net.pitan76.mcpitanlib.api.event.v1.listener.BlockPlacedTask; - -public class BlockEventRegistry { - /** - * Event that is called when a block is placed - *

{@code
-     * BlockEventRegistry.ON_PLACED.register((event) -> {
-     *     // Do something
-     * }
- */ - public static OrderedEvent ON_PLACED = new OrderedEvent<>(); - - /** - * Event that is called when a block is broken - *
{@code
-     * BlockEventRegistry.ON_BREAK.register((event) -> {
-     *     // Do something
-     *     return new BlockBreakResult(event.state);
-     * }
- */ - public static OrderedEvent ON_BREAK = new OrderedEvent<>(); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java deleted file mode 100644 index 822804845..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v2; - -import net.pitan76.mcpitanlib.api.event.v2.listener.InventoryTickTask; - -public class ItemEventRegistry { - public static OrderedEvent INVENTORY_TICK = new OrderedEvent<>(); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java deleted file mode 100644 index 019d5f5a7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java +++ /dev/null @@ -1,167 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v2; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class OrderedEvent extends AbstractEvent { - - public volatile Map listeners = new HashMap<>(); - public volatile int maxPriority = 0; - - /** - * Check if the event has any listeners - * @return Whether the event has any listeners - */ - public boolean isEmpty() { - return listeners.isEmpty(); - } - - /** - * Check if a listener is registered - * @param listener The listener to check - * @return Whether the listener is registered - */ - public boolean isExists(T listener) { - return listeners.containsKey(listener); - } - - /** - * Alias for isExists - * @param listener The listener to check - * @return Whether the listener is registered - */ - public boolean has(T listener) { - return isExists(listener); - } - - /** - * Check if a listener has a priority - * @param listener The listener to check - * @return Whether the listener has a priority - */ - public boolean hasPriority(T listener) { - if (!isExists(listener)) return false; - return listeners.get(listener) != null && listeners.get(listener) != 0; - } - - /** - * Set the priority of a listener - * @param listener The listener to set the priority of - * @param priority The priority to set - */ - public void setPriority(T listener, int priority) { - if (!isExists(listener)) { - listeners.put(listener, priority); - return; - } - listeners.replace(listener, priority); - } - - /** - * Register a listener with a priority - * @param listener The listener to register - * @param priority The priority of the listener - */ - public void register(T listener, int priority) { - this.listeners.put(listener, priority); - if (priority > maxPriority) { - maxPriority = priority; - } - } - - /** - * Register a listener (no priority) - * @param listener The listener to register - * @throws IllegalArgumentException If the listener is already registered - */ - @Override - public void register(T listener) { - if (isExists(listener)) throw new IllegalArgumentException("Listener already exists"); - this.listeners.put(listener, 0); - } - - /** - * Register a listener (no priority) - * @param listener The listener to register - */ - public void registerNonSafe(T listener) { - if (isExists(listener)) return; - register(listener); - } - - /** - * Unregister a listener - * @param listener The listener to unregister - */ - @Override - public void unregister(T listener) { - if (!isExists(listener)) return; - this.listeners.remove(listener); - } - - /** - * Get all listeners - * @return A list of all listeners - */ - @Override - public List getListenersAsList() { - return listeners.keySet().stream().toList(); - } - - /** - * get the priority of a listener - * @param listener The listener to get the priority of - * @return The priority of the listener - */ - public int getPriority(T listener) { - return listeners.get(listener); - } - - /** - * Get the highest priority - * @return The highest priority - */ - public int getMaxPriority() { - return maxPriority; - } - - /** - * Get the next priority - * @return The next priority - */ - public int nextPriority() { - return maxPriority + 1; - } - - @Deprecated - public T getListener(int index) { - return getListenersAsList().get(index); - } - - /** - * Get all listeners with a specific priority - * @param priority The priority to get listeners for - * @return A list of listeners with the specified priority - */ - public List getListenersAsList(int priority) { - List listeners = new ArrayList<>(); - for (Map.Entry entry : this.listeners.entrySet()) { - if (entry.getValue() == priority) { - listeners.add(entry.getKey()); - } - } - return listeners; - } - - @Deprecated - @SuppressWarnings("unchecked") - public T[] getListeners(int priority) { - return (T[]) getListenersAsList(priority).toArray(); - } - - public Map getListeners() { - return listeners; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java deleted file mode 100644 index 4f66ba34f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.pitan76.mcpitanlib.api.event.v2.listener; - -import net.pitan76.mcpitanlib.api.event.item.InventoryTickEvent; - -@FunctionalInterface -public interface InventoryTickTask { - void inventoryTick(InventoryTickEvent event); -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java deleted file mode 100644 index f1ce3ec98..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.pitan76.mcpitanlib.api.gen; - -import net.minecraft.block.Block; -import net.minecraft.util.Identifier; -import net.minecraft.world.gen.GenerationStep; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.PlacedFeature; -import net.pitan76.mcpitanlib.api.registry.WorldGenRegistry; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; -import net.pitan76.mcpitanlib.api.util.BlockUtil; -import net.pitan76.mcpitanlib.api.util.FeatureConfigUtil; -import net.pitan76.mcpitanlib.api.util.PlacedFutureUtil; - -@Deprecated -public class OreRegistry { - /** - * Generating custom ore in stone - * @param registry WorldGenRegistry - * @param block Block - * @param size Ore size - * @param height generating height - * @param count generating count per chunk - * @return Identifier of feature - */ - public static Identifier registerStoneOre(WorldGenRegistry registry, Block block, int size, int height, int count) { - Identifier identifier = BlockUtil.toID(block).withSuffixedPath("_ore_feature"); - RegistryResult> configuredFuture = registry.registerFeature(identifier, - () -> FeatureConfigUtil.createConfiguredFeature( - FeatureConfigUtil.createStoneOreFeatureConfig(block.getDefaultState(), size) - ) - ); - - RegistryResult placedFeature = registry.registerPlacedFeature(identifier, - () -> PlacedFutureUtil.create(configuredFuture.getOrNull(), - PlacedFutureUtil.createPlacementModifiers(count, height) - ) - ); - - WorldGenRegistry.addProperties(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeature); - return identifier; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java deleted file mode 100644 index e5324df34..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui; - -import dev.architectury.registry.menu.ExtendedMenuProvider; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerFactory; -import net.minecraft.text.Text; -import org.jetbrains.annotations.Nullable; - -@Deprecated -public class ExtendedNamedScreenHandlerFactory implements ExtendedMenuProvider { - - private final Text name; - private final ScreenHandlerFactory baseFactory; - private final PacketByteBufFactory bufFactory; - - public ExtendedNamedScreenHandlerFactory(Text name, ScreenHandlerFactory baseFactory, PacketByteBufFactory bufFactory) { - this.name = name; - this.baseFactory = baseFactory; - this.bufFactory = bufFactory; - } - - @Override - public void saveExtraData(PacketByteBuf buf) { - bufFactory.saveExtraData(buf); - } - - @Override - public Text getDisplayName() { - return name; - } - - @Nullable - @Override - public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player) { - return baseFactory.createMenu(syncId, inv, player); - - } - - @FunctionalInterface - public interface PacketByteBufFactory { - void saveExtraData(PacketByteBuf buf); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java deleted file mode 100644 index 45d413cfb..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandlerType; -import org.jetbrains.annotations.Nullable; - -public class ExtendedScreenHandler extends SimpleScreenHandler { - protected ExtendedScreenHandler(@Nullable ScreenHandlerType type, int syncId, PacketByteBuf buf) { - this(type, syncId); - } - - protected ExtendedScreenHandler(@Nullable ScreenHandlerType type, int syncId) { - super(type, syncId); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java deleted file mode 100644 index 17d6586b0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui; - -import dev.architectury.registry.menu.ExtendedMenuProvider; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; -import net.pitan76.mcpitanlib.api.event.container.factory.ExtraDataArgs; - -@Deprecated -public interface ExtendedScreenHandlerFactory extends ExtendedMenuProvider { - @Override - default Text getDisplayName() { - return getDisplayName(new DisplayNameArgs()); - } - - @Override - default void saveExtraData(PacketByteBuf buf) { - writeExtraData(new ExtraDataArgs(buf)); - } - - Text getDisplayName(DisplayNameArgs args); - - void writeExtraData(ExtraDataArgs args); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java deleted file mode 100644 index dd672f9a6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui; - -import dev.architectury.registry.menu.MenuRegistry; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; - -public class ExtendedScreenHandlerTypeBuilder { - - private final Factory factory; - - public ExtendedScreenHandlerTypeBuilder(Factory factory) { - this.factory = factory; - } - - public ExtendedScreenHandlerTypeBuilder(Factory2 factory) { - this.factory = factory; - } - - public ScreenHandlerType build() { - return MenuRegistry.ofExtended(factory::create); - } - - @FunctionalInterface - public interface Factory { - T create(int syncId, PlayerInventory inventory, PacketByteBuf buf); - } - - @FunctionalInterface - public interface Factory2 extends Factory { - T create(CreateMenuEvent e, PacketByteBuf buf); - - @Override - default T create(int syncId, PlayerInventory inventory, PacketByteBuf buf) { - return create(new CreateMenuEvent(syncId, inventory), buf); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java deleted file mode 100644 index 334c42388..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java +++ /dev/null @@ -1,276 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.slot.Slot; -import net.minecraft.screen.slot.SlotActionType; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.api.gui.args.SlotClickEvent; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; -import net.pitan76.mcpitanlib.api.util.SlotUtil; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; - -public class SimpleScreenHandler extends ScreenHandler { - protected SimpleScreenHandler(@Nullable ScreenHandlerType type, int syncId) { - super(type, syncId); - } - - protected SimpleScreenHandler(@Nullable ScreenHandlerType type, CreateMenuEvent e) { - this(type, e.getSyncId()); - } - - public boolean hasMainInventory = false; - public boolean hasHotbar = false; - - @Deprecated - @Override - public boolean canUse(PlayerEntity player) { - return canUse(new Player(player)); - } - - public boolean canUse(Player player) { - return true; - } - - public Slot addNormalSlot(Inventory inventory, int index, int x, int y) { - Slot slot = new Slot(inventory, index, x, y); - return this.addSlot(slot); - } - - public Slot addSlot(Inventory inventory, int index, int x, int y, SlotFactory factory) { - Slot slot = factory.create(inventory, index, x, y); - return this.addSlot(slot); - } - - public interface SlotFactory { - T create(Inventory inventory, int index, int x, int y); - } - - public Slot callAddSlot(Slot slot) { - return this.addSlot(slot); - } - - @Deprecated - @Override - protected Slot addSlot(Slot slot) { - return super.addSlot(slot); - } - - @Deprecated - @Override - public void onClosed(PlayerEntity player) { - this.close(new Player(player)); - } - - public void close(Player player) { - super.onClosed(player.getPlayerEntity()); - } - - - public static final int DEFAULT_SLOT_SIZE = 18; - - /** - * Add player main inventory slots - * @param inventory target player inventory - * @param x start x - * @param y start y - */ - protected List addPlayerMainInventorySlots(PlayerInventory inventory, int x, int y) { - hasMainInventory = true; - return this.addSlots(inventory, 9, x, y, DEFAULT_SLOT_SIZE, 9, 3); - } - - /** - * Add player hotbar slots - * @param inventory target player inventory - * @param x start x - * @param y start y - */ - protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int y) { - hasHotbar = true; - return this.addSlotsX(inventory, 0, x, y, DEFAULT_SLOT_SIZE, 9); - } - - /** - * 一括でスロットを設置する - * @param inventory target inventory - * @param firstIndex fisrt index - * @param firstX first x - * @param firstY first y - * @param size a slot size (if this is -1, set 18 to this) - * @param maxAmountX x line slot max amount - * @param maxAmountY y line slot max amount - * @return Slot list - */ - protected List addSlots(Inventory inventory, int firstIndex, int firstX, int firstY, int size, int maxAmountX, int maxAmountY) { - if (size < 0) size = DEFAULT_SLOT_SIZE; - List slots = new ArrayList<>(); - for (int y = 0; y < maxAmountY; ++y) { - List xSlots = this.addSlotsX(inventory, firstIndex + (y * maxAmountX), firstX, firstY + (y * size), size, maxAmountX); - slots.addAll(xSlots); - } - return slots; - } - - /** - * 一括で横にスロットを設置する - * @param inventory target inventory - * @param firstIndex first index - * @param firstX first x - * @param y y - * @param size a slot size (if this is -1, set 18 to this) - * @param amount slot amount - * @return Slot list - */ - protected List addSlotsX(Inventory inventory, int firstIndex, int firstX, int y, int size, int amount) { - if (size < 0) size = DEFAULT_SLOT_SIZE; - List slots = new ArrayList<>(); - for (int x = 0; x < amount; ++x) { - Slot slot = this.addNormalSlot(inventory, firstIndex + x, firstX + (x * size), y); - slots.add(slot); - } - return slots; - } - - /** - * 一括で縦にスロットを設置する - * @param inventory target inventory - * @param firstIndex first index - * @param x x - * @param firstY first y - * @param size a slot size (if this is -1, set 18 to this) - * @param amount slot amount - * @return Slot list - */ - protected List addSlotsY(Inventory inventory, int firstIndex, int x, int firstY, int size, int amount) { - if (size < 0) size = DEFAULT_SLOT_SIZE; - List slots = new ArrayList<>(); - for (int y = 0; y < amount; ++y) { - Slot slot = this.addNormalSlot(inventory, firstIndex + x, x, firstY + (y * size)); - slots.add(slot); - } - return slots; - } - - @Deprecated - public ItemStack quickMoveOverride(PlayerEntity player, int index) { - return quickMoveOverride(new Player(player), index); - } - - public boolean callInsertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { - return this.insertItem(stack, startIndex, endIndex, fromLast); - } - - @Deprecated - @Override - protected boolean insertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { - return super.insertItem(stack, startIndex, endIndex, fromLast); - } - - public ItemStack quickMoveOverride(Player player, int index) { - ItemStack itemStack = ItemStackUtil.empty(); - Slot slot = ScreenHandlerUtil.getSlot(this, index); - int size = ScreenHandlerUtil.getSlots(this).size(); - - if (SlotUtil.hasStack(slot)) { - ItemStack itemStack2 = SlotUtil.getStack(slot); - itemStack = itemStack2.copy(); - - if (hasMainInventory && hasHotbar) { - if (index > 35) { - if (!this.callInsertItem(itemStack2, 0, 9, false)) { - if (!this.callInsertItem(itemStack2, 9, 36, true)) { - return ItemStackUtil.empty(); - } - } - } else if (size > 36 && !this.callInsertItem(itemStack2, 36, size, false)) { - return ItemStackUtil.empty(); - } - } - - if (itemStack2.isEmpty()) { - SlotUtil.setStack(slot, ItemStackUtil.empty()); - } else { - SlotUtil.markDirty(slot); - } - - if (itemStack2.getCount() == itemStack.getCount()) { - return ItemStackUtil.empty(); - } - - SlotUtil.onTakeItem(slot, player, itemStack2); - } - - return itemStack; - } - - - @Deprecated - @Override - public ItemStack quickMove(PlayerEntity player, int slot) { - return quickMoveOverride(player, slot); - } - - @Deprecated - @Override - public Slot getSlot(int index) { - return callGetSlot(index); - } - - public Slot callGetSlot(int index) { - return super.getSlot(index); - } - - @Deprecated - @Override - public void onSlotClick(int slotIndex, int button, SlotActionType actionType, PlayerEntity player) { - overrideOnSlotClick(slotIndex, button, actionType, new Player(player)); - } - - public void overrideOnSlotClick(int slotIndex, int button, SlotActionType actionType, Player player) { - onSlotClick(new SlotClickEvent(slotIndex, button, actionType, player)); - } - - public void onSlotClick(SlotClickEvent e) { - super.onSlotClick(e.slot, e.button, e.actionType, e.player.getEntity()); - } - - @Override - @Deprecated - public void setCursorStack(ItemStack stack) { - callSetCursorStack(stack); - } - - public void callSetCursorStack(ItemStack stack) { - super.setCursorStack(stack); - } - - @Override - @Deprecated - public void setStackInSlot(int slot, int revision, ItemStack stack) { - callSetStackInSlot(slot, revision, stack); - } - - public void callSetStackInSlot(int slot, int revision, ItemStack stack) { - super.setStackInSlot(slot, revision, stack); - } - - @Override - @Deprecated - public int getRevision() { - return callGetRevision(); - } - - public int callGetRevision() { - return super.getRevision(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java deleted file mode 100644 index 39d18ee67..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.resource.featuretoggle.FeatureFlags; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; - -public class SimpleScreenHandlerTypeBuilder { - - private final Factory factory; - - public SimpleScreenHandlerTypeBuilder(Factory factory) { - this.factory = factory; - } - - public SimpleScreenHandlerTypeBuilder(Factory2 factory) { - this.factory = factory; - } - - public ScreenHandlerType build() { - return new ScreenHandlerType<>(factory::create, FeatureFlags.VANILLA_FEATURES); - } - - @FunctionalInterface - public interface Factory { - T create(int syncId, PlayerInventory inventory); - } - - @FunctionalInterface - public interface Factory2 extends Factory { - T create(CreateMenuEvent e); - - @Override - default T create(int syncId, PlayerInventory inventory) { - return create(new CreateMenuEvent(syncId, inventory)); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java deleted file mode 100644 index 1fface96e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.args; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class CreateMenuEvent { - public int syncId; - public PlayerInventory playerInventory; - public PlayerEntity player; - - public CreateMenuEvent(int syncId, PlayerInventory playerInventory, PlayerEntity player) { - this.syncId = syncId; - this.playerInventory = playerInventory; - this.player = player; - } - - public CreateMenuEvent(int syncId, PlayerInventory playerInventory) { - this.syncId = syncId; - this.playerInventory = playerInventory; - this.player = playerInventory.player; - } - - public CreateMenuEvent(int syncId, Player player) { - this.syncId = syncId; - this.playerInventory = player.getInv(); - this.player = player.getEntity(); - } - - public int getSyncId() { - return syncId; - } - - public PlayerInventory getPlayerInventory() { - return playerInventory; - } - - public PlayerEntity getPlayerEntity() { - return player; - } - - public Player getPlayer() { - return new Player(player); - } - - public boolean isExistPlayer() { - return player != null; - } - - public boolean isClient() { - return getPlayer().isClient(); - } - - public World getWorld() { - return getPlayer().getWorld(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java deleted file mode 100644 index 2c63f0d20..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java +++ /dev/null @@ -1,67 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.args; - -import net.minecraft.screen.slot.SlotActionType; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.gui.slot.CompatSlotActionType; - -public class SlotClickEvent { - public int slot; - public int button; - public SlotActionType actionType; - public Player player; - - public SlotClickEvent(int slot, int button, SlotActionType actionType, Player player) { - this.slot = slot; - this.button = button; - this.actionType = actionType; - this.player = player; - } - - public int getSlot() { - return slot; - } - - public int getButton() { - return button; - } - - public SlotActionType getRawActionType() { - return actionType; - } - - public CompatSlotActionType getActionType() { - return CompatSlotActionType.of(actionType); - } - - public Player getPlayer() { - return player; - } - - public boolean isClient() { - return player.isClient(); - } - - public boolean isServer() { - return player.isServer(); - } - - public boolean isSwapAction() { - return actionType == SlotActionType.SWAP; - } - - public boolean isPickupAction() { - return actionType == SlotActionType.PICKUP; - } - - public boolean isQuickCraftAction() { - return actionType == SlotActionType.QUICK_CRAFT; - } - - public boolean isQuickMoveAction() { - return actionType == SlotActionType.QUICK_MOVE; - } - - public boolean isThrowAction() { - return actionType == SlotActionType.THROW; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java deleted file mode 100644 index aea703cca..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java +++ /dev/null @@ -1,77 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.inventory; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; - -public interface IInventory extends Inventory { - - DefaultedList getItems(); - - static IInventory of(DefaultedList items) { - return () -> items; - } - - static IInventory ofSize(int size) { - return of(DefaultedList.ofSize(size, ItemStack.EMPTY)); - } - - @Override - default int size() { - return getItems().size(); - } - - @Override - default boolean isEmpty() { - for (int i = 0; i < size(); i++) { - ItemStack stack = getStack(i); - if (!stack.isEmpty()) { - return false; - } - } - return true; - } - - @Override - default ItemStack getStack(int slot) { - return getItems().get(slot); - } - - @Override - default ItemStack removeStack(int slot, int count) { - ItemStack result = Inventories.splitStack(getItems(), slot, count); - if (!result.isEmpty()) { - markDirty(); - } - return result; - } - - @Override - default ItemStack removeStack(int slot) { - return Inventories.removeStack(getItems(), slot); - } - - @Override - default void setStack(int slot, ItemStack stack) { - getItems().set(slot, stack); - if (stack.getCount() > getMaxCountPerStack()) { - stack.setCount(getMaxCountPerStack()); - } - } - - @Override - default void clear() { - getItems().clear(); - } - - @Override - default void markDirty() { - } - - @Override - default boolean canPlayerUse(PlayerEntity player) { - return true; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java deleted file mode 100644 index a4cd6f4f3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.inventory.sided; - -import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.AvailableSlotsArgs; - -public interface ChestStyleSidedInventory extends VanillaStyleSidedInventory { - @Override - default int[] getAvailableSlots(AvailableSlotsArgs args) { - return args.getAllSlots(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java deleted file mode 100644 index 5f4ce81b3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.inventory.sided; - -import net.minecraft.inventory.SidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Direction; -import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.AvailableSlotsArgs; -import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanExtractArgs; -import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanInsertArgs; -import org.jetbrains.annotations.Nullable; - -public interface CompatSidedInventory extends SidedInventory { - @Override - @Deprecated - default int[] getAvailableSlots(Direction side) { - return getAvailableSlots(new AvailableSlotsArgs(side, this)); - } - - int[] getAvailableSlots(AvailableSlotsArgs args); - - @Override - @Deprecated - default boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { - return canInsert(new CanInsertArgs(slot, stack, dir)); - } - - boolean canInsert(CanInsertArgs args); - - @Override - @Deprecated - default boolean canExtract(int slot, ItemStack stack, Direction dir) { - return canExtract(new CanExtractArgs(slot, stack, dir)); - } - - boolean canExtract(CanExtractArgs args); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java deleted file mode 100644 index 119a59057..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.inventory.sided; - -import net.minecraft.util.math.Direction; -import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanExtractArgs; -import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanInsertArgs; - -public interface VanillaStyleSidedInventory extends CompatSidedInventory { - @Override - default boolean canInsert(CanInsertArgs args) { - if (args.getDir() == null) - return false; - - return args.getDir() != Direction.DOWN; - } - - @Override - default boolean canExtract(CanExtractArgs args) { - return args.getDir() == Direction.DOWN; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java deleted file mode 100644 index 748b47420..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; - -import net.minecraft.util.math.Direction; -import net.pitan76.mcpitanlib.api.gui.inventory.sided.CompatSidedInventory; -import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; - -public class AvailableSlotsArgs { - public Direction side; - public CompatSidedInventory inventory; - - public AvailableSlotsArgs(Direction side, CompatSidedInventory inventory) { - this.side = side; - this.inventory = inventory; - } - - public Direction getSide() { - return side; - } - - public CompatSidedInventory getInventory() { - return inventory; - } - - public int[] getAllSlots() { - if (!(inventory instanceof IInventory)) - return new int[0]; - - IInventory inv = (IInventory) inventory; - int size = inv.size(); - - int[] slots = new int[size]; - for (int i = 0; i < size; i++) { - slots[i] = i; - } - - return slots; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java deleted file mode 100644 index 568dcbe4c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Direction; - -public class CanExtractArgs { - public int slot; - public ItemStack stack; - public Direction dir; - - public CanExtractArgs(int slot, ItemStack stack, Direction dir) { - this.slot = slot; - this.stack = stack; - this.dir = dir; - } - - public int getSlot() { - return slot; - } - - public ItemStack getStack() { - return stack; - } - - public Direction getDir() { - return dir; - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStack_midohra() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java deleted file mode 100644 index a6aa1a662..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Direction; -import org.jetbrains.annotations.Nullable; - -public class CanInsertArgs { - public int slot; - public ItemStack stack; - - @Nullable - public Direction dir; - - public CanInsertArgs(int slot, ItemStack stack, @Nullable Direction dir) { - this.slot = slot; - this.stack = stack; - this.dir = dir; - } - - public int getSlot() { - return slot; - } - - public ItemStack getStack() { - return stack; - } - - public @Nullable Direction getDir() { - return dir; - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getStack_midohra() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java deleted file mode 100644 index 0addfd2a2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.slot; - -import net.minecraft.screen.slot.SlotActionType; - -public class CompatSlotActionType { - public static final CompatSlotActionType PICKUP = new CompatSlotActionType(SlotActionType.PICKUP); - public static final CompatSlotActionType QUICK_MOVE = new CompatSlotActionType(SlotActionType.QUICK_MOVE); - public static final CompatSlotActionType SWAP = new CompatSlotActionType(SlotActionType.SWAP); - public static final CompatSlotActionType THROW = new CompatSlotActionType(SlotActionType.THROW); - public static final CompatSlotActionType CLONE = new CompatSlotActionType(SlotActionType.CLONE); - public static final CompatSlotActionType QUICK_CRAFT = new CompatSlotActionType(SlotActionType.QUICK_CRAFT); - public static final CompatSlotActionType PICKUP_ALL = new CompatSlotActionType(SlotActionType.PICKUP_ALL); - - public final SlotActionType raw; - - protected CompatSlotActionType(SlotActionType raw) { - this.raw = raw; - } - - public static CompatSlotActionType of(SlotActionType raw) { - if (raw == SlotActionType.PICKUP) return PICKUP; - if (raw == SlotActionType.QUICK_MOVE) return QUICK_MOVE; - if (raw == SlotActionType.SWAP) return SWAP; - if (raw == SlotActionType.THROW) return THROW; - if (raw == SlotActionType.CLONE) return CLONE; - if (raw == SlotActionType.QUICK_CRAFT) return QUICK_CRAFT; - if (raw == SlotActionType.PICKUP_ALL) return PICKUP_ALL; - return new CompatSlotActionType(raw); - } - - public boolean isSwapOrPickupOrQuickMoveOrThrow() { - return raw == SlotActionType.SWAP || raw == SlotActionType.PICKUP || raw == SlotActionType.QUICK_MOVE || raw == SlotActionType.THROW; - } - - public SlotActionType getRaw() { - return raw; - } - - public int getIndex() { - return raw.getIndex(); - } - - public String getName() { - return raw.name(); - } - - public boolean isOf(CompatSlotActionType type) { - return raw == type.raw; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java deleted file mode 100644 index f49db49df..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java +++ /dev/null @@ -1,125 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.slot; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.slot.Slot; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class CompatibleSlot extends Slot { - - public Inventory inventory; - public int index; - public int x; - public int y; - - public CompatibleSlot(Inventory inventory, int index, int x, int y) { - super(inventory, index, x, y); - this.inventory = inventory; - this.index = index; - this.x = x; - this.y = y; - } - - public void callSetStack(ItemStack stack) { - super.setStack(stack); - } - - public void callSetStackNoCallbacks(ItemStack stack) { - super.setStackNoCallbacks(stack); - } - - public ItemStack callGetStack() { - return super.getStack(); - } - - public ItemStack callTakeStack(int amount) { - return super.takeStack(amount); - } - - public boolean callHasStack() { - return super.hasStack(); - } - - @Deprecated - @Override - public void setStack(ItemStack stack) { - callSetStack(stack); - } - - @Deprecated - @Override - public void setStackNoCallbacks(ItemStack stack) { - callSetStackNoCallbacks(stack); - } - - @Deprecated - @Override - public ItemStack getStack() { - return callGetStack(); - } - - @Deprecated - @Override - public ItemStack takeStack(int amount) { - return callTakeStack(amount); - } - - @Deprecated - @Override - public boolean hasStack() { - return callHasStack(); - } - - public Inventory callGetInventory() { - return inventory; - } - - public int callGetIndex() { - return super.getIndex(); - } - - public int callGetId() { - return super.id; - } - - public int callGetX() { - return super.x; - } - - public int callGetY() { - return super.y; - } - - public void callMarkDirty() { - super.markDirty(); - } - - @Override - public boolean canInsert(ItemStack stack) { - return canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack)); - } - - @Override - public boolean canTakeItems(PlayerEntity playerEntity) { - return canTakeItems(new Player(playerEntity)); - } - - public boolean canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return super.canInsert(stack.toMinecraft()); - } - - public boolean canTakeItems(Player player) { - return super.canTakeItems(player.getEntity()); - } - - @Deprecated - @Override - public boolean canTakePartial(PlayerEntity player) { - return canTakePartial(new Player(player)); - } - - public boolean canTakePartial(Player player) { - return super.canTakePartial(player.getEntity()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java deleted file mode 100644 index b26d1915f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.v2; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; - -@SuppressWarnings("deprecation") -public interface ExtendedScreenHandlerFactory extends net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerFactory { - - @Override - default ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { - return createMenu(new CreateMenuEvent(syncId, playerInventory, player)); - } - - ScreenHandler createMenu(CreateMenuEvent event); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java deleted file mode 100644 index 8d447ebb3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.gui.v2; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; - -public interface SimpleScreenHandlerFactory extends NamedScreenHandlerFactory { - @Override - default Text getDisplayName() { - return getDisplayName(new DisplayNameArgs()); - } - - Text getDisplayName(DisplayNameArgs args); - - @Override - default ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { - return createMenu(new CreateMenuEvent(syncId, playerInventory, player)); - } - - ScreenHandler createMenu(CreateMenuEvent event); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java b/common/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java deleted file mode 100644 index 763444f86..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.pitan76.mcpitanlib.api.helper; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; -import net.pitan76.mcpitanlib.api.item.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; -import net.pitan76.mcpitanlib.api.item.ExtendItem; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.util.ItemUtil; -import net.pitan76.mcpitanlib.core.datafixer.Pair; - -import java.util.function.Supplier; - -public class SimpleRegister { - public static Supplier createItem(CompatRegistryV2 registry, CompatIdentifier id, CompatibleItemSettings settings) { - return registry.registerExtendItem(id, () -> new ExtendItem(settings)); - } - - public static Supplier createSimpleItem(CompatRegistryV2 registry, CompatIdentifier id) { - return createItem(registry, id, new CompatibleItemSettings()); - } - - public static Supplier createFoodItem(CompatRegistryV2 registry, CompatIdentifier id, CompatFoodComponent component) { - return createItem(registry, id, new CompatibleItemSettings().food(component)); - } - - public static Supplier createSimpleFoodItem(CompatRegistryV2 registry, CompatIdentifier id, int hunger, float saturation, boolean meat, boolean snack) { - CompatFoodComponent component = new CompatFoodComponent().setHunger(hunger).setSaturation(saturation); - if (meat) component.setMeat(); - if (snack) component.setSnack(); - return createFoodItem(registry, id, component); - } - - public static Supplier createSimpleFoodItem(CompatRegistryV2 registry, CompatIdentifier id, int hunger, float saturation) { - return createSimpleFoodItem(registry, id, hunger, saturation, false, false); - } - - public static Pair, Supplier> createBlock(CompatRegistryV2 registry, CompatIdentifier id, CompatibleBlockSettings blockSettings, CompatibleItemSettings itemSettings) { - Supplier blockSupplier = registry.registerExtendBlock(id, () -> new ExtendBlock(blockSettings)); - RegistryResult itemRegistryResult = registry.registerItem(id, () -> ItemUtil.ofBlock(blockSupplier.get(), itemSettings)); - Supplier itemSupplier = itemRegistryResult::getOrNull; - return new Pair<>(blockSupplier, itemSupplier); - } - - public static Pair, Supplier> createSimpleBlock(CompatRegistryV2 registry, CompatIdentifier id, CompatibleItemSettings itemSettings) { - return createBlock(registry, id, new CompatibleBlockSettings(), itemSettings); - } - - public static Pair, Supplier> createSimpleBlock(CompatRegistryV2 registry, CompatIdentifier id) { - return createBlock(registry, id, new CompatibleBlockSettings(), new CompatibleItemSettings()); - } - - public static CreativeTabBuilder createCreativeTab(CompatRegistryV2 registry, CompatIdentifier id, Supplier icon) { - CreativeTabBuilder builder = CreativeTabBuilder.create(id).setIcon(icon); - registry.registerItemGroup(builder); - return builder; - } - - public static CreativeTabBuilder createCreativeTabByItem(CompatRegistryV2 registry, CompatIdentifier id, Supplier item) { - return createCreativeTab(registry, id, () -> ItemStackUtil.create(item.get())); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java deleted file mode 100644 index 14e0cf624..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java +++ /dev/null @@ -1,75 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.equipment.EquipmentType; -import org.jetbrains.annotations.Nullable; - -public class ArmorEquipmentType { - public static ArmorEquipmentType HEAD = new ArmorEquipmentType(EquipmentSlot.HEAD, EquipmentType.HELMET); - public static ArmorEquipmentType CHEST = new ArmorEquipmentType(EquipmentSlot.CHEST, EquipmentType.CHESTPLATE); - public static ArmorEquipmentType LEGS = new ArmorEquipmentType(EquipmentSlot.LEGS, EquipmentType.LEGGINGS); - public static ArmorEquipmentType FEET = new ArmorEquipmentType(EquipmentSlot.FEET, EquipmentType.BOOTS); - - // New type for animals from 1.20.5 - public static ArmorEquipmentType BODY = new ArmorEquipmentType(EquipmentSlot.BODY, EquipmentType.BODY); - - protected final EquipmentSlot slot; - protected final EquipmentType type; - - protected ArmorEquipmentType(EquipmentSlot slot, EquipmentType type) { - this.slot = slot; - this.type = type; - } - - @Deprecated - public EquipmentSlot getSlot() { - return slot; - } - - @Deprecated - public EquipmentType getType() { - return type; - } - - @Nullable - public static ArmorEquipmentType of(EquipmentSlot slot) { - switch (slot) { - case HEAD -> { - return HEAD; - } - case CHEST -> { - return CHEST; - } - case LEGS -> { - return LEGS; - } - case FEET -> { - return FEET; - } - default -> { - return null; - } - } - } - - @Nullable - public static ArmorEquipmentType of(EquipmentType type) { - switch (type) { - case HELMET -> { - return HEAD; - } - case CHESTPLATE -> { - return CHEST; - } - case LEGGINGS -> { - return LEGS; - } - case BOOTS -> { - return FEET; - } - default -> { - return null; - } - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java deleted file mode 100644 index c7cf23987..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java +++ /dev/null @@ -1,120 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import com.mojang.datafixers.util.Pair; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; - -import java.util.ArrayList; -import java.util.List; - -public class CompatFoodComponent { - private int hunger; - private float saturation; - private boolean meat; - private boolean alwaysEdible; - private boolean snack; - private final List> statusEffects = new ArrayList<>(); - - private FoodComponent latestComponent = null; - - public static CompatFoodComponent create() { - return new CompatFoodComponent(); - } - - public CompatFoodComponent setHunger(int hunger) { - this.hunger = hunger; - return this; - } - - public CompatFoodComponent setSaturation(float saturation) { - this.saturation = saturation; - return this; - } - - public CompatFoodComponent setAlwaysEdible() { - this.alwaysEdible = true; - return this; - } - - public CompatFoodComponent setSnack() { - this.snack = true; - return this; - } - - public CompatFoodComponent setMeat() { - this.meat = true; - return this; - } - - @Deprecated - public CompatFoodComponent addStatusEffect(StatusEffectInstance effect, float chance) { - statusEffects.add(Pair.of(effect, chance)); - return this; - } - - public CompatFoodComponent addStatusEffect(CompatStatusEffectInstance instance, float chance) { - return addStatusEffect(instance.getInstance(), chance); - } - - public FoodComponent.Builder getVanillaBuilder() { - FoodComponent.Builder builder = new FoodComponent.Builder(); - builder.nutrition(hunger).saturationModifier(saturation); - if (alwaysEdible) builder.alwaysEdible(); - return builder; - } - - public FoodComponent build() { - if (latestComponent != null) return latestComponent; - - float eatSeconds = 1.6f; - if (snack) eatSeconds = 0.8f; - if (meat) eatSeconds = 1.6f; - - latestComponent = new FoodComponent(hunger, saturation, alwaysEdible); - - return latestComponent; - } - - public FoodComponent vanillaBuild() { - if (latestComponent != null) return latestComponent; - - latestComponent = getVanillaBuilder().build(); - return latestComponent; - } - - // ---- - - public int getHunger() { - return hunger; - } - - public float getSaturation() { - return saturation; - } - - public boolean isMeat() { - return meat; - } - - public boolean isSnack() { - return snack; - } - - public boolean isAlwaysEdible() { - return alwaysEdible; - } - - @Deprecated - public List> getStatusEffects() { - return statusEffects; - } - - public List> getCompatStatusEffects() { - List> compatStatusEffects = new ArrayList<>(); - for (Pair pair : statusEffects) { - compatStatusEffects.add(Pair.of(new CompatStatusEffectInstance(pair.getFirst()), pair.getSecond())); - } - return compatStatusEffects; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java deleted file mode 100644 index d7c0e9958..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.item.Item; -import net.minecraft.item.Items; - -public class CompatItems { - public static Item SHORT_GRASS = Items.SHORT_GRASS; - public static Item TALL_GRASS = Items.TALL_GRASS; - public static Item TURTLE_SCUTE = Items.TURTLE_SCUTE; - - // Compatibility - public static Item GRASS = SHORT_GRASS; - public static Item SCUTE = TURTLE_SCUTE; - - // ---- - - public static Item AIR = Items.AIR; - public static Item STONE = Items.STONE; - public static Item COBBLESTONE = Items.COBBLESTONE; - public static Item GRASS_BLOCK = Items.GRASS_BLOCK; - public static Item DIRT = Items.DIRT; - public static Item SAND = Items.SAND; - public static Item RED_SAND = Items.RED_SAND; - public static Item GRANITE = Items.GRANITE; - public static Item POLISHED_GRANITE = Items.POLISHED_GRANITE; - public static Item DIORITE = Items.DIORITE; - public static Item POLISHED_DIORITE = Items.POLISHED_DIORITE; - public static Item ANDESITE = Items.ANDESITE; - public static Item POLISHED_ANDESITE = Items.POLISHED_ANDESITE; - public static Item COARSE_DIRT = Items.COARSE_DIRT; - public static Item PODZOL = Items.PODZOL; - public static Item OAK_LOG = Items.OAK_LOG; - public static Item SPRUCE_LOG = Items.SPRUCE_LOG; - public static Item BIRCH_LOG = Items.BIRCH_LOG; - public static Item JUNGLE_LOG = Items.JUNGLE_LOG; - public static Item ACACIA_LOG = Items.ACACIA_LOG; - public static Item DARK_OAK_LOG = Items.DARK_OAK_LOG; - public static Item OAK_PLANKS = Items.OAK_PLANKS; - public static Item SPRUCE_PLANKS = Items.SPRUCE_PLANKS; - public static Item BIRCH_PLANKS = Items.BIRCH_PLANKS; - public static Item JUNGLE_PLANKS = Items.JUNGLE_PLANKS; - public static Item ACACIA_PLANKS = Items.ACACIA_PLANKS; - public static Item DARK_OAK_PLANKS = Items.DARK_OAK_PLANKS; - public static Item GLASS = Items.GLASS; - - public static Item STICK = Items.STICK; - public static Item GLASS_BOTTLE = Items.GLASS_BOTTLE; - public static Item EXP_BOTTLE = Items.EXPERIENCE_BOTTLE; - - public static Item GUNPOWDER = Items.GUNPOWDER; - public static Item REDSTONE = Items.REDSTONE; - public static Item COAL = Items.COAL; - public static Item CHARCOAL = Items.CHARCOAL; - public static Item IRON_INGOT = Items.IRON_INGOT; - public static Item COPPER_INGOT = Items.COPPER_INGOT; - public static Item GOLD_INGOT = Items.GOLD_INGOT; - public static Item DIAMOND = Items.DIAMOND; - public static Item EMERALD = Items.EMERALD; - public static Item LAPIS_LAZULI = Items.LAPIS_LAZULI; - public static Item NETHERITE_INGOT = Items.NETHERITE_INGOT; - public static Item NETHERITE_SCRAP = Items.NETHERITE_SCRAP; - public static Item QUARTZ = Items.QUARTZ; - - // ---- - - public static boolean isExist(Item item) { - return item != null && item != Items.AIR; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java deleted file mode 100644 index 0a6db5d51..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; - -public class CompatibleArmorItem extends Item implements CompatItemProvider { - public final ArmorEquipmentType type; - public final CompatibleArmorMaterial material; - - public CompatibleItemSettings settings; - - public CompatibleArmorItem(CompatibleArmorMaterial material, ArmorEquipmentType type, CompatibleItemSettings settings) { - super(settings.build().armor(material.build(), type.getType())); - this.type = type; - this.material = material; - - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - /** - * get ArmorEquipmentType - * @return ArmorEquipmentType - */ - public ArmorEquipmentType getArmorEquipmentType() { - return type; - } - - /** - * get ArmorMaterial - * @return CompatibleArmorMaterial - */ - public CompatibleArmorMaterial getArmorMaterial() { - return material; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java deleted file mode 100644 index 1c83e1af3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.item.Item; -import net.minecraft.item.equipment.ArmorMaterial; -import net.minecraft.item.equipment.EquipmentAssetKeys; -import net.minecraft.item.equipment.EquipmentType; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.IngredientUtil; - -import java.util.EnumMap; - -public interface CompatibleArmorMaterial { - int getDurability(ArmorEquipmentType type); - - int getProtection(ArmorEquipmentType type); - - int getEnchantability(); - - SoundEvent getEquipSound(); - - default Ingredient getRepairIngredient() { - return IngredientUtil.fromTagByIdentifier(getRepairTag().id()); - } - - /** - * @return the name of the material - */ - default String getName() { - return getId().getPath(); - } - - /** - * @return the id of the material - */ - Identifier getId(); - - float getToughness(); - - float getKnockbackResistance(); - - default TagKey getRepairTag() { - return ItemTags.REPAIRS_IRON_ARMOR; - } - - @Deprecated - default ArmorMaterial build() { - return new ArmorMaterial(0, getDefense(), getEnchantability(), RegistryEntry.of(getEquipSound()), getToughness(), getKnockbackResistance(), getRepairTag(), RegistryKey.of(EquipmentAssetKeys.REGISTRY_KEY, getId())); - } - - default EnumMap getDefense() { - EnumMap map = new EnumMap<>(EquipmentType.class); - map.put(EquipmentType.HELMET, this.getProtection(ArmorEquipmentType.HEAD)); - map.put(EquipmentType.CHESTPLATE, this.getProtection(ArmorEquipmentType.CHEST)); - map.put(EquipmentType.LEGGINGS, this.getProtection(ArmorEquipmentType.LEGS)); - map.put(EquipmentType.BOOTS, this.getProtection(ArmorEquipmentType.FEET)); - return map; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java deleted file mode 100644 index 717db504c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java +++ /dev/null @@ -1,111 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.minecraft.util.Rarity; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; - -import java.util.function.Supplier; - -@Deprecated -public class CompatibleItemSettings { - protected final ExtendSettings settings = new ExtendSettings(); - - protected Identifier itemGroupId = null; - protected Identifier _itemId = null; - - @Deprecated - public static CompatibleItemSettings of() { - return new CompatibleItemSettings(); - } - - // ~1.19.2 - public CompatibleItemSettings addGroup(ItemGroup itemGroup) { - settings.addGroup(itemGroup); - return this; - } - - // 1.19.3~ - // identifier: Item ID - public CompatibleItemSettings addGroup(ItemGroup itemGroup, Identifier identifier) { - settings.addGroup(itemGroup, identifier); - _itemId = identifier; - return this; - } - - public CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { - settings.addGroup(itemGroup, identifier); - _itemId = identifier; - return this; - } - - public CompatibleItemSettings addGroup(CreativeTabBuilder itemGroup) { - this.itemGroupId = itemGroup.getIdentifier(); - return this; - } - - public CompatibleItemSettings maxCount(int maxCount) { - settings.maxCount(maxCount); - return this; - } - - public CompatibleItemSettings maxDamage(int maxDamage) { - settings.maxDamage(maxDamage); - return this; - } - - public CompatibleItemSettings maxDamageIfAbsent(int maxDamage) { - try { - settings.maxDamage(maxDamage); - } catch (Exception ignored) {} - - return this; - } - - @Deprecated - public CompatibleItemSettings food(FoodComponent foodComponent) { - settings.food(foodComponent); - return this; - } - - public CompatibleItemSettings rarity(Rarity rarity) { - settings.rarity(rarity); - return this; - } - - public CompatibleItemSettings recipeRemainder(Item recipeRemainder) { - settings.recipeRemainder(recipeRemainder); - return this; - } - - public ExtendSettings build() { - if (itemGroupId != null) { - RegistrySupplier itemGroup = MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(itemGroupId); - settings.arch$tab(itemGroup); - } - - if (_itemId != null && !(this instanceof net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings)) { - settings.registryKey(RegistryKey.of(RegistryKeys.ITEM, _itemId)); - } - - return settings; - } - - public CompatibleItemSettings addGroup(ItemGroup itemGroup, CompatIdentifier identifier) { - return addGroup(itemGroup, identifier.toMinecraft()); - } - - public CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { - return addGroup(itemGroup, identifier.toMinecraft()); - } - - public CompatibleItemSettings food(CompatFoodComponent foodComponent) { - return food(foodComponent.build()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java deleted file mode 100644 index fc7e9851a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java +++ /dev/null @@ -1,112 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import dev.architectury.registry.CreativeTabRegistry; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; -import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; - -import java.util.function.Supplier; - -public class CreativeTabBuilder { - private final Identifier identifier; - private Text displayName = null; - private Supplier iconSupplier = null; - private boolean noRenderedName = false; - private boolean noScrollbar = false; - private boolean special = false; - private String texture; - - @Deprecated - // Recommend: create(identifier) - public CreativeTabBuilder(Identifier identifier) { - this.identifier = identifier; - } - - public static CreativeTabBuilder create(Identifier identifier) { - return new CreativeTabBuilder(identifier); - } - - public static CreativeTabBuilder create(CompatIdentifier identifier) { - return create(identifier.toMinecraft()); - } - - public CreativeTabBuilder setDisplayName(Text text) { - this.displayName = text; - return this; - } - - /** - * Set icon - * @param iconSupplier Icon supplier - * @return CreativeTabBuilder - */ - public CreativeTabBuilder setIcon(Supplier iconSupplier) { - this.iconSupplier = iconSupplier; - return this; - } - - /** - * Set icon (Already registered item only) - * @param item Item - * @return CreativeTabBuilder - */ - public CreativeTabBuilder setIcon(Item item) { - return setIcon(() -> new ItemStack(item)); - } - - public void noRenderedName() { - this.noRenderedName = true; - } - - public void noScrollbar() { - this.noScrollbar = true; - } - - public void special() { - this.special = true; - } - - public void setTexture(String texture) { - this.texture = texture; - } - - /** - * Build ItemGroup (If loader is forge, not recommended) - * @return ItemGroup - */ - public ItemGroup build() { - return CreativeTabRegistry.create((builder -> { - if (displayName != null) builder.displayName(displayName); - else builder.displayName(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); - - if (iconSupplier != null) builder.icon(iconSupplier); - if (noRenderedName) builder.noRenderedName(); - if (noScrollbar) builder.noScrollbar(); - if (special) builder.special(); - if (texture != null) builder.texture(IdentifierUtil.id(texture)); - })); - } - - @SuppressWarnings("deprecation") - public ItemGroupWrapper getBuiltWrapper() { - if (MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.containsKey(identifier)) - return ItemGroupWrapper.of(MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(identifier).getOrNull()); - - return ItemGroupWrapper.of(build()); - } - - public Identifier getIdentifier() { - return identifier; - } - - public CompatIdentifier getCompatIdentifier() { - return CompatIdentifier.fromMinecraft(identifier); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java deleted file mode 100644 index b8de65096..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java +++ /dev/null @@ -1,112 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import dev.architectury.registry.CreativeTabRegistry; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.ItemUtil; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; - -public class CreativeTabManager { - private static List bookingItems = new ArrayList<>(); - private static List bookingStacks = new ArrayList<>(); - - // グループ予約済みアイテム - public static class BookingItem { - @Deprecated - public ItemGroup itemGroup; - - public Supplier itemGroupSupplier; - public Identifier identifier; - - @Deprecated - private BookingItem(ItemGroup itemGroup, Identifier identifier) { - this.itemGroup = itemGroup; - this.identifier = identifier; - } - - private BookingItem(Supplier itemGroup, Identifier identifier) { - this.itemGroupSupplier = itemGroup; - this.identifier = identifier; - } - - public ItemGroup getItemGroup() { - if (itemGroupSupplier != null) - return itemGroupSupplier.get(); - return itemGroup; - } - } - - // グループ予約済みアイテムスタック - public static class BookingStack { - @Deprecated - public ItemGroup itemGroup; - - public Supplier itemGroupSupplier; - public ItemStack stack; - - @Deprecated - private BookingStack(ItemGroup itemGroup, ItemStack stack) { - this.itemGroup = itemGroup; - this.stack = stack; - } - - private BookingStack(Supplier itemGroup, ItemStack stack) { - this.itemGroupSupplier = itemGroup; - this.stack = stack; - } - - public ItemGroup getItemGroup() { - if (itemGroupSupplier != null) - return itemGroupSupplier.get(); - return itemGroup; - } - } - - public static void allRegister() { - if (!bookingItems.isEmpty()) { - for (BookingItem bookingItem : bookingItems) { - CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); - } - bookingItems = new ArrayList<>(); - } - - if (!bookingStacks.isEmpty()) { - for (BookingStack bookingStack : bookingStacks) { - CreativeTabRegistry.appendBuiltinStack(bookingStack.getItemGroup(), bookingStack.stack); - } - bookingStacks = new ArrayList<>(); - } - } - - public static void register(Identifier identifier) { - if (bookingItems.isEmpty()) return; - for (BookingItem bookingItem : bookingItems) { - if (!bookingItem.identifier.toString().equals(identifier.toString())) continue; - CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); - bookingItems.remove(bookingItem); - break; - } - } - - @Deprecated - public static void addItem(ItemGroup itemGroup, Identifier identifier) { - bookingItems.add(new BookingItem(itemGroup, identifier)); - } - - @Deprecated - public static void addStack(ItemGroup itemGroup, ItemStack stack) { - bookingStacks.add(new BookingStack(itemGroup, stack)); - } - - public static void addItem(Supplier itemGroup, Identifier identifier) { - bookingItems.add(new BookingItem(itemGroup, identifier)); - } - - public static void addStack(Supplier itemGroup, ItemStack stack) { - bookingStacks.add(new BookingStack(itemGroup, stack)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java deleted file mode 100644 index b5d5f17ce..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemGroups; -import net.minecraft.registry.Registries; - -public class DefaultItemGroups { - public static final ItemGroup BUILDING_BLOCKS = Registries.ITEM_GROUP.get(ItemGroups.BUILDING_BLOCKS); - public static final ItemGroup COLORED_BLOCKS = Registries.ITEM_GROUP.get(ItemGroups.COLORED_BLOCKS); // if 1.19.2 and below, BUILDING_BLOCKS - public static final ItemGroup NATURAL = Registries.ITEM_GROUP.get(ItemGroups.NATURAL); // if 1.19.2 and below, DECORATIONS - public static final ItemGroup FUNCTIONAL = Registries.ITEM_GROUP.get(ItemGroups.FUNCTIONAL); // if 1.19.2 and below, TRANSPORTATION - public static final ItemGroup REDSTONE = Registries.ITEM_GROUP.get(ItemGroups.REDSTONE); - public static final ItemGroup HOTBAR = Registries.ITEM_GROUP.get(ItemGroups.HOTBAR); - public static final ItemGroup SEARCH = Registries.ITEM_GROUP.get(ItemGroups.SEARCH); - public static final ItemGroup TOOLS = Registries.ITEM_GROUP.get(ItemGroups.TOOLS); - public static final ItemGroup COMBAT = Registries.ITEM_GROUP.get(ItemGroups.COMBAT); - public static final ItemGroup FOOD_AND_DRINK = Registries.ITEM_GROUP.get(ItemGroups.FOOD_AND_DRINK); // if 1.19.2 and below, FOOD - public static final ItemGroup INGREDIENTS = Registries.ITEM_GROUP.get(ItemGroups.INGREDIENTS); // if 1.19.2 and below, MISC - public static final ItemGroup SPAWN_EGGS = Registries.ITEM_GROUP.get(ItemGroups.SPAWN_EGGS); // if 1.19.2 and below, MISC - public static final ItemGroup OPERATOR = Registries.ITEM_GROUP.get(ItemGroups.OPERATOR); // if 1.19.2 and below, MISC - public static final ItemGroup INVENTORY = Registries.ITEM_GROUP.get(ItemGroups.INVENTORY); - - // ~1.19.2 Item Group - public static final ItemGroup BREWING = FOOD_AND_DRINK; - public static final ItemGroup TRANSPORTATION = FUNCTIONAL; - public static final ItemGroup DECORATIONS = NATURAL; - public static final ItemGroup MISC = INGREDIENTS; -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java deleted file mode 100644 index d69eaa553..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java +++ /dev/null @@ -1,138 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.block.Block; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.*; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.StackActionResult; -import net.pitan76.mcpitanlib.core.Dummy; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; - -import java.util.List; -import java.util.function.Consumer; - -public class ExtendBlockItem extends BlockItem implements ExtendItemProvider { - - public ExtendBlockItem(Block block, Settings settings) { - super(block, settings); - } - - public ExtendBlockItem(Block block, CompatibleItemSettings settings) { - super(block, settings.build()); - } - - // ExtendItem - @Deprecated - @Override - public ActionResult use(World world, PlayerEntity user, Hand hand) { - return onRightClick(new ItemUseEvent(world, user, hand)).toActionResult(); - } - - @Deprecated - @Override - public ActionResult useOnBlock(ItemUsageContext context) { - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; - return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); - } - - @Deprecated - @Override - public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { - return onFinishUsing(new ItemFinishUsingEvent(stack, world, user)); - } - - @Deprecated - @Override - public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { - return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); - } - - @Deprecated - public boolean hasRecipeRemainder() { - return hasRecipeRemainder(new Dummy()); - } - - @Deprecated - @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { - appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); - } - - @Deprecated - @Override - public void onCraft(ItemStack stack, World world) { - onCraft(new CraftEvent(stack, world)); - } - - /** - * item right click event - * - * @param event ItemUseEvent - * @return ActionResultType - */ - public StackActionResult onRightClick(ItemUseEvent event) { - return StackActionResult.create(CompatActionResult.create(super.use(event.world, event.user.getPlayerEntity(), event.hand)), event.stack); - } - - /** - * item right click event on block - * @param event ItemUseOnBlockEvent - * @return ActionResultType - */ - public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { - return CompatActionResult.create(super.useOnBlock(event.toIUC())); - } - - /** - * item finish using event - * @param event ItemFinishUsingEvent - * @return ItemStack - */ - public ItemStack onFinishUsing(ItemFinishUsingEvent event) { - return super.finishUsing(event.stack, event.world, event.user); - } - - /** - * item right click event on entity - * @param event ItemUseOnEntityEvent - * @return ActionResultType - */ - public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event) { - return CompatActionResult.create(super.useOnEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); - } - - /** - * check if item has recipe remainder - * @param dummy Dummy - * @return boolean - */ - public boolean hasRecipeRemainder(Dummy dummy) { - return false; - } - - /** - * append tooltip to item - * @param event ItemAppendTooltipEvent - */ - public void appendTooltip(ItemAppendTooltipEvent event) { - super.appendTooltip(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); - } - - /** - * on craft event - * @param event CraftEvent - */ - public void onCraft(CraftEvent event) { - super.onCraft(event.stack, event.world); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java deleted file mode 100644 index 54e1391cc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java +++ /dev/null @@ -1,262 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.block.BlockState; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.item.consume.UseAction; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Rarity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.*; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.StackActionResult; -import net.pitan76.mcpitanlib.core.Dummy; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; - -import java.util.List; -import java.util.function.Consumer; - -public class ExtendItem extends Item { - - public ExtendItem(Settings settings) { - super(settings); - } - - public ExtendItem(CompatibleItemSettings settings) { - super(settings.build()); - } - - @Deprecated - @Override - public ActionResult use(World world, PlayerEntity user, Hand hand) { - return onRightClick(new ItemUseEvent(world, user, hand)).toActionResult(); - } - - @Deprecated - @Override - public ActionResult useOnBlock(ItemUsageContext context) { - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; - return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); - } - - @Deprecated - @Override - public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { - return onFinishUsing(new ItemFinishUsingEvent(stack, world, user)); - } - - @Deprecated - @Override - public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { - return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); - } - - @Override - public UseAction getUseAction(ItemStack stack) { - return super.getUseAction(stack); - } - - @Deprecated - //@Override - public boolean hasRecipeRemainder() { - return hasRecipeRemainder(new Dummy()); - } - - @Deprecated - @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { - appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); - } - - @Deprecated - @Override - public void onCraft(ItemStack stack, World world) { - onCraft(new CraftEvent(stack, world)); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * item right click event - * - * @param event ItemUseEvent - * @return ActionResultType - */ - public StackActionResult onRightClick(ItemUseEvent event) { - return StackActionResult.create(CompatActionResult.create(super.use(event.world, event.user.getPlayerEntity(), event.hand)), event.stack); - } - - /** - * item right click event on block - * @param event ItemUseOnBlockEvent - * @return ActionResultType - */ - public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { - return CompatActionResult.create(super.useOnBlock(event.toIUC())); - } - - /** - * item finish using event - * @param event ItemFinishUsingEvent - * @return ItemStack - */ - public ItemStack onFinishUsing(ItemFinishUsingEvent event) { - return super.finishUsing(event.stack, event.world, event.user); - } - - /** - * item right click event on entity - * @param event ItemUseOnEntityEvent - * @return ActionResultType - */ - public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event) { - return CompatActionResult.create(super.useOnEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); - } - - /** - * check if item has recipe remainder - * @param dummy Dummy - * @return boolean - */ - public boolean hasRecipeRemainder(Dummy dummy) { - return false; - } - - /** - * append tooltip to item - * @param event ItemAppendTooltipEvent - */ - public void appendTooltip(ItemAppendTooltipEvent event) { - super.appendTooltip(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); - } - - /** - * on craft event - * @param event CraftEvent - */ - public void onCraft(CraftEvent event) { - super.onCraft(event.stack, event.world); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - // -1.20.6 - public Rarity getRarity(ItemStack stack) { - return Rarity.COMMON; - } - - @Deprecated - public boolean isEnchantable(ItemStack stack) { - return isEnchantable(new EnchantableArgs(stack)); - } - - public boolean isEnchantable(EnchantableArgs args) { - return false; - } - - @Deprecated - public int getEnchantability() { - return getEnchantability(new EnchantabilityArgs()); - } - - public int getEnchantability(EnchantabilityArgs args) { - return 0; - } - - @Deprecated - @Override - public int getItemBarColor(ItemStack stack) { - return getItemBarColor(new ItemBarColorArgs(stack)); - } - - public int getItemBarColor(ItemBarColorArgs args) { - return super.getItemBarColor(args.stack); - } - - @Deprecated - @Override - public boolean isItemBarVisible(ItemStack stack) { - return isItemBarVisible(new ItemBarVisibleArgs(stack)); - } - - public boolean isItemBarVisible(ItemBarVisibleArgs args) { - return super.isItemBarVisible(args.stack); - } - - @Deprecated - @Override - public int getItemBarStep(ItemStack stack) { - return getItemBarStep(new ItemBarStepArgs(stack)); - } - - public int getItemBarStep(ItemBarStepArgs args) { - return super.getItemBarStep(args.stack); - } - - @Deprecated - @Override - public float getBonusAttackDamage(Entity target, float baseAttackDamage, DamageSource damageSource) { - return getBonusAttackDamage(new BonusAttackDamageArgs(target, baseAttackDamage, damageSource)); - } - - public float getBonusAttackDamage(BonusAttackDamageArgs args) { - return super.getBonusAttackDamage(args.target, args.baseAttackDamage, args.damageSource); - } - - @Deprecated - //@Override - public boolean canRepair(ItemStack stack, ItemStack ingredient) { - return canRepair(new CanRepairArgs(stack, ingredient)); - } - - public boolean canRepair(CanRepairArgs args) { - return false; - } - - @Deprecated - @Override - public boolean canMine(ItemStack stack, BlockState state, World world, BlockPos pos, LivingEntity user) { - return canMine(new CanMineArgs(stack, state, world, pos, user)); - } - - public boolean canMine(CanMineArgs args) { - return super.canMine(args.stack, args.state, args.world, args.pos, args.entity); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java deleted file mode 100644 index 7742fa05e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java +++ /dev/null @@ -1,136 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.Rarity; -import net.pitan76.mcpitanlib.api.event.item.*; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.StackActionResult; - -public interface ExtendItemProvider { - - /** - * item right click event - * - * @param event ItemUseEvent - * @return ActionResultType - */ - default StackActionResult onRightClick(ItemUseEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * item right click event on block - * @param event ItemUseOnBlockEvent - * @return ActionResultType - */ - default CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * using finish with item - * @param event ItemFinishUsingEvent - * @return ItemStack - */ - default ItemStack onFinishUsing(ItemFinishUsingEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * on click with item on entity - * @param event ItemUseOnEntityEvent - * @return ActionResult - */ - default CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event, Options options) { - options.cancel = false; - return null; - } - - /** - * item has recipe remainder - * @param options Options - * @return boolean - */ - default boolean hasRecipeRemainder(Options options) { - options.cancel = false; - return false; - } - - /** - * add tooltip - * @param event ItemAppendTooltipEvent - */ - default void appendTooltip(ItemAppendTooltipEvent event, Options options) { - options.cancel = false; - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - default boolean postHit(PostHitEvent event, Options options) { - options.cancel = false; - return false; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - default boolean postMine(PostMineEvent event, Options options) { - options.cancel = false; - return false; - } - - /** - * on craft event - * @param event CraftEvent - */ - default void onCraft(CraftEvent event, Options options) { - options.cancel = false; - } - - default Rarity getRarity(ItemStack stack, Options options) { - options.cancel = false; - return null; - } - - default boolean isEnchantable(EnchantableArgs args, Options options) { - options.cancel = false; - return false; - } - - default int getEnchantability(EnchantabilityArgs args, Options options) { - options.cancel = false; - return 0; - } - - default int getItemBarColor(ItemBarColorArgs args, Options options) { - options.cancel = false; - return 0; - } - - default boolean isItemBarVisible(ItemBarVisibleArgs args, Options options) { - options.cancel = false; - return false; - } - - default int getItemBarStep(ItemBarStepArgs args, Options options) { - options.cancel = false; - return 0; - } - - default float getBonusAttackDamage(BonusAttackDamageArgs args, Options options) { - options.cancel = false; - return 0; - } - - public static class Options { - public boolean cancel = true; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java deleted file mode 100644 index bbf502359..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.util.Identifier; - -import java.util.function.Supplier; - -/** - * Use {@link CompatibleItemSettings} instead. - */ -public class ExtendSettings extends Item.Settings { - - // ~1.19.2 - @Deprecated - public ExtendSettings addGroup(ItemGroup itemGroup) { - return this; - } - - // 1.19.3~ - // identifier: Item ID - @Deprecated - public ExtendSettings addGroup(ItemGroup itemGroup, Identifier identifier) { - this.arch$tab(itemGroup); - CreativeTabManager.addItem(itemGroup, identifier); - return this; - } - - @Deprecated - public ExtendSettings addGroup(Supplier itemGroup, Identifier identifier) { - CreativeTabManager.addItem(itemGroup, identifier); - return this; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java deleted file mode 100644 index c96382ed2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.minecraft.item.ItemStack; - -public interface FixedRecipeRemainderItem { - ItemStack getFixedRecipeRemainder(ItemStack stack); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java deleted file mode 100644 index a188233b2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.api.item; - -import net.pitan76.mcpitanlib.api.item.v2.CompatItem; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class FoodItem extends CompatItem { - public FoodItem(int hunger, float saturation, CompatIdentifier id) { - this(new ItemSettingsBuilder().foodComponent(CompatFoodComponent.create().setHunger(hunger).setSaturation(saturation)).build(id)); - } - - public FoodItem(CompatFoodComponent component, CompatIdentifier id) { - this(new ItemSettingsBuilder().foodComponent(component).build(id)); - } - - public FoodItem(CompatFoodComponent component, ItemSettingsBuilder builder, CompatIdentifier id) { - this(builder.foodComponent(component).build(id)); - } - - public FoodItem(CompatFoodComponent component, CompatibleItemSettings settings) { - this(settings.food(component)); - } - - public FoodItem(CompatibleItemSettings settings) { - super(settings); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java deleted file mode 100644 index 6db9d79f4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.args; - -import net.minecraft.item.ItemStack; - -public class RarityArgs { - public ItemStack stack; - - public RarityArgs(ItemStack stack) { - this.stack = stack; - } - - public ItemStack getStack() { - return stack; - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java deleted file mode 100644 index e7c9e8446..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.args; - -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; - -import java.util.Optional; - -public class StoppedUsingArgs { - - public ItemStack stack; - public World world; - public LivingEntity user; - public int remainingUseTicks; - - public StoppedUsingArgs(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { - this.stack = stack; - this.world = world; - this.user = user; - this.remainingUseTicks = remainingUseTicks; - } - - public StoppedUsingArgs(ItemStack stack, World world, LivingEntity user) { - this(stack, world, user, 0); - } - - public StoppedUsingArgs(ItemStack stack, World world, Player player, int remainingUseTicks) { - this(stack, world, player.getEntity(), remainingUseTicks); - } - - public StoppedUsingArgs(ItemStack stack, World world, Player player) { - this(stack, world, player, 0); - } - - public ItemStack getStack() { - return stack; - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } - - public World getWorld() { - return world; - } - - public LivingEntity getUser() { - return user; - } - - public int getRemainingUseTicks() { - return remainingUseTicks; - } - - public boolean hasRemainingUseTicks() { - return remainingUseTicks > 0; - } - - public boolean hasNoRemainingUseTicks() { - return !hasRemainingUseTicks(); - } - - public boolean isClient() { - return world.isClient(); - } - - public boolean isServer() { - return !isClient(); - } - - public boolean isPlayer() { - return user instanceof PlayerEntity; - } - - public Optional getPlayer() { - return isPlayer() ? Optional.of(new Player((PlayerEntity) user)) : Optional.empty(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java deleted file mode 100644 index acdbd404d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.args; - -import net.minecraft.item.ItemStack; - -public class UseActionArgs { - public ItemStack stack; - - public UseActionArgs(ItemStack stack) { - this.stack = stack; - } - - public static UseActionArgs of(ItemStack stack) { - return new UseActionArgs(stack); - } - - public static UseActionArgs of(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return of(stack.toMinecraft()); - } - - public ItemStack getStack() { - return stack; - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java deleted file mode 100644 index e3350697c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java +++ /dev/null @@ -1,45 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.consume; - -import net.minecraft.item.consume.UseAction; -import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; - -public class CompatUseAction implements CompatStringIdentifiable { - private final UseAction useAction; - - public static final CompatUseAction NONE = of(UseAction.NONE); - public static final CompatUseAction EAT = of(UseAction.EAT); - public static final CompatUseAction DRINK = of(UseAction.DRINK); - public static final CompatUseAction BLOCK = of(UseAction.BLOCK); - public static final CompatUseAction BOW = of(UseAction.BOW); - public static final CompatUseAction SPEAR = of(UseAction.SPEAR); - public static final CompatUseAction CROSSBOW = of(UseAction.CROSSBOW); - public static final CompatUseAction SPYGLASS = of(UseAction.SPYGLASS); - public static final CompatUseAction TOOT_HORN = of(UseAction.TOOT_HORN); - public static final CompatUseAction BRUSH = of(UseAction.BRUSH); - - public CompatUseAction(UseAction useAction) { - this.useAction = useAction; - } - - public static CompatUseAction of(UseAction useAction) { - return new CompatUseAction(useAction); - } - - @Deprecated - public UseAction get() { - return useAction; - } - - public int getId() { - return useAction.getId(); - } - - public String getName() { - return useAction.asString(); - } - - @Override - public String asString_compat() { - return getName(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java deleted file mode 100644 index 3a979fc7e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.equipment; - -import net.minecraft.item.equipment.EquipmentAssetKeys; -import net.minecraft.registry.RegistryKey; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class CompatEquipmentAsset { - private final RegistryKey raw; - - @Deprecated - public CompatEquipmentAsset(RegistryKey key) { - this.raw = key; - } - - @Deprecated - public RegistryKey raw() { - return raw; - } - - public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(raw.getValue()); - } - - @Deprecated - public static CompatEquipmentAsset of(RegistryKey key) { - return new CompatEquipmentAsset(key); - } - - public static CompatEquipmentAsset of(CompatIdentifier id) { - return of(RegistryKey.of(EquipmentAssetKeys.REGISTRY_KEY, id.toMinecraft())); - } - - public static CompatEquipmentAsset of(String id) { - return of(CompatIdentifier.of(id)); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof CompatEquipmentAsset)) return false; - CompatEquipmentAsset that = (CompatEquipmentAsset) obj; - return raw.equals(that.raw); - } - - @Override - public int hashCode() { - if (raw == null) return super.hashCode(); - return raw.hashCode(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java deleted file mode 100644 index e66cde67e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.equipment; - -import net.minecraft.component.type.EquippableComponent; - -public class CompatEquippableComponent { - private final EquippableComponent raw; - - @Deprecated - public CompatEquippableComponent(EquippableComponent component) { - this.raw = component; - } - - @Deprecated - public EquippableComponent raw() { - return raw; - } - - @Deprecated - public static CompatEquippableComponent of(EquippableComponent component) { - return new CompatEquippableComponent(component); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof CompatEquippableComponent)) return false; - CompatEquippableComponent that = (CompatEquippableComponent) obj; - return raw().equals(that.raw()); - } - - @Override - public int hashCode() { - if (raw() == null) return super.hashCode(); - return raw().hashCode(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java deleted file mode 100644 index 5ced28a55..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java +++ /dev/null @@ -1,94 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.equipment; - -import net.minecraft.component.type.EquippableComponent; -import net.minecraft.entity.EntityType; -import net.minecraft.registry.Registries; -import net.minecraft.registry.RegistryEntryLookup; -import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class EquippableComponentBuilder { - - public ArmorEquipmentType equipmentType; - public CompatSoundEvent equipSound; - public CompatSoundEvent shearingSound; - public boolean equipOnInteract = false; - public boolean canBeSheared = false; - public CompatEquipmentAsset model; - public TagKey allowedEntities = null; - - public EquippableComponentBuilder() { - - } - - public EquippableComponentBuilder(ArmorEquipmentType equipmentType) { - this.equipmentType = equipmentType; - } - - public EquippableComponentBuilder equipmentType(ArmorEquipmentType equipmentType) { - this.equipmentType = equipmentType; - return this; - } - - public EquippableComponentBuilder equipSound(CompatSoundEvent equipSound) { - this.equipSound = equipSound; - return this; - } - - public EquippableComponentBuilder shearingSound(CompatSoundEvent shearingSound) { - this.shearingSound = shearingSound; - return this; - } - - public EquippableComponentBuilder equipOnInteract(boolean equipOnInteract) { - this.equipOnInteract = equipOnInteract; - return this; - } - - public EquippableComponentBuilder canBeSheared(boolean canBeSheared) { - this.canBeSheared = canBeSheared; - return this; - } - - public EquippableComponentBuilder model(CompatEquipmentAsset model) { - this.model = model; - return this; - } - - public EquippableComponentBuilder model(CompatIdentifier id) { - return model(CompatEquipmentAsset.of(id)); - } - - public EquippableComponentBuilder allowedEntities(TagKey allowedEntities) { - this.allowedEntities = allowedEntities; - return this; - } - - public EquippableComponentBuilder allowedEntities(CompatIdentifier tagId) { - return allowedEntities(TagKey.create(TagKey.Type.ENTITY_TYPE, tagId)); - } - - public EquippableComponentBuilder allowedEntities(String tagId) { - return allowedEntities(CompatIdentifier.of(tagId)); - } - - public CompatEquippableComponent build() { - EquippableComponent.Builder component = EquippableComponent.builder(equipmentType.getSlot()); - if (equipSound != null) - component.equipSound(equipSound.getEntry() != null ? equipSound.getEntry() : equipSound.getReference()); - if (shearingSound != null) - component.shearingSound(shearingSound.getEntry() != null ? shearingSound.getEntry() : shearingSound.getReference()); - - component.equipOnInteract(equipOnInteract); - component.canBeSheared(canBeSheared); - if (model != null) component.model(model.raw()); - if (allowedEntities != null) { - RegistryEntryLookup> registryEntryLookup = Registries.createEntryLookup(Registries.ENTITY_TYPE); - component.allowedEntities(registryEntryLookup.getOrThrow((net.minecraft.registry.tag.TagKey>) allowedEntities.getTagKey())); - } - - return CompatEquippableComponent.of(component.build()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java deleted file mode 100644 index e29531d73..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.stack; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.LoreComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; - -import java.util.List; - -public class LoreUtil { - public static boolean hasLore(ItemStack stack) { - return stack.contains(DataComponentTypes.LORE); - } - - public static List getLore(ItemStack stack) { - if (!hasLore(stack)) return List.of(); - return stack.get(DataComponentTypes.LORE).lines(); - } - - public static List getLoreAsStringList(ItemStack stack) { - return getLore(stack).stream() - .map(Text::getString) - .toList(); - } - - public static String getLoreAsString(ItemStack stack) { - return getLoreAsStringList(stack).stream() - .reduce("", (a, b) -> a + "\n" + b); - } - - public static void setLore(ItemStack stack, List lore) { - stack.set(DataComponentTypes.LORE, new LoreComponent(lore)); - } - - public static void setLoreStringList(ItemStack stack, List lore) { - setLore(stack, lore.stream() - .map(Text::of) - .toList()); - } - - public static void setLore(ItemStack stack, String lore) { - setLore(stack, lore.lines() - .map(Text::of) - .toList()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java deleted file mode 100644 index f6023e0ac..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java +++ /dev/null @@ -1,90 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.AxeItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -public class CompatibleAxeItem extends AxeItem implements CompatItemProvider { - - public CompatibleItemSettings settings; - - public CompatibleAxeItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, CompatibleItemSettings settings) { - super(material.build(), attackDamage, attackSpeed, settings.build()); - this.settings = settings; - } - - public CompatibleAxeItem(float attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { - super(material, attackDamage, attackSpeed, settings.build()); - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - // -1.20.6 - public boolean isDamageableOnDefault() { - return ItemStackUtil.getMaxDamage(this) > 0; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java deleted file mode 100644 index 0842a0fd9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java +++ /dev/null @@ -1,90 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.HoeItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; - -public class CompatibleHoeItem extends HoeItem implements CompatItemProvider { - - public CompatibleItemSettings settings; - - public CompatibleHoeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { - super(material.build(), attackDamage, attackSpeed, settings.build()); - this.settings = settings; - } - - public CompatibleHoeItem(int attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { - super(material, attackDamage, attackSpeed, settings.build()); - this.settings = settings; - } - - @Override - public net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - // -1.20.6 - public boolean isDamageableOnDefault() { - return ItemStackUtil.getMaxDamage(this) > 0; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java deleted file mode 100644 index 153b473b2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java +++ /dev/null @@ -1,125 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.ItemUseOnEntityEvent; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; -import net.pitan76.mcpitanlib.api.tag.v2.typed.BlockTagKey; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -public class CompatibleMiningToolItem extends Item implements CompatItemProvider { - - public CompatibleItemSettings settings; - - @Deprecated - protected CompatibleMiningToolItem(float attackDamage, float attackSpeed, ToolMaterial material, net.minecraft.registry.tag.TagKey effectiveBlocks, Settings settings) { - super(settings.tool(material, effectiveBlocks, attackDamage, attackSpeed, 0)); - } - - public CompatibleMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, TagKey tagKey, CompatibleItemSettings settings) { - this(attackDamage, attackSpeed, material.build(), tagKey.getTagKey(), settings.build()); - this.settings = settings; - } - - public CompatibleMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatTagKey tagKey, CompatibleItemSettings settings) { - this(attackDamage, attackSpeed, material.build(), tagKey.getTagKey(), settings.build()); - this.settings = settings; - } - - public CompatibleMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, BlockTagKey tagKey, CompatibleItemSettings settings) { - this(attackDamage, attackSpeed, material.build(), tagKey.getTagKey(), settings.build()); - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - // -1.20.6 - public boolean isDamageableOnDefault() { - return ItemStackUtil.getMaxDamage(this) > 0; - } - - @Deprecated - @Override - public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { - return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); - } - - @Deprecated - @Override - public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event, Options options) { - return CompatItemProvider.super.onRightClickOnEntity(event, options); - } - - public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent e) { - return CompatActionResult.of(super.useOnEntity(e.stack, e.user.getEntity(), e.entity, e.hand)); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java deleted file mode 100644 index 6a7d66539..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java +++ /dev/null @@ -1,90 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; - -public class CompatiblePickaxeItem extends Item implements CompatItemProvider { - - public CompatibleItemSettings settings; - - public CompatiblePickaxeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { - super(settings.build().pickaxe(material.build(), attackDamage, attackSpeed)); - this.settings = settings; - } - - public CompatiblePickaxeItem(int attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { - super(settings.build().pickaxe(material, attackDamage, attackSpeed)); - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - // -1.20.6 - public boolean isDamageableOnDefault() { - return ItemStackUtil.getMaxDamage(this) > 0; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java deleted file mode 100644 index baf1308b3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java +++ /dev/null @@ -1,89 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ShearsItem; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -public class CompatibleShearsItem extends ShearsItem implements CompatItemProvider { - - public CompatibleItemSettings settings; - - @Deprecated - public CompatibleShearsItem(Settings settings) { - super(settings); - } - - public CompatibleShearsItem(CompatibleItemSettings settings) { - this(settings.build()); - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - // -1.20.6 - public boolean isDamageableOnDefault() { - return ItemStackUtil.getMaxDamage(this) > 0; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java deleted file mode 100644 index d3737e319..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java +++ /dev/null @@ -1,90 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ShovelItem; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -public class CompatibleShovelItem extends ShovelItem implements CompatItemProvider { - - public CompatibleItemSettings settings; - - public CompatibleShovelItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, CompatibleItemSettings settings) { - super(material.build(), attackDamage, attackSpeed, settings.build()); - } - - public CompatibleShovelItem(float attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { - super(material, attackDamage, attackSpeed, settings.build()); - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * post hit event - * - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - // -1.20.6 - public boolean isDamageableOnDefault() { - return ItemStackUtil.getMaxDamage(this) > 0; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java deleted file mode 100644 index cba960cde..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java +++ /dev/null @@ -1,90 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; - -public class CompatibleSwordItem extends Item implements CompatItemProvider { - - public CompatibleItemSettings settings; - - public CompatibleSwordItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { - super(settings.build().sword(material.build(), attackDamage, attackSpeed)); - this.settings = settings; - } - - public CompatibleSwordItem(int attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { - super(settings.build().sword(material, attackDamage, attackSpeed)); - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } - - // -1.20.6 - public boolean isDamageableOnDefault() { - return ItemStackUtil.getMaxDamage(this) > 0; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java deleted file mode 100644 index 27907c3ce..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java +++ /dev/null @@ -1,86 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; -import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; - -public class CompatibleToolItem extends Item implements CompatItemProvider { - - public CompatibleToolMaterial material; - - public CompatibleItemSettings settings; - - @Deprecated - protected CompatibleToolItem(Settings settings) { - super(settings); - } - - public CompatibleToolItem(CompatibleToolMaterial material, CompatibleItemSettings settings) { - this(settings.build().tool(material.build(), null, 0, 0, 0)); - this.material = material; - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); - } - - @Deprecated - @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { - return overrideIsSuitableFor(state); - } - - public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { - return 1.0F; - } - - @Deprecated - @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * material.getCompatMiningSpeedMultiplier(); - } - - @Deprecated - @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { - postHit(new PostHitEvent(stack, target, attacker)); - } - - @Deprecated - @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { - return postMine(new PostMineEvent(stack, world, state, pos, miner)); - } - - /** - * post hit event - * @param event PostHitEvent - * @return boolean - */ - public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); - return true; - } - - /** - * post mine event - * @param event PostMineEvent - * @return boolean - */ - public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java deleted file mode 100644 index ab44f30bf..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java +++ /dev/null @@ -1,85 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.tool; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ToolMaterial; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.IngredientUtil; - -public interface CompatibleToolMaterial { - - int getCompatMiningLevel(); - - float getCompatAttackDamage(); - - float getCompatMiningSpeedMultiplier(); - - default Ingredient getCompatRepairIngredient() { - return IngredientUtil.fromTagByIdentifier(getRepairTag().id()); - } - - int getCompatDurability(); - - int getCompatEnchantability(); - - default TagKey getInverseTag() { - - return level2inverseTag(getCompatMiningLevel()); - } - - public static TagKey level2inverseTag(int level) { - switch (level) { - case 1: - return BlockTags.INCORRECT_FOR_WOODEN_TOOL; - case 2: - return BlockTags.INCORRECT_FOR_STONE_TOOL; - case 3: - return BlockTags.INCORRECT_FOR_IRON_TOOL; - case 4: - return BlockTags.INCORRECT_FOR_GOLD_TOOL; - case 5: - return BlockTags.INCORRECT_FOR_DIAMOND_TOOL; - case 6: - return BlockTags.INCORRECT_FOR_NETHERITE_TOOL; - - default: - return BlockTags.INCORRECT_FOR_WOODEN_TOOL; - } - } - - @Deprecated - default float getAttackDamage() { - return getCompatAttackDamage(); - } - - @Deprecated - default float getMiningSpeedMultiplier() { - return getCompatMiningSpeedMultiplier(); - } - - @Deprecated - default Ingredient getRepairIngredient() { - return getCompatRepairIngredient(); - } - - @Deprecated - default int getDurability() { - return getCompatDurability(); - } - - @Deprecated - default int getEnchantability() { - return getCompatEnchantability(); - } - - default TagKey getRepairTag() { - return ItemTags.IRON_TOOL_MATERIALS; - } - - default ToolMaterial build() { - return new ToolMaterial(getInverseTag(), getCompatDurability(), getCompatMiningSpeedMultiplier(), getCompatAttackDamage(), getCompatEnchantability(), getRepairTag()); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java deleted file mode 100644 index 8d757d099..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v2; - -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -@Deprecated -public interface CompatArmorMaterial extends CompatibleArmorMaterial { - - @Override - default SoundEvent getEquipSound() { - return getEquipCompatSound().get(); - } - - CompatSoundEvent getEquipCompatSound(); - - @Override - default Identifier getId() { - return getCompatId().toMinecraft(); - } - - CompatIdentifier getCompatId(); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java deleted file mode 100644 index aa542b01b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java +++ /dev/null @@ -1,103 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v2; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.consume.UseAction; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Rarity; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.CanRepairArgs; -import net.pitan76.mcpitanlib.api.event.item.EnchantabilityArgs; -import net.pitan76.mcpitanlib.api.event.item.EnchantableArgs; -import net.pitan76.mcpitanlib.api.event.item.InventoryTickEvent; -import net.pitan76.mcpitanlib.api.item.ExtendItem; -import net.pitan76.mcpitanlib.api.item.args.RarityArgs; -import net.pitan76.mcpitanlib.api.item.args.StoppedUsingArgs; -import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; -import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; -import net.pitan76.mcpitanlib.api.util.CompatRarity; -import net.pitan76.mcpitanlib.core.Dummy; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import org.jetbrains.annotations.Nullable; - -public class CompatItem extends ExtendItem { - - public CompatibleItemSettings settings; - - public CompatItem(CompatibleItemSettings settings) { - super(settings); - this.settings = settings; - } - - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - public ItemWrapper getWrapper() { - return ItemWrapper.of(this); - } - - @Deprecated - @Override - public UseAction getUseAction(ItemStack stack) { - return getUseAction(new UseActionArgs(stack)).get(); - } - - public CompatUseAction getUseAction(UseActionArgs args) { - return CompatUseAction.of(super.getUseAction(args.stack)); - } - - @Deprecated - @Override - public Rarity getRarity(ItemStack stack) { - return getRarity(new RarityArgs(stack)).get(); - } - - public CompatRarity getRarity(RarityArgs args) { - return settings.rarity; - } - - @Override - public boolean isEnchantable(EnchantableArgs args) { - return settings.enchantability != -1; - } - - @Override - public int getEnchantability(EnchantabilityArgs args) { - return settings.enchantability; - } - - @Override - public boolean canRepair(CanRepairArgs args) { - RepairIngredientTag tag = settings.repairIngredientTag; - return tag != null && tag.contains(args.stack); - } - - @Override - public boolean hasRecipeRemainder(Dummy dummy) { - return settings.recipeRemainder != null; - } - - @Deprecated - @Override - public boolean onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { - return onStoppedUsing(new StoppedUsingArgs(stack, world, user, remainingUseTicks)); - } - - public boolean onStoppedUsing(StoppedUsingArgs args) { - return super.onStoppedUsing(args.stack, args.world, args.user, args.remainingUseTicks); - } - - @Deprecated - @Override - public void inventoryTick(ItemStack stack, ServerWorld world, Entity entity, @Nullable EquipmentSlot slot) { - inventoryTick(new InventoryTickEvent(stack, world, entity, slot)); - } - - public void inventoryTick(InventoryTickEvent e) { - super.inventoryTick(e.stack, e.getServerWorld(), e.entity, e.equipmentSlot); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java deleted file mode 100644 index 67cb774ea..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v2; - -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.event.item.CanRepairArgs; -import net.pitan76.mcpitanlib.api.event.item.EnchantabilityArgs; -import net.pitan76.mcpitanlib.api.event.item.EnchantableArgs; -import net.pitan76.mcpitanlib.api.event.item.InventoryTickEvent; -import net.pitan76.mcpitanlib.api.item.ExtendItemProvider; -import net.pitan76.mcpitanlib.api.item.args.RarityArgs; -import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; -import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; -import net.pitan76.mcpitanlib.api.util.CompatRarity; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; - -public interface CompatItemProvider extends ExtendItemProvider { - CompatibleItemSettings getCompatSettings(); - - default ItemWrapper getWrapper() { - return this instanceof Item ? ItemWrapper.of((Item) this) : ItemWrapper.of(); - } - - default CompatUseAction getUseAction(UseActionArgs args, Options options) { - options.cancel = false; - return null; - } - - default CompatRarity getRarity(RarityArgs args) { - return getCompatSettings().rarity; - } - - default boolean isEnchantable(EnchantableArgs args) { - return getCompatSettings().enchantability != -1; - } - - default int getEnchantability(EnchantabilityArgs args) { - return getCompatSettings().enchantability; - } - - default boolean canRepair(CanRepairArgs args) { - RepairIngredientTag tag = getCompatSettings().repairIngredientTag; - return tag != null && tag.contains(args.stack); - } - - default void inventoryTick(InventoryTickEvent e, Options options) { - options.cancel = false; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java deleted file mode 100644 index a805e546a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java +++ /dev/null @@ -1,202 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v2; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.minecraft.util.Rarity; -import net.pitan76.mcpitanlib.api.entity.attribute.AttributeModifiersComponentBuilder; -import net.pitan76.mcpitanlib.api.entity.attribute.CompatAttributeModifiersComponent; -import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; -import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; -import net.pitan76.mcpitanlib.api.item.ExtendSettings; -import net.pitan76.mcpitanlib.api.item.equipment.CompatEquippableComponent; -import net.pitan76.mcpitanlib.api.item.equipment.EquippableComponentBuilder; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.CompatRarity; -import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; - -import java.util.function.Supplier; - -@SuppressWarnings("deprecation") -public class CompatibleItemSettings extends net.pitan76.mcpitanlib.api.item.CompatibleItemSettings { - protected CompatIdentifier identifier = null; - public boolean changedTranslationKey = false; - public CompatRarity rarity = CompatRarity.COMMON; - public int enchantability = -1; - public RepairIngredientTag repairIngredientTag = null; - public Item recipeRemainder = null; - - public CompatibleItemSettings(CompatIdentifier identifier) { - super(); - setId(identifier); - } - - public static CompatibleItemSettings of(CompatIdentifier id) { - return new CompatibleItemSettings(id); - } - - @Deprecated - public CompatibleItemSettings setId(CompatIdentifier identifier) { - this.identifier = identifier; - return this; - } - - public CompatibleItemSettings addGroup(ItemGroup itemGroup) { - super.addGroup(itemGroup, identifier); - return this; - } - - public CompatibleItemSettings addGroup(Supplier itemGroup) { - super.addGroup(itemGroup, identifier); - return this; - } - - @Override - public CompatibleItemSettings addGroup(CreativeTabBuilder itemGroup) { - super.addGroup(itemGroup); - return this; - } - - public CompatibleItemSettings addGroup(ItemGroupWrapper itemGroup) { - return addGroup(itemGroup.get()); - } - - @Override - public CompatibleItemSettings maxCount(int maxCount) { - super.maxCount(maxCount); - return this; - } - - @Override - public CompatibleItemSettings maxDamage(int maxDamage) { - super.maxDamage(maxDamage); - return this; - } - - @Override - public CompatibleItemSettings maxDamageIfAbsent(int maxDamage) { - super.maxDamageIfAbsent(maxDamage); - return this; - } - - @Override - public CompatibleItemSettings recipeRemainder(Item recipeRemainder) { - super.recipeRemainder(recipeRemainder); - this.recipeRemainder = recipeRemainder; - return this; - } - - public CompatibleItemSettings recipeRemainder(ItemWrapper recipeRemainder) { - return recipeRemainder(recipeRemainder.get()); - } - - @Deprecated - @Override - public CompatibleItemSettings rarity(Rarity rarity) { - super.rarity(rarity); - this.rarity = CompatRarity.of(rarity); - return this; - } - - public CompatibleItemSettings rarity(CompatRarity rarity) { - super.rarity(rarity.get()); - this.rarity = rarity; - return this; - } - - @Override - public CompatibleItemSettings food(CompatFoodComponent foodComponent) { - super.food(foodComponent); - return this; - } - - public CompatibleItemSettings useItemPrefixedTranslationKey() { - settings.useItemPrefixedTranslationKey(); - changedTranslationKey = true; - return this; - } - - public CompatibleItemSettings useBlockPrefixedTranslationKey() { - settings.useBlockPrefixedTranslationKey(); - changedTranslationKey = true; - return this; - } - - public CompatibleItemSettings translationKey(String translationKey) { - settings.translationKey(translationKey); - changedTranslationKey = true; - return this; - } - - public CompatibleItemSettings enchantable(int enchantability) { - settings.enchantable(enchantability); - this.enchantability = enchantability; - return this; - } - - public CompatibleItemSettings repairable(RepairIngredientTag tag) { - settings.repairable(tag.getTag()); - this.repairIngredientTag = tag; - return this; - } - - public CompatibleItemSettings equipable(CompatEquippableComponent component) { - settings.component(DataComponentTypes.EQUIPPABLE, component.raw()); - return this; - } - - public CompatibleItemSettings equipable(EquippableComponentBuilder builder) { - return equipable(builder.build()); - } - - public CompatibleItemSettings attributeModifiers(CompatAttributeModifiersComponent component) { - settings.component(DataComponentTypes.ATTRIBUTE_MODIFIERS, component.raw()); - return this; - } - - public CompatibleItemSettings attributeModifiers(AttributeModifiersComponentBuilder builder) { - return attributeModifiers(builder.build()); - } - - @Override - public ExtendSettings build() { - super.build(); - - if (identifier != null) { - settings.registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier.toMinecraft())); - } - - return settings; - } - - // Deprecated - - @Deprecated - @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(ItemGroup itemGroup, Identifier identifier) { - return super.addGroup(itemGroup, identifier); - } - - @Deprecated - @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { - return super.addGroup(itemGroup, identifier); - } - - @Deprecated - @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { - return super.addGroup(itemGroup, identifier); - } - - @Deprecated - @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(ItemGroup itemGroup, CompatIdentifier identifier) { - return super.addGroup(itemGroup, identifier); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java deleted file mode 100644 index ef6761f3e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java +++ /dev/null @@ -1,75 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v2; - -import net.minecraft.block.Block; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; -import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; - -import java.util.List; -import java.util.function.Consumer; - -public class ExtendBlockItem extends BlockItem implements CompatItemProvider { - - public CompatibleItemSettings settings; - - @Deprecated - public ExtendBlockItem(Block block, Settings settings) { - super(block, settings); - } - - public ExtendBlockItem(Block block, CompatibleItemSettings settings) { - this(block, settings.build()); - this.settings = settings; - } - - @Override - public CompatibleItemSettings getCompatSettings() { - return settings; - } - - @Deprecated - @Override - public ActionResult useOnBlock(ItemUsageContext context) { - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; - return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); - } - - @Deprecated - @Override - public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event, Options options) { - return CompatItemProvider.super.onRightClickOnBlock(event, options); - } - - public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { - return CompatActionResult.create(super.useOnBlock(event.toIUC())); - } - - @Deprecated - @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { - appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); - } - - @Deprecated - @Override - public void appendTooltip(ItemAppendTooltipEvent event, Options options) { - CompatItemProvider.super.appendTooltip(event, options); - } - - public void appendTooltip(ItemAppendTooltipEvent event) { - super.appendTooltip(event.getStack(), event.getContext(), event.displayComponent, event.textConsumer, event.type); - } - - @Override - public Block getBlock() { - return super.getBlock(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java deleted file mode 100644 index a980204e6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java +++ /dev/null @@ -1,153 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v2; - -import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; -import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; -import net.pitan76.mcpitanlib.api.item.ExtendSettings; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.CompatRarity; -import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; - -public class ItemSettingsBuilder { - - public CompatIdentifier id; - public int maxCount = -1; - public int maxDamage = -1; - public int maxDamageIfAbsent = -1; - public int enchantability = -1; - public RepairIngredientTag repairIngredientTag; - public CompatFoodComponent foodComponent; - public CompatRarity rarity; - public ItemWrapper recipeRemainder; - - public ItemGroupWrapper itemGroupWrapper; - public CreativeTabBuilder itemGroupBuilder; - - public ItemSettingsBuilder(CompatIdentifier id) { - this.id = id; - } - - public ItemSettingsBuilder() { - - } - - public ItemSettingsBuilder addGroup(ItemGroupWrapper itemGroup) { - itemGroupWrapper = itemGroup; - return this; - } - - public ItemSettingsBuilder addGroup(CreativeTabBuilder itemGroup) { - itemGroupBuilder = itemGroup; - return this; - } - - public ItemSettingsBuilder maxCount(int maxCount) { - this.maxCount = maxCount; - return this; - } - - public ItemSettingsBuilder maxDamage(int maxDamage) { - this.maxDamage = maxDamage; - return this; - } - - public ItemSettingsBuilder maxDamageIfAbsent(int maxDamage) { - this.maxDamageIfAbsent = maxDamage; - return this; - } - - public ItemSettingsBuilder recipeRemainder(ItemWrapper recipeRemainder) { - this.recipeRemainder = recipeRemainder; - return this; - } - - public ItemSettingsBuilder enchantability(int enchantability) { - this.enchantability = enchantability; - return this; - } - - public ItemSettingsBuilder repairable(RepairIngredientTag repairIngredientTag) { - this.repairIngredientTag = repairIngredientTag; - return this; - } - - public ItemSettingsBuilder repairable(CompatIdentifier repairIngredientTag) { - this.repairIngredientTag = new RepairIngredientTag(repairIngredientTag); - return this; - } - - public ItemSettingsBuilder foodComponent(CompatFoodComponent foodComponent) { - this.foodComponent = foodComponent; - return this; - } - - public ItemSettingsBuilder rarity(CompatRarity rarity) { - this.rarity = rarity; - return this; - } - - public CompatibleItemSettings build() { - return build(id); - } - - public ExtendSettings _build() { - return build().build(); - } - - public CompatibleItemSettings build(CompatIdentifier id) { - CompatibleItemSettings settings = new CompatibleItemSettings(id); - - if (itemGroupWrapper != null) settings.addGroup(itemGroupWrapper); - if (itemGroupBuilder != null) settings.addGroup(itemGroupBuilder); - - if (maxCount != -1) settings.maxCount(maxCount); - - if (maxDamage != -1) settings.maxDamage(maxDamage); - - if (maxDamageIfAbsent != -1) settings.maxDamageIfAbsent(maxDamageIfAbsent); - - if (rarity != null) settings.rarity(rarity); - if (foodComponent != null) settings.food(foodComponent); - - if (recipeRemainder != null) settings.recipeRemainder(recipeRemainder); - - if (enchantability != -1) settings.enchantable(enchantability); - - if (repairIngredientTag != null) settings.repairable(repairIngredientTag); - - return settings; - } - - public ExtendSettings _build(CompatIdentifier id) { - return build(id).build(); - } - - public ItemSettingsBuilder copy(CompatIdentifier id) { - ItemSettingsBuilder builder = new ItemSettingsBuilder(); - builder.id = id; - builder.maxCount = this.maxCount; - builder.maxDamage = this.maxDamage; - builder.maxDamageIfAbsent = this.maxDamageIfAbsent; - builder.enchantability = this.enchantability; - builder.repairIngredientTag = this.repairIngredientTag; - builder.foodComponent = this.foodComponent; - builder.rarity = this.rarity; - builder.recipeRemainder = this.recipeRemainder; - builder.itemGroupWrapper = this.itemGroupWrapper; - builder.itemGroupBuilder = this.itemGroupBuilder; - return builder; - } - - public ItemSettingsBuilder copy() { - return copy(this.id); - } - - public static ItemSettingsBuilder of(CompatIdentifier id) { - return new ItemSettingsBuilder(id); - } - - public static ItemSettingsBuilder of() { - return new ItemSettingsBuilder(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java deleted file mode 100644 index d545d09cc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v3; - -import net.minecraft.item.Item; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; - -public interface CompatArmorMaterial extends net.pitan76.mcpitanlib.api.item.v2.CompatArmorMaterial { - - @Deprecated - @Override - default TagKey getRepairTag() { - return getRepairIngredientTag().getTag(); - } - - RepairIngredientTag getRepairIngredientTag(); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java deleted file mode 100644 index 004134948..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v3; - -import net.minecraft.item.Item; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; - -public interface CompatToolMaterial extends CompatibleToolMaterial { - @Deprecated - @Override - default TagKey getRepairTag() { - return getRepairIngredientTag().getTag(); - } - - RepairIngredientTag getRepairIngredientTag(); -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java deleted file mode 100644 index 41c63b9ba..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.pitan76.mcpitanlib.api.item.v3; - -import net.minecraft.block.Block; -import net.minecraft.item.ToolMaterial; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; - -public class VanillaCompatToolMaterial implements CompatToolMaterial { - private final ToolMaterial material; - - public static final VanillaCompatToolMaterial WOOD = of(ToolMaterial.WOOD); - public static final VanillaCompatToolMaterial STONE = of(ToolMaterial.STONE); - public static final VanillaCompatToolMaterial IRON = of(ToolMaterial.IRON); - public static final VanillaCompatToolMaterial GOLD = of(ToolMaterial.GOLD); - public static final VanillaCompatToolMaterial DIAMOND = of(ToolMaterial.DIAMOND); - public static final VanillaCompatToolMaterial NETHERITE = of(ToolMaterial.NETHERITE); - - protected VanillaCompatToolMaterial(ToolMaterial material) { - this.material = material; - } - - private static VanillaCompatToolMaterial of(ToolMaterial material) { - return new VanillaCompatToolMaterial(material); - } - - @Override - public RepairIngredientTag getRepairIngredientTag() { - return new RepairIngredientTag(material.repairItems()); - } - - @Override - public int getCompatDurability() { - return material.durability(); - } - - @Override - public float getCompatMiningSpeedMultiplier() { - return material.speed(); - } - - @Override - public float getCompatAttackDamage() { - return material.attackDamageBonus(); - } - - @Override - public int getCompatMiningLevel() { - TagKey tag = material.incorrectBlocksForDrops(); - if (tag == ToolMaterial.WOOD.incorrectBlocksForDrops()) return 0; - if (tag == ToolMaterial.STONE.incorrectBlocksForDrops()) return 1; - if (tag == ToolMaterial.IRON.incorrectBlocksForDrops()) return 2; - if (tag == ToolMaterial.GOLD.incorrectBlocksForDrops()) return 2; - if (tag == ToolMaterial.DIAMOND.incorrectBlocksForDrops()) return 3; - if (tag == ToolMaterial.NETHERITE.incorrectBlocksForDrops()) return 4; - return -1; - } - - @Override - public int getCompatEnchantability() { - return material.enchantmentValue(); - } - - @Deprecated - public ToolMaterial toMinecraft() { - return material; - } - - @Override - public ToolMaterial build() { - return material; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java b/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java deleted file mode 100644 index 34b588f58..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.pitan76.mcpitanlib.api.nbt; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.NbtComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtType; - -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.scanner.NbtScanner; -import net.minecraft.nbt.visitor.NbtElementVisitor; - -import java.io.DataOutput; -import java.io.IOException; - -@Deprecated -public class NbtTag { - public NbtCompound nbt; - - public NbtTag() { - super(); - } - - /** - * Create NbtTag instance - * @return NbtTag instance - */ - public static NbtTag create() { - return new NbtTag(); - } - - /** - * Cast to NbtTag - * @param nbt Nbt Object - * @return NbtTag - */ - public static NbtTag from(Object nbt) { - if (nbt instanceof NbtCompound) { - return (NbtTag) nbt; - } - return (NbtTag) nbt; - } - - /** - * Check item stack nbt - * @param stack Item stack - * @return boolean - */ - public static boolean hasNbt(ItemStack stack) { - return !stack.getComponents().isEmpty(); - } - - /** - * Get nbt from item stack - * @param stack Item stack - * @return NbtTag - */ - public static NbtTag getNbt(ItemStack stack) { - return from(stack.get(DataComponentTypes.CUSTOM_DATA).copyNbt()); - } - - /** - * Set nbt to item stack - * @param stack Item stack - * @param nbt NbtTag - */ - public static void setNbt(ItemStack stack, NbtTag nbt) { - stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt.nbt)); - } - - public boolean contains(String key) { - return nbt.contains(key); - } - - public void write(DataOutput output) throws IOException { - nbt.write(output); - } - - public byte getType() { - return nbt.getType(); - } - - public NbtType getNbtType() { - return nbt.getNbtType(); - } - - public NbtElement copy() { - return nbt.copy(); - } - - public int getSizeInBytes() { - return nbt.getSizeInBytes(); - } - - public void accept(NbtElementVisitor visitor) { - nbt.accept(visitor); - } - - public NbtScanner.Result doAccept(NbtScanner visitor) { - return nbt.doAccept(visitor); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java deleted file mode 100644 index f034b4339..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.pitan76.mcpitanlib.api.nbt; - -import net.minecraft.nbt.NbtElement; - -public class NbtTypeBytes { - public static final byte END = NbtElement.END_TYPE; - public static final byte BYTE = NbtElement.BYTE_TYPE; - public static final byte SHORT = NbtElement.SHORT_TYPE; - public static final byte INT = NbtElement.INT_TYPE; - public static final byte LONG = NbtElement.LONG_TYPE; - public static final byte FLOAT = NbtElement.FLOAT_TYPE; - public static final byte DOUBLE = NbtElement.DOUBLE_TYPE; - public static final byte BYTE_ARRAY = NbtElement.BYTE_ARRAY_TYPE; - public static final byte STRING = NbtElement.STRING_TYPE; - public static final byte LIST = NbtElement.LIST_TYPE; - public static final byte COMPOUND = NbtElement.COMPOUND_TYPE; - public static final byte INT_ARRAY = NbtElement.INT_ARRAY_TYPE; - public static final byte LONG_ARRAY = NbtElement.LONG_ARRAY_TYPE; - public static final byte NUMBER = NbtElement.INT_TYPE; -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java deleted file mode 100644 index fada6c1bf..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.pitan76.mcpitanlib.api.network; - -import dev.architectury.networking.NetworkManager; -import dev.architectury.networking.transformers.PacketTransformer; -import io.netty.buffer.Unpooled; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.packet.CustomPayload; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.core.network.BufPayload; - -import java.util.List; - -import static dev.architectury.impl.NetworkAggregator.*; - -public class ClientNetworking { - public static void send(Identifier identifier, PacketByteBuf buf) { - /* - if (!C2S_TYPE.containsKey(identifier)) { - CustomPayload.Id type = new CustomPayload.Id<>(identifier); - C2S_TYPE.put(identifier, type); - //registerC2SType(type, NetworkAggregator.BufCustomPacketPayload.streamCodec(type), List.of()); - } - */ - - BufPayload payload = new BufPayload(buf, identifier); - NetworkManager.sendToServer(payload); - } - - public static void registerReceiver(Identifier identifier, ClientNetworkHandler handler) { - BufPayload.Id id = BufPayload.id(identifier); - - NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, BufPayload.getCodec(id), - (payload, context) -> { - PacketByteBuf buf = new PacketByteBuf(Unpooled.wrappedBuffer(payload.getData())); - - ClientPlayerEntity player = null; - if (context.getPlayer() instanceof ClientPlayerEntity) - player = (ClientPlayerEntity) context.getPlayer(); - - handler.receive(MinecraftClient.getInstance(), player, buf); - buf.release(); - }); - } - - @FunctionalInterface - public interface ClientNetworkHandler { - void receive(MinecraftClient client, ClientPlayerEntity player, PacketByteBuf buf); - } - - - public static void registerC2SType(CustomPayload.Id type, PacketCodec codec, List packetTransformers) { -// Objects.requireNonNull(type, "Cannot register a null type!"); -// packetTransformers = Objects.requireNonNullElse(packetTransformers, List.of()); -// C2S_CODECS.put(type.id(), (PacketCodec) codec); -// C2S_TRANSFORMERS.put(type.id(), PacketTransformer.concat(packetTransformers)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java deleted file mode 100644 index e1d651760..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java +++ /dev/null @@ -1,259 +0,0 @@ -package net.pitan76.mcpitanlib.api.network; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.NbtSizeTracker; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -import java.util.Map; -import java.util.UUID; -import java.util.function.BiConsumer; -import java.util.function.Function; - -public class PacketByteUtil { - public static PacketByteBuf create() { - return new PacketByteBuf(Unpooled.buffer()); - } - - - public static PacketByteBuf empty() { - return new PacketByteBuf(Unpooled.EMPTY_BUFFER); - } - - public static Map readMap(PacketByteBuf buf, Function keyParser, Function valueParser) { - return buf.readMap(keyParser::apply, valueParser::apply); - } - - public static void writeMap(PacketByteBuf buf, Map map) { - writeMap(buf, map, PacketByteUtil::writeVar, PacketByteUtil::writeVar); - } - - public static void writeMap(PacketByteBuf buf, Map map, BiConsumer keySerializer, BiConsumer valueSerializer) { - buf.writeMap(map, keySerializer::accept, valueSerializer::accept); - } - - public static void writeVar(PacketByteBuf buf, Object obj) { - if (obj instanceof String) { - String s = (String) obj; - buf.writeString(s); - } - if (obj instanceof Integer) { - int i = (int) obj; - buf.writeInt(i); - } - if (obj instanceof Long) { - long l = (long) obj; - buf.writeLong(l); - } - if (obj instanceof Short) { - short s = (short) obj; - buf.writeShort(s); - } - if (obj instanceof Boolean) { - boolean b = (boolean) obj; - buf.writeBoolean(b); - } - if (obj instanceof Byte) { - byte b = (byte) obj; - buf.writeByte(b); - } - if (obj instanceof NbtCompound) { - NbtCompound nbt = (NbtCompound) obj; - buf.writeNbt(nbt); - } - if (obj instanceof ItemStack) { - ItemStack stack = (ItemStack) obj; - buf.encodeAsJson(ItemStack.CODEC, stack); - } - if (obj instanceof Identifier) { - Identifier identifier = (Identifier) obj; - buf.writeIdentifier(identifier); - } - if (obj instanceof Float) { - Float f = (Float) obj; - buf.writeFloat(f); - } - if (obj instanceof UUID) { - UUID uuid = (UUID) obj; - buf.writeUuid(uuid); - } - if (obj instanceof Text) { - Text text = (Text) obj; - buf.writeString(text.getString()); - } - if (obj instanceof BlockPos) { - BlockPos pos = (BlockPos) obj; - buf.writeBlockPos(pos); - } - if (obj instanceof Map) { - Map map = (Map) obj; - writeMap(buf, map); - } - } - - public static PacketByteBuf writeNbt(PacketByteBuf buf, NbtCompound nbt) { - return buf.writeNbt(nbt); - } - - public static NbtCompound readNbt(PacketByteBuf buf) { - return buf.readNbt(); - } - - public static PacketByteBuf writeItemStack(PacketByteBuf buf, ItemStack stack) { - buf.encodeAsJson(ItemStack.CODEC, stack); - return buf; - } - - public static ItemStack readItemStack(PacketByteBuf buf) { - return buf.decodeAsJson(ItemStack.CODEC); - } - - public static PacketByteBuf writeIdentifier(PacketByteBuf buf, Identifier identifier) { - return buf.writeIdentifier(identifier); - } - - public static Identifier readIdentifier(PacketByteBuf buf) { - return buf.readIdentifier(); - } - - public static PacketByteBuf writeText(PacketByteBuf buf, Text text) { - return buf.writeString(text.getString()); - } - - public static Text readText(PacketByteBuf buf) { - return TextUtil.literal(buf.readString()); - } - - public static PacketByteBuf writeBlockPos(PacketByteBuf buf, BlockPos pos) { - return buf.writeBlockPos(pos); - } - - public static BlockPos readBlockPos(PacketByteBuf buf) { - return buf.readBlockPos(); - } - - public static PacketByteBuf writeUuid(PacketByteBuf buf, UUID uuid) { - return buf.writeUuid(uuid); - } - - public static UUID readUuid(PacketByteBuf buf) { - return buf.readUuid(); - } - - public static PacketByteBuf writeVarInt(PacketByteBuf buf, int i) { - return buf.writeVarInt(i); - } - - public static int readVarInt(PacketByteBuf buf) { - return buf.readVarInt(); - } - - public static PacketByteBuf writeVarLong(PacketByteBuf buf, long l) { - return buf.writeVarLong(l); - } - - public static long readVarLong(PacketByteBuf buf) { - return buf.readVarLong(); - } - - public static ByteBuf writeBoolean(PacketByteBuf buf, boolean b) { - return buf.writeBoolean(b); - } - - public static boolean readBoolean(PacketByteBuf buf) { - return buf.readBoolean(); - } - - public static ByteBuf writeByte(PacketByteBuf buf, byte b) { - return buf.writeByte(b); - } - - public static byte readByte(PacketByteBuf buf) { - return buf.readByte(); - } - - public static ByteBuf writeShort(PacketByteBuf buf, short s) { - return buf.writeShort(s); - } - - public static short readShort(PacketByteBuf buf) { - return buf.readShort(); - } - - public static ByteBuf writeInt(PacketByteBuf buf, int i) { - return buf.writeInt(i); - } - - public static int readInt(PacketByteBuf buf) { - return buf.readInt(); - } - - public static ByteBuf writeLong(PacketByteBuf buf, long l) { - return buf.writeLong(l); - } - - public static long readLong(PacketByteBuf buf) { - return buf.readLong(); - } - - public static ByteBuf writeFloat(PacketByteBuf buf, float f) { - return buf.writeFloat(f); - } - - public static float readFloat(PacketByteBuf buf) { - return buf.readFloat(); - } - - public static ByteBuf writeDouble(PacketByteBuf buf, double d) { - return buf.writeDouble(d); - } - - public static double readDouble(PacketByteBuf buf) { - return buf.readDouble(); - } - - public static PacketByteBuf writeByteArray(PacketByteBuf buf, byte[] bytes) { - return buf.writeByteArray(bytes); - } - - public static byte[] readByteArray(PacketByteBuf buf) { - return buf.readByteArray(); - } - - public static PacketByteBuf writeString(PacketByteBuf buf, String s) { - return buf.writeString(s); - } - - public static String readString(PacketByteBuf buf) { - return buf.readString(); - } - - public static PacketByteBuf writeIntArray(PacketByteBuf buf, int[] ints) { - return buf.writeIntArray(ints); - } - - public static int[] readIntArray(PacketByteBuf buf) { - return buf.readIntArray(); - } - - public static PacketByteBuf writeLongArray(PacketByteBuf buf, long[] longs) { - return buf.writeLongArray(longs); - } - - public static long[] readLongArray(PacketByteBuf buf) { - return buf.readLongArray(); - } - - public static NbtElement readUnlimitedNbt(PacketByteBuf buf) { - return buf.readNbt(NbtSizeTracker.ofUnlimitedBytes()); - } -} - - diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java deleted file mode 100644 index b5171eb2d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java +++ /dev/null @@ -1,65 +0,0 @@ -package net.pitan76.mcpitanlib.api.network; - -import dev.architectury.impl.NetworkAggregator; -import dev.architectury.networking.NetworkManager; -import io.netty.buffer.Unpooled; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.core.network.BufPayload; - -import java.util.ArrayList; -import java.util.List; - -public class ServerNetworking { - public static void send(ServerPlayerEntity player, Identifier identifier, PacketByteBuf buf) { - registerS2CPayloadType(identifier); - - BufPayload payload = new BufPayload(buf, identifier); - NetworkManager.sendToPlayer(player, payload); - } - - public static void send(Iterable players, Identifier identifier, PacketByteBuf buf) { - registerS2CPayloadType(identifier); - - BufPayload payload = new BufPayload(buf, identifier); - NetworkManager.sendToPlayers(players, payload); - } - - public static void sendAll(MinecraftServer server, Identifier identifier, PacketByteBuf buf) { - send(server.getPlayerManager().getPlayerList(), identifier, buf); - } - - public static void registerReceiver(Identifier identifier, ServerNetworkHandler handler) { - BufPayload.Id id = BufPayload.id(identifier); - NetworkManager.registerReceiver(NetworkManager.Side.C2S, id, BufPayload.getCodec(id), - (payload, context) -> { - PacketByteBuf buf = new PacketByteBuf(Unpooled.wrappedBuffer(payload.getData())); - - ServerPlayerEntity player = null; - if (context.getPlayer() instanceof ServerPlayerEntity) - player = (ServerPlayerEntity) context.getPlayer(); - - handler.receive(context.getPlayer().getEntityWorld().getServer(), player, buf); - buf.release(); - }); - } - - private static final List registeredList = new ArrayList<>(); - - public static void registerS2CPayloadType(Identifier identifier) { - if (registeredList.contains(identifier)) return; - registeredList.add(identifier); - - if (NetworkAggregator.S2C_CODECS.containsKey(identifier)) return; - - BufPayload.Id id = BufPayload.id(identifier); - NetworkManager.registerS2CPayloadType(id, BufPayload.getCodec(id)); - } - - @FunctionalInterface - public interface ServerNetworkHandler { - void receive(MinecraftServer server, ServerPlayerEntity player, PacketByteBuf buf); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java deleted file mode 100644 index 67fef00ce..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.pitan76.mcpitanlib.api.network.v2; - -import net.minecraft.network.PacketByteBuf; -import net.pitan76.mcpitanlib.api.network.PacketByteUtil; -import net.pitan76.mcpitanlib.api.network.v2.args.ClientReceiveEvent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; - -import java.util.function.Consumer; - -public class ClientNetworking { - public static void send(CompatIdentifier id, PacketByteBuf buf) { - net.pitan76.mcpitanlib.api.network.ClientNetworking.send(id.toMinecraft(), buf); - } - - public static void registerReceiver(CompatIdentifier id, Consumer consumer) { - net.pitan76.mcpitanlib.api.network.ClientNetworking.registerReceiver(id.toMinecraft(), (client, player, buf) -> { - consumer.accept(new ClientReceiveEvent(client, player, buf)); - }); - } - - public static void send(CompatIdentifier id, CompatPacketByteBuf buf) { - send(id, buf.getRaw()); - } - - public static void send(CompatIdentifier id) { - send(id, PacketByteUtil.create()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java deleted file mode 100644 index f5356c9d0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java +++ /dev/null @@ -1,97 +0,0 @@ -package net.pitan76.mcpitanlib.api.network.v2; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.network.PacketByteUtil; -import net.pitan76.mcpitanlib.api.network.v2.args.ServerReceiveEvent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.function.Consumer; - -public class ServerNetworking { - public static void send(ServerPlayerEntity serverPlayerEntity, CompatIdentifier id, PacketByteBuf buf) { - net.pitan76.mcpitanlib.api.network.ServerNetworking.send(serverPlayerEntity, id.toMinecraft(), buf); - } - - public static void sendByServerPlayerEntity(Iterable players, CompatIdentifier id, PacketByteBuf buf) { - net.pitan76.mcpitanlib.api.network.ServerNetworking.send(players, id.toMinecraft(), buf); - } - - public static void send(Player player, CompatIdentifier id, PacketByteBuf buf) { - Optional optional = player.getServerPlayer(); - if (optional.isEmpty()) return; - - send(optional.get(), id, buf); - } - - public static void send(Iterable players, CompatIdentifier id, PacketByteBuf buf) { - List list = new ArrayList<>(); - for (Player player : players) { - Optional optional = player.getServerPlayer(); - optional.ifPresent(list::add); - } - - sendByServerPlayerEntity(list, id, buf); - } - - public static void sendAll(MinecraftServer server, CompatIdentifier id, PacketByteBuf buf) { - net.pitan76.mcpitanlib.api.network.ServerNetworking.sendAll(server, id.toMinecraft(), buf); - } - - public static void sendAll(World world, CompatIdentifier id, PacketByteBuf buf) { - sendAll(world.getServer(), id, buf); - } - - public static void registerReceiver(CompatIdentifier id, Consumer consumer) { - net.pitan76.mcpitanlib.api.network.ServerNetworking.registerReceiver(id.toMinecraft(), (server, player, buf) -> { - consumer.accept(new ServerReceiveEvent(server, player, buf)); - }); - } - - public static void send(ServerPlayerEntity serverPlayerEntity, CompatIdentifier id, CompatPacketByteBuf buf) { - send(serverPlayerEntity, id, buf.getRaw()); - } - - public static void send(Player player, CompatIdentifier id, CompatPacketByteBuf buf) { - send(player, id, buf.getRaw()); - } - - public static void send(Iterable players, CompatIdentifier id, CompatPacketByteBuf buf) { - send(players, id, buf.getRaw()); - } - - public static void sendAll(MinecraftServer server, CompatIdentifier id, CompatPacketByteBuf buf) { - sendAll(server, id, buf.getRaw()); - } - - public static void sendAll(World world, CompatIdentifier id, CompatPacketByteBuf buf) { - sendAll(world.getServer(), id, buf.getRaw()); - } - - public static void send(ServerPlayerEntity serverPlayerEntity, CompatIdentifier id) { - send(serverPlayerEntity, id, PacketByteUtil.create()); - } - - public static void send(Player player, CompatIdentifier id) { - send(player, id, PacketByteUtil.create()); - } - - public static void send(Iterable players, CompatIdentifier id) { - send(players, id, PacketByteUtil.create()); - } - - public static void sendAll(MinecraftServer server, CompatIdentifier id) { - sendAll(server, id, PacketByteUtil.create()); - } - - public static void sendAll(World world, CompatIdentifier id) { - sendAll(world.getServer(), id, PacketByteUtil.create()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java deleted file mode 100644 index 568c74d07..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.network.v2.args; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; - -public class ClientReceiveEvent { - public MinecraftClient client; - public ClientPlayerEntity clientPlayer; - public Player player; - public PacketByteBuf buf; - - public ClientReceiveEvent(MinecraftClient client, ClientPlayerEntity player, PacketByteBuf buf) { - this.client = client; - this.clientPlayer = player; - this.player = new Player(player); - this.buf = buf; - } - - public ClientPlayerEntity getClientPlayer() { - return clientPlayer; - } - - public Player getPlayer() { - return player; - } - - public MinecraftClient getClient() { - return client; - } - - public PacketByteBuf getBuf() { - return buf; - } - - public CompatPacketByteBuf getCompatBuf() { - return CompatPacketByteBuf.of(buf); - } - - public World getWorld() { - return getPlayer().getWorld(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java deleted file mode 100644 index 3fbe2834e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.pitan76.mcpitanlib.api.network.v2.args; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; -import net.pitan76.mcpitanlib.midohra.server.MCServer; - -public class ServerReceiveEvent { - public MinecraftServer server; - public ServerPlayerEntity serverPlayer; - public Player player; - public PacketByteBuf buf; - - public ServerReceiveEvent(MinecraftServer server, ServerPlayerEntity player, PacketByteBuf buf) { - this.server = server; - this.serverPlayer = player; - this.player = new Player(player); - this.buf = buf; - } - - public ServerPlayerEntity getServerPlayer() { - return serverPlayer; - } - - public Player getPlayer() { - return player; - } - - public MinecraftServer getServer() { - return server; - } - - public PacketByteBuf getBuf() { - return buf; - } - - public World getWorld() { - return getPlayer().getWorld(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); - } - - public MCServer getMidohraServer() { - return MCServer.of(server); - } - - public CompatPacketByteBuf getCompatBuf() { - return CompatPacketByteBuf.of(buf); - } - - public void execute(Runnable runnable) { - server.execute(runnable); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java deleted file mode 100644 index 1bb470b52..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.pitan76.mcpitanlib.api.offlineplayer; - -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.midohra.server.PlayerManager; - -import java.util.Optional; -import java.util.UUID; - -public class OfflinePlayer { - public String uuid; - public String name; - - public OfflinePlayer(String uuid, String name) { - this.uuid = uuid; - this.name = name; - } - - public String getUUIDasString() { - return uuid; - } - - public String getName() { - return name; - } - - public UUID getUUID() { - return UUID.fromString(uuid); - } - - public Optional getOnlinePlayer(PlayerManager playerManager) { - return OfflinePlayerManager.getOnlinePlayer(this, playerManager); - } - - public boolean isOnline(PlayerManager playerManager) { - return playerManager.hasPlayerByUUID(getUUID()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java b/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java deleted file mode 100644 index 7eecbaf2c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java +++ /dev/null @@ -1,229 +0,0 @@ -package net.pitan76.mcpitanlib.api.offlineplayer; - -import net.pitan76.easyapi.FileControl; -import net.pitan76.easyapi.config.JsonConfig; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.util.PlatformUtil; -import net.pitan76.mcpitanlib.midohra.server.PlayerManager; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -public class OfflinePlayerManager { - public static OfflinePlayerManager INSTANCE = new OfflinePlayerManager(); - public static final File DEFAULT_FILE = new File(PlatformUtil.getConfigFolderAsFile(), "mcpitanlib/offlineplayer.json"); - - private final List offlinePlayers = new ArrayList<>(); - - protected OfflinePlayerManager() { - if (INSTANCE == null) - INSTANCE = this; - load(); - } - - public File getFile() { - return DEFAULT_FILE; - } - - public void load() { - if (FileControl.fileExists(getFile())) { - JsonConfig config = new JsonConfig(getFile()); - config.configMap.forEach((key, value) -> offlinePlayers.add(new OfflinePlayer(key, (String) value))); - } - } - - public void save() { - if (!FileControl.fileExists(getFile().getParentFile())) { - getFile().getParentFile().mkdirs(); - } - JsonConfig config = new JsonConfig(); - offlinePlayers.forEach(offlinePlayer -> config.set(offlinePlayer.uuid, offlinePlayer.name)); - config.save(getFile(), true); - } - - public OfflinePlayer getPlayer(String uuid) { - for (OfflinePlayer offlinePlayer : offlinePlayers) { - if (offlinePlayer.uuid.equals(uuid)) { - return offlinePlayer; - } - } - return null; - } - - public OfflinePlayer getPlayerByName(String name) { - for (OfflinePlayer offlinePlayer : offlinePlayers) { - if (offlinePlayer.name.equals(name)) { - return offlinePlayer; - } - } - return null; - } - - public void addPlayer(OfflinePlayer offlinePlayer) { - offlinePlayers.add(offlinePlayer); - } - - public void removePlayer(OfflinePlayer offlinePlayer) { - offlinePlayers.remove(offlinePlayer); - } - - public void addPlayer(String uuid, String name) { - if (containsPlayerByUUID(uuid)) - return; - addPlayer(new OfflinePlayer(uuid, name)); - } - - public void removePlayer(String uuid) { - removePlayer(getPlayer(uuid)); - } - - public boolean containsPlayerByUUID(String uuid) { - return getPlayer(uuid) != null; - } - - public boolean containsPlayerByName(String name) { - return getPlayerByName(name) != null; - } - - public boolean containsPlayer(OfflinePlayer offlinePlayer) { - return offlinePlayers.contains(offlinePlayer); - } - - public boolean containsPlayer(UUID uuid) { - return containsPlayerByUUID(uuid.toString()); - } - - public static Optional getOnlinePlayer(UUID uuid, PlayerManager playerManager) { - if (playerManager.hasPlayerByUUID(uuid)) - return Optional.of(playerManager.getPlayerByUUID(uuid)); - - return Optional.empty(); - } - - public static Optional getOnlinePlayerByName(String name, PlayerManager playerManager) { - if (playerManager.hasPlayerByName(name)) - return Optional.of(playerManager.getPlayerByName(name)); - - return Optional.empty(); - } - - public static Optional getOnlinePlayerByUUID(String uuid, PlayerManager playerManager) { - return getOnlinePlayer(UUID.fromString(uuid), playerManager); - } - - public static Optional getOnlinePlayer(OfflinePlayer offlinePlayer, PlayerManager playerManager) { - return getOnlinePlayer(UUID.fromString(offlinePlayer.uuid), playerManager); - } - - public UUID getUUID(String name) { - return UUID.fromString(getUUIDasString(name)); - } - - public String getName(UUID uuid) { - for (OfflinePlayer offlinePlayer : offlinePlayers) { - if (offlinePlayer.uuid.equals(uuid.toString())) { - return offlinePlayer.name; - } - } - return null; - } - - public String getUUIDasString(String name) { - for (OfflinePlayer offlinePlayer : offlinePlayers) { - if (offlinePlayer.name.equals(name)) { - return offlinePlayer.uuid; - } - } - return null; - } - - public List getOfflinePlayers() { - return offlinePlayers; - } - - public void clear() { - offlinePlayers.clear(); - } - - public void reload() { - clear(); - load(); - } - - public void saveAndReload() { - save(); - reload(); - } - - public void saveAndReloadAsync() { - new Thread(() -> { - save(); - reload(); - }).start(); - } - - public void saveAsync() { - new Thread(this::save).start(); - } - - public void reloadAsync() { - new Thread(this::reload).start(); - } - - public void clearAsync() { - new Thread(this::clear).start(); - } - - public void saveAndReloadAsync(Runnable runnable) { - new Thread(() -> { - save(); - reload(); - runnable.run(); - }).start(); - } - - public void saveAsync(Runnable runnable) { - new Thread(() -> { - save(); - runnable.run(); - }).start(); - } - - public void reloadAsync(Runnable runnable) { - new Thread(() -> { - reload(); - runnable.run(); - }).start(); - } - - public void clearAsync(Runnable runnable) { - new Thread(() -> { - clear(); - runnable.run(); - }).start(); - } - - public void saveAndReload(Runnable runnable) { - save(); - reload(); - runnable.run(); - } - - public void save(Runnable runnable) { - save(); - runnable.run(); - } - - public void reload(Runnable runnable) { - reload(); - runnable.run(); - } - - public void clear(Runnable runnable) { - clear(); - runnable.run(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java deleted file mode 100644 index 2690dae1c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.packet; - -public class UpdatePacketType { - public static final UpdatePacketType NONE = new UpdatePacketType("NONE"); - public static final UpdatePacketType BLOCK_ENTITY_UPDATE_S2C = new UpdatePacketType("BLOCK_ENTITY_UPDATE_S2C"); - - public final String name; - - public UpdatePacketType(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public UpdatePacketType fromName(String name) { - switch (name) { - case "NONE": - return NONE; - case "BLOCK_ENTITY_UPDATE_S2C": - return BLOCK_ENTITY_UPDATE_S2C; - } - return null; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java deleted file mode 100644 index a68005e01..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.api.recipe; - -import net.minecraft.recipe.*; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -@Deprecated -public class CompatRecipeType> { - public static final CompatRecipeType CRAFTING = new CompatRecipeType<>(RecipeType.CRAFTING); - public static final CompatRecipeType SMELTING = new CompatRecipeType<>(RecipeType.SMELTING); - public static final CompatRecipeType BLASTING = new CompatRecipeType<>(RecipeType.BLASTING); - public static final CompatRecipeType SMOKING = new CompatRecipeType<>(RecipeType.SMOKING); - public static final CompatRecipeType CAMPFIRE_COOKING = new CompatRecipeType<>(RecipeType.CAMPFIRE_COOKING); - public static final CompatRecipeType STONECUTTING = new CompatRecipeType<>(RecipeType.STONECUTTING); - public static final CompatRecipeType SMITHING = new CompatRecipeType<>(RecipeType.SMITHING); - - private final RecipeType type; - - public CompatRecipeType(String id) { - this(RecipeType.register(id)); - } - - public CompatRecipeType(RecipeType type) { - this.type = type; - } - - public RecipeType getType() { - return type; - } - - public CompatIdentifier getName() { - Identifier id = Registries.RECIPE_TYPE.getId(type); - if (id == null) return CompatIdentifier.empty(); - - return CompatIdentifier.fromMinecraft(id); - } - - public static CompatRecipeType of(CompatIdentifier id) { - RecipeType type = Registries.RECIPE_TYPE.get(id.toMinecraft()); - if (type == null) return null; - - return new CompatRecipeType<>(type); - } - - public static > CompatRecipeType of(CompatIdentifier id, Class clazz) { - return (CompatRecipeType) of(id); - } - - public static > CompatRecipeType of(RecipeType type) { - return new CompatRecipeType<>(type); - } - - public net.pitan76.mcpitanlib.midohra.recipe.RecipeType toMidohra() { - return net.pitan76.mcpitanlib.midohra.recipe.RecipeType.of(type); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java deleted file mode 100644 index 38c4b3700..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.pitan76.mcpitanlib.api.recipe; - -import net.minecraft.recipe.*; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.RecipeUtil; -import org.jetbrains.annotations.Nullable; - -@Deprecated -public class CompatibleRecipeEntry { - private final RecipeEntry entry; - - public String group = ""; - public RecipeUtil.CompatibilityCraftingRecipeCategory category = null; - - @Deprecated - public CompatibleRecipeEntry(RecipeEntry entry) { - this.entry = entry; - } - - public CompatibleRecipeEntry(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ShapelessRecipe shapelessRecipe) { - this.entry = new RecipeEntry<>(RegistryKey.of(RegistryKeys.RECIPE, id), shapelessRecipe); - this.group = group; - this.category = category; - } - - public CompatibleRecipeEntry(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ShapelessRecipe shapelessRecipe) { - this(id.toMinecraft(), group, category, shapelessRecipe); - } - - @Deprecated - public RecipeEntry getRecipeEntry() { - return entry; - } - - public Recipe getRecipe() { - Object object = entry.value(); - if (object instanceof Recipe) { - return (Recipe) object; - } - return null; - } - - public Identifier getId() { - return entry.id().getValue(); - } - - public CompatIdentifier getCompatId() { - return CompatIdentifier.fromMinecraft(getId()); - } - - public RecipeType getType() { - Recipe recipe = getRecipe(); - if (recipe == null) return null; - - return recipe.getType(); - } - - public RecipeSerializer getSerializer() { - Recipe recipe = getRecipe(); - if (recipe == null) return null; - - return recipe.getSerializer(); - } - - @Nullable - public RecipeUtil.CompatibilityCraftingRecipeCategory getCategory() { - return category; - } - - public String getGroup() { - return group; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java deleted file mode 100644 index e0ec74ef3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.api.recipe; - -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.input.RecipeInput; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; -import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; - -import java.util.Optional; - -@Deprecated -public interface MatchGetter> { - Optional> getFirstMatch(CompatRecipeInput input, World world); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java deleted file mode 100644 index 5f97fc400..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.api.recipe.input; - -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.input.RecipeInput; - -public class CompatRecipeInput { - protected I input; - - public CompatRecipeInput(I input) { - this.input = input; - } - - public I getInput() { - return input; - } - - public ItemStack getStack(int slot) { - return input.getStackInSlot(slot); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack(int slot) { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(slot)); - } - - public int getSize() { - return input.size(); - } - - public boolean isEmpty() { - return input.isEmpty(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java deleted file mode 100644 index 11b490d3d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.pitan76.mcpitanlib.api.recipe.v2; - -import net.minecraft.recipe.*; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.RecipeUtil; -import org.jetbrains.annotations.Nullable; - -@Deprecated -public class CompatRecipeEntry> { - private final RecipeEntry entry; - - public String group = ""; - public RecipeUtil.CompatibilityCraftingRecipeCategory category = null; - - @Deprecated - public CompatRecipeEntry(RecipeEntry entry) { - this.entry = entry; - } - - public CompatRecipeEntry(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, T recipe) { - this.entry = new RecipeEntry<>(RegistryKey.of(RegistryKeys.RECIPE, id), recipe); - this.group = group; - this.category = category; - } - - public CompatRecipeEntry(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, T recipe) { - this(id.toMinecraft(), group, category, recipe); - } - - public boolean isNull() { - return entry == null; - } - - @Deprecated - public RecipeEntry getRecipeEntry() { - return entry; - } - - public T getRecipe() { - return entry.value(); - } - - public Identifier getId() { - return entry.id().getValue(); - } - - public CompatIdentifier getCompatId() { - return CompatIdentifier.fromMinecraft(getId()); - } - - public RecipeType getType() { - T recipe = getRecipe(); - if (recipe == null) return null; - - return recipe.getType(); - } - - public RecipeSerializer getSerializer() { - Recipe recipe = getRecipe(); - if (recipe == null) return null; - - return recipe.getSerializer(); - } - - @Nullable - public RecipeUtil.CompatibilityCraftingRecipeCategory getCategory() { - return category; - } - - public String getGroup() { - return group; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java deleted file mode 100644 index 09b62e257..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.recipe.v2; - -import net.minecraft.recipe.Recipe; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.RecipeUtil; - -@Deprecated -public class CompatRecipeNonEntry> extends CompatRecipeEntry { - public CompatRecipeNonEntry(T recipe) { - super(CompatIdentifier.EMPTY, "", RecipeUtil.CompatibilityCraftingRecipeCategory.MISC, recipe); - } - - public static CompatRecipeNonEntry create(Recipe recipe) { - return new CompatRecipeNonEntry<>(recipe); - } - - @Override - public T getRecipe() { - return super.getRecipe(); - } - - public Recipe getRawRecipe() { - return super.getRecipe(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java deleted file mode 100644 index a42bb92c2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.pitan76.mcpitanlib.api.recipe.v3; - -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeType; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; -import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.RecipeUtil; -import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; - -public class CompatRecipe { - public Recipe recipe; - public Identifier id; - - public CompatRecipe(Recipe recipe, Identifier id) { - this.recipe = recipe; - this.id = id; - } - - @Deprecated - public CompatRecipe(net.minecraft.recipe.RecipeEntry entry) { - this(entry.value(), entry.id().getValue()); - } - - @Deprecated - public CompatRecipe(Recipe recipe) { - this.recipe = recipe; - this.id = RecipeUtil.getId(recipe); - } - - public boolean isNull() { - return recipe == null; - } - - public Recipe getRecipe() { - return recipe; - } - - public Identifier getId() { - return id; - } - - public CompatIdentifier getCompatId() { - return CompatIdentifier.fromMinecraft(getId()); - } - - public RecipeType getType() { - Recipe recipe = getRecipe(); - if (recipe == null) return null; - - return recipe.getType(); - } - - @Deprecated - public CompatRecipeEntry getRecipeEntry() { - return new CompatRecipeEntry<>(getId(), "", null, getRecipe()); - } - - @Deprecated - public CompatibleRecipeEntry getCompatibleRecipeEntry() { - return new CompatibleRecipeEntry(new net.minecraft.recipe.RecipeEntry>(RegistryKey.of(RegistryKeys.RECIPE, getId()), getRecipe())); - } - - // MidohraAPI - public net.pitan76.mcpitanlib.midohra.recipe.Recipe getMidohraRecipe() { - if (getMidohraType() == net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING) { - return net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) getRecipe()); - } - - return net.pitan76.mcpitanlib.midohra.recipe.Recipe.of(getRecipe()); - } - - public net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry getMidohraRecipeEntry() { - if (getMidohraType() == net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING) { - return net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry.of((net.minecraft.recipe.CraftingRecipe) getRecipe(), getCompatId()); - } - - return RecipeEntry.of(getRecipe(), getCompatId()); - } - - public net.pitan76.mcpitanlib.midohra.recipe.RecipeType getMidohraType() { - return net.pitan76.mcpitanlib.midohra.recipe.RecipeType.of(getType()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java deleted file mode 100644 index 2bb439e04..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java +++ /dev/null @@ -1,191 +0,0 @@ -package net.pitan76.mcpitanlib.api.registry; - -import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.component.ComponentType; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemGroup; -import net.minecraft.particle.ParticleType; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.MCPitanLib; -import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; -import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; -import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; -import net.pitan76.mcpitanlib.api.item.CreativeTabManager; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.block.BlockUtil; -import net.pitan76.mcpitanlib.api.util.item.ItemUtil; -import net.pitan76.mcpitanlib.core.registry.FuelRegistry; -import net.pitan76.mcpitanlib.core.registry.MCPLRegistry; -import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; -import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_21; - -import java.util.function.Supplier; - -public class CompatRegistry { - - protected final MCPLRegistry mcplr; - protected final MCPLRegistry1_20 mcplr1_20; - protected final MCPLRegistry1_21 mcplr1_21; - protected final WorldGenRegistry worldGenRegistry; - - protected String MOD_ID; - - /** - * @deprecated Use {@link #createRegistry(String)} instead - */ - @Deprecated - public CompatRegistry(String MOD_ID) { - mcplr = new MCPLRegistry(MOD_ID); - mcplr1_20 = new MCPLRegistry1_20(mcplr, MOD_ID); - mcplr1_21 = new MCPLRegistry1_21(mcplr, MOD_ID); - worldGenRegistry = new WorldGenRegistry(MOD_ID); - this.MOD_ID = MOD_ID; - } - - /** - * create(new CompatRegistry)'s alias - * @see #create(String) - */ - public static CompatRegistry createRegistry(String MOD_ID) { - return new CompatRegistry(MOD_ID); - } - - /** - * Create a new CompatRegistry - * @param MOD_ID The mod id - * @return The new CompatRegistry - */ - public static CompatRegistry create(String MOD_ID) { - return createRegistry(MOD_ID); - } - - /** - * Register an item - * @param id The item id - * @param supplier The item supplier - * @return The registry result - */ - public RegistryResult registerItem(Identifier id, Supplier supplier) { - if (MCPitanLib.isItemBlackListed(id)) supplier = () -> ItemUtil.create(CompatibleItemSettings.of(CompatIdentifier.fromMinecraft(id))); - RegistrySupplier registrySupplier = mcplr.registryItem(id, supplier); - CreativeTabManager.register(id); - return new RegistryResult<>(registrySupplier); - } - - public RegistryResult registerBlock(Identifier id, Supplier supplier) { - if (MCPitanLib.isBlockBlackListed(id)) supplier = () -> BlockUtil.create(CompatibleBlockSettings.of(CompatibleMaterial.STONE)); - return new RegistryResult<>(mcplr.registryBlock(id, supplier)); - } - - public RegistryResult> registerScreenHandlerType(Identifier id, Supplier> supplier) { - return new RegistryResult<>(mcplr.registryScreenHandlerType(id, supplier)); - } - - @Deprecated - public RegistryResult> registerExtendedScreenHandlerType(Identifier id, Supplier> supplier) { - return registerScreenHandlerType(id, () -> supplier.get().build()); - } - - public RegistryResult> registerMenu(Identifier id, Supplier> supplier) { - return registerScreenHandlerType(id, supplier); - } - - public RegistryResult> registerBlockEntityType(Identifier id, Supplier> supplier) { - return new RegistryResult<>(mcplr.registryBlockEntityType(id, supplier)); - } - - public RegistryResult> registerEntity(Identifier id, Supplier> supplier) { - return new RegistryResult<>(mcplr.registryEntityType(id, supplier)); - } - - @Deprecated - public RegistryResult registerSoundEvent(Identifier id, Supplier supplier) { - return new RegistryResult<>(mcplr.registrySoundEvent(id, supplier)); - } - - public RegistryResult registerSoundEvent(Identifier id) { - return registerSoundEvent(id, () -> SoundEvent.of(id)); - } - - public RegistryResult registerSoundEvent(Identifier id, float distanceToTravel) { - return registerSoundEvent(id, () -> SoundEvent.of(id, distanceToTravel)); - } - - public RegistryResult registerFluid(Identifier id, Supplier supplier) { - return new RegistryResult<>(mcplr.registryFluid(id, supplier)); - } - - public RegistryResult> registerParticleType(Identifier id, Supplier> supplier) { - return new RegistryResult<>(mcplr.registryParticleType(id, supplier)); - } - - public RegistryResult registerEnchantment(Identifier id, Supplier supplier) { - return new RegistryResult<>(mcplr.registryEnchantment(id, supplier)); - } - - public RegistryResult registerStatusEffect(Identifier id, Supplier supplier) { - return new RegistryResult<>(mcplr.registryStatusEffect(id, supplier)); - } - - public RegistryResult registerItemGroup(Identifier id, Supplier supplier) { - return new RegistryResult<>(mcplr1_20.registryItemGroup(id, supplier)); - } - - public RegistryResult registerItemGroup(Identifier id, CreativeTabBuilder builder) { - return new RegistryResult<>(mcplr1_20.registryItemGroup(id, builder)); - } - - public RegistryResult registerItemGroup(CreativeTabBuilder builder) { - return registerItemGroup(builder.getIdentifier(), builder); - } - - public RegistryResult> registerDataComponentType(Identifier id, Supplier> supplier) { - return new RegistryResult<>(mcplr1_21.registryDataComponentType(id, supplier)); - } - - public static void registerFuel(int time, ItemConvertible... item) { - FuelRegistry.register(time, item); - } - - public void allRegister() { - // 1.16 Register - mcplr.allRegister1_16(); - - mcplr1_20.register(); - mcplr1_21.register(); - - // ItemGroup - CreativeTabManager.allRegister(); - } - - @Deprecated - public MCPLRegistry getMcplr() { - return mcplr; - } - - @Deprecated - public MCPLRegistry1_20 getMcplr1_20() { - return mcplr1_20; - } - - @Deprecated - public MCPLRegistry1_21 getMcplr1_21() { - return mcplr1_21; - } - - public String getNamespace() { - return MOD_ID; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java deleted file mode 100644 index 1a3afc996..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.pitan76.mcpitanlib.api.registry; - -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryWrapper; -import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; - -public class CompatRegistryLookup { - - private final RegistryWrapper.WrapperLookup registryLookup; - - @Deprecated - public CompatRegistryLookup(RegistryWrapper.WrapperLookup registryLookup) { - this.registryLookup = registryLookup; - } - - public CompatRegistryLookup() { - this.registryLookup = BuiltinRegistries.createWrapperLookup(); - } - - @Deprecated - public RegistryWrapper.WrapperLookup getRegistryLookup() { - if (registryLookup == null) - return BuiltinRegistries.createWrapperLookup(); - - return registryLookup; - } - - public NbtRWArgs getNbtRWArgs(NbtCompound nbt) { - return new NbtRWArgs(nbt, registryLookup); - } - - public WriteNbtArgs createWriteNbtArgs(NbtCompound nbt) { - return new WriteNbtArgs(nbt, registryLookup); - } - - public ReadNbtArgs createReadNbtArgs(NbtCompound nbt) { - return new ReadNbtArgs(nbt, registryLookup); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java deleted file mode 100644 index f5dc51bb4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.api.registry; - -import net.minecraft.item.ItemConvertible; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; - -public class FuelRegistry { - - private static final Map, Integer>> FUEL_MAP = new HashMap<>(); - - public static void register(Supplier itemSupplier, int time, String namespace) { - Map, Integer> map = new HashMap<>(); - map.put(itemSupplier, time); - - FUEL_MAP.put(namespace, map); - } - - @Deprecated - public static void allRegister(String namespace) { - if (!FUEL_MAP.containsKey(namespace)) return; - - Map, Integer> map = FUEL_MAP.get(namespace); - for (Map.Entry, Integer> entry : map.entrySet()) { - net.pitan76.mcpitanlib.core.registry.FuelRegistry.register(entry.getValue(), entry.getKey().get()); - } - - FUEL_MAP.remove(namespace); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java deleted file mode 100644 index 4a4071011..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java +++ /dev/null @@ -1,107 +0,0 @@ -package net.pitan76.mcpitanlib.api.registry; - -import dev.architectury.registry.level.biome.BiomeModifications; -import dev.architectury.registry.registries.DeferredRegister; -import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.minecraft.world.gen.GenerationStep; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.PlacedFeature; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; - -import java.util.function.Supplier; - -public class WorldGenRegistry { - protected String MOD_ID; - - protected DeferredRegister> CONFIGURED_FEATURE; - protected DeferredRegister PLACED_FEATURE; - - @Deprecated - public WorldGenRegistry(String MOD_ID) { - this.MOD_ID = MOD_ID; - CONFIGURED_FEATURE = DeferredRegister.create(MOD_ID, RegistryKeys.CONFIGURED_FEATURE); - PLACED_FEATURE = DeferredRegister.create(MOD_ID, RegistryKeys.PLACED_FEATURE); - } - - /** - * Create a new CompatRegistry - * @param MOD_ID The mod id - * @return The new CompatRegistry - */ - public static WorldGenRegistry createRegistry(String MOD_ID) { - return new WorldGenRegistry(MOD_ID); - } - - public static WorldGenRegistry createRegistry(CompatRegistry registry) { - return registry.worldGenRegistry; - } - - /** - * Register a configured feature - * @param id The id of the configured feature - * @param supplier The supplier of the configured feature - * @return The result of the registration - */ - public RegistryResult> registerFeature(Identifier id, Supplier> supplier) { - RegistrySupplier> feature = CONFIGURED_FEATURE.register(id, supplier); - return new RegistryResult<>(feature); - } - - /** - * Register a placed feature - * @param id The id of the placed feature - * @param supplier The supplier of the placed feature - * @return The result of the registration - */ - public RegistryResult registerPlacedFeature(Identifier id, Supplier supplier) { - RegistrySupplier feature = PLACED_FEATURE.register(id, supplier); - return new RegistryResult<>(feature); - } - - /** - * Replace the properties of a biome - * @param decoration The decoration step - * @param feature The feature to replace - */ - public static void replaceProperties(GenerationStep.Feature decoration, RegistrySupplier feature) { - BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); - } - - public static void replaceProperties(GenerationStep.Feature decoration, RegistryResult feature) { - replaceProperties(decoration, feature.supplier); - } - - /** - * Replace the properties of a biome - * @param decoration The decoration step - * @param feature The feature to replace - */ - public static void replaceProperties(GenerationStep.Feature decoration, PlacedFeature feature) { - BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, RegistryEntry.of(feature))); - } - - /** - * Add a feature to the biome properties - * @param decoration The decoration step - * @param feature The feature to add - */ - public static void addProperties(GenerationStep.Feature decoration, RegistrySupplier feature) { - BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); - } - - public static void addProperties(GenerationStep.Feature decoration, RegistryResult feature) { - addProperties(decoration, feature.supplier); - } - - /** - * Add a feature to the biome properties - * @param decoration The decoration step - * @param feature The feature to add - */ - public static void addProperties(GenerationStep.Feature decoration, PlacedFeature feature) { - BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, RegistryEntry.of(feature))); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java deleted file mode 100644 index 3bcf95488..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.api.registry.result; - -import dev.architectury.registry.registries.RegistrySupplier; -import org.jetbrains.annotations.Nullable; - -/** - * The result of a registry - * @param The type of the registry - * - *
{@code
- * RegistryResult ITEM = registry.registerItem(IdentifierUtil.id("mcpitanlib", "example"), ExampleItem::new);
- * ITEM.getOrNull(); => The item (Item.class) or null
- * ITEM.get(); => The item (Item.class)
- * }
- */ -public class RegistryResult { - public RegistrySupplier supplier; - - public RegistryResult(RegistrySupplier supplier) { - this.supplier = supplier; - } - - public T get() { - return supplier.get(); - } - - @Nullable - public T getOrNull() { - return supplier.getOrNull(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java deleted file mode 100644 index 4e2a538c2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.pitan76.mcpitanlib.api.registry.result; - -import dev.architectury.registry.registries.RegistrySupplier; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; -import java.util.function.Supplier; - -public class SupplierResult extends RegistryResult { - protected Supplier supplier; - - protected SupplierResult(Supplier supplier) { - super(null); - this.supplier = supplier; - } - - protected SupplierResult(RegistrySupplier supplier) { - this(supplier::getOrNull); - } - - protected SupplierResult(RegistryResult result) { - this(result.supplier); - } - - public static SupplierResult of(Supplier supplier) { - return new SupplierResult<>(supplier); - } - - public static SupplierResult of(RegistrySupplier supplier) { - return new SupplierResult<>(supplier); - } - - public static SupplierResult of(RegistryResult result) { - return new SupplierResult<>(result); - } - - @Override - public T get() { - return supplier.get(); - } - - @Override - public @Nullable T getOrNull() { - if (supplier == null) - return null; - return supplier.get(); - } - - public Optional getOptional() { - return Optional.ofNullable(getOrNull()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java deleted file mode 100644 index 4db49a44d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java +++ /dev/null @@ -1,179 +0,0 @@ -package net.pitan76.mcpitanlib.api.registry.v2; - -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.particle.ParticleType; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; -import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; -import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; -import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; -import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; -import net.pitan76.mcpitanlib.api.item.ExtendItem; -import net.pitan76.mcpitanlib.api.registry.CompatRegistry; -import net.pitan76.mcpitanlib.api.registry.FuelRegistry; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; -import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.sound.RegistryResultCompatSoundEvent; -import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; - -import java.util.function.Supplier; - -public class CompatRegistryV2 { - - public final CompatRegistry cr1; - - @Deprecated - public CompatRegistryV2(CompatRegistry compatRegistry) { - this.cr1 = compatRegistry; - } - - /** - * Create a new CompatRegistryV2 - * @param MOD_ID The mod id - * @return The new CompatRegistryV2 - */ - public static CompatRegistryV2 create(String MOD_ID) { - CompatRegistry cr1 = CompatRegistry.create(MOD_ID); - return new CompatRegistryV2(cr1); - } - - public static CompatRegistryV2 create(CompatRegistry compatRegistry) { - return new CompatRegistryV2(compatRegistry); - } - - /** - * Register an item - * @param id The item id - * @param supplier The item supplier - * @return The registry result - */ - public RegistryResult registerItem(CompatIdentifier id, Supplier supplier) { - return cr1.registerItem(id.toMinecraft(), supplier); - } - - public Supplier registerExtendItem(CompatIdentifier id, Supplier supplier) { - RegistryResult result = registerItem(id, supplier::get); - return () -> (ExtendItem) result.get(); - } - - /** - * Register a block - * @param id The block id - * @param supplier The block supplier - * @return The registry result - */ - public RegistryResult registerBlock(CompatIdentifier id, Supplier supplier) { - return cr1.registerBlock(id.toMinecraft(), supplier); - } - - public Supplier registerExtendBlock(CompatIdentifier id, Supplier supplier) { - RegistryResult result = registerBlock(id, supplier::get); - return () -> (ExtendBlock) result.get(); - } - - public RegistryResult> registerScreenHandlerType(CompatIdentifier id, Supplier> supplier) { - return cr1.registerScreenHandlerType(id.toMinecraft(), supplier); - } - - public Supplier> registerScreenHandlerTypeSavingGenerics(CompatIdentifier id, Supplier> supplier) { - RegistryResult> result = cr1.registerScreenHandlerType(id.toMinecraft(), supplier::get); - return () -> (ScreenHandlerType) result.getOrNull(); - } - - public SupplierResult> registerScreenHandlerType(CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { - return SupplierResult.of(registerScreenHandlerTypeSavingGenerics(id, builder::build)); - } - - public SupplierResult> registerScreenHandlerType(CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { - return SupplierResult.of(registerScreenHandlerTypeSavingGenerics(id, builder::build)); - } - - public RegistryResult> registerBlockEntityType(CompatIdentifier id, Supplier> supplier) { - return cr1.registerBlockEntityType(id.toMinecraft(), supplier); - } - - public SupplierResult> registerBlockEntityType(CompatIdentifier id, BlockEntityTypeBuilder builder) { - RegistryResult> result = cr1.registerBlockEntityType(id.toMinecraft(), builder::build); - return SupplierResult.of(() -> (BlockEntityType) result.getOrNull()); - } - - public RegistryResult> registerEntity(CompatIdentifier id, Supplier> supplier) { - return cr1.registerEntity(id.toMinecraft(), supplier); - } - - public RegistryResult registerSoundEvent(CompatIdentifier id) { - return cr1.registerSoundEvent(id.toMinecraft()); - } - - public RegistryResult registerSoundEvent(CompatIdentifier id, float distanceToTravel) { - return cr1.registerSoundEvent(id.toMinecraft(), distanceToTravel); - } - - public CompatSoundEvent registerCompatSoundEvent(CompatIdentifier id) { - return RegistryResultCompatSoundEvent.of(registerSoundEvent(id)); - } - - public CompatSoundEvent registerCompatSoundEvent(CompatIdentifier id, float distanceToTravel) { - return RegistryResultCompatSoundEvent.of(registerSoundEvent(id, distanceToTravel)); - } - - public RegistryResult registerFluid(CompatIdentifier id, Supplier supplier) { - return cr1.registerFluid(id.toMinecraft(), supplier); - } - - public RegistryResult> registerParticleType(CompatIdentifier id, Supplier> supplier) { - return cr1.registerParticleType(id.toMinecraft(), supplier); - } - - public RegistryResult registerEnchantment(CompatIdentifier id, Supplier supplier) { - return cr1.registerEnchantment(id.toMinecraft(), () -> supplier.get().getEnchantment(null)); - } - - public RegistryResult registryStatusEffect(CompatIdentifier id, Supplier supplier) { - return cr1.registerStatusEffect(id.toMinecraft(), () -> supplier.get().getStatusEffect(null)); - } - - public RegistryResult registerItemGroup(CompatIdentifier id, Supplier supplier) { - return cr1.registerItemGroup(id.toMinecraft(), supplier); - } - - public RegistryResult registerItemGroup(CompatIdentifier id, CreativeTabBuilder builder) { - return cr1.registerItemGroup(id.toMinecraft(), builder); - } - - public RegistryResult registerItemGroup(CreativeTabBuilder builder) { - return cr1.registerItemGroup(builder.getIdentifier(), builder); - } - - public RegistryResult> registerChunkTicketType(Identifier id, Supplier> supplier) { - return SupplierResult.of(cr1.getMcplr1_21().registryChunkTicketType(id, supplier)); - } - - public RegistryResult> registerChunkTicketType(CompatIdentifier id, Supplier> supplier) { - return registerChunkTicketType(id.toMinecraft(), supplier); - } - - public void registerFuel(Supplier itemSupplier, int time) { - FuelRegistry.register(itemSupplier::get, time, cr1.getNamespace()); - } - - public void allRegister() { - cr1.allRegister(); - FuelRegistry.allRegister(cr1.getNamespace()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java deleted file mode 100644 index 2353be362..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.api.simple.block; - -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; -import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; -import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; - -public abstract class SimpleGuiBlock extends ExtendBlock implements SimpleScreenHandlerFactory { - - public SimpleGuiBlock(Settings settings) { - super(settings); - } - - @Override - public CompatActionResult onRightClick(BlockUseEvent e) { - if (e.isClient()) - e.player.openGuiScreen(this); - - return e.success(); - } - - @Override - public Text getDisplayName(DisplayNameArgs args) { - return getName(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java deleted file mode 100644 index 570410379..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.pitan76.mcpitanlib.api.simple.item; - -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; -import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.v2.CompatItem; -import net.pitan76.mcpitanlib.api.util.StackActionResult; - -public class SimpleGuiItem extends CompatItem implements SimpleScreenHandlerFactory { - - public ScreenHandlerFactory factory; - public Text name; - - public SimpleGuiItem(CompatibleItemSettings settings, ScreenHandlerFactory factory, Text name) { - super(settings); - this.factory = factory; - this.name = name; - } - - public SimpleGuiItem(CompatibleItemSettings settings, ScreenHandlerFactory factory) { - super(settings); - this.factory = factory; - } - - public SimpleGuiItem(CompatibleItemSettings settings) { - super(settings); - } - - @Override - public StackActionResult onRightClick(ItemUseEvent e) { - if (!e.isClient()) - e.user.openGuiScreen(this); - - return e.success(); - } - - @Override - public Text getDisplayName(DisplayNameArgs args) { - if (name == null) - return getName(); - - return name; - } - - @Override - public ScreenHandler createMenu(CreateMenuEvent e) { - if (factory == null) - return null; - - return factory.create(e); - } - - @FunctionalInterface - public interface ScreenHandlerFactory { - ScreenHandler create(CreateMenuEvent e); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java deleted file mode 100644 index 55563b8ae..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java +++ /dev/null @@ -1,221 +0,0 @@ -package net.pitan76.mcpitanlib.api.sound; - -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.sound.SoundEvent; - -public class CompatBlockSoundGroup { - public static final CompatBlockSoundGroup INTENTIONALLY_EMPTY = of(BlockSoundGroup.INTENTIONALLY_EMPTY); - public static final CompatBlockSoundGroup WOOD = of(BlockSoundGroup.WOOD); - public static final CompatBlockSoundGroup GRAVEL = of(BlockSoundGroup.GRAVEL); - public static final CompatBlockSoundGroup GRASS = of(BlockSoundGroup.GRASS); - public static final CompatBlockSoundGroup LILY_PAD = of(BlockSoundGroup.LILY_PAD); - public static final CompatBlockSoundGroup STONE = of(BlockSoundGroup.STONE); - public static final CompatBlockSoundGroup METAL = of(BlockSoundGroup.METAL); - public static final CompatBlockSoundGroup GLASS = of(BlockSoundGroup.GLASS); - public static final CompatBlockSoundGroup WOOL = of(BlockSoundGroup.WOOL); - public static final CompatBlockSoundGroup SAND = of(BlockSoundGroup.SAND); - public static final CompatBlockSoundGroup SNOW = of(BlockSoundGroup.SNOW); - public static final CompatBlockSoundGroup POWDER_SNOW = of(BlockSoundGroup.POWDER_SNOW); - public static final CompatBlockSoundGroup LADDER = of(BlockSoundGroup.LADDER); - public static final CompatBlockSoundGroup ANVIL = of(BlockSoundGroup.ANVIL); - public static final CompatBlockSoundGroup SLIME = of(BlockSoundGroup.SLIME); - public static final CompatBlockSoundGroup HONEY = of(BlockSoundGroup.HONEY); - public static final CompatBlockSoundGroup WET_GRASS = of(BlockSoundGroup.WET_GRASS); - public static final CompatBlockSoundGroup CORAL = of(BlockSoundGroup.CORAL); - public static final CompatBlockSoundGroup BAMBOO = of(BlockSoundGroup.BAMBOO); - public static final CompatBlockSoundGroup BAMBOO_SAPLING = of(BlockSoundGroup.BAMBOO_SAPLING); - public static final CompatBlockSoundGroup SCAFFOLDING = of(BlockSoundGroup.SCAFFOLDING); - public static final CompatBlockSoundGroup SWEET_BERRY_BUSH = of(BlockSoundGroup.SWEET_BERRY_BUSH); - public static final CompatBlockSoundGroup CROP = of(BlockSoundGroup.CROP); - public static final CompatBlockSoundGroup STEM = of(BlockSoundGroup.STEM); - public static final CompatBlockSoundGroup VINE = of(BlockSoundGroup.VINE); - public static final CompatBlockSoundGroup NETHER_WART = of(BlockSoundGroup.NETHER_WART); - public static final CompatBlockSoundGroup LANTERN = of(BlockSoundGroup.LANTERN); - public static final CompatBlockSoundGroup NETHER_STEM = of(BlockSoundGroup.NETHER_STEM); - public static final CompatBlockSoundGroup NYLIUM = of(BlockSoundGroup.NYLIUM); - public static final CompatBlockSoundGroup FUNGUS = of(BlockSoundGroup.FUNGUS); - public static final CompatBlockSoundGroup ROOTS = of(BlockSoundGroup.ROOTS); - public static final CompatBlockSoundGroup SHROOMLIGHT = of(BlockSoundGroup.SHROOMLIGHT); - public static final CompatBlockSoundGroup WEEPING_VINES = of(BlockSoundGroup.WEEPING_VINES); - public static final CompatBlockSoundGroup WEEPING_VINES_LOW_PITCH = of(BlockSoundGroup.WEEPING_VINES_LOW_PITCH); - public static final CompatBlockSoundGroup SOUL_SAND = of(BlockSoundGroup.SOUL_SAND); - public static final CompatBlockSoundGroup SOUL_SOIL = of(BlockSoundGroup.SOUL_SOIL); - public static final CompatBlockSoundGroup BASALT = of(BlockSoundGroup.BASALT); - public static final CompatBlockSoundGroup WART_BLOCK = of(BlockSoundGroup.WART_BLOCK); - public static final CompatBlockSoundGroup NETHERRACK = of(BlockSoundGroup.NETHERRACK); - public static final CompatBlockSoundGroup NETHER_BRICKS = of(BlockSoundGroup.NETHER_BRICKS); - public static final CompatBlockSoundGroup NETHER_SPROUTS = of(BlockSoundGroup.NETHER_SPROUTS); - public static final CompatBlockSoundGroup NETHER_ORE = of(BlockSoundGroup.NETHER_ORE); - public static final CompatBlockSoundGroup BONE = of(BlockSoundGroup.BONE); - public static final CompatBlockSoundGroup NETHERITE = of(BlockSoundGroup.NETHERITE); - public static final CompatBlockSoundGroup ANCIENT_DEBRIS = of(BlockSoundGroup.ANCIENT_DEBRIS); - public static final CompatBlockSoundGroup LODESTONE = of(BlockSoundGroup.LODESTONE); - public static final CompatBlockSoundGroup CHAIN = of(BlockSoundGroup.CHAIN); - public static final CompatBlockSoundGroup NETHER_GOLD_ORE = of(BlockSoundGroup.NETHER_GOLD_ORE); - public static final CompatBlockSoundGroup GILDED_BLACKSTONE = of(BlockSoundGroup.GILDED_BLACKSTONE); - public static final CompatBlockSoundGroup CANDLE = of(BlockSoundGroup.CANDLE); - public static final CompatBlockSoundGroup AMETHYST_BLOCK = of(BlockSoundGroup.AMETHYST_BLOCK); - public static final CompatBlockSoundGroup AMETHYST_CLUSTER = of(BlockSoundGroup.AMETHYST_CLUSTER); - public static final CompatBlockSoundGroup SMALL_AMETHYST_BUD = of(BlockSoundGroup.SMALL_AMETHYST_BUD); - public static final CompatBlockSoundGroup MEDIUM_AMETHYST_BUD = of(BlockSoundGroup.MEDIUM_AMETHYST_BUD); - public static final CompatBlockSoundGroup LARGE_AMETHYST_BUD = of(BlockSoundGroup.LARGE_AMETHYST_BUD); - public static final CompatBlockSoundGroup TUFF = of(BlockSoundGroup.TUFF); - public static final CompatBlockSoundGroup TUFF_BRICKS = of(BlockSoundGroup.TUFF_BRICKS); - public static final CompatBlockSoundGroup POLISHED_TUFF = of(BlockSoundGroup.POLISHED_TUFF); - public static final CompatBlockSoundGroup CALCITE = of(BlockSoundGroup.CALCITE); - public static final CompatBlockSoundGroup DRIPSTONE_BLOCK = of(BlockSoundGroup.DRIPSTONE_BLOCK); - public static final CompatBlockSoundGroup POINTED_DRIPSTONE = of(BlockSoundGroup.POINTED_DRIPSTONE); - public static final CompatBlockSoundGroup COPPER = of(BlockSoundGroup.COPPER); - public static final CompatBlockSoundGroup COPPER_BULB = of(BlockSoundGroup.COPPER_BULB); - public static final CompatBlockSoundGroup COPPER_GRATE = of(BlockSoundGroup.COPPER_GRATE); - public static final CompatBlockSoundGroup CAVE_VINES = of(BlockSoundGroup.CAVE_VINES); - public static final CompatBlockSoundGroup SPORE_BLOSSOM = of(BlockSoundGroup.SPORE_BLOSSOM); - public static final CompatBlockSoundGroup AZALEA = of(BlockSoundGroup.AZALEA); - public static final CompatBlockSoundGroup FLOWERING_AZALEA = of(BlockSoundGroup.FLOWERING_AZALEA); - public static final CompatBlockSoundGroup MOSS_CARPET = of(BlockSoundGroup.MOSS_CARPET); - public static final CompatBlockSoundGroup PINK_PETALS = of(BlockSoundGroup.CHERRY_LEAVES); - public static final CompatBlockSoundGroup MOSS_BLOCK = of(BlockSoundGroup.MOSS_BLOCK); - public static final CompatBlockSoundGroup BIG_DRIPLEAF = of(BlockSoundGroup.BIG_DRIPLEAF); - public static final CompatBlockSoundGroup SMALL_DRIPLEAF = of(BlockSoundGroup.SMALL_DRIPLEAF); - public static final CompatBlockSoundGroup ROOTED_DIRT = of(BlockSoundGroup.ROOTED_DIRT); - public static final CompatBlockSoundGroup HANGING_ROOTS = of(BlockSoundGroup.HANGING_ROOTS); - public static final CompatBlockSoundGroup AZALEA_LEAVES = of(BlockSoundGroup.AZALEA_LEAVES); - public static final CompatBlockSoundGroup SCULK_SENSOR = of(BlockSoundGroup.SCULK_SENSOR); - public static final CompatBlockSoundGroup SCULK_CATALYST = of(BlockSoundGroup.SCULK_CATALYST); - public static final CompatBlockSoundGroup SCULK = of(BlockSoundGroup.SCULK); - public static final CompatBlockSoundGroup SCULK_VEIN = of(BlockSoundGroup.SCULK_VEIN); - public static final CompatBlockSoundGroup SCULK_SHRIEKER = of(BlockSoundGroup.SCULK_SHRIEKER); - public static final CompatBlockSoundGroup GLOW_LICHEN = of(BlockSoundGroup.GLOW_LICHEN); - public static final CompatBlockSoundGroup DEEPSLATE = of(BlockSoundGroup.DEEPSLATE); - public static final CompatBlockSoundGroup DEEPSLATE_BRICKS = of(BlockSoundGroup.DEEPSLATE_BRICKS); - public static final CompatBlockSoundGroup DEEPSLATE_TILES = of(BlockSoundGroup.DEEPSLATE_TILES); - public static final CompatBlockSoundGroup POLISHED_DEEPSLATE = of(BlockSoundGroup.POLISHED_DEEPSLATE); - public static final CompatBlockSoundGroup FROGLIGHT = of(BlockSoundGroup.FROGLIGHT); - public static final CompatBlockSoundGroup FROGSPAWN = of(BlockSoundGroup.FROGSPAWN); - public static final CompatBlockSoundGroup MANGROVE_ROOTS = of(BlockSoundGroup.MANGROVE_ROOTS); - public static final CompatBlockSoundGroup MUDDY_MANGROVE_ROOTS = of(BlockSoundGroup.MUDDY_MANGROVE_ROOTS); - public static final CompatBlockSoundGroup MUD = of(BlockSoundGroup.MUD); - public static final CompatBlockSoundGroup MUD_BRICKS = of(BlockSoundGroup.MUD_BRICKS); - public static final CompatBlockSoundGroup PACKED_MUD = of(BlockSoundGroup.PACKED_MUD); - public static final CompatBlockSoundGroup HANGING_SIGN = of(BlockSoundGroup.HANGING_SIGN); - public static final CompatBlockSoundGroup NETHER_WOOD_HANGING_SIGN = of(BlockSoundGroup.NETHER_WOOD_HANGING_SIGN); - public static final CompatBlockSoundGroup BAMBOO_WOOD_HANGING_SIGN = of(BlockSoundGroup.BAMBOO_WOOD_HANGING_SIGN); - public static final CompatBlockSoundGroup BAMBOO_WOOD = of(BlockSoundGroup.BAMBOO_WOOD); - public static final CompatBlockSoundGroup NETHER_WOOD = of(BlockSoundGroup.NETHER_WOOD); - public static final CompatBlockSoundGroup CHERRY_WOOD = of(BlockSoundGroup.CHERRY_WOOD); - public static final CompatBlockSoundGroup CHERRY_SAPLING = of(BlockSoundGroup.CHERRY_SAPLING); - public static final CompatBlockSoundGroup CHERRY_LEAVES = of(BlockSoundGroup.CHERRY_LEAVES); - public static final CompatBlockSoundGroup CHERRY_WOOD_HANGING_SIGN = of(BlockSoundGroup.CHERRY_WOOD_HANGING_SIGN); - public static final CompatBlockSoundGroup CHISELED_BOOKSHELF = of(BlockSoundGroup.CHISELED_BOOKSHELF); - public static final CompatBlockSoundGroup SUSPICIOUS_SAND = of(BlockSoundGroup.SUSPICIOUS_SAND); - public static final CompatBlockSoundGroup SUSPICIOUS_GRAVEL = of(BlockSoundGroup.SUSPICIOUS_GRAVEL); - public static final CompatBlockSoundGroup DECORATED_POT = of(BlockSoundGroup.DECORATED_POT); - public static final CompatBlockSoundGroup DECORATED_POT_SHATTER = of(BlockSoundGroup.DECORATED_POT_SHATTER); - public static final CompatBlockSoundGroup TRIAL_SPAWNER = of(BlockSoundGroup.TRIAL_SPAWNER); - public static final CompatBlockSoundGroup SPONGE = of(BlockSoundGroup.SPONGE); - public static final CompatBlockSoundGroup WET_SPONGE = of(BlockSoundGroup.WET_SPONGE); - public static final CompatBlockSoundGroup VAULT = of(BlockSoundGroup.VAULT); - public static final CompatBlockSoundGroup HEAVY_CORE = of(BlockSoundGroup.HEAVY_CORE); - public static final CompatBlockSoundGroup COBWEB = of(BlockSoundGroup.COBWEB); - - public BlockSoundGroup blockSoundGroup; - - private final float volume; - private final float pitch; - private final SoundEvent breakSound; - private final SoundEvent stepSound; - private final SoundEvent placeSound; - private final SoundEvent hitSound; - private final SoundEvent fallSound; - - public CompatBlockSoundGroup(BlockSoundGroup blockSoundGroup) { - this.blockSoundGroup = blockSoundGroup; - - this.volume = blockSoundGroup.getVolume(); - this.pitch = blockSoundGroup.getPitch(); - this.breakSound = blockSoundGroup.getBreakSound(); - this.stepSound = blockSoundGroup.getStepSound(); - this.placeSound = blockSoundGroup.getPlaceSound(); - this.hitSound = blockSoundGroup.getHitSound(); - this.fallSound = blockSoundGroup.getFallSound(); - } - - public CompatBlockSoundGroup(float volume, float pitch, SoundEvent breakSound, SoundEvent stepSound, SoundEvent placeSound, SoundEvent hitSound, SoundEvent fallSound) { - this.blockSoundGroup = new BlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); - - this.volume = volume; - this.pitch = pitch; - this.breakSound = breakSound; - this.stepSound = stepSound; - this.placeSound = placeSound; - this.hitSound = hitSound; - this.fallSound = fallSound; - } - - public BlockSoundGroup get() { - if (blockSoundGroup == null) { - return new BlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); - } - return blockSoundGroup; - } - - public static CompatBlockSoundGroup of(BlockSoundGroup blockSoundGroup) { - return new CompatBlockSoundGroup(blockSoundGroup); - } - - public static CompatBlockSoundGroup of(float volume, float pitch, SoundEvent breakSound, SoundEvent stepSound, SoundEvent placeSound, SoundEvent hitSound, SoundEvent fallSound) { - return new CompatBlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); - } - - public static CompatBlockSoundGroup of(float volume, float pitch, CompatSoundEvent breakSound, CompatSoundEvent stepSound, CompatSoundEvent placeSound, CompatSoundEvent hitSound, CompatSoundEvent fallSound) { - return new CompatBlockSoundGroup(volume, pitch, breakSound.get(), stepSound.get(), placeSound.get(), hitSound.get(), fallSound.get()); - } - - public float getVolume() { - return volume; - } - - public float getPitch() { - return pitch; - } - - public SoundEvent getRawBreakSound() { - return breakSound; - } - - public SoundEvent getRawStepSound() { - return stepSound; - } - - public SoundEvent getRawPlaceSound() { - return placeSound; - } - - public SoundEvent getRawHitSound() { - return hitSound; - } - - public SoundEvent getRawFallSound() { - return fallSound; - } - - public CompatSoundEvent getBreakSound() { - return CompatSoundEvent.of(breakSound); - } - - public CompatSoundEvent getStepSound() { - return CompatSoundEvent.of(stepSound); - } - - public CompatSoundEvent getPlaceSound() { - return CompatSoundEvent.of(placeSound); - } - - public CompatSoundEvent getHitSound() { - return CompatSoundEvent.of(hitSound); - } - - public CompatSoundEvent getFallSound() { - return CompatSoundEvent.of(fallSound); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java deleted file mode 100644 index 4fdd2bd18..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.sound; - -import net.minecraft.sound.SoundCategory; - -public class CompatSoundCategory { - - public static final CompatSoundCategory MASTER = of(SoundCategory.MASTER); - public static final CompatSoundCategory MUSIC = of(SoundCategory.MUSIC); - public static final CompatSoundCategory RECORDS = of(SoundCategory.RECORDS); - public static final CompatSoundCategory WEATHER = of(SoundCategory.WEATHER); - public static final CompatSoundCategory BLOCKS = of(SoundCategory.BLOCKS); - public static final CompatSoundCategory HOSTILE = of(SoundCategory.HOSTILE); - public static final CompatSoundCategory NEUTRAL = of(SoundCategory.NEUTRAL); - public static final CompatSoundCategory PLAYERS = of(SoundCategory.PLAYERS); - public static final CompatSoundCategory AMBIENT = of(SoundCategory.AMBIENT); - public static final CompatSoundCategory VOICE = of(SoundCategory.VOICE); - - public SoundCategory soundCategory; - - public CompatSoundCategory(SoundCategory soundCategory) { - this.soundCategory = soundCategory; - } - - public static CompatSoundCategory of(SoundCategory soundCategory) { - return new CompatSoundCategory(soundCategory); - } - - public SoundCategory get() { - return soundCategory; - } - - public String getName() { - return soundCategory.getName(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java deleted file mode 100644 index f18fcf204..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.api.sound; - -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.sound.SoundEvent; -import org.jetbrains.annotations.Nullable; - -public class CompatSoundEvent { - private SoundEvent soundEvent; - private RegistryEntry.Reference reference; - private RegistryEntry entry; - - public CompatSoundEvent(SoundEvent soundEvent) { - this.soundEvent = soundEvent; - } - - public CompatSoundEvent(RegistryEntry.Reference reference) { - this.reference = reference; - } - - public CompatSoundEvent(RegistryEntry entry) { - this.entry = entry; - } - - public static CompatSoundEvent of(SoundEvent soundEvent) { - return new CompatSoundEvent(soundEvent); - } - - public SoundEvent get() { - if (soundEvent == null) { - if (reference != null) { - soundEvent = reference.value(); - } else if (entry != null) { - soundEvent = entry.value(); - } - } - - return soundEvent; - } - - @Nullable - @Deprecated - public RegistryEntry.Reference getReference() { - return reference; - } - - @Nullable - @Deprecated - public RegistryEntry getEntry() { - if (entry == null) { - entry = RegistryEntry.of(soundEvent); - } - - return entry; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java deleted file mode 100644 index e535953d6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java +++ /dev/null @@ -1,1625 +0,0 @@ -package net.pitan76.mcpitanlib.api.sound; - -import com.google.common.collect.ImmutableList; -import net.minecraft.entity.passive.WolfSoundVariants; -import net.minecraft.sound.SoundEvents; - -public class CompatSoundEvents { - public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITH_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_AMBIENT_WITH_ITEM); - public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM); - public static final CompatSoundEvent ENTITY_ALLAY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_DEATH); - public static final CompatSoundEvent ENTITY_ALLAY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_HURT); - public static final CompatSoundEvent ENTITY_ALLAY_ITEM_GIVEN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_GIVEN); - public static final CompatSoundEvent ENTITY_ALLAY_ITEM_TAKEN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_TAKEN); - public static final CompatSoundEvent ENTITY_ALLAY_ITEM_THROWN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_THROWN); - public static final CompatSoundEvent AMBIENT_CAVE = new CompatSoundEvent(SoundEvents.AMBIENT_CAVE); - public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_ADDITIONS); - public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_LOOP); - public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_MOOD); - public static final CompatSoundEvent AMBIENT_CRIMSON_FOREST_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_CRIMSON_FOREST_ADDITIONS); - public static final CompatSoundEvent AMBIENT_CRIMSON_FOREST_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_CRIMSON_FOREST_LOOP); - public static final CompatSoundEvent AMBIENT_CRIMSON_FOREST_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_CRIMSON_FOREST_MOOD); - public static final CompatSoundEvent AMBIENT_NETHER_WASTES_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_NETHER_WASTES_ADDITIONS); - public static final CompatSoundEvent AMBIENT_NETHER_WASTES_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_NETHER_WASTES_LOOP); - public static final CompatSoundEvent AMBIENT_NETHER_WASTES_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_NETHER_WASTES_MOOD); - public static final CompatSoundEvent AMBIENT_SOUL_SAND_VALLEY_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS); - public static final CompatSoundEvent AMBIENT_SOUL_SAND_VALLEY_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_LOOP); - public static final CompatSoundEvent AMBIENT_SOUL_SAND_VALLEY_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_MOOD); - public static final CompatSoundEvent AMBIENT_WARPED_FOREST_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_WARPED_FOREST_ADDITIONS); - public static final CompatSoundEvent AMBIENT_WARPED_FOREST_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_WARPED_FOREST_LOOP); - public static final CompatSoundEvent AMBIENT_WARPED_FOREST_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_WARPED_FOREST_MOOD); - public static final CompatSoundEvent AMBIENT_UNDERWATER_ENTER = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_ENTER); - public static final CompatSoundEvent AMBIENT_UNDERWATER_EXIT = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_EXIT); - public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP); - public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS); - public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE); - public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_RESONATE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_RESONATE); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_BREAK); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_FALL); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_HIT); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_PLACE); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_STEP); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_BREAK); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_STEP); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_PLACE); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_HIT); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_FALL); - public static final CompatSoundEvent BLOCK_ANVIL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_BREAK); - public static final CompatSoundEvent BLOCK_ANVIL_DESTROY = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_DESTROY); - public static final CompatSoundEvent BLOCK_ANVIL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_FALL); - public static final CompatSoundEvent BLOCK_ANVIL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_HIT); - public static final CompatSoundEvent BLOCK_ANVIL_LAND = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_LAND); - public static final CompatSoundEvent BLOCK_ANVIL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_PLACE); - public static final CompatSoundEvent BLOCK_ANVIL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_STEP); - public static final CompatSoundEvent BLOCK_ANVIL_USE = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_USE); - public static final CompatSoundEvent ENTITY_ARMADILLO_EAT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_EAT); - public static final CompatSoundEvent ENTITY_ARMADILLO_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_HURT); - public static final CompatSoundEvent ENTITY_ARMADILLO_HURT_REDUCED = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_HURT_REDUCED); - public static final CompatSoundEvent ENTITY_ARMADILLO_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_AMBIENT); - public static final CompatSoundEvent ENTITY_ARMADILLO_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_STEP); - public static final CompatSoundEvent ENTITY_ARMADILLO_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_DEATH); - public static final CompatSoundEvent ENTITY_ARMADILLO_ROLL = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_ROLL); - public static final CompatSoundEvent ENTITY_ARMADILLO_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_LAND); - public static final CompatSoundEvent ENTITY_ARMADILLO_SCUTE_DROP = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_SCUTE_DROP); - public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_FINISH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_UNROLL_FINISH); - public static final CompatSoundEvent ENTITY_ARMADILLO_PEEK = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_PEEK); - public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_START = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_UNROLL_START); - public static final CompatSoundEvent ENTITY_ARMADILLO_BRUSH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_BRUSH); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_CHAIN = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_CHAIN); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_DIAMOND = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_ELYTRA = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_ELYTRA); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GENERIC = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_GENERIC); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GOLD = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_GOLD); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_IRON = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_IRON); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_LEATHER = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_LEATHER); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_NETHERITE = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_TURTLE = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_TURTLE); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_WOLF = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_WOLF); - public static final CompatSoundEvent ITEM_ARMOR_UNEQUIP_WOLF = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_UNEQUIP_WOLF); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_BREAK); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_FALL = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_FALL); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_HIT = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_HIT); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_PLACE); - public static final CompatSoundEvent ENTITY_ARROW_HIT = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_HIT); - public static final CompatSoundEvent ENTITY_ARROW_HIT_PLAYER = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_HIT_PLAYER); - public static final CompatSoundEvent ENTITY_ARROW_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_SHOOT); - public static final CompatSoundEvent ITEM_AXE_STRIP = new CompatSoundEvent(SoundEvents.ITEM_AXE_STRIP); - public static final CompatSoundEvent ITEM_AXE_SCRAPE = new CompatSoundEvent(SoundEvents.ITEM_AXE_SCRAPE); - public static final CompatSoundEvent ITEM_AXE_WAX_OFF = new CompatSoundEvent(SoundEvents.ITEM_AXE_WAX_OFF); - public static final CompatSoundEvent ENTITY_AXOLOTL_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_ATTACK); - public static final CompatSoundEvent ENTITY_AXOLOTL_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_DEATH); - public static final CompatSoundEvent ENTITY_AXOLOTL_HURT = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_HURT); - public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_AIR = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_IDLE_AIR); - public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_WATER = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_IDLE_WATER); - public static final CompatSoundEvent ENTITY_AXOLOTL_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_SPLASH); - public static final CompatSoundEvent ENTITY_AXOLOTL_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_SWIM); - public static final CompatSoundEvent BLOCK_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_BREAK); - public static final CompatSoundEvent BLOCK_AZALEA_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_FALL); - public static final CompatSoundEvent BLOCK_AZALEA_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_HIT); - public static final CompatSoundEvent BLOCK_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_PLACE); - public static final CompatSoundEvent BLOCK_AZALEA_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_STEP); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_BREAK); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_FALL); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_HIT); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_PLACE); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_FALL); - public static final CompatSoundEvent BLOCK_BAMBOO_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FALL); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN); - public static final CompatSoundEvent BLOCK_BARREL_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BARREL_CLOSE); - public static final CompatSoundEvent BLOCK_BARREL_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BARREL_OPEN); - public static final CompatSoundEvent BLOCK_BASALT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_BREAK); - public static final CompatSoundEvent BLOCK_BASALT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_STEP); - public static final CompatSoundEvent BLOCK_BASALT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_PLACE); - public static final CompatSoundEvent BLOCK_BASALT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_HIT); - public static final CompatSoundEvent BLOCK_BASALT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_FALL); - public static final CompatSoundEvent ENTITY_BAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BAT_AMBIENT); - public static final CompatSoundEvent ENTITY_BAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BAT_DEATH); - public static final CompatSoundEvent ENTITY_BAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BAT_HURT); - public static final CompatSoundEvent ENTITY_BAT_LOOP = new CompatSoundEvent(SoundEvents.ENTITY_BAT_LOOP); - public static final CompatSoundEvent ENTITY_BAT_TAKEOFF = new CompatSoundEvent(SoundEvents.ENTITY_BAT_TAKEOFF); - public static final CompatSoundEvent BLOCK_BEACON_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_ACTIVATE); - public static final CompatSoundEvent BLOCK_BEACON_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_AMBIENT); - public static final CompatSoundEvent BLOCK_BEACON_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_DEACTIVATE); - public static final CompatSoundEvent BLOCK_BEACON_POWER_SELECT = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_POWER_SELECT); - public static final CompatSoundEvent ENTITY_BEE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BEE_DEATH); - public static final CompatSoundEvent ENTITY_BEE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BEE_HURT); - public static final CompatSoundEvent ENTITY_BEE_LOOP_AGGRESSIVE = new CompatSoundEvent(SoundEvents.ENTITY_BEE_LOOP_AGGRESSIVE); - public static final CompatSoundEvent ENTITY_BEE_LOOP = new CompatSoundEvent(SoundEvents.ENTITY_BEE_LOOP); - public static final CompatSoundEvent ENTITY_BEE_STING = new CompatSoundEvent(SoundEvents.ENTITY_BEE_STING); - public static final CompatSoundEvent ENTITY_BEE_POLLINATE = new CompatSoundEvent(SoundEvents.ENTITY_BEE_POLLINATE); - public static final CompatSoundEvent BLOCK_BEEHIVE_DRIP = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_DRIP); - public static final CompatSoundEvent BLOCK_BEEHIVE_ENTER = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_ENTER); - public static final CompatSoundEvent BLOCK_BEEHIVE_EXIT = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_EXIT); - public static final CompatSoundEvent BLOCK_BEEHIVE_SHEAR = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_SHEAR); - public static final CompatSoundEvent BLOCK_BEEHIVE_WORK = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_WORK); - public static final CompatSoundEvent BLOCK_BELL_USE = new CompatSoundEvent(SoundEvents.BLOCK_BELL_USE); - public static final CompatSoundEvent BLOCK_BELL_RESONATE = new CompatSoundEvent(SoundEvents.BLOCK_BELL_RESONATE); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_BREAK); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_FALL); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_HIT); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_PLACE); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_STEP); - public static final CompatSoundEvent ENTITY_BLAZE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_AMBIENT); - public static final CompatSoundEvent ENTITY_BLAZE_BURN = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_BURN); - public static final CompatSoundEvent ENTITY_BLAZE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_DEATH); - public static final CompatSoundEvent ENTITY_BLAZE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_HURT); - public static final CompatSoundEvent ENTITY_BLAZE_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_SHOOT); - public static final CompatSoundEvent ENTITY_BOAT_PADDLE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_BOAT_PADDLE_LAND); - public static final CompatSoundEvent ENTITY_BOAT_PADDLE_WATER = new CompatSoundEvent(SoundEvents.ENTITY_BOAT_PADDLE_WATER); - public static final CompatSoundEvent ENTITY_BOGGED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_AMBIENT); - public static final CompatSoundEvent ENTITY_BOGGED_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_DEATH); - public static final CompatSoundEvent ENTITY_BOGGED_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_HURT); - public static final CompatSoundEvent ENTITY_BOGGED_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_SHEAR); - public static final CompatSoundEvent ENTITY_BOGGED_STEP = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_STEP); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_STEP); - public static final CompatSoundEvent ITEM_BONE_MEAL_USE = new CompatSoundEvent(SoundEvents.ITEM_BONE_MEAL_USE); - public static final CompatSoundEvent ITEM_BOOK_PAGE_TURN = new CompatSoundEvent(SoundEvents.ITEM_BOOK_PAGE_TURN); - public static final CompatSoundEvent ITEM_BOOK_PUT = new CompatSoundEvent(SoundEvents.ITEM_BOOK_PUT); - public static final CompatSoundEvent BLOCK_BLASTFURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_BLASTFURNACE_FIRE_CRACKLE); - public static final CompatSoundEvent ITEM_BOTTLE_EMPTY = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_EMPTY); - public static final CompatSoundEvent ITEM_BOTTLE_FILL = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_FILL); - public static final CompatSoundEvent ITEM_BOTTLE_FILL_DRAGONBREATH = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH); - public static final CompatSoundEvent ENTITY_BREEZE_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_CHARGE); - public static final CompatSoundEvent ENTITY_BREEZE_DEFLECT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_DEFLECT); - public static final CompatSoundEvent ENTITY_BREEZE_INHALE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_INHALE); - public static final CompatSoundEvent ENTITY_BREEZE_IDLE_GROUND = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_IDLE_GROUND); - public static final CompatSoundEvent ENTITY_BREEZE_IDLE_AIR = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_IDLE_AIR); - public static final CompatSoundEvent ENTITY_BREEZE_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_SHOOT); - public static final CompatSoundEvent ENTITY_BREEZE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_JUMP); - public static final CompatSoundEvent ENTITY_BREEZE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_LAND); - public static final CompatSoundEvent ENTITY_BREEZE_SLIDE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_SLIDE); - public static final CompatSoundEvent ENTITY_BREEZE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_DEATH); - public static final CompatSoundEvent ENTITY_BREEZE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_HURT); - public static final CompatSoundEvent ENTITY_BREEZE_WHIRL = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_WHIRL); - public static final CompatSoundEvent ENTITY_BREEZE_WIND_BURST = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_WIND_BURST); - public static final CompatSoundEvent BLOCK_BREWING_STAND_BREW = new CompatSoundEvent(SoundEvents.BLOCK_BREWING_STAND_BREW); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GENERIC = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GENERIC); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_SAND); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GRAVEL); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND_COMPLETE = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_SAND_COMPLETE); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL_COMPLETE = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GRAVEL_COMPLETE); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_BUBBLE_POP = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_BUBBLE_POP); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_AXOLOTL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_AXOLOTL); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_FISH = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_FISH); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_LAVA = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_LAVA); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_POWDER_SNOW = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_POWDER_SNOW); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_TADPOLE = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_TADPOLE); - public static final CompatSoundEvent ITEM_BUCKET_FILL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL); - public static final CompatSoundEvent ITEM_BUCKET_FILL_AXOLOTL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_AXOLOTL); - public static final CompatSoundEvent ITEM_BUCKET_FILL_FISH = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_FISH); - public static final CompatSoundEvent ITEM_BUCKET_FILL_LAVA = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_LAVA); - public static final CompatSoundEvent ITEM_BUCKET_FILL_POWDER_SNOW = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_POWDER_SNOW); - public static final CompatSoundEvent ITEM_BUCKET_FILL_TADPOLE = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_TADPOLE); - public static final CompatSoundEvent ITEM_BUNDLE_DROP_CONTENTS = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_DROP_CONTENTS); - public static final CompatSoundEvent ITEM_BUNDLE_INSERT = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_INSERT); - public static final CompatSoundEvent ITEM_BUNDLE_REMOVE_ONE = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_REMOVE_ONE); - public static final CompatSoundEvent BLOCK_CAKE_ADD_CANDLE = new CompatSoundEvent(SoundEvents.BLOCK_CAKE_ADD_CANDLE); - public static final CompatSoundEvent BLOCK_CALCITE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_BREAK); - public static final CompatSoundEvent BLOCK_CALCITE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_STEP); - public static final CompatSoundEvent BLOCK_CALCITE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_PLACE); - public static final CompatSoundEvent BLOCK_CALCITE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_HIT); - public static final CompatSoundEvent BLOCK_CALCITE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_FALL); - public static final CompatSoundEvent ENTITY_CAMEL_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_AMBIENT); - public static final CompatSoundEvent ENTITY_CAMEL_DASH = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DASH); - public static final CompatSoundEvent ENTITY_CAMEL_DASH_READY = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DASH_READY); - public static final CompatSoundEvent ENTITY_CAMEL_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DEATH); - public static final CompatSoundEvent ENTITY_CAMEL_EAT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_EAT); - public static final CompatSoundEvent ENTITY_CAMEL_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_HURT); - public static final CompatSoundEvent ENTITY_CAMEL_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_SADDLE); - public static final CompatSoundEvent ENTITY_CAMEL_SIT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_SIT); - public static final CompatSoundEvent ENTITY_CAMEL_STAND = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STAND); - public static final CompatSoundEvent ENTITY_CAMEL_STEP = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STEP); - public static final CompatSoundEvent ENTITY_CAMEL_STEP_SAND = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STEP_SAND); - public static final CompatSoundEvent BLOCK_CAMPFIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_CAMPFIRE_CRACKLE); - public static final CompatSoundEvent BLOCK_CANDLE_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_AMBIENT); - public static final CompatSoundEvent BLOCK_CANDLE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_BREAK); - public static final CompatSoundEvent BLOCK_CANDLE_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_EXTINGUISH); - public static final CompatSoundEvent BLOCK_CANDLE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_FALL); - public static final CompatSoundEvent BLOCK_CANDLE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_HIT); - public static final CompatSoundEvent BLOCK_CANDLE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_PLACE); - public static final CompatSoundEvent BLOCK_CANDLE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_STEP); - public static final CompatSoundEvent ENTITY_CAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_AMBIENT); - public static final CompatSoundEvent ENTITY_CAT_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_STRAY_AMBIENT); - public static final CompatSoundEvent ENTITY_CAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CAT_DEATH); - public static final CompatSoundEvent ENTITY_CAT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_EAT); - public static final CompatSoundEvent ENTITY_CAT_HISS = new CompatSoundEvent(SoundEvents.ENTITY_CAT_HISS); - public static final CompatSoundEvent ENTITY_CAT_BEG_FOR_FOOD = new CompatSoundEvent(SoundEvents.ENTITY_CAT_BEG_FOR_FOOD); - public static final CompatSoundEvent ENTITY_CAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_HURT); - public static final CompatSoundEvent ENTITY_CAT_PURR = new CompatSoundEvent(SoundEvents.ENTITY_CAT_PURR); - public static final CompatSoundEvent ENTITY_CAT_PURREOW = new CompatSoundEvent(SoundEvents.ENTITY_CAT_PURREOW); - public static final CompatSoundEvent BLOCK_CAVE_VINES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_BREAK); - public static final CompatSoundEvent BLOCK_CAVE_VINES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_FALL); - public static final CompatSoundEvent BLOCK_CAVE_VINES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_HIT); - public static final CompatSoundEvent BLOCK_CAVE_VINES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_PLACE); - public static final CompatSoundEvent BLOCK_CAVE_VINES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_STEP); - public static final CompatSoundEvent BLOCK_CAVE_VINES_PICK_BERRIES = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_PICK_BERRIES); - public static final CompatSoundEvent BLOCK_CHAIN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_BREAK); - public static final CompatSoundEvent BLOCK_CHAIN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_FALL); - public static final CompatSoundEvent BLOCK_CHAIN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_HIT); - public static final CompatSoundEvent BLOCK_CHAIN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_PLACE); - public static final CompatSoundEvent BLOCK_CHAIN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN); - public static final CompatSoundEvent BLOCK_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_CLOSE); - public static final CompatSoundEvent BLOCK_CHEST_LOCKED = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_LOCKED); - public static final CompatSoundEvent BLOCK_CHEST_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_OPEN); - public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_AMBIENT); - public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_DEATH); - public static final CompatSoundEvent ENTITY_CHICKEN_EGG = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_EGG); - public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_HURT); - public static final CompatSoundEvent ENTITY_CHICKEN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_STEP); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_BREAK); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_FALL); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_HIT); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_INSERT); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT_ENCHANTED = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_INSERT_ENCHANTED); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_STEP); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PICKUP); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP_ENCHANTED = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PICKUP_ENCHANTED); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PLACE); - public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_DEATH = new CompatSoundEvent(SoundEvents.BLOCK_CHORUS_FLOWER_DEATH); - public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_GROW = new CompatSoundEvent(SoundEvents.BLOCK_CHORUS_FLOWER_GROW); - public static final CompatSoundEvent ITEM_CHORUS_FRUIT_TELEPORT = new CompatSoundEvent(SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT); - public static final CompatSoundEvent BLOCK_COBWEB_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_BREAK); - public static final CompatSoundEvent BLOCK_COBWEB_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_STEP); - public static final CompatSoundEvent BLOCK_COBWEB_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_PLACE); - public static final CompatSoundEvent BLOCK_COBWEB_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_HIT); - public static final CompatSoundEvent BLOCK_COBWEB_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_FALL); - public static final CompatSoundEvent ENTITY_COD_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_COD_AMBIENT); - public static final CompatSoundEvent ENTITY_COD_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_COD_DEATH); - public static final CompatSoundEvent ENTITY_COD_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_COD_FLOP); - public static final CompatSoundEvent ENTITY_COD_HURT = new CompatSoundEvent(SoundEvents.ENTITY_COD_HURT); - public static final CompatSoundEvent BLOCK_COMPARATOR_CLICK = new CompatSoundEvent(SoundEvents.BLOCK_COMPARATOR_CLICK); - public static final CompatSoundEvent BLOCK_COMPOSTER_EMPTY = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_EMPTY); - public static final CompatSoundEvent BLOCK_COMPOSTER_FILL = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_FILL); - public static final CompatSoundEvent BLOCK_COMPOSTER_FILL_SUCCESS = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_FILL_SUCCESS); - public static final CompatSoundEvent BLOCK_COMPOSTER_READY = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_READY); - public static final CompatSoundEvent BLOCK_CONDUIT_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_ACTIVATE); - public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_AMBIENT); - public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT_SHORT = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_AMBIENT_SHORT); - public static final CompatSoundEvent BLOCK_CONDUIT_ATTACK_TARGET = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_ATTACK_TARGET); - public static final CompatSoundEvent BLOCK_CONDUIT_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_DEACTIVATE); - public static final CompatSoundEvent BLOCK_COPPER_BULB_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_BREAK); - public static final CompatSoundEvent BLOCK_COPPER_BULB_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_STEP); - public static final CompatSoundEvent BLOCK_COPPER_BULB_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_PLACE); - public static final CompatSoundEvent BLOCK_COPPER_BULB_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_HIT); - public static final CompatSoundEvent BLOCK_COPPER_BULB_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_FALL); - public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_ON = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_TURN_ON); - public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_OFF = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_TURN_OFF); - public static final CompatSoundEvent BLOCK_COPPER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BREAK); - public static final CompatSoundEvent BLOCK_COPPER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_STEP); - public static final CompatSoundEvent BLOCK_COPPER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_PLACE); - public static final CompatSoundEvent BLOCK_COPPER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_HIT); - public static final CompatSoundEvent BLOCK_COPPER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_FALL); - public static final CompatSoundEvent BLOCK_COPPER_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_COPPER_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_BREAK); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_STEP); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_PLACE); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_HIT); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_FALL); - public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_STEP); - public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_COW_AMBIENT); - public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_COW_DEATH); - public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.ENTITY_COW_HURT); - public static final CompatSoundEvent ENTITY_COW_MILK = new CompatSoundEvent(SoundEvents.ENTITY_COW_MILK); - public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.ENTITY_COW_STEP); - public static final CompatSoundEvent BLOCK_CRAFTER_CRAFT = new CompatSoundEvent(SoundEvents.BLOCK_CRAFTER_CRAFT); - public static final CompatSoundEvent BLOCK_CRAFTER_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_CRAFTER_FAIL); - public static final CompatSoundEvent ENTITY_CREEPER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_DEATH); - public static final CompatSoundEvent ENTITY_CREEPER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_HURT); - public static final CompatSoundEvent ENTITY_CREEPER_PRIMED = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_PRIMED); - public static final CompatSoundEvent BLOCK_CROP_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CROP_BREAK); - public static final CompatSoundEvent ITEM_CROP_PLANT = new CompatSoundEvent(SoundEvents.ITEM_CROP_PLANT); - public static final CompatSoundEvent ITEM_CROSSBOW_HIT = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_HIT); - public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_END = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_END); - public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_MIDDLE = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_MIDDLE); - public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_START = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_START); - public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_1 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_1); - public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_2 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_2); - public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_3 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_3); - public static final CompatSoundEvent ITEM_CROSSBOW_SHOOT = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_SHOOT); - public static final CompatSoundEvent BLOCK_DECORATED_POT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_BREAK); - public static final CompatSoundEvent BLOCK_DECORATED_POT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_FALL); - public static final CompatSoundEvent BLOCK_DECORATED_POT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_HIT); - public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_INSERT); - public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_INSERT_FAIL); - public static final CompatSoundEvent BLOCK_DECORATED_POT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_STEP); - public static final CompatSoundEvent BLOCK_DECORATED_POT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_PLACE); - public static final CompatSoundEvent BLOCK_DECORATED_POT_SHATTER = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_SHATTER); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BREAK); - public static final CompatSoundEvent BLOCK_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_FALL); - public static final CompatSoundEvent BLOCK_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_HIT); - public static final CompatSoundEvent BLOCK_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_PLACE); - public static final CompatSoundEvent BLOCK_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_STEP); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_BREAK); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_FALL); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_HIT); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_PLACE); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_STEP); - public static final CompatSoundEvent BLOCK_DISPENSER_DISPENSE = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_DISPENSE); - public static final CompatSoundEvent BLOCK_DISPENSER_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_FAIL); - public static final CompatSoundEvent BLOCK_DISPENSER_LAUNCH = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_LAUNCH); - public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_AMBIENT); - public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_AMBIENT_WATER); - public static final CompatSoundEvent ENTITY_DOLPHIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_ATTACK); - public static final CompatSoundEvent ENTITY_DOLPHIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_DEATH); - public static final CompatSoundEvent ENTITY_DOLPHIN_EAT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_EAT); - public static final CompatSoundEvent ENTITY_DOLPHIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_HURT); - public static final CompatSoundEvent ENTITY_DOLPHIN_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_JUMP); - public static final CompatSoundEvent ENTITY_DOLPHIN_PLAY = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_PLAY); - public static final CompatSoundEvent ENTITY_DOLPHIN_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_SPLASH); - public static final CompatSoundEvent ENTITY_DOLPHIN_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_SWIM); - public static final CompatSoundEvent ENTITY_DONKEY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_AMBIENT); - public static final CompatSoundEvent ENTITY_DONKEY_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_ANGRY); - public static final CompatSoundEvent ENTITY_DONKEY_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_CHEST); - public static final CompatSoundEvent ENTITY_DONKEY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_DEATH); - public static final CompatSoundEvent ENTITY_DONKEY_EAT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_EAT); - public static final CompatSoundEvent ENTITY_DONKEY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_HURT); - public static final CompatSoundEvent ENTITY_DONKEY_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_JUMP); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_BREAK); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_STEP); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_PLACE); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_HIT); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_FALL); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_LAND = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_LAND); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_LAVA); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_WATER); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_DOWN = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_DOWN); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_UP = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_UP); - public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_AMBIENT); - public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_AMBIENT_WATER); - public static final CompatSoundEvent ENTITY_DROWNED_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_DEATH); - public static final CompatSoundEvent ENTITY_DROWNED_DEATH_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_DEATH_WATER); - public static final CompatSoundEvent ENTITY_DROWNED_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_HURT); - public static final CompatSoundEvent ENTITY_DROWNED_HURT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_HURT_WATER); - public static final CompatSoundEvent ENTITY_DROWNED_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_SHOOT); - public static final CompatSoundEvent ENTITY_DROWNED_STEP = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_STEP); - public static final CompatSoundEvent ENTITY_DROWNED_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_SWIM); - public static final CompatSoundEvent ITEM_DYE_USE = new CompatSoundEvent(SoundEvents.ITEM_DYE_USE); - public static final CompatSoundEvent ENTITY_EGG_THROW = new CompatSoundEvent(SoundEvents.ENTITY_EGG_THROW); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_AMBIENT); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_AMBIENT_LAND); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_CURSE = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_CURSE); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_DEATH); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_DEATH_LAND); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_FLOP); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_HURT); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_HURT_LAND); - public static final CompatSoundEvent ITEM_ELYTRA_FLYING = new CompatSoundEvent(SoundEvents.ITEM_ELYTRA_FLYING); - public static final CompatSoundEvent BLOCK_ENCHANTMENT_TABLE_USE = new CompatSoundEvent(SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE); - public static final CompatSoundEvent BLOCK_ENDER_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_ENDER_CHEST_CLOSE); - public static final CompatSoundEvent BLOCK_ENDER_CHEST_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_ENDER_CHEST_OPEN); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_AMBIENT); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_DEATH); - public static final CompatSoundEvent ENTITY_DRAGON_FIREBALL_EXPLODE = new CompatSoundEvent(SoundEvents.ENTITY_DRAGON_FIREBALL_EXPLODE); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_FLAP = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_FLAP); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_GROWL = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_GROWL); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_HURT); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_SHOOT); - public static final CompatSoundEvent ENTITY_ENDER_EYE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_EYE_DEATH); - public static final CompatSoundEvent ENTITY_ENDER_EYE_LAUNCH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_EYE_LAUNCH); - public static final CompatSoundEvent ENTITY_ENDERMAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_AMBIENT); - public static final CompatSoundEvent ENTITY_ENDERMAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_DEATH); - public static final CompatSoundEvent ENTITY_ENDERMAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_HURT); - public static final CompatSoundEvent ENTITY_ENDERMAN_SCREAM = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_SCREAM); - public static final CompatSoundEvent ENTITY_ENDERMAN_STARE = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_STARE); - public static final CompatSoundEvent ENTITY_ENDERMAN_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_TELEPORT); - public static final CompatSoundEvent ENTITY_ENDERMITE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_AMBIENT); - public static final CompatSoundEvent ENTITY_ENDERMITE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_DEATH); - public static final CompatSoundEvent ENTITY_ENDERMITE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_HURT); - public static final CompatSoundEvent ENTITY_ENDERMITE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_STEP); - public static final CompatSoundEvent ENTITY_ENDER_PEARL_THROW = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_PEARL_THROW); - public static final CompatSoundEvent BLOCK_END_GATEWAY_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_END_GATEWAY_SPAWN); - public static final CompatSoundEvent BLOCK_END_PORTAL_FRAME_FILL = new CompatSoundEvent(SoundEvents.BLOCK_END_PORTAL_FRAME_FILL); - public static final CompatSoundEvent BLOCK_END_PORTAL_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_END_PORTAL_SPAWN); - public static final CompatSoundEvent ENTITY_EVOKER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_AMBIENT); - public static final CompatSoundEvent ENTITY_EVOKER_CAST_SPELL = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_CAST_SPELL); - public static final CompatSoundEvent ENTITY_EVOKER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_CELEBRATE); - public static final CompatSoundEvent ENTITY_EVOKER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_DEATH); - public static final CompatSoundEvent ENTITY_EVOKER_FANGS_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_FANGS_ATTACK); - public static final CompatSoundEvent ENTITY_EVOKER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_HURT); - public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_ATTACK); - public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_SUMMON = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_SUMMON); - public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_WOLOLO = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_WOLOLO); - public static final CompatSoundEvent ENTITY_EXPERIENCE_BOTTLE_THROW = new CompatSoundEvent(SoundEvents.ENTITY_EXPERIENCE_BOTTLE_THROW); - public static final CompatSoundEvent ENTITY_EXPERIENCE_ORB_PICKUP = new CompatSoundEvent(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP); - public static final CompatSoundEvent BLOCK_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_FENCE_GATE_OPEN); - public static final CompatSoundEvent ITEM_FIRECHARGE_USE = new CompatSoundEvent(SoundEvents.ITEM_FIRECHARGE_USE); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_BLAST); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_BLAST_FAR); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LARGE_BLAST); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LAUNCH = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LAUNCH); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_SHOOT); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_TWINKLE); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_TWINKLE_FAR); - public static final CompatSoundEvent BLOCK_FIRE_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_FIRE_AMBIENT); - public static final CompatSoundEvent BLOCK_FIRE_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_FIRE_EXTINGUISH); - public static final CompatSoundEvent ENTITY_FISH_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_FISH_SWIM); - public static final CompatSoundEvent ENTITY_FISHING_BOBBER_RETRIEVE = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_RETRIEVE); - public static final CompatSoundEvent ENTITY_FISHING_BOBBER_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_SPLASH); - public static final CompatSoundEvent ENTITY_FISHING_BOBBER_THROW = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_THROW); - public static final CompatSoundEvent ITEM_FLINTANDSTEEL_USE = new CompatSoundEvent(SoundEvents.ITEM_FLINTANDSTEEL_USE); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_BREAK); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_FALL); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_HIT); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_PLACE); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_STEP); - public static final CompatSoundEvent ENTITY_FOX_AGGRO = new CompatSoundEvent(SoundEvents.ENTITY_FOX_AGGRO); - public static final CompatSoundEvent ENTITY_FOX_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_AMBIENT); - public static final CompatSoundEvent ENTITY_FOX_BITE = new CompatSoundEvent(SoundEvents.ENTITY_FOX_BITE); - public static final CompatSoundEvent ENTITY_FOX_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_FOX_DEATH); - public static final CompatSoundEvent ENTITY_FOX_EAT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_EAT); - public static final CompatSoundEvent ENTITY_FOX_HURT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_HURT); - public static final CompatSoundEvent ENTITY_FOX_SCREECH = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SCREECH); - public static final CompatSoundEvent ENTITY_FOX_SLEEP = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SLEEP); - public static final CompatSoundEvent ENTITY_FOX_SNIFF = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SNIFF); - public static final CompatSoundEvent ENTITY_FOX_SPIT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SPIT); - public static final CompatSoundEvent ENTITY_FOX_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_TELEPORT); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_BREAK); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_STEP); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_PLACE); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_HIT); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_FALL); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_BREAK); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_STEP); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_PLACE); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_HIT); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_FALL); - public static final CompatSoundEvent BLOCK_FROGLIGHT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_BREAK); - public static final CompatSoundEvent BLOCK_FROGLIGHT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_FALL); - public static final CompatSoundEvent BLOCK_FROGLIGHT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_HIT); - public static final CompatSoundEvent BLOCK_FROGLIGHT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_PLACE); - public static final CompatSoundEvent BLOCK_FROGLIGHT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_STEP); - public static final CompatSoundEvent BLOCK_FROGSPAWN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_STEP); - public static final CompatSoundEvent BLOCK_FROGSPAWN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_BREAK); - public static final CompatSoundEvent BLOCK_FROGSPAWN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_FALL); - public static final CompatSoundEvent BLOCK_FROGSPAWN_HATCH = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_HATCH); - public static final CompatSoundEvent BLOCK_FROGSPAWN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_HIT); - public static final CompatSoundEvent BLOCK_FROGSPAWN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_PLACE); - public static final CompatSoundEvent ENTITY_FROG_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_AMBIENT); - public static final CompatSoundEvent ENTITY_FROG_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_FROG_DEATH); - public static final CompatSoundEvent ENTITY_FROG_EAT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_EAT); - public static final CompatSoundEvent ENTITY_FROG_HURT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_HURT); - public static final CompatSoundEvent ENTITY_FROG_LAY_SPAWN = new CompatSoundEvent(SoundEvents.ENTITY_FROG_LAY_SPAWN); - public static final CompatSoundEvent ENTITY_FROG_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_FROG_LONG_JUMP); - public static final CompatSoundEvent ENTITY_FROG_STEP = new CompatSoundEvent(SoundEvents.ENTITY_FROG_STEP); - public static final CompatSoundEvent ENTITY_FROG_TONGUE = new CompatSoundEvent(SoundEvents.ENTITY_FROG_TONGUE); - public static final CompatSoundEvent BLOCK_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_STEP); - public static final CompatSoundEvent BLOCK_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_FURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE); - public static final CompatSoundEvent ENTITY_GENERIC_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_BIG_FALL); - public static final CompatSoundEvent ENTITY_GENERIC_BURN = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_BURN); - public static final CompatSoundEvent ENTITY_GENERIC_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_DEATH); - public static final CompatSoundEvent ENTITY_GENERIC_DRINK = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_DRINK); - public static final CompatSoundEvent ENTITY_GENERIC_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EAT); - public static final CompatSoundEvent ENTITY_GENERIC_EXPLODE = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EXPLODE); - public static final CompatSoundEvent ENTITY_GENERIC_EXTINGUISH_FIRE = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE); - public static final CompatSoundEvent ENTITY_GENERIC_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_HURT); - public static final CompatSoundEvent ENTITY_GENERIC_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SMALL_FALL); - public static final CompatSoundEvent ENTITY_GENERIC_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SPLASH); - public static final CompatSoundEvent ENTITY_GENERIC_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SWIM); - public static final CompatSoundEvent ENTITY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_AMBIENT); - public static final CompatSoundEvent ENTITY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_DEATH); - public static final CompatSoundEvent ENTITY_GHAST_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_HURT); - public static final CompatSoundEvent ENTITY_GHAST_SCREAM = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_SCREAM); - public static final CompatSoundEvent ENTITY_GHAST_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_SHOOT); - public static final CompatSoundEvent ENTITY_GHAST_WARN = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_WARN); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_BREAK); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_FALL); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_HIT); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_PLACE); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_STEP); - public static final CompatSoundEvent BLOCK_GLASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_BREAK); - public static final CompatSoundEvent BLOCK_GLASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_FALL); - public static final CompatSoundEvent BLOCK_GLASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_HIT); - public static final CompatSoundEvent BLOCK_GLASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_PLACE); - public static final CompatSoundEvent BLOCK_GLASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_STEP); - public static final CompatSoundEvent ITEM_GLOW_INK_SAC_USE = new CompatSoundEvent(SoundEvents.ITEM_GLOW_INK_SAC_USE); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_ADD_ITEM); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_BREAK); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_PLACE); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_REMOVE_ITEM); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_ROTATE_ITEM); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_AMBIENT); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_DEATH); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_HURT); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_SQUIRT); - public static final CompatSoundEvent ENTITY_GOAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_AMBIENT); - public static final CompatSoundEvent ENTITY_GOAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_DEATH); - public static final CompatSoundEvent ENTITY_GOAT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_EAT); - public static final CompatSoundEvent ENTITY_GOAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HURT); - public static final CompatSoundEvent ENTITY_GOAT_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_LONG_JUMP); - public static final CompatSoundEvent ENTITY_GOAT_MILK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_MILK); - public static final CompatSoundEvent ENTITY_GOAT_PREPARE_RAM = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_PREPARE_RAM); - public static final CompatSoundEvent ENTITY_GOAT_RAM_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_RAM_IMPACT); - public static final CompatSoundEvent ENTITY_GOAT_HORN_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HORN_BREAK); - public static final CompatSoundEvent ITEM_GOAT_HORN_PLAY = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_STEP); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_AMBIENT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_DEATH); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_EAT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_HURT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_LONG_JUMP); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_MILK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_MILK); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_PREPARE_RAM = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_PREPARE_RAM); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_RAM_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_RAM_IMPACT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HORN_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HORN_BREAK); - public static final CompatSoundEvent ENTITY_GOAT_STEP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_STEP); - public static final CompatSoundEvent BLOCK_GRASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_BREAK); - public static final CompatSoundEvent BLOCK_GRASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_FALL); - public static final CompatSoundEvent BLOCK_GRASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_HIT); - public static final CompatSoundEvent BLOCK_GRASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_PLACE); - public static final CompatSoundEvent BLOCK_GRASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_STEP); - public static final CompatSoundEvent BLOCK_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_BREAK); - public static final CompatSoundEvent BLOCK_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_FALL); - public static final CompatSoundEvent BLOCK_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_HIT); - public static final CompatSoundEvent BLOCK_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_PLACE); - public static final CompatSoundEvent BLOCK_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_STEP); - public static final CompatSoundEvent BLOCK_GRINDSTONE_USE = new CompatSoundEvent(SoundEvents.BLOCK_GRINDSTONE_USE); - public static final CompatSoundEvent BLOCK_GROWING_PLANT_CROP = new CompatSoundEvent(SoundEvents.BLOCK_GROWING_PLANT_CROP); - public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_AMBIENT); - public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_AMBIENT_LAND); - public static final CompatSoundEvent ENTITY_GUARDIAN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_ATTACK); - public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_DEATH); - public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_DEATH_LAND); - public static final CompatSoundEvent ENTITY_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_FLOP); - public static final CompatSoundEvent ENTITY_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_HURT); - public static final CompatSoundEvent ENTITY_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_HURT_LAND); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_STEP); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_BREAK); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_FALL); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_HIT); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_PLACE); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_STEP); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_BREAK); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_STEP); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_PLACE); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_HIT); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_FALL); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_MOB = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_MOB); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_ITEM); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_DETECT_PLAYER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_DETECT_PLAYER); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OMINOUS_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_OMINOUS_ACTIVATE); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_AMBIENT); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT_OMINOUS = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_AMBIENT_OMINOUS); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_EJECT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_EJECT_ITEM); - public static final CompatSoundEvent ITEM_HOE_TILL = new CompatSoundEvent(SoundEvents.ITEM_HOE_TILL); - public static final CompatSoundEvent ENTITY_HOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_HOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_HOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_ATTACK); - public static final CompatSoundEvent ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED); - public static final CompatSoundEvent ENTITY_HOGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_DEATH); - public static final CompatSoundEvent ENTITY_HOGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_HURT); - public static final CompatSoundEvent ENTITY_HOGLIN_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_RETREAT); - public static final CompatSoundEvent ENTITY_HOGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_STEP); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_SLIDE = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_SLIDE); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_STEP); - public static final CompatSoundEvent ITEM_HONEYCOMB_WAX_ON = new CompatSoundEvent(SoundEvents.ITEM_HONEYCOMB_WAX_ON); - public static final CompatSoundEvent ITEM_HONEY_BOTTLE_DRINK = new CompatSoundEvent(SoundEvents.ITEM_HONEY_BOTTLE_DRINK); - public static final int GOAT_HORN_SOUNDS_COUNT = SoundEvents.GOAT_HORN_SOUND_COUNT; - public static final ImmutableList GOAT_HORN_SOUNDS; - public static final CompatSoundEvent ENTITY_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_AMBIENT); - public static final CompatSoundEvent ENTITY_HORSE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_ANGRY); - public static final CompatSoundEvent ENTITY_HORSE_ARMOR = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_ARMOR); - public static final CompatSoundEvent ENTITY_HORSE_BREATHE = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_BREATHE); - public static final CompatSoundEvent ENTITY_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_DEATH); - public static final CompatSoundEvent ENTITY_HORSE_EAT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_EAT); - public static final CompatSoundEvent ENTITY_HORSE_GALLOP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_GALLOP); - public static final CompatSoundEvent ENTITY_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_HURT); - public static final CompatSoundEvent ENTITY_HORSE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_JUMP); - public static final CompatSoundEvent ENTITY_HORSE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_LAND); - public static final CompatSoundEvent ENTITY_HORSE_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_SADDLE); - public static final CompatSoundEvent ENTITY_HORSE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_STEP); - public static final CompatSoundEvent ENTITY_HORSE_STEP_WOOD = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_STEP_WOOD); - public static final CompatSoundEvent ENTITY_HOSTILE_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_BIG_FALL); - public static final CompatSoundEvent ENTITY_HOSTILE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_DEATH); - public static final CompatSoundEvent ENTITY_HOSTILE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_HURT); - public static final CompatSoundEvent ENTITY_HOSTILE_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SMALL_FALL); - public static final CompatSoundEvent ENTITY_HOSTILE_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SPLASH); - public static final CompatSoundEvent ENTITY_HOSTILE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SWIM); - public static final CompatSoundEvent ENTITY_HUSK_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_AMBIENT); - public static final CompatSoundEvent ENTITY_HUSK_CONVERTED_TO_ZOMBIE = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_CONVERTED_TO_ZOMBIE); - public static final CompatSoundEvent ENTITY_HUSK_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_DEATH); - public static final CompatSoundEvent ENTITY_HUSK_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_HURT); - public static final CompatSoundEvent ENTITY_HUSK_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_STEP); - public static final CompatSoundEvent ENTITY_ILLUSIONER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_AMBIENT); - public static final CompatSoundEvent ENTITY_ILLUSIONER_CAST_SPELL = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_CAST_SPELL); - public static final CompatSoundEvent ENTITY_ILLUSIONER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_DEATH); - public static final CompatSoundEvent ENTITY_ILLUSIONER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_HURT); - public static final CompatSoundEvent ENTITY_ILLUSIONER_MIRROR_MOVE = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_MIRROR_MOVE); - public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_BLINDNESS = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_PREPARE_BLINDNESS); - public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_MIRROR = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_PREPARE_MIRROR); - public static final CompatSoundEvent ITEM_INK_SAC_USE = new CompatSoundEvent(SoundEvents.ITEM_INK_SAC_USE); - public static final CompatSoundEvent BLOCK_IRON_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_IRON_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_IRON_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_IRON_DOOR_OPEN); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_ATTACK); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_DAMAGE = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_DAMAGE); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_DEATH); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_HURT); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_REPAIR = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_REPAIR); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_STEP = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_STEP); - public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_BREAK); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_PLACE); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_REMOVE_ITEM); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_ROTATE_ITEM); - public static final CompatSoundEvent ENTITY_ITEM_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_BREAK); - public static final CompatSoundEvent ENTITY_ITEM_PICKUP = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_PICKUP); - public static final CompatSoundEvent BLOCK_LADDER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_BREAK); - public static final CompatSoundEvent BLOCK_LADDER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_FALL); - public static final CompatSoundEvent BLOCK_LADDER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_HIT); - public static final CompatSoundEvent BLOCK_LADDER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_PLACE); - public static final CompatSoundEvent BLOCK_LADDER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_STEP); - public static final CompatSoundEvent BLOCK_LANTERN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_BREAK); - public static final CompatSoundEvent BLOCK_LANTERN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_FALL); - public static final CompatSoundEvent BLOCK_LANTERN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_HIT); - public static final CompatSoundEvent BLOCK_LANTERN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_PLACE); - public static final CompatSoundEvent BLOCK_LANTERN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_STEP); - public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LARGE_AMETHYST_BUD_BREAK); - public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LARGE_AMETHYST_BUD_PLACE); - public static final CompatSoundEvent BLOCK_LAVA_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_AMBIENT); - public static final CompatSoundEvent BLOCK_LAVA_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_EXTINGUISH); - public static final CompatSoundEvent BLOCK_LAVA_POP = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_POP); - public static final CompatSoundEvent ENTITY_LEASH_KNOT_BREAK = new CompatSoundEvent(SoundEvents.ITEM_LEAD_BREAK); - public static final CompatSoundEvent ENTITY_LEASH_KNOT_PLACE = new CompatSoundEvent(SoundEvents.ITEM_LEAD_TIED); - public static final CompatSoundEvent BLOCK_LEVER_CLICK = new CompatSoundEvent(SoundEvents.BLOCK_LEVER_CLICK); - public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_LIGHTNING_BOLT_IMPACT); - public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_THUNDER = new CompatSoundEvent(SoundEvents.ENTITY_LIGHTNING_BOLT_THUNDER); - public static final CompatSoundEvent ENTITY_LINGERING_POTION_THROW = new CompatSoundEvent(SoundEvents.ENTITY_LINGERING_POTION_THROW); - public static final CompatSoundEvent ENTITY_LLAMA_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_AMBIENT); - public static final CompatSoundEvent ENTITY_LLAMA_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_ANGRY); - public static final CompatSoundEvent ENTITY_LLAMA_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_CHEST); - public static final CompatSoundEvent ENTITY_LLAMA_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_DEATH); - public static final CompatSoundEvent ENTITY_LLAMA_EAT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_EAT); - public static final CompatSoundEvent ENTITY_LLAMA_HURT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_HURT); - public static final CompatSoundEvent ENTITY_LLAMA_SPIT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_SPIT); - public static final CompatSoundEvent ENTITY_LLAMA_STEP = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_STEP); - public static final CompatSoundEvent ENTITY_LLAMA_SWAG = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_SWAG); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_DEATH_SMALL); - public static final CompatSoundEvent BLOCK_LODESTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_BREAK); - public static final CompatSoundEvent BLOCK_LODESTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_STEP); - public static final CompatSoundEvent BLOCK_LODESTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_PLACE); - public static final CompatSoundEvent BLOCK_LODESTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_HIT); - public static final CompatSoundEvent BLOCK_LODESTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_FALL); - public static final CompatSoundEvent ITEM_LODESTONE_COMPASS_LOCK = new CompatSoundEvent(SoundEvents.ITEM_LODESTONE_COMPASS_LOCK); - public static final CompatSoundEvent ITEM_MACE_SMASH_AIR = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_AIR); - public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_GROUND); - public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND_HEAVY = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_GROUND_HEAVY); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_DEATH); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_HURT); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_HURT_SMALL); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_JUMP); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_SQUISH); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_SQUISH_SMALL); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_STEP); - public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MEDIUM_AMETHYST_BUD_BREAK); - public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MEDIUM_AMETHYST_BUD_PLACE); - public static final CompatSoundEvent BLOCK_METAL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_METAL_BREAK); - public static final CompatSoundEvent BLOCK_METAL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_METAL_FALL); - public static final CompatSoundEvent BLOCK_METAL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_METAL_HIT); - public static final CompatSoundEvent BLOCK_METAL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PLACE); - public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_METAL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_METAL_STEP); - public static final CompatSoundEvent ENTITY_MINECART_INSIDE_UNDERWATER = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_INSIDE_UNDERWATER); - public static final CompatSoundEvent ENTITY_MINECART_INSIDE = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_INSIDE); - public static final CompatSoundEvent ENTITY_MINECART_RIDING = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_RIDING); - public static final CompatSoundEvent ENTITY_MOOSHROOM_CONVERT = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_CONVERT); - public static final CompatSoundEvent ENTITY_MOOSHROOM_EAT = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_EAT); - public static final CompatSoundEvent ENTITY_MOOSHROOM_MILK = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_MILK); - public static final CompatSoundEvent ENTITY_MOOSHROOM_SUSPICIOUS_MILK = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_SUSPICIOUS_MILK); - public static final CompatSoundEvent ENTITY_MOOSHROOM_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_SHEAR); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_BREAK); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_FALL); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_HIT); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_PLACE); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_STEP); - public static final CompatSoundEvent BLOCK_PINK_PETALS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_BREAK); - public static final CompatSoundEvent BLOCK_PINK_PETALS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_FALL); - public static final CompatSoundEvent BLOCK_PINK_PETALS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_HIT); - public static final CompatSoundEvent BLOCK_PINK_PETALS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_PLACE); - public static final CompatSoundEvent BLOCK_PINK_PETALS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_STEP); - public static final CompatSoundEvent BLOCK_MOSS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_BREAK); - public static final CompatSoundEvent BLOCK_MOSS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_FALL); - public static final CompatSoundEvent BLOCK_MOSS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_HIT); - public static final CompatSoundEvent BLOCK_MOSS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_PLACE); - public static final CompatSoundEvent BLOCK_MOSS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_STEP); - public static final CompatSoundEvent BLOCK_MUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BREAK); - public static final CompatSoundEvent BLOCK_MUD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUD_FALL); - public static final CompatSoundEvent BLOCK_MUD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUD_HIT); - public static final CompatSoundEvent BLOCK_MUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUD_PLACE); - public static final CompatSoundEvent BLOCK_MUD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUD_STEP); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_STEP); - public static final CompatSoundEvent ENTITY_MULE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_AMBIENT); - public static final CompatSoundEvent ENTITY_MULE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_MULE_ANGRY); - public static final CompatSoundEvent ENTITY_MULE_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_MULE_CHEST); - public static final CompatSoundEvent ENTITY_MULE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_MULE_DEATH); - public static final CompatSoundEvent ENTITY_MULE_EAT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_EAT); - public static final CompatSoundEvent ENTITY_MULE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_HURT); - public static final CompatSoundEvent ENTITY_MULE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_MULE_JUMP); - public static final CompatSoundEvent MUSIC_CREATIVE = new CompatSoundEvent(SoundEvents.MUSIC_CREATIVE); - public static final CompatSoundEvent MUSIC_CREDITS = new CompatSoundEvent(SoundEvents.MUSIC_CREDITS); - public static final CompatSoundEvent MUSIC_DISC_5 = new CompatSoundEvent(SoundEvents.MUSIC_DISC_5); - public static final CompatSoundEvent MUSIC_DISC_11 = new CompatSoundEvent(SoundEvents.MUSIC_DISC_11); - public static final CompatSoundEvent MUSIC_DISC_13 = new CompatSoundEvent(SoundEvents.MUSIC_DISC_13); - public static final CompatSoundEvent MUSIC_DISC_BLOCKS = new CompatSoundEvent(SoundEvents.MUSIC_DISC_BLOCKS); - public static final CompatSoundEvent MUSIC_DISC_CAT = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CAT); - public static final CompatSoundEvent MUSIC_DISC_CHIRP = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CHIRP); - public static final CompatSoundEvent MUSIC_DISC_FAR = new CompatSoundEvent(SoundEvents.MUSIC_DISC_FAR); - public static final CompatSoundEvent MUSIC_DISC_MALL = new CompatSoundEvent(SoundEvents.MUSIC_DISC_MALL); - public static final CompatSoundEvent MUSIC_DISC_MELLOHI = new CompatSoundEvent(SoundEvents.MUSIC_DISC_MELLOHI); - public static final CompatSoundEvent MUSIC_DISC_PIGSTEP = new CompatSoundEvent(SoundEvents.MUSIC_DISC_PIGSTEP); - public static final CompatSoundEvent MUSIC_DISC_STAL = new CompatSoundEvent(SoundEvents.MUSIC_DISC_STAL); - public static final CompatSoundEvent MUSIC_DISC_STRAD = new CompatSoundEvent(SoundEvents.MUSIC_DISC_STRAD); - public static final CompatSoundEvent MUSIC_DISC_WAIT = new CompatSoundEvent(SoundEvents.MUSIC_DISC_WAIT); - public static final CompatSoundEvent MUSIC_DISC_WARD = new CompatSoundEvent(SoundEvents.MUSIC_DISC_WARD); - public static final CompatSoundEvent MUSIC_DISC_OTHERSIDE = new CompatSoundEvent(SoundEvents.MUSIC_DISC_OTHERSIDE); - public static final CompatSoundEvent MUSIC_DISC_RELIC = new CompatSoundEvent(SoundEvents.MUSIC_DISC_RELIC); - public static final CompatSoundEvent MUSIC_DISC_CREATOR = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CREATOR); - public static final CompatSoundEvent MUSIC_DISC_CREATOR_MUSIC_BOX = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CREATOR_MUSIC_BOX); - public static final CompatSoundEvent MUSIC_DISC_PRECIPICE = new CompatSoundEvent(SoundEvents.MUSIC_DISC_PRECIPICE); - public static final CompatSoundEvent MUSIC_DRAGON = new CompatSoundEvent(SoundEvents.MUSIC_DRAGON); - public static final CompatSoundEvent MUSIC_END = new CompatSoundEvent(SoundEvents.MUSIC_END); - public static final CompatSoundEvent MUSIC_GAME = new CompatSoundEvent(SoundEvents.MUSIC_GAME); - public static final CompatSoundEvent MUSIC_MENU = new CompatSoundEvent(SoundEvents.MUSIC_MENU); - public static final CompatSoundEvent MUSIC_NETHER_BASALT_DELTAS = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_BASALT_DELTAS); - public static final CompatSoundEvent MUSIC_NETHER_CRIMSON_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_CRIMSON_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_DEEP_DARK = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DEEP_DARK); - public static final CompatSoundEvent MUSIC_OVERWORLD_DRIPSTONE_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DRIPSTONE_CAVES); - public static final CompatSoundEvent MUSIC_OVERWORLD_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_GROVE); - public static final CompatSoundEvent MUSIC_OVERWORLD_JAGGED_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_JAGGED_PEAKS); - public static final CompatSoundEvent MUSIC_OVERWORLD_LUSH_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_LUSH_CAVES); - public static final CompatSoundEvent MUSIC_OVERWORLD_SWAMP = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SWAMP); - public static final CompatSoundEvent MUSIC_OVERWORLD_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_OLD_GROWTH_TAIGA = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_OLD_GROWTH_TAIGA); - public static final CompatSoundEvent MUSIC_OVERWORLD_MEADOW = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_MEADOW); - public static final CompatSoundEvent MUSIC_OVERWORLD_CHERRY_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_CHERRY_GROVE); - public static final CompatSoundEvent MUSIC_NETHER_NETHER_WASTES = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_NETHER_WASTES); - public static final CompatSoundEvent MUSIC_OVERWORLD_FROZEN_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FROZEN_PEAKS); - public static final CompatSoundEvent MUSIC_OVERWORLD_SNOWY_SLOPES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SNOWY_SLOPES); - public static final CompatSoundEvent MUSIC_NETHER_SOUL_SAND_VALLEY = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_SOUL_SAND_VALLEY); - public static final CompatSoundEvent MUSIC_OVERWORLD_STONY_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_STONY_PEAKS); - public static final CompatSoundEvent MUSIC_NETHER_WARPED_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_WARPED_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_FLOWER_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FLOWER_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_DESERT = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DESERT); - public static final CompatSoundEvent MUSIC_OVERWORLD_BADLANDS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_BADLANDS); - public static final CompatSoundEvent MUSIC_OVERWORLD_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_JUNGLE); - public static final CompatSoundEvent MUSIC_OVERWORLD_SPARSE_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SPARSE_JUNGLE); - public static final CompatSoundEvent MUSIC_OVERWORLD_BAMBOO_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_BAMBOO_JUNGLE); - public static final CompatSoundEvent MUSIC_UNDER_WATER = new CompatSoundEvent(SoundEvents.MUSIC_UNDER_WATER); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_NETHER_WART_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WART_BREAK); - public static final CompatSoundEvent ITEM_NETHER_WART_PLANT = new CompatSoundEvent(SoundEvents.ITEM_NETHER_WART_PLANT); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FALL); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HIT); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_STEP); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FENCE_GATE_OPEN); - public static final CompatSoundEvent INTENTIONALLY_EMPTY = new CompatSoundEvent(SoundEvents.INTENTIONALLY_EMPTY); - public static final CompatSoundEvent BLOCK_PACKED_MUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_BREAK); - public static final CompatSoundEvent BLOCK_PACKED_MUD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_FALL); - public static final CompatSoundEvent BLOCK_PACKED_MUD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_HIT); - public static final CompatSoundEvent BLOCK_PACKED_MUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_PLACE); - public static final CompatSoundEvent BLOCK_PACKED_MUD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_STEP); - public static final CompatSoundEvent BLOCK_STEM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_STEM_BREAK); - public static final CompatSoundEvent BLOCK_STEM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_STEM_STEP); - public static final CompatSoundEvent BLOCK_STEM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_STEM_PLACE); - public static final CompatSoundEvent BLOCK_STEM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_STEM_HIT); - public static final CompatSoundEvent BLOCK_STEM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_STEM_FALL); - public static final CompatSoundEvent BLOCK_NYLIUM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_BREAK); - public static final CompatSoundEvent BLOCK_NYLIUM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_STEP); - public static final CompatSoundEvent BLOCK_NYLIUM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_PLACE); - public static final CompatSoundEvent BLOCK_NYLIUM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_HIT); - public static final CompatSoundEvent BLOCK_NYLIUM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_FALL); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_STEP); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_HIT); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_FALL); - public static final CompatSoundEvent BLOCK_FUNGUS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_BREAK); - public static final CompatSoundEvent BLOCK_FUNGUS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_STEP); - public static final CompatSoundEvent BLOCK_FUNGUS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_PLACE); - public static final CompatSoundEvent BLOCK_FUNGUS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_HIT); - public static final CompatSoundEvent BLOCK_FUNGUS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_FALL); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_BREAK); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_STEP); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_PLACE); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_HIT); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_FALL); - public static final CompatSoundEvent BLOCK_WART_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_WART_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_WART_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_WART_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_WART_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_NETHERRACK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_BREAK); - public static final CompatSoundEvent BLOCK_NETHERRACK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_STEP); - public static final CompatSoundEvent BLOCK_NETHERRACK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_PLACE); - public static final CompatSoundEvent BLOCK_NETHERRACK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_HIT); - public static final CompatSoundEvent BLOCK_NETHERRACK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_FALL); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASEDRUM = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BASEDRUM); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASS = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BASS); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BELL = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BELL); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_CHIME); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_FLUTE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_FLUTE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_GUITAR = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_GUITAR); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HARP = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_HARP); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HAT = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_HAT); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_PLING = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_PLING); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_SNARE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_SNARE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_XYLOPHONE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_XYLOPHONE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IRON_XYLOPHONE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_COW_BELL = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_COW_BELL); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_DIDGERIDOO = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BIT = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BIT); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BANJO = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BANJO); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_SKELETON); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_CREEPER); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_PIGLIN); - public static final CompatSoundEvent ENTITY_OCELOT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_HURT); - public static final CompatSoundEvent ENTITY_OCELOT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_AMBIENT); - public static final CompatSoundEvent ENTITY_OCELOT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_DEATH); - public static final CompatSoundEvent ITEM_OMINOUS_BOTTLE_DISPOSE = new CompatSoundEvent(SoundEvents.ITEM_OMINOUS_BOTTLE_DISPOSE); - public static final CompatSoundEvent ENTITY_PAINTING_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_PAINTING_BREAK); - public static final CompatSoundEvent ENTITY_PAINTING_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_PAINTING_PLACE); - public static final CompatSoundEvent ENTITY_PANDA_PRE_SNEEZE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_PRE_SNEEZE); - public static final CompatSoundEvent ENTITY_PANDA_SNEEZE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_SNEEZE); - public static final CompatSoundEvent ENTITY_PANDA_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_AMBIENT); - public static final CompatSoundEvent ENTITY_PANDA_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_DEATH); - public static final CompatSoundEvent ENTITY_PANDA_EAT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_EAT); - public static final CompatSoundEvent ENTITY_PANDA_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_STEP); - public static final CompatSoundEvent ENTITY_PANDA_CANT_BREED = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_CANT_BREED); - public static final CompatSoundEvent ENTITY_PANDA_AGGRESSIVE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_AGGRESSIVE_AMBIENT); - public static final CompatSoundEvent ENTITY_PANDA_WORRIED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_WORRIED_AMBIENT); - public static final CompatSoundEvent ENTITY_PANDA_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_HURT); - public static final CompatSoundEvent ENTITY_PANDA_BITE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_BITE); - public static final CompatSoundEvent ENTITY_PARROT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_AMBIENT); - public static final CompatSoundEvent ENTITY_PARROT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_DEATH); - public static final CompatSoundEvent ENTITY_PARROT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_EAT); - public static final CompatSoundEvent ENTITY_PARROT_FLY = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_FLY); - public static final CompatSoundEvent ENTITY_PARROT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_HURT); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BLAZE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BLAZE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BOGGED = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BOGGED); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BREEZE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BREEZE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_CREEPER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_DROWNED = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_DROWNED); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ELDER_GUARDIAN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ELDER_GUARDIAN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ENDER_DRAGON); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDERMITE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ENDERMITE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_EVOKER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_EVOKER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GHAST = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_GHAST); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GUARDIAN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_GUARDIAN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HOGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_HOGLIN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HUSK = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_HUSK); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ILLUSIONER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ILLUSIONER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_MAGMA_CUBE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_MAGMA_CUBE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PHANTOM = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PHANTOM); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PIGLIN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN_BRUTE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PIGLIN_BRUTE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PILLAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PILLAGER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_RAVAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_RAVAGER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SHULKER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SHULKER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SILVERFISH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SILVERFISH); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SKELETON); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SLIME = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SLIME); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SPIDER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SPIDER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_STRAY = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_STRAY); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VEX = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_VEX); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VINDICATOR = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_VINDICATOR); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WARDEN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WARDEN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITCH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITCH); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITHER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITHER_SKELETON); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOGLIN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOMBIE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER); - public static final CompatSoundEvent ENTITY_PARROT_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_STEP); - public static final CompatSoundEvent ENTITY_PHANTOM_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_AMBIENT); - public static final CompatSoundEvent ENTITY_PHANTOM_BITE = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_BITE); - public static final CompatSoundEvent ENTITY_PHANTOM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_DEATH); - public static final CompatSoundEvent ENTITY_PHANTOM_FLAP = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_FLAP); - public static final CompatSoundEvent ENTITY_PHANTOM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_HURT); - public static final CompatSoundEvent ENTITY_PHANTOM_SWOOP = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_SWOOP); - public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIG_AMBIENT); - public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIG_DEATH); - public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIG_HURT); - public static final CompatSoundEvent ENTITY_PIG_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_PIG_SADDLE); - public static final CompatSoundEvent ENTITY_PIG_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIG_STEP); - public static final CompatSoundEvent ENTITY_PIGLIN_ADMIRING_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_ADMIRING_ITEM); - public static final CompatSoundEvent ENTITY_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_PIGLIN_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_CELEBRATE); - public static final CompatSoundEvent ENTITY_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_DEATH); - public static final CompatSoundEvent ENTITY_PIGLIN_JEALOUS = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_JEALOUS); - public static final CompatSoundEvent ENTITY_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_HURT); - public static final CompatSoundEvent ENTITY_PIGLIN_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_RETREAT); - public static final CompatSoundEvent ENTITY_PIGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_STEP); - public static final CompatSoundEvent ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_AMBIENT); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_ANGRY); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_DEATH); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_HURT); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_STEP); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED); - public static final CompatSoundEvent ENTITY_PILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_PILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_CELEBRATE); - public static final CompatSoundEvent ENTITY_PILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_DEATH); - public static final CompatSoundEvent ENTITY_PILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_HURT); - public static final CompatSoundEvent BLOCK_PISTON_CONTRACT = new CompatSoundEvent(SoundEvents.BLOCK_PISTON_CONTRACT); - public static final CompatSoundEvent BLOCK_PISTON_EXTEND = new CompatSoundEvent(SoundEvents.BLOCK_PISTON_EXTEND); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_CRIT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_CRIT); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_KNOCKBACK = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_NODAMAGE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_STRONG = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_STRONG); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_SWEEP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_WEAK = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_WEAK); - public static final CompatSoundEvent ENTITY_PLAYER_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BIG_FALL); - public static final CompatSoundEvent ENTITY_PLAYER_BREATH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BREATH); - public static final CompatSoundEvent ENTITY_PLAYER_BURP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BURP); - public static final CompatSoundEvent ENTITY_PLAYER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_DEATH); - public static final CompatSoundEvent ENTITY_PLAYER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_DROWN = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_DROWN); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_FREEZE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_FREEZE); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_ON_FIRE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_ON_FIRE); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH); - public static final CompatSoundEvent ENTITY_PLAYER_LEVELUP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_LEVELUP); - public static final CompatSoundEvent ENTITY_PLAYER_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SMALL_FALL); - public static final CompatSoundEvent ENTITY_PLAYER_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SPLASH); - public static final CompatSoundEvent ENTITY_PLAYER_SPLASH_HIGH_SPEED = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SPLASH_HIGH_SPEED); - public static final CompatSoundEvent ENTITY_PLAYER_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SWIM); - public static final CompatSoundEvent ENTITY_PLAYER_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_TELEPORT); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_AMBIENT); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT_BABY = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_AMBIENT_BABY); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_DEATH); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_HURT = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_HURT); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_STEP = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_STEP); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_WARNING = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_WARNING); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_BREAK); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_FALL); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_HIT); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_PLACE); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_STEP); - public static final CompatSoundEvent BLOCK_PORTAL_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_AMBIENT); - public static final CompatSoundEvent BLOCK_PORTAL_TRAVEL = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_TRAVEL); - public static final CompatSoundEvent BLOCK_PORTAL_TRIGGER = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_TRIGGER); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_BREAK); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_FALL); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_HIT); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_PLACE); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_STEP); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_STING); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_OUT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_BLOW_OUT); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_UP = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_BLOW_UP); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_DEATH); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_FLOP); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_HURT); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_STING = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_STING); - public static final CompatSoundEvent BLOCK_PUMPKIN_CARVE = new CompatSoundEvent(SoundEvents.BLOCK_PUMPKIN_CARVE); - public static final CompatSoundEvent ENTITY_RABBIT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_AMBIENT); - public static final CompatSoundEvent ENTITY_RABBIT_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_ATTACK); - public static final CompatSoundEvent ENTITY_RABBIT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_DEATH); - public static final CompatSoundEvent ENTITY_RABBIT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_HURT); - public static final CompatSoundEvent ENTITY_RABBIT_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_JUMP); - public static final CompatSoundEvent EVENT_RAID_HORN = new CompatSoundEvent(SoundEvents.EVENT_RAID_HORN); - public static final CompatSoundEvent ENTITY_RAVAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_RAVAGER_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_ATTACK); - public static final CompatSoundEvent ENTITY_RAVAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_CELEBRATE); - public static final CompatSoundEvent ENTITY_RAVAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_DEATH); - public static final CompatSoundEvent ENTITY_RAVAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_HURT); - public static final CompatSoundEvent ENTITY_RAVAGER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_STEP); - public static final CompatSoundEvent ENTITY_RAVAGER_STUNNED = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_STUNNED); - public static final CompatSoundEvent ENTITY_RAVAGER_ROAR = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_ROAR); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_FALL); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_HIT); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_STEP); - public static final CompatSoundEvent BLOCK_NETHER_ORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_ORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_FALL); - public static final CompatSoundEvent BLOCK_NETHER_ORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_HIT); - public static final CompatSoundEvent BLOCK_NETHER_ORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_ORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_STEP); - public static final CompatSoundEvent BLOCK_REDSTONE_TORCH_BURNOUT = new CompatSoundEvent(SoundEvents.BLOCK_REDSTONE_TORCH_BURNOUT); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_AMBIENT); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_CHARGE = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_CHARGE); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_DEPLETE = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_DEPLETE); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_SET_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_SET_SPAWN); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_BREAK); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_FALL); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_HIT); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_PLACE); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_STEP); - public static final CompatSoundEvent ENTITY_SALMON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_AMBIENT); - public static final CompatSoundEvent ENTITY_SALMON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_DEATH); - public static final CompatSoundEvent ENTITY_SALMON_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_FLOP); - public static final CompatSoundEvent ENTITY_SALMON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_HURT); - public static final CompatSoundEvent BLOCK_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SAND_BREAK); - public static final CompatSoundEvent BLOCK_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SAND_FALL); - public static final CompatSoundEvent BLOCK_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SAND_HIT); - public static final CompatSoundEvent BLOCK_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SAND_PLACE); - public static final CompatSoundEvent BLOCK_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SAND_STEP); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_BREAK); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_FALL); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_HIT); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_PLACE); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_STEP); - public static final CompatSoundEvent BLOCK_SCULK_SPREAD = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SPREAD); - public static final CompatSoundEvent BLOCK_SCULK_CHARGE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CHARGE); - public static final CompatSoundEvent BLOCK_SCULK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_FALL); - public static final CompatSoundEvent BLOCK_SCULK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_HIT); - public static final CompatSoundEvent BLOCK_SCULK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_STEP); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BLOOM = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_BLOOM); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_FALL); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_HIT); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_STEP); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_CLICKING); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING_STOP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_CLICKING_STOP); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_FALL); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_HIT); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_STEP); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_FALL); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_HIT); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_SHRIEK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_SHRIEK); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_STEP); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_FALL); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_HIT); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_STEP); - public static final CompatSoundEvent ENTITY_SHEEP_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_AMBIENT); - public static final CompatSoundEvent ENTITY_SHEEP_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_DEATH); - public static final CompatSoundEvent ENTITY_SHEEP_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_HURT); - public static final CompatSoundEvent ENTITY_SHEEP_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_SHEAR); - public static final CompatSoundEvent ENTITY_SHEEP_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_STEP); - public static final CompatSoundEvent ITEM_SHIELD_BLOCK = new CompatSoundEvent(SoundEvents.ITEM_SHIELD_BLOCK); - public static final CompatSoundEvent ITEM_SHIELD_BREAK = new CompatSoundEvent(SoundEvents.ITEM_SHIELD_BREAK); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_BREAK); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_STEP); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_PLACE); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_HIT); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_FALL); - public static final CompatSoundEvent ITEM_SHOVEL_FLATTEN = new CompatSoundEvent(SoundEvents.ITEM_SHOVEL_FLATTEN); - public static final CompatSoundEvent ENTITY_SHULKER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_AMBIENT); - public static final CompatSoundEvent BLOCK_SHULKER_BOX_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_SHULKER_BOX_CLOSE); - public static final CompatSoundEvent BLOCK_SHULKER_BOX_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_SHULKER_BOX_OPEN); - public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HIT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_BULLET_HIT); - public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_BULLET_HURT); - public static final CompatSoundEvent ENTITY_SHULKER_CLOSE = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_CLOSE); - public static final CompatSoundEvent ENTITY_SHULKER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_DEATH); - public static final CompatSoundEvent ENTITY_SHULKER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_HURT); - public static final CompatSoundEvent ENTITY_SHULKER_HURT_CLOSED = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_HURT_CLOSED); - public static final CompatSoundEvent ENTITY_SHULKER_OPEN = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_OPEN); - public static final CompatSoundEvent ENTITY_SHULKER_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_SHOOT); - public static final CompatSoundEvent ENTITY_SHULKER_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_TELEPORT); - public static final CompatSoundEvent ENTITY_SILVERFISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_AMBIENT); - public static final CompatSoundEvent ENTITY_SILVERFISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_DEATH); - public static final CompatSoundEvent ENTITY_SILVERFISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_HURT); - public static final CompatSoundEvent ENTITY_SILVERFISH_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_STEP); - public static final CompatSoundEvent ENTITY_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_AMBIENT); - public static final CompatSoundEvent ENTITY_SKELETON_CONVERTED_TO_STRAY = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_CONVERTED_TO_STRAY); - public static final CompatSoundEvent ENTITY_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_DEATH); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_AMBIENT); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_DEATH); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_HURT); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_SWIM); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_AMBIENT_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_GALLOP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_GALLOP_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_JUMP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_JUMP_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_STEP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_STEP_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HURT); - public static final CompatSoundEvent ENTITY_SKELETON_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_SHOOT); - public static final CompatSoundEvent ENTITY_SKELETON_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_STEP); - public static final CompatSoundEvent ENTITY_SLIME_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_ATTACK); - public static final CompatSoundEvent ENTITY_SLIME_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_DEATH); - public static final CompatSoundEvent ENTITY_SLIME_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_HURT); - public static final CompatSoundEvent ENTITY_SLIME_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_JUMP); - public static final CompatSoundEvent ENTITY_SLIME_SQUISH = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_SQUISH); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_AMETHYST_BUD_BREAK); - public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_AMETHYST_BUD_PLACE); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_BREAK); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_FALL); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_HIT); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_PLACE); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_STEP); - public static final CompatSoundEvent BLOCK_SOUL_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_BREAK); - public static final CompatSoundEvent BLOCK_SOUL_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_STEP); - public static final CompatSoundEvent BLOCK_SOUL_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_PLACE); - public static final CompatSoundEvent BLOCK_SOUL_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_HIT); - public static final CompatSoundEvent BLOCK_SOUL_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_FALL); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_BREAK); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_STEP); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_PLACE); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_HIT); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_FALL); - public static final CompatSoundEvent PARTICLE_SOUL_ESCAPE = new CompatSoundEvent(SoundEvents.PARTICLE_SOUL_ESCAPE); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_BREAK); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_FALL); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_HIT); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_PLACE); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_STEP); - public static final CompatSoundEvent ENTITY_STRIDER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_AMBIENT); - public static final CompatSoundEvent ENTITY_STRIDER_HAPPY = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_HAPPY); - public static final CompatSoundEvent ENTITY_STRIDER_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_RETREAT); - public static final CompatSoundEvent ENTITY_STRIDER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_DEATH); - public static final CompatSoundEvent ENTITY_STRIDER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_HURT); - public static final CompatSoundEvent ENTITY_STRIDER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_STEP); - public static final CompatSoundEvent ENTITY_STRIDER_STEP_LAVA = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_STEP_LAVA); - public static final CompatSoundEvent ENTITY_STRIDER_EAT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_EAT); - public static final CompatSoundEvent ENTITY_STRIDER_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_SADDLE); - public static final CompatSoundEvent ENTITY_SLIME_DEATH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_DEATH_SMALL); - public static final CompatSoundEvent ENTITY_SLIME_HURT_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_HURT_SMALL); - public static final CompatSoundEvent ENTITY_SLIME_JUMP_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_JUMP_SMALL); - public static final CompatSoundEvent ENTITY_SLIME_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_SQUISH_SMALL); - public static final CompatSoundEvent BLOCK_SMITHING_TABLE_USE = new CompatSoundEvent(SoundEvents.BLOCK_SMITHING_TABLE_USE); - public static final CompatSoundEvent BLOCK_SMOKER_SMOKE = new CompatSoundEvent(SoundEvents.BLOCK_SMOKER_SMOKE); - public static final CompatSoundEvent ENTITY_SNIFFER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_STEP); - public static final CompatSoundEvent ENTITY_SNIFFER_EAT = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_EAT); - public static final CompatSoundEvent ENTITY_SNIFFER_IDLE = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_IDLE); - public static final CompatSoundEvent ENTITY_SNIFFER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_HURT); - public static final CompatSoundEvent ENTITY_SNIFFER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DEATH); - public static final CompatSoundEvent ENTITY_SNIFFER_DROP_SEED = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DROP_SEED); - public static final CompatSoundEvent ENTITY_SNIFFER_SCENTING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SCENTING); - public static final CompatSoundEvent ENTITY_SNIFFER_SNIFFING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SNIFFING); - public static final CompatSoundEvent ENTITY_SNIFFER_SEARCHING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SEARCHING); - public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DIGGING); - public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING_STOP = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DIGGING_STOP); - public static final CompatSoundEvent ENTITY_SNIFFER_HAPPY = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_HAPPY); - public static final CompatSoundEvent BLOCK_SNIFFER_EGG_PLOP = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_PLOP); - public static final CompatSoundEvent BLOCK_SNIFFER_EGG_CRACK = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_CRACK); - public static final CompatSoundEvent BLOCK_SNIFFER_EGG_HATCH = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_HATCH); - public static final CompatSoundEvent ENTITY_SNOWBALL_THROW = new CompatSoundEvent(SoundEvents.ENTITY_SNOWBALL_THROW); - public static final CompatSoundEvent BLOCK_SNOW_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_BREAK); - public static final CompatSoundEvent BLOCK_SNOW_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_FALL); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_AMBIENT); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_DEATH); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_HURT); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_SHOOT); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_SHEAR); - public static final CompatSoundEvent BLOCK_SNOW_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_HIT); - public static final CompatSoundEvent BLOCK_SNOW_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_PLACE); - public static final CompatSoundEvent BLOCK_SNOW_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_STEP); - public static final CompatSoundEvent ENTITY_SPIDER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_AMBIENT); - public static final CompatSoundEvent ENTITY_SPIDER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_DEATH); - public static final CompatSoundEvent ENTITY_SPIDER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_HURT); - public static final CompatSoundEvent ENTITY_SPIDER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_STEP); - public static final CompatSoundEvent ENTITY_SPLASH_POTION_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_SPLASH_POTION_BREAK); - public static final CompatSoundEvent ENTITY_SPLASH_POTION_THROW = new CompatSoundEvent(SoundEvents.ENTITY_SPLASH_POTION_THROW); - public static final CompatSoundEvent BLOCK_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_BREAK); - public static final CompatSoundEvent BLOCK_SPONGE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_FALL); - public static final CompatSoundEvent BLOCK_SPONGE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_HIT); - public static final CompatSoundEvent BLOCK_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_PLACE); - public static final CompatSoundEvent BLOCK_SPONGE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_STEP); - public static final CompatSoundEvent BLOCK_SPONGE_ABSORB = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_ABSORB); - public static final CompatSoundEvent ITEM_SPYGLASS_USE = new CompatSoundEvent(SoundEvents.ITEM_SPYGLASS_USE); - public static final CompatSoundEvent ITEM_SPYGLASS_STOP_USING = new CompatSoundEvent(SoundEvents.ITEM_SPYGLASS_STOP_USING); - public static final CompatSoundEvent ENTITY_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_AMBIENT); - public static final CompatSoundEvent ENTITY_SQUID_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_DEATH); - public static final CompatSoundEvent ENTITY_SQUID_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_HURT); - public static final CompatSoundEvent ENTITY_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_SQUIRT); - public static final CompatSoundEvent BLOCK_STONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BREAK); - public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_STONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_STONE_FALL); - public static final CompatSoundEvent BLOCK_STONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_STONE_HIT); - public static final CompatSoundEvent BLOCK_STONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PLACE); - public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_STONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_STONE_STEP); - public static final CompatSoundEvent ENTITY_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_AMBIENT); - public static final CompatSoundEvent ENTITY_STRAY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_DEATH); - public static final CompatSoundEvent ENTITY_STRAY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_HURT); - public static final CompatSoundEvent ENTITY_STRAY_STEP = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_STEP); - public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_BREAK); - public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_PLACE); - public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES); - public static final CompatSoundEvent ENTITY_TADPOLE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_DEATH); - public static final CompatSoundEvent ENTITY_TADPOLE_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_FLOP); - public static final CompatSoundEvent ENTITY_TADPOLE_GROW_UP = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_GROW_UP); - public static final CompatSoundEvent ENTITY_TADPOLE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_HURT); - public static final CompatSoundEvent ENCHANT_THORNS_HIT = new CompatSoundEvent(SoundEvents.ENCHANT_THORNS_HIT); - public static final CompatSoundEvent ENTITY_TNT_PRIMED = new CompatSoundEvent(SoundEvents.ENTITY_TNT_PRIMED); - public static final CompatSoundEvent ITEM_TOTEM_USE = new CompatSoundEvent(SoundEvents.ITEM_TOTEM_USE); - public static final CompatSoundEvent ITEM_TRIDENT_HIT = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_HIT); - public static final CompatSoundEvent ITEM_TRIDENT_HIT_GROUND = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_HIT_GROUND); - public static final CompatSoundEvent ITEM_TRIDENT_RETURN = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RETURN); - public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_1 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_1); - public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_2 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_2); - public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_3 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_3); - public static final CompatSoundEvent ITEM_TRIDENT_THROW = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_THROW); - public static final CompatSoundEvent ITEM_TRIDENT_THUNDER = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_THUNDER); - public static final CompatSoundEvent BLOCK_TRIPWIRE_ATTACH = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_ATTACH); - public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_CLICK_ON); - public static final CompatSoundEvent BLOCK_TRIPWIRE_DETACH = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_DETACH); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_AMBIENT); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_DEATH); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_FLOP); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_HURT); - public static final CompatSoundEvent BLOCK_TUFF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BREAK); - public static final CompatSoundEvent BLOCK_TUFF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_STEP); - public static final CompatSoundEvent BLOCK_TUFF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_PLACE); - public static final CompatSoundEvent BLOCK_TUFF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_HIT); - public static final CompatSoundEvent BLOCK_TUFF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_FALL); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_BREAK); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_FALL); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_HIT); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_PLACE); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_STEP); - public static final CompatSoundEvent ENTITY_TURTLE_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_AMBIENT_LAND); - public static final CompatSoundEvent ENTITY_TURTLE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_DEATH); - public static final CompatSoundEvent ENTITY_TURTLE_DEATH_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_DEATH_BABY); - public static final CompatSoundEvent ENTITY_TURTLE_EGG_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_BREAK); - public static final CompatSoundEvent ENTITY_TURTLE_EGG_CRACK = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_CRACK); - public static final CompatSoundEvent ENTITY_TURTLE_EGG_HATCH = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_HATCH); - public static final CompatSoundEvent ENTITY_TURTLE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_HURT); - public static final CompatSoundEvent ENTITY_TURTLE_HURT_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_HURT_BABY); - public static final CompatSoundEvent ENTITY_TURTLE_LAY_EGG = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_LAY_EGG); - public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SHAMBLE); - public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SHAMBLE_BABY); - public static final CompatSoundEvent ENTITY_TURTLE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SWIM); - public static final CompatSoundEvent UI_BUTTON_CLICK = new CompatSoundEvent(SoundEvents.UI_BUTTON_CLICK); - public static final CompatSoundEvent UI_LOOM_SELECT_PATTERN = new CompatSoundEvent(SoundEvents.UI_LOOM_SELECT_PATTERN); - public static final CompatSoundEvent UI_LOOM_TAKE_RESULT = new CompatSoundEvent(SoundEvents.UI_LOOM_TAKE_RESULT); - public static final CompatSoundEvent UI_CARTOGRAPHY_TABLE_TAKE_RESULT = new CompatSoundEvent(SoundEvents.UI_CARTOGRAPHY_TABLE_TAKE_RESULT); - public static final CompatSoundEvent UI_STONECUTTER_TAKE_RESULT = new CompatSoundEvent(SoundEvents.UI_STONECUTTER_TAKE_RESULT); - public static final CompatSoundEvent UI_STONECUTTER_SELECT_RECIPE = new CompatSoundEvent(SoundEvents.UI_STONECUTTER_SELECT_RECIPE); - public static final CompatSoundEvent UI_TOAST_CHALLENGE_COMPLETE = new CompatSoundEvent(SoundEvents.UI_TOAST_CHALLENGE_COMPLETE); - public static final CompatSoundEvent UI_TOAST_IN = new CompatSoundEvent(SoundEvents.UI_TOAST_IN); - public static final CompatSoundEvent UI_TOAST_OUT = new CompatSoundEvent(SoundEvents.UI_TOAST_OUT); - public static final CompatSoundEvent BLOCK_VAULT_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_ACTIVATE); - public static final CompatSoundEvent BLOCK_VAULT_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_AMBIENT); - public static final CompatSoundEvent BLOCK_VAULT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_BREAK); - public static final CompatSoundEvent BLOCK_VAULT_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_CLOSE_SHUTTER); - public static final CompatSoundEvent BLOCK_VAULT_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_DEACTIVATE); - public static final CompatSoundEvent BLOCK_VAULT_EJECT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_EJECT_ITEM); - public static final CompatSoundEvent BLOCK_VAULT_REJECT_REWARDED_PLAYER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_REJECT_REWARDED_PLAYER); - public static final CompatSoundEvent BLOCK_VAULT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_FALL); - public static final CompatSoundEvent BLOCK_VAULT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_HIT); - public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_INSERT_ITEM); - public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_INSERT_ITEM_FAIL); - public static final CompatSoundEvent BLOCK_VAULT_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_OPEN_SHUTTER); - public static final CompatSoundEvent BLOCK_VAULT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_PLACE); - public static final CompatSoundEvent BLOCK_VAULT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_STEP); - public static final CompatSoundEvent ENTITY_VEX_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VEX_AMBIENT); - public static final CompatSoundEvent ENTITY_VEX_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_VEX_CHARGE); - public static final CompatSoundEvent ENTITY_VEX_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VEX_DEATH); - public static final CompatSoundEvent ENTITY_VEX_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VEX_HURT); - public static final CompatSoundEvent ENTITY_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_VILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_CELEBRATE); - public static final CompatSoundEvent ENTITY_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_DEATH); - public static final CompatSoundEvent ENTITY_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_HURT); - public static final CompatSoundEvent ENTITY_VILLAGER_NO = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_NO); - public static final CompatSoundEvent ENTITY_VILLAGER_TRADE = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_TRADE); - public static final CompatSoundEvent ENTITY_VILLAGER_YES = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_YES); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_ARMORER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_ARMORER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_BUTCHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_BUTCHER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CARTOGRAPHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_CARTOGRAPHER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CLERIC = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_CLERIC); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FARMER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FARMER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FISHERMAN = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FISHERMAN); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FLETCHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FLETCHER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LEATHERWORKER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_LEATHERWORKER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LIBRARIAN = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_MASON = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_MASON); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_SHEPHERD = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_SHEPHERD); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_TOOLSMITH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_WEAPONSMITH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_WEAPONSMITH); - public static final CompatSoundEvent ENTITY_VINDICATOR_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_AMBIENT); - public static final CompatSoundEvent ENTITY_VINDICATOR_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_CELEBRATE); - public static final CompatSoundEvent ENTITY_VINDICATOR_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_DEATH); - public static final CompatSoundEvent ENTITY_VINDICATOR_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_HURT); - public static final CompatSoundEvent BLOCK_VINE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_VINE_BREAK); - public static final CompatSoundEvent BLOCK_VINE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_VINE_FALL); - public static final CompatSoundEvent BLOCK_VINE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_VINE_HIT); - public static final CompatSoundEvent BLOCK_VINE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_VINE_PLACE); - public static final CompatSoundEvent BLOCK_VINE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_VINE_STEP); - public static final CompatSoundEvent BLOCK_LILY_PAD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LILY_PAD_PLACE); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_AMBIENT); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DEATH); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DISAPPEARED = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DISAPPEARED); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_MILK = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DRINK_MILK); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_POTION = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DRINK_POTION); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_HURT); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_NO = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_NO); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_REAPPEARED = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_REAPPEARED); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_TRADE = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_TRADE); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_YES = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_YES); - public static final CompatSoundEvent ENTITY_WARDEN_AGITATED = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_AGITATED); - public static final CompatSoundEvent ENTITY_WARDEN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_AMBIENT); - public static final CompatSoundEvent ENTITY_WARDEN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ANGRY); - public static final CompatSoundEvent ENTITY_WARDEN_ATTACK_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ATTACK_IMPACT); - public static final CompatSoundEvent ENTITY_WARDEN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_DEATH); - public static final CompatSoundEvent ENTITY_WARDEN_DIG = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_DIG); - public static final CompatSoundEvent ENTITY_WARDEN_EMERGE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_EMERGE); - public static final CompatSoundEvent ENTITY_WARDEN_HEARTBEAT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_HEARTBEAT); - public static final CompatSoundEvent ENTITY_WARDEN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_HURT); - public static final CompatSoundEvent ENTITY_WARDEN_LISTENING = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_LISTENING); - public static final CompatSoundEvent ENTITY_WARDEN_LISTENING_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_LISTENING_ANGRY); - public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSE); - public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSER = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSER); - public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSEST = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSEST); - public static final CompatSoundEvent ENTITY_WARDEN_ROAR = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ROAR); - public static final CompatSoundEvent ENTITY_WARDEN_SNIFF = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SNIFF); - public static final CompatSoundEvent ENTITY_WARDEN_SONIC_BOOM = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SONIC_BOOM); - public static final CompatSoundEvent ENTITY_WARDEN_SONIC_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SONIC_CHARGE); - public static final CompatSoundEvent ENTITY_WARDEN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_STEP); - public static final CompatSoundEvent ENTITY_WARDEN_TENDRIL_CLICKS = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_TENDRIL_CLICKS); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL); - public static final CompatSoundEvent BLOCK_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_SIGN_WAXED_INTERACT_FAIL); - public static final CompatSoundEvent BLOCK_WATER_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_WATER_AMBIENT); - public static final CompatSoundEvent WEATHER_RAIN = new CompatSoundEvent(SoundEvents.WEATHER_RAIN); - public static final CompatSoundEvent WEATHER_RAIN_ABOVE = new CompatSoundEvent(SoundEvents.WEATHER_RAIN_ABOVE); - public static final CompatSoundEvent BLOCK_WET_GRASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_BREAK); - public static final CompatSoundEvent BLOCK_WET_GRASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_FALL); - public static final CompatSoundEvent BLOCK_WET_GRASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_HIT); - public static final CompatSoundEvent BLOCK_WET_GRASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_PLACE); - public static final CompatSoundEvent BLOCK_WET_GRASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_STEP); - public static final CompatSoundEvent BLOCK_WET_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_BREAK); - public static final CompatSoundEvent BLOCK_WET_SPONGE_DRIES = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_DRIES); - public static final CompatSoundEvent BLOCK_WET_SPONGE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_FALL); - public static final CompatSoundEvent BLOCK_WET_SPONGE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_HIT); - public static final CompatSoundEvent BLOCK_WET_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_PLACE); - public static final CompatSoundEvent BLOCK_WET_SPONGE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_STEP); - public static final CompatSoundEvent ENTITY_WIND_CHARGE_WIND_BURST = new CompatSoundEvent(SoundEvents.ENTITY_WIND_CHARGE_WIND_BURST); - public static final CompatSoundEvent ENTITY_WIND_CHARGE_THROW = new CompatSoundEvent(SoundEvents.ENTITY_WIND_CHARGE_THROW); - public static final CompatSoundEvent ENTITY_WITCH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_AMBIENT); - public static final CompatSoundEvent ENTITY_WITCH_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_CELEBRATE); - public static final CompatSoundEvent ENTITY_WITCH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_DEATH); - public static final CompatSoundEvent ENTITY_WITCH_DRINK = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_DRINK); - public static final CompatSoundEvent ENTITY_WITCH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_HURT); - public static final CompatSoundEvent ENTITY_WITCH_THROW = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_THROW); - public static final CompatSoundEvent ENTITY_WITHER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_AMBIENT); - public static final CompatSoundEvent ENTITY_WITHER_BREAK_BLOCK = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_BREAK_BLOCK); - public static final CompatSoundEvent ENTITY_WITHER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_DEATH); - public static final CompatSoundEvent ENTITY_WITHER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_HURT); - public static final CompatSoundEvent ENTITY_WITHER_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SHOOT); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_AMBIENT); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_DEATH); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_HURT); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_STEP); - public static final CompatSoundEvent ENTITY_WITHER_SPAWN = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SPAWN); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_BREAK = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_BREAK); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_CRACK = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_CRACK); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_DAMAGE = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_DAMAGE); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_REPAIR = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_REPAIR); - public static final CompatSoundEvent ENTITY_WOLF_AMBIENT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).ambientSound()); - public static final CompatSoundEvent ENTITY_WOLF_DEATH = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).deathSound()); - public static final CompatSoundEvent ENTITY_WOLF_GROWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).growlSound()); - public static final CompatSoundEvent ENTITY_WOLF_HOWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).ambientSound()); - public static final CompatSoundEvent ENTITY_WOLF_HURT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).hurtSound()); - public static final CompatSoundEvent ENTITY_WOLF_PANT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).pantSound()); - public static final CompatSoundEvent ENTITY_WOLF_SHAKE = new CompatSoundEvent(SoundEvents.ENTITY_WOLF_SHAKE); - public static final CompatSoundEvent ENTITY_WOLF_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WOLF_STEP); - public static final CompatSoundEvent ENTITY_WOLF_WHINE = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).whineSound()); - public static final CompatSoundEvent BLOCK_WOODEN_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_WOODEN_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_FALL); - public static final CompatSoundEvent BLOCK_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_HIT); - public static final CompatSoundEvent BLOCK_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_STEP); - public static final CompatSoundEvent BLOCK_WOOL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_BREAK); - public static final CompatSoundEvent BLOCK_WOOL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_FALL); - public static final CompatSoundEvent BLOCK_WOOL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_HIT); - public static final CompatSoundEvent BLOCK_WOOL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_PLACE); - public static final CompatSoundEvent BLOCK_WOOL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_STEP); - public static final CompatSoundEvent ENTITY_ZOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_ZOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_ATTACK); - public static final CompatSoundEvent ENTITY_ZOGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_DEATH); - public static final CompatSoundEvent ENTITY_ZOGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_HURT); - public static final CompatSoundEvent ENTITY_ZOGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_STEP); - public static final CompatSoundEvent ENTITY_ZOMBIE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR); - public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_IRON_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_ATTACK_IRON_DOOR); - public static final CompatSoundEvent ENTITY_ZOMBIE_BREAK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR); - public static final CompatSoundEvent ENTITY_ZOMBIE_CONVERTED_TO_DROWNED = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_CONVERTED_TO_DROWNED); - public static final CompatSoundEvent ENTITY_ZOMBIE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIE_DESTROY_EGG = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_DESTROY_EGG); - public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_INFECT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_INFECT); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_STEP); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CONVERTED = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CONVERTED); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CURE = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_STEP); - public static final CompatSoundEvent EVENT_MOB_EFFECT_BAD_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_BAD_OMEN); - public static final CompatSoundEvent EVENT_MOB_EFFECT_TRIAL_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_TRIAL_OMEN); - public static final CompatSoundEvent EVENT_MOB_EFFECT_RAID_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_RAID_OMEN); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_EQUIP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_EQUIP); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_AMBIENT); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_DEATH); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HURT); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_RIDING = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_RIDING); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_UNEQUIP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_UNEQUIP); - - static { - GOAT_HORN_SOUNDS = SoundEvents.GOAT_HORN_SOUNDS.stream().map(CompatSoundEvent::new).collect(ImmutableList.toImmutableList()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java deleted file mode 100644 index c9a68ee56..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.sound; - -import net.minecraft.sound.SoundEvent; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; - -public class RegistryResultCompatSoundEvent extends CompatSoundEvent { - - public RegistryResult result; - - public RegistryResultCompatSoundEvent(RegistryResult result) { - super((SoundEvent) null); - this.result = result; - } - - public static RegistryResultCompatSoundEvent of(RegistryResult result) { - return new RegistryResultCompatSoundEvent(result); - } - - @Override - public SoundEvent get() { - if ((result == null || result.getOrNull() == null) && super.get() != null) - return super.get(); - - return result.get(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java deleted file mode 100644 index a6b7775be..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.api.state.property; - -public class BooleanProperty implements IProperty { - - private final net.minecraft.state.property.BooleanProperty property; - - public BooleanProperty(String name) { - this(net.minecraft.state.property.BooleanProperty.of(name)); - } - - public BooleanProperty(net.minecraft.state.property.BooleanProperty property) { - this.property = property; - } - - public static BooleanProperty of(String name) { - return new BooleanProperty(name); - } - - public static BooleanProperty of(net.minecraft.state.property.BooleanProperty property) { - return new BooleanProperty(property); - } - - @Override - public net.minecraft.state.property.BooleanProperty getProperty() { - return property; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java deleted file mode 100644 index 92cd6000a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java +++ /dev/null @@ -1,117 +0,0 @@ -package net.pitan76.mcpitanlib.api.state.property; - -import net.minecraft.block.enums.*; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.StringIdentifiable; -import net.minecraft.util.math.Direction; - -public class CompatProperties { - public static final DirectionProperty FACING = new DirectionProperty(Properties.FACING); - public static final DirectionProperty HORIZONTAL_FACING = new DirectionProperty(Properties.HORIZONTAL_FACING); - public static final DirectionProperty HOPPER_FACING = new DirectionProperty(Properties.HOPPER_FACING); - public static final DirectionProperty VERTICAL_DIRECTION = new DirectionProperty(Properties.VERTICAL_DIRECTION); - - public static final BooleanProperty POWERED = new BooleanProperty(Properties.POWERED); - public static final BooleanProperty ENABLED = new BooleanProperty(Properties.ENABLED); - public static final BooleanProperty WATERLOGGED = new BooleanProperty(Properties.WATERLOGGED); - public static final BooleanProperty LIT = new BooleanProperty(Properties.LIT); - public static final BooleanProperty OCCUPIED = new BooleanProperty(Properties.OCCUPIED); - public static final BooleanProperty ATTACHED = new BooleanProperty(Properties.ATTACHED); - public static final BooleanProperty HANGING = new BooleanProperty(Properties.HANGING); - public static final BooleanProperty BOTTOM = new BooleanProperty(Properties.BOTTOM); - public static final BooleanProperty OPEN = new BooleanProperty(Properties.OPEN); - public static final BooleanProperty UNSTABLE = new BooleanProperty(Properties.UNSTABLE); - public static final BooleanProperty UP = new BooleanProperty(Properties.UP); - public static final BooleanProperty DOWN = new BooleanProperty(Properties.DOWN); - public static final BooleanProperty NORTH = new BooleanProperty(Properties.NORTH); - public static final BooleanProperty EAST = new BooleanProperty(Properties.EAST); - public static final BooleanProperty SOUTH = new BooleanProperty(Properties.SOUTH); - public static final BooleanProperty WEST = new BooleanProperty(Properties.WEST); - - public static final IntProperty POWER = new IntProperty(Properties.POWER); - public static final IntProperty LAYERS = new IntProperty(Properties.LAYERS); - public static final IntProperty NOTE = new IntProperty(Properties.NOTE); - public static final IntProperty ROTATION = new IntProperty(Properties.ROTATION); - public static final IntProperty EGGS = new IntProperty(Properties.EGGS); - public static final IntProperty DELAY = new IntProperty(Properties.DELAY); - - public static final EnumProperty BLOCK_HALF = new EnumProperty<>(Properties.BLOCK_HALF); - public static final EnumProperty STAIR_SHAPE = new EnumProperty<>(Properties.STAIR_SHAPE); - public static final EnumProperty SLAB_TYPE = new EnumProperty<>(Properties.SLAB_TYPE); - public static final EnumProperty CHEST_TYPE = new EnumProperty<>(Properties.CHEST_TYPE); - public static final EnumProperty PISTON_TYPE = new EnumProperty<>(Properties.PISTON_TYPE); - public static final EnumProperty AXIS = new EnumProperty<>(Properties.AXIS); - public static final EnumProperty HORIZONTAL_AXIS = new EnumProperty<>(Properties.HORIZONTAL_AXIS); - public static final EnumProperty COMPARATOR_MODE = new EnumProperty<>(Properties.COMPARATOR_MODE); - - public static IProperty of(Property property) { - if (property instanceof net.minecraft.state.property.IntProperty) { - return of((net.minecraft.state.property.IntProperty) property); - } - if (property instanceof net.minecraft.state.property.BooleanProperty) { - return of((net.minecraft.state.property.BooleanProperty) property); - } - if (property instanceof net.minecraft.state.property.EnumProperty) { - if (property.getType() == Direction.class) { - return ofDir((net.minecraft.state.property.EnumProperty) property); - } - return of((net.minecraft.state.property.EnumProperty) property); - } - return UnknownProperty.of(property); - } - - public static IntProperty of(net.minecraft.state.property.IntProperty property) { - if (property == Properties.POWER) return POWER; - if (property == Properties.LAYERS) return LAYERS; - if (property == Properties.NOTE) return NOTE; - if (property == Properties.ROTATION) return ROTATION; - if (property == Properties.EGGS) return EGGS; - if (property == Properties.DELAY) return DELAY; - - return new IntProperty(property); - } - - public static BooleanProperty of(net.minecraft.state.property.BooleanProperty property) { - if (property == Properties.POWERED) return POWERED; - if (property == Properties.ENABLED) return ENABLED; - if (property == Properties.WATERLOGGED) return WATERLOGGED; - if (property == Properties.LIT) return LIT; - if (property == Properties.OCCUPIED) return OCCUPIED; - if (property == Properties.ATTACHED) return ATTACHED; - if (property == Properties.HANGING) return HANGING; - if (property == Properties.BOTTOM) return BOTTOM; - if (property == Properties.OPEN) return OPEN; - if (property == Properties.UNSTABLE) return UNSTABLE; - if (property == Properties.UP) return UP; - if (property == Properties.DOWN) return DOWN; - if (property == Properties.NORTH) return NORTH; - if (property == Properties.EAST) return EAST; - if (property == Properties.SOUTH) return SOUTH; - if (property == Properties.WEST) return WEST; - - return new BooleanProperty(property); - } - - public static & StringIdentifiable> EnumProperty of(net.minecraft.state.property.EnumProperty property) { - if (property.equals(Properties.BLOCK_HALF)) return (EnumProperty) BLOCK_HALF; - if (property.equals(Properties.STAIR_SHAPE)) return (EnumProperty) STAIR_SHAPE; - if (property.equals(Properties.SLAB_TYPE)) return (EnumProperty) SLAB_TYPE; - if (property.equals(Properties.CHEST_TYPE)) return (EnumProperty) CHEST_TYPE; - if (property.equals(Properties.PISTON_TYPE)) return (EnumProperty) PISTON_TYPE; - if (property.equals(Properties.AXIS)) return (EnumProperty) AXIS; - if (property.equals(Properties.HORIZONTAL_AXIS)) return (EnumProperty) HORIZONTAL_AXIS; - if (property.equals(Properties.COMPARATOR_MODE)) return (EnumProperty) COMPARATOR_MODE; - - return new EnumProperty<>(property); - } - - public static DirectionProperty ofDir(net.minecraft.state.property.EnumProperty property) { - if (property == Properties.FACING) return FACING; - if (property == Properties.HORIZONTAL_FACING) return HORIZONTAL_FACING; - if (property == Properties.HOPPER_FACING) return HOPPER_FACING; - if (property == Properties.VERTICAL_DIRECTION) return VERTICAL_DIRECTION; - - return new DirectionProperty(property); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java deleted file mode 100644 index f1bd61a7b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.state.property; - -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Property; -import net.minecraft.util.math.Direction; -import net.pitan76.mcpitanlib.midohra.block.BlockState; - -import java.util.function.Predicate; - -public class DirectionProperty implements IProperty { - - private final EnumProperty property; - - public DirectionProperty(String name, Predicate filter) { - this(EnumProperty.of(name, Direction.class, filter)); - } - - public DirectionProperty(String name) { - this(name, direction -> true); - } - - public DirectionProperty(EnumProperty property) { - this.property = property; - } - - public static DirectionProperty of(String name) { - return new DirectionProperty(name); - } - - public static DirectionProperty of(String name, Predicate filter) { - return new DirectionProperty(name, filter); - } - - public net.pitan76.mcpitanlib.midohra.util.math.Direction getAsMidohra(BlockState state) { - return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(get(state.toMinecraft())); - } - - public BlockState with(BlockState state, net.pitan76.mcpitanlib.midohra.util.math.Direction value) { - return BlockState.of(with(state.toMinecraft(), value.toMinecraft())); - } - - public BlockState cycle(BlockState state) { - return BlockState.of(cycle(state.toMinecraft())); - } - - @Override - public Property getProperty() { - return property; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java deleted file mode 100644 index 7e7e9522b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.api.state.property; - -import net.minecraft.util.StringIdentifiable; - -import java.util.function.Predicate; - -public class EnumProperty & StringIdentifiable> implements IProperty { - - private final net.minecraft.state.property.EnumProperty property; - - public EnumProperty(String name, Class type) { - this(net.minecraft.state.property.EnumProperty.of(name, type)); - } - - public EnumProperty(String name, Class type, Predicate filter) { - this(net.minecraft.state.property.EnumProperty.of(name, type, filter)); - } - - public EnumProperty(net.minecraft.state.property.EnumProperty property) { - this.property = property; - } - - public static & StringIdentifiable> EnumProperty of(String name, Class type) { - return new EnumProperty<>(name, type); - } - - public static & StringIdentifiable> EnumProperty of(String name, Class type, Predicate filter) { - return new EnumProperty<>(name, type, filter); - } - - - public static & StringIdentifiable> EnumProperty of(net.minecraft.state.property.EnumProperty property) { - return new EnumProperty<>(property); - } - - @Override - public net.minecraft.state.property.EnumProperty getProperty() { - return property; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java deleted file mode 100644 index 2274a41e3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java +++ /dev/null @@ -1,49 +0,0 @@ -package net.pitan76.mcpitanlib.api.state.property; - -import net.minecraft.block.BlockState; -import net.minecraft.state.property.Property; -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; - -public interface IProperty> { - default void apply(AppendPropertiesArgs args) { - args.addProperty(getProperty()); - } - - default T get(BlockState state) { - return state.get(getProperty()); - } - - default BlockState with(BlockState state, T value) { - return state.with(getProperty(), value); - } - - default boolean contains(BlockState state) { - return state.contains(getProperty()); - } - - default BlockState cycle(BlockState state) { - return state.cycle(getProperty()); - } - - default String getName() { - return getProperty().getName(); - } - - Property getProperty(); - - default net.pitan76.mcpitanlib.midohra.block.BlockState with(net.pitan76.mcpitanlib.midohra.block.BlockState state, T value) { - return state.with(getProperty(), value); - } - - default T get(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return state.get(getProperty()); - } - - default boolean contains(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return state.contains(getProperty()); - } - - default net.pitan76.mcpitanlib.midohra.block.BlockState cycle(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return state.cycle(getProperty()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java deleted file mode 100644 index 850604d9f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.state.property; - -public class IntProperty implements IProperty { - - private final net.minecraft.state.property.IntProperty property; - - public IntProperty(String name, int min, int max) { - this(net.minecraft.state.property.IntProperty.of(name, min, max)); - } - - public IntProperty(String name) { - this(name, 0, 15); - } - - public IntProperty(net.minecraft.state.property.IntProperty property) { - this.property = property; - } - - public static IntProperty of(String name) { - return new IntProperty(name); - } - - public static IntProperty of(String name, int min, int max) { - return new IntProperty(name, min, max); - } - - public static IntProperty of(net.minecraft.state.property.IntProperty property) { - return new IntProperty(property); - } - - @Override - public net.minecraft.state.property.IntProperty getProperty() { - return property; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java deleted file mode 100644 index e59d0cad5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.state.property; - -import net.minecraft.state.property.Property; - -public class UnknownProperty implements IProperty { - - private final net.minecraft.state.property.Property property; - - public UnknownProperty(net.minecraft.state.property.Property property) { - this.property = property; - } - - public static UnknownProperty of(net.minecraft.state.property.Property property) { - return new UnknownProperty(property); - } - - @Override - public Property getProperty() { - return property; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java deleted file mode 100644 index 85aeaacf9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag; - -public enum MineableToolTags { - NONE, - //SWORD, - AXE, - PICKAXE, - SHOVEL, - HOE, - //SHEARS -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java deleted file mode 100644 index 8c023e3a3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityType; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.*; - -public class TagKey { - private final net.minecraft.registry.tag.TagKey tagKey; - - @Deprecated - public TagKey(net.minecraft.registry.tag.TagKey tagKey) { - this.tagKey = tagKey; - } - - public static TagKey create(Type type, Identifier identifier) { - return switch (type) { - case BLOCK -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.BLOCK, identifier)); - case ITEM -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.ITEM, identifier)); - case FLUID -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.FLUID, identifier)); - case ENTITY_TYPE -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.ENTITY_TYPE, identifier)); - }; - } - - public static TagKey create(Type type, CompatIdentifier id) { - return create(type, id.toMinecraft()); - } - - @Deprecated - public net.minecraft.registry.tag.TagKey getTagKey() { - return tagKey; - } - - public enum Type { - BLOCK, - ITEM, - FLUID, - ENTITY_TYPE, - } - - public boolean isOf(T value) { - if (value instanceof Item) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.ITEM, ItemUtil.toID((Item) value)); - if (value instanceof Block) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.BLOCK, BlockUtil.toID((Block) value)); - if (value instanceof Fluid) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.FLUID, FluidUtil.toID((Fluid) value)); - if (value instanceof EntityType) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.ENTITY_TYPE, EntityTypeUtil.toID((EntityType) value)); - - return RegistryEntry.of(value).isIn(getTagKey()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java deleted file mode 100644 index ed91ce35e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag.item; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IngredientUtil; -import net.pitan76.mcpitanlib.api.util.item.ItemUtil; - -public class RepairIngredientTag { - - public static final RepairIngredientTag REPAIRS_LEATHER_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_LEATHER_ARMOR); - public static final RepairIngredientTag REPAIRS_CHAIN_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_CHAIN_ARMOR); - public static final RepairIngredientTag REPAIRS_IRON_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_IRON_ARMOR); - public static final RepairIngredientTag REPAIRS_GOLD_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_GOLD_ARMOR); - public static final RepairIngredientTag REPAIRS_DIAMOND_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_DIAMOND_ARMOR); - public static final RepairIngredientTag REPAIRS_NETHERITE_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_NETHERITE_ARMOR); - public static final RepairIngredientTag REPAIRS_TURTLE_HELMET = new RepairIngredientTag(ItemTags.REPAIRS_TURTLE_HELMET); - public static final RepairIngredientTag REPAIRS_WOLF_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_WOLF_ARMOR); - public static final RepairIngredientTag WOODEN_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.WOODEN_TOOL_MATERIALS); - public static final RepairIngredientTag STONE_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.STONE_TOOL_MATERIALS); - public static final RepairIngredientTag IRON_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.IRON_TOOL_MATERIALS); - public static final RepairIngredientTag GOLDEN_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.GOLD_TOOL_MATERIALS); - public static final RepairIngredientTag DIAMOND_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.DIAMOND_TOOL_MATERIALS); - public static final RepairIngredientTag NETHERITE_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.NETHERITE_TOOL_MATERIALS); - - private TagKey tag; - - public RepairIngredientTag(CompatIdentifier identifier) { - this.tag = TagKey.of(RegistryKeys.ITEM, identifier.toMinecraft()); - } - - @Deprecated - public RepairIngredientTag(TagKey tag) { - this.tag = tag; - } - - @Deprecated - public TagKey getTag() { - return tag; - } - - @Deprecated - public Ingredient getIngredient() { - return IngredientUtil.fromTagByIdentifier(tag.id()); - } - - public boolean contains(Item item) { - if (item == null || tag == null) - return false; - - return ItemUtil.isInTag(item, CompatIdentifier.fromMinecraft(tag.id())); - } - - public boolean contains(ItemStack stack) { - if (stack.isEmpty() || tag == null) - return false; - - return getIngredient().test(stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java deleted file mode 100644 index 63f4df308..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag.v2; - -import net.minecraft.registry.entry.RegistryEntry; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class CompatTagKey extends TagKey { - @Deprecated - public CompatTagKey(net.minecraft.registry.tag.TagKey tagKey) { - super(tagKey); - } - - @Deprecated - public static CompatTagKey of(net.minecraft.registry.tag.TagKey tagKey) { - return new CompatTagKey<>(tagKey); - } - - public static CompatTagKey of(CompatTagKeyType type, CompatIdentifier identifier) { - return of(net.minecraft.registry.tag.TagKey.of(type.getRegistryKey(), identifier.toMinecraft())); - } - - public boolean isOf(T value) { - return RegistryEntry.of(value).isIn(getTagKey()); - } - - public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(getTagKey().id()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java deleted file mode 100644 index 2a0dabc61..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag.v2; - -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.EntityType; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class CompatTagKeyType { - public static final CompatTagKeyType BLOCK = of(RegistryKeys.BLOCK); - public static final CompatTagKeyType ITEM = new CompatTagKeyType<>(RegistryKeys.ITEM); - public static final CompatTagKeyType FLUID = new CompatTagKeyType<>(RegistryKeys.FLUID); - public static final CompatTagKeyType> ENTITY_TYPE = new CompatTagKeyType<>(RegistryKeys.ENTITY_TYPE); - public static final CompatTagKeyType> BLOCK_ENTITY_TYPE = new CompatTagKeyType<>(RegistryKeys.BLOCK_ENTITY_TYPE); - public static final CompatTagKeyType> SCREEN_HANDLER = new CompatTagKeyType<>(RegistryKeys.SCREEN_HANDLER); - - public final CompatIdentifier id; - - protected CompatTagKeyType(CompatIdentifier id) { - this.id = id; - } - - public static CompatTagKeyType of(CompatIdentifier id) { - return new CompatTagKeyType<>(id); - } - - // RegistryKey - private RegistryKey> key; - - protected CompatTagKeyType(RegistryKey> key) { - this.id = CompatIdentifier.fromMinecraft(key.getRegistry()); - this.key = key; - } - - public static CompatTagKeyType of(RegistryKey> key) { - return new CompatTagKeyType<>(key); - } - - @Deprecated - public RegistryKey> getRegistryKey() { - return key; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java deleted file mode 100644 index 382e101b8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag.v2.typed; - -import net.minecraft.block.Block; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.block.BlockUtil; - -import java.util.List; - -public class BlockTagKey extends CompatTagKey { - @Deprecated - public BlockTagKey(TagKey tagKey) { - super(tagKey); - } - - public static BlockTagKey of(CompatIdentifier identifier) { - return new BlockTagKey(TagKey.of(CompatTagKeyType.BLOCK.getRegistryKey(), identifier.toMinecraft())); - } - - public List values() { - return BlockUtil.getInTag(this); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java deleted file mode 100644 index 61d57fee9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag.v2.typed; - -import net.minecraft.entity.EntityType; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -import java.util.List; - -public class EntityTagKey extends CompatTagKey> { - @Deprecated - public EntityTagKey(TagKey> tagKey) { - super(tagKey); - } - - public static EntityTagKey of(CompatIdentifier identifier) { - return new EntityTagKey(TagKey.of(CompatTagKeyType.ENTITY_TYPE.getRegistryKey(), identifier.toMinecraft())); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java deleted file mode 100644 index 03cdeb507..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag.v2.typed; - -import net.minecraft.fluid.Fluid; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class FluidTagKey extends CompatTagKey { - @Deprecated - public FluidTagKey(TagKey tagKey) { - super(tagKey); - } - - public static FluidTagKey of(CompatIdentifier identifier) { - return new FluidTagKey(TagKey.of(CompatTagKeyType.FLUID.getRegistryKey(), identifier.toMinecraft())); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java deleted file mode 100644 index cce0a7cb2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.api.tag.v2.typed; - -import net.minecraft.item.Item; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.tag.TagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; -import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IngredientUtil; -import net.pitan76.mcpitanlib.api.util.item.ItemUtil; - -import java.util.List; - -public class ItemTagKey extends CompatTagKey { - @Deprecated - public ItemTagKey(TagKey tagKey) { - super(tagKey); - } - - public static ItemTagKey of(CompatIdentifier identifier) { - return new ItemTagKey(net.minecraft.registry.tag.TagKey.of(CompatTagKeyType.ITEM.getRegistryKey(), identifier.toMinecraft())); - } - - public Ingredient asIngredient() { - return IngredientUtil.fromTagByIdentifier(getTagKey().id()); - } - - public List values() { - return ItemUtil.getInTag(this); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java deleted file mode 100644 index 1de5acf72..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java +++ /dev/null @@ -1,86 +0,0 @@ -package net.pitan76.mcpitanlib.api.text; - -import net.minecraft.util.Formatting; -import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; - -public class CompatFormatting implements CompatStringIdentifiable { - private final Formatting formatting; - - public static final CompatFormatting BLACK = of(Formatting.BLACK); - public static final CompatFormatting DARK_BLUE = of(Formatting.DARK_BLUE); - public static final CompatFormatting DARK_GREEN = of(Formatting.DARK_GREEN); - public static final CompatFormatting DARK_AQUA = of(Formatting.DARK_AQUA); - public static final CompatFormatting DARK_RED = of(Formatting.DARK_RED); - public static final CompatFormatting DARK_PURPLE = of(Formatting.DARK_PURPLE); - public static final CompatFormatting GOLD = of(Formatting.GOLD); - public static final CompatFormatting GRAY = of(Formatting.GRAY); - public static final CompatFormatting DARK_GRAY = of(Formatting.DARK_GRAY); - public static final CompatFormatting BLUE = of(Formatting.BLUE); - public static final CompatFormatting GREEN = of(Formatting.GREEN); - public static final CompatFormatting AQUA = of(Formatting.AQUA); - public static final CompatFormatting RED = of(Formatting.RED); - public static final CompatFormatting LIGHT_PURPLE = of(Formatting.LIGHT_PURPLE); - public static final CompatFormatting YELLOW = of(Formatting.YELLOW); - public static final CompatFormatting WHITE = of(Formatting.WHITE); - public static final CompatFormatting OBFUSCATED = of(Formatting.OBFUSCATED); - public static final CompatFormatting BOLD = of(Formatting.BOLD); - public static final CompatFormatting STRIKETHROUGH = of(Formatting.STRIKETHROUGH); - public static final CompatFormatting UNDERLINE = of(Formatting.UNDERLINE); - public static final CompatFormatting ITALIC = of(Formatting.ITALIC); - public static final CompatFormatting RESET = of(Formatting.RESET); - - public CompatFormatting(Formatting formatting) { - this.formatting = formatting; - } - - public static CompatFormatting of(Formatting formatting) { - return new CompatFormatting(formatting); - } - - public Formatting getRaw() { - return formatting; - } - - @Override - public String asString_compat() { - return formatting.asString(); - } - - public boolean isColor() { - return formatting.isColor(); - } - - public boolean isModifier() { - return formatting.isModifier(); - } - - public char getCode() { - return formatting.getCode(); - } - - public Integer getColorValue() { - return formatting.getColorValue(); - } - - public int getColorIndex() { - return formatting.getColorIndex(); - } - - @Override - public String toString() { - return formatting.toString(); - } - - @Override - public int hashCode() { - return formatting.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - CompatFormatting other = (CompatFormatting) obj; - return formatting.equals(other.formatting); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java deleted file mode 100644 index 43b9aee73..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java +++ /dev/null @@ -1,105 +0,0 @@ -package net.pitan76.mcpitanlib.api.text; - -import net.minecraft.text.Style; - -public class CompatStyle { - private final Style style; - - public CompatStyle(Style style) { - this.style = style; - } - - public CompatStyle() { - this(Style.EMPTY); - } - - public static CompatStyle of(Style style) { - return new CompatStyle(style); - } - - public static CompatStyle of() { - return new CompatStyle(); - } - - public CompatStyle withColor(CompatTextColor color) { - return new CompatStyle(style.withColor(color.getRaw())); - } - - public CompatStyle withColor(CompatFormatting formatting) { - return new CompatStyle(style.withColor(formatting.getRaw())); - } - - public CompatStyle withColor(int rgbColor) { - return new CompatStyle(style.withColor(rgbColor)); - } - - public CompatStyle withBold(boolean bold) { - return new CompatStyle(style.withBold(bold)); - } - - public CompatStyle withItalic(boolean italic) { - return new CompatStyle(style.withItalic(italic)); - } - - public CompatStyle withUnderline(boolean underline) { - return new CompatStyle(style.withUnderline(underline)); - } - - public CompatStyle withStrikethrough(boolean strikethrough) { - return new CompatStyle(style.withStrikethrough(strikethrough)); - } - - public CompatStyle withObfuscated(boolean obfuscated) { - return new CompatStyle(style.withObfuscated(obfuscated)); - } - - public CompatTextColor getColor() { - if (style.getColor() == null) return null; - return new CompatTextColor(style.getColor()); - } - - public boolean isBold() { - return style.isBold(); - } - - public boolean isItalic() { - return style.isItalic(); - } - - public boolean isUnderlined() { - return style.isUnderlined(); - } - - public boolean isStrikethrough() { - return style.isStrikethrough(); - } - - public boolean isObfuscated() { - return style.isObfuscated(); - } - - public boolean isEmpty() { - return style.isEmpty(); - } - - public CompatStyle withFormatting(CompatFormatting formatting) { - return withColor(formatting); - } - - public Style getRaw() { - return style; - } - - @Override - public int hashCode() { - return style.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - CompatStyle that = (CompatStyle) obj; - return style.equals(that.style); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java deleted file mode 100644 index 306034382..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.pitan76.mcpitanlib.api.text; - -import net.minecraft.text.TextColor; -import net.minecraft.util.Formatting; - -public class CompatTextColor { - private final TextColor textColor; - - public static final CompatTextColor BLACK = of(TextColor.fromFormatting(Formatting.BLACK)); - public static final CompatTextColor DARK_BLUE = of(TextColor.fromFormatting(Formatting.DARK_BLUE)); - public static final CompatTextColor DARK_GREEN = of(TextColor.fromFormatting(Formatting.DARK_GREEN)); - public static final CompatTextColor DARK_AQUA = of(TextColor.fromFormatting(Formatting.DARK_AQUA)); - public static final CompatTextColor DARK_RED = of(TextColor.fromFormatting(Formatting.DARK_RED)); - public static final CompatTextColor DARK_PURPLE = of(TextColor.fromFormatting(Formatting.DARK_PURPLE)); - public static final CompatTextColor GOLD = of(TextColor.fromFormatting(Formatting.GOLD)); - public static final CompatTextColor GRAY = of(TextColor.fromFormatting(Formatting.GRAY)); - public static final CompatTextColor DARK_GRAY = of(TextColor.fromFormatting(Formatting.DARK_GRAY)); - public static final CompatTextColor BLUE = of(TextColor.fromFormatting(Formatting.BLUE)); - public static final CompatTextColor GREEN = of(TextColor.fromFormatting(Formatting.GREEN)); - public static final CompatTextColor AQUA = of(TextColor.fromFormatting(Formatting.AQUA)); - public static final CompatTextColor RED = of(TextColor.fromFormatting(Formatting.RED)); - public static final CompatTextColor LIGHT_PURPLE = of(TextColor.fromFormatting(Formatting.LIGHT_PURPLE)); - public static final CompatTextColor YELLOW = of(TextColor.fromFormatting(Formatting.YELLOW)); - public static final CompatTextColor WHITE = of(TextColor.fromFormatting(Formatting.WHITE)); - - public CompatTextColor(TextColor textColor) { - this.textColor = textColor; - } - - public TextColor getRaw() { - return textColor; - } - - public static CompatTextColor of(TextColor textColor) { - return new CompatTextColor(textColor); - } - - public static CompatTextColor fromFormatting(Formatting formatting) { - return new CompatTextColor(TextColor.fromFormatting(formatting)); - } - - public static CompatTextColor fromFormatting(CompatFormatting formatting) { - return fromFormatting(formatting.getRaw()); - } - - public static CompatTextColor fromRgb(int rgb) { - return new CompatTextColor(TextColor.fromRgb(rgb)); - } - - public static CompatTextColor fromRgb(int r, int g, int b) { - int rgb = (r << 16) | (g << 8) | b; - return fromRgb(rgb); - } - - public static CompatTextColor parse(String string) { - try { - return parseOrThrow(string); - } catch (Exception e) { - return null; - } - } - - public static CompatTextColor parseOrThrow(String string) { - return new CompatTextColor(TextColor.parse(string).getOrThrow()); - } - - @Override - public int hashCode() { - return textColor.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - CompatTextColor other = (CompatTextColor) obj; - return textColor.equals(other.textColor); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java deleted file mode 100644 index 08ee2e869..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java +++ /dev/null @@ -1,130 +0,0 @@ -package net.pitan76.mcpitanlib.api.text; - -import net.minecraft.text.MutableText; -import net.minecraft.text.Style; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import org.jetbrains.annotations.Nullable; - -public class TextComponent { - - private Text text; - - public TextComponent() { - this(TextUtil.empty()); - } - - public TextComponent(Text text) { - this.text = text; - } - - public TextComponent(String string) { - this(TextUtil.literal(string)); - } - - public Text getText() { - return text; - } - - public void setText(Text text) { - this.text = text; - } - - public MutableText asMutableText() { - return (MutableText) text; - } - - public VariableTextComponent asVariableTextComponent() { - return new VariableTextComponent(this); - } - - @Nullable - public MutableText asMutableTextOrNull() { - if (text instanceof MutableText) { - return asMutableText(); - } - return null; - } - - public static TextComponent literal(String string) { - return new TextComponent(string); - } - - public static TextComponent of(String string) { - return TextComponent.literal(string); - } - - public static TextComponent translatable(String key) { - return new TextComponent(TextUtil.translatable(key)); - } - - public static TextComponent translatable(String key, Object... args) { - return new TextComponent(TextUtil.translatable(key, args)); - } - - public static TextComponent empty() { - return new TextComponent(TextUtil.empty()); - } - - public static TextComponent format(String format, Object... args) { - return literal(String.format(format, args)); - } - - @Override - public String toString() { - return getString(); - } - - public String getString() { - return TextUtil.txt2str(getText()); - } - - public String superToString() { - return super.toString(); - } - - public TextComponent copy() { - return new TextComponent(getText()); - } - - public Style getStyle() { - return text.getStyle(); - } - - public TextComponent setStyle(Style style) { - if (text instanceof MutableText) - TextUtil.setStyle((MutableText) text, style); - - return this; - } - - public TextComponent setStyle(CompatStyle style) { - return setStyle(style.getRaw()); - } - - public CompatStyle getCompatStyle() { - return CompatStyle.of(getStyle()); - } - - public boolean contains(TextComponent other) { - return TextUtil.contains(getText(), other.getText()); - } - - /** - * Convert string to TextComponent with formatting - * @param text String - * @return TextComponent - */ - public static TextComponent convert(String text) { - return new TextComponent(TextUtil.convert(text)); - } - - /** - * Convert string to TextComponent with translatable - * @param text String - * @return TextComponent - */ - public static TextComponent convertWithTranslatable(String text) { - return new TextComponent(TextUtil.convertWithTranslatable(text)); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java deleted file mode 100644 index 85836c4f8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.pitan76.mcpitanlib.api.text; - -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class TextConverter { - - public static MutableText convert(String string) { - return convert(string, false); - } - - /** - * Convert string to MutableText with formatting - * - * @param text String - * @param translatable boolean - * @return MutableText - */ - public static MutableText convert(String text, boolean translatable) { - String[] splits = split(text); - MutableText result = Text.literal(""); - Formatting[] currentFormatting = {}; - - for (String part : splits) { - // Section - if (part.startsWith("§") && part.length() == 2) { - char code = part.charAt(1); - // Reset - if (code == 'r') { - currentFormatting = new Formatting[]{}; - continue; - } - - Formatting format = Formatting.byCode(code); - if (format == null) - continue; - - // Bold, Italic, Underline, Strikethrough, Obfuscated - if (code >= 'k' && code <= 'o') { - ArrayList list = new ArrayList<>(Arrays.asList(currentFormatting)); - list.add(format); - currentFormatting = list.toArray(new Formatting[0]); - continue; - } - - // Color - currentFormatting = new Formatting[]{format}; - continue; - } - - // Translatable - if (translatable) { - Pattern pattern = Pattern.compile("\\{(.+?)\\}"); - Matcher matcher = pattern.matcher(part); - MutableText tempText = Text.literal(""); - int lastIndex = 0; - - while (matcher.find()) { - // {translatable key} より前の文字列を追加 - if (matcher.start() > lastIndex) { - tempText.append(Text.literal(part.substring(lastIndex, matcher.start())).formatted(currentFormatting)); - } - - // {translatable key} を追加 - String key = matcher.group(1); - tempText.append(Text.translatable(key).formatted(currentFormatting)); - - lastIndex = matcher.end(); - } - - // 最後の文字列を追加 - if (lastIndex < part.length()) { - tempText.append(Text.literal(part.substring(lastIndex)).formatted(currentFormatting)); - } - - result.append(tempText); - continue; - } - - result.append(Text.literal(part).formatted(currentFormatting)); - } - - return result; - } - - public static String[] split(String text) { - Matcher matcher = Pattern.compile("(?i)§[0-9a-fk-or]|[^§]+").matcher(text); - List parts = new ArrayList<>(); - - while (matcher.find()) - parts.add(matcher.group()); - - return parts.toArray(new String[0]); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java deleted file mode 100644 index b231f4071..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.text; - -import net.pitan76.mcpitanlib.api.util.TextUtil; - -// 可変TextComponent -public class VariableTextComponent extends TextComponent { - - public VariableTextComponent(TextComponent textComponent) { - setText(textComponent.getText()); - } - - public void append(String string) { - setText(TextUtil.literal(getString() + string)); - } - - public void addLine(String string) { - setText(TextUtil.literal(getString() + "\n" + string)); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java deleted file mode 100644 index 5a98fb969..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java +++ /dev/null @@ -1,66 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile; - -import com.mojang.datafixers.types.Type; -import dev.architectury.injectables.annotations.ExpectPlatform; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class BlockEntityTypeBuilder { - private final Factory factory; - private final List blocks; - - public BlockEntityTypeBuilder(Factory factory, List blocks) { - this.factory = factory; - this.blocks = blocks; - } - - public static BlockEntityTypeBuilder create(Factory factory, Block... blocks) { - List blocksList = new ArrayList<>(blocks.length); - Collections.addAll(blocksList, blocks); - - return new BlockEntityTypeBuilder<>(factory, blocksList); - } - - public BlockEntityTypeBuilder addBlock(Block block) { - this.blocks.add(block); - return this; - } - - public BlockEntityTypeBuilder addBlocks(Block... blocks) { - Collections.addAll(this.blocks, blocks); - return this; - } - - - public BlockEntityType build() { - return build(null); - } - - public BlockEntityType build(Type type) { - return build(type, factory, blocks.toArray(new Block[0])); - } - - @ExpectPlatform - @Deprecated - public static BlockEntityType build(Type type, Factory factory, Block... blocks) { - throw new AssertionError(); - } - - @FunctionalInterface - public interface Factory { - T create(TileCreateEvent event); - - @Deprecated - default T create(BlockPos pos, BlockState state) { - return create(new TileCreateEvent(pos, state)); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java deleted file mode 100644 index 9e89cd1eb..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java +++ /dev/null @@ -1,198 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.packet.UpdatePacketType; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; -import net.pitan76.mcpitanlib.api.util.NbtUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; -import org.jetbrains.annotations.Nullable; - -public class CompatBlockEntity extends BlockEntity { - public CompatBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { - super(type, pos, state); - } - - public CompatBlockEntity(BlockEntityType type, TileCreateEvent event) { - this(type, event.getBlockPos(), event.getBlockState()); - } - - @Nullable - @Override - @Deprecated - public Packet toUpdatePacket() { - switch (getUpdatePacketType().name) { - case "BLOCK_ENTITY_UPDATE_S2C": - return BlockEntityUpdateS2CPacket.create(this); - } - return super.toUpdatePacket(); - } - - public UpdatePacketType getUpdatePacketType() { - return UpdatePacketType.NONE; - } - - public void writeNbt(WriteNbtArgs args) { - - } - - public void readNbt(ReadNbtArgs args) { - - } - - public NbtCompound toInitialChunkDataNbt(CompatRegistryLookup registryLookup) { - return super.toInitialChunkDataNbt(registryLookup.getRegistryLookup()); - } - - @Deprecated - @Override - public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries) { - return toInitialChunkDataNbt(new CompatRegistryLookup(registries)); - } - - // deprecated - - /** - * @deprecated Use {@link #writeNbt(WriteNbtArgs)} instead - */ - @Deprecated - public void writeNbtOverride(NbtCompound nbt) { - //super.writeNbt(nbt, wrapperLookupCache); - } - - /** - * @deprecated Use {@link #readNbt(ReadNbtArgs)} instead - */ - @Deprecated - public void readNbtOverride(NbtCompound nbt) { - //super.readNbt(nbt, wrapperLookupCache); - } - - @Deprecated - private RegistryWrapper.WrapperLookup wrapperLookupCache; - - // ---- - - - @Override - protected void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = NbtUtil.create(); - writeNbt(nbt, this.callGetWorld().getRegistryManager()); - writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.callGetWorld().getRegistryManager()))); - NbtDataConverter.nbt2writeData(nbt, view); - } - - @Override - protected void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readNbt(nbt, view.getRegistries()); - readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.getRegistries()))); - } - - @Deprecated - public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { - // deprecated - wrapperLookupCache = registryLookup; - writeNbtOverride(nbt); - // ---- - } - - @Deprecated - public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { - // deprecated - wrapperLookupCache = registryLookup; - readNbtOverride(nbt); - // ---- - } - - public boolean isClient() { - if (getWorld() == null) - return false; - - return WorldUtil.isClient(getWorld()); - } - - @Deprecated - @Override - public @Nullable World getWorld() { - return callGetWorld(); - } - - @Deprecated - @Override - public BlockPos getPos() { - return callGetPos(); - } - - public World callGetWorld() { - return super.getWorld(); - } - - public BlockPos callGetPos() { - return super.getPos(); - } - - public BlockState callGetBlockState() { - return BlockEntityUtil.getBlockState(this); - } - - public BlockState callGetCachedState() { - return BlockEntityUtil.getCachedState(this); - } - - public boolean hasServerWorld() { - return callGetWorld() instanceof ServerWorld; - } - - public ServerWorld getServerWorld() { - return BlockEntityUtil.getServerWorld(this); - } - - public void callMarkDirty() { - BlockEntityUtil.markDirty(this); - } - - @Deprecated - @Override - public void markRemoved() { - markRemovedOverride(); - } - - public void markRemovedOverride() { - super.markRemoved(); - } - - public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { - return net.pitan76.mcpitanlib.midohra.world.World.of(callGetWorld()); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(callGetPos()); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(callGetBlockState()); - } - - public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraCachedState() { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(callGetCachedState()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java deleted file mode 100644 index 8b4b3d914..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java +++ /dev/null @@ -1,111 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.packet.UpdatePacketType; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.NbtUtil; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; -import org.jetbrains.annotations.Nullable; - -public class CompatChestBlockEntity extends ChestBlockEntity { - protected CompatChestBlockEntity(BlockEntityType blockEntityType, BlockPos blockPos, BlockState blockState) { - super(blockEntityType, blockPos, blockState); - } - - public CompatChestBlockEntity(BlockEntityType type, TileCreateEvent event) { - this(type, event.getBlockPos(), event.getBlockState()); - } - - @Nullable - @Override - @Deprecated - public Packet toUpdatePacket() { - switch (getUpdatePacketType().name) { - case "BLOCK_ENTITY_UPDATE_S2C": - return BlockEntityUpdateS2CPacket.create(this); - } - return super.toUpdatePacket(); - } - - public UpdatePacketType getUpdatePacketType() { - return UpdatePacketType.NONE; - } - - public void writeNbt(WriteNbtArgs args) { - - } - - public void readNbt(ReadNbtArgs args) { - - } - - - // deprecated - - /** - * @deprecated Use {@link #writeNbt(WriteNbtArgs)} instead - */ - @Deprecated - public void writeNbtOverride(NbtCompound nbt) { - - } - - /** - * @deprecated Use {@link #readNbt(ReadNbtArgs)} instead - */ - @Deprecated - public void readNbtOverride(NbtCompound nbt) { - - } - - @Deprecated - private RegistryWrapper.WrapperLookup wrapperLookupCache; - - // ---- - - @Override - protected void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = NbtUtil.create(); - writeNbt(nbt, this.getWorld().getRegistryManager()); - writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.getWorld().getRegistryManager()))); - NbtDataConverter.nbt2writeData(nbt, view); - } - - @Override - protected void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readNbt(nbt, view.getRegistries()); - readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.getRegistries()))); - } - - @Deprecated - public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { - // deprecated - wrapperLookupCache = registryLookup; - writeNbtOverride(nbt); - // ---- - } - - @Deprecated - public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { - // deprecated - wrapperLookupCache = registryLookup; - readNbtOverride(nbt); - // ---- - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java deleted file mode 100644 index 01ea4f2e2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.world.ExtendWorld; - -public class ExtendBlockEntity extends CompatBlockEntity { - public ExtendWorld world; - - public ExtendBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { - super(type, pos, state); - } - - public ExtendBlockEntity(BlockEntityType type, TileCreateEvent event) { - this(type, event.getBlockPos(), event.getBlockState()); - } - - @Override - public void setWorld(World world) { - super.setWorld(world); - this.world = new ExtendWorld(world); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java deleted file mode 100644 index 8bce6ee96..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.tile.TileTickEvent; - -public interface ExtendBlockEntityTicker extends BlockEntityTicker { - @Override - default void tick(World world, BlockPos pos, BlockState state, T blockEntity) { - tick(new TileTickEvent<>(world, pos, state, blockEntity)); - } - - void tick(TileTickEvent event); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java deleted file mode 100644 index 4ce375ada..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile; - -import org.jetbrains.annotations.Nullable; - -@Deprecated -public interface RenderDataBlockEntity { - - @Nullable - Object getCompatRenderData(); - - default boolean hasCompatRenderData() { - return getCompatRenderData() != null; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java deleted file mode 100644 index af90ff0c0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile.v2; - -import com.mojang.datafixers.types.Type; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; -import java.util.function.Supplier; - -public class BlockEntityTypeBuilder extends net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder { - private final Factory factory; - private final Consumer> consumer; - - public BlockEntityTypeBuilder(Factory factory, Consumer> blocks) { - super(null, null); - - this.factory = factory; - this.consumer = blocks; - } - - @Deprecated - public static BlockEntityTypeBuilder create(Factory factory, Block... blocks) { - throw new IllegalStateException("Use create(Factory, Consumer>) instead"); - } - - public static BlockEntityTypeBuilder create(BlockEntityTypeBuilder.Factory factory, Consumer> blocks) { - return new BlockEntityTypeBuilder<>(factory, blocks); - } - - public static BlockEntityTypeBuilder createA(BlockEntityTypeBuilder.Factory factory, Supplier block) { - return new BlockEntityTypeBuilder<>(factory, blocks -> { - blocks.add(block.get()); - }); - } - - public static BlockEntityTypeBuilder create(BlockEntityTypeBuilder.Factory factory, SupplierBlockWrapper wrapper) { - return new BlockEntityTypeBuilder<>(factory, blocks -> { - blocks.add(wrapper.get()); - }); - } - - @Override - @Deprecated - public BlockEntityTypeBuilder addBlock(Block block) { - return this; - } - - @Override - @Deprecated - public BlockEntityTypeBuilder addBlocks(Block... blocks) { - return this; - } - - public BlockEntityType build() { - return build(null); - } - - public BlockEntityType build(Type type) { - List blocks = new ArrayList<>(); - if (consumer != null) - consumer.accept(blocks); - - return build(type, factory, blocks.toArray(new Block[0])); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java deleted file mode 100644 index 58e042b3e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.pitan76.mcpitanlib.api.timer; - -import java.util.function.Supplier; - -public interface MinecraftServerTimerAccess { - void mcpitanlib$addTimer(long ticksUntilSomething, Supplier supplier); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java deleted file mode 100644 index 8dbd2dc14..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.pitan76.mcpitanlib.api.timer; - -import java.util.function.Supplier; - -public interface ServerWorldTimerAccess { - void mcpitanlib$addTimer(long ticksUntilSomething, Supplier supplier); -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java deleted file mode 100644 index ecf00fc80..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.api.timer; - -import java.util.function.Supplier; - -public class TimerItem { - public long ticksUntilSomething; - - public Supplier executeSupplier; - - public TimerItem(long ticksUntilSomething, Supplier executeSupplier) { - this.ticksUntilSomething = ticksUntilSomething; - this.executeSupplier = executeSupplier; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java deleted file mode 100644 index 0576fca2f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1; - -import dev.architectury.injectables.annotations.ExpectPlatform; -import net.minecraft.fluid.Fluid; - -public class FluidStorageUtil { - @ExpectPlatform - public static IFluidStorage withFixedCapacity(long capacity, Runnable onChange) { - throw new AssertionError(); - } - - @ExpectPlatform - public static IFluidVariant getVariant(Fluid fluid) { - throw new AssertionError(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java deleted file mode 100644 index f239e8608..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java +++ /dev/null @@ -1,104 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1; - -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.nbt.NbtCompound; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; - -public interface IFluidStorage { - long getAmount(); - - long getCapacity(); - - IFluidVariant getResource(); - - void setResource(IFluidVariant variant); - - long insert(IFluidVariant variant, long maxAmount, boolean simulate); - - long extract(IFluidVariant variant, long maxAmount, boolean simulate); - - void writeNbt(WriteNbtArgs args); - - void readNbt(ReadNbtArgs args); - - default void readNbt(WriteNbtArgs args) { - readNbt(new ReadNbtArgs(args.getNbt(), args.getWrapperLookup())); - } - - default long insert(IFluidVariant variant, long maxAmount) { - return insert(variant, maxAmount, false); - } - - default long extract(IFluidVariant variant, long maxAmount) { - return extract(variant, maxAmount, false); - } - - default long insert(Fluid fluid, long maxAmount) { - return insert(FluidStorageUtil.getVariant(fluid), maxAmount); - } - - default long extract(Fluid fluid, long maxAmount) { - return extract(FluidStorageUtil.getVariant(fluid), maxAmount); - } - - default long insert(FluidWrapper wrapper, long maxAmount) { - return insert(wrapper.get(), maxAmount); - } - - default long extract(FluidWrapper wrapper, long maxAmount) { - return extract(wrapper.get(), maxAmount); - } - - default boolean isResourceBlank() { - return getResource() == null || getAmount() <= 0; - } - - default boolean isResource(IFluidVariant variant) { - return getResource() == variant; - } - - default boolean isEmpty() { - return getAmount() <= 0; - } - - default boolean isFull() { - return getAmount() >= getCapacity(); - } - - default boolean canInsert(IFluidVariant variant, long amount) { - return insert(variant, amount, true) == amount; - } - - default boolean canExtract(IFluidVariant variant, long amount) { - return extract(variant, amount, true) == amount; - } - - default boolean canInsert(Fluid fluid, long amount) { - return canInsert(FluidStorageUtil.getVariant(fluid), amount); - } - - default boolean canExtract(Fluid fluid, long amount) { - return canExtract(FluidStorageUtil.getVariant(fluid), amount); - } - - default boolean canInsert(FluidWrapper wrapper, long amount) { - return canInsert(wrapper.get(), amount); - } - - default boolean canExtract(FluidWrapper wrapper, long amount) { - return canExtract(wrapper.get(), amount); - } - - default void writeNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { - writeNbt(new WriteNbtArgs(nbt, registryLookup)); - } - - default void readNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { - readNbt(new WriteNbtArgs(nbt, registryLookup)); - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java deleted file mode 100644 index cc78339a4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1; - -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.Fluids; -import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; - -public interface IFluidVariant { - Fluid getFluid(); - - default FluidWrapper getWrapper() { - return FluidWrapper.of(getFluid()); - } - - default boolean isSame(IFluidVariant variant) { - return getFluid() == variant.getFluid(); - } - - default boolean isSame(Fluid fluid) { - return getFluid() == fluid; - } - - default boolean isBlank() { - return getFluid() == null || getFluid() == Fluids.EMPTY; - } - - static IFluidVariant of(Fluid fluid) { - return FluidStorageUtil.getVariant(fluid); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java deleted file mode 100644 index 17dda5fe0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java +++ /dev/null @@ -1,138 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.recipe.Ingredient; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; -import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; - -public class ArmorMaterialUtil { - public static CompatibleArmorMaterial create(String name, int[] durability, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { - return create(IdentifierUtil.id(name), durability, protectionAmounts, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); - } - public static CompatibleArmorMaterial create(String name, int durability, int protectionAmount, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { - return create(IdentifierUtil.id(name), durability, protectionAmount, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); - } - - @Deprecated - public static CompatibleArmorMaterial create(Identifier id, int[] durability, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { - return new CompatibleArmorMaterial() { - @Override - public int getDurability(ArmorEquipmentType type) { - switch (type.getSlot()) { - case HEAD -> { - return durability[0]; - } - case CHEST -> { - return durability[1]; - } - case LEGS -> { - return durability[2]; - } - case FEET -> { - return durability[3]; - } - default -> { - return 0; - } - } - } - - @Override - public int getProtection(ArmorEquipmentType type) { - switch (type.getSlot()) { - case HEAD -> { - return protectionAmounts[0]; - } - case CHEST -> { - return protectionAmounts[1]; - } - case LEGS -> { - return protectionAmounts[2]; - } - case FEET -> { - return protectionAmounts[3]; - } - default -> { - return 0; - } - } - } - - @Override - public int getEnchantability() { - return enchantability; - } - - @Override - public SoundEvent getEquipSound() { - return equipSound; - } - - @Override - public Ingredient getRepairIngredient() { - return repairIngredient; - } - - @Override - public Identifier getId() { - return id; - } - - @Override - public float getToughness() { - return toughness; - } - - @Override - public float getKnockbackResistance() { - return knockbackResistance; - } - }; - } - - @Deprecated - public static CompatibleArmorMaterial create(Identifier id, int durability, int protectionAmount, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { - return new CompatibleArmorMaterial() { - @Override - public int getDurability(ArmorEquipmentType type) { - return durability; - } - - @Override - public int getProtection(ArmorEquipmentType type) { - return protectionAmount; - } - - @Override - public int getEnchantability() { - return enchantability; - } - - @Override - public SoundEvent getEquipSound() { - return equipSound; - } - - @Override - public Ingredient getRepairIngredient() { - return repairIngredient; - } - - @Override - public Identifier getId() { - return id; - } - - @Override - public float getToughness() { - return toughness; - } - - @Override - public float getKnockbackResistance() { - return knockbackResistance; - } - }; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java deleted file mode 100644 index 6d04e40df..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java +++ /dev/null @@ -1,49 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.TypedEntityData; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; - -public class BlockEntityDataUtil { - public static NbtCompound getBlockEntityNbt(ItemStack stack) { - if (!hasBlockEntityNbt(stack)) return NbtUtil.create(); - TypedEntityData> data = stack.get(DataComponentTypes.BLOCK_ENTITY_DATA); - NbtCompound nbt = data.copyNbtWithoutId(); - - String id = BlockEntityTypeUtil.toCompatID(data.getType()).toString(); - NbtUtil.putString(nbt, "id", id); - return nbt; - } - - public static void setBlockEntityNbt(ItemStack stack, NbtCompound nbt) { - if (!nbt.contains("id")) return; - - BlockEntityType type = BlockEntityTypeUtil.fromId(CompatIdentifier.of(NbtUtil.getString(nbt, "id"))); - stack.set(DataComponentTypes.BLOCK_ENTITY_DATA, TypedEntityData.create(type, nbt)); - } - - public static boolean hasBlockEntityNbt(ItemStack stack) { - return stack.get(DataComponentTypes.BLOCK_ENTITY_DATA) != null; - } - - public static void readCompatBlockEntityNbtFromStack(ItemStack stack, CompatBlockEntity blockEntity) { - NbtCompound nbt = getBlockEntityNbt(stack); - blockEntity.readNbt(new ReadNbtArgs(nbt, RegistryLookupUtil.getRegistryLookup(blockEntity))); - } - - public static void writeCompatBlockEntityNbtToStack(ItemStack stack, CompatBlockEntity blockEntity) { - NbtCompound nbt = getBlockEntityNbt(stack); - blockEntity.writeNbt(new WriteNbtArgs(nbt, RegistryLookupUtil.getRegistryLookup(blockEntity))); - NbtUtil.putString(nbt, "id", BlockEntityTypeUtil.toCompatID(blockEntity.getType()).toString()); - setBlockEntityNbt(stack, nbt); - } - - public static void removeBlockEntityNbt(ItemStack stack) { - stack.remove(DataComponentTypes.BLOCK_ENTITY_DATA); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java deleted file mode 100644 index 22355031b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; - -public class BlockEntityTypeUtil { - public static Identifier toID(BlockEntityType entityType) { - return Registries.BLOCK_ENTITY_TYPE.getId(entityType); - } - - public static BlockEntityType fromId(Identifier identifier) { - return Registries.BLOCK_ENTITY_TYPE.get(identifier); - } - - public static boolean isExist(Identifier identifier) { - return Registries.BLOCK_ENTITY_TYPE.containsId(identifier); - } - - public static CompatIdentifier toCompatID(BlockEntityType entityType) { - return CompatIdentifier.fromMinecraft(toID(entityType)); - } - - public static BlockEntityType fromId(CompatIdentifier identifier) { - return fromId(identifier.toMinecraft()); - } - - public static boolean isExist(CompatIdentifier identifier) { - return isExist(identifier.toMinecraft()); - } - - public static int getRawId(BlockEntityType type) { - return Registries.BLOCK_ENTITY_TYPE.getRawId(type); - } - - public static BlockEntityType fromIndex(int index) { - return Registries.BLOCK_ENTITY_TYPE.get(index); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java deleted file mode 100644 index 2bcea11b6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java +++ /dev/null @@ -1,115 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; -import org.jetbrains.annotations.Nullable; - -public class BlockEntityUtil { - - public static BlockEntity getBlockEntity(World world, BlockPos pos) { - return WorldUtil.getBlockEntity(world, pos); - } - - public static NbtCompound getBlockEntityNbt(@Nullable World world, BlockEntity blockEntity) { - if (world == null) - world = getWorld(blockEntity); - if (world == null) - return NbtUtil.create(); - - return blockEntity.createNbt(world.getRegistryManager()); - } - - public static NbtCompound getBlockEntityNbt(BlockEntity blockEntity) { - return getBlockEntityNbt(null, blockEntity); - } - - public static World getWorld(BlockEntity blockEntity) { - return blockEntity.getWorld(); - } - - public static boolean hasWorld(BlockEntity blockEntity) { - return blockEntity.hasWorld(); - } - - public static BlockPos getPos(BlockEntity blockEntity) { - return blockEntity.getPos(); - } - - public static BlockState getCachedState(BlockEntity blockEntity) { - return blockEntity.getCachedState(); - } - - public static BlockState getBlockState(BlockEntity blockEntity) { - return getWorld(blockEntity).getBlockState(getPos(blockEntity)); - } - - public static Block getBlock(BlockEntity blockEntity) { - return getBlockState(blockEntity).getBlock(); - } - - public static void markRemoved(BlockEntity blockEntity) { - blockEntity.markRemoved(); - } - - public static void markDirty(BlockEntity blockEntity) { - blockEntity.markDirty(); - } - - public static BlockEntityType getType(BlockEntity blockEntity) { - return blockEntity.getType(); - } - - public static void readNbt(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { - ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); - blockEntity.readComponentlessData(view); - } - - public static void writeNbt(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { - NbtWriteView view = NbtWriteView.create(ErrorReporter.EMPTY); - blockEntity.writeComponentlessData(view); - NbtDataConverter.data2nbt(view, nbt); - } - - public static void read(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { - ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); - blockEntity.read(view); - } - - public static NbtCompound createNbt(BlockEntity blockEntity, CompatRegistryLookup registryLookup) { - return blockEntity.createNbt(registryLookup.getRegistryLookup()); - } - - public static void setStackNbt(BlockEntity blockEntity, ItemStack stack, CompatRegistryLookup registryLookup) { - blockEntity.readComponents(stack); - } - - public static ServerWorld getServerWorld(BlockEntity blockEntity) { - return (ServerWorld) getWorld(blockEntity); - } - - public static void writeToStack(ItemStack stack, BlockEntity blockEntity, CompatRegistryLookup registryLookup) { - NbtCompound nbt = blockEntity.createComponentlessNbt(registryLookup.getRegistryLookup()); - if (!NbtUtil.has(nbt, "id")) - NbtUtil.putString(nbt, "id", BlockEntityTypeUtil.toID(BlockEntityUtil.getType(blockEntity)).toString()); - - BlockEntityDataUtil.setBlockEntityNbt(stack, nbt); - - blockEntity.createComponentMap().forEach(stack::set); - } - - public static boolean isRemoved(BlockEntity blockEntity) { - return blockEntity.isRemoved(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java deleted file mode 100644 index d0e81a1d4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java +++ /dev/null @@ -1,169 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.Property; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.block.WireOrientation; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; -import net.pitan76.mcpitanlib.api.util.block.BlockHitResultUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; - -public class BlockStateUtil { - public static Block getBlock(BlockState state) { - return state.getBlock(); - } - - public static boolean isAir(BlockState state) { - return state.isAir(); - } - - public static boolean isOpaque(BlockState state) { - return state.isOpaque(); - } - - public static BlockSoundGroup getSoundGroup(BlockState state) { - return state.getSoundGroup(); - } - - public static CompatBlockSoundGroup getCompatSoundGroup(BlockState state) { - return CompatBlockSoundGroup.of(getSoundGroup(state)); - } - - public static BlockState getDefaultState(Block block) { - return block.getDefaultState(); - } - - public static StateManager getStateManager(Block block) { - return block.getStateManager(); - } - - public static , V extends T> BlockState with(BlockState state, Property property, V value) { - return state.with(property, value); - } - - public static void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { - WireOrientation wireOrientation = WireOrientation.of(pos.up() == fromPos ? Direction.UP : Direction.DOWN, pos.north() == fromPos ? Direction.NORTH : Direction.SOUTH, pos.east() == fromPos ? WireOrientation.SideBias.RIGHT : WireOrientation.SideBias.LEFT); - - state.neighborUpdate(world, pos, block, wireOrientation, notify); - } - - public static void updateNeighbors(BlockState state, WorldAccess world, BlockPos pos, int flags) { - state.updateNeighbors(world, pos, flags); - } - - public static boolean hasRandomTicks(BlockState state) { - return state.hasRandomTicks(); - } - - public static void randomTick(BlockState state, ServerWorld world, BlockPos pos) { - state.randomTick(world, pos, world.random); - } - - public static CompatActionResult onUse(BlockState state, World world, Player player, BlockHitResult hitResult) { - return CompatActionResult.create(state.onUse(world, player.getEntity(), hitResult)); - } - - public static CompatActionResult onUse(BlockState state, World world, Player player, Direction dir, BlockPos blockPos) { - return onUse(state, world, player, BlockHitResultUtil.create(player.getPos(), dir, blockPos)); - } - - public static CompatActionResult onUseWithItem(BlockState state, ItemStack stack, World world, PlayerEntity player, Hand hand, BlockHitResult hit) { - return CompatActionResult.create(state.onUseWithItem(stack, world, player, hand, hit)); - } - - public static CompatActionResult onUseWithItem_actionResult(BlockState state, ItemStack stack, World world, PlayerEntity player, Hand hand, BlockHitResult hit) { - return onUseWithItem(state, stack, world, player, hand, hit); - } - - public static FluidState getFluidState(BlockState state) { - return state.getFluidState(); - } - - public static Fluid getFluid(BlockState state) { - return getFluidState(state).getFluid(); - } - - public static BlockState rotate(BlockState state, BlockRotation rotation) { - return state.rotate(rotation); - } - - public static net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraDefaultState(Block block) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getDefaultState(block)); - } - - public static net.pitan76.mcpitanlib.midohra.block.BlockState getDefaultState(BlockWrapper block) { - return block.getDefaultState(); - } - - public static float getHardness(BlockState state, BlockView world, BlockPos pos) { - return state.getHardness(world, pos); - } - - public static float getHardness(BlockState state, World world, BlockPos pos) { - return state.getHardness(world, pos); - } - - public static int getLuminance(BlockState state) { - return state.getLuminance(); - } - - public static int getOpacity(BlockState state) { - return state.getOpacity(); - } - - public static int getComparatorOutput(BlockState state, World world, BlockPos pos) { - return state.getComparatorOutput(world, pos, Direction.NORTH); - } - - public static float getHardness(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.BlockView world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return getHardness(state.toMinecraft(), world.getRaw(), pos.toMinecraft()); - } - - public static int getLuminance(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return getLuminance(state.toMinecraft()); - } - - public static int getOpacity(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return getOpacity(state.toMinecraft()); - } - - public static int getComparatorOutput(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return getComparatorOutput(state.toMinecraft(), world.getRaw(), pos.toMinecraft()); - } - - public static boolean canPlaceAt(BlockState state, BlockPos pos, World world) { - return state.canPlaceAt(world, pos); - } - - public static boolean canPlaceAt(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.world.World world) { - return canPlaceAt(state.toMinecraft(), pos.toMinecraft(), world.getRaw()); - } - - public static boolean hasRandomTicks(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return hasRandomTicks(state.toMinecraft()); - } - - public static void randomTick(net.pitan76.mcpitanlib.midohra.block.BlockState state, ServerWorld world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - randomTick(state.toMinecraft(), world, pos.toMinecraft()); - } - - public static void randomTick(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.ServerWorld world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - randomTick(state.toMinecraft(), world.getRaw(), pos.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java deleted file mode 100644 index 0a5532540..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java +++ /dev/null @@ -1,258 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.tag.MineableToolTags; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.v1.BlockUtilV1; -import net.pitan76.mcpitanlib.api.util.v2.BlockUtilV2; - -import java.util.List; - -@Deprecated -public class BlockUtil { - /** - * Get block from Identifier. - * @param id Identifier of the block. - * @return Block of the Identifier. - */ - public static Block block(Identifier id) { - return BlockUtilV1.block(id); - } - - /** - * Check if two blocks are equal. - * @param block Block to compare. - * @param block2 Block to compare. - * @return If two blocks are equal. - */ - public static boolean isEqual(Block block, Block block2) { - return BlockUtilV2.isEqual(block, block2); - } - - /** - * Check if the block is in the tag. (MCPitanLib TagKey) - * @param block Block to check. - * @param tagKey TagKey of the tag. - * @return If the block is in the tag. - */ - public static boolean isIn(Block block, TagKey tagKey) { - return BlockUtilV2.isIn(block, tagKey); - } - - /** - * set break tool tag and level to block - * @param settings Block settings - * @param toolTags Tool tags - * @param level Level - * @return Block settings - */ - public static AbstractBlock.Settings breakByTool(AbstractBlock.Settings settings, MineableToolTags toolTags, int level) { - return BlockUtilV1.breakByTool(settings, toolTags, level); - } - - /** - * not drop anything when block is broken - * @param settings Block settings - * @return Block settings - */ - public static AbstractBlock.Settings dropsNothing(AbstractBlock.Settings settings) { - return BlockUtilV1.dropsNothing(settings); - } - /** - * block breaking requires any tool - * @param settings Block settings - * @return Block settings - */ - public static AbstractBlock.Settings requiresTool(AbstractBlock.Settings settings) { - return BlockUtilV1.requiresTool(settings); - } - - /** - * Check if the block is existed. - * @param identifier Identifier of the block. - * @return If the block is existed. - */ - public static boolean isExist(Identifier identifier) { - return BlockUtilV1.isExist(identifier); - } - - /** - * Get Identifier from block. - * @param block Block to get Identifier. - * @return Identifier of the block. - */ - public static Identifier toID(Block block) { - return BlockUtilV1.toID(block); - } - - /** - * Get block from Identifier. - * @param identifier Identifier of the block. - * @return Block of the Identifier. - */ - public static Block fromId(Identifier identifier) { - return BlockUtilV1.fromId(identifier); - } - - /** - * Get CompatIdentifier from block. - * @param block Block to get CompatIdentifier. - * @return CompatIdentifier of the block. - */ - public static CompatIdentifier toCompatID(Block block) { - return CompatIdentifier.fromMinecraft(toID(block)); - } - - /** - * Get block from CompatIdentifier. - * @param identifier CompatIdentifier of the block. - * @return Block of the CompatIdentifier. - */ - public static Block fromId(CompatIdentifier identifier) { - return fromId(identifier.toMinecraft()); - } - - /** - * Check if the block is existed. - * @param identifier CompatIdentifier of the block. - * @return If the block is existed. - */ - public static boolean isExist(CompatIdentifier identifier) { - return isExist(identifier.toMinecraft()); - } - - /** - * Get all blocks. - * @return List of all blocks. - */ - public static List getAllBlocks() { - return BlockUtilV1.getAllBlocks(); - } - - /** - * Create Block from Block.Settings. - * @param settings Block.Settings to create Block. - * @return Block created from Block.Settings. - */ - @Deprecated - public static Block of(AbstractBlock.Settings settings) { - return BlockUtilV1.of(settings); - } - - /** - * Create Block from CompatibleBlockSettings. - * @param settings CompatibleBlockSettings to create Block. - * @return Block created from CompatibleBlockSettings. - */ - public static Block of(CompatibleBlockSettings settings) { - return BlockUtilV1.of(settings); - } - - /** - * Get raw id of the block. - * @param block Block to get raw id. - * @return Raw id of the block. - */ - public static int getRawId(Block block) { - return BlockUtilV1.getRawId(block); - } - - /** - * Get block from raw id. - * @param index Raw id of the block. - * @return Block from raw id. - */ - public static Block fromIndex(int index) { - return BlockUtilV1.fromIndex(index); - } - - /** - * Get all blocks in the tag. (MCPitanLib TagKey) - * @param tagKey TagKey of the tag. - * @return List of blocks in the tag. - */ - public static List getBlocks(TagKey tagKey) { - return BlockUtilV2.getBlocks(tagKey); - } - - /** - * Get given the list of blocks in the tag. (MCPitanLib TagKey) - * @param tagKey TagKey of the tag. - * @param blocks List of blocks to search. - * @return List of blocks in the tag. - */ - public static List getBlocks(TagKey tagKey, List blocks) { - return BlockUtilV2.getBlocks(tagKey, blocks); - } - - /** - * Get all blocks in the tag. - * @param identifier Identifier of the tag. - * @return List of blocks in the tag. - */ - public static List getBlocks(Identifier identifier) { - return BlockUtilV2.getBlocks(identifier); - } - - /** - * Get given the list of blocks in the tag. - * @param identifier Identifier of the tag. - * @param blocks List of blocks to search. - * @return List of blocks in the tag. - */ - public static List getBlocks(Identifier identifier, List blocks) { - return BlockUtilV2.getBlocks(identifier, blocks); - } - - /** - * Get all blocks in the tag. - * @param id String of the tag. - * @return List of blocks in the tag. - */ - public static List getBlocks(String id) { - return BlockUtilV2.getBlocks(id); - } - - /** - * Get given the list of blocks in the tag. - * @param id String of the tag. - * @param blocks List of blocks to search. - * @return List of blocks in the tag. - */ - public static List getBlocks(String id, List blocks) { - return BlockUtilV2.getBlocks(id, blocks); - } - - /** - * Check if the block is in the tag. - * @param block Block to check. - * @param identifier Identifier of the tag. - * @return If the block is in the tag. - */ - public static boolean isBlockInTag(Block block, Identifier identifier) { - return BlockUtilV2.isBlockInTag(block, identifier); - } - - /** - * Check if the block is in the tag. - * @param block Block to check. - * @param id String of the tag. - * @return If the block is in the tag. - */ - public static boolean isBlockInTag(Block block, String id) { - return BlockUtilV2.isBlockInTag(block, id); - } - - public static Block fromItem(Item item) { - return BlockUtilV2.fromItem(item); - } - - public static Block fromItem(ItemStack stack) { - return BlockUtilV2.fromItem(stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java deleted file mode 100644 index a95953baf..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; - -public class BlockViewUtil { - public static BlockState getBlockState(BlockView blockView, BlockPos pos) { - return blockView.getBlockState(pos); - } - - public static BlockEntity getBlockEntity(BlockView blockView, BlockPos pos) { - return blockView.getBlockEntity(pos); - } - - public static boolean hasBlockEntity(BlockView blockView, BlockPos pos) { - return getBlockEntity(blockView, pos) != null; - } - - public static boolean isAir(BlockView blockView, BlockPos pos) { - return getBlockState(blockView, pos).isAir(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java deleted file mode 100644 index 8173c9737..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.permission.LeveledPermissionPredicate; -import net.minecraft.command.permission.PermissionLevel; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.world.ServerWorld; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.core.command.CommandResult; - -public class CommandManagerUtil { - public static CommandManager getCommandManager(MinecraftServer server) { - return server.getCommandManager(); - } - - public static CommandResult execute(MinecraftServer server, String command) { - CommandDispatcher dispatcher = getCommandManager(server).getDispatcher(); - ServerCommandSource source = server.getCommandSource(); - - if (command.startsWith("/")) { - command = command.substring(1); - } - - CommandResult cr = new CommandResult(); - cr.setSuccess(false); - cr.setSource(source); - - try { - int result = dispatcher.execute(command, source); - cr.setResult(result); - cr.setSuccess(true); - } catch (CommandSyntaxException e) { - cr.setMessage(e.getMessage()); - cr.setErrorType(CommandResult.ErrorType.COMMAND_SYNTAX_ERROR); - } catch (RuntimeException e) { - cr.setMessage(e.getMessage()); - cr.setErrorType(CommandResult.ErrorType.RUNTIME_ERROR); - } - - return cr; - } - - public static CommandResult execute(ServerCommandSource source, String command) { - CommandDispatcher dispatcher = source.getServer().getCommandManager().getDispatcher(); - - if (command.startsWith("/")) { - command = command.substring(1); - } - - CommandResult cr = new CommandResult(); - cr.setSuccess(false); - cr.setSource(source); - - try { - int result = dispatcher.execute(command, source); - cr.setResult(result); - cr.setSuccess(true); - } catch (CommandSyntaxException e) { - cr.setMessage(e.getMessage()); - cr.setErrorType(CommandResult.ErrorType.COMMAND_SYNTAX_ERROR); - } catch (RuntimeException e) { - cr.setMessage(e.getMessage()); - cr.setErrorType(CommandResult.ErrorType.RUNTIME_ERROR); - } - - return cr; - } - - public static CommandResult execute(Player player, String command) { - return execute(getCommandSource(player), command); - } - - public static ServerCommandSource getCommandSource(MinecraftServer server) { - return server.getCommandSource(); - } - - public static ServerCommandSource getCommandSource(Player player) { - return player.getEntity().getCommandSource((ServerWorld) player.getWorld()); - } - - public static ServerCommandSource withLevel(ServerCommandSource source, int level) { - return source.withPermissions(LeveledPermissionPredicate.fromLevel(PermissionLevel.fromLevel(level))); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java deleted file mode 100644 index 8ba934d53..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import com.mojang.brigadier.arguments.*; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.block.Block; -import net.minecraft.command.argument.BlockStateArgumentType; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.ItemStackArgumentType; -import net.minecraft.entity.Entity; -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public class CommandUtil { - public static Item getItemArgument(String name, ServerCommandEvent e) { - return ItemStackArgumentType.getItemStackArgument(e.getContext(), name).getItem(); - } - - public static Block getBlockArgument(String name, ServerCommandEvent e) { - return BlockStateArgumentType.getBlockState(e.getContext(), name).getBlockState().getBlock(); - } - - public static Integer getIntegerArgument(String name, ServerCommandEvent e) { - return IntegerArgumentType.getInteger(e.getContext(), name); - } - - public static Double getDoubleArgument(String name, ServerCommandEvent e) { - return DoubleArgumentType.getDouble(e.getContext(), name); - } - - public static Float getFloatArgument(String name, ServerCommandEvent e) { - return FloatArgumentType.getFloat(e.getContext(), name); - } - - public static Long getLongArgument(String name, ServerCommandEvent e) { - return LongArgumentType.getLong(e.getContext(), name); - } - - public static Boolean getBooleanArgument(String name, ServerCommandEvent e) { - return BoolArgumentType.getBool(e.getContext(), name); - } - - public static String getStringArgument(String name, ServerCommandEvent e) { - return StringArgumentType.getString(e.getContext(), name); - } - - public static Entity getEntityArgument(String name, ServerCommandEvent e) { - try { - return EntityArgumentType.getEntity(e.getContext(), name); - } catch (CommandSyntaxException ex) { - return null; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java deleted file mode 100644 index c17a5d707..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java +++ /dev/null @@ -1,123 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.util.ActionResult; -import net.pitan76.mcpitanlib.api.event.result.EventResult; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; - -import java.util.Optional; - -public class CompatActionResult { - public static final CompatActionResult SUCCESS = new CompatActionResult(ActionResult.SUCCESS, EventResult.success()); - public static final CompatActionResult PASS = new CompatActionResult(ActionResult.PASS, EventResult.pass()); - public static final CompatActionResult FAIL = new CompatActionResult(ActionResult.FAIL, EventResult.fail()); - public static final CompatActionResult CONSUME = new CompatActionResult(ActionResult.CONSUME, EventResult.success()); - public static final CompatActionResult PASS_TO_DEFAULT_BLOCK_ACTION = new CompatActionResult(ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION, EventResult.pass()); - public static final CompatActionResult SUCCESS_SERVER = new CompatActionResult(ActionResult.SUCCESS_SERVER, EventResult.success()); - public static final CompatActionResult STOP = new CompatActionResult(ActionResult.FAIL, EventResult.stop()); - - private final ActionResult actionResult; - private final EventResult eventResult; - - protected CompatActionResult(ActionResult actionResult, EventResult eventResult) { - this.actionResult = actionResult; - this.eventResult = eventResult; - } - - public ActionResult toActionResult() { - return actionResult; - } - - public EventResult toEventResult() { - return eventResult; - } - - public Optional getNewMidohraHandStack() { - return getNewHandStack().map(ItemStack::of); - } - - public Optional getNewHandStack() { - if (!(actionResult instanceof ActionResult.Success)) return Optional.empty(); - - ActionResult.Success success = (ActionResult.Success) actionResult; - return Optional.ofNullable(success.getNewHandStack()); - } - - public static CompatActionResult of(ActionResult result) { - if (result == ActionResult.SUCCESS) - return SUCCESS; - - if (result == ActionResult.PASS) - return PASS; - - if (result == ActionResult.FAIL) - return FAIL; - - if (result == ActionResult.CONSUME) - return CONSUME; - - if (result == ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION) - return PASS_TO_DEFAULT_BLOCK_ACTION; - - if (result == ActionResult.SUCCESS_SERVER) - return SUCCESS_SERVER; - - return PASS; - } - - public static CompatActionResult of(EventResult result) { - if (result == EventResult.success()) - return SUCCESS; - - if (result == EventResult.pass()) - return PASS; - - if (result == EventResult.fail()) - return FAIL; - - if (result == EventResult.stop()) - return STOP; - - return PASS; - } - - @Deprecated - public static CompatActionResult create(ActionResult result, EventResult eventResult) { - return new CompatActionResult(result, eventResult); - } - - /** - * @deprecated Use {@link #of(ActionResult)} instead. - */ - @Deprecated - public static CompatActionResult create(ActionResult result) { - return of(result); - } - - @Deprecated - public static CompatActionResult create2(ActionResult result) { - return create(result, EventResult.stop()); - } - - @Override - public boolean equals(Object obj) { - if (super.equals(obj)) return true; - if (!(obj instanceof CompatActionResult)) return false; - if (actionResult.equals(((CompatActionResult) obj).actionResult)) { - return eventResult.equals(((CompatActionResult) obj).eventResult); - } - - return false; - } - - public String getName() { - if (this == SUCCESS) return "SUCCESS"; - if (this == PASS) return "PASS"; - if (this == FAIL) return "FAIL"; - if (this == CONSUME) return "CONSUME"; - if (this == PASS_TO_DEFAULT_BLOCK_ACTION) return "PASS_TO_DEFAULT_BLOCK_ACTION"; - if (this == SUCCESS_SERVER) return "SUCCESS_SERVER"; - if (this == STOP) return "STOP"; - - return "UNKNOWN"; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java deleted file mode 100644 index b471d8313..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java +++ /dev/null @@ -1,173 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.util.Identifier; - -import java.util.Objects; - -/** - * This is the Identifier class unique to MCPitanLib. - * It is different from Minecraft's Identifier class. - */ -public class CompatIdentifier { - private final String namespace; - private final String path; - - public static final CompatIdentifier EMPTY = CompatIdentifier.of("mcpitanlib:empty"); - - /** - * Creates a new Identifier with the given namespace and path. - * @param namespace The namespace of the Identifier. - * @param path The path of the Identifier. - */ - public CompatIdentifier(String namespace, String path) { - this.namespace = namespace; - this.path = path; - } - - /** - * Creates a new Identifier with the given id. - * @param id The id of the Identifier. - */ - public CompatIdentifier(String id) { - if (!id.contains(":")) { - this.namespace = "minecraft"; - this.path = id; - return; - } - String[] split = id.split(":"); - this.namespace = split[0]; - this.path = split[1]; - } - - /** - * Creates a new Identifier with the given id. - * @param id The id of the Identifier. - * @return The Identifier. - */ - public static CompatIdentifier of(String id) { - return new CompatIdentifier(id); - } - - /** - * Creates a new Identifier with the given namespace and path. - * @param namespace The namespace of the Identifier. - * @param path The path of the Identifier. - * @return The Identifier. - */ - public static CompatIdentifier of(String namespace, String path) { - return new CompatIdentifier(namespace, path); - } - - /** - * Returns the string representation of the Identifier. - * @return The string representation of the Identifier. - */ - public String toString() { - return this.namespace + ":" + this.path; - } - - /** - * Returns the namespace of the Identifier. - * @return The namespace of the Identifier. - */ - public String getNamespace() { - return this.namespace; - } - - /** - * Returns the path of the Identifier. - * @return The path of the Identifier. - */ - public String getPath() { - return this.path; - } - - public boolean equals(Object obj) { - if (this == obj) { - return true; - } else if (obj != null && this.getClass() == obj.getClass()) { - CompatIdentifier identifier = (CompatIdentifier)obj; - return this.namespace.equals(identifier.namespace) && this.path.equals(identifier.path); - } else if (obj instanceof Identifier) { - return this.toString().equals(obj.toString()); - } else if (obj instanceof String) { - return this.toString().equals(obj); - } else { - return false; - } - } - - public boolean equals(CompatIdentifier identifier) { - return this.namespace.equals(identifier.namespace) && this.path.equals(identifier.path); - } - - public boolean equals(String id) { - return this.toString().equals(id); - } - - public static boolean equals(CompatIdentifier id1, CompatIdentifier id2) { - return id1.namespace.equals(id2.namespace) && id1.path.equals(id2.path); - } - - public static boolean equals(CompatIdentifier id1, Identifier id2) { - return id1.toString().equals(id2.toString()); - } - - public static boolean equals(Identifier id1, CompatIdentifier id2) { - return id1.toString().equals(id2.toString()); - } - - public static boolean equals(Identifier id1, Identifier id2) { - return id1.toString().equals(id2.toString()); - } - - @Override - public int hashCode() { - return 31 * this.namespace.hashCode() + this.path.hashCode(); - } - - // ---- - - /** - * Converts this MCPitanLib Identifier to a Minecraft Identifier. - * @return The Minecraft Identifier. - */ - public Identifier toMinecraft() { - return IdentifierUtil.id(this.toString()); - } - - /** - * Converts a Minecraft Identifier to an MCPitanLib Identifier. - * @param id The Minecraft Identifier. - * @return The Identifier. - */ - public static CompatIdentifier fromMinecraft(Identifier id) { - if (id == null) return EMPTY; - return of(id.toString()); - } - - public static CompatIdentifier empty() { - return EMPTY; - } - - public boolean isEmpty() { - return equals(EMPTY); - } - - public static boolean isMinecraftNamespace(CompatIdentifier id) { - return id.getNamespace().equals("minecraft"); - } - - public boolean isMinecraftNamespace() { - return this.namespace.equals("minecraft"); - } - - public CompatIdentifier(Identifier id) { - this.namespace = id.getNamespace(); - this.path = id.getPath(); - } - - public static CompatIdentifier of(Identifier id) { - return new CompatIdentifier(id); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java deleted file mode 100644 index e11866da2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.util.Formatting; -import net.minecraft.util.Rarity; - -public class CompatRarity implements CompatStringIdentifiable { - private final Rarity rarity; - - public static final CompatRarity NONE = of(Rarity.COMMON); - public static final CompatRarity COMMON = of(Rarity.COMMON); - public static final CompatRarity UNCOMMON = of(Rarity.UNCOMMON); - public static final CompatRarity RARE = of(Rarity.RARE); - public static final CompatRarity EPIC = of(Rarity.EPIC); - - public CompatRarity(Rarity rarity) { - this.rarity = rarity; - } - - public static CompatRarity of(Rarity rarity) { - return new CompatRarity(rarity); - } - - public Rarity get() { - return rarity; - } - - public Formatting getFormatting() { - return rarity.getFormatting(); - } - - public String getName() { - return rarity.name(); - } - - @Override - public String asString_compat() { - return getName(); - } - - public static CompatRarity fromString(String name) { - switch (name) { - case "common": - return COMMON; - case "uncommon": - return UNCOMMON; - case "rare": - return RARE; - case "epic": - return EPIC; - default: - return NONE; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java deleted file mode 100644 index 2fb01f76e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.util.StringIdentifiable; - -public interface CompatStringIdentifiable extends StringIdentifiable { - @Deprecated - @Override - default String asString() { - return asString_compat(); - } - - String asString_compat(); - - default StringIdentifiable get() { - return this; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java deleted file mode 100644 index 6201ecc60..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.util.Identifier; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; -import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; -import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; - -public class CompatibleRecipeEntryUtil { - public static CompatibleRecipeEntry createShapelessRecipe(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { - return new CompatibleRecipeEntry(id, group, category, RecipeUtil.createShapelessRecipe(id, group, category, output, input)); - } - - public static CompatibleRecipeEntry createShapelessRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { - return createShapelessRecipe(id.toMinecraft(), group, category, output, input); - } - - public static RecipeEntry createShapelessRecipeM(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { - return RecipeEntry.of(RecipeUtil.createShapelessRecipe(id.toMinecraft(), group, category, output, input), id); - } - - public static CompatRecipe createShapelessAsCompatRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { - return new CompatRecipe(RecipeUtil.createShapelessRecipe(id.toMinecraft(), group, category, output, input), id.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java deleted file mode 100644 index 96507c718..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java +++ /dev/null @@ -1,175 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.NbtComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; - -import java.util.Set; - -/** - * カスタムデータのユーティリティクラス - */ -public class CustomDataUtil { - /** - * NBTを取得する。存在しない場合は新しいNBTを作成する。 - * @param stack ItemStack - * @return NBT - */ - public static NbtCompound getOrCreateNbt(ItemStack stack) { - if (!hasNbt(stack)) { - return NbtUtil.create(); - } - - return getNbt(stack); - } - - /** - * NBTを設定する。 - * @param stack ItemStack - * @param nbt NBT - */ - public static void setNbt(ItemStack stack, NbtCompound nbt) { - stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt)); - } - - /** - * NBTが存在するかどうかを取得する。 - * @param stack ItemStack - * @return NBTが存在するかどうか - */ - public static boolean hasNbt(ItemStack stack) { - return stack.get(DataComponentTypes.CUSTOM_DATA) != null; - } - - /** - * NBTを取得する。 - * @param stack ItemStack - * @return NBT - */ - public static NbtCompound getNbt(ItemStack stack) { - if (stack.get(DataComponentTypes.CUSTOM_DATA) == null) - return NbtUtil.create(); - - return stack.get(DataComponentTypes.CUSTOM_DATA).copyNbt(); - } - - /** - * 値を設定する。 - * @param stack ItemStack - * @param key キー - * @param value 値 - */ - public static void put(ItemStack stack, String key, NbtCompound value) { - NbtCompound nbt = getOrCreateNbt(stack); - NbtUtil.put(nbt, key, value); - setNbt(stack, nbt); - } - - /** - * 値を取得する。 - * @param stack ItemStack - * @param key キー - * @return 値 - */ - public static NbtCompound get(ItemStack stack, String key) { - NbtCompound nbt = getNbt(stack); - return nbt.getCompoundOrEmpty(key); - } - - /** - * 値を削除する。 - * @param stack ItemStack - * @param key キー - */ - public static void remove(ItemStack stack, String key) { - NbtCompound nbt = getNbt(stack); - nbt.remove(key); - setNbt(stack, nbt); - } - - /** - * 値が存在するかどうかを取得する。 - * @param stack ItemStack - * @param key キー - * @return 値が存在するかどうか - */ - public static boolean has(ItemStack stack, String key) { - if (!hasNbt(stack)) - return false; - - NbtCompound nbt = getNbt(stack); - return nbt.contains(key); - } - - /** - * 指定した型の値を取得する - * @param stack ItemStack - * @param key キー - * @param clazz クラス - * @param 値 - */ - public static T get(ItemStack stack, String key, Class clazz) { - NbtCompound nbt = getNbt(stack); - return NbtUtil.get(nbt, key, clazz); - } - - /** - * 値を設定する。 - * @param stack ItemStack - * @param key キー - * @param value 値 - */ - public static void set(ItemStack stack, String key, T value) { - NbtCompound nbt = getOrCreateNbt(stack); - NbtUtil.set(nbt, key, value); - setNbt(stack, nbt); - } - - /** - * キーの一覧を取得する。 - * @param stack ItemStack - * @return キーの一覧 - */ - public static Set getKeys(ItemStack stack) { - NbtCompound nbt = getNbt(stack); - return NbtUtil.getKeys(nbt); - } - - /** - * set(stack, key, value) のエイリアス - * @param stack ItemStack - * @param key キー - * @param value 値 - */ - public static void put(ItemStack stack, String key, T value) { - set(stack, key, value); - } - - /** - * has(stack, key) のエイリアス - * @param stack ItemStack - * @param key キー - * @return 値が存在するかどうか - */ - public static boolean contains(ItemStack stack, String key) { - return has(stack, key); - } - - /** - * 1.20.3以前下位互換のための修正用 - * @param stack ItemStack - * @param keys 移植するキー - */ - public static void fix_oldNbt(ItemStack stack, String[] keys) { - - } - - /** - * カスタムNBTを削除する - * @param stack ItemStack - */ - public static void remove(ItemStack stack) { - stack.remove(DataComponentTypes.CUSTOM_DATA); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java deleted file mode 100644 index b5733480d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class DamageSourceUtil { - public static DamageSource thrownProjectile(Entity projectile, Entity attacker, Entity source) { - return source.getDamageSources().thrown(projectile, attacker); - } - - public static DamageSource thrownProjectile(Entity projectile, Entity attacker) { - return thrownProjectile(projectile, attacker, projectile); - } - - public static DamageSource playerAttack(Player attacker, Entity source) { - return source.getDamageSources().playerAttack(attacker.getPlayerEntity()); - } - - public static DamageSource playerAttack(Player attacker) { - return playerAttack(attacker, attacker.getPlayerEntity()); - } - - public static DamageSource mobAttack(LivingEntity attacker, Entity source) { - return source.getDamageSources().mobAttack(attacker); - } - - public static DamageSource mobAttack(LivingEntity attacker) { - return mobAttack(attacker, attacker); - } - - public static DamageSource mobProjectile(Entity projectile, LivingEntity attacker, Entity source) { - return source.getDamageSources().mobProjectile(projectile, attacker); - } - - public static DamageSource mobProjectile(Entity projectile, LivingEntity attacker) { - return mobProjectile(projectile, attacker, projectile); - } - - public static DamageSource fall(Entity source) { - return source.getDamageSources().fall(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java deleted file mode 100644 index 13d9ad550..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java +++ /dev/null @@ -1,68 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; -import net.pitan76.mcpitanlib.api.state.property.CompatProperties; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Direction; -import net.pitan76.mcpitanlib.midohra.world.World; - -public class DirectionBoolPropertyUtil { - /** - * 指定位置のブロック状態に対して、方向に対応する Boolean プロパティを設定してワールドに反映する。 - * 例: Direction.UP => CompatProperties.UP - * @return プロパティが存在して設定に成功した場合は true、プロパティが存在しない場合やブロック状態が null の場合は false - */ - public static boolean setProperty(World world, BlockPos pos, Direction dir, boolean value) { - BlockState state = world.getBlockState(pos); - - if (dir == Direction.UP && state.contains(CompatProperties.UP)) { - state = state.with(CompatProperties.UP, value); - } else if (dir == Direction.DOWN && state.contains(CompatProperties.DOWN)) { - state = state.with(CompatProperties.DOWN, value); - } else if (dir == Direction.NORTH && state.contains(CompatProperties.NORTH)) { - state = state.with(CompatProperties.NORTH, value); - } else if (dir == Direction.SOUTH && state.contains(CompatProperties.SOUTH)) { - state = state.with(CompatProperties.SOUTH, value); - } else if (dir == Direction.WEST && state.contains(CompatProperties.WEST)) { - state = state.with(CompatProperties.WEST, value); - } else if (dir == Direction.EAST && state.contains(CompatProperties.EAST)) { - state = state.with(CompatProperties.EAST, value); - } else { - return false; - } - - world.setBlockState(pos, state); - return true; - } - - public static boolean hasAll(BlockState state) { - return state.contains(CompatProperties.UP) && state.contains(CompatProperties.DOWN) && state.contains(CompatProperties.NORTH) && - state.contains(CompatProperties.SOUTH) && state.contains(CompatProperties.WEST) && state.contains(CompatProperties.EAST); - } - - public static BlockState clearAll(BlockState state) { - return state - .with(CompatProperties.UP, false) - .with(CompatProperties.DOWN, false) - .with(CompatProperties.NORTH, false) - .with(CompatProperties.EAST, false) - .with(CompatProperties.SOUTH, false) - .with(CompatProperties.WEST, false); - } - - public static void addProperties(AppendPropertiesArgs args) { - args.addProperty(CompatProperties.UP, CompatProperties.DOWN, CompatProperties.NORTH, - CompatProperties.EAST, CompatProperties.SOUTH, CompatProperties.WEST); - } - - public static BlockState withAll(BlockState state, boolean value) { - return state - .with(CompatProperties.UP, value) - .with(CompatProperties.DOWN, value) - .with(CompatProperties.NORTH, value) - .with(CompatProperties.EAST, value) - .with(CompatProperties.SOUTH, value) - .with(CompatProperties.WEST, value); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java deleted file mode 100644 index 8f449872f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java +++ /dev/null @@ -1,82 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.ItemEnchantmentsComponent; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class EnchantmentUtil { - public static CompatEnchantment getEnchantment(Identifier identifier) { - RegistryKey registryKey = RegistryKey.of(RegistryKeys.ENCHANTMENT, identifier); - return new CompatEnchantment(registryKey); - } - - public static Identifier getId(CompatEnchantment enchantment) { - return enchantment.getId(); - } - - public static int getLevel(CompatEnchantment enchantment, ItemStack stack, @Nullable World world) { - return enchantment.getLevel(stack, world); - } - - // CompatIdentifier - public static CompatEnchantment getEnchantment(CompatIdentifier identifier) { - return getEnchantment(identifier.toMinecraft()); - } - - public static CompatIdentifier getCompatId(CompatEnchantment enchantment) { - return CompatIdentifier.fromMinecraft(enchantment.getId()); - } - - public static List getEnchantments(ItemStack stack) { - List enchantments = new ArrayList<>(); - - EnchantmentHelper.getEnchantments(stack).getEnchantments().forEach((enchantment) -> { - if (enchantment.getKey().isPresent()) - enchantments.add(new CompatEnchantment(enchantment.getKey().get())); - }); - - return enchantments; - } - - public static boolean hasEnchantment(ItemStack stack) { - return EnchantmentHelper.hasEnchantments(stack); - } - - public static Map getEnchantment(ItemStack stack, @Nullable World world) { - Map enchantments = new HashMap<>(); - - List enchantmentList = getEnchantments(stack); - enchantmentList.forEach((enchantment) -> { - enchantments.put(enchantment, getLevel(enchantment, stack, world)); - }); - - return enchantments; - } - - public static void setEnchantment(ItemStack stack, Map enchantments, @Nullable World world) { - ItemEnchantmentsComponent.Builder builder = new ItemEnchantmentsComponent.Builder(ItemEnchantmentsComponent.DEFAULT); - - enchantments.forEach((compatEnchantment, integer) -> { - builder.add(compatEnchantment.getEntry(world), integer); - }); - - EnchantmentHelper.set(stack, builder.build()); - } - - public static void removeEnchantment(ItemStack stack) { - stack.remove(DataComponentTypes.ENCHANTMENTS); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java deleted file mode 100644 index 196fb231c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.entity.EntityType; -import net.minecraft.registry.Registries; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; - -public class EntityTypeUtil { - public static Identifier toID(EntityType entityType) { - return Registries.ENTITY_TYPE.getId(entityType); - } - - public static EntityType fromId(Identifier identifier) { - return Registries.ENTITY_TYPE.get(identifier); - } - - public static boolean isExist(Identifier identifier) { - return Registries.ENTITY_TYPE.containsId(identifier); - } - - public static CompatIdentifier toCompatID(EntityType entityType) { - return CompatIdentifier.fromMinecraft(toID(entityType)); - } - - public static EntityType fromId(CompatIdentifier identifier) { - return fromId(identifier.toMinecraft()); - } - - public static boolean isExist(CompatIdentifier identifier) { - return isExist(identifier.toMinecraft()); - } - - public static int getRawId(EntityType type) { - return Registries.ENTITY_TYPE.getRawId(type); - } - - public static EntityType fromIndex(int index) { - return Registries.ENTITY_TYPE.get(index); - } - - public static Text getName(EntityType entityType) { - return entityType.getName(); - } - - public static String getTranslationKey(EntityType entityType) { - return entityType.getTranslationKey(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java deleted file mode 100644 index 8872d9f4a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java +++ /dev/null @@ -1,364 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.network.packet.s2c.play.PositionFlag; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.text.Text; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; - -import java.util.UUID; - -public class EntityUtil { - public static World getWorld(Entity entity) { - return entity.getEntityWorld(); - } - - public static boolean damage(Entity target, DamageSource damageSource, float amount) { - return target.damage((ServerWorld) target.getEntityWorld(), damageSource, amount); - } - - public static boolean damageWithThrownProjectile(Entity target, float damageAmount, Entity projectile, Entity attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.thrownProjectile(projectile, attacker), damageAmount); - } - - public static boolean damageWithMobProjectile(Entity target, float damageAmount, Entity projectile, LivingEntity attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.mobProjectile(projectile, attacker), damageAmount); - } - - public static boolean damageWithMobAttack(Entity target, float damageAmount, Entity source, LivingEntity attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.mobAttack(attacker, source), damageAmount); - } - - public static boolean damageWithPlayerAttack(Entity target, float damageAmount, Entity source, Player attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.playerAttack(attacker, source), damageAmount); - } - - public static void discard(Entity entity) { - entity.discard(); - } - - public static void kill(Entity entity) { - if (entity.getEntityWorld() instanceof ServerWorld) - return; - - entity.kill((ServerWorld) entity.getEntityWorld()); - } - - public static void setVelocity(Entity entity, double x, double y, double z) { - entity.setVelocity(x, y, z); - } - - public static Vec3d getVelocity(Entity entity) { - return entity.getVelocity(); - } - - public static void setNoGravity(Entity entity, boolean noGravity) { - entity.setNoGravity(noGravity); - } - - public static boolean hasNoGravity(Entity entity) { - return entity.hasNoGravity(); - } - - public static void setInvulnerable(Entity entity, boolean invulnerable) { - entity.setInvulnerable(invulnerable); - } - - public static boolean isInvulnerable(Entity entity) { - return entity.isInvulnerable(); - } - - public static void setSilent(Entity entity, boolean silent) { - entity.setSilent(silent); - } - - public static boolean isSilent(Entity entity) { - return entity.isSilent(); - } - - public static void setGlowing(Entity entity, boolean glowing) { - entity.setGlowing(glowing); - } - - public static boolean isGlowing(Entity entity) { - return entity.isGlowing(); - } - - public static void setFire(Entity entity, int seconds) { - entity.setOnFireFor(seconds); - } - - public static void extinguish(Entity entity) { - entity.extinguish(); - } - - public static boolean isOnFire(Entity entity) { - return entity.isOnFire(); - } - - public static void setInvisible(Entity entity, boolean invisible) { - entity.setInvisible(invisible); - } - - public static boolean isInvisible(Entity entity) { - return entity.isInvisible(); - } - - public static void setSneaking(Entity entity, boolean sneaking) { - entity.setSneaking(sneaking); - } - - public static boolean isSneaking(Entity entity) { - return entity.isSneaking(); - } - - public static void setSprinting(Entity entity, boolean sprinting) { - entity.setSprinting(sprinting); - } - - public static boolean isSprinting(Entity entity) { - return entity.isSprinting(); - } - - public static void setSwimming(Entity entity, boolean swimming) { - entity.setSwimming(swimming); - } - - public static boolean isSwimming(Entity entity) { - return entity.isSwimming(); - } - - public static void detach(Entity entity) { - entity.detach(); - } - - public static void attach(Entity entity, Entity vehicle) { - entity.startRiding(vehicle, true, true); - } - - public static void detachFromVehicle(Entity entity) { - entity.stopRiding(); - } - - public static boolean isRiding(Entity entity) { - return entity.hasVehicle(); - } - - public static Entity getVehicle(Entity entity) { - return entity.getVehicle(); - } - - public static void setVehicle(Entity entity, Entity vehicle) { - entity.startRiding(vehicle, true, true); - } - - public static void applyRotation(Entity entity, BlockRotation rotation) { - entity.applyRotation(rotation); - } - - public static void setVelocity(Entity entity, Vec3d velocity) { - entity.setVelocity(velocity); - } - - public static void setFallDistance(Entity entity, double fallDistance) { - entity.fallDistance = fallDistance; - } - - public static double getFallDistance(Entity entity) { - return entity.fallDistance; - } - - public static void setVelocityModified(Entity entity, boolean velocityModified) { - entity.velocityDirty = velocityModified; - } - - public static boolean isVelocityModified(Entity entity) { - return entity.velocityDirty; - } - - public static float getYaw(Entity entity) { - return entity.getYaw(); - } - - public static float getPitch(Entity entity) { - return entity.getPitch(); - } - - public static void setYaw(Entity entity, float yaw) { - entity.setYaw(yaw); - } - - public static void setPitch(Entity entity, float pitch) { - entity.setPitch(pitch); - } - - public static float getSpeed(Entity entity) { - return entity.speed; - } - - public static void setSpeed(Entity entity, float speed) { - entity.speed = speed; - } - - public static boolean isOnGround(Entity entity) { - return entity.isOnGround(); - } - - public static void setOnGround(Entity entity, boolean onGround) { - entity.setOnGround(onGround); - } - - public static boolean isAlive(Entity entity) { - return entity.isAlive(); - } - - public static UUID getUuid(Entity entity) { - return entity.getUuid(); - } - - public static String getUuidString(Entity entity) { - return entity.getUuidAsString(); - } - - public static void setUuid(Entity entity, UUID uuid) { - entity.setUuid(uuid); - } - - public static Text getName(Entity entity) { - return entity.getName(); - } - - public static Text getDisplayName(Entity entity) { - return entity.getDisplayName(); - } - - public static void setCustomName(Entity entity, Text customName) { - entity.setCustomName(customName); - } - - public static Text getCustomName(Entity entity) { - return entity.getCustomName(); - } - - public static void setCustomNameVisible(Entity entity, boolean visible) { - entity.setCustomNameVisible(visible); - } - - public static boolean isCustomNameVisible(Entity entity) { - return entity.isCustomNameVisible(); - } - - public static boolean hasCustomName(Entity entity) { - return entity.hasCustomName(); - } - - public static String getNameAsString(Entity entity) { - return entity.getName().getString(); - } - - public static String getDisplayNameAsString(Entity entity) { - if (entity.getDisplayName() == null) - return null; - return entity.getDisplayName().getString(); - } - - public static String getCustomNameAsString(Entity entity) { - if (entity.getCustomName() == null) - return null; - return entity.getCustomName().getString(); - } - - public static void setCustomName(Entity entity, String customName) { - entity.setCustomName(TextUtil.literal(customName)); - } - - public static Vec3d getRotationVector(Entity entity) { - return entity.getRotationVector(); - } - - public static Vec3d getPos(Entity entity) { - return entity.getEntityPos(); - } - - public static Vector3d getPosM(Entity entity) { - return Vector3d.of(getPos(entity)); - } - - public static void setPos(Entity entity, double x, double y, double z) { - entity.setPos(x, y, z); - } - - public static void addVelocity(Entity entity, double x, double y, double z) { - entity.addVelocity(x, y, z); - } - - public static void addVelocity(Entity entity, Vec3d velocity) { - entity.addVelocity(velocity); - } - - public static void addVelocity(Entity entity, Vector3d velocity) { - addVelocity(entity, velocity.toMinecraft()); - } - - public static void setVelocity(Entity entity, Vector3d velocity) { - entity.setVelocity(velocity.toMinecraft()); - } - - public static void setPos(Entity entity, BlockPos pos) { - setPos(entity, pos.getX(), pos.getY(), pos.getZ()); - } - - public static void setPos(Entity entity, Vector3d pos) { - setPos(entity, pos.getX(), pos.getY(), pos.getZ()); - } - - public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - entity.teleport(world, x, y, z, PositionFlag.VALUES, yaw, pitch, resetCamera); - } - - public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch) { - teleport(entity, world, x, y, z, yaw, pitch, true); - } - - public static void teleport(Entity entity, ServerWorld world, double x, double y, double z) { - teleport(entity, world, x, y, z, entity.getYaw(), entity.getPitch(), true); - } - - public static void teleport(Entity entity, ServerWorld world, Vector3d pos) { - teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); - } - - public static void teleport(Entity entity, ServerWorld world, BlockPos pos) { - teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); - } - - public static void teleport(Entity entity, double x, double y, double z) { - if (!(entity.getEntityWorld() instanceof ServerWorld)) - return; - - teleport(entity, (ServerWorld) entity.getEntityWorld(), x, y, z, entity.getYaw(), entity.getPitch()); - } - - public static void teleport(Entity entity, Vector3d pos) { - teleport(entity, pos.getX(), pos.getY(), pos.getZ()); - } - - public static void teleport(Entity entity, BlockPos pos) { - teleport(entity, pos.getX(), pos.getY(), pos.getZ()); - } - - public static void teleport(Entity entity, ServerWorld world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { - teleport(entity, world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); - } - - public static void teleport(Entity entity, ServerWorld raw, BlockPos pos, float yaw, float pitch, boolean resetCamera) { - teleport(entity, raw, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java deleted file mode 100644 index 2f97b2781..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.item.ToolMaterial; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; -import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; -import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; - -public class EquipMaterialUtil { - @Deprecated - public static ToolMaterial createToolMaterial(int durability, float miningSpeedMultiplier, float attackDamage, int miningLevel, int enchantability, Ingredient repairIngredient) { - return new ToolMaterial(CompatibleToolMaterial.level2inverseTag(miningLevel), durability, miningSpeedMultiplier, attackDamage, enchantability, ItemTags.IRON_TOOL_MATERIALS); - } - - public static ToolMaterial createToolMaterial(int durability, float miningSpeedMultiplier, float attackDamage, int miningLevel, int enchantability, RepairIngredientTag ingredientTag) { - return new ToolMaterial(CompatibleToolMaterial.level2inverseTag(miningLevel), durability, miningSpeedMultiplier, attackDamage, enchantability, ingredientTag.getTag()); - } - - public static int toInt(ArmorEquipmentType type) { - switch (type.getSlot()) { - case HEAD: - return 0; - case CHEST: - return 1; - case LEGS: - return 2; - case FEET: - return 3; - default: - return 0; - } - } - - public static CompatibleArmorMaterial createArmorMaterial(int[] durability, int[] protection, int enchantability, SoundEvent equipSound, Ingredient repairIngredient, String name, float toughness, float knockbackResistance) { - return ArmorMaterialUtil.create(name, durability, protection, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); - } - - @Deprecated - public static CompatibleArmorMaterial createArmorMaterial(int[] durability, int[] protection, int enchantability, SoundEvent equipSound, Ingredient repairIngredient, Identifier id, float toughness, float knockbackResistance) { - return ArmorMaterialUtil.create(id, durability, protection, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java deleted file mode 100644 index 5b2a4a017..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java +++ /dev/null @@ -1,81 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.structure.rule.RuleTest; -import net.minecraft.structure.rule.TagMatchRuleTest; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.Feature; -import net.minecraft.world.gen.feature.OreFeatureConfig; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class FeatureConfigUtil { - - /** - * Create a new ConfiguredFeature - * @param oreFeatureConfig The ore feature config - * @return The new ConfiguredFeature - */ - public static ConfiguredFeature createConfiguredFeature(OreFeatureConfig oreFeatureConfig) { - return new ConfiguredFeature<>(Feature.ORE, oreFeatureConfig); - } - - /** - * Create a new OreFeatureConfig - * @param test The rule test - * @param state The block state - * @param size The size - * @return The new OreFeatureConfig - */ - public static OreFeatureConfig createOreFeatureConfig(RuleTest test, BlockState state, int size) { - return new OreFeatureConfig(test, state, size); - } - - /** - * Create a new OreFeatureConfig - * @param test The rule test - * @param block The block - * @param size The size - * @return The new OreFeatureConfig - */ - public static OreFeatureConfig createOreFeatureConfig(RuleTest test, Block block, int size) { - return createOreFeatureConfig(test, block.getDefaultState(), size); - } - - /** - * Create a new OreFeatureConfig - * @param targets The targets - * @param size The size - * @return The new OreFeatureConfig - */ - public static OreFeatureConfig createOreFeatureConfig(List targets, int size) { - return new OreFeatureConfig(targets, size); - } - - /** - * Create a new OreFeatureConfig - * @param targetMap The target map - * @param size The size - * @return The new OreFeatureConfig - */ - public static OreFeatureConfig createOreFeatureConfig(Map targetMap, int size) { - List targets = new ArrayList<>(); - targetMap.forEach((ruleTest, blockState) -> targets.add(OreFeatureConfig.createTarget(ruleTest, blockState))); - return createOreFeatureConfig(targets, size); - } - - /** - * Create a new OreFeatureConfig - * @param state The block state - * @param size The size - * @return The new OreFeatureConfig - */ - public static OreFeatureConfig createStoneOreFeatureConfig(BlockState state, int size) { - RuleTest ruleTest = new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD); - return createOreFeatureConfig(ruleTest, state, size); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java deleted file mode 100644 index 848547d07..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.BlockState; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.registry.tag.FluidTags; -import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.World; - -public class FluidStateUtil { - public static boolean isWater(FluidState state) { - return state.isIn(FluidTags.WATER); - } - - public static boolean isLava(FluidState state) { - return state.isIn(FluidTags.LAVA); - } - - @Deprecated - public static FluidState getFluidState(BlockState state) { - return state.getFluidState(); - } - - public static FluidState getDefaultState(Fluid state) { - return state.getDefaultState(); - } - - public static Fluid getFluid(FluidState state) { - return state.getFluid(); - } - - public static FluidWrapper getFluidWrapper(FluidState state) { - return FluidWrapper.of(getFluid(state)); - } - - public static FluidWrapper getFluidWrapper(BlockState state) { - return getFluidWrapper(getFluidState(state)); - } - - public static FluidWrapper getFluidWrapper(net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return getFluidWrapper(state.toMinecraft()); - } - - public static FluidWrapper getFluidWrapper(World world, BlockPos pos) { - return getFluidWrapper(world.getBlockState(pos)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java deleted file mode 100644 index 8195dd203..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java +++ /dev/null @@ -1,109 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.fluid.FlowableFluid; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.minecraft.world.WorldView; - -public class FluidUtil { - public static Identifier toID(Fluid fluid) { - return Registries.FLUID.getId(fluid); - } - - public static Fluid fromId(Identifier identifier) { - return Registries.FLUID.get(identifier); - } - - public static Fluid fromId(CompatIdentifier identifier) { - return fromId(identifier.toMinecraft()); - } - - public static int getRawId(Fluid fluid) { - return Registries.FLUID.getRawId(fluid); - } - - public static Fluid fromIndex(int index) { - return Registries.FLUID.get(index); - } - - public static boolean isExist(CompatIdentifier id) { - return Registries.FLUID.containsId(id.toMinecraft()); - } - - public static CompatIdentifier toCompatId(Fluid fluid) { - return CompatIdentifier.fromMinecraft(toID(fluid)); - } - - public static Fluid fromCompatId(CompatIdentifier id) { - return fromId(id.toMinecraft()); - } - - public static FlowableFluid water() { - return Fluids.WATER; - } - - public static FlowableFluid lava() { - return Fluids.LAVA; - } - - public static Fluid empty() { - return Fluids.EMPTY; - } - - public static FlowableFluid flowingWater() { - return Fluids.FLOWING_WATER; - } - - public static FlowableFluid flowingLava() { - return Fluids.FLOWING_LAVA; - } - - public static boolean isStill(Fluid fluid) { - return fluid == water() || fluid == lava(); - } - - public static boolean isStill(FluidState state) { - return state.isStill(); - } - - public static FluidState getStill(FlowableFluid fluid, boolean falling) { - return fluid.getStill(falling); - } - - public static FluidState getFlowing(FlowableFluid fluid, int level, boolean falling) { - return fluid.getFlowing(level, falling); - } - - public static FluidState getStill(FlowableFluid fluid) { - return getStill(fluid, false); - } - - public static FluidState getStillWater() { - return getStill(water()); - } - - public static FluidState getStillLava() { - return getStill(lava()); - } - - public static boolean isFlowing(Fluid fluid) { - return fluid == flowingWater() || fluid == flowingLava(); - } - - public static int getTickRate(Fluid fluid, WorldView world) { - return fluid.getTickRate(world); - } - - public static FluidState getDefaultState(Fluid fluid) { - return fluid.getDefaultState(); - } - - - public static Item getBucketItem(Fluid fluid) { - return fluid.getBucketItem(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java deleted file mode 100644 index 8690b4db9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.util.Hand; - -public class HandUtil { - public static Hand getOppositeHand(Hand hand) { - return hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND; - } - - public static EquipmentSlot getEquipmentSlot(Hand hand) { - return hand == Hand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; - } - - public static Hand getHand(EquipmentSlot slot) { - return slot == EquipmentSlot.MAINHAND ? Hand.MAIN_HAND : Hand.OFF_HAND; - } - - public static Hand getHand(boolean mainHand) { - return mainHand ? Hand.MAIN_HAND : Hand.OFF_HAND; - } - - public static boolean isMainHand(Hand hand) { - return hand == Hand.MAIN_HAND; - } - - public static boolean isOffHand(Hand hand) { - return hand == Hand.OFF_HAND; - } - - public static boolean isMainHand(EquipmentSlot slot) { - return slot == EquipmentSlot.MAINHAND; - } - - public static boolean isOffHand(EquipmentSlot slot) { - return slot == EquipmentSlot.OFFHAND; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java deleted file mode 100644 index 2b2841b69..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.util.Identifier; - -public class IdentifierUtil { - public static Identifier id(String id) { - return Identifier.of(id); - } - - public static Identifier id(String namespace, String path) { - return Identifier.of(namespace, path); - } - - public static String toString(Identifier identifier) { - return identifier.toString(); - } - - public static String getNamespace(Identifier identifier) { - return identifier.getNamespace(); - } - - public static String getPath(Identifier identifier) { - return identifier.getPath(); - } - - public static Identifier from(CompatIdentifier id) { - if (id == null) - return null; - - return id.toMinecraft(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java deleted file mode 100644 index 3f29ac40f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java +++ /dev/null @@ -1,96 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.Registries; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.entry.RegistryEntryList; -import net.minecraft.util.Identifier; -import net.minecraft.util.collection.DefaultedList; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class IngredientUtil { - public static Ingredient fromTagByIdentifier(Identifier id) { - List items = ItemUtil.getItems(id); - - List> entryList = new ArrayList<>(); - for (Item item : items) { - entryList.add(Registries.ITEM.getEntry(item)); - } - - RegistryEntryList entryList2 = RegistryEntryList.of(entryList); - - return Ingredient.ofTag(entryList2); - } - - public static Ingredient fromTagByString(String id) { - return fromTagByIdentifier(IdentifierUtil.id(id)); - } - - public static Ingredient fromTagByIdentifier(CompatIdentifier id) { - return fromTagByIdentifier(id.toMinecraft()); - } - - public static List getItems(Ingredient ingredient) { - List items = new ArrayList<>(); - - for (RegistryEntry entry : ingredient.getMatchingItems().toList()) { - items.add(entry.value()); - } - - return items; - } - - public static IntList getMatchingStacksIds(Ingredient ingredient) { - IntList ids = new IntArrayList(); - - for (Item item : getItems(ingredient)) { - ids.add(ItemUtil.getRawId(item)); - } - - return ids; - } - - public static List getMatchingStacksAsList(Ingredient ingredient) { - return new ArrayList<>(Arrays.asList(getMatchingStacks(ingredient))); - } - - public static ItemStack[] getMatchingStacks(Ingredient ingredient) { - List stacks = new ArrayList<>(); - for (Item item : getItems(ingredient)) { - stacks.add(new ItemStack(item)); - } - - return stacks.toArray(new ItemStack[0]); - } - - public static Ingredient empty() { - return null; - } - - public static Ingredient ofItems(ItemConvertible... items) { - return Ingredient.ofItems(items); - } - - public static DefaultedList buildInput(Object[] input) { - DefaultedList list = DefaultedList.of(); - for (Object obj : input) { - if (obj instanceof Ingredient) { - list.add((Ingredient) obj); - continue; - } - - if (obj instanceof ItemConvertible) { - list.add(ofItems((ItemConvertible) obj)); - } - } - return list; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java deleted file mode 100644 index ec99294b9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.BlockState; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; -import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; -import net.pitan76.mcpitanlib.api.event.item.ItemUseOnEntityEvent; -import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; -import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; - -public class InteractUtil { - - public static StackActionResult useItem(Item item, ItemUseEvent event) { - CompatActionResult result = CompatActionResult.create(item.use(event.getWorld(), event.user.getEntity(), event.getHand())); - return StackActionResult.create(result, event.getStack()); - } - - public static CompatActionResult useItemOnBlock(Item item, ItemUsageContext context) { - return CompatActionResult.create(item.useOnBlock(context)); - } - - public static CompatActionResult useItemOnBlock(Item item, ItemUseOnBlockEvent event) { - return useItemOnBlock(item, event.toIUC()); - } - - public static CompatActionResult useItemOnEntity(Item item, ItemUseOnEntityEvent event) { - return CompatActionResult.create(item.useOnEntity(event.getStack(), event.getUser().getEntity(), event.getEntity(), event.getHand())); - } - - public static CompatUseAction getUseAction(Item item, UseActionArgs args) { - return CompatUseAction.of(item.getUseAction(args.stack)); - } - - public static CompatUseAction getUseAction(Item item, ItemStack stack) { - return CompatUseAction.of(item.getUseAction(stack)); - } - - public static CompatActionResult useBlock(BlockState state, World world, Player player, BlockHitResult hitResult) { - return BlockStateUtil.onUse(state, world, player, hitResult); - } - - public static CompatActionResult useBlock(BlockState state, World world, Player player, Direction dir, BlockPos blockPos) { - return BlockStateUtil.onUse(state, world, player, dir, blockPos); - } - - public static boolean onStoppingUsing(Item item, ItemStack stack, World world, Player player, int remainingUseTicks) { - return item.onStoppedUsing(stack, world, player.getEntity(), remainingUseTicks); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java deleted file mode 100644 index 8ff9c3eff..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java +++ /dev/null @@ -1,202 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.nbt.NbtListUtil; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; - -public class InventoryUtil { - public static boolean insertItem(ItemStack insertStack, DefaultedList inventory) { - return insertItem(insertStack, inventory, false); - } - - public static boolean insertItem(ItemStack insertStack, DefaultedList inventory, boolean test) { - boolean isInserted = false; - for (int i = 0; i < inventory.size(); i++) { - ItemStack stack = inventory.get(i); - if (stack.isEmpty()) { - if (!test) inventory.set(i, insertStack); - isInserted = true; - break; - } else if (canMergeItems(stack, insertStack)) { - int j = insertStack.getCount(); - if (!test) stack.increment(j); - isInserted = j > 0; - break; - } - } - return isInserted; - - } - - public static boolean canMergeItems(ItemStack first, ItemStack second) { - if (!first.isOf(second.getItem())) { - return false; - } - if (first.getDamage() != second.getDamage()) { - return false; - } - if (first.getCount() + second.getCount() > first.getMaxCount()) { - return false; - } - return ItemStackUtil.areNbtOrComponentEqual(first, second); - } - - public static NbtCompound writeNbt(NbtRWArgs args, NbtCompound nbt, DefaultedList stacks, boolean setIfEmpty) { - boolean nbtNull = nbt == null; - - if (args instanceof WriteNbtArgs) { - WriteNbtArgs writeNbtArgs = (WriteNbtArgs) args; - if (writeNbtArgs.view == null) writeNbtArgs.view = NbtWriteView.create(ErrorReporter.EMPTY); - - Inventories.writeData(writeNbtArgs.view, stacks, setIfEmpty); - if (!nbtNull) - NbtUtil.put(nbt, "Items", NbtListUtil.create()); // dummy list to compat with old mod - - NbtDataConverter.data2nbt(writeNbtArgs.view, nbt); - return nbt; - } - - WriteView view = NbtDataConverter.nbt2writeData(nbt, args.registryLookup); - Inventories.writeData(view, stacks, setIfEmpty); - if (!nbtNull) - NbtUtil.put(nbt, "Items", NbtListUtil.create()); // dummy list to compat with old mod - - NbtDataConverter.data2nbt(view, nbt); - return nbt; - } - - public static void readNbt(NbtRWArgs args, NbtCompound nbt, DefaultedList stacks) { - if (args instanceof ReadNbtArgs) { - ReadNbtArgs readNbtArgs = (ReadNbtArgs) args; - if (readNbtArgs.view == null) return; - - Inventories.readData(readNbtArgs.view, stacks); - return; - } - - ReadView view = NbtDataConverter.nbt2readData(nbt, args.registryLookup); - Inventories.readData(view, stacks); - } - - public static NbtCompound writeNbt(NbtRWArgs args, DefaultedList stacks, boolean setIfEmpty) { - return writeNbt(args, args.getNbt(), stacks, setIfEmpty); - } - - public static NbtCompound writeNbt(NbtRWArgs args, DefaultedList stacks) { - return writeNbt(args, stacks, true); - } - - public static void readNbt(NbtRWArgs args, DefaultedList stacks) { - readNbt(args, args.getNbt(), stacks); - } - - public static void readNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks) { - ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); - Inventories.readData(view, stacks); - } - - public static NbtCompound writeNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks, boolean setIfEmpty) { - NbtUtil.put(nbt, "Items", NbtListUtil.create()); - WriteView view = NbtDataConverter.nbt2writeData(nbt, registryLookup); - Inventories.writeData(view, stacks, setIfEmpty); - - NbtDataConverter.data2nbt(view, nbt); - - System.out.println("writeNbt(): " + nbt); - - return nbt; - } - - public static NbtCompound writeNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks) { - return writeNbt(registryLookup, nbt, stacks, true); - } - - // deprecated - /** - * @deprecated Use {@link #writeNbt(NbtRWArgs, DefaultedList)} instead - */ - @Deprecated - public static NbtCompound writeNbt(World world, NbtCompound nbt, DefaultedList stacks) { - return writeNbt(world, nbt, true, stacks); - } - - /** - * @deprecated Use {@link #writeNbt(NbtRWArgs, DefaultedList, boolean)} instead - */ - @Deprecated - public static NbtCompound writeNbt(World world, NbtCompound nbt, boolean setIfEmpty, DefaultedList stacks) { - return writeNbt(new NbtRWArgs(nbt), stacks, setIfEmpty); - } - - /** - * @deprecated Use {@link #readNbt(NbtRWArgs, DefaultedList)} instead - */ - @Deprecated - public static void readNbt(World world, NbtCompound nbt, DefaultedList stacks) { - readNbt(new ReadNbtArgs(nbt), stacks); - } - // ---- - - public static SimpleInventory createSimpleInventory(int size) { - return new SimpleInventory(size); - } - - public static void copyToInv(DefaultedList from, Inventory to) { - for (int i = 0; i < from.size(); i++) { - to.setStack(i, from.get(i)); - } - } - - public static void copyToList(Inventory from, DefaultedList to) { - for (int i = 0; i < from.size(); i++) { - to.set(i, from.getStack(i)); - } - } - - public static int getSize(Inventory inventory) { - return inventory.size(); - } - - public static ItemStack getStack(Inventory inventory, int slot) { - return inventory.getStack(slot); - } - - public static void setStack(Inventory inventory, int slot, ItemStack stack) { - inventory.setStack(slot, stack); - } - - public static boolean isEmpty(Inventory inventory) { - return inventory.isEmpty(); - } - - public static ItemStack removeStack(Inventory inventory, int slot) { - return inventory.removeStack(slot); - } - - public static ItemStack removeStack(Inventory inventory, int slot, int amount) { - return inventory.removeStack(slot, amount); - } - - public static void clear(Inventory inventory) { - inventory.clear(); - } - - public static void markDirty(Inventory inventory) { - inventory.markDirty(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java deleted file mode 100644 index 4e592d9b3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java +++ /dev/null @@ -1,193 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.DataResult; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.NbtOps; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; - -import java.util.Objects; -import java.util.Optional; - -public class ItemStackUtil { - public static ItemStack copy(ItemStack stack) { - return stack.copy(); - } - - public static ItemStack copyWithCount(ItemStack stack, int count) { - return stack.copyWithCount(count); - } - - public static boolean areItemsEqual(ItemStack left, ItemStack right) { - return ItemStack.areItemsEqual(left, right); - } - - @Deprecated - public static boolean areNbtEqual(ItemStack left, ItemStack right) { - return areNbtOrComponentEqual(left, right); - } - - /** - * NBT (1.20.4) か Component (1.20.5以降) が一致するかどうかを取得する。 - * @param left ItemStack - * @param right ItemStack - * @return NBTかComponentが一致するかどうか - */ - public static boolean areNbtOrComponentEqual(ItemStack left, ItemStack right) { - return Objects.equals(left.getComponents(), right.getComponents()); - } - - /** - * NBTかComponentが存在するかどうか - * @param stack ItemStack - * @return Whether NBT or Component exists - */ - public static boolean hasNbtOrComponent(ItemStack stack) { - return !stack.getComponents().isEmpty(); - } - - /** - * NBTからItemStackを取得する - * @param world World - * @param nbt NbtCompound - * @return ItemStack - */ - public static ItemStack fromNbt(World world, NbtCompound nbt) { - return fromNbt(new ReadNbtArgs(nbt)); - } - - /** - * NBTからItemStackを取得する - * @param args NbtRWArgs - * @return ItemStack - */ - public static ItemStack fromNbt(NbtRWArgs args) { - DataResult> result = ItemStack.CODEC.decode(NbtOps.INSTANCE, args.nbt); - if (result.error().isPresent()) return ItemStack.EMPTY; - - Pair pair = result.result().orElseThrow(); - return pair.getFirst(); - } - - public static ItemStack getDefaultStack(Item item) { - return item.getDefaultStack(); - } - - public static int getMaxDamage(ItemStack stack) { - return stack.getMaxDamage(); - } - - public static int getMaxDamage(Item item) { - return getMaxDamage(getDefaultStack(item)); - } - - public static int getDamage(ItemStack stack) { - return stack.getDamage(); - } - - public static void setDamage(ItemStack stack, int damage) { - stack.setDamage(damage); - } - - public static int getCount(ItemStack stack) { - return stack.getCount(); - } - - public static void setCount(ItemStack stack, int count) { - stack.setCount(count); - } - - public static void decrementCount(ItemStack stack, int count) { - stack.decrement(count); - } - - public static void incrementCount(ItemStack stack, int count) { - stack.increment(count); - } - - public static void damage(ItemStack stack, int amount, ServerPlayerEntity entity, Runnable breakCallback) { - stack.damage(amount, entity.getEntityWorld(), entity, (item) -> breakCallback.run()); - } - - public static void damage(ItemStack stack, int amount, LivingEntity entity, EquipmentSlot slot) { - stack.damage(amount, entity, slot); - } - - public static void damage(ItemStack stack, int amount, ServerPlayerEntity entity) { - stack.damage(amount, entity.getEntityWorld(), entity, (item) -> entity.sendEquipmentBreakStatus(item, EquipmentSlot.MAINHAND)); - } - - public static void damage(ItemStack stack, int amount, Player entity) { - Optional player = entity.getServerPlayer(); - if (player.isEmpty()) return; - - damage(stack, amount, player.get()); - } - - public static ItemStack empty() { - return ItemStack.EMPTY; - } - - public static ItemStack create(Item item) { - if (item == null) return empty(); - return new ItemStack(item); - } - - public static ItemStack create(Item item, int count) { - if (item == null) return empty(); - return new ItemStack(item, count); - } - - public static ItemStack create(ItemConvertible item) { - if (item == null) return empty(); - return new ItemStack(item); - } - - public static ItemStack create(ItemConvertible item, int count) { - if (item == null) return empty(); - return new ItemStack(item, count); - } - - public static boolean isEmpty(ItemStack stack) { - if (stack == null) return true; - return stack.isEmpty(); - } - - public static boolean isEnchantable(ItemStack stack) { - return stack.isEnchantable(); - } - - public static boolean isDamageable(ItemStack stack) { - return stack.isDamageable(); - } - - public static boolean isBreak(ItemStack stack) { - if (isDamageable(stack)) - return getDamage(stack) >= getMaxDamage(stack); - - return false; - } - - public static ItemWrapper getItemWrapper(ItemStack stack) { - return ItemWrapper.of(stack.getItem()); - } - - public static int getMaxCount(ItemStack stack) { - return stack.getMaxCount(); - } - - public static Item getItem(ItemStack stack) { - return stack.getItem(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java deleted file mode 100644 index 70cfe5a75..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java +++ /dev/null @@ -1,275 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.item.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.v1.ItemUtilV1; -import net.pitan76.mcpitanlib.api.util.v2.ItemUtilV2; - -import java.util.List; - -@Deprecated -public class ItemUtil { - - /** - * Get item from Identifier. - * @param id Identifier of the item. - * @return Item of the Identifier. - */ - public static Item item(Identifier id) { - return ItemUtilV1.item(id); - } - - /** - * Check if two items are equal. - * @param item Item to compare. - * @param item2 Item to compare. - * @return If two items are equal. - */ - public static boolean isEqual(Item item, Item item2) { - return ItemUtilV1.isEqual(item, item2); - } - - /** - * Check if the item is of the given item. - * @param stack ItemStack to check. - * @param item Item to check. - * @return If the item is of the given item. - */ - public static boolean isOf(ItemStack stack, Item item) { - return ItemUtilV1.isOf(stack, item); - } - - /** - * Check if the item is in the tag. (MCPitanLib TagKey) - * @param stack ItemStack to check. - * @param tagKey TagKey of the tag. - * @return If the item is in the tag. - */ - public static boolean isIn(ItemStack stack, TagKey tagKey) { - return ItemUtilV1.isIn(stack, tagKey); - } - - /** - * Check if the item is in the tag. (MCPitanLib TagKey) - * @param item Item to check. - * @param tagKey TagKey of the tag. - * @return If the item is in the tag. - */ - public static boolean isIn(Item item, TagKey tagKey) { - return ItemUtilV1.isIn(item, tagKey); - } - - /** - * Check if the item is existed. - * @param identifier Identifier of the item. - * @return If the item is existed. - */ - public static boolean isExist(Identifier identifier) { - return ItemUtilV1.isExist(identifier); - } - - /** - * Get Identifier from Item. - * @param item Item to get Identifier. - * @return Identifier of the Item. - */ - public static Identifier toID(Item item) { - return ItemUtilV1.toID(item); - } - - /** - * Get item from Identifier. - * @param identifier Identifier of the item. - * @return Item of the Identifier. - */ - public static Item fromId(Identifier identifier) { - return ItemUtilV1.fromId(identifier); - } - - /** - * Get CompatIdentifier from Item. - * @param item Item to get CompatIdentifier. - * @return CompatIdentifier of the Item. - */ - public static CompatIdentifier toCompatID(Item item) { - return CompatIdentifier.fromMinecraft(toID(item)); - } - - /** - * Get item from CompatIdentifier. - * @param identifier CompatIdentifier of the item. - * @return Item of the CompatIdentifier. - */ - public static Item fromId(CompatIdentifier identifier) { - return fromId(identifier.toMinecraft()); - } - - /** - * Check if the item is existed. - * @param identifier CompatIdentifier of the item. - * @return If the item is existed. - */ - public static boolean isExist(CompatIdentifier identifier) { - return isExist(identifier.toMinecraft()); - } - - /** - * Create BlockItem from Block and Item.Settings. - * @param block Block to create BlockItem. - * @param settings Item.Settings to create BlockItem. - * @return BlockItem created from Block and Item.Settings. - */ - @Deprecated - public static BlockItem ofBlock(Block block, Item.Settings settings) { - return ItemUtilV1.ofBlock(block, settings); - } - - /** - * Create BlockItem from Block and CompatibleItemSettings. - * @param block Block to create BlockItem. - * @param settings CompatibleItemSettings to create BlockItem. - * @return BlockItem created from Block and CompatibleItemSettings. - */ - public static BlockItem ofBlock(Block block, CompatibleItemSettings settings) { - return ItemUtilV1.ofBlock(block, settings); - } - - /** - * Create Item from Item.Settings. - * @param settings Item.Settings to create Item. - * @return Item created from Item.Settings. - */ - @Deprecated - public static Item of(Item.Settings settings) { - return ItemUtilV1.of(settings); - } - - /** - * Create Item from CompatibleItemSettings. - * @param settings CompatibleItemSettings to create Item. - * @return Item created from CompatibleItemSettings. - */ - public static Item of(CompatibleItemSettings settings) { - return ItemUtilV1.of(settings); - } - - /** - * Get all items. - * @return List of all items. - */ - public static List getAllItems() { - return ItemUtilV1.getAllItems(); - } - - /** - * Get raw id of the item. - * @param item Item to get raw id. - * @return Raw id of the item. - */ - public static int getRawId(Item item) { - return ItemUtilV1.getRawId(item); - } - - /** - * Get item from index. - * @param index Index of the item. - * @return Item of the index. - */ - public static Item fromIndex(int index) { - return ItemUtilV1.fromIndex(index); - } - - /** - * Get all items in the tag. (MCPitanLib TagKey) - * @param tagKey TagKey of the tag. - * @return List of items in the tag. - */ - public static List getItems(TagKey tagKey) { - return ItemUtilV2.getItems(tagKey); - } - - /** - * Get given the list of items in the tag. (MCPitanLib TagKey) - * @param tagKey TagKey of the tag. - * @param items List of items to search. - * @return List of items in the tag. - */ - public static List getItems(TagKey tagKey, List items) { - return ItemUtilV2.getItems(tagKey, items); - } - - /** - * Get all items in the tag. - * @param identifier Identifier of the tag. - * @return List of items in the tag. - */ - public static List getItems(Identifier identifier) { - return ItemUtilV2.getItems(identifier); - } - - /** - * Get given the list of items in the tag. - * @param identifier Identifier of the tag. - * @param items List of items to search. - * @return List of items in the tag. - */ - public static List getItems(Identifier identifier, List items) { - return ItemUtilV2.getItems(identifier, items); - } - - public static List getItems(CompatIdentifier identifier) { - return getItems(identifier.toMinecraft()); - } - - public static List getItems(CompatIdentifier identifier, List items) { - return getItems(identifier.toMinecraft(), items); - } - - /** - * Get all items in the tag. - * @param id String of the tag. - * @return List of items in the tag. - */ - public static List getItems(String id) { - return ItemUtilV2.getItems(id); - } - - /** - * Get given the list of items in the tag. - * @param id String of the tag. - * @param items List of items to search. - * @return List of items in the tag. - */ - public static List getItems(String id, List items) { - return ItemUtilV2.getItems(id, items); - } - - /** - * Check if the item is in the tag. - * @param item Item to check. - * @param identifier Identifier of the tag. - * @return If the item is in the tag. - */ - public static boolean isItemInTag(Item item, Identifier identifier) { - return ItemUtilV2.isItemInTag(item, identifier); - } - - public static boolean isItemInTag(Item item, CompatIdentifier identifier) { - return isItemInTag(item, identifier.toMinecraft()); - } - - /** - * Check if the item is in the tag. - * @param item Item to check. - * @param id String of the tag. - * @return If the item is in the tag. - */ - public static boolean isItemInTag(Item item, String id) { - return ItemUtilV2.isItemInTag(item, id); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java deleted file mode 100644 index 00967c3cb..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java +++ /dev/null @@ -1,190 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; - -public class Logger { - public String name = ""; - - public boolean usingPrefix = true; - - private final org.apache.logging.log4j.Logger logger; - - public Logger(String name) { - this.name = name; - this.logger = LoggerUtil.getLogger(name); - } - - public Logger() { - this.logger = LoggerUtil.getLogger(); - } - - public Logger(Class clazz) { - this.logger = LoggerUtil.getLogger(clazz); - } - - public Logger(String name, boolean usePrefix) { - this(name); - usePrefix(usePrefix); - } - - public org.apache.logging.log4j.Logger getLogger() { - return logger; - } - - public void info(String message) { - LoggerUtil.info(logger, message); - } - - public void warn(String message) { - LoggerUtil.warn(logger, message); - } - - public void error(String message) { - LoggerUtil.error(logger, message); - } - - public void debug(String message) { - LoggerUtil.debug(logger, message); - } - - public void infoIfDev(String message) { - if (!PlatformUtil.isDevelopmentEnvironment()) return; - LoggerUtil.debug(logger, message); - } - - public void trace(String message) { - LoggerUtil.trace(logger, message); - } - - // ---- - - public void error(Exception e) { - error(e.getMessage()); - } - - public void initializeMessage() { - info(prefix() + "Initializing..."); - } - - public void initializedMessage() { - info(prefix() + "Initialized"); - } - - public String prefix() { - if (name.isEmpty() || !isUsingPrefix()) - return ""; - - return "[" + name + "] "; - } - - public void usePrefix(boolean use) { - usingPrefix = use; - } - - public boolean isUsingPrefix() { - return usingPrefix; - } - - /** - * Log message - * @param message log message - * @param isDebug if true, log as debug - */ - public void log(String message, boolean isDebug) { - if (isDebug) { - debug(message); - return; - } - info(message); - } - - public void log_onClientTick(int tick, String message, boolean isDebug) { - if (!PlatformUtil.isClient()) return; - long time = ClientUtil.getRenderTime(); - if (time % tick != 0) return; - - log(message, isDebug); - } - - public void log_onWorldTick(int tick, String message, World world, boolean isDebug) { - long time = WorldUtil.getTime(world); - if (time % tick != 0) return; - - log(message, isDebug); - } - - public void log_onSystemTick(int tick, String message, boolean isDebug) { - long millis = System.currentTimeMillis(); - long time = millis / 1000 * 60; - - if (time % tick != 0) return; - - log(message, isDebug); - } - - public void log_onClientTick(int tick, String message) { - log_onClientTick(tick, message, false); - } - - public void log_onWorldTick(int tick, String message, World world) { - log_onWorldTick(tick, message, world, false); - } - - public void log_onSystemTick(int tick, String message) { - log_onSystemTick(tick, message, false); - } - - /** - * Log message every second on ClientTick - * @param message log message - * @param isDebug if true, log as debug - */ - public void log_onClientTick(String message, boolean isDebug) { - log_onClientTick(60, message, isDebug); - } - - /** - * Log message every second on WorldTick - * @param message log message - * @param world world - * @param isDebug if true, log as debug - */ - public void log_onWorldTick(String message, World world, boolean isDebug) { - log_onWorldTick(60, message, world, isDebug); - } - - /** - * Log message every second on SystemTick - * @param message log message - * @param isDebug if true, log as debug - */ - public void log_onSystemTick(String message, boolean isDebug) { - log_onSystemTick(60, message, isDebug); - } - - /** - * Log message every second on ClientTick - * @param message log message - */ - public void log_onClientTick(String message) { - log_onClientTick(message, false); - } - - /** - * Log message every second on WorldTick - * @param message log message - * @param world world - */ - public void log_onWorldTick(String message, World world) { - log_onWorldTick(message, world, false); - } - - /** - * Log message every second on SystemTick - * @param message log message - */ - public void log_onSystemTick(String message) { - log_onSystemTick(message, false); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java deleted file mode 100644 index 666a367b5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class LoggerUtil { - public static Logger getLogger(String name) { - return LogManager.getLogger(name); - } - - public static Logger getLogger(Class clazz) { - return LogManager.getLogger(clazz); - } - - public static Logger getLogger() { - return LogManager.getLogger(); - } - - public static void info(Logger logger, String message) { - logger.info(message); - } - - public static void warn(Logger logger, String message) { - logger.warn(message); - } - - public static void error(Logger logger, String message) { - logger.error(message); - } - - public static void debug(Logger logger, String message) { - logger.debug(message); - } - - public static void trace(Logger logger, String message) { - logger.trace(message); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java deleted file mode 100644 index 7ec6e5315..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.SharedConstants; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; - -public class MCVersionUtil { - - public static int getProtocolVersion() { - return SharedConstants.getProtocolVersion(); - } - - public static String getGameVersion() { - return ClientUtil.getClient().getGameVersion(); - } - - public static boolean isSupportedComponent() { - return SharedConstants.getProtocolVersion() >= 766; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java deleted file mode 100644 index 2cb21eb12..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.util.math.RotationAxis; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import org.joml.Quaternionf; - -public class MathUtil { - - public static CompatRandom createRandom(long seed) { - return CompatRandom.of(seed); - } - - public static CompatRandom createRandom() { - return CompatRandom.of(); - } - - @Deprecated - public static Quaternionf getRotationDegrees(RotationAxisType type, float deg) { - return type.axis.rotationDegrees(deg); - } - - public static class RotationAxisType { - - public static RotationAxisType POSITIVE_X = new RotationAxisType(RotationAxis.POSITIVE_X); - public static RotationAxisType POSITIVE_Y = new RotationAxisType(RotationAxis.POSITIVE_Y); - public static RotationAxisType POSITIVE_Z = new RotationAxisType(RotationAxis.POSITIVE_Z); - - protected final RotationAxis axis; - protected RotationAxisType(RotationAxis axis) { - this.axis = axis; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java deleted file mode 100644 index 0a95c4ffe..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java +++ /dev/null @@ -1,560 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.DataResult; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.math.PosUtil; -import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; -import net.pitan76.mcpitanlib.api.util.math.Vec3iUtil; - -import java.util.Optional; -import java.util.Set; -import java.util.UUID; - -public class NbtUtil { - - /** - * 新しいNbtCompoundを作成する。 - * @return NbtCompound - */ - public static NbtCompound create() { - return new NbtCompound(); - } - - /** - * 値を設定する。 - * @param nbt NbtCompound - * @param key キー - * @param value 値 - */ - public static void put(NbtCompound nbt, String key, NbtCompound value) { - nbt.put(key, value); - } - - /** - * 値を設定する。 - * @param nbt NbtCompound - * @param key キー - * @param value 値 - */ - public static void put(NbtCompound nbt, String key, NbtElement value) { - nbt.put(key, value); - } - - /** - * 値を取得する。 - * @param nbt NbtCompound - * @param key キー - * @return 値 - */ - public static NbtCompound get(NbtCompound nbt, String key) { - return nbt.getCompoundOrEmpty(key); - } - - /** - * 値を削除する。 - * @param nbt NbtCompound - * @param key キー - */ - public static void remove(NbtCompound nbt, String key) { - nbt.remove(key); - } - - /** - * 値が存在するかどうかを取得する。 - * @param nbt NbtCompound - * @param key キー - * @return 値が存在するかどうか - */ - public static boolean has(NbtCompound nbt, String key) { - return nbt.contains(key); - } - - /** - * 指定した型の値を取得する - * @param nbt NbtCompound - * @param key キー - * @param clazz クラス - * @param 値 - */ - public static T get(NbtCompound nbt, String key, Class clazz) { - if (clazz == Integer.class) { - return (T) Integer.valueOf(nbt.getInt(key, 0)); - } - if (clazz == String.class) { - return (T) nbt.getString(key).orElse(""); - } - if (clazz == Boolean.class) { - return (T) Boolean.valueOf(nbt.getBoolean(key, false)); - } - if (clazz == Float.class) { - return (T) Float.valueOf(nbt.getFloat(key, 0f)); - } - if (clazz == Double.class) { - return (T) Double.valueOf(nbt.getDouble(key, 0d)); - } - if (clazz == Long.class) { - return (T) Long.valueOf(nbt.getLong(key, 0l)); - } - if (clazz == NbtCompound.class) { - return (T) nbt.getCompoundOrEmpty(key); - } - if (clazz == NbtList.class) { - return (T) nbt.get(key); - } - if (clazz == Byte.class) { - return (T) Byte.valueOf(nbt.getByte(key, (byte) 0)); - } - if (clazz == Short.class) { - return (T) Short.valueOf(nbt.getShort(key, (short) 0)); - } - if (clazz == UUID.class) { - return (T) UUID.fromString(nbt.getString(key).orElse("")); - } - return null; - } - - /** - * 値を設定する。 - * @param nbt NbtCompound - * @param key キー - * @param value 値 - */ - public static void set(NbtCompound nbt, String key, T value) { - if (value instanceof Integer) { - nbt.putInt(key, (Integer) value); - return; - } - if (value instanceof String) { - nbt.putString(key, (String) value); - return; - } - if (value instanceof Boolean) { - nbt.putBoolean(key, (Boolean) value); - return; - } - if (value instanceof Float) { - nbt.putFloat(key, (Float) value); - return; - } - if (value instanceof Double) { - nbt.putDouble(key, (Double) value); - return; - } - if (value instanceof Long) { - nbt.putLong(key, (Long) value); - return; - } - if (value instanceof NbtCompound) { - nbt.put(key, (NbtCompound) value); - return; - } - if (value instanceof NbtList) { - nbt.put(key, (NbtList) value); - return; - } - if (value instanceof Byte) { - nbt.putByte(key, (Byte) value); - return; - } - if (value instanceof Short) { - nbt.putShort(key, (Short) value); - return; - } - if (value instanceof UUID) { - nbt.putString(key, value.toString()); - return; - } - } - - /** - * キーの一覧を取得する。 - * @param nbt NbtCompound - * @return キーの一覧 - */ - public static Set getKeys(NbtCompound nbt) { - return nbt.getKeys(); - } - - /** - * NbtListを取得する。 - * @return NbtList - */ - public static NbtList getList(NbtCompound nbt, String key) { - return (NbtList) nbt.get(key); - } - - /** - * NbtListを取得する。 - * @return NbtList - */ - public static NbtList getList(NbtCompound nbt, String key, int type) { - return nbt.getListOrEmpty(key); - } - - /** - * NbtCompoundのリストを取得する。 - * @return NbtList - */ - public static NbtList getNbtCompoundList(NbtCompound nbt, String key) { - return nbt.getListOrEmpty(key); - } - - /** - * NbtCompoundをコピーする。 - * @return NbtCompound - */ - public static NbtCompound copy(NbtCompound nbt) { - return nbt.copy(); - } - - // Helper methods - - public static void putInt(NbtCompound nbt, String key, int value) { - set(nbt, key, value); - } - - public static int getInt(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, Integer.class); - return 0; - } - - public static void putString(NbtCompound nbt, String key, String value) { - set(nbt, key, value); - } - - public static String getString(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, String.class); - return ""; - } - - public static void putBoolean(NbtCompound nbt, String key, boolean value) { - set(nbt, key, value); - } - - public static boolean getBoolean(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, Boolean.class); - return false; - } - - public static void putFloat(NbtCompound nbt, String key, float value) { - set(nbt, key, value); - } - - public static float getFloat(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, Float.class); - return 0; - } - - public static void putDouble(NbtCompound nbt, String key, double value) { - set(nbt, key, value); - } - - public static double getDouble(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, Double.class); - return 0; - } - - public static void putLong(NbtCompound nbt, String key, long value) { - set(nbt, key, value); - } - - public static long getLong(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, Long.class); - return 0; - } - - public static void putByte(NbtCompound nbt, String key, byte value) { - set(nbt, key, value); - } - - public static byte getByte(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, Byte.class); - return 0; - } - - public static void putShort(NbtCompound nbt, String key, short value) { - set(nbt, key, value); - } - - public static short getShort(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, Short.class); - return 0; - } - - public static void putUuid(NbtCompound nbt, String key, UUID value) { - set(nbt, key, value); - } - - public static UUID getUuid(NbtCompound nbt, String key) { - if (has(nbt, key)) - return get(nbt, key, UUID.class); - return null; - } - - /** - * BlockPosを設定する。 - * key: { - * "x": pos.getX(), - * "y": pos.getY(), - * "z": pos.getZ() - * } - * - * @param nbt NbtCompound - * @param key キー - * @param pos BlockPos - */ - public static void setBlockPos(NbtCompound nbt, String key, BlockPos pos) { - NbtCompound posNbt = create(); - putInt(posNbt, "x", pos.getX()); - putInt(posNbt, "y", pos.getY()); - putInt(posNbt, "z", pos.getZ()); - put(nbt, key, posNbt); - } - - /** - * BlockPosを取得する。 - * - * @param nbt NbtCompound - * @param key キー - * @return BlockPos - */ - public static BlockPos getBlockPos(NbtCompound nbt, String key) { - NbtCompound posNbt = get(nbt, key); - return PosUtil.flooredBlockPos(getInt(posNbt, "x"), getInt(posNbt, "y"), getInt(posNbt, "z")); - } - - public static void putVec3i(NbtCompound nbt, String key, Vec3i vec3i) { - NbtCompound vec3iNbt = create(); - putInt(vec3iNbt, "x", vec3i.getX()); - putInt(vec3iNbt, "y", vec3i.getY()); - putInt(vec3iNbt, "z", vec3i.getZ()); - put(nbt, key, vec3iNbt); - } - - public static Vec3i getVec3i(NbtCompound nbt, String key) { - NbtCompound vec3iNbt = get(nbt, key); - return Vec3iUtil.create(getInt(vec3iNbt, "x"), getInt(vec3iNbt, "y"), getInt(vec3iNbt, "z")); - } - - public static void putVec3d(NbtCompound nbt, String key, Vec3d vec3d) { - NbtCompound vec3dNbt = create(); - putDouble(vec3dNbt, "x", vec3d.getX()); - putDouble(vec3dNbt, "y", vec3d.getY()); - putDouble(vec3dNbt, "z", vec3d.getZ()); - put(nbt, key, vec3dNbt); - } - - public static Vec3d getVec3d(NbtCompound nbt, String key) { - NbtCompound vec3dNbt = get(nbt, key); - return Vec3dUtil.create(getDouble(vec3dNbt, "x"), getDouble(vec3dNbt, "y"), getDouble(vec3dNbt, "z")); - } - - public static void putItemStack(NbtCompound nbt, String key, ItemStack stack, CompatRegistryLookup registryLookup) { - DataResult dataResult = ItemStack.CODEC.encodeStart(NbtOps.INSTANCE, stack); - put(nbt, key, dataResult.getOrThrow()); - } - - public static Optional getItemStack(NbtCompound nbt, String key, CompatRegistryLookup registryLookup) { - NbtElement stackNbt = get(nbt, key); - DataResult> dataResult = ItemStack.CODEC.decode(NbtOps.INSTANCE, stackNbt); - if (dataResult.error().isPresent()) return Optional.empty(); - - Pair pair = dataResult.getOrThrow(); - return Optional.ofNullable(pair.getFirst()); - } - - public static void putSimpleItemStack(NbtCompound nbt, String key, ItemStack stack) { - NbtCompound stackNbt = create(); - putString(stackNbt, "id", ItemUtil.toID(stack.getItem()).toString()); - putByte(stackNbt, "Count", (byte) ItemStackUtil.getCount(stack)); - - NbtCompound tagNbt = create(); - NbtCompound componentsNbt = create(); - put(componentsNbt, "minecraft:custom_data", CustomDataUtil.getOrCreateNbt(stack)); - put(tagNbt, "components", componentsNbt); - put(stackNbt, "tag", tagNbt); - put(nbt, key, stackNbt); - } - - public static Optional getSimpleItemStack(NbtCompound nbt, String key) { - if (!has(nbt, key)) return Optional.empty(); - NbtCompound stackNbt = get(nbt, key); - - if (!has(stackNbt, "id") || !has(stackNbt, "Count")) return Optional.empty(); - Item item = ItemUtil.fromId(CompatIdentifier.of(getString(stackNbt, "id"))); - int count = getByte(stackNbt, "Count"); - - ItemStack stack = ItemStackUtil.create(item, count); - - if (has(stackNbt, "tag")) { - NbtCompound tagNbt = get(stackNbt, "tag"); - if (has(tagNbt, "components")) { - NbtCompound componentsNbt = get(tagNbt, "components"); - if (has(componentsNbt, "minecraft:custom_data")) { - CustomDataUtil.setNbt(stack, get(componentsNbt, "minecraft:custom_data")); - } - } - } - - return Optional.of(stack); - } - - public static NbtList createNbtList() { - return new NbtList(); - } - - public static int getIntOrDefault(NbtCompound nbt, String key, int defaultValue) { - if (has(nbt, key)) - return getInt(nbt, key); - return defaultValue; - } - - public static String getStringOrDefault(NbtCompound nbt, String key, String defaultValue) { - if (has(nbt, key)) - return getString(nbt, key); - return defaultValue; - } - - public static boolean getBooleanOrDefault(NbtCompound nbt, String key, boolean defaultValue) { - if (has(nbt, key)) - return getBoolean(nbt, key); - return defaultValue; - } - - public static float getFloatOrDefault(NbtCompound nbt, String key, float defaultValue) { - if (has(nbt, key)) - return getFloat(nbt, key); - return defaultValue; - } - - public static double getDoubleOrDefault(NbtCompound nbt, String key, double defaultValue) { - if (has(nbt, key)) - return getDouble(nbt, key); - return defaultValue; - } - - public static long getLongOrDefault(NbtCompound nbt, String key, long defaultValue) { - if (has(nbt, key)) - return getLong(nbt, key); - return defaultValue; - } - - public static byte getByteOrDefault(NbtCompound nbt, String key, byte defaultValue) { - if (has(nbt, key)) - return getByte(nbt, key); - return defaultValue; - } - - public static short getShortOrDefault(NbtCompound nbt, String key, short defaultValue) { - if (has(nbt, key)) - return getShort(nbt, key); - return defaultValue; - } - - public static UUID getUuidOrDefault(NbtCompound nbt, String key, UUID defaultValue) { - if (has(nbt, key)) - return getUuid(nbt, key); - return defaultValue; - } - - public static NbtElement getElement(NbtCompound nbt, String key) { - return nbt.get(key); - } - - public static void putElement(NbtCompound nbt, String key, NbtElement element) { - nbt.put(key, element); - } - - public static void setBlockPosDirect(NbtCompound nbt, BlockPos pos) { - putInt(nbt, "x", pos.getX()); - putInt(nbt, "y", pos.getY()); - putInt(nbt, "z", pos.getZ()); - } - - public static BlockPos getBlockPosDirect(NbtCompound nbt) { - return PosUtil.flooredBlockPos(getInt(nbt, "x"), getInt(nbt, "y"), getInt(nbt, "z")); - } - - public static void setVec3iDirect(NbtCompound nbt, Vec3i vec3i) { - putInt(nbt, "x", vec3i.getX()); - putInt(nbt, "y", vec3i.getY()); - putInt(nbt, "z", vec3i.getZ()); - } - - public static Vec3i getVec3iDirect(NbtCompound nbt) { - return Vec3iUtil.create(getInt(nbt, "x"), getInt(nbt, "y"), getInt(nbt, "z")); - } - - public static void setVec3dDirect(NbtCompound nbt, Vec3d vec3d) { - putDouble(nbt, "x", vec3d.getX()); - putDouble(nbt, "y", vec3d.getY()); - putDouble(nbt, "z", vec3d.getZ()); - } - - public static Vec3d getVec3dDirect(NbtCompound nbt) { - return Vec3dUtil.create(getDouble(nbt, "x"), getDouble(nbt, "y"), getDouble(nbt, "z")); - } - - public static void setVec3iDirect(NbtCompound nbt, int x, int y, int z) { - putInt(nbt, "x", x); - putInt(nbt, "y", y); - putInt(nbt, "z", z); - } - - public static void setVec3dDirect(NbtCompound nbt, double x, double y, double z) { - putDouble(nbt, "x", x); - putDouble(nbt, "y", y); - putDouble(nbt, "z", z); - } - - public static String asString(NbtElement nbt) { - return nbt.asString().orElse(""); - } - - public static NbtString createString(String string) { - return NbtString.of(string); - } - - public static NbtInt createInt(int value) { - return NbtInt.of(value); - } - - public static NbtFloat createFloat(float value) { - return NbtFloat.of(value); - } - - public static NbtDouble createDouble(double value) { - return NbtDouble.of(value); - } - - public static NbtLong createLong(long value) { - return NbtLong.of(value); - } - - public static NbtByte createByte(byte value) { - return NbtByte.of(value); - } - - public static NbtShort createShort(short value) { - return NbtShort.of(value); - } - - public static void copyFrom(NbtCompound source, NbtCompound target) { - target.copyFrom(source); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java deleted file mode 100644 index bcfa9d246..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleType; -import net.pitan76.mcpitanlib.api.util.particle.effect.ItemStackParticleEffectUtil; - -public class ParticleEffectUtil { - public static ItemStackParticleEffectUtil itemStack = new ItemStackParticleEffectUtil(); - - public static ParticleType getType(ParticleEffect effect) { - return effect.getType(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java deleted file mode 100644 index 9ba2c4abf..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import com.mojang.serialization.Codec; -import net.minecraft.datafixer.DataFixTypes; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.PersistentState; -import net.minecraft.world.PersistentStateManager; -import net.minecraft.world.PersistentStateType; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.world.CompatiblePersistentState; - -import java.util.function.Function; -import java.util.function.Supplier; - -public class PersistentStateUtil { - public static T getOrCreate(PersistentStateManager manager, String id, Supplier supplier, Function function) { - Codec codec = NbtCompound.CODEC.xmap( - // NBT -> PersistentState - (nbt) -> { - T state = supplier.get(); - - if (state instanceof CompatiblePersistentState) - ((CompatiblePersistentState) state).readNbt(new ReadNbtArgs(nbt)); - - return state; - }, - // PersistentState -> NBT - (state) -> { - if (state instanceof CompatiblePersistentState) - return ((CompatiblePersistentState) state).writeNbt(new WriteNbtArgs(new NbtCompound())); - - return NbtUtil.create(); - } - ); - - PersistentStateType type = new PersistentStateType<>(id, supplier, codec, DataFixTypes.LEVEL); - return manager.getOrCreate(type); - } - - public static PersistentStateManager getManagerFromServer(MinecraftServer server) { - return server.getWorld(World.OVERWORLD).getPersistentStateManager(); - } - - public static PersistentStateManager getManagerFromWorld(ServerWorld world) { - return world.getPersistentStateManager(); - } - - public static void markDirty(PersistentState state) { - state.markDirty(); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java deleted file mode 100644 index 228e4eedd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.world.gen.YOffset; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.PlacedFeature; -import net.minecraft.world.gen.placementmodifier.CountPlacementModifier; -import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier; -import net.minecraft.world.gen.placementmodifier.PlacementModifier; -import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier; - -import java.util.List; - -public class PlacedFutureUtil { - public static PlacedFeature create(ConfiguredFeature configuredFeature, List placementModifiers) { - return new PlacedFeature(RegistryEntry.of(configuredFeature), placementModifiers); - } - - public static List createPlacementModifiers(CountPlacementModifier countPlacementModifier, SquarePlacementModifier squarePlacementModifier, HeightRangePlacementModifier heightRangePlacementModifier) { - return List.of(countPlacementModifier, squarePlacementModifier, heightRangePlacementModifier); - } - - public static List createPlacementModifiers(int chunkCount, int top, int bottom) { - return createPlacementModifiers( -CountPlacementModifier.of(chunkCount), - SquarePlacementModifier.of(), - HeightRangePlacementModifier.uniform(YOffset.fixed(bottom), YOffset.fixed(top)) - ); - } - - public static List createPlacementModifiers(int chunkCount, int top) { - return createPlacementModifiers( - CountPlacementModifier.of(chunkCount), - SquarePlacementModifier.of(), - HeightRangePlacementModifier.uniform(YOffset.getBottom(), YOffset.fixed(top)) - ); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java deleted file mode 100644 index bf25068fa..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import dev.architectury.injectables.annotations.ExpectPlatform; -import dev.architectury.platform.Platform; -import dev.architectury.utils.Env; -import net.fabricmc.api.EnvType; - -import java.io.File; -import java.nio.file.Path; -import java.util.Collection; - -public class PlatformUtil { - public static boolean isDevelopmentEnvironment() { - return Platform.isDevelopmentEnvironment(); - } - - public static boolean isFabric() { - return Platform.isFabric(); - } - - public static boolean isForge() { - return Platform.isMinecraftForge(); - } - - public static boolean isNeoForge() { - return Platform.isNeoForge(); - } - - @ExpectPlatform - public static boolean isModLoaded(String id) { - return Platform.isModLoaded(id); - } - - @ExpectPlatform - public static boolean isClient() { - return Platform.getEnvironment() == Env.CLIENT; - } - - @ExpectPlatform - public static boolean isServer() { - return Platform.getEnvironment() == Env.SERVER; - } - - @ExpectPlatform - public static Path getConfigFolder() { - return Platform.getConfigFolder(); - } - - public static Path getGameFolder() { - return Platform.getGameFolder(); - } - - public static Path getModsFolder() { - return Platform.getModsFolder(); - } - - public static File getConfigFolderAsFile() { - return getConfigFolder().toFile(); - } - - public static File getGameFolderAsFile() { - return getGameFolder().toFile(); - } - - public static File getModsFolderAsFile() { - return getModsFolder().toFile(); - } - - public static Collection getModIds() { - return Platform.getModIds(); - } - - public static EnvType getEnv() { - return Platform.getEnv(); - } - - public static String getGameVersion() { - return Platform.getMinecraftVersion(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java deleted file mode 100644 index ae2e7ecc5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java +++ /dev/null @@ -1,130 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.PlayerManager; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -public class PlayerManagerUtil { - - /** - * Get player by UUID - * @param server MinecraftServer - * @param uuid UUID - * @return Player - */ - public static Player getPlayerByUUID(MinecraftServer server, UUID uuid) { - return PlayerUtil.getPlayerByUUID(server, uuid); - } - - /** - * Get player by name - * @param server MinecraftServer - * @param name String - * @return Player - */ - public static Player getPlayerByName(MinecraftServer server, String name) { - return PlayerUtil.getPlayerByName(server, name); - } - - /** - * Get players by IP - * @param server MinecraftServer - * @param ip String - * @return List - */ - public static List getPlayersByIP(MinecraftServer server, String ip) { - return PlayerUtil.getPlayersByIP(server, ip); - } - - /** - * Get players - * @param server MinecraftServer - * @return List - */ - public static List getPlayers(MinecraftServer server) { - return PlayerUtil.getPlayers(server); - } - - /** - * Get players - * @param world World - * @return List - */ - public static List getPlayers(World world) { - List players = new ArrayList<>(); - for (PlayerEntity p : world.getPlayers()) { - players.add(new Player(p)); - } - return players; - } - - /** - * Get player by UUID - * @param world World - * @param uuid UUID - * @return Player - */ - public static Player getPlayerByUUID(World world, UUID uuid) { - return PlayerUtil.getPlayerByUUID(world, uuid); - } - - /** - * Get player by name - * @param world World - * @param name String - * @return Player - */ - public static Player getPlayerByName(World world, String name) { - return PlayerUtil.getPlayerByName(world, name); - } - - public static PlayerManager getPlayerManager(MinecraftServer server) { - return ServerUtil.getPlayerManager(server); - } - - public static PlayerManager getPlayerManager(World world) { - return getPlayerManager(world.getServer()); - } - - public static boolean hasPlayerByUUID(PlayerManager playerManager, UUID uuid) { - return playerManager.getPlayer(uuid) != null; - } - - public static boolean hasPlayerByName(PlayerManager playerManager, String name) { - return playerManager.getPlayer(name) != null; - } - - public static boolean hasPlayerByIP(PlayerManager playerManager, String ip) { - return !playerManager.getPlayersByIp(ip).isEmpty(); - } - - public static boolean hasPlayerByUUID(MinecraftServer server, UUID uuid) { - return hasPlayerByUUID(getPlayerManager(server), uuid); - } - - public static boolean hasPlayerByName(MinecraftServer server, String name) { - return hasPlayerByName(getPlayerManager(server), name); - } - - public static boolean hasPlayerByIP(MinecraftServer server, String ip) { - return hasPlayerByIP(getPlayerManager(server), ip); - } - - public static boolean hasPlayerByUUID(World world, UUID uuid) { - return hasPlayerByUUID(getPlayerManager(world), uuid); - } - - public static boolean hasPlayerByName(World world, String name) { - return hasPlayerByName(getPlayerManager(world), name); - } - - public static boolean hasPlayerByIP(World world, String ip) { - return hasPlayerByIP(getPlayerManager(world), ip); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java deleted file mode 100644 index 90f67e846..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java +++ /dev/null @@ -1,98 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -public class PlayerUtil { - - public static Player getPlayerByUUID(MinecraftServer server, UUID uuid) { - return new Player(server.getPlayerManager().getPlayer(uuid)); - } - - public static Player getPlayerByName(MinecraftServer server, String name) { - return new Player(server.getPlayerManager().getPlayer(name)); - } - - public static List getPlayersByIP(MinecraftServer server, String ip) { - List players = new ArrayList<>(); - for (PlayerEntity p: server.getPlayerManager().getPlayersByIp(ip)) { - players.add(new Player(p)); - } - return players; - } - - public static List getPlayers(MinecraftServer server) { - List players = new ArrayList<>(); - for (PlayerEntity p : server.getPlayerManager().getPlayerList()) { - players.add(new Player(p)); - } - return players; - } - - public static Player getPlayerByUUID(World world, UUID uuid) { - return getPlayerByUUID(world.getServer(), uuid); - } - - public static Player getPlayerByName(World world, String name) { - return getPlayerByName(world.getServer(), name); - } - - public static boolean isExistByUUID(MinecraftServer server, UUID uuid) { - return server.getPlayerManager().getPlayer(uuid) != null; - } - - public static boolean isExistByUUID(World world, UUID uuid) { - return isExistByUUID(world.getServer(), uuid); - } - - public static boolean isExistByName(MinecraftServer server, String name) { - return server.getPlayerManager().getPlayer(name) != null; - } - - public static boolean isExistByName(World world, String name) { - return isExistByName(world.getServer(), name); - } - - public static boolean isExistByIP(MinecraftServer server, String ip) { - return !server.getPlayerManager().getPlayersByIp(ip).isEmpty(); - } - - public static boolean isExistByIP(World world, String ip) { - return isExistByIP(world.getServer(), ip); - } - - public static void sendMessage(Player player, String message) { - player.sendMessage(TextUtil.literal(message)); - } - - public static float getYaw(Player player) { - return player.getYaw(); - } - - public static float getPitch(Player player) { - return player.getPitch(); - } - - public static BlockPos getBlockPos(Player player) { - return player.getBlockPos(); - } - - public static World getWorld(Player player) { - return player.getWorld(); - } - - public static boolean isClient(Player player) { - return player.isClient(); - } - - public static void teleport(Player player, double x, double y, double z) { - player.teleport(x, y, z); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java deleted file mode 100644 index a97c8dc53..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.BlockState; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.block.enums.StairShape; -import net.minecraft.state.property.*; -import net.minecraft.util.StringIdentifiable; -import net.minecraft.util.math.Direction; -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; -import net.pitan76.mcpitanlib.api.state.property.CompatProperties; -import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; - -public class PropertyUtil { - public static BooleanProperty createBooleanProperty(String name) { - return BooleanProperty.of(name); - } - - public static DirectionProperty createDirectionProperty(String name) { - return DirectionProperty.of(name); - } - - public static IntProperty createIntProperty(String name, int min, int max) { - return IntProperty.of(name, min, max); - } - - public static & StringIdentifiable> EnumProperty createEnumProperty(String name, Class type) { - return EnumProperty.of(name, type); - } - - public static BlockState with(BlockState state, BooleanProperty property, boolean value) { - return state.with(property, value); - } - - public static BlockState with(BlockState state, IntProperty property, int value) { - return state.with(property, value); - } - - public static BlockState with(BlockState state, DirectionProperty property, Direction value) { - return property.with(state, value); - } - - public static boolean get(BlockState state, BooleanProperty property) { - return state.get(property); - } - - public static int get(BlockState state, IntProperty property) { - return state.get(property); - } - - public static Direction get(BlockState state, DirectionProperty property) { - return property.get(state); - } - - public static net.pitan76.mcpitanlib.midohra.util.math.Direction getAsMidohra(BlockState state, DirectionProperty property) { - return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(property.get(state)); - } - - public static Direction getFacing(BlockState state) { - return facing().get(state); - } - - public static Direction getHorizontalFacing(BlockState state) { - return horizontalFacing().get(state); - } - - public static int getPower(BlockState state) { - return state.get(power()); - } - - public static boolean isPowered(BlockState state) { - return state.get(powered()); - } - - public static void append(AppendPropertiesArgs args, Property... properties) { - args.addProperty(properties); - } - - public static void appendFacing(AppendPropertiesArgs args) { - facing().apply(args); - } - - public static void appendHorizontalFacing(AppendPropertiesArgs args) { - horizontalFacing().apply(args); - } - - public static void appendPower(AppendPropertiesArgs args) { - args.addProperty(power()); - } - - public static void appendPowered(AppendPropertiesArgs args) { - args.addProperty(powered()); - } - - public static IntProperty power() { - return Properties.POWER; - } - - public static BooleanProperty powered() { - return Properties.POWERED; - } - - public static DirectionProperty facing() { - return CompatProperties.FACING; - } - - public static DirectionProperty horizontalFacing() { - return CompatProperties.HORIZONTAL_FACING; - } - - public static EnumProperty axis() { - return Properties.AXIS; - } - - public static EnumProperty blockHalf() { - return Properties.BLOCK_HALF; - } - - public static EnumProperty stairShape() { - return Properties.STAIR_SHAPE; - } - - public static BooleanProperty lit() { - return Properties.LIT; - } - - public static BooleanProperty waterlogged() { - return Properties.WATERLOGGED; - } - - public static BooleanProperty attached() { - return Properties.ATTACHED; - } - - public static BooleanProperty hanging() { - return Properties.HANGING; - } - - public static BooleanProperty bottom() { - return Properties.BOTTOM; - } - - public static BooleanProperty conditional() { - return Properties.CONDITIONAL; - } - - public static BooleanProperty inWall() { - return Properties.IN_WALL; - } - - public static BooleanProperty open() { - return Properties.OPEN; - } - - public static BooleanProperty occupied() { - return Properties.OCCUPIED; - } - - public static boolean contains(BlockState state, Property property) { - return state.contains(property); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java deleted file mode 100644 index 14d0a5612..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java +++ /dev/null @@ -1,223 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.*; -import net.minecraft.recipe.book.CraftingRecipeCategory; -import net.minecraft.recipe.input.CraftingRecipeInput; -import net.minecraft.recipe.input.RecipeInput; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Identifier; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.recipe.CompatRecipeType; -import net.pitan76.mcpitanlib.api.recipe.MatchGetter; -import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; -import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; -import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeNonEntry; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -public class RecipeUtil { - public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { - return new ShapelessRecipe(group, CraftingRecipeCategory.valueOf(category.name()), output, input); - } - - public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, ItemStack output, DefaultedList input) { - return createShapelessRecipe(id, group, CompatibilityCraftingRecipeCategory.MISC, output, input); - } - - @Deprecated - public static ItemStack craft_2(Recipe recipe, C inventory, World world) { - return recipe.craft(inventory, world.getRegistryManager()); - } - - @Deprecated - public static ItemStack getOutput_2(Recipe recipe, World world) { - return craft_2(recipe, (C) CraftingRecipeInput.EMPTY, world); - } - - public static ItemStack craft(Recipe recipe, Inventory inventory, World world) { - if (inventory instanceof RecipeInput) { - Recipe inputRecipe = (Recipe) recipe; - return inputRecipe.craft((RecipeInput) inventory, world.getRegistryManager()); - } - return ItemStack.EMPTY; - } - - public static ItemStack getOutput(Recipe recipe, World world) { - return getOutput(recipe, RegistryLookupUtil.getRegistryLookup(world)); - } - - public static List> getAllRecipes(World world) { - RecipeManager iRecipeManager = getRecipeManager(world); - if (!(iRecipeManager instanceof ServerRecipeManager)) - return new ArrayList<>(); - - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; - - Collection> recipes = recipeManager.values(); - List> outRecipes = new ArrayList<>(); - for (Object recipeEntryObj : recipes) { - if (recipeEntryObj instanceof RecipeEntry) { - RecipeEntry recipeEntry = (RecipeEntry) recipeEntryObj; - if (recipeEntry.value() instanceof Recipe) { - outRecipes.add(recipeEntry.value()); - } - } - } - return outRecipes; - } - - public static List> getAllCompatRecipeEntry(World world) { - List> recipes = getAllRecipes(world); - List> outRecipes = new ArrayList<>(); - for (Recipe recipe : recipes) { - outRecipes.add(new CompatRecipeNonEntry<>(recipe)); - } - return outRecipes; - } - - public static RecipeType getType(Recipe recipe) { - return recipe.getType(); - } - - public static Identifier getId(Recipe recipe) { - return IdentifierUtil.id(recipe.getClass().hashCode() + ""); - } - - public static > CompatRecipeEntry getFirstMatch(RecipeManager iRecipeManager, CompatRecipeType type, CompatRecipeInput input, World world) { - if (!(iRecipeManager instanceof ServerRecipeManager)) - return new CompatRecipeEntry<>(null); - - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; - - Optional> recipe = recipeManager.getFirstMatch(type.getType(), input.getInput(), world); - return recipe.map(CompatRecipeEntry::new).orElseGet(() -> new CompatRecipeEntry<>(null)); - } - - public static > CompatRecipeEntry getFirstMatch(RecipeManager iRecipeManager, CompatRecipeType type, CompatRecipeInput input, World world, CompatIdentifier identifier) { - if (!(iRecipeManager instanceof ServerRecipeManager)) - return new CompatRecipeEntry<>(null); - - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; - - Optional> recipe = recipeManager.getFirstMatch(type.getType(), input.getInput(), world, RegistryKey.of(RegistryKeys.RECIPE, identifier.toMinecraft())); - return recipe.map(CompatRecipeEntry::new).orElseGet(() -> new CompatRecipeEntry<>(null)); - } - - public static > CompatRecipeEntry getFirstMatch(World world, CompatRecipeType type, CompatRecipeInput input) { - return getFirstMatch(getRecipeManager(world), type, input, world); - } - - public static > CompatRecipeEntry getFirstMatch(World world, CompatRecipeType type, CompatRecipeInput input, CompatIdentifier identifier) { - return getFirstMatch(getRecipeManager(world), type, input, world, identifier); - } - - public static RecipeManager getRecipeManager(World world) { - return world.getRecipeManager(); - } - - public Optional> get(World world, CompatIdentifier id) { - return get(getRecipeManager(world), id); - } - - public Optional> get(RecipeManager iRecipeManager, CompatIdentifier id) { - if (!(iRecipeManager instanceof ServerRecipeManager)) - return Optional.empty(); - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; - - return recipeManager.get(RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft())); - } - - public static > MatchGetter createCachedMatchGetter(RecipeType type) { - return (input, world) -> { - Optional> optional = ServerRecipeManager.createCachedMatchGetter(type).getFirstMatch(input.getInput(), (ServerWorld) world); - return optional.map(CompatRecipeEntry::new); - }; - } - - public static > MatchGetter createCachedMatchGetter(CompatRecipeType type) { - return createCachedMatchGetter(type.getType()); - } - - public static DefaultedList getInputs(Recipe recipe) { - List ingredients = recipe.getIngredientPlacement().getIngredients(); - - DefaultedList outIngredients = DefaultedList.ofSize(ingredients.size()); - - for (int i = 0; i < ingredients.size(); i++) { - outIngredients.set(i, ingredients.get(i)); - } - - return outIngredients; - } - - public static DefaultedList getInputs(CompatRecipeEntry recipeEntry) { - return getInputs(recipeEntry.getRecipe()); - } - - public static ItemStackList getInputsAsStack(Recipe recipe) { - DefaultedList ingredients = getInputs(recipe); - ItemStackList stacks = ItemStackList.ofSize(ingredients.size(), ItemStackUtil.empty()); - for (Ingredient ingredient : ingredients) { - stacks.addAll(IngredientUtil.getMatchingStacksAsList(ingredient)); - } - return stacks; - } - - public static ItemStackList getInputsAsStack(CompatRecipeEntry recipeEntry) { - return getInputsAsStack(recipeEntry.getRecipe()); - } - - public static ItemStack getOutput(Recipe recipe, CompatRegistryLookup registryLookup) { - if (recipe instanceof ShapelessRecipe) { - ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe; - return shapelessRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); - } - - if (recipe instanceof ShapedRecipe) { - ShapedRecipe shapedRecipe = (ShapedRecipe) recipe; - return shapedRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); - } - - if (recipe instanceof CraftingRecipe) { - CraftingRecipe craftingRecipe = (CraftingRecipe) recipe; - return craftingRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); - } - - if (recipe instanceof SpecialCraftingRecipe) { - SpecialCraftingRecipe specialCraftingRecipe = (SpecialCraftingRecipe) recipe; - return specialCraftingRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); - } - - return recipe.craft(null, registryLookup.getRegistryLookup()); - } - - public static ItemStack getOutput(CompatRecipeEntry recipeEntry, CompatRegistryLookup registryLookup) { - return getOutput(recipeEntry.getRecipe(), registryLookup); - } - - public static CompatRecipeType getType(CompatRecipeEntry recipeEntry) { - return CompatRecipeType.of(recipeEntry.getRecipe().getType()); - } - - public static > ItemStackList getRemainder(CompatRecipeEntry recipeEntry, CompatRecipeInput input) { - return ItemStackList.of(); - //return ItemStackList.of(recipeEntry.getRecipe().getRemainder(input.getInput())); - } - - public enum CompatibilityCraftingRecipeCategory { - BUILDING, - REDSTONE, - EQUIPMENT, - MISC; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java deleted file mode 100644 index b507e75ee..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.CompatEntity; -import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; -import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; - -public class RegistryLookupUtil { - public static CompatRegistryLookup getRegistryLookup(ItemAppendTooltipEvent e) { - return new CompatRegistryLookup(e.context.getRegistryLookup()); - } - - public static CompatRegistryLookup getRegistryLookup(CompatEntity entity) { - return new CompatRegistryLookup(entity.getRegistryManager()); - } - - public static CompatRegistryLookup getRegistryLookup(Entity entity) { - return new CompatRegistryLookup(entity.getRegistryManager()); - } - - public static CompatRegistryLookup getRegistryLookup(CompatBlockEntity entity) { - return new CompatRegistryLookup(entity.getWorld().getRegistryManager()); - } - - public static CompatRegistryLookup getRegistryLookup(BlockEntity entity) { - return new CompatRegistryLookup(entity.getWorld().getRegistryManager()); - } - - public static CompatRegistryLookup getRegistryLookup(NbtRWArgs args) { - return args.getRegistryLookup(); - } - - public static CompatRegistryLookup getRegistryLookup(World world) { - return new CompatRegistryLookup(world.getRegistryManager()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java deleted file mode 100644 index cfb5df1d5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.resource.Resource; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.Identifier; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -public class ResourceUtil { - public static Resource getResource(ResourceManager resourceManager, Identifier identifier) { - return resourceManager.getResource(identifier).get(); - } - - public static InputStream getInputStream(Resource resource) throws IOException { - return resource.getInputStream(); - } - - public static Map findResources(ResourceManager resourceManager, String startingPath, String endingPath) throws IOException { - return resourceManager.findResources(startingPath, s -> s.toString().endsWith(endingPath)); - } - - public static void close(Resource resource) throws IOException { - getInputStream(resource).close(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java deleted file mode 100644 index 7ce969235..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import dev.architectury.registry.menu.ExtendedMenuProvider; -import dev.architectury.registry.menu.MenuRegistry; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.registry.Registries; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.slot.Slot; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.collection.DefaultedList; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; - -public class ScreenHandlerUtil { - public static DefaultedList getSlots(ScreenHandler screenHandler) { - return screenHandler.slots; - } - - public static Slot getSlot(ScreenHandler screenHandler, int index) { - return screenHandler.getSlot(index); - } - - public static List> getAllScreenHandlerTypes() { - List> screenHandlerTypes = new ArrayList<>(); - for (ScreenHandlerType screenHandler : Registries.SCREEN_HANDLER) { - screenHandlerTypes.add(screenHandler); - } - return screenHandlerTypes; - } - - public static void openExtendedMenu(ServerPlayerEntity player, NamedScreenHandlerFactory provider, Consumer bufWriter) { - MenuRegistry.openExtendedMenu(player, provider, bufWriter); - } - - public static void openExtendedMenu(ServerPlayerEntity player, ExtendedMenuProvider provider) { - MenuRegistry.openExtendedMenu(player, provider); - } - - public static void openMenu(ServerPlayerEntity player, NamedScreenHandlerFactory provider) { - MenuRegistry.openMenu(player, provider); - } - - public static int getRawId(ScreenHandlerType type) { - return Registries.SCREEN_HANDLER.getRawId(type); - } - - public static ScreenHandlerType fromIndex(int index) { - return Registries.SCREEN_HANDLER.get(index); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java deleted file mode 100644 index 6718b610d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.PlayerManager; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class ServerUtil { - public static MinecraftServer getServer(World world) { - return world.getServer(); - } - - public static String getIP(MinecraftServer server) { - return server.getServerIp(); - } - - public static int getPort(MinecraftServer server) { - return server.getServerPort(); - } - - public static String getMotd(MinecraftServer server) { - return server.getServerMotd(); - } - - public static String getServerModName(MinecraftServer server) { - return server.getServerModName(); - } - - public static int getMaxPlayerCount(MinecraftServer server) { - return server.getMaxPlayerCount(); - } - - public static int getCurrentPlayerCount(MinecraftServer server) { - return server.getCurrentPlayerCount(); - } - - public static boolean isOnlineMode(MinecraftServer server) { - return server.isOnlineMode(); - } - - public static boolean isServerRunning(MinecraftServer server) { - return server.isRunning(); - } - - public static boolean isServerDedicated(MinecraftServer server) { - return server.isDedicated(); - } - - public static boolean isSingleplayer(MinecraftServer server) { - return server.isSingleplayer(); - } - - public static PlayerManager getPlayerManager(MinecraftServer server) { - return server.getPlayerManager(); - } - - public static MinecraftServer getServer(Player player) { - return getServer(player.getWorld()); - } - - public static void execute(MinecraftServer server, Runnable runnable) { - server.execute(runnable); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java deleted file mode 100644 index 9176cee25..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; - -public class SimpleInventoryUtil { - public static DefaultedList getHeldStacks(SimpleInventory inventory) { - return inventory.getHeldStacks(); - } - - public static SimpleInventory create(int size) { - return InventoryUtil.createSimpleInventory(size); - } - - public static ItemStack getStack(SimpleInventory inventory, int slot) { - return inventory.getStack(slot); - } - - public static void setStack(SimpleInventory inventory, int slot, ItemStack stack) { - inventory.setStack(slot, stack); - } - - public static void clear(SimpleInventory inventory) { - inventory.clear(); - } - - public static int size(SimpleInventory inventory) { - return inventory.size(); - } - - public static boolean isEmpty(SimpleInventory inventory) { - return inventory.isEmpty(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java deleted file mode 100644 index 018aad006..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.slot.Slot; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class SlotUtil { - public static void setStack(Slot slot, ItemStack stack) { - slot.setStack(stack); - } - - public static ItemStack getStack(Slot slot) { - return slot.getStack(); - } - - public static void takeStack(Slot slot, int amount) { - slot.takeStack(amount); - } - - public static boolean hasStack(Slot slot) { - return slot.hasStack(); - } - - public static void markDirty(Slot slot) { - slot.markDirty(); - } - - public static boolean canInsert(Slot slot, ItemStack stack) { - return slot.canInsert(stack); - } - - public static boolean canTakeItems(Slot slot) { - return slot.canTakeItems(null); - } - - public static void onTakeItem(Slot slot, Player player, ItemStack stack) { - slot.onTakeItem(player.getEntity(), stack); - } - - public static Inventory getInventory(Slot slot) { - return slot.inventory; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java deleted file mode 100644 index 57a0c1364..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.registry.Registries; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -public class SoundEventUtil { - public static Identifier getId(SoundEvent soundEvent) { - return soundEvent.id(); - } - - public static SoundEvent getSoundEvent(Identifier id) { - return SoundEvent.of(id); - } - - public static CompatIdentifier getCompatId(SoundEvent soundEvent) { - return CompatIdentifier.fromMinecraft(getId(soundEvent)); - } - - public static SoundEvent getSoundEvent(CompatIdentifier id) { - return getSoundEvent(id.toMinecraft()); - } - - public static List getAllSoundEvents() { - return Registries.SOUND_EVENT.stream().collect(Collectors.toList()); - } - - public static List getAllSoundEventIds() { - return new ArrayList<>(Registries.SOUND_EVENT.getIds()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java deleted file mode 100644 index 7519d7e99..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java +++ /dev/null @@ -1,107 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.pitan76.mcpitanlib.api.event.result.EventResult; - -import java.util.Optional; - -public class StackActionResult extends CompatActionResult { - private final ItemStack stack; - private final CompatActionResult compatActionResult; - - public StackActionResult(ActionResult actionResult, EventResult eventResult, ItemStack stack) { - this(new CompatActionResult(actionResult, eventResult), stack); - } - - public StackActionResult(CompatActionResult actionResult, ItemStack stack) { - super(null, null); - compatActionResult = actionResult; - this.stack = stack; - } - - @Override - public ActionResult toActionResult() { - return compatActionResult.toActionResult(); - } - - @Override - public EventResult toEventResult() { - return compatActionResult.toEventResult(); - } - - @Deprecated - @Override - public Optional getNewHandStack() { - if (hasNewStack()) - return compatActionResult.getNewHandStack(); - - return Optional.empty(); - } - - public boolean hasNewStack() { - return compatActionResult.getNewHandStack().isPresent(); - } - - public boolean hasStack() { - return getStack() != null; - } - - public CompatActionResult asCompatActionResult() { - return compatActionResult; - } - - public static StackActionResult create(CompatActionResult compatActionResult, ItemStack stack) { - if (compatActionResult.getNewHandStack().isPresent()) - return new StackActionResult(compatActionResult, compatActionResult.getNewHandStack().get()); - - return new StackActionResult(compatActionResult, stack); - } - - public static StackActionResult create(CompatActionResult compatActionResult) { - return new StackActionResult(compatActionResult, null); - } - - public static StackActionResult create(ActionResult actionResult, EventResult eventResult, ItemStack stack) { - return new StackActionResult(actionResult, eventResult, stack); - } - - public static StackActionResult create(ActionResult actionResult, ItemStack stack) { - return new StackActionResult(actionResult, null, stack); - } - - public static StackActionResult success(ItemStack stack) { - CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.SUCCESS.withNewHandStack(stack)); - return create(compatActionResult, stack); - } - - public static StackActionResult successServer(ItemStack stack) { - CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.SUCCESS_SERVER.withNewHandStack(stack)); - return create(compatActionResult, stack); - } - - public static StackActionResult consume(ItemStack stack) { - CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.CONSUME.withNewHandStack(stack)); - return create(compatActionResult, stack); - } - - public static StackActionResult pass(ItemStack stack) { - return create(CompatActionResult.PASS, stack); - } - - public static StackActionResult pass() { - return create(CompatActionResult.PASS); - } - - public static StackActionResult fail(ItemStack stack) { - return create(CompatActionResult.FAIL, stack); - } - - public static StackActionResult fail() { - return create(CompatActionResult.FAIL); - } - - public ItemStack getStack() { - return stack; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java deleted file mode 100644 index a51ef0e36..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import com.google.common.collect.ImmutableList; -import net.minecraft.state.State; -import net.minecraft.state.StateManager; - -public class StateManagerUtil { - public static > S getDefaultState(StateManager manager) { - return manager.getDefaultState(); - } - - public > ImmutableList getStates(StateManager manager) { - return manager.getStates(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java deleted file mode 100644 index 333f996f8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; - -public class StatusEffectUtil { - public static CompatStatusEffect getStatusEffect(Identifier identifier) { - RegistryKey registryKey = RegistryKey.of(RegistryKeys.STATUS_EFFECT, identifier); - return new CompatStatusEffect(registryKey); - } - - public static CompatStatusEffect getStatusEffect(CompatIdentifier identifier) { - return getStatusEffect(identifier.toMinecraft()); - } - - public static Identifier getId(CompatStatusEffect statusEffect) { - return statusEffect.getId(); - } - - public static CompatIdentifier getCompatId(CompatStatusEffect statusEffect) { - return CompatIdentifier.fromMinecraft(statusEffect.getId()); - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java deleted file mode 100644 index 6959d1fca..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.text.ClickEvent; -import net.minecraft.text.HoverEvent; -import net.minecraft.text.Style; -import net.minecraft.text.StyleSpriteSource; -import net.minecraft.util.Formatting; - -public class StyleUtil { - public static Style emptyStyle() { - return Style.EMPTY; - } - - public static Style withColor(Style style, int color) { - return style.withColor(color); - } - - public static Style withBold(Style style, boolean bold) { - return style.withBold(bold); - } - - public static Style withItalic(Style style, boolean italic) { - return style.withItalic(italic); - } - - public static Style withUnderline(Style style, boolean underline) { - return style.withUnderline(underline); - } - - public static Style withStrikethrough(Style style, boolean strikethrough) { - return style.withStrikethrough(strikethrough); - } - - public static Style withObfuscated(Style style, boolean obfuscated) { - return style.withObfuscated(obfuscated); - } - - public static Style withInsertion(Style style, String insertion) { - return style.withInsertion(insertion); - } - - public static Style withClickEvent(Style style, ClickEvent clickEvent) { - return style.withClickEvent(clickEvent); - } - - public static Style withHoverEvent(Style style, HoverEvent hoverEvent) { - return style.withHoverEvent(hoverEvent); - } - - public static Style withFont(Style style, CompatIdentifier font) { - return style.withFont(new StyleSpriteSource.Font(font.toMinecraft())); - } - - public static Style withFormatting(Style style, Formatting formatting) { - return style.withFormatting(formatting); - } - - public static Style withExclusiveFormatting(Style style, Formatting formatting) { - return style.withExclusiveFormatting(formatting); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java deleted file mode 100644 index 388da58de..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.text.MutableText; -import net.minecraft.text.Style; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.text.TextConverter; - -public class TextUtil { - public static MutableText literal(String string) { - return Text.literal(string); - } - - public static MutableText translatable(String key) { - return Text.translatable(key); - } - - public static MutableText translatable(String key, Object... args) { - return Text.translatable(key, args); - } - - public static MutableText empty() { - return literal(""); - } - - public static MutableText keybind(String string) { - return Text.keybind(string); - } - - public static String txt2str(Text text) { - return text.getString(); - } - - public static MutableText setStyle(MutableText text, Style style) { - return text.setStyle(style); - } - - public static Style getStyle(MutableText text) { - return text.getStyle(); - } - - public static MutableText withColor(MutableText text, int color) { - return setStyle(text, StyleUtil.withColor(text.getStyle(), color)); - } - - public static MutableText withBold(MutableText text, boolean bold) { - return setStyle(text, StyleUtil.withBold(text.getStyle(), bold)); - } - - public static MutableText append(MutableText text, Text sibling) { - return text.append(sibling); - } - - public static MutableText append(MutableText text, String string) { - return text.append(string); - } - - public static MutableText of(String string) { - return literal(string); - } - - public static MutableText convert(String text) { - return TextConverter.convert(text, false); - } - - public static MutableText convertWithTranslatable(String text) { - return TextConverter.convert(text, true); - } - - public static boolean contains(Text text, Text text1) { - return text.contains(text1); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java deleted file mode 100644 index eaf08acdb..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.world.ServerWorld; -import net.pitan76.mcpitanlib.api.timer.MinecraftServerTimerAccess; -import net.pitan76.mcpitanlib.api.timer.ServerWorldTimerAccess; - -import java.util.function.Supplier; - -public class TimerUtil { - public static void addTimer(ServerWorld world, long ticksUntilSomething, Supplier supplier) { - ((ServerWorldTimerAccess) world).mcpitanlib$addTimer(ticksUntilSomething, supplier); - } - - public static void addTimer(MinecraftServer server, long ticksUntilSomething, Supplier supplier) { - ((MinecraftServerTimerAccess) server).mcpitanlib$addTimer(ticksUntilSomething, supplier); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java deleted file mode 100644 index 87571de96..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.recipe.Ingredient; -import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; - -public class ToolMaterialUtil { - // ミスでstatic化し忘れていたが、互換性のため保持しておく - public CompatibleToolMaterial create(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) { - return create2(miningLevel, durability, miningSpeed, attackDamage, enchantability, repairIngredient); - } - - /** - * Create CompatibleToolMaterial - * @param miningLevel Mining Level - * @param durability Durability - * @param miningSpeed Mining Speed - * @param attackDamage Attack Damage - * @param enchantability Enchantability - * @param repairIngredient Repair Ingredient - * @return CompatibleToolMaterial - */ - public static CompatibleToolMaterial create2(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) { - return new CompatibleToolMaterial() { - @Override - public int getCompatMiningLevel() { - return miningLevel; - } - - @Override - public int getCompatDurability() { - return durability; - } - - @Override - public float getCompatMiningSpeedMultiplier() { - return miningSpeed; - } - - @Override - public Ingredient getCompatRepairIngredient() { - return repairIngredient; - } - - @Override - public float getCompatAttackDamage() { - return attackDamage; - } - - @Override - public int getCompatEnchantability() { - return enchantability; - } - }; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java deleted file mode 100644 index f68dd0bfb..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; - -public class VoxelShapeUtil { - public static VoxelShape union(VoxelShape shape,VoxelShape... shapes) { - return VoxelShapes.union(shape, shapes); - } - - public static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) { - return VoxelShapes.cuboid(x1, y1, z1, x2, y2, z2); - } - - public static VoxelShape cuboid(double x, double y, double z, double size) { - return VoxelShapes.cuboid(x, y, z, x + size, y + size, z + size); - } - - public static VoxelShape cuboid(double size) { - return VoxelShapes.cuboid(0, 0, 0, size, size, size); - } - - public static VoxelShape centeredCuboid(double x, double y, double z, double size) { - return VoxelShapes.cuboid(x - size / 2, y - size / 2, z - size / 2, x + size / 2, y + size / 2, z + size / 2); - } - - public static VoxelShape empty() { - return VoxelShapes.empty(); - } - - public static VoxelShape fullCube() { - return VoxelShapes.fullCube(); - } - - public static VoxelShape blockCuboid(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - return VoxelShapes.cuboid(minX / 16.0, minY / 16.0, minZ / 16.0, maxX / 16.0, maxY / 16.0, maxZ / 16.0); - } - - public static Box getBoundingBox(VoxelShape shape) { - return shape.getBoundingBox(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java deleted file mode 100644 index 183a6e34f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.world.World; - -public class WorldRandomUtil { - public static int nextInt(World world) { - return world.getRandom().nextInt(); - } - - public static int nextInt(World world, int bound) { - return world.getRandom().nextInt(bound); - } - - public static long nextLong(World world) { - return world.getRandom().nextLong(); - } - - public static double nextDouble(World world) { - return world.getRandom().nextDouble(); - } - - public static double nextGaussian(World world) { - return world.getRandom().nextGaussian(); - } - - public static float nextFloat(World world) { - return world.getRandom().nextFloat(); - } - - public static int nextBetween(World world, int min, int max) { - return world.getRandom().nextBetween(min, max); - } - - public static int nextBetweenExclusive(World world, int min, int max) { - return world.getRandom().nextBetweenExclusive(min, max); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java deleted file mode 100644 index 9a322dae9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java +++ /dev/null @@ -1,482 +0,0 @@ -package net.pitan76.mcpitanlib.api.util; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.*; -import net.minecraft.entity.mob.Monster; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.predicate.entity.EntityPredicates; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.util.math.BoxUtil; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import net.pitan76.mcpitanlib.api.util.particle.CompatParticleType; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; -import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; -import org.jetbrains.annotations.Nullable; - -import java.util.*; -import java.util.function.Predicate; - -public class WorldUtil { - public static boolean hasSkyLight(World world) { - return world.getDimension().hasSkyLight(); - } - - public static boolean isThundering(World world) { - return world.isThundering(); - } - - public static boolean isRaining(World world) { - return world.isRaining(); - } - - public static boolean isNight(World world) { - return world.isNight(); - } - - public static boolean isDay(World world) { - return world.isDay(); - } - - public static boolean isSkyVisible(World world, BlockPos pos) { - return world.isSkyVisible(pos); - } - - public static boolean isClient(World world) { - return world.isClient(); - } - - public static void scheduleBlockTick(World world, BlockPos pos, Block block, int delay) { - world.scheduleBlockTick(pos, block, delay); - } - - public static void scheduleFluidTick(World world, BlockPos pos, Fluid fluid, int delay) { - world.scheduleFluidTick(pos, fluid, delay); - } - - public static boolean isServer(World world) { - return !isClient(world); - } - - public static void spawnStack(World world, BlockPos pos, ItemStack stack) { - spawnEntity(world, new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), stack)); - } - - public static void spawnExperienceOrb(World world, Vec3d pos, int amount) { - if (world instanceof ServerWorld) - ExperienceOrbEntity.spawn((ServerWorld) world, pos, amount); - } - - public static void spawnExperienceOrb(World world, BlockPos pos, int amount) { - spawnExperienceOrb(world, pos.toCenterPos(), amount); - } - - public static void spawnEntity(World world, Entity entity) { - world.spawnEntity(entity); - } - - public static void playSound(World world, @Nullable Player player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { - PlayerEntity entity = player == null ? null : player.getEntity(); - world.playSound(entity, pos, sound, category, volume, pitch); - } - - public static void playSound(World world, @Nullable Player player, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { - playSound(world, player, pos, sound.get(), category.get(), volume, pitch); - } - - public static void playSound(World world, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { - playSound(world, null, pos, sound.get(), category.get(), volume, pitch); - } - - public static void playSound(World world, double x, double y, double z, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, boolean useDistance) { - world.playSoundClient(x, y, z, sound.get(), category.get(), volume, pitch, useDistance); - } - - public static void sendEntityStatus(World world, Entity entity, byte status) { - world.sendEntityStatus(entity, status); - } - - public static BlockPos getSpawnPos(World world) { - return world.getSpawnPoint().getPos(); - } - - public static Optional getServer(World world) { - if (isClient(world)) return Optional.empty(); - return Optional.ofNullable(world.getServer()); - } - - public static ServerWorld getWorld(World world, Identifier worldId) { - Optional server = getServer(world); - return server.map(minecraftServer -> getWorld(minecraftServer, worldId)).orElse(null); - - } - - public static Optional getWorld(World world, CompatIdentifier worldId) { - return Optional.ofNullable(getWorld(world, worldId.toMinecraft())); - } - - public static ServerWorld getOverworld(MinecraftServer server) { - return server.getWorld(World.OVERWORLD); - } - - public static ServerWorld getNether(MinecraftServer server) { - return server.getWorld(World.NETHER); - } - - public static ServerWorld getEnd(MinecraftServer server) { - return server.getWorld(World.END); - } - - public static ServerWorld getWorld(MinecraftServer server, Identifier worldId) { - return server.getWorld(RegistryKey.of(RegistryKeys.WORLD, worldId)); - } - - public static ServerWorld getWorld(MinecraftServer server, CompatIdentifier worldId) { - return getWorld(server, worldId.toMinecraft()); - } - - public static Identifier getWorldId(World world) { - return world.getRegistryKey().getValue(); - } - - public static CompatIdentifier getCompatWorldId(World world) { - return CompatIdentifier.fromMinecraft(getWorldId(world)); - } - - public static boolean equals(World world, World world2) { - return Objects.equals(getWorldId(world), getWorldId(world2)); - } - - @Deprecated - public static void addTicket(ServerWorld world, net.minecraft.server.world.ChunkTicketType type, ChunkPos pos, int radius, T argument) { - world.getChunkManager().addTicket(type, pos, radius); - } - - @Deprecated - public static void removeTicket(ServerWorld world, net.minecraft.server.world.ChunkTicketType type, ChunkPos pos, int radius, T argument) { - world.getChunkManager().removeTicket(type, pos, radius); - } - - public static void addTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { - addTicket(world, type.getRaw(), pos, radius, argument); - } - - public static void removeTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { - removeTicket(world, type.getRaw(), pos, radius, argument); - } - - public static void addTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius) { - world.getChunkManager().addTicket(type.getRaw(), pos, radius); - } - - public static void removeTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius) { - world.getChunkManager().removeTicket(type.getRaw(), pos, radius); - } - - public static boolean isReceivingRedstonePower(World world, BlockPos pos) { - return world.isReceivingRedstonePower(pos); - } - - public static int getBottomY(World world) { - return world.getBottomY(); - } - - public static int getTopY(World world) { - return world.getTopYInclusive(); - } - - public static int getDimensionHeight(World world) { - return world.getDimension().height(); - } - - public static BlockEntity getBlockEntity(World world, BlockPos pos) { - return world.getBlockEntity(pos); - } - - public static boolean hasBlockEntity(World world, BlockPos pos) { - return getBlockEntity(world, pos) != null; - } - - public static BlockState getBlockState(World world, BlockPos pos) { - return world.getBlockState(pos); - } - - public static FluidState getFluidState(World world, BlockPos pos) { - return world.getFluidState(pos); - } - - public static boolean hasFluidState(World world, BlockPos pos) { - return ! getFluidState(world, pos).isEmpty(); - } - - public static boolean isAir(World world, BlockPos pos) { - return getBlockState(world, pos).isAir(); - } - - public static boolean setBlockState(World world, BlockPos pos, BlockState state, int flags) { - return world.setBlockState(pos, state, flags); - } - - public static boolean setBlockState(World world, BlockPos pos, BlockState state) { - return setBlockState(world, pos, state, 3); - } - - public static boolean setBlockState(World world, BlockPos pos, Block block, int flags) { - return setBlockState(world, pos, block.getDefaultState(), flags); - } - - public static boolean setBlockState(World world, BlockPos pos, Block block) { - return setBlockState(world, pos, block, 3); - } - - public static boolean breakBlock(World world, BlockPos pos, boolean drop) { - return world.breakBlock(pos, drop); - } - - public static boolean breakBlock(World world, BlockPos pos) { - return breakBlock(world, pos, true); - } - - public static boolean breakBlock(World world, BlockPos pos, boolean drop, @Nullable Player player) { - if (player == null) - return world.breakBlock(pos, drop, null); - - return world.breakBlock(pos, drop, player.getPlayerEntity()); - } - - public static boolean breakBlock(World world, BlockPos pos, @Nullable Player player) { - return breakBlock(world, pos, true, player); - } - - public static void removeBlockEntity(World world, BlockPos pos) { - world.removeBlockEntity(pos); - } - - public static boolean removeBlock(World world, BlockPos pos, boolean move) { - return world.removeBlock(pos, move); - } - - public static void addParticle(World world, ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - world.addParticleClient(parameters, x, y, z, velocityX, velocityY, velocityZ); - } - - public static boolean canSetBlock(World world, BlockPos pos) { - return world.canPlace(Blocks.STONE.getDefaultState(), pos, ShapeContext.absent()); - } - - public static void updateComparators(World world, BlockPos pos, Block block) { - world.updateComparators(pos, block); - } - - public static List getPlayers(World world) { - List players = new ArrayList<>(); - for (PlayerEntity player : world.getPlayers()) { - players.add(new Player(player)); - } - - return players; - } - - public static Player getPlayer(World world, UUID uuid) { - return new Player(world.getPlayerByUuid(uuid)); - } - - public static CompatRandom getRandom(World world) { - return new CompatRandom(world.getRandom()); - } - - public static long getTime(World world) { - return world.getTime(); - } - - public static List getEntitiesByType(World world, EntityType filter, Box box, Predicate predicate) { - return world.getEntitiesByType(filter, box, predicate); - } - - public static List getEntitiesByClass(World world, Class entityClass, Box box, Predicate predicate) { - return world.getEntitiesByClass(entityClass, box, predicate); - } - - public static void spawnParticles(World world, ParticleEffect parameters, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { - if (!isServer(world)) return; - - ((ServerWorld) world).spawnParticles(parameters, x, y, z, count, velocityX, velocityY, velocityZ, speed); - } - - public static void updateListeners(World world, BlockPos pos, BlockState oldState, BlockState newState, int flags) { - world.updateListeners(pos, oldState, newState, flags); - } - - public static net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState(World world, BlockPos pos) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState(world, pos)); - } - - public static boolean setBlockState(World world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { - return setBlockState(world, pos, state.toMinecraft(), flags); - } - - public static boolean setBlockState(World world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return setBlockState(world, pos, state, 3); - } - - public static boolean setBlockState(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { - return setBlockState(world, pos.toMinecraft(), state.toMinecraft(), flags); - } - - public static boolean setBlockState(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { - return setBlockState(world, pos, state, 3); - } - - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop) { - return breakBlock(world, pos.toMinecraft(), drop); - } - - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return breakBlock(world, pos, true); - } - - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop, @Nullable Player player) { - return breakBlock(world, pos.toMinecraft(), drop, player); - } - - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, @Nullable Player player) { - return breakBlock(world, pos, true, player); - } - - public static void removeBlockEntity(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - removeBlockEntity(world, pos.toMinecraft()); - } - - public static boolean removeBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean move) { - return removeBlock(world, pos.toMinecraft(), move); - } - - public static void playSound(net.pitan76.mcpitanlib.midohra.world.World world, @Nullable Player player, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { - playSound(world.getRaw(), player, pos.toMinecraft(), sound, category, volume, pitch); - } - - public static void dropStackOnBlock(World world, BlockPos pos, ItemStack stack) { - Block.dropStack(world, pos, stack); - } - - public static float getSkyAngle(World world, float tickDelta) { - long timeOfDay = world.getTimeOfDay(); - float f = ((float)(timeOfDay % 24000L) + tickDelta) / 24000.0F - 0.25F; - if (f < 0.0F) { - f += 1.0F; - } - if (f > 1.0F) { - f -= 1.0F; - } - return f; - } - - public static Block getBlock(World world, BlockPos pos) { - return getBlockState(world, pos).getBlock(); - } - - public static BlockWrapper getBlockWrapper(World world, BlockPos pos) { - return BlockWrapper.of(getBlock(world, pos)); - } - - public static List getEntitiesByType(World world, EntityType filter, Box box) { - return getEntitiesByType(world, filter, box, EntityPredicates.VALID_ENTITY); - } - - public static List getEntitiesByType(World world, EntityTypeWrapper filter, Box box, Predicate predicate) { - return getEntitiesByType(world, (EntityType) filter.get(), box, predicate); - } - - public static List getEntitiesByType(World world, EntityTypeWrapper filter, Box box) { - return getEntitiesByType(world, filter.get(), box); - } - - public static CompatIdentifier getOverworldId() { - return CompatIdentifier.fromMinecraft(World.OVERWORLD.getValue()); - } - - public static CompatIdentifier getNetherId() { - return CompatIdentifier.fromMinecraft(World.NETHER.getValue()); - } - - public static CompatIdentifier getEndId() { - return CompatIdentifier.fromMinecraft(World.END.getValue()); - } - - public static long getTimeOfDay(World world) { - return world.getTimeOfDay(); - } - - public static List getEntitiesByClass(World world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box) { - return getEntitiesByClass(world, entityClass, box, EntityPredicates.VALID_ENTITY); - } - - public static List getEntitiesByClass(World world, Class entityClass, Box box) { - return getEntitiesByClass(world, entityClass, box, EntityPredicates.VALID_ENTITY); - } - - public static List getEntitiesByClass(World world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { - return getEntitiesByClass(world, entityClass, box.toMinecraft(), predicate); - } - - public static List getEntitiesByClass(World world, Class entityClass, Vector3d center, double radius, Predicate predicate) { - Box box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); - return getEntitiesByClass(world, entityClass, box, predicate); - } - - public static List getEntitiesByClass(World world, Class entityClass, Vector3d center, double radius) { - return getEntitiesByClass(world, entityClass, center, radius, EntityPredicates.VALID_ENTITY); - } - - public static List getMonsters(World world, Box box) { - return world.getEntitiesByClass(LivingEntity.class, box, entity -> entity instanceof Monster); - } - - public static List getMonsters(World world, net.pitan76.mcpitanlib.midohra.util.math.Box box) { - return getMonsters(world, box.toMinecraft()); - } - - public static List getMonsters(World world, Vector3d center, double radius) { - Box box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); - return getMonsters(world, box); - } - - public static List getEntitiesByType(World world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box) { - return getEntitiesByType(world, filter, box.toMinecraft()); - } - - public static List getEntitiesByType(World world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { - return getEntitiesByType(world, filter, box.toMinecraft(), predicate); - } - - /** - * ParticleType is a ParticleEffect only. - */ - public static void addParticle(World world, CompatParticleType parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - if (parameters.getRaw() instanceof ParticleEffect) - addParticle(world, (ParticleEffect) parameters.getRaw(), x, y, z, velocityX, velocityY, velocityZ); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java deleted file mode 100644 index 4c42a10e8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.block; - -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; - -public class BlockHitResultUtil { - - public static BlockHitResult create(Vec3d pos, Direction direction, BlockPos blockPos, boolean insideBlock) { - return new BlockHitResult(pos, direction, blockPos, insideBlock); - } - - public static BlockHitResult create(Vec3d pos, Direction direction, BlockPos blockPos) { - return new BlockHitResult(pos, direction, blockPos, false); - } - - public static Vec3d getPos(BlockHitResult blockHitResult) { - return blockHitResult.getPos(); - } - - public static Direction getSide(BlockHitResult blockHitResult) { - return blockHitResult.getSide(); - } - - public static BlockPos getBlockPos(BlockHitResult blockHitResult) { - return blockHitResult.getBlockPos(); - } - - public static boolean isInsideBlock(BlockHitResult blockHitResult) { - return blockHitResult.isInsideBlock(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java deleted file mode 100644 index 4f1eae397..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java +++ /dev/null @@ -1,235 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.block; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.v2.BlockUtilV2; - -import java.util.ArrayList; -import java.util.List; - -@SuppressWarnings("deprecation") -public class BlockUtil { - /** - * Check if two blocks are equal. - * @param block Block to compare. - * @param block2 Block to compare. - * @return If two blocks are equal. - */ - public static boolean isEqual(Block block, Block block2) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.isEqual(block, block2); - } - - /** - * Get block from CompatIdentifier. - * @param id CompatIdentifier of the block. - * @return Block of the CompatIdentifier. - */ - public static Block fromId(CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.fromId(id); - } - - public static Block fromId(String id) { - return fromId(CompatIdentifier.of(id)); - } - - public static Block fromId(String namespace, String path) { - return fromId(CompatIdentifier.of(namespace, path)); - } - - /** - * Get CompatIdentifier from Block. - * @param block Block to get CompatIdentifier. - * @return CompatIdentifier of the Block. - */ - public static CompatIdentifier toId(Block block) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.toCompatID(block); - } - - public static String toIdAsString(Block block) { - return toId(block).toString(); - } - - /** - * Check if the block exist. - * @param id CompatIdentifier of the block. - * @return If the block exist. - */ - public static boolean isExist(CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.isExist(id); - } - - public static boolean isExist(String id) { - return isExist(CompatIdentifier.of(id)); - } - - public static boolean isExist(String namespace, String path) { - return isExist(CompatIdentifier.of(namespace, path)); - } - - public static boolean isMinecraftBlock(Block block) { - return CompatIdentifier.isMinecraftNamespace(toId(block)); - } - - /** - * Create a new Block - * @param settings Block settings - * @return The new Block - */ - public static Block create(CompatibleBlockSettings settings) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.of(settings); - } - - /** - * Get all blocks. - * @return List of all blocks. - */ - public static List getBlocks() { - return net.pitan76.mcpitanlib.api.util.BlockUtil.getAllBlocks(); - } - - /** - * Get blocks from tag key. - * @param tagKey Tag key of the blocks. - * @return Blocks of the tag key. - */ - public static List getInTag(TagKey tagKey) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.getBlocks(tagKey); - } - - /** - * Get blocks from tag key. - * @param id CompatIdentifier of the tag key. - * @return Blocks of the tag key. - */ - public static List getInTag(CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.getBlocks(id.toMinecraft()); - } - - public static List getInTag(String id) { - return getInTag(CompatIdentifier.of(id)); - } - - public static List getInTag(String namespace, String path) { - return getInTag(CompatIdentifier.of(namespace, path)); - } - - /** - * Check if the block is in the tag. - * @param block Block to check. - * @param tagKey Tag key of the tag. - * @return If the block is in the tag. - */ - public static boolean isInTag(Block block, TagKey tagKey) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.isIn(block, tagKey); - } - - /** - * Check if the block is in the tag. - * @param block Block to check. - * @param id CompatIdentifier of the tag. - * @return If the block is in the tag. - */ - public static boolean isInTag(Block block, CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.isBlockInTag(block, id.toMinecraft()); - } - - public static boolean isInTag(Block block, String id) { - return isInTag(block, CompatIdentifier.of(id)); - } - - public static boolean isInTag(Block block, String namespace, String path) { - return isInTag(block, CompatIdentifier.of(namespace, path)); - } - - /** - * Get raw id of the block. - * @param block Block to get raw id. - * @return Raw id of the block. - */ - public static int getRawId(Block block) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.getRawId(block); - } - - /** - * Get block from raw id. - * @param rawId Raw id of the block. - * @return Block of the raw id. - */ - public static Block fromRawId(int rawId) { - return net.pitan76.mcpitanlib.api.util.BlockUtil.fromIndex(rawId); - } - - /** - * Get blocks in the namespace. - * @param namespace Namespace of the blocks. - * @return List of blocks in the namespace. - */ - public static List getBlocksInNamespace(String namespace) { - List blocks = new ArrayList<>(); - - for (Block block : getBlocks()) { - if (toId(block).getNamespace().equals(namespace)) { - blocks.add(block); - } - } - - return blocks; - } - - /** - * Get number of all blocks. - * @return Number of all blocks. - */ - public static int getNumberOfBlocks() { - return getBlocks().size(); - } - - /** - * Get item from block. - * @param block Block - * @return Item - */ - public static Item toItem(Block block) { - return block.asItem(); - } - - /** - * Get name of the block. - * @param block Block - * @return Name of the block. - */ - public static String getNameAsString(Block block) { - return block.getName().getString(); - } - - /** - * Get name of the block. - * @param block Block - * @return Name of the block. - */ - public static TextComponent getName(Block block) { - return new TextComponent(block.getName()); - } - - /** - * Get translation key of the block. - * @param block Block - * @return Translation key of the block. - */ - public static String getTranslationKey(Block block) { - return block.getTranslationKey(); - } - - public static Block fromItem(Item item) { - return BlockUtilV2.fromItem(item); - } - - public static Block fromItem(ItemStack stack) { - return BlockUtilV2.fromItem(stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java deleted file mode 100644 index 20199a63e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.block.entity; - -import net.minecraft.block.entity.AbstractFurnaceBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.AbstractCookingRecipe; -import net.minecraft.recipe.input.SingleStackRecipeInput; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.recipe.MatchGetter; -import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.api.util.recipe.input.SingleStackRecipeInputUtil; - -public class FurnaceUtil { - public static int getDefaultCookTime() { - return AbstractFurnaceBlockEntity.DEFAULT_COOK_TIME; - } - - public static boolean canUseAsFuel(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, World world) { - return canUseAsFuel(stack.toMinecraft(), world); - } - - public static boolean canUseAsFuel(ItemStack stack, World world) { - return world.getFuelRegistry().isFuel(stack); - } - - public static void tick(World world, BlockPos pos, AbstractFurnaceBlockEntity blockEntity) { - AbstractFurnaceBlockEntity.tick((ServerWorld) world, pos, WorldUtil.getBlockState(world, pos), blockEntity); - } - - public static int getCookTime(World world, AbstractFurnaceBlockEntity furnace, MatchGetter matchGetter) { - return getCookTime(world, furnace.getStack(0), matchGetter); - } - - public static int getCookTime(World world, ItemStack stack, MatchGetter matchGetter) { - CompatRecipeInput input = (CompatRecipeInput) SingleStackRecipeInputUtil.create(stack); - - matchGetter.getFirstMatch(input, world); - - return matchGetter.getFirstMatch(input, world).map( - (recipe) -> (recipe.getRecipe()).getCookingTime()).orElse(200); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java deleted file mode 100644 index 66a89f319..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; - -public class BlockEntityRendererUtil { - public static BlockEntityRendererFactory.Context convert(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { - return new BlockEntityRendererFactory.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getItemRenderer(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer(), ctx.getSpriteHolder(), ctx.getPlayerSkinRenderCache()); - } - - public static CompatRegistryClient.BlockEntityRendererFactory.Context convert(BlockEntityRendererFactory.Context ctx) { - return new CompatRegistryClient.BlockEntityRendererFactory.Context(ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java deleted file mode 100644 index 9b807f0ea..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java +++ /dev/null @@ -1,117 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import com.mojang.authlib.GameProfile; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.Mouse; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.texture.TextureManager; -import net.minecraft.client.util.Window; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.profiler.Profiler; -import net.pitan76.mcpitanlib.api.client.option.GameOptionsWrapper; -import net.pitan76.mcpitanlib.api.entity.Player; - -import java.io.File; -import java.util.Optional; - -public class ClientUtil { - public static void setScreen(Screen screen) { - getClient().setScreen(screen); - } - - public static Screen getScreen() { - return getClient().currentScreen; - } - - public static Player getPlayer() { - return new Player(getClientPlayer()); - } - - public static ClientPlayerEntity getClientPlayer() { - return getClient().player; - } - - public static MinecraftClient getClient() { - return MinecraftClient.getInstance(); - } - - public static TextRenderer getTextRenderer() { - return getClient().textRenderer; - } - - public static ItemRenderer getItemRenderer() { - return getClient().getItemRenderer(); - } - - public static ResourceManager getResourceManager() { - return getClient().getResourceManager(); - } - - public static TextureManager getTextureManager() { - return getClient().getTextureManager(); - } - - public static ClientWorld getWorld() { - return getClient().world; - } - - public static GameRenderer getGameRenderer() { - return getClient().gameRenderer; - } - - public static Optional getTime() { - if (getClient().world == null) return Optional.empty(); - return Optional.of(getClient().world.getTime()); - } - - public static long getRenderTime() { - return getClient().getRenderTime(); - } - - public static HitResult getTarget() { - return getClient().crosshairTarget; - } - - public static WorldRenderer getWorldRenderer() { - return getClient().worldRenderer; - } - - public static File getRunDirectory() { - return getClient().runDirectory; - } - - public static Profiler getProfiler() { - return null; - } - - public static GameProfile getGameProfile() { - return getClient().getGameProfile(); - } - - public static Window getWindow() { - return getClient().getWindow(); - } - - public static Mouse getMouse() { - return getClient().mouse; - } - - public static boolean isInSingleplayer() { - return getClient().isInSingleplayer(); - } - - public static boolean isPaused() { - return getClient().isPaused(); - } - - public static GameOptionsWrapper getOptions() { - return new GameOptionsWrapper(getClient().options); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java deleted file mode 100644 index 89ce635d4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import net.minecraft.client.resource.language.I18n; -import net.minecraft.client.resource.language.LanguageManager; -import net.pitan76.mcpitanlib.midohra.resource.ResourceManager; - -public class LanguageUtil { - public static boolean hasTranslation(String key) { - return I18n.hasTranslation(key); - } - - public static String translate(String key) { - return I18n.translate(key); - } - - public static String translate(String key, Object... args) { - return I18n.translate(key, args); - } - - public static String translateWithFallback(String key, String fallback) { - return I18n.hasTranslation(key) ? I18n.translate(key) : fallback; - } - - public static String translateWithFallback(String key, String fallback, Object... args) { - return I18n.hasTranslation(key) ? I18n.translate(key, args) : fallback; - } - - public static LanguageManager getLanguageManager() { - return ClientUtil.getClient().getLanguageManager(); - } - - public static String getLanguage() { - return getLanguageManager().getLanguage(); - } - - public static void setLanguage(String language) { - getLanguageManager().setLanguage(language); - } - - public static void reload(net.minecraft.resource.ResourceManager resourceManager) { - getLanguageManager().reload(resourceManager); - } - - public static void reload(ResourceManager resourceManager) { - reload(resourceManager.getRaw()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java deleted file mode 100644 index 52a5d0a56..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import net.minecraft.client.util.math.MatrixStack; -import net.pitan76.mcpitanlib.api.util.MathUtil; - -import static net.pitan76.mcpitanlib.api.util.MathUtil.getRotationDegrees; - -public class MatrixStackUtil { - public static void multiply(MatrixStack matrixStack, MathUtil.RotationAxisType type, float deg) { - matrixStack.multiply(getRotationDegrees(type, deg)); - } - - public static void push(MatrixStack matrices) { - matrices.push(); - } - - public static void pop(MatrixStack matrices) { - matrices.pop(); - } - - public static void translate(MatrixStack matrices, double x, double y, double z) { - matrices.translate(x, y, z); - } - - public static void scale(MatrixStack matrices, float x, float y, float z) { - matrices.scale(x, y, z); - } - - public static MatrixStack.Entry peek(MatrixStack matrices) { - return matrices.peek(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java deleted file mode 100644 index 898acde1d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import net.minecraft.client.Mouse; - -public class MouseUtil { - - public static Mouse getMouse() { - return ClientUtil.getMouse(); - } - - public static double getMouseX() { - return getMouse().getX(); - } - - public static double getMouseY() { - return getMouse().getY(); - } - - public static boolean isCursorLocked() { - return getMouse().isCursorLocked(); - } - - public static void lockCursor() { - getMouse().lockCursor(); - } - - public static void unlockCursor() { - getMouse().unlockCursor(); - } - - public static void tick() { - getMouse().tick(); - } - - public static boolean wasLeftButtonClicked() { - return getMouse().wasLeftButtonClicked(); - } - - public static boolean wasRightButtonClicked() { - return getMouse().wasRightButtonClicked(); - } - - public static boolean wasMiddleButtonClicked() { - return getMouse().wasMiddleButtonClicked(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java deleted file mode 100644 index bf130ba5e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.util.Identifier; - -public class RenderUtil { - public static void setShaderToPositionTexProgram() { - // -1.21.4 - } - - public static void setShaderColor(float red, float green, float blue, float alpha) { - //RenderSystem.setShaderColor(red, green, blue, alpha); - } - - public static void setShaderTexture(int texture, Identifier id) { - // -1.21.4 - } - - public static void enableDepthTest() { - // -1.21.4 - } - - public static void enableTexture() { - // ~1.19.2 - } - - public static void disableTexture() { - // ~1.19.2 - } - - public static class RendererUtil extends ScreenUtil.RendererUtil {} -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java deleted file mode 100644 index 373a3bd72..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java +++ /dev/null @@ -1,224 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.screen.ScreenTexts; -import net.minecraft.text.OrderedText; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; -import net.pitan76.mcpitanlib.api.client.gui.widget.RedrawableTexturedButtonWidget; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -@Environment(EnvType.CLIENT) -public class ScreenUtil { - public static void setBackground(Identifier GUI, float f, float g, float h, float i) { - RenderUtil.setShaderToPositionTexProgram(); - RenderUtil.setShaderColor(f, g, h, i); - RenderUtil.setShaderTexture(0, GUI); - - // GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); - // MinecraftClient.getInstance().getTextureManager().bindTexture(GUI); - } - - public static void setBackground(Identifier GUI) { - setBackground(GUI, 1.0F, 1.0F, 1.0F, 1.0F); - } - - // ~1.19.2 - public static void setRepeatEvents(boolean isRepeatEvents) { - } - - // ~1.19.4 - public static void setPassEvents(Screen screen, boolean isPassEvents) { - } - - public static ButtonWidget createButtonWidget(int x, int y, int width, int height, Text message, ButtonWidget.PressAction onPress) { - return createButtonWidget(x, y, width, height, message, onPress, null); - } - - public static ButtonWidget createButtonWidget(int x, int y, int width, int height, Text message, ButtonWidget.PressAction onPress, @Nullable ButtonWidget.NarrationSupplier tooltipSupplier) { - ButtonWidget.Builder builder = ButtonWidget.builder(message, onPress).dimensions(x, y, width , height); - if (tooltipSupplier != null) - builder.narrationSupplier(tooltipSupplier); - - return builder.build(); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { - return createTexturedButtonWidget(x, y, width, height, u, v, height, texture, pressAction); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { - return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { - return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, Texts.empty()); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { - return new CompatibleTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { - return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, height, texture, pressAction); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { - return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { - return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, Texts.empty()); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { - return new RedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { - return createTexturedButtonWidget(x, y, width, height, u, v, height, texture.toMinecraft(), pressAction); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { - return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { - return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); - } - - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { - return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, message); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { - return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, texture.toMinecraft(), pressAction); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { - return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { - return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); - } - - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { - return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, message); - } - - - - public static class Texts { - public static Text empty() { - return ScreenTexts.EMPTY; - } - } - - public static class TextFieldUtil extends net.pitan76.mcpitanlib.api.util.client.widget.TextFieldUtil { - // Nothing - } - - public static class ClickableWidgetUtil extends net.pitan76.mcpitanlib.api.util.client.widget.ClickableWidgetUtil { - // Nothing - } - - public static class RendererUtil { - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, Text text, int x, int y, int color) { - drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); - return -1; - } - - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, String text, int x, int y, int color) { - drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); - return -1; - } - - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, OrderedText text, int x, int y, int color) { - drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); - return -1; - } - - public static void drawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { - drawObjectDM.getContext().drawTexture(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, textureWidth, textureHeight); - } - - public static void drawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, float u, float v, int width, int height) { - drawObjectDM.getContext().drawTexture(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, 256, 256); - } - - public static TextRenderer getTextRenderer() { - return MinecraftClient.getInstance().textRenderer; - } - - public static void drawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { - drawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height, textureWidth, textureHeight); - } - - public static void drawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, float u, float v, int width, int height) { - drawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); - } - - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y, int color) { - return drawText(renderer, drawObjectDM, text.getText(), x, y, color); - } - - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, Text text, int x, int y) { - return drawText(renderer, drawObjectDM, text, x, y, -12566464); - } - - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { - return drawText(renderer, drawObjectDM, text, x, y, -12566464); - } - - public static void drawTooltip(DrawObjectDM drawObjectDM, TextRenderer textRenderer, Text text, int x, int y) { - drawObjectDM.getContext().drawTooltip(textRenderer, text, x, y); - } - - public static void drawTooltip(DrawObjectDM drawObjectDM, TextRenderer textRenderer, List texts, int x, int y) { - drawObjectDM.getContext().drawTooltip(textRenderer, texts, x, y); - } - - public static void drawBorder(DrawObjectDM drawObjectDM, int x, int y, int width, int height, int color) { - // TODO: drawBorderを一時的に廃止 - //drawObjectDM.getContext().drawBorder(x, y, width, height, color); - } - - public static void drawTooltip(DrawObjectDM drawObjectDM, Text text, int x, int y) { - drawObjectDM.getContext().drawTooltip(getTextRenderer(), text, x, y); - } - - public static void drawTooltip(DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { - drawTooltip(drawObjectDM, text.getText(), x, y); - } - - public static void drawTooltip(DrawObjectDM drawObjectDM, List texts, int x, int y) { - drawObjectDM.getContext().drawTooltip(getTextRenderer(), texts, x, y); - } - } - - public static int getWidth(Text text) { - return RendererUtil.getTextRenderer().getWidth(text); - } - - // RGBからARGBに変換する (1.21.6からは透明になるため) - private static int fixColor(int color) { - if ((color >>> 24) == 0) { - return 0xFF000000 | color; - } else { - return color; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java deleted file mode 100644 index a57e74910..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client; - -import net.minecraft.client.util.Window; - -public class WindowUtil { - - public static Window getWindow() { - return ClientUtil.getWindow(); - } - - public static int getWindowScaledWidth() { - return getWindow().getScaledWidth(); - } - - public static int getWindowScaledHeight() { - return getWindow().getScaledHeight(); - } - - public static int getWindowWidth() { - return getWindow().getWidth(); - } - - public static int getWindowHeight() { - return getWindow().getHeight(); - } - - public static int getWindowX() { - return getWindow().getX(); - } - - public static int getWindowY() { - return getWindow().getY(); - } - - public static void setTitle(String title) { - getWindow().setTitle(title); - } - - public static void close() { - getWindow().close(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java deleted file mode 100644 index d6567bf1f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.render; - -import net.minecraft.item.ItemDisplayContext; -import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; - -public class CompatItemDisplayContext implements CompatStringIdentifiable { - private final ItemDisplayContext context; - - public static final CompatItemDisplayContext NONE = of(ItemDisplayContext.NONE); - public static final CompatItemDisplayContext THIRD_PERSON_LEFT_HAND = of(ItemDisplayContext.THIRD_PERSON_LEFT_HAND); - public static final CompatItemDisplayContext THIRD_PERSON_RIGHT_HAND = of(ItemDisplayContext.THIRD_PERSON_RIGHT_HAND); - public static final CompatItemDisplayContext FIRST_PERSON_LEFT_HAND = of(ItemDisplayContext.FIRST_PERSON_LEFT_HAND); - public static final CompatItemDisplayContext FIRST_PERSON_RIGHT_HAND = of(ItemDisplayContext.FIRST_PERSON_RIGHT_HAND); - public static final CompatItemDisplayContext HEAD = of(ItemDisplayContext.HEAD); - public static final CompatItemDisplayContext GUI = of(ItemDisplayContext.GUI); - public static final CompatItemDisplayContext GROUND = of(ItemDisplayContext.GROUND); - public static final CompatItemDisplayContext FIXED = of(ItemDisplayContext.FIXED); - public static final CompatItemDisplayContext ON_SHELF = of(ItemDisplayContext.ON_SHELF); - - public CompatItemDisplayContext(ItemDisplayContext context) { - this.context = context; - } - - public static CompatItemDisplayContext of(ItemDisplayContext context) { - return new CompatItemDisplayContext(context); - } - - public ItemDisplayContext getContext() { - return context; - } - - public String getName() { - return context.name(); - } - - @Override - public String asString_compat() { - return getName(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java deleted file mode 100644 index 3a7e8b59f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.render; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.item.ItemModelManager; -import net.minecraft.client.render.item.ItemRenderState; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; - -/** - * Cross-version utility for rendering items in block entity renderers. - */ -public class CompatItemRenderUtil { - /** - * Renders an ItemStack in FIXED transform mode. - */ - public static void renderItemFixed(ItemStack stack, BlockEntityRenderEvent e, World world) { - renderItem(stack, CompatItemDisplayContext.FIXED, e, world); - } - - /** - * Renders an ItemStack - */ - public static void renderItem(ItemStack stack, CompatItemDisplayContext displayContext, BlockEntityRenderEvent e, World world) { - ItemModelManager manager = e.ctx != null ? e.ctx.getItemModelManager() : MinecraftClient.getInstance().getItemModelManager(); - - ItemRenderState state = new ItemRenderState(); - manager.clearAndUpdate(state, stack, displayContext.getContext(), world, null, 0); - - int light = e.getLight(); - if (light == 0) light = 0xF000F0; // full-bright fallback if not populated by MCPitanLib - int overlay = e.getOverlay(); - - state.render(e.matrices, e.getQueue(), light, overlay, 0); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java deleted file mode 100644 index 6121672b7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java +++ /dev/null @@ -1,203 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.render; - -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; -import org.joml.Matrix3f; -import org.joml.Matrix4f; - -public class VertexConsumerUtil { - public static VertexConsumer vertex(VertexConsumer vertexConsumer, float x, float y, float z) { - return vertexConsumer.vertex(x, y, z); - } - - public static VertexConsumer vertex(VertexConsumer vertexConsumer, MatrixStack stack, float x, float y, float z) { - return vertexConsumer.vertex(stack.peek(), x, y, z); - } - - public static VertexConsumer normal(VertexConsumer vertexConsumer, float x, float y, float z) { - return vertexConsumer.normal(x, y, z); - } - - public static VertexConsumer color(VertexConsumer vertexConsumer, float red, float green, float blue, float alpha) { - return vertexConsumer.color(red, green, blue, alpha); - } - - public static VertexConsumer color(VertexConsumer vertexConsumer, int red, int green, int blue, int alpha) { - return vertexConsumer.color(red, green, blue, alpha); - } - - public static VertexConsumer colorARGB(VertexConsumer vertexConsumer, int argb) { - return vertexConsumer.color(argb); - } - - public static VertexConsumer colorRGB(VertexConsumer vertexConsumer, int rgb) { - return colorARGB(vertexConsumer, (0xFF << 24) | (rgb & 0xFFFFFF)); - } - - public static VertexConsumer light(VertexConsumer vertexConsumer, int light) { - return vertexConsumer.light(light); - } - - public static VertexConsumer overlay(VertexConsumer vertexConsumer, int overlay) { - return vertexConsumer.overlay(overlay); - } - - public static VertexConsumer overlayDefaultUV(VertexConsumer vertexConsumer) { - return vertexConsumer.overlay(OverlayTexture.DEFAULT_UV); - } - - public static DrawObjectMV vertex(DrawObjectMV drawObject, float x, float y, float z) { - vertex(drawObject.getBuffer(), drawObject.getStack(), x, y, z); - return drawObject; - } - - public static DrawObjectMV normal(DrawObjectMV drawObject, float x, float y, float z) { - normal(drawObject.getBuffer(), x, y, z); - return drawObject; - } - - public static DrawObjectMV color(DrawObjectMV drawObject, float red, float green, float blue, float alpha) { - color(drawObject.getBuffer(), red, green, blue, alpha); - return drawObject; - } - - public static DrawObjectMV color(DrawObjectMV drawObject, int red, int green, int blue, int alpha) { - color(drawObject.getBuffer(), red, green, blue, alpha); - return drawObject; - } - - public static DrawObjectMV colorARGB(DrawObjectMV drawObject, int argb) { - colorARGB(drawObject.getBuffer(), argb); - return drawObject; - } - - public static DrawObjectMV colorRGB(DrawObjectMV drawObject, int rgb) { - colorRGB(drawObject.getBuffer(), rgb); - return drawObject; - } - - public static DrawObjectMV light(DrawObjectMV drawObject, int light) { - light(drawObject.getBuffer(), light); - return drawObject; - } - - public static DrawObjectMV overlay(DrawObjectMV drawObject, int overlay) { - overlay(drawObject.getBuffer(), overlay); - return drawObject; - } - - public static DrawObjectMV overlayDefaultUV(DrawObjectMV drawObject) { - overlayDefaultUV(drawObject.getBuffer()); - return drawObject; - } - - public static VertexConsumer texture(VertexConsumer vertexConsumer, float u, float v) { - return vertexConsumer.texture(u, v); - } - - public static VertexConsumer vertex(VertexConsumer vertexConsumer, Matrix4f matrix4f, float x, float y, float z) { - return vertexConsumer.vertex(matrix4f, x, y, z); - } - - public static VertexConsumer normal(VertexConsumer vertexConsumer, MatrixStack stack, float x, float y, float z) { - return vertexConsumer.normal(stack.peek(), x, y, z); - } - - public static VertexConsumer next(VertexConsumer vertexConsumer) { - return vertexConsumer; - } - - public static void renderQuad(VertexConsumer vertexConsumer, MatrixStack stack, Matrix4f matrix4f, Matrix3f matrix3f, - float x1, float y1, float z1, float x2, float y2, float z2, - float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { - - float[][] vertexes = new float[4][3]; - - if (Math.abs(normalY) > 0.5f) { - if (normalY > 0) { - vertexes = new float[][]{ - {x1, y1, z1}, - {x1, y1, z2}, - {x2, y1, z2}, - {x2, y1, z1} - }; - - } else { - vertexes = new float[][]{ - {x1, y1, z1}, - {x2, y1, z1}, - {x2, y1, z2}, - {x1, y1, z2} - }; - } - } else if (Math.abs(normalZ) > 0.5f) { - if (normalZ > 0) { - vertexes = new float[][]{ - {x1, y1, z1}, - {x2, y1, z1}, - {x2, y2, z1}, - {x1, y2, z1} - }; - } else { - vertexes = new float[][]{ - {x1, y1, z1}, - {x1, y2, z1}, - {x2, y2, z1}, - {x2, y1, z1} - }; - } - } else if (Math.abs(normalX) > 0.5f) { - if (normalX > 0) { - vertexes = new float[][]{ - {x1, y1, z1}, - {x1, y2, z1}, - {x1, y2, z2}, - {x1, y1, z2} - }; - } else { - vertexes = new float[][]{ - {x1, y1, z1}, - {x1, y1, z2}, - {x1, y2, z2}, - {x1, y2, z1} - }; - } - } - - for (float[] vertex : vertexes) { - if (vertex.length != 3) continue; - - vertex(vertexConsumer, matrix4f, vertex[0], vertex[1], vertex[2]); - color(vertexConsumer, r, g, b, alpha); - texture(vertexConsumer, u, v); - light(vertexConsumer, light); - normal(vertexConsumer, stack, normalX, normalY, normalZ); - next(vertexConsumer); - } - } - - public static void renderQuad(DrawObjectMV drawObject, Matrix4f matrix4f, Matrix3f matrix3f, - float x1, float y1, float z1, float x2, float y2, float z2, - float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { - renderQuad(drawObject.getBuffer(), drawObject.getStack(), matrix4f, matrix3f, - x1, y1, z1, x2, y2, z2, - normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); - - } - - public static void renderQuad(DrawObjectMV drawObject, - float x1, float y1, float z1, float x2, float y2, float z2, - float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { - - Matrix4f matrix4f = drawObject.getMatrix4f(); - Matrix3f matrix3f = drawObject.getMatrix3f(); - - renderQuad(drawObject.getBuffer(), drawObject.getStack(), matrix4f, matrix3f, - x1, y1, z1, x2, y2, z2, - normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); - - } -} - diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java deleted file mode 100644 index 8744b12e6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java +++ /dev/null @@ -1,114 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.render; - -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexRendering; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Box; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; -import org.joml.Matrix3f; -import org.joml.Matrix4f; - -import java.util.Optional; - -public class VertexRenderingUtil { - public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { - MatrixStack.Entry entry = matrices.peek(); - - drawLine(buffer, entry, minX, minY, minZ, maxX, minY, minZ, red, green, blue, alpha); - drawLine(buffer, entry, minX, minY, maxZ, maxX, minY, maxZ, red, green, blue, alpha); - drawLine(buffer, entry, minX, maxY, minZ, maxX, maxY, minZ, red, green, blue, alpha); - drawLine(buffer, entry, minX, maxY, maxZ, maxX, maxY, maxZ, red, green, blue, alpha); - - drawLine(buffer, entry, minX, minY, minZ, minX, maxY, minZ, red, green, blue, alpha); - drawLine(buffer, entry, maxX, minY, minZ, maxX, maxY, minZ, red, green, blue, alpha); - drawLine(buffer, entry, minX, minY, maxZ, minX, maxY, maxZ, red, green, blue, alpha); - drawLine(buffer, entry, maxX, minY, maxZ, maxX, maxY, maxZ, red, green, blue, alpha); - - drawLine(buffer, entry, minX, minY, minZ, minX, minY, maxZ, red, green, blue, alpha); - drawLine(buffer, entry, maxX, minY, minZ, maxX, minY, maxZ, red, green, blue, alpha); - drawLine(buffer, entry, minX, maxY, minZ, minX, maxY, maxZ, red, green, blue, alpha); - drawLine(buffer, entry, maxX, maxY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); - } - - public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha, float xAxisRed, float yAxisGreen, float zAxisBlue) { - MatrixStack.Entry entry = matrices.peek(); - - drawLine(buffer, entry, minX, minY, minZ, maxX, minY, minZ, xAxisRed, green, blue, alpha); - drawLine(buffer, entry, minX, minY, maxZ, maxX, minY, maxZ, xAxisRed, green, blue, alpha); - drawLine(buffer, entry, minX, maxY, minZ, maxX, maxY, minZ, xAxisRed, green, blue, alpha); - drawLine(buffer, entry, minX, maxY, maxZ, maxX, maxY, maxZ, xAxisRed, green, blue, alpha); - - drawLine(buffer, entry, minX, minY, minZ, minX, maxY, minZ, red, yAxisGreen, blue, alpha); - drawLine(buffer, entry, maxX, minY, minZ, maxX, maxY, minZ, red, yAxisGreen, blue, alpha); - drawLine(buffer, entry, minX, minY, maxZ, minX, maxY, maxZ, red, yAxisGreen, blue, alpha); - drawLine(buffer, entry, maxX, minY, maxZ, maxX, maxY, maxZ, red, yAxisGreen, blue, alpha); - - drawLine(buffer, entry, minX, minY, minZ, minX, minY, maxZ, red, green, zAxisBlue, alpha); - drawLine(buffer, entry, maxX, minY, minZ, maxX, minY, maxZ, red, green, zAxisBlue, alpha); - drawLine(buffer, entry, minX, maxY, minZ, minX, maxY, maxZ, red, green, zAxisBlue, alpha); - drawLine(buffer, entry, maxX, maxY, minZ, maxX, maxY, maxZ, red, green, zAxisBlue, alpha); - } - - public static void drawFilledBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { - MatrixStack.Entry entry = matrices.peek(); - Matrix4f positionMatrix = entry.getPositionMatrix(); - - drawQuad(buffer, positionMatrix, minX, minY, minZ, maxX, minY, minZ, maxX, minY, maxZ, minX, minY, maxZ, red, green, blue, alpha); - drawQuad(buffer, positionMatrix, minX, maxY, minZ, minX, maxY, maxZ, maxX, maxY, maxZ, maxX, maxY, minZ, red, green, blue, alpha); - drawQuad(buffer, positionMatrix, minX, minY, minZ, minX, maxY, minZ, maxX, maxY, minZ, maxX, minY, minZ, red, green, blue, alpha); - drawQuad(buffer, positionMatrix, minX, minY, maxZ, maxX, minY, maxZ, maxX, maxY, maxZ, minX, maxY, maxZ, red, green, blue, alpha); - drawQuad(buffer, positionMatrix, minX, minY, minZ, minX, minY, maxZ, minX, maxY, maxZ, minX, maxY, minZ, red, green, blue, alpha); - drawQuad(buffer, positionMatrix, maxX, minY, minZ, maxX, maxY, minZ, maxX, maxY, maxZ, maxX, minY, maxZ, red, green, blue, alpha); - } - - public static void drawBox(DrawObjectMV drawObject, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { - drawBox(drawObject.getStack(), drawObject.getBuffer(), minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); - } - - public static void drawBox(DrawObjectMV drawObject, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha, float xAxisRed, float yAxisGreen, float zAxisBlue) { - drawBox(drawObject.getStack(), drawObject.getBuffer(), minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha, xAxisRed, yAxisGreen, zAxisBlue); - } - - public static void drawFilledBox(DrawObjectMV drawObject, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { - drawFilledBox(drawObject.getStack(), drawObject.getBuffer(), minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); - } - - public static void renderQuad(VertexConsumer vertexConsumer, MatrixStack stack, Matrix4f matrix4f, Matrix3f matrix3f, float x1, float y1, float z1, float x2, float y2, float z2, float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { - VertexConsumerUtil.renderQuad(vertexConsumer, stack, matrix4f, matrix3f, x1, y1, z1, x2, y2, z2, normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); - } - - public static void renderQuad(DrawObjectMV drawObject, float x1, float y1, float z1, float x2, float y2, float z2, float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { - renderQuad(drawObject.getBuffer(), drawObject.getStack(), drawObject.getMatrix4f(), drawObject.getMatrix3f(), x1, y1, z1, x2, y2, z2, normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); - } - - // TODO: all version impl - private static void drawQuad(VertexConsumer buffer, Matrix4f matrix, double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, float red, float green, float blue, float alpha) { - VertexConsumerUtil.vertex(buffer, matrix, (float)x1, (float)y1, (float)z1).color(red, green, blue, alpha); - VertexConsumerUtil.vertex(buffer, matrix, (float)x2, (float)y2, (float)z2).color(red, green, blue, alpha); - VertexConsumerUtil.vertex(buffer, matrix, (float)x3, (float)y3, (float)z3).color(red, green, blue, alpha); - VertexConsumerUtil.vertex(buffer, matrix, (float)x4, (float)y4, (float)z4).color(red, green, blue, alpha); - } - - // TODO: all version impl - private static void drawLine(VertexConsumer consumer, MatrixStack.Entry entry, double x1, double y1, double z1, double x2, double y2, double z2, float red, float green, float blue, float alpha) { - float dx = (float)(x2 - x1); - float dy = (float)(y2 - y1); - float dz = (float)(z2 - z1); - float len = (float)Math.sqrt(dx * dx + dy * dy + dz * dz); - float nx = len == 0.0f ? 0.0f : dx / len; - float ny = len == 0.0f ? 1.0f : dy / len; - float nz = len == 0.0f ? 0.0f : dz / len; - - VertexConsumerUtil.vertex(consumer, entry.getPositionMatrix(), (float)x1, (float)y1, (float)z1); - VertexConsumerUtil.color(consumer, red, green, blue, alpha); - VertexConsumerUtil.normal(consumer, nx, ny, nz); - consumer.lineWidth(2.0f); // - VertexConsumerUtil.next(consumer); - - VertexConsumerUtil.vertex(consumer, entry.getPositionMatrix(), (float)x2, (float)y2, (float)z2); - VertexConsumerUtil.color(consumer, red, green, blue, alpha); - VertexConsumerUtil.normal(consumer, nx, ny, nz); - consumer.lineWidth(2.0f); // - VertexConsumerUtil.next(consumer); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java deleted file mode 100644 index 8160f8ba9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.render; - -import net.minecraft.client.render.WorldRenderer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class WorldRendererUtil { - public static int getLightmapCoordinates(World world, BlockPos pos) { - return WorldRenderer.getLightmapCoordinates(world, pos); - } - - public static int getLightmapCoordinates(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return getLightmapCoordinates(world.getRaw(), pos.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java deleted file mode 100644 index cc3313a48..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.v2; - -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class RenderUtil extends net.pitan76.mcpitanlib.api.util.client.RenderUtil { - public static void setShaderTexture(int texture, CompatIdentifier id) { - setShaderTexture(texture, id.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java deleted file mode 100644 index ac619fbdd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.v2; - -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.screen.Screen; - -public class ScreenUtil extends net.pitan76.mcpitanlib.api.util.client.ScreenUtil { - - public static void setFocus(Screen screen, boolean focus) { - screen.setFocused(focus); - } - - public static void setFocus(Screen screen, Element element) { - screen.setFocused(element); - } - - public static boolean isFocused(Screen screen) { - return screen.isFocused(); - } - - public static void setDragging(Screen screen, boolean dragging) { - screen.setDragging(dragging); - } - - public static boolean isDragging(Screen screen) { - return screen.isDragging(); - } - - public static int getWidth(Screen screen) { - return screen.width; - } - - public static int getHeight(Screen screen) { - return screen.height; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java deleted file mode 100644 index 7182eb723..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.widget; - -import net.minecraft.client.gui.widget.ClickableWidget; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; - -public class ClickableWidgetUtil { - public static void render(ClickableWidget widget, RenderArgs args) { - widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java deleted file mode 100644 index 78f8ec4af..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.client.widget; - -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.input.CharInput; -import net.minecraft.client.input.KeyInput; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -public class TextFieldUtil { - public static void setFocused(TextFieldWidget widget, boolean focused) { - widget.setFocused(focused); - } - - public static void render(TextFieldWidget widget, RenderArgs args) { - widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); - } - - public static void setEditable(TextFieldWidget widget, boolean editable) { - widget.setEditable(editable); - } - - public static void setMaxLength(TextFieldWidget widget, int maxLength) { - widget.setMaxLength(maxLength); - } - - public static void setSuggestion(TextFieldWidget widget, String suggestion) { - widget.setSuggestion(suggestion); - } - - public static void setText(TextFieldWidget widget, String text) { - widget.setText(text); - } - - public static String getText(TextFieldWidget widget) { - return widget.getText(); - } - - public static void setDrawsBackground(TextFieldWidget widget, boolean drawsBackground) { - widget.setDrawsBackground(drawsBackground); - } - - public static void setFocusUnlocked(TextFieldWidget widget, boolean focusUnlocked) { - widget.setFocusUnlocked(focusUnlocked); - } - - public static boolean isFocused(TextFieldWidget widget) { - return widget.isFocused(); - } - - public static boolean keyPressed(TextFieldWidget widget, int keyCode, int scanCode, int modifiers) { - return widget.keyPressed(new KeyInput(keyCode, scanCode, modifiers)); - } - - public static boolean keyReleased(TextFieldWidget widget, int keyCode, int scanCode, int modifiers) { - return widget.keyReleased(new KeyInput(keyCode, scanCode, modifiers)); - } - - public static boolean charTyped(TextFieldWidget widget, char chr, int modifiers) { - return widget.charTyped(new CharInput(chr, modifiers)); - } - - public static TextFieldWidget create(TextRenderer renderer, int x, int y, int width, int height, Text text) { - return new TextFieldWidget(renderer, x, y, width, height, text); - } - - public static TextFieldWidget create(TextRenderer renderer, int width, int height, Text text) { - return new TextFieldWidget(renderer, width, height, text); - } - - public static TextFieldWidget create(TextRenderer renderer, int x, int y, int width, int height) { - return new TextFieldWidget(renderer, x, y, width, height, TextUtil.empty()); - } - - public static TextFieldWidget create(TextRenderer renderer, int width, int height) { - return new TextFieldWidget(renderer, width, height, TextUtil.empty()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java deleted file mode 100644 index 432caf05f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.collection; - -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.util.inventory.ClippedInventory; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import org.jetbrains.annotations.NotNull; - -public class ClippedItemStackList extends ItemStackList { - - public final ItemStackList list; - public final int start; - public final int end; - - public ClippedItemStackList(ItemStackList list, int start, int end) { - super(null, null); - this.list = list; - if (start < 0 || end > list.size() || start >= end) { - throw new IllegalArgumentException("Invalid start or end indices for clipping item stack list."); - } - this.start = start; - this.end = end; - } - - public static ClippedItemStackList of(ItemStackList list, int start, int end) { - return new ClippedItemStackList(list, start, end); - } - - public static ClippedItemStackList of(ItemStackList list) { - return of(list, 0, list.size()); - } - - public static ClippedItemStackList of(ItemStackList list, int start) { - return of(list, start, list.size()); - } - - @Override - public int size() { - return end - start; - } - - @Override - public Inventory toInventory() { - return ClippedInventory.of(list.toInventory(), start, end); - } - - @Override - public DefaultedList defaultedList() { - DefaultedList clippedList = DefaultedList.ofSize(size(), ItemStackUtil.empty()); - for (int i = 0; i < size(); i++) - clippedList.set(i, get(i)); - - return clippedList; - } - - @Override - public @NotNull ItemStack get(int index) { - return list.get(start + index); - } - - @Override - public ItemStack set(int index, ItemStack element) { - return list.set(start + index, element); - } - - @Override - public ItemStack remove(int index) { - return list.remove(start + index); - } - - @Override - public boolean contains(Object o) { - for (int i = start; i < end; i++) { - if (list.get(i).equals(o)) { - return true; - } - } - return false; - } - - @Override - public boolean isEmpty() { - for (int i = start; i < end; i++) { - if (!list.get(i).isEmpty()) { - return false; - } - } - return true; - } - - @Override - public void clear() { - for (int i = start; i < end; i++) { - list.set(i, ItemStackUtil.empty()); - } - } - - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java deleted file mode 100644 index 5db1133ae..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.collection; - -import net.minecraft.util.collection.DefaultedList; - -public class DefaultedListUtil { - - public static DefaultedList of() { - return DefaultedList.of(); - } - - public static DefaultedList ofSize(int size, E defaultElement) { - return DefaultedList.ofSize(size, defaultElement); - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java deleted file mode 100644 index 3bf041152..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java +++ /dev/null @@ -1,214 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.collection; - -import com.google.common.collect.Lists; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import org.apache.commons.lang3.Validate; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class ItemStackList extends DefaultedList { - - public ItemStackList(List delegate, @Nullable ItemStack initialElement) { - super(delegate, initialElement); - } - - public static ItemStackList of() { - return new ItemStackList(Lists.newArrayList(), ItemStackUtil.empty()); - } - - public static ItemStackList ofSize(int size) { - return ofSize(size, ItemStackUtil.empty()); - } - - public static ItemStackList ofSize(int size, ItemStack defaultStack) { - Validate.notNull(defaultStack); - ItemStack[] objects = new ItemStack[size]; - Arrays.fill(objects, defaultStack); - return new ItemStackList(Arrays.asList(objects), defaultStack); - } - - public static ItemStackList copyOf(ItemStack defaultStack, ItemStack... stacks) { - return new ItemStackList(Arrays.asList(stacks), defaultStack); - } - - public static Inventory toInventory(DefaultedList list) { - return IInventory.of(list); - } - - public static DefaultedList toDefaultedList(Inventory inventory) { - DefaultedList list = DefaultedList.ofSize(inventory.size(), ItemStackUtil.empty()); - for (int i = 0; i < inventory.size(); i++) { - list.set(i, inventory.getStack(i)); - } - - return list; - } - - public static ItemStackList fromInventory(Inventory inventory) { - return new ItemStackList(toDefaultedList(inventory), ItemStackUtil.empty()); - } - - public Inventory toInventory() { - return toInventory(this); - } - - public DefaultedList defaultedList() { - return this; - } - - public static ItemStackList of(DefaultedList defaultedList) { - ItemStackList stacks = ItemStackList.ofSize(defaultedList.size()); - for (int i = 0; i < defaultedList.size(); i++) { - stacks.set(i , defaultedList.get(i)); - } - - return stacks; - } - - public static ItemStackList of(ItemStack stack) { - return ItemStackList.ofSize(1, stack); - } - - // Midohra - public List toMidohra() { - List stacks = new ArrayList<>(); - for (ItemStack stack : this) { - stacks.add(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack)); - } - - return stacks; - } - - public @NotNull net.pitan76.mcpitanlib.midohra.item.ItemStack getAsMidohra(int index) { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(get(index)); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getFirstAsMidohra() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getFirst()); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getLastAsMidohra() { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getLast()); - } - - public boolean add(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return add(stack.toMinecraft()); - } - - public boolean addAll(List stacks) { - boolean changed = false; - for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { - changed |= add(stack); - } - - return changed; - } - - public boolean addAll(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { - return addAll(Arrays.asList(stacks)); - } - - public boolean remove(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return remove(stack.toMinecraft()); - } - - public boolean removeAll(List stacks) { - boolean changed = false; - for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { - changed |= remove(stack); - } - - return changed; - } - - public boolean removeAll(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { - return removeAll(Arrays.asList(stacks)); - } - - public boolean contains(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return contains(stack.toMinecraft()); - } - - public boolean containsAll(List stacks) { - for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { - if (!contains(stack)) { - return false; - } - } - - return true; - } - - public boolean containsAll(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { - return containsAll(Arrays.asList(stacks)); - } - - public boolean containsAny(List stacks) { - for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { - if (contains(stack)) { - return true; - } - } - - return false; - } - - public boolean containsAny(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { - return containsAny(Arrays.asList(stacks)); - } - - public boolean equals(List stacks) { - if (size() != stacks.size()) { - return false; - } - - for (int i = 0; i < size(); i++) { - if (!get(i).equals(stacks.get(i).toMinecraft())) { - return false; - } - } - - return true; - } - - public boolean equals(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { - return equals(Arrays.asList(stacks)); - } - - public static ItemStackList of(List stacks) { - ItemStackList list = ItemStackList.ofSize(stacks.size()); - for (int i = 0; i < stacks.size(); i++) { - list.set(i, stacks.get(i).toMinecraft()); - } - - return list; - } - - public static ItemStackList of(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { - return ItemStackList.of(Arrays.asList(stacks)); - } - - public static ItemStackList of(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return of(stack, 1); - } - - public static ItemStackList of(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, int size) { - return ItemStackList.ofSize(size, stack.toMinecraft()); - } - - public static ItemStackList of2(List stacks) { - ItemStackList list = ItemStackList.ofSize(stacks.size()); - for (int i = 0; i < stacks.size(); i++) - list.set(i, stacks.get(i)); - - return list; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java deleted file mode 100644 index bb113ce46..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.color; - -import net.minecraft.block.MapColor; - -public class CompatBrightness { - private final MapColor.Brightness brightness; - - public static final CompatBrightness LOW = of(MapColor.Brightness.LOW); - public static final CompatBrightness NORMAL = of(MapColor.Brightness.NORMAL); - public static final CompatBrightness HIGH = of(MapColor.Brightness.HIGH); - public static final CompatBrightness LOWEST = of(MapColor.Brightness.LOWEST); - - public CompatBrightness(MapColor.Brightness brightness) { - this.brightness = brightness; - } - - public static CompatBrightness of(MapColor.Brightness brightness) { - return new CompatBrightness(brightness); - } - - public MapColor.Brightness get() { - return brightness; - } - - public String getName() { - return get().name(); - } - - public int getId() { - return get().id; - } - - public int getBrightness() { - return get().brightness; - } - - - - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java deleted file mode 100644 index e6e397126..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.color; - -import net.minecraft.util.DyeColor; -import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; - -public class CompatDyeColor implements CompatStringIdentifiable { - private final DyeColor color; - - public static final CompatDyeColor WHITE = of(DyeColor.WHITE); - public static final CompatDyeColor ORANGE = of(DyeColor.ORANGE); - public static final CompatDyeColor MAGENTA = of(DyeColor.MAGENTA); - public static final CompatDyeColor LIGHT_BLUE = of(DyeColor.LIGHT_BLUE); - public static final CompatDyeColor YELLOW = of(DyeColor.YELLOW); - public static final CompatDyeColor LIME = of(DyeColor.LIME); - public static final CompatDyeColor PINK = of(DyeColor.PINK); - public static final CompatDyeColor GRAY = of(DyeColor.GRAY); - public static final CompatDyeColor LIGHT_GRAY = of(DyeColor.LIGHT_GRAY); - public static final CompatDyeColor CYAN = of(DyeColor.CYAN); - public static final CompatDyeColor PURPLE = of(DyeColor.PURPLE); - public static final CompatDyeColor BLUE = of(DyeColor.BLUE); - public static final CompatDyeColor BROWN = of(DyeColor.BROWN); - public static final CompatDyeColor GREEN = of(DyeColor.GREEN); - public static final CompatDyeColor RED = of(DyeColor.RED); - public static final CompatDyeColor BLACK = of(DyeColor.BLACK); - - public CompatDyeColor(DyeColor color) { - this.color = color; - } - - public static CompatDyeColor of(DyeColor color) { - return new CompatDyeColor(color); - } - - public DyeColor getColor() { - return color; - } - - public String getName() { - return color.name(); - } - - @Override - public String asString_compat() { - return getName(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java deleted file mode 100644 index 08c7084cc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java +++ /dev/null @@ -1,94 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.color; - -import net.minecraft.block.MapColor; - -public class CompatMapColor { - private final MapColor color; - - public static final CompatMapColor CLEAR = of(MapColor.CLEAR); - public static final CompatMapColor PALE_GREEN = of(MapColor.PALE_GREEN); - public static final CompatMapColor PALE_YELLOW = of(MapColor.PALE_YELLOW); - public static final CompatMapColor WHITE_GRAY = of(MapColor.WHITE_GRAY); - public static final CompatMapColor BRIGHT_RED = of(MapColor.BRIGHT_RED); - public static final CompatMapColor PALE_PURPLE = of(MapColor.PALE_PURPLE); - public static final CompatMapColor IRON_GRAY = of(MapColor.IRON_GRAY); - public static final CompatMapColor DARK_GREEN = of(MapColor.DARK_GREEN); - public static final CompatMapColor WHITE = of(MapColor.WHITE); - public static final CompatMapColor LIGHT_BLUE_GRAY = of(MapColor.LIGHT_BLUE_GRAY); - public static final CompatMapColor DIRT_BROWN = of(MapColor.DIRT_BROWN); - public static final CompatMapColor STONE_GRAY = of(MapColor.STONE_GRAY); - public static final CompatMapColor WATER_BLUE = of(MapColor.WATER_BLUE); - public static final CompatMapColor OAK_TAN = of(MapColor.OAK_TAN); - public static final CompatMapColor OFF_WHITE = of(MapColor.OFF_WHITE); - public static final CompatMapColor ORANGE = of(MapColor.ORANGE); - public static final CompatMapColor MAGENTA = of(MapColor.MAGENTA); - public static final CompatMapColor LIGHT_BLUE = of(MapColor.LIGHT_BLUE); - public static final CompatMapColor YELLOW = of(MapColor.YELLOW); - public static final CompatMapColor LIME = of(MapColor.LIME); - public static final CompatMapColor PINK = of(MapColor.PINK); - public static final CompatMapColor GRAY = of(MapColor.GRAY); - public static final CompatMapColor LIGHT_GRAY = of(MapColor.LIGHT_GRAY); - public static final CompatMapColor CYAN = of(MapColor.CYAN); - public static final CompatMapColor PURPLE = of(MapColor.PURPLE); - public static final CompatMapColor BLUE = of(MapColor.BLUE); - public static final CompatMapColor BROWN = of(MapColor.BROWN); - public static final CompatMapColor GREEN = of(MapColor.GREEN); - public static final CompatMapColor RED = of(MapColor.RED); - public static final CompatMapColor BLACK = of(MapColor.BLACK); - public static final CompatMapColor GOLD = of(MapColor.GOLD); - public static final CompatMapColor DIAMOND_BLUE = of(MapColor.DIAMOND_BLUE); - public static final CompatMapColor LAPIS_BLUE = of(MapColor.LAPIS_BLUE); - public static final CompatMapColor EMERALD_GREEN = of(MapColor.EMERALD_GREEN); - public static final CompatMapColor SPRUCE_BROWN = of(MapColor.SPRUCE_BROWN); - public static final CompatMapColor DARK_RED = of(MapColor.DARK_RED); - public static final CompatMapColor TERRACOTTA_WHITE = of(MapColor.TERRACOTTA_WHITE); - public static final CompatMapColor TERRACOTTA_ORANGE = of(MapColor.TERRACOTTA_ORANGE); - public static final CompatMapColor TERRACOTTA_MAGENTA = of(MapColor.TERRACOTTA_MAGENTA); - public static final CompatMapColor TERRACOTTA_LIGHT_BLUE = of(MapColor.TERRACOTTA_LIGHT_BLUE); - public static final CompatMapColor TERRACOTTA_YELLOW = of(MapColor.TERRACOTTA_YELLOW); - public static final CompatMapColor TERRACOTTA_LIME = of(MapColor.TERRACOTTA_LIME); - public static final CompatMapColor TERRACOTTA_PINK = of(MapColor.TERRACOTTA_PINK); - public static final CompatMapColor TERRACOTTA_GRAY = of(MapColor.TERRACOTTA_GRAY); - public static final CompatMapColor TERRACOTTA_LIGHT_GRAY = of(MapColor.TERRACOTTA_LIGHT_GRAY); - public static final CompatMapColor TERRACOTTA_CYAN = of(MapColor.TERRACOTTA_CYAN); - public static final CompatMapColor TERRACOTTA_PURPLE = of(MapColor.TERRACOTTA_PURPLE); - public static final CompatMapColor TERRACOTTA_BLUE = of(MapColor.TERRACOTTA_BLUE); - public static final CompatMapColor TERRACOTTA_BROWN = of(MapColor.TERRACOTTA_BROWN); - public static final CompatMapColor TERRACOTTA_GREEN = of(MapColor.TERRACOTTA_GREEN); - public static final CompatMapColor TERRACOTTA_RED = of(MapColor.TERRACOTTA_RED); - public static final CompatMapColor TERRACOTTA_BLACK = of(MapColor.TERRACOTTA_BLACK); - public static final CompatMapColor DULL_RED = of(MapColor.DULL_RED); - public static final CompatMapColor DULL_PINK = of(MapColor.DULL_PINK); - public static final CompatMapColor DARK_CRIMSON = of(MapColor.DARK_CRIMSON); - public static final CompatMapColor TEAL = of(MapColor.TEAL); - public static final CompatMapColor DARK_AQUA = of(MapColor.DARK_AQUA); - public static final CompatMapColor DARK_DULL_PINK = of(MapColor.DARK_DULL_PINK); - public static final CompatMapColor BRIGHT_TEAL = of(MapColor.BRIGHT_TEAL); - public static final CompatMapColor DEEPSLATE_GRAY = of(MapColor.DEEPSLATE_GRAY); - public static final CompatMapColor RAW_IRON_PINK = of(MapColor.RAW_IRON_PINK); - public static final CompatMapColor LICHEN_GREEN = of(MapColor.LICHEN_GREEN); - - public CompatMapColor(MapColor color) { - this.color = color; - } - - public static CompatMapColor of(MapColor color) { - return new CompatMapColor(color); - } - - public MapColor getColor() { - return color; - } - - public int getId() { - return color.id; - } - - public int getRgb() { - return color.color; - } - - public int getRenderColor(CompatBrightness brightness) { - return color.getRenderColor(brightness.get()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java deleted file mode 100644 index 2fb569972..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.debug; - -import net.minecraft.inventory.Inventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.util.ItemUtil; -import net.pitan76.mcpitanlib.api.util.PlatformUtil; - -public class OutputUtil { - - public static boolean dev = PlatformUtil.isDevelopmentEnvironment(); - - public static void print(Item item) { - if (!dev) return; - System.out.println(getString(item)); - } - - public static void print(ItemStack stack) { - if (!dev) return; - System.out.println(getString(stack)); - } - - public static void print(Inventory inventory) { - if (!dev) return; - System.out.println(getString(inventory)); - } - - public static String getString(Item item) { - StringBuilder sb = new StringBuilder(); - sb.append("Item: {").append("\n"); - - sb.append(" Name: ").append(item.getTranslationKey()).append("\n"); - sb.append(" Id: ").append(ItemUtil.toCompatID(item)).append("\n"); - sb.append("}\n"); - - return sb.toString(); - } - - public static String getString(ItemStack stack) { - Item item = stack.getItem(); - - StringBuilder sb = new StringBuilder(); - sb.append("ItemStack: {").append("\n"); - - sb.append(getString(item)); - sb.append(" Count: ").append(stack.getCount()).append("\n"); - sb.append("}\n"); - - return sb.toString(); - } - - public static String getString(Inventory inventory) { - StringBuilder sb = new StringBuilder(); - sb.append("Inventory: {").append("\n"); - - for (int i = 0; i < inventory.size(); i++) { - ItemStack stack = inventory.getStack(i); - if (stack.isEmpty()) continue; - - sb.append(" Slot ").append(i).append(": {").append("\n"); - sb.append(getString(stack)); - sb.append(" }\n"); - } - - sb.append("}\n"); - - return sb.toString(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java deleted file mode 100644 index e12d3910f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.projectile.ArrowEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import org.jetbrains.annotations.Nullable; - -public class ArrowEntityUtil { - public static ArrowEntity create(World world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { - return new ArrowEntity(world, x, y, z, stack, shotFrom); - } - - public static ArrowEntity create(World world, double x, double y, double z, ItemStack stack) { - return create(world, x, y, z, stack, null); - } - - public static ArrowEntity create(World world, double x, double y, double z) { - return create(world, x, y, z, ItemStackUtil.getDefaultStack(Items.ARROW)); - } - - public static void setVelocity(ArrowEntity arrow, double x, double y, double z, float velocity, float divergence) { - arrow.setVelocity(x, y, z, velocity, divergence); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java deleted file mode 100644 index dec1f836b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.EquipmentSlot; -import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; - -public class EquipmentSlotUtil { - public static boolean isArmor(EquipmentSlot slot) { - return slot == EquipmentSlot.HEAD || slot == EquipmentSlot.CHEST || slot == EquipmentSlot.LEGS || slot == EquipmentSlot.FEET; - } - - public static boolean isMainHand(EquipmentSlot slot) { - return slot == EquipmentSlot.MAINHAND; - } - - public static boolean isOffHand(EquipmentSlot slot) { - return slot == EquipmentSlot.OFFHAND; - } - - public static boolean isWeapon(EquipmentSlot slot) { - return slot == EquipmentSlot.MAINHAND || slot == EquipmentSlot.OFFHAND; - } - - public static int getEntitySlotId(EquipmentSlot slot) { - if (slot == null) - return 0; - - return slot.getEntitySlotId(); - } - - public static EquipmentSlot fromEntitySlotId(int id) { - for (EquipmentSlot slot : EquipmentSlot.values()) { - if (slot.getEntitySlotId() == id) { - return slot; - } - } - return EquipmentSlot.MAINHAND; - } - - public static ArmorEquipmentType getArmorEquipmentType(EquipmentSlot slot) { - switch (slot) { - case HEAD: - return ArmorEquipmentType.HEAD; - case CHEST: - return ArmorEquipmentType.CHEST; - case LEGS: - return ArmorEquipmentType.LEGS; - case FEET: - return ArmorEquipmentType.FEET; - case BODY: - return ArmorEquipmentType.BODY; - default: - return null; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java deleted file mode 100644 index 5686c1bee..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java +++ /dev/null @@ -1,118 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.EntityType; -import net.minecraft.entity.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3i; - -import java.util.List; - -public class ItemEntityUtil { - public static ItemEntity create(World world, double x, double y, double z, ItemStack stack) { - return new ItemEntity(world, x, y, z, stack); - } - - public static ItemEntity create(World world, BlockPos pos, ItemStack stack) { - return create(world, pos.getX(), pos.getY(), pos.getZ(), stack); - } - - public static ItemEntity create(World world, Vec3d pos, ItemStack stack) { - return create(world, pos.x, pos.y, pos.z, stack); - } - - public static ItemEntity create(World world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) { - ItemEntity itemEntity = create(world, x, y, z, stack); - setVelocity(itemEntity, velocityX, velocityY, velocityZ); - return itemEntity; - } - - public static void setVelocity(ItemEntity itemEntity, double velocityX, double velocityY, double velocityZ) { - itemEntity.setVelocity(velocityX, velocityY, velocityZ); - } - - public static void setVelocity(ItemEntity itemEntity, Vec3d vec3d) { - itemEntity.setVelocity(vec3d); - } - - public static void setPickupDelay(ItemEntity itemEntity, int pickupDelay) { - itemEntity.setPickupDelay(pickupDelay); - } - - public static void setToDefaultPickupDelay(ItemEntity itemEntity) { - itemEntity.setToDefaultPickupDelay(); - } - - public static ItemStack getStack(ItemEntity entity) { - return entity.getStack(); - } - - public static List getEntities(World world, Box box) { - return WorldUtil.getEntitiesByType(world, EntityType.ITEM, box); - } - - public static ItemEntity createWithSpawn(World world, ItemStack stack, double x, double y, double z) { - ItemEntity itemEntity = create(world, x, y, z, stack); - setToDefaultPickupDelay(itemEntity); - setVelocity(itemEntity, 0.0D, 0.0D, 0.0D); - WorldUtil.spawnEntity(world, itemEntity); - return itemEntity; - } - - public static ItemEntity createWithSpawn(World world, ItemStack stack, BlockPos pos) { - return createWithSpawn(world, stack, pos.getX(), pos.getY(), pos.getZ()); - } - - public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3d pos) { - return createWithSpawn(world, stack, pos.x, pos.y, pos.z); - } - - public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3i pos) { - return createWithSpawn(world, stack, pos.toCenter()); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, double x, double y, double z) { - return createWithSpawn(world.getRaw(), stack, x, y, z); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, BlockPos pos) { - return createWithSpawn(world, stack, pos.getX(), pos.getY(), pos.getZ()); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, Vector3i pos) { - return createWithSpawn(world, stack, pos.toCenter()); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3d pos) { - return createWithSpawn(world.getRaw(), stack, pos.x, pos.y, pos.z); - } - - public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return createWithSpawn(world, stack, pos.toCenterVector3d()); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, double x, double y, double z) { - return createWithSpawn(world.getRaw(), stack.toMinecraft(), x, y, z); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return createWithSpawn(world.getRaw(), stack.toMinecraft(), pos.toRaw()); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3d pos) { - return createWithSpawn(world.getRaw(), stack.toMinecraft(), pos.x, pos.y, pos.z); - } - - public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return createWithSpawn(world, stack, pos.toCenterVector3d()); - } - - public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3i pos) { - return createWithSpawn(world, stack, pos.toCenter()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java deleted file mode 100644 index 9e74fc58f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; -import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; -import net.pitan76.mcpitanlib.api.util.EntityUtil; - -import java.util.ArrayList; -import java.util.List; - -public class LivingEntityUtil extends EntityUtil { - public static void addStatusEffect(LivingEntity entity, CompatStatusEffectInstance effect) { - entity.addStatusEffect(effect.getInstance()); - } - - public static void removeStatusEffect(LivingEntity entity, CompatStatusEffectInstance effect) { - entity.removeStatusEffect(effect.getInstance().getEffectType()); - } - - public static void removeStatusEffect(LivingEntity entity, CompatStatusEffect effect, World world) { - entity.removeStatusEffect(effect.getEntry(world)); - } - - public static List getStatusEffects(LivingEntity entity) { - List compatEffects = new ArrayList<>(); - - for (StatusEffectInstance effect : entity.getStatusEffects()) { - compatEffects.add(new CompatStatusEffectInstance(effect)); - } - - return compatEffects; - } - - public static float getHealth(LivingEntity entity) { - return entity.getHealth(); - } - - public static void setHealth(LivingEntity entity, float health) { - entity.setHealth(health); - } - - public static float getMaxHealth(LivingEntity entity) { - return entity.getMaxHealth(); - } - - public static ItemStack getEquippedStack(LivingEntity entity, EquipmentSlot slot) { - return entity.getEquippedStack(slot); - } - - public static void setEquippedStack(LivingEntity entity, EquipmentSlot slot, ItemStack stack) { - entity.equipStack(slot, stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java deleted file mode 100644 index 806215177..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.projectile.ProjectileEntity; - -public class ProjectileEntityUtil { - public static void setVelocity(ProjectileEntity projectileEntity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { - projectileEntity.setVelocity(shooter, pitch, yaw, roll, speed, divergence); - } - - public static void setVelocity(ProjectileEntity projectileEntity, double x, double y, double z, float power, float uncertainty) { - projectileEntity.setVelocity(x, y, z, power, uncertainty); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java deleted file mode 100644 index 1f4a155dc..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; - -import java.util.Collections; -import java.util.Optional; - -public class ServerPlayerUtil { - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - return serverPlayerEntity.teleport(serverWorld, x, y, z, Collections.emptySet(), yaw, pitch, resetCamera); - } - - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { - return teleport(serverPlayerEntity, serverWorld, x, y, z, yaw, pitch, true); - } - - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z) { - return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYaw(), serverPlayerEntity.getPitch()); - } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - return teleport(serverPlayerEntity, serverWorld.getRaw(), x, y, z, yaw, pitch, resetCamera); - } - - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { - return teleport(serverPlayerEntity, serverWorld, x, y, z, yaw, pitch, false); - } - - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z) { - return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYaw(), serverPlayerEntity.getPitch()); - } - - public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - Optional optionalServerPlayer = player.getServerPlayer(); - if (!optionalServerPlayer.isPresent()) return false; - - return teleport(optionalServerPlayer.get(), serverWorld, x, y, z, yaw, pitch, resetCamera); - } - - public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { - return teleport(player, serverWorld, x, y, z, yaw, pitch, false); - } - - public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z) { - return teleport(player, serverWorld, x, y, z, player.getYaw(), player.getPitch()); - } - - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, double x, double y, double z, boolean particleEffects) { - return serverPlayerEntity.teleport(x, y, z, particleEffects); - } - - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, double x, double y, double z) { - return teleport(serverPlayerEntity, x, y, z, false); - } - - public static boolean teleport(Player player, double x, double y, double z, boolean particleEffects) { - Optional optionalServerPlayer = player.getServerPlayer(); - if (!optionalServerPlayer.isPresent()) return false; - - return teleport(optionalServerPlayer.get(), x, y, z, particleEffects); - } - - public static boolean teleport(Player player, double x, double y, double z) { - return teleport(player, x, y, z, false); - } - - public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { - playSound(serverPlayerEntity, soundEvent, volume, pitch); - } - - public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent, float volume, float pitch) { - serverPlayerEntity.playSound(soundEvent.get(), volume, pitch); - } - - public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent) { - serverPlayerEntity.playSound(soundEvent.get()); - } - - public static void playSound(Player player, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { - Optional optionalServerPlayer = player.getServerPlayer(); - if (!optionalServerPlayer.isPresent()) return; - - playSound(optionalServerPlayer.get(), soundEvent, category, volume, pitch); - } - - public static void playSound(Player player, CompatSoundEvent soundEvent, float volume, float pitch) { - Optional optionalServerPlayer = player.getServerPlayer(); - if (!optionalServerPlayer.isPresent()) return; - - playSound(optionalServerPlayer.get(), soundEvent, volume, pitch); - } - - public static void playSound(Player player, CompatSoundEvent soundEvent) { - Optional optionalServerPlayer = player.getServerPlayer(); - if (!optionalServerPlayer.isPresent()) return; - - playSound(optionalServerPlayer.get(), soundEvent); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java deleted file mode 100644 index 38f484a37..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.projectile.SmallFireballEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; - -public class SmallFireballEntityUtil { - public static SmallFireballEntity create(World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - return new SmallFireballEntity(world, x, y, z, Vec3dUtil.create(velocityX, velocityY, velocityZ)); - } - - public static SmallFireballEntity create(World world, double x, double y, double z, Vec3d velocity) { - return new SmallFireballEntity(world, x, y, z, velocity); - } - - public static void setVelocity(SmallFireballEntity entity, double x, double y, double z, float velocity, float divergence) { - entity.setVelocity(x, y, z, velocity, divergence); - } - - public static void setItem(SmallFireballEntity entity, ItemStack stack) { - entity.setItem(stack); - } - - public static ItemStack getItem(SmallFireballEntity entity) { - return entity.getStack(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java deleted file mode 100644 index 9d5fd3085..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.projectile.thrown.SnowballEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -public class SnowballEntityUtil { - public static SnowballEntity create(World world, double x, double y, double z) { - return new SnowballEntity(world, x, y, z, ItemStackUtil.empty()); - } - - public static SnowballEntity create(World world, double x, double y, double z, ItemStack stack) { - return new SnowballEntity(world, x, y, z, stack); - } - - public static void setVelocity(SnowballEntity entity, double x, double y, double z, float velocity, float divergence) { - entity.setVelocity(x, y, z, velocity, divergence); - } - - public static void setItem(SnowballEntity entity, ItemStack stack) { - entity.setItem(stack); - } - - public static ItemStack getItem(SnowballEntity entity) { - return entity.getStack(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java deleted file mode 100644 index 2f83e9548..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.projectile.SpectralArrowEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import org.jetbrains.annotations.Nullable; - -public class SpectralArrowEntityUtil { - public static SpectralArrowEntity create(World world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { - return new SpectralArrowEntity(world, x, y, z, stack, shotFrom); - } - - public static SpectralArrowEntity create(World world, double x, double y, double z, ItemStack stack) { - return create(world, x, y, z, stack, null); - } - - public static SpectralArrowEntity create(World world, double x, double y, double z) { - return create(world, x, y, z, ItemStackUtil.getDefaultStack(Items.ARROW)); - } - - public static void setVelocity(SpectralArrowEntity arrow, double x, double y, double z, float velocity, float divergence) { - arrow.setVelocity(x, y, z, velocity, divergence); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java deleted file mode 100644 index 73dfb6cc4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.entity; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.projectile.thrown.ThrownItemEntity; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.entity.CompatThrownItemEntity; - -public class ThrownItemEntityUtil { - public static ItemStack getItem(ThrownItemEntity entity) { - return entity.getStack(); - } - - public static void setItem(ThrownItemEntity entity, ItemStack stack) { - entity.setItem(stack); - } - - public static ItemStack getStack(ThrownItemEntity entity) { - return entity.getStack(); - } - - public static void setVelocity(ThrownItemEntity entity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { - ProjectileEntityUtil.setVelocity(entity, shooter, pitch, yaw, roll, speed, divergence); - } - - public static void setVelocity(CompatThrownItemEntity entity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { - ProjectileEntityUtil.setVelocity(entity, shooter, pitch, yaw, roll, speed, divergence); - } - - public static void setVelocity(ThrownItemEntity entity, double x, double y, double z, float power, float uncertainty) { - ProjectileEntityUtil.setVelocity(entity, x, y, z, power, uncertainty); - } - - public static void setVelocity(CompatThrownItemEntity entity, double x, double y, double z, float power, float uncertainty) { - ProjectileEntityUtil.setVelocity(entity, x, y, z, power, uncertainty); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java deleted file mode 100644 index f721d32a5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.event; - -import net.minecraft.block.Block; -import net.pitan76.mcpitanlib.api.event.block.BlockBreakEvent; -import net.pitan76.mcpitanlib.api.event.block.BlockPlacedEvent; -import net.pitan76.mcpitanlib.api.event.block.ItemScattererUtil; -import net.pitan76.mcpitanlib.api.event.block.StateReplacedEvent; - -public class BlockEventGenerator { - public static void onPlaced(Block block, BlockPlacedEvent e) { - block.onPlaced(e.world, e.pos, e.state, e.placer, e.stack); - } - - public static void onBreak(Block block, BlockBreakEvent e) { - block.onBreak(e.world, e.pos, e.state, e.getPlayerEntity()); - } - - public static void onStateReplaced(Block block, StateReplacedEvent e) { - ItemScattererUtil.onStateReplaced(e); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java deleted file mode 100644 index 8983bd5d4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.event; - -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; - -public class ItemEventGenerator { - public static CompatActionResult onRightClick(Item item, ItemUseEvent e) { - return CompatActionResult.create(item.use(e.world, e.user.getPlayerEntity(), e.hand)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java deleted file mode 100644 index 49bcbc196..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java +++ /dev/null @@ -1,91 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.inventory; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -public class ClippedInventory implements Inventory, ICompatInventory { - - private final Inventory inventory; - private final int start; - private final int end; - - public static ClippedInventory of(Inventory inventory, int start, int end) { - if (start < 0 || end > inventory.size() || start >= end) { - throw new IllegalArgumentException("Invalid start or end indices for clipping inventory."); - } - return new ClippedInventory(inventory, start, end); - } - - public static ClippedInventory of(Inventory inventory) { - return of(inventory, 0, inventory.size()); - } - - public static ClippedInventory of(Inventory inventory, int start) { - return of(inventory, start, inventory.size()); - } - - public ClippedInventory(Inventory inventory, int start, int end) { - this.inventory = inventory; - this.start = start; - this.end = end; - } - - @Override - public int size() { - return end - start; - } - - @Override - public boolean isEmpty() { - for (int i = start; i < end; i++) { - if (!inventory.getStack(i).isEmpty()) { - return false; - } - } - return true; - } - - @Override - public ItemStack getStack(int slot) { - return inventory.getStack(start + slot); - } - - @Override - public ItemStack removeStack(int slot, int amount) { - return inventory.removeStack(start + slot, amount); - } - - @Override - public ItemStack removeStack(int slot) { - return inventory.removeStack(start + slot); - } - - @Override - public void setStack(int slot, ItemStack stack) { - inventory.setStack(start + slot, stack); - } - - @Override - public void markDirty() { - inventory.markDirty(); - } - - @Override - public boolean canPlayerUse(PlayerEntity player) { - return inventory.canPlayerUse(player); - } - - @Override - public void clear() { - for (int i = start; i < end; i++) { - inventory.setStack(i, ItemStackUtil.empty()); - } - } - - @Override - public int getMaxCountPerStack() { - return inventory.getMaxCountPerStack(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java deleted file mode 100644 index 6fc2623d0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java +++ /dev/null @@ -1,229 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.inventory; - -import net.minecraft.entity.ContainerUser; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.entity.CompatContainerUser; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.NbtUtil; -import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; -import net.pitan76.mcpitanlib.api.util.inventory.args.CanInsertArgs; -import net.pitan76.mcpitanlib.midohra.nbt.NbtList; - -import java.util.List; - -public class CompatInventory extends SimpleInventory { - public CompatInventory(int size) { - super(size); - } - - @Override - public void setStack(int slot, ItemStack stack) { - super.setStack(slot, stack); - } - - /** - * super method of setStack(slot, stack) - */ - public final void superSetStack(int slot, ItemStack stack) { - super.setStack(slot, stack); - } - - /** - * super method of removeStack(slot, amount) - */ - public final ItemStack superRemoveStack(int slot, int amount) { - return super.removeStack(slot, amount); - } - - @Override - public ItemStack removeStack(int slot, int amount) { - return callRemoveStack(slot, amount); - } - - public ItemStack callRemoveStack(int slot, int amount) { - return super.removeStack(slot, amount); - } - - @Override - public ItemStack removeStack(int slot) { - return super.removeStack(slot); - } - - @Override - public ItemStack removeItem(Item item, int count) { - return super.removeItem(item, count); - } - - @Deprecated - @Override - public void onOpen(ContainerUser user) { - if (user instanceof PlayerEntity) { - onOpen(new Player((PlayerEntity) user)); - return; - } - - this.onOpen(new CompatContainerUser(user)); - - } - - @Deprecated - @Override - public void onClose(ContainerUser user) { - if (user instanceof PlayerEntity) { - onClose(new Player((PlayerEntity) user)); - return; - } - - this.onClose(new CompatContainerUser(user)); - } - - // @Deprecated -// public net.minecraft.nbt.NbtList toNbtList(RegistryWrapper.WrapperLookup registries) { -// return toNbtList(new CompatRegistryLookup(registries)).toMinecraft(); -// } -// -// @Deprecated -// public void readNbtList(net.minecraft.nbt.NbtList list, RegistryWrapper.WrapperLookup registries) { -// readNbtList(NbtList.of(list), new CompatRegistryLookup(registries)); -// } - - @Deprecated - @Override - public boolean canPlayerUse(PlayerEntity player) { - return canPlayerUse(new Player(player)); - } - - @Deprecated - @Override - public boolean canInsert(ItemStack stack) { - return canInsert(new CanInsertArgs(stack)); - } - - public void onOpen(Player player) { - onOpen(new CompatContainerUser(player.getEntity())); - } - - public void onClose(Player player) { - onClose(new CompatContainerUser(player.getEntity())); - } - - public void onOpen(CompatContainerUser user) { - super.onOpen(user.getRaw()); - } - - public void onClose(CompatContainerUser user) { - super.onClose(user.getRaw()); - } - - public NbtList toNbtList(CompatRegistryLookup registries) { -// WriteView.ListAppender listAppender = new ListApp -// toDataList(); -// -// super.toDataList(); -// -// return NbtList.of(super.toNbtList(registries.getRegistryLookup())); - return NbtList.of(NbtUtil.createNbtList()); - } - - public void readNbtList(NbtList list, CompatRegistryLookup registries) { -// super.readNbtList(list.toMinecraft(), registries.getRegistryLookup()); - } - - public boolean canPlayerUse(Player player) { - return true; - } - - public boolean canInsert(CanInsertArgs args) { - return super.canInsert(args.getMcStack()); - } - - @Deprecated - @Override - public List clearToList() { - return callClearToList(); - } - - public List callClearToList() { - return super.clearToList(); - } - - @Deprecated - @Override - public DefaultedList getHeldStacks() { - return callGetHeldStacks(); - } - - public DefaultedList callGetHeldStacks() { - return super.getHeldStacks(); - } - - public ItemStackList callGetHeldStacksAsItemStackList() { - return ItemStackList.of(callGetHeldStacks()); - } - - @Deprecated - @Override - public ItemStack getStack(int slot) { - return callGetStack(slot); - } - - public ItemStack callGetStack(int slot) { - return super.getStack(slot); - } - - @Deprecated - @Override - public int size() { - return getSize(); - } - - public int getSize() { - return super.size(); - } - - @Deprecated - @Override - public boolean isEmpty() { - return callIsEmpty(); - } - - public boolean callIsEmpty() { - return super.isEmpty(); - } - - @Deprecated - @Override - public boolean canTransferTo(Inventory hopperInventory, int slot, ItemStack stack) { - return callCanTransferTo(hopperInventory, slot, stack); - } - - public boolean callCanTransferTo(Inventory hopperInventory, int slot, ItemStack stack) { - return super.canTransferTo(hopperInventory, slot, stack); - } - - @Deprecated - @Override - public ItemStack addStack(ItemStack stack) { - return callAddStack(stack); - } - - public ItemStack callAddStack(ItemStack stack) { - return super.addStack(stack); - } - - @Deprecated - @Override - public int getMaxCountPerStack() { - return callGetMaxCountPerStack(); - } - - public int callGetMaxCountPerStack() { - return super.getMaxCountPerStack(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java deleted file mode 100644 index 9f9ab0730..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.inventory; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class CompatPlayerInventory { - public PlayerInventory inv; - - public CompatPlayerInventory(PlayerInventory inv) { - this.inv = inv; - } - - public Player getPlayer() { - return PlayerInventoryUtil.getPlayer(inv); - } - - public int getSelectedSlot() { - return PlayerInventoryUtil.getSelectedSlot(inv); - } - - public void setSelectedSlot(int slot) { - PlayerInventoryUtil.setSelectedSlot(inv, slot); - } - - public void dropAllItems() { - PlayerInventoryUtil.dropAllItems(inv); - } - - public void offerOrDrop(ItemStack stack) { - inv.offerOrDrop(stack); - } - - public void offerOrDrop(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - offerOrDrop(stack.toMinecraft()); - } - - public PlayerInventory getRaw() { - return inv; - } -} - diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java deleted file mode 100644 index b4be9a037..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.inventory; - -import net.minecraft.screen.ScreenHandler; - -public class ContainerInventory extends CompatInventory { - - public final T screenHandler; - - public ContainerInventory(T screenHandler, int size) { - super(size); - this.screenHandler = screenHandler; - } - - public T getScreenHandler() { - return screenHandler; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java deleted file mode 100644 index b33afd6be..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.inventory; - -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.entity.Player; - -public interface ICompatInventory extends Inventory { - default void callSetStack(int slot, ItemStack stack) { - setStack(slot, stack); - } - - default ItemStack callGetStack(int slot) { - return getStack(slot); - } - - default int callSize() { - return size(); - } - - default boolean callIsEmpty() { - return isEmpty(); - } - - default ItemStack callRemoveStack(int slot, int amount) { - return removeStack(slot, amount); - } - - default ItemStack callRemoveStack(int slot) { - return removeStack(slot); - } - - default void callClear() { - clear(); - } - - default void callMarkDirty() { - markDirty(); - } - - default boolean callCanPlayerUse(net.minecraft.entity.player.PlayerEntity player) { - return canPlayerUse(player); - } - - default boolean canPlayerUse(Player player) { - return canPlayerUse(player.getEntity()); - } - - - default void callSetStack(int slot, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - setStack(slot, stack.toMinecraft()); - } - - default net.pitan76.mcpitanlib.midohra.item.ItemStack callGetStackAsMidohra(int slot) { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(slot)); - } - - default int callGetMaxCountPerStack() { - return getMaxCountPerStack(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java deleted file mode 100644 index e3a4b61df..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.inventory; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class PlayerInventoryUtil { - public static Player getPlayer(PlayerInventory playerInventory) { - return new Player(playerInventory.player); - } - - public static int getSelectedSlot(PlayerInventory playerInventory) { - return playerInventory.getSelectedSlot(); - } - - public static void setSelectedSlot(PlayerInventory playerInventory, int slot) { - playerInventory.setSelectedSlot(slot); - } - - public static void dropAllItems(PlayerInventory inv) { - inv.dropAll(); - } - - public static DefaultedList getMain(PlayerInventory inv) { - return inv.getMainStacks(); - } - - public static DefaultedList getArmor(PlayerInventory inv) { - DefaultedList stacks = DefaultedList.ofSize(4, ItemStack.EMPTY); - stacks.set(0, inv.getStack(36)); - stacks.set(1, inv.getStack(37)); - stacks.set(2, inv.getStack(38)); - stacks.set(3, inv.getStack(39)); - return stacks; - } - - public static DefaultedList getOffHand(PlayerInventory inv) { - DefaultedList stacks = DefaultedList.ofSize(1, ItemStack.EMPTY); - stacks.set(0, inv.getStack(PlayerInventory.OFF_HAND_SLOT)); - return stacks; - } - - public static ItemStack getMainHandStack(PlayerInventory inv) { - return inv.player.getMainHandStack(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java deleted file mode 100644 index aeb15f5e9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.inventory.args; - -import net.pitan76.mcpitanlib.midohra.item.ItemStack; - -public class CanInsertArgs { - public ItemStack stack; - - public CanInsertArgs(ItemStack stack) { - this.stack = stack; - } - - public CanInsertArgs(net.minecraft.item.ItemStack stack) { - this(ItemStack.of(stack)); - } - - public ItemStack getStack() { - return stack; - } - - public net.minecraft.item.ItemStack getMcStack() { - return stack.toMinecraft(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java deleted file mode 100644 index 4024ce047..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.item; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.core.registry.FuelRegistry; - -public class FuelUtil { - - public static int getTime(World world, ItemStack stack) { - return FuelRegistry.get(world, stack); - } - - public static boolean isFuel(World world, ItemStack stack) { - return FuelRegistry.isFuel(world, stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java deleted file mode 100644 index 44138ad5e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.item; - -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class ItemGroupUtil { - public static Identifier toID(ItemGroup itemGroup) { - return Registries.ITEM_GROUP.getId(itemGroup); - } - - public static ItemGroup fromId(Identifier identifier) { - return Registries.ITEM_GROUP.get(identifier); - } - - public static boolean isExist(Identifier identifier) { - return Registries.ITEM_GROUP.containsId(identifier); - } - - public static CompatIdentifier toCompatID(ItemGroup itemGroup) { - return CompatIdentifier.fromMinecraft(toID(itemGroup)); - } - - public static ItemGroup fromId(CompatIdentifier identifier) { - return fromId(identifier.toMinecraft()); - } - - public static boolean isExist(CompatIdentifier identifier) { - return isExist(identifier.toMinecraft()); - } - - public static int getRawId(ItemGroup itemGroup) { - return Registries.ITEM_GROUP.getRawId(itemGroup); - } - - public static ItemGroup fromIndex(int index) { - return Registries.ITEM_GROUP.get(index); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java deleted file mode 100644 index 2d8c17de6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java +++ /dev/null @@ -1,263 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.item; - -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -import java.util.ArrayList; -import java.util.List; - -@SuppressWarnings("deprecation") -public class ItemUtil { - - /** - * Check if the item is equal. - * @param item Item to compare. - * @param item2 Item to compare. - * @return If the item is equal. - */ - public static boolean isEqual(Item item, Item item2) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.isEqual(item, item2); - } - - /** - * Get item from CompatIdentifier. - * @param id CompatIdentifier of the item. - * @return Item of the CompatIdentifier. - */ - public static Item fromId(CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.fromId(id); - } - - public static Item fromId(String id) { - return fromId(CompatIdentifier.of(id)); - } - - public static Item fromId(String namespace, String path) { - return fromId(CompatIdentifier.of(namespace, path)); - } - - /** - * Get CompatIdentifier from Item. - * @param item Item to get CompatIdentifier. - * @return CompatIdentifier of the Item. - */ - public static CompatIdentifier toId(Item item) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.toCompatID(item); - } - - public static String toIdAsString(Item item) { - return toId(item).toString(); - } - - /** - * Check if the item exist. - * @param id CompatIdentifier of the item. - * @return If the item exist. - */ - public static boolean isExist(CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.isExist(id); - } - - public static boolean isExist(String id) { - return isExist(CompatIdentifier.of(id)); - } - - public static boolean isExist(String namespace, String path) { - return isExist(CompatIdentifier.of(namespace, path)); - } - - public static boolean isMinecraftItem(Item item) { - return CompatIdentifier.isMinecraftNamespace(toId(item)); - } - - /** - * Create a new BlockItem. - * @param block Block to create BlockItem. - * @param settings CompatItemSettings of the BlockItem. - * @return The new BlockItem. - */ - public static BlockItem create(Block block, CompatibleItemSettings settings) { - if (!settings.changedTranslationKey) - settings.useBlockPrefixedTranslationKey(); - - return net.pitan76.mcpitanlib.api.util.ItemUtil.ofBlock(block, settings); - } - - /** - * Create a new Item. - * @param settings CompatItemSettings of the Item. - * @return The new Item. - */ - public static Item create(CompatibleItemSettings settings) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.of(settings); - } - - /** - * Get all items. - * @return List of all items. - */ - public static List getItems() { - return net.pitan76.mcpitanlib.api.util.ItemUtil.getAllItems(); - } - - /** - * Get items in the tag. - * @param tagKey TagKey of the items. - * @return List of items in the tag. - */ - public static List getInTag(TagKey tagKey) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.getItems(tagKey); - } - - /** - * Get items in the tag. - * @param id CompatIdentifier of the tag. - * @return List of items in the tag. - */ - public static List getInTag(CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.getItems(id); - } - - public static List getInTag(String id) { - return getInTag(CompatIdentifier.of(id)); - } - - public static List getInTag(String namespace, String path) { - return getInTag(CompatIdentifier.of(namespace, path)); - } - - /** - * Check if the item is in the tag. - * @param item Item to check. - * @param tagKey TagKey of the tag. - * @return If the item is in the tag. - */ - public static boolean isInTag(Item item, TagKey tagKey) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.isIn(item, tagKey); - } - - /** - * Check if the item is in the tag. - * @param item Item to check. - * @param id CompatIdentifier of the tag. - * @return If the item is in the tag. - */ - public static boolean isInTag(Item item, CompatIdentifier id) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.isItemInTag(item, id); - } - - public static boolean isInTag(Item item, String id) { - return isInTag(item, CompatIdentifier.of(id)); - } - - public static boolean isInTag(Item item, String namespace, String path) { - return isInTag(item, CompatIdentifier.of(namespace, path)); - } - - /** - * Get raw id of the item. - * @param item Item to get raw id. - * @return Raw id of the item. - */ - public static int toRawId(Item item) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.getRawId(item); - } - - /** - * Get item from raw id. - * @param rawId Raw id of the item. - * @return Item from raw id. - */ - public static Item fromRawId(int rawId) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.fromIndex(rawId); - } - - /** - * Get items by namespace. - * @param namespace Namespace of the items. - * @return List of items by namespace. - */ - public static List getItemsByNamespace(String namespace) { - List items = new ArrayList<>(); - - for (Item item : getItems()) { - if (toId(item).getNamespace().equals(namespace)) - items.add(item); - } - - return items; - } - - /** - * Get number of all items. - * @return Number of all items. - */ - public static int getNumberOfItems() { - return getItems().size(); - } - - /** - * Get item from stack. - * @param stack ItemStack to get item. - * @return Item of the stack. - */ - public static Item of(ItemStack stack) { - return stack.getItem(); - } - - /** - * Check if the item is of the item. - * @param stack ItemStack to check. - * @param item Item to check. - * @return If the item is of the item. - */ - public static boolean isOf(ItemStack stack, Item item) { - return net.pitan76.mcpitanlib.api.util.ItemUtil.isOf(stack, item); - } - - /** - * Get name of the item. - * @param item Item - * @return Name of the item. - */ - public static String getNameAsString(Item item) { - return item.getName().getString(); - } - - /** - * Get name of the item. - * @param item Item - * @return Name of the item. - */ - public static TextComponent getName(Item item) { - return new TextComponent(item.getName()); - } - - /** - * Get translation key of the item. - * @param item Item - * @return Translation key of the item. - */ - public static String getTranslationKey(Item item) { - return item.getTranslationKey(); - } - - public static boolean hasRecipeRemainder(Item item) { - return !ItemStackUtil.isEmpty(getRecipeRemainderStack(item)); - } - - public static Item getRecipeRemainder(Item item) { - return getRecipeRemainderStack(item).getItem(); - } - - public static ItemStack getRecipeRemainderStack(Item item) { - return item.getRecipeRemainder(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java deleted file mode 100644 index 6f19c06bd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math; - -import net.minecraft.util.BlockRotation; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; - -public class BlockRotations { - public static BlockRotation NONE = BlockRotation.NONE; - public static BlockRotation CLOCKWISE_90 = BlockRotation.CLOCKWISE_90; - public static BlockRotation CLOCKWISE_180 = BlockRotation.CLOCKWISE_180; - public static BlockRotation COUNTERCLOCKWISE_90 = BlockRotation.COUNTERCLOCKWISE_90; - - public static BlockRotation rotate(BlockRotation rotation, BlockRotation rotation2) { - return rotation.rotate(rotation2); - } - - public static BlockRotation random(CompatRandom random) { - return BlockRotation.random(random.getMcRandom()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java deleted file mode 100644 index 8bf031508..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; - -public class BoxUtil { - public static Box createBox(double x1, double y1, double z1, double x2, double y2, double z2) { - return new Box(x1, y1, z1, x2, y2, z2); - } - - public static Box createBox(double x, double y, double z, double size) { - return new Box(x, y, z, x + size, y + size, z + size); - } - - public static Box createBox(double size) { - return new Box(0, 0, 0, size, size, size); - } - - public static Box createBox(double x1, double y1, double z1, double x2, double y2, double z2, double size) { - return new Box(x1, y1, z1, x2 + size, y2 + size, z2 + size); - } - - public static Box createBox(BlockPos pos) { - return new Box(pos); - } - - public static Box createBox(BlockPos pos1, BlockPos pos2) { - return new Box(pos1.toCenterPos(), pos2.toCenterPos()); - } - - public static Box createBox(BlockPos pos, int size) { - return createBox(pos, pos.add(size, size, size)); - } - - public static Box createBox(BlockPos pos, int sizeX, int sizeY, int sizeZ) { - return createBox(pos, pos.add(sizeX, sizeY, sizeZ)); - } - - public static Box createBoxCenter(BlockPos pos, int size) { - return createBox(pos.add(-size, -size, -size), pos.add(size, size, size)); - } - - public static Box expand(Box box, double x, double y, double z) { - return new Box(box.minX - x, box.minY - y, box.minZ - z, box.maxX + x, box.maxY + y, box.maxZ + z); - } - - public static Box expand(Box box, double size) { - return expand(box, size, size, size); - } - - public static Box union(Box box1, Box box2) { - return box1.union(box2); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java deleted file mode 100644 index 08ac22244..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math; - -import net.minecraft.util.math.Direction; - -public class DirectionUtil { - - public static Direction north() { - return Direction.NORTH; - } - - public static Direction south() { - return Direction.SOUTH; - } - - public static Direction east() { - return Direction.EAST; - } - - public static Direction west() { - return Direction.WEST; - } - - public static Direction up() { - return Direction.UP; - } - - public static Direction down() { - return Direction.DOWN; - } - - public static Direction getOpposite(Direction direction) { - return direction.getOpposite(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java deleted file mode 100644 index 9af8468c3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math; - -public class PointUtil { - public static boolean isInRegion(int x, int y, int width, int height, int pointX, int pointY) { - return pointX >= x && pointX < x + width && pointY >= y && pointY < y + height; - } - - public static boolean isInRegion(int x, int y, int width, int height, double pointX, double pointY) { - return pointX >= x && pointX < x + width && pointY >= y && pointY < y + height; - } - - public static boolean isInRegion2(int x1, int y1, int x2, int y2, int pointX, int pointY) { - return pointX >= x1 && pointX < x2 && pointY >= y1 && pointY < y2; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java deleted file mode 100644 index 3a3468921..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java +++ /dev/null @@ -1,116 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math; - -import net.minecraft.util.math.*; - -public class PosUtil { - public static BlockPos flooredBlockPos(double x, double y, double z) { - return BlockPos.ofFloored(x, y, z); - } - - public static BlockPos flooredBlockPos(Position pos) { - return BlockPos.ofFloored(pos); - } - - public static BlockPos flooredBlockPos(Vec3d pos) { - return BlockPos.ofFloored(pos); - } - - public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos midohraBlockPos(int x, int y, int z) { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(x, y, z); - } - - public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos flooredMidohraBlockPos(double x, double y, double z) { - int x1 = (int) Math.floor(x); - int y1 = (int) Math.floor(y); - int z1 = (int) Math.floor(z); - return midohraBlockPos(x1, y1, z1); - } - - public static double getSquaredDistance(BlockPos pos1, BlockPos pos2) { - return pos1.getSquaredDistance(pos2); - } - - public static double getSquaredDistance(BlockPos pos1, double x, double y, double z) { - return pos1.getSquaredDistance(x, y, z); - } - - public static Iterable iterate(BlockPos start, BlockPos end) { - return BlockPos.iterate(start, end); - } - - public static BlockPos[] getNeighborPoses(BlockPos pos) { - return new BlockPos[]{pos.north(), pos.south(), pos.east(), pos.west(), pos.up(), pos.down()}; - } - - public static BlockPos up(BlockPos pos) { - return pos.up(); - } - - public static BlockPos down(BlockPos pos) { - return pos.down(); - } - - public static BlockPos north(BlockPos pos) { - return pos.north(); - } - - public static BlockPos south(BlockPos pos) { - return pos.south(); - } - - public static BlockPos east(BlockPos pos) { - return pos.east(); - } - - public static BlockPos west(BlockPos pos) { - return pos.west(); - } - - public static BlockPos add(BlockPos pos, int x, int y, int z) { - return pos.add(x, y, z); - } - - public static BlockPos sub(BlockPos pos, int x, int y, int z) { - return pos.subtract(new Vec3i(x, y, z)); - } - - public static BlockPos mul(BlockPos pos, int n) { - return pos.multiply(n); - } - - public static int x(BlockPos pos) { - return pos.getX(); - } - - public static int y(BlockPos pos) { - return pos.getY(); - } - - public static int z(BlockPos pos) { - return pos.getZ(); - } - - public static BlockPos offset(BlockPos pos, Direction direction) { - return pos.offset(direction); - } - - public static BlockPos offset(BlockPos pos, Direction direction, int n) { - return pos.offset(direction, n); - } - - public static BlockPos offset(BlockPos pos, net.pitan76.mcpitanlib.midohra.util.math.Direction direction) { - return pos.offset(direction.toMinecraft()); - } - - public static BlockPos offset(BlockPos pos, net.pitan76.mcpitanlib.midohra.util.math.Direction direction, int n) { - return pos.offset(direction.toMinecraft(), n); - } - - public static BlockPos toImmutable(BlockPos pos) { - return pos.toImmutable(); - } - - public static long asLong(BlockPos pos) { - return pos.asLong(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java deleted file mode 100644 index f239b0a40..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math; - -import net.minecraft.util.math.Vec3d; - -public class Vec3dUtil { - public static Vec3d create(double x, double y, double z) { - return new Vec3d(x, y, z); - } - - public static Vec3d add(Vec3d a, Vec3d b) { - return a.add(b); - } - - public static Vec3d subtract(Vec3d a, Vec3d b) { - return a.subtract(b); - } - - public static Vec3d multiply(Vec3d a, double b) { - return a.multiply(b); - } - - public static Vec3d divide(Vec3d a, double b) { - return a.multiply(1.0D / b); - } - - public static double dot(Vec3d a, Vec3d b) { - return a.dotProduct(b); - } - - public static Vec3d cross(Vec3d a, Vec3d b) { - return a.crossProduct(b); - } - - public static Vec3d normalize(Vec3d a) { - return a.normalize(); - } - - public static Vec3d rotateX(Vec3d a, float angle) { - return a.rotateX(angle); - } - - public static Vec3d rotateY(Vec3d a, float angle) { - return a.rotateY(angle); - } - - public static Vec3d rotateZ(Vec3d a, float angle) { - return a.rotateZ(angle); - } - - public static Vec3d add(Vec3d a, double x, double y, double z) { - return a.add(x, y, z); - } - - public static Vec3d subtract(Vec3d a, double x, double y, double z) { - return a.subtract(x, y, z); - } - - public static Vec3d multiply(Vec3d a, double x, double y, double z) { - return a.multiply(x, y, z); - } - - public static double distanceTo(Vec3d a, Vec3d b) { - return a.distanceTo(b); - } - - public static Vec3d ofCenter(double x, double y, double z) { - return new Vec3d(x + 0.5, y + 0.5, z + 0.5); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java deleted file mode 100644 index 4def019b0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math; - -import net.minecraft.util.math.Vec3i; - -public class Vec3iUtil { - public static Vec3i create(int x, int y, int z) { - return new Vec3i(x, y, z); - } - - public static Vec3i add(Vec3i a, Vec3i b) { - return a.add(b); - } - - public static Vec3i subtract(Vec3i a, Vec3i b) { - return a.subtract(b); - } - - public static Vec3i multiply(Vec3i a, int b) { - return a.multiply(b); - } - - public static Vec3i cross(Vec3i a, Vec3i b) { - return a.crossProduct(b); - } - - public static Vec3i add(Vec3i a, int x, int y, int z) { - return a.add(x, y, z); - } - - public static Vec3i subtract(Vec3i a, int x, int y, int z) { - return a.add(-x, -y, -z); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java deleted file mode 100644 index 93cd723d5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java +++ /dev/null @@ -1,140 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.math.random; - -public class CompatRandom { - private java.util.Random javaRandom; - private net.minecraft.util.math.random.Random mcRandom; - - public CompatRandom(java.util.Random javaRandom) { - this.javaRandom = javaRandom; - } - - public CompatRandom(net.minecraft.util.math.random.Random mcRandom) { - this.mcRandom = mcRandom; - } - - @Deprecated - public CompatRandom() { - this.mcRandom = net.minecraft.util.math.random.Random.create(); - } - - @Deprecated - public CompatRandom(long seed) { - this.mcRandom = net.minecraft.util.math.random.Random.create(seed); - } - - public static CompatRandom of(long seed) { - return new CompatRandom(seed); - } - - public static CompatRandom of() { - return new CompatRandom(); - } - - public void setSeed(long seed) { - if (javaRandom != null) { - javaRandom.setSeed(seed); - } else { - mcRandom.setSeed(seed); - } - } - - public void skip(int count) { - if (javaRandom != null) { - for (int i = 0; i < count; i++) { - javaRandom.nextInt(); - } - } else { - mcRandom.skip(count); - } - } - - public void split() { - if (javaRandom != null) { - javaRandom.nextInt(); - } else { - mcRandom.split(); - } - } - - public int nextInt() { - if (javaRandom != null) { - return javaRandom.nextInt(); - } else { - return mcRandom.nextInt(); - } - } - - public int nextInt(int bound) { - if (javaRandom != null) { - return javaRandom.nextInt(bound); - } else { - return mcRandom.nextInt(bound); - } - } - - public long nextLong() { - if (javaRandom != null) { - return javaRandom.nextLong(); - } else { - return mcRandom.nextLong(); - } - } - - public double nextDouble() { - if (javaRandom != null) { - return javaRandom.nextDouble(); - } else { - return mcRandom.nextDouble(); - } - } - - public double nextGaussian() { - if (javaRandom != null) { - return javaRandom.nextGaussian(); - } else { - return mcRandom.nextGaussian(); - } - } - - public float nextFloat() { - if (javaRandom != null) { - return javaRandom.nextFloat(); - } else { - return mcRandom.nextFloat(); - } - } - - public int nextBetween(int min, int max) { - if (javaRandom != null) { - return min + javaRandom.nextInt(max - min); - } else { - return min + mcRandom.nextInt(max - min); - } - } - - public int nextBetweenExclusive(int min, int max) { - if (javaRandom != null) { - return min + javaRandom.nextInt(max - min - 1); - } else { - return min + mcRandom.nextInt(max - min - 1); - } - } - - public boolean nextBoolean() { - if (javaRandom != null) { - return javaRandom.nextBoolean(); - } else { - return mcRandom.nextBoolean(); - } - } - - @Deprecated - public java.util.Random getJavaRandom() { - return javaRandom; - } - - @Deprecated - public net.minecraft.util.math.random.Random getMcRandom() { - return mcRandom; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java deleted file mode 100644 index 56646127c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.nbt; - -import net.minecraft.inventory.Inventories; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; - -public class InvRWUtil { - public static void putInv(WriteNbtArgs args, DefaultedList stacks) { - Inventories.writeData(args.view, stacks); - } - - public static void getInv(ReadNbtArgs args, DefaultedList stacks) { - Inventories.readData(args.view, stacks); - } - - public static void putInv(WriteNbtArgs args, ItemStackList stacks) { - putInv(args, (DefaultedList) stacks); - } - - public static void getInv(ReadNbtArgs args, ItemStackList stacks) { - getInv(args, (DefaultedList) stacks); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java deleted file mode 100644 index a8f2c17e7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java +++ /dev/null @@ -1,88 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.nbt; - -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.NbtList; -import net.pitan76.mcpitanlib.api.util.NbtUtil; - -import java.util.Optional; -import java.util.stream.Stream; - -public class NbtListUtil { - public static NbtList create() { - return NbtUtil.createNbtList(); - } - - public static NbtList copy(NbtList list) { - return list.copy(); - } - - public static Stream stream(NbtList list) { - return list.stream(); - } - - public static Optional getStringOptional(NbtList list, int index) { - return list.getString(index); - } - - public static NbtElement get(NbtList list, int index) { - return list.get(index); - } - - public static NbtElement getOrDefault(NbtList list, int index, NbtElement defaultValue) { - NbtElement nbt = get(list, index); - return nbt == null ? defaultValue : nbt; - } - - public static void set(NbtList list, int index, NbtElement value) { - list.set(index, value); - } - - public static void add(NbtList list, NbtElement value) { - list.add(value); - } - - public static void set(NbtList list, int index, String value) { - set(list, index, NbtUtil.createString(value)); - } - - public static boolean has(NbtList list, NbtElement value) { - return list.contains(value); - } - - public static int size(NbtList list) { - return list.size(); - } - - public static void remove(NbtList list, int index) { - list.remove(index); - } - - public static void clear(NbtList list) { - list.clear(); - } - - public static boolean isEmpty(NbtList list) { - return list.isEmpty(); - } - - public static String getString(NbtList list, int index) { - return getStringOptional(list, index).orElse(""); - } - - public static void setString(NbtList list, int index, String value) { - list.set(index, NbtUtil.createString(value)); - } - - public static void addString(NbtList list, String value) { - list.add(NbtUtil.createString(value)); - } - - public static NbtList getList(NbtList list, int index) { - return list.getList(index).orElse(create()); - } - - public static NbtCompound getCompound(NbtList list, int index) { - return list.getCompound(index).orElse(NbtUtil.create()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java deleted file mode 100644 index 17c119629..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java +++ /dev/null @@ -1,141 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.nbt; - -import net.minecraft.nbt.NbtCompound; -import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.util.NbtUtil; - -public class NbtRWUtil { - - public static void putBoolean(WriteNbtArgs args, String key, boolean value) { - args.view.putBoolean(key, value); - } - - public static boolean getBoolean(ReadNbtArgs args, String key) { - return args.view.getBoolean(key, false); - } - - public static void putByte(WriteNbtArgs args, String key, byte value) { - args.view.putByte(key, value); - } - - public static byte getByte(ReadNbtArgs args, String key) { - return args.view.getByte(key, (byte) 0); - } - - public static void putInt(WriteNbtArgs args, String key, int value) { - args.view.putInt(key, value); - } - - public static int getInt(ReadNbtArgs args, String key) { - return args.view.getInt(key, 0); - } - - public static void putLong(WriteNbtArgs args, String key, long value) { - args.view.putLong(key, value); - } - - public static long getLong(ReadNbtArgs args, String key) { - return args.view.getLong(key, 0L); - } - - public static void putShort(WriteNbtArgs args, String key, short value) { - args.view.putShort(key, value); - } - - public static short getShort(ReadNbtArgs args, String key) { - return (short) args.view.getShort(key, (short) 0); - } - - public static void putFloat(WriteNbtArgs args, String key, float value) { - args.view.putFloat(key, value); - } - - public static float getFloat(ReadNbtArgs args, String key) { - return args.view.getFloat(key, 0.0f); - } - - public static void putDouble(WriteNbtArgs args, String key, double value) { - args.view.putDouble(key, value); - } - - public static double getDouble(ReadNbtArgs args, String key) { - return args.view.getDouble(key, 0.0); - } - - public static void putString(WriteNbtArgs args, String key, String value) { - args.view.putString(key, value); - } - - public static String getString(ReadNbtArgs args, String key) { - return args.view.getString(key, ""); - } - - public static void putIntArray(WriteNbtArgs args, String key, int[] value) { - args.view.putIntArray(key, value); - } - - public static int[] getIntArray(ReadNbtArgs args, String key) { - return args.view.getOptionalIntArray(key).orElse(new int[0]); - } - - public static boolean getBooleanOrDefault(ReadNbtArgs args, String key, boolean defaultValue) { - return args.view.getBoolean(key, defaultValue); - } - - public static byte getByteOrDefault(ReadNbtArgs args, String key, byte defaultValue) { - return args.view.getByte(key, defaultValue); - } - - public static int getIntOrDefault(ReadNbtArgs args, String key, int defaultValue) { - return args.view.getInt(key, defaultValue); - } - - public static long getLongOrDefault(ReadNbtArgs args, String key, long defaultValue) { - return args.view.getLong(key, defaultValue); - } - - public static short getShortOrDefault(ReadNbtArgs args, String key, short defaultValue) { - return (short) args.view.getShort(key, defaultValue); - } - - public static float getFloatOrDefault(ReadNbtArgs args, String key, float defaultValue) { - return args.view.getFloat(key, defaultValue); - } - - public static double getDoubleOrDefault(ReadNbtArgs args, String key, double defaultValue) { - return args.view.getDouble(key, defaultValue); - } - - public static String getStringOrDefault(ReadNbtArgs args, String key, String defaultValue) { - return args.view.getString(key, defaultValue); - } - - public static int[] getIntArrayOrDefault(ReadNbtArgs args, String key, int[] defaultValue) { - return args.view.getOptionalIntArray(key).orElse(defaultValue); - } - - public static boolean isEmpty(NbtRWArgs args) { - if (args instanceof WriteNbtArgs) - return ((WriteNbtArgs) args).view.isEmpty(); - else - return true; - } - - public static void put(WriteNbtArgs args, String key, NbtRWArgs other) { - putCompound(args, key, other.nbt); - } - - public static NbtRWArgs get(ReadNbtArgs args, String key) { - return new NbtRWArgs(getCompound(args, key)); - } - - public static void putCompound(WriteNbtArgs args, String key, NbtCompound other) { - args.view.put(key, NbtCompound.CODEC, other); - } - - public static NbtCompound getCompound(ReadNbtArgs args, String key) { - return args.view.read(key, NbtCompound.CODEC).orElse(NbtUtil.create()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java deleted file mode 100644 index 702a6e97b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java +++ /dev/null @@ -1,126 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.nbt.v2; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; -import net.pitan76.mcpitanlib.api.util.math.PosUtil; -import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; -import net.pitan76.mcpitanlib.api.util.math.Vec3iUtil; -import net.pitan76.mcpitanlib.api.util.nbt.InvRWUtil; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; - -import java.util.Optional; - -public class NbtRWUtil extends net.pitan76.mcpitanlib.api.util.nbt.NbtRWUtil { - public static void putInv(WriteNbtArgs args, ItemStackList stacks) { - InvRWUtil.putInv(args, stacks); - } - - public static void getInv(ReadNbtArgs args, ItemStackList stacks) { - InvRWUtil.getInv(args, stacks); - } - - public static WriteNbtArgs create(CompatRegistryLookup registryLookup) { - NbtWriteView view = _view(registryLookup); - return new WriteNbtArgs(view.getNbt(), view, registryLookup); - } - - public static WriteNbtArgs create() { - return create(null); - } - - public static void put(WriteNbtArgs parent, WriteNbtArgs child, String key) { - if (child.view instanceof NbtWriteView childView) - parent.view.put(key, NbtCompound.CODEC, childView.getNbt()); - } - - public static WriteNbtArgs putWithCreate(WriteNbtArgs parent, String key) { - NbtWriteView subView = _view(parent.registryLookup); - parent.view.put(key, NbtCompound.CODEC, subView.getNbt()); - return new WriteNbtArgs(subView.getNbt(), subView, parent.registryLookup); - } - - public static ReadNbtArgs get(ReadNbtArgs parent, String key) { - ReadView view = parent.view.getReadView(key); - return new ReadNbtArgs(null, view, parent.registryLookup); - } - - public static ReadNbtArgs getOrDefault(ReadNbtArgs parent, String key, ReadNbtArgs defaultValue) { - Optional view = parent.view.getOptionalReadView(key); - return view.map(readView -> new ReadNbtArgs(null, readView, parent.registryLookup)).orElse(defaultValue); - } - - public static void putPos3i(WriteNbtArgs args, String key, int x, int y, int z) { - WriteNbtArgs args2 = putWithCreate(args, key); - putInt(args2, "x", x); - putInt(args2, "y", y); - putInt(args2, "z", z); - } - - public static void putPos3d(WriteNbtArgs args, String key, double x, double y, double z) { - WriteNbtArgs args2 = putWithCreate(args, key); - putDouble(args2, "x", x); - putDouble(args2, "y", y); - putDouble(args2, "z", z); - } - - public static Vec3i getPos3i(ReadNbtArgs args, String key) { - ReadNbtArgs args2 = get(args, key); - int x = getInt(args2, "x"); - int y = getInt(args2, "y"); - int z = getInt(args2, "z"); - return Vec3iUtil.create(x, y, z); - } - - public static Vec3d getPos3d(ReadNbtArgs args, String key) { - ReadNbtArgs args2 = get(args, key); - double x = getDouble(args2, "x"); - double y = getDouble(args2, "y"); - double z = getDouble(args2, "z"); - return Vec3dUtil.create(x, y, z); - } - - public static void putBlockPos(WriteNbtArgs args, String key, BlockPos pos) { - putPos3i(args, key, pos.getX(), pos.getY(), pos.getZ()); - } - - public static BlockPos getBlockPos(ReadNbtArgs args, String key) { - ReadNbtArgs args2 = get(args, key); - int x = getInt(args2, "x"); - int y = getInt(args2, "y"); - int z = getInt(args2, "z"); - return BlockPos.of(x, y, z); - } - - public static void putBlockPos(WriteNbtArgs args, String key, net.minecraft.util.math.BlockPos pos) { - putPos3i(args, key, PosUtil.x(pos), PosUtil.y(pos), PosUtil.z(pos)); - } - - public static net.minecraft.util.math.BlockPos getBlockPosV(ReadNbtArgs args, String key) { - ReadNbtArgs args2 = get(args, key); - int x = getInt(args2, "x"); - int y = getInt(args2, "y"); - int z = getInt(args2, "z"); - return PosUtil.flooredBlockPos(x, y, z); - } - - private static NbtWriteView _view(CompatRegistryLookup registryLookup) { - return NbtWriteView.create(ErrorReporter.EMPTY, registryLookup.getRegistryLookup()); - } - - public static void putItemStack(WriteNbtArgs args, String key, ItemStack stack) { - args.view.put(key, ItemStack.CODEC, stack); - } - - public static Optional getItemStack(ReadNbtArgs args, String key) { - return args.view.read(key, ItemStack.CODEC); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java deleted file mode 100644 index 758900a07..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.particle; - -import net.minecraft.particle.ParticleType; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class CompatParticleType { - private final ParticleType particleType; - - public CompatParticleType(ParticleType particleType) { - this.particleType = particleType; - } - - public static CompatParticleType of(ParticleType particleType) { - return new CompatParticleType(particleType); - } - - public ParticleType getRaw() { - return particleType; - } - - public boolean shouldAlwaysSpawn() { - return particleType.shouldAlwaysSpawn(); - } - - public Identifier getId() { - return Registries.PARTICLE_TYPE.getId(particleType); - } - - public CompatIdentifier getCompatId() { - return CompatIdentifier.fromMinecraft(getId()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java deleted file mode 100644 index 5562d9bda..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java +++ /dev/null @@ -1,121 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.particle; - -import net.minecraft.particle.*; - -public class CompatParticleTypes { - public static final CompatParticleType ANGRY_VILLAGER = new CompatParticleType(ParticleTypes.ANGRY_VILLAGER); - public static final CompatParticleType BLOCK = new CompatParticleType(ParticleTypes.BLOCK); - public static final CompatParticleType BLOCK_MARKER = new CompatParticleType(ParticleTypes.BLOCK_MARKER); - public static final CompatParticleType BUBBLE = new CompatParticleType(ParticleTypes.BUBBLE); - public static final CompatParticleType CLOUD = new CompatParticleType(ParticleTypes.CLOUD); - public static final CompatParticleType COPPER_FIRE_FLAME = new CompatParticleType(ParticleTypes.COPPER_FIRE_FLAME); - public static final CompatParticleType CRIT = new CompatParticleType(ParticleTypes.CRIT); - public static final CompatParticleType DAMAGE_INDICATOR = new CompatParticleType(ParticleTypes.DAMAGE_INDICATOR); - public static final CompatParticleType DRAGON_BREATH = new CompatParticleType(ParticleTypes.DRAGON_BREATH); - public static final CompatParticleType DRIPPING_LAVA = new CompatParticleType(ParticleTypes.DRIPPING_LAVA); - public static final CompatParticleType FALLING_LAVA = new CompatParticleType(ParticleTypes.FALLING_LAVA); - public static final CompatParticleType LANDING_LAVA = new CompatParticleType(ParticleTypes.LANDING_LAVA); - public static final CompatParticleType DRIPPING_WATER = new CompatParticleType(ParticleTypes.DRIPPING_WATER); - public static final CompatParticleType FALLING_WATER = new CompatParticleType(ParticleTypes.FALLING_WATER); - public static final CompatParticleType DUST = new CompatParticleType(ParticleTypes.DUST); - public static final CompatParticleType DUST_COLOR_TRANSITION = new CompatParticleType(ParticleTypes.DUST_COLOR_TRANSITION); - public static final CompatParticleType EFFECT = new CompatParticleType(ParticleTypes.EFFECT); - public static final CompatParticleType ELDER_GUARDIAN = new CompatParticleType(ParticleTypes.ELDER_GUARDIAN); - public static final CompatParticleType ENCHANTED_HIT = new CompatParticleType(ParticleTypes.ENCHANTED_HIT); - public static final CompatParticleType ENCHANT = new CompatParticleType(ParticleTypes.ENCHANT); - public static final CompatParticleType END_ROD = new CompatParticleType(ParticleTypes.END_ROD); - public static final CompatParticleType ENTITY_EFFECT = new CompatParticleType(ParticleTypes.ENTITY_EFFECT); - public static final CompatParticleType EXPLOSION_EMITTER = new CompatParticleType(ParticleTypes.EXPLOSION_EMITTER); - public static final CompatParticleType EXPLOSION = new CompatParticleType(ParticleTypes.EXPLOSION); - public static final CompatParticleType GUST = new CompatParticleType(ParticleTypes.GUST); - public static final CompatParticleType SMALL_GUST = new CompatParticleType(ParticleTypes.SMALL_GUST); - public static final CompatParticleType GUST_EMITTER_LARGE = new CompatParticleType(ParticleTypes.GUST_EMITTER_LARGE); - public static final CompatParticleType GUST_EMITTER_SMALL = new CompatParticleType(ParticleTypes.GUST_EMITTER_SMALL); - public static final CompatParticleType SONIC_BOOM = new CompatParticleType(ParticleTypes.SONIC_BOOM); - public static final CompatParticleType FALLING_DUST = new CompatParticleType(ParticleTypes.FALLING_DUST); - public static final CompatParticleType FIREWORK = new CompatParticleType(ParticleTypes.FIREWORK); - public static final CompatParticleType FISHING = new CompatParticleType(ParticleTypes.FISHING); - public static final CompatParticleType FLAME = new CompatParticleType(ParticleTypes.FLAME); - public static final CompatParticleType INFESTED = new CompatParticleType(ParticleTypes.INFESTED); - public static final CompatParticleType CHERRY_LEAVES = new CompatParticleType(ParticleTypes.CHERRY_LEAVES); - public static final CompatParticleType PALE_OAK_LEAVES = new CompatParticleType(ParticleTypes.PALE_OAK_LEAVES); - public static final CompatParticleType TINTED_LEAVES = new CompatParticleType(ParticleTypes.TINTED_LEAVES); - public static final CompatParticleType SCULK_SOUL = new CompatParticleType(ParticleTypes.SCULK_SOUL); - public static final CompatParticleType SCULK_CHARGE = new CompatParticleType(ParticleTypes.SCULK_CHARGE); - public static final CompatParticleType SCULK_CHARGE_POP = new CompatParticleType(ParticleTypes.SCULK_CHARGE_POP); - public static final CompatParticleType SOUL_FIRE_FLAME = new CompatParticleType(ParticleTypes.SOUL_FIRE_FLAME); - public static final CompatParticleType SOUL = new CompatParticleType(ParticleTypes.SOUL); - public static final CompatParticleType FLASH = new CompatParticleType(ParticleTypes.FLASH); - public static final CompatParticleType HAPPY_VILLAGER = new CompatParticleType(ParticleTypes.HAPPY_VILLAGER); - public static final CompatParticleType COMPOSTER = new CompatParticleType(ParticleTypes.COMPOSTER); - public static final CompatParticleType HEART = new CompatParticleType(ParticleTypes.HEART); - public static final CompatParticleType INSTANT_EFFECT = new CompatParticleType(ParticleTypes.INSTANT_EFFECT); - public static final CompatParticleType ITEM = new CompatParticleType(ParticleTypes.ITEM); - public static final CompatParticleType VIBRATION = new CompatParticleType(ParticleTypes.VIBRATION); - public static final CompatParticleType TRAIL = new CompatParticleType(ParticleTypes.TRAIL); - public static final CompatParticleType ITEM_SLIME = new CompatParticleType(ParticleTypes.ITEM_SLIME); - public static final CompatParticleType ITEM_COBWEB = new CompatParticleType(ParticleTypes.ITEM_COBWEB); - public static final CompatParticleType ITEM_SNOWBALL = new CompatParticleType(ParticleTypes.ITEM_SNOWBALL); - public static final CompatParticleType LARGE_SMOKE = new CompatParticleType(ParticleTypes.LARGE_SMOKE); - public static final CompatParticleType LAVA = new CompatParticleType(ParticleTypes.LAVA); - public static final CompatParticleType MYCELIUM = new CompatParticleType(ParticleTypes.MYCELIUM); - public static final CompatParticleType NOTE = new CompatParticleType(ParticleTypes.NOTE); - public static final CompatParticleType POOF = new CompatParticleType(ParticleTypes.POOF); - public static final CompatParticleType PORTAL = new CompatParticleType(ParticleTypes.PORTAL); - public static final CompatParticleType RAIN = new CompatParticleType(ParticleTypes.RAIN); - public static final CompatParticleType SMOKE = new CompatParticleType(ParticleTypes.SMOKE); - public static final CompatParticleType WHITE_SMOKE = new CompatParticleType(ParticleTypes.WHITE_SMOKE); - public static final CompatParticleType SNEEZE = new CompatParticleType(ParticleTypes.SNEEZE); - public static final CompatParticleType SPIT = new CompatParticleType(ParticleTypes.SPIT); - public static final CompatParticleType SQUID_INK = new CompatParticleType(ParticleTypes.SQUID_INK); - public static final CompatParticleType SWEEP_ATTACK = new CompatParticleType(ParticleTypes.SWEEP_ATTACK); - public static final CompatParticleType TOTEM_OF_UNDYING = new CompatParticleType(ParticleTypes.TOTEM_OF_UNDYING); - public static final CompatParticleType UNDERWATER = new CompatParticleType(ParticleTypes.UNDERWATER); - public static final CompatParticleType SPLASH = new CompatParticleType(ParticleTypes.SPLASH); - public static final CompatParticleType WITCH = new CompatParticleType(ParticleTypes.WITCH); - public static final CompatParticleType BUBBLE_POP = new CompatParticleType(ParticleTypes.BUBBLE_POP); - public static final CompatParticleType CURRENT_DOWN = new CompatParticleType(ParticleTypes.CURRENT_DOWN); - public static final CompatParticleType BUBBLE_COLUMN_UP = new CompatParticleType(ParticleTypes.BUBBLE_COLUMN_UP); - public static final CompatParticleType NAUTILUS = new CompatParticleType(ParticleTypes.NAUTILUS); - public static final CompatParticleType DOLPHIN = new CompatParticleType(ParticleTypes.DOLPHIN); - public static final CompatParticleType CAMPFIRE_COSY_SMOKE = new CompatParticleType(ParticleTypes.CAMPFIRE_COSY_SMOKE); - public static final CompatParticleType CAMPFIRE_SIGNAL_SMOKE = new CompatParticleType(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE); - public static final CompatParticleType DRIPPING_HONEY = new CompatParticleType(ParticleTypes.DRIPPING_HONEY); - public static final CompatParticleType FALLING_HONEY = new CompatParticleType(ParticleTypes.FALLING_HONEY); - public static final CompatParticleType LANDING_HONEY = new CompatParticleType(ParticleTypes.LANDING_HONEY); - public static final CompatParticleType FALLING_NECTAR = new CompatParticleType(ParticleTypes.FALLING_NECTAR); - public static final CompatParticleType FALLING_SPORE_BLOSSOM = new CompatParticleType(ParticleTypes.FALLING_SPORE_BLOSSOM); - public static final CompatParticleType ASH = new CompatParticleType(ParticleTypes.ASH); - public static final CompatParticleType CRIMSON_SPORE = new CompatParticleType(ParticleTypes.CRIMSON_SPORE); - public static final CompatParticleType WARPED_SPORE = new CompatParticleType(ParticleTypes.WARPED_SPORE); - public static final CompatParticleType SPORE_BLOSSOM_AIR = new CompatParticleType(ParticleTypes.SPORE_BLOSSOM_AIR); - public static final CompatParticleType DRIPPING_OBSIDIAN_TEAR = new CompatParticleType(ParticleTypes.DRIPPING_OBSIDIAN_TEAR); - public static final CompatParticleType FALLING_OBSIDIAN_TEAR = new CompatParticleType(ParticleTypes.FALLING_OBSIDIAN_TEAR); - public static final CompatParticleType LANDING_OBSIDIAN_TEAR = new CompatParticleType(ParticleTypes.LANDING_OBSIDIAN_TEAR); - public static final CompatParticleType REVERSE_PORTAL = new CompatParticleType(ParticleTypes.REVERSE_PORTAL); - public static final CompatParticleType WHITE_ASH = new CompatParticleType(ParticleTypes.WHITE_ASH); - public static final CompatParticleType SMALL_FLAME = new CompatParticleType(ParticleTypes.SMALL_FLAME); - public static final CompatParticleType SNOWFLAKE = new CompatParticleType(ParticleTypes.SNOWFLAKE); - public static final CompatParticleType DRIPPING_DRIPSTONE_LAVA = new CompatParticleType(ParticleTypes.DRIPPING_DRIPSTONE_LAVA); - public static final CompatParticleType FALLING_DRIPSTONE_LAVA = new CompatParticleType(ParticleTypes.FALLING_DRIPSTONE_LAVA); - public static final CompatParticleType DRIPPING_DRIPSTONE_WATER = new CompatParticleType(ParticleTypes.DRIPPING_DRIPSTONE_WATER); - public static final CompatParticleType FALLING_DRIPSTONE_WATER = new CompatParticleType(ParticleTypes.FALLING_DRIPSTONE_WATER); - public static final CompatParticleType GLOW_SQUID_INK = new CompatParticleType(ParticleTypes.GLOW_SQUID_INK); - public static final CompatParticleType GLOW = new CompatParticleType(ParticleTypes.GLOW); - public static final CompatParticleType WAX_ON = new CompatParticleType(ParticleTypes.WAX_ON); - public static final CompatParticleType WAX_OFF = new CompatParticleType(ParticleTypes.WAX_OFF); - public static final CompatParticleType ELECTRIC_SPARK = new CompatParticleType(ParticleTypes.ELECTRIC_SPARK); - public static final CompatParticleType SCRAPE = new CompatParticleType(ParticleTypes.SCRAPE); - public static final CompatParticleType SHRIEK = new CompatParticleType(ParticleTypes.SHRIEK); - public static final CompatParticleType EGG_CRACK = new CompatParticleType(ParticleTypes.EGG_CRACK); - public static final CompatParticleType DUST_PLUME = new CompatParticleType(ParticleTypes.DUST_PLUME); - public static final CompatParticleType TRIAL_SPAWNER_DETECTION = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTION); - public static final CompatParticleType TRIAL_SPAWNER_DETECTION_OMINOUS = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTION_OMINOUS); - public static final CompatParticleType VAULT_CONNECTION = new CompatParticleType(ParticleTypes.VAULT_CONNECTION); - public static final CompatParticleType DUST_PILLAR = new CompatParticleType(ParticleTypes.DUST_PILLAR); - public static final CompatParticleType OMINOUS_SPAWNING = new CompatParticleType(ParticleTypes.OMINOUS_SPAWNING); - public static final CompatParticleType RAID_OMEN = new CompatParticleType(ParticleTypes.RAID_OMEN); - public static final CompatParticleType TRIAL_OMEN = new CompatParticleType(ParticleTypes.TRIAL_OMEN); - public static final CompatParticleType BLOCK_CRUMBLE = new CompatParticleType(ParticleTypes.BLOCK_CRUMBLE); - public static final CompatParticleType FIREFLY = new CompatParticleType(ParticleTypes.FIREFLY); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java deleted file mode 100644 index 9eab41f4d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.particle.effect; - -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ItemStackParticleEffect; -import net.minecraft.particle.ParticleType; -import net.minecraft.particle.ParticleTypes; - -// Use: ParticleEffectUtil -public class ItemStackParticleEffectUtil { - - public ItemStackParticleEffectUtil() { - // Empty constructor - } - - public ItemStackParticleEffect create(ParticleType type, ItemStack stack) { - return new ItemStackParticleEffect(type, stack); - } - - public ItemStackParticleEffect createTypedItem(ItemStack stack) { - return new ItemStackParticleEffect(ParticleTypes.ITEM, stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java deleted file mode 100644 index 2c6844f07..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.recipe; - -import it.unimi.dsi.fastutil.ints.IntList; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeMatcher; -import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.util.ItemUtil; - -public class RecipeMatcherUtil { - public static ItemStack getStackFromId(int itemId) { - return ItemStackUtil.create(ItemUtil.fromIndex(itemId)); - } - - public static int getItemId(ItemStack stack) { - return ItemUtil.getRawId(stack.getItem()); - } - - public static boolean match(RecipeMatcher matcher, CompatibleRecipeEntry entry, IntList output) { - return match(matcher, entry.getRecipe(), output); - } - - public static boolean match(RecipeMatcher matcher, CompatibleRecipeEntry entry, IntList output, int multiplier) { - return match(matcher, entry.getRecipe(), output, multiplier); - } - - @Deprecated - public static boolean match(RecipeMatcher matcher, Recipe recipe, IntList output) { - return false; - //return matcher.match(recipe, output); - } - - @Deprecated - public static boolean match(RecipeMatcher matcher, Recipe recipe, IntList output, int multiplier) { - return false; - //return matcher.match(recipe, output, multiplier); - } - - public static void clear(RecipeMatcher matcher) { - matcher.clear(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java deleted file mode 100644 index dc6430e2b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java +++ /dev/null @@ -1,101 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.recipe; - -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeType; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; -import net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry; -import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class RecipeUtil { - public static Collection> getMCRecipes(World world) { - Collection> recipes = new ArrayList<>(); - - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { - recipes.add(entry.value()); - } - - return recipes; - } - - public static Collection> getMCRecipeEntries(World world) { - if (world.getRecipeManager() instanceof ServerRecipeManager) { - return ((ServerRecipeManager) world.getRecipeManager()).values(); - } - - // Client is not supported... TODO: Implement client support for 1.21.3~ - return new ArrayList<>(); - } - - public static Collection getRecipes(World world) { - List recipes = new ArrayList<>(); - - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { - recipes.add(new CompatRecipe(entry)); - } - - return recipes; - } - - public static Collection getRecipesByType(World world, RecipeType type) { - List recipes = new ArrayList<>(); - - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { - if (entry.value().getType() == type) { - recipes.add(new CompatRecipe(entry)); - } - } - - return recipes; - } - - // MidohraAPI - public static Collection getRecipes(net.pitan76.mcpitanlib.midohra.world.World world) { - return getRecipes(world.getRaw()); - } - - public static Collection getRecipesByType(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.recipe.RecipeType type) { - return getRecipesByType(world.getRaw(), type.getRaw()); - } - - public static Collection getRecipeEntries(net.pitan76.mcpitanlib.midohra.world.World world) { - List entries = new ArrayList<>(); - - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world.getRaw())) { - entries.add(RecipeEntry.of(entry.value(), CompatIdentifier.fromMinecraft(entry.id().getValue()))); - } - - return entries; - } - - public static Collection getCraftingRecipes(net.pitan76.mcpitanlib.midohra.world.World world) { - List recipes = new ArrayList<>(); - - for (CompatRecipe recipe : getRecipesByType(world, net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING)) { - if (recipe.getRecipe() instanceof net.minecraft.recipe.CraftingRecipe) { - recipes.add(CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) recipe.getRecipe())); - } - } - - return recipes; - } - - public static Collection getCraftingRecipeEntries(net.pitan76.mcpitanlib.midohra.world.World world) { - List entries = new ArrayList<>(); - - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world.getRaw())) { - if (entry.value() instanceof net.minecraft.recipe.CraftingRecipe) { - entries.add(CraftingRecipeEntry.of((net.minecraft.recipe.CraftingRecipe) entry.value(), CompatIdentifier.fromMinecraft(entry.id().getValue()))); - } - } - - return entries; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java deleted file mode 100644 index 694e4c3b1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java +++ /dev/null @@ -1,97 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.recipe.input; - -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.RecipeFinder; -import net.minecraft.recipe.input.CraftingRecipeInput; -import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -import java.util.List; -import java.util.Optional; - -public class CraftingRecipeInputUtil { - public static Optional get(CompatRecipeInput input) { - if (input.getInput() instanceof CraftingRecipeInput) { - return Optional.of((CraftingRecipeInput) input.getInput()); - } - return Optional.empty(); - } - - public static CompatRecipeInput create(CraftingRecipeInput input) { - return new CompatRecipeInput<>(input); - } - - public static CompatRecipeInput create(int width, int height, List stacks) { - return new CompatRecipeInput<>(CraftingRecipeInput.create(width, height, stacks)); - } - - public static ItemStack getStack(CraftingRecipeInput input, int x, int y) { - return input.getStackInSlot(x, y); - } - - public static ItemStack getStack(CompatRecipeInput input, int x, int y) { - Optional recipeInput = get(input); - if (!recipeInput.isPresent()) return ItemStackUtil.empty(); - - return getStack(recipeInput.get(), x, y); - } - - public static net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack(CompatRecipeInput input, int x, int y) { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(input, x, y)); - } - - public static RecipeFinder getRecipeMatcher(CraftingRecipeInput input) { - return input.getRecipeMatcher(); - } - - public static RecipeFinder getRecipeMatcher(CompatRecipeInput input) { - Optional recipeInput = get(input); - if (!recipeInput.isPresent()) return null; - - return getRecipeMatcher(recipeInput.get()); - } - - public static List getStacks(CraftingRecipeInput input) { - return input.getStacks(); - } - - public static List getStacks(CompatRecipeInput input) { - Optional recipeInput = get(input); - if (!recipeInput.isPresent()) return null; - - return getStacks(recipeInput.get()); - } - - public static int getWidth(CraftingRecipeInput input) { - return input.getWidth(); - } - - public static int getWidth(CompatRecipeInput input) { - Optional recipeInput = get(input); - if (!recipeInput.isPresent()) return -1; - - return getWidth(recipeInput.get()); - } - - public static int getHeight(CraftingRecipeInput input) { - return input.getHeight(); - } - - public static int getHeight(CompatRecipeInput input) { - Optional recipeInput = get(input); - if (!recipeInput.isPresent()) return -1; - - return getHeight(recipeInput.get()); - } - - public static int getStackCount(CraftingRecipeInput input) { - return input.getStackCount(); - } - - public static int getStackCount(CompatRecipeInput input) { - Optional recipeInput = get(input); - if (!recipeInput.isPresent()) return -1; - - return getStackCount(recipeInput.get()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java deleted file mode 100644 index daf08816f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.recipe.input; - -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.input.SingleStackRecipeInput; -import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; - -import java.util.Optional; - -public class SingleStackRecipeInputUtil { - public static Optional get(CompatRecipeInput input) { - if (input.getInput() instanceof SingleStackRecipeInput) { - return Optional.of((SingleStackRecipeInput) input.getInput()); - } - return Optional.empty(); - } - - public static CompatRecipeInput create(SingleStackRecipeInput input) { - return new CompatRecipeInput<>(input); - } - - public static CompatRecipeInput create(ItemStack stack) { - return new CompatRecipeInput<>(new SingleStackRecipeInput(stack)); - } - - public static ItemStack getStack(CompatRecipeInput input) { - Optional recipeInput = get(input); - if (!recipeInput.isPresent()) return ItemStackUtil.empty(); - - return recipeInput.get().getStackInSlot(0); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java deleted file mode 100644 index fbc99fb76..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.screen; - -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; -import org.jetbrains.annotations.Nullable; - -import java.util.Set; - -public class ScreenHandlerUtil { - public static int calcComparatorOutput(@Nullable Inventory inventory) { - return ScreenHandler.calculateComparatorOutput(inventory); - } - - public static int calcComparatorOutput(@Nullable BlockEntity blockEntity) { - return ScreenHandler.calculateComparatorOutput(blockEntity); - } - - public static int calculateStackSize(Set slots, int mode, ItemStack stack) { - return ScreenHandler.calculateStackSize(slots, mode, stack); - } - - public static boolean canInsertItemIntoSlot(@Nullable Slot slot, ItemStack stack, boolean allowOverflow) { - return ScreenHandler.canInsertItemIntoSlot(slot, stack, allowOverflow); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java deleted file mode 100644 index 42b63a52c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.v1; - -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.tag.MineableToolTags; - -import java.util.ArrayList; -import java.util.List; - -public class BlockUtilV1 { - public static Block block(Identifier id) { - return Registries.BLOCK.get(id); - } - - /** - * ~1.16? - * @param settings - * @param toolTags - * @param level - * @return - */ - public static AbstractBlock.Settings breakByTool(AbstractBlock.Settings settings, MineableToolTags toolTags, int level) { - return settings; - } - - public static AbstractBlock.Settings dropsNothing(AbstractBlock.Settings settings) { - return settings.dropsNothing(); - } - - public static AbstractBlock.Settings requiresTool(AbstractBlock.Settings settings) { - return settings.requiresTool(); - } - - public static boolean isExist(Identifier identifier) { - return Registries.BLOCK.containsId(identifier); - } - - public static Identifier toID(Block block) { - return Registries.BLOCK.getId(block); - } - - public static Block fromId(Identifier identifier) { - return Registries.BLOCK.get(identifier); - } - - public static List getAllBlocks() { - List blocks = new ArrayList<>(); - for (Block block : Registries.BLOCK) { - blocks.add(block); - } - return blocks; - } - - @Deprecated - public static Block of(AbstractBlock.Settings settings) { - return new Block(settings); - } - - public static Block of(CompatibleBlockSettings settings) { - return of(settings.build()); - } - - public static int getRawId(Block block) { - return Registries.BLOCK.getRawId(block); - } - - public static Block fromIndex(int index) { - return Registries.BLOCK.get(index); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java deleted file mode 100644 index 73280f625..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java +++ /dev/null @@ -1,92 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.v1; - -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.block.BlockItemByExtendBlock1215; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; -import net.pitan76.mcpitanlib.api.item.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.tag.TagKey; - -import java.util.ArrayList; -import java.util.List; - -public class ItemUtilV1 { - public static Item item(Identifier id) { - return Registries.ITEM.get(id); - } - - public static boolean isEqual(Item item, Item item2) { - return item == item2; - } - - public static boolean isOf(ItemStack stack, Item item) { - return stack.isOf(item); - } - - public static boolean isIn(ItemStack stack, TagKey tagKey) { - return isIn(stack.getItem(), tagKey); - } - - public static boolean isIn(Item item, TagKey tagKey) { - if (item.getRegistryEntry().isIn(tagKey.getTagKey())) return true; - return tagKey.isOf(item); - } - - public static boolean isExist(Identifier identifier) { - return Registries.ITEM.containsId(identifier); - } - public static Identifier toID(Item item) { - return Registries.ITEM.getId(item); - } - - public static Item fromId(Identifier identifier) { - return Registries.ITEM.get(identifier); - } - - @Deprecated - public static BlockItem ofBlock(Block block, Item.Settings settings) { - if (block instanceof ExtendBlock) { - return new BlockItemByExtendBlock1215((ExtendBlock) block, settings); - } - - if (block instanceof ExtendBlockProvider) { - return new BlockItemByExtendBlock1215((ExtendBlockProvider) block, settings); - } - - return new BlockItem(block, settings); - } - - public static BlockItem ofBlock(Block block, CompatibleItemSettings settings) { - return ofBlock(block, settings.build()); - } - - @Deprecated - public static Item of(Item.Settings settings) { - return new Item(settings); - } - - public static Item of(CompatibleItemSettings settings) { - return of(settings.build()); - } - - public static List getAllItems() { - List items = new ArrayList<>(); - for (Item item : Registries.ITEM) { - items.add(item); - } - return items; - } - - public static int getRawId(Item item) { - return Registries.ITEM.getRawId(item); - } - - public static Item fromIndex(int index) { - return Registries.ITEM.get(index); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java deleted file mode 100644 index 5024e1b7a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java +++ /dev/null @@ -1,125 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.v2; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.BlockUtil; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; - -import java.util.ArrayList; -import java.util.List; - -public class BlockUtilV2 { - /** - * Check if the block is in the tag. (MCPitanLib TagKey) - * @param block Block to check. - * @param tagKey TagKey of the tag. - * @return If the block is in the tag. - */ - public static boolean isIn(Block block, TagKey tagKey) { - if (block.getRegistryEntry().isIn(tagKey.getTagKey())) return true; - return tagKey.isOf(block); - } - - /** - * Check if two blocks are equal. - * @param block Block to compare. - * @param block2 Block to compare. - * @return If two blocks are equal. - */ - public static boolean isEqual(Block block, Block block2) { - return block == block2; - } - - /** - * Get all blocks in the tag. - * @param tagKey TagKey of the tag. - * @return List of blocks in the tag. - */ - public static List getBlocks(TagKey tagKey) { - return getBlocks(tagKey, BlockUtil.getAllBlocks()); - } - /** - * Get given the list of blocks in the tag. - * @param tagKey TagKey of the tag. - * @param blocks List of blocks to search. - * @return List of blocks in the tag. - */ - public static List getBlocks(TagKey tagKey, List blocks) { - List result = new ArrayList<>(); - for (Block block : blocks) { - if (!BlockUtil.isIn(block, tagKey)) continue; - result.add(block); - } - return result; - } - - /** - * Get all blocks in the tag. - * @param identifier Identifier of the tag. - * @return List of blocks in the tag. - */ - public static List getBlocks(Identifier identifier) { - return getBlocks((TagKey) TagKey.create(TagKey.Type.BLOCK, identifier)); - } - - /** - * Get given the list of blocks in the tag. - * @param identifier Identifier of the tag. - * @param blocks List of blocks to search. - * @return List of blocks in the tag. - */ - public static List getBlocks(Identifier identifier, List blocks) { - return getBlocks((TagKey) TagKey.create(TagKey.Type.BLOCK, identifier), blocks); - } - - /** - * Get all blocks in the tag. - * @param id String of the tag. - * @return List of blocks in the tag. - */ - public static List getBlocks(String id) { - return getBlocks(IdentifierUtil.id(id)); - } - - /** - * Get given the list of blocks in the tag. - * @param id String of the tag. - * @param blocks List of blocks to search. - * @return List of blocks in the tag. - */ - - public static List getBlocks(String id, List blocks) { - return getBlocks(IdentifierUtil.id(id), blocks); - } - - /** - * Check if the block is in the tag. - * @param block Block to check. - * @param identifier Identifier of the tag. - * @return If the block is in the tag. - */ - public static boolean isBlockInTag(Block block, Identifier identifier) { - return BlockUtil.isIn(block, (TagKey) TagKey.create(TagKey.Type.BLOCK, identifier)); - } - - /** - * Check if the block is in the tag. - * @param block Block to check. - * @param id String of the tag. - * @return If the block is in the tag. - */ - public static boolean isBlockInTag(Block block, String id) { - return isBlockInTag(block, IdentifierUtil.id(id)); - } - - public static Block fromItem(Item item) { - return Block.getBlockFromItem(item); - } - - public static Block fromItem(ItemStack stack) { - return fromItem(stack.getItem()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java deleted file mode 100644 index c24eb0df9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.v2; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -public class CustomNameUtil { - - public static void setCustomName(ItemStack stack, Text name) { - stack.set(DataComponentTypes.CUSTOM_NAME, name); - } - - public static void setCustomName(ItemStack stack, String name) { - setCustomNameFromString(stack, name); - } - - public static void setCustomNameFromString(ItemStack stack, String name) { - setCustomName(stack, TextUtil.literal(name)); - } - - public static void setCustomNameFromTranslatable(ItemStack stack, String key) { - setCustomName(stack, TextUtil.translatable(key)); - } - - public static void setCustomName(ItemStack stack, TextComponent name) { - setCustomName(stack, name.getText()); - } - - public static Text getCustomName(ItemStack stack) { - return stack.get(DataComponentTypes.CUSTOM_NAME); - } - - public static String getCustomNameAsString(ItemStack stack) { - return getCustomName(stack).getString(); - } - - public static TextComponent getCustomNameAsTextComponent(ItemStack stack) { - return new TextComponent(getCustomName(stack)); - } - - public static boolean hasCustomName(ItemStack stack) { - return stack.contains(DataComponentTypes.CUSTOM_NAME); - } - - public static void removeCustomName(ItemStack stack) { - stack.remove(DataComponentTypes.CUSTOM_NAME); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java deleted file mode 100644 index 636e449c7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java +++ /dev/null @@ -1,94 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.v2; - -import net.minecraft.item.Item; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.tag.TagKey; -import net.pitan76.mcpitanlib.api.util.IdentifierUtil; -import net.pitan76.mcpitanlib.api.util.ItemUtil; - -import java.util.ArrayList; -import java.util.List; - -public class ItemUtilV2 { - /** - * Get all items in the tag. - * @param tagKey TagKey of the tag. - * @return List of items in the tag. - */ - public static List getItems(TagKey tagKey) { - return getItems(tagKey, ItemUtil.getAllItems()); - } - - /** - * Get given the list of items in the tag. - * @param tagKey TagKey of the tag. - * @param items List of items to search. - * @return List of items in the tag. - */ - public static List getItems(TagKey tagKey, List items) { - List result = new ArrayList<>(); - for (Item item : items) { - if (!ItemUtil.isIn(item, tagKey)) continue; - result.add(item); - } - return result; - } - - /** - * Get all items in the tag. - * @param identifier Identifier of the tag. - * @return List of items in the tag. - */ - public static List getItems(Identifier identifier) { - return getItems((TagKey) TagKey.create(TagKey.Type.ITEM, identifier)); - } - - /** - * Get given the list of items in the tag. - * @param identifier Identifier of the tag. - * @param items List of items to search. - * @return List of items in the tag. - */ - public static List getItems(Identifier identifier, List items) { - return getItems((TagKey) TagKey.create(TagKey.Type.ITEM, identifier), items); - } - - /** - * Get all items in the tag. - * @param id String of the tag. - * @return List of items in the tag. - */ - public static List getItems(String id) { - return getItems(IdentifierUtil.id(id)); - } - - /** - * Get given the list of items in the tag. - * @param id String of the tag. - * @param items List of items to search. - * @return List of items in the tag. - */ - public static List getItems(String id, List items) { - return getItems(IdentifierUtil.id(id), items); - } - - /** - * Check if the item is in the tag. - * @param item Item to check. - * @param identifier Identifier of the tag. - * @return True if the item is in the tag. - */ - public static boolean isItemInTag(Item item, Identifier identifier) { - return ItemUtil.isIn(item, (TagKey) TagKey.create(TagKey.Type.ITEM, identifier)); - } - - /** - * Check if the item is in the tag. - * @param item Item to check. - * @param id String of the tag. - * @return True if the item is in the tag. - */ - public static boolean isItemInTag(Item item, String id) { - return isItemInTag(item, IdentifierUtil.id(id)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java deleted file mode 100644 index 436192e5d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.world; - -import net.minecraft.server.world.ServerChunkManager; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; - -public class ChunkManagerUtil { - - public static void markForUpdate(ServerChunkManager manager, BlockPos pos) { - markForUpdate(manager, pos.toRaw()); - } - - public static void markForUpdate(ServerChunkManager manager, net.minecraft.util.math.BlockPos pos) { - manager.markForUpdate(pos); - } - - public static void markForUpdate(ServerWorld world, net.minecraft.util.math.BlockPos pos) { - markForUpdate(ServerWorldUtil.getChunkManager(world), pos); - } - - public static void markForUpdate(World world, net.minecraft.util.math.BlockPos pos) { - if (!(world instanceof ServerWorld)) return; - markForUpdate((ServerWorld) world, pos); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java deleted file mode 100644 index 6e1b2166b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.world; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.server.world.ServerChunkManager; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -public class ServerWorldUtil { - public static void spawnParticles(ServerWorld world, ParticleEffect particle, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { - world.spawnParticles(particle, x, y, z, count, velocityX, velocityY, velocityZ, speed); - } - - public static void spawnParticles(ServerWorld world, Player player, ParticleEffect particle, boolean force, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { - if (player.isServer()) { - world.spawnParticles(player.getServerPlayer().get(), particle, force, false, x, y, z, count, velocityX, velocityY, velocityZ, speed); - } - } - - public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity) { - return Block.getDroppedStacks(state, world, pos, blockEntity); - } - - public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntityWrapper blockEntity) { - return getDroppedStacksOnBlock(state, world, pos, blockEntity.get()); - } - - public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack stack) { - return Block.getDroppedStacks(state, world, pos, blockEntity, entity, stack); - } - - public static ServerChunkManager getChunkManager(ServerWorld world) { - return world.getChunkManager(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java deleted file mode 100644 index 22ad43e5f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.world; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; - -public class TickerUtil { - public static void tick(T blockEntity, World world, BlockPos pos, BlockState state) { - if (isTicker(blockEntity)) - ((BlockEntityTicker) blockEntity).tick(world, pos, state, blockEntity); - } - - public static void tick(T blockEntity, World world, BlockPos pos) { - tick(blockEntity, world, pos, WorldUtil.getBlockState(world, pos)); - } - - public static void tick(T blockEntity) { - tick(blockEntity, blockEntity.getWorld(), blockEntity.getPos()); - } - - public static void tick(T entity) { - entity.tick(); - } - - public static boolean isTicker(BlockEntity blockEntity) { - return blockEntity instanceof BlockEntityTicker; - } - - public static void tick(T blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { - tick(blockEntity, world.toMinecraft(), pos.toMinecraft(), state.toMinecraft()); - } - - public static void tick(T blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - tick(blockEntity, world.toMinecraft(), pos.toMinecraft()); - } - - public static void tick(BlockEntityWrapper blockEntity) { - tick(blockEntity.get()); - } - - public static void tick(BlockEntityWrapper blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { - tick(blockEntity.get(), world.toMinecraft(), pos.toMinecraft(), state.toMinecraft()); - } - - public static void tick(BlockEntityWrapper blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - tick(blockEntity.get(), world.toMinecraft(), pos.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java deleted file mode 100644 index 6bf8142a5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.world; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.fluid.Fluid; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldAccess; - -public class WorldAccessUtil extends WorldViewUtil { - - public static void scheduleBlockTick(WorldAccess world, BlockPos pos, Block block, int delay) { - world.scheduleBlockTick(pos, block, delay); - } - - public static void scheduleFluidTick(WorldAccess world, BlockPos pos, Fluid fluid, int delay) { - world.scheduleFluidTick(pos, fluid, delay); - } - - public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state, int flags) { - return world.setBlockState(pos, state, flags); - } - - public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { - return world.setBlockState(pos, state, flags, maxUpdateDepth); - } - - public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state) { - return setBlockState(world, pos, state, 3); - } - - public static BlockState getBlockState(WorldAccess world, BlockPos pos) { - return world.getBlockState(pos); - } - - public static boolean breakBlock(WorldAccess world, BlockPos pos, boolean drop) { - return world.breakBlock(pos, drop); - } - - public static boolean breakBlock(WorldAccess world, BlockPos pos, boolean drop, Entity entity) { - return world.breakBlock(pos, drop, entity); - } - - public static boolean removeBlock(WorldAccess world, BlockPos pos, boolean move) { - return world.removeBlock(pos, move); - } - - public static MinecraftServer getServer(WorldAccess world) { - return world.getServer(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java deleted file mode 100644 index 72dec4165..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java +++ /dev/null @@ -1,104 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.world; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.dimension.DimensionType; -import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; - -import java.util.List; -import java.util.Optional; -import java.util.function.Predicate; - -public class WorldViewUtil { - - public static boolean isClient(WorldView world) { - return world.isClient(); - } - - public static BlockState getBlockState(WorldView world, BlockPos pos) { - return world.getBlockState(pos); - } - - public static Block getBlock(WorldView world, BlockPos pos) { - return getBlockState(world, pos).getBlock(); - } - - public static BlockEntity getBlockEntity(WorldView world, BlockPos pos) { - return world.getBlockEntity(pos); - } - - public static Optional getBlockEntity(WorldView world, BlockPos pos, BlockEntityType type) { - return world.getBlockEntity(pos, type); - } - - public static FluidState getFluidState(WorldView world, BlockPos pos) { - return getBlockState(world, pos).getFluidState(); - } - - public static Fluid getFluid(WorldView world, BlockPos pos) { - return getFluidState(world, pos).getFluid(); - } - - public static int getBottomY(WorldView world) { - return world.getBottomY(); - } - - public static int getTopY(WorldView world) { - return world.getTopYInclusive(); - } - - public static boolean isChunkLoaded(WorldView world, BlockPos pos) { - return world.isChunkLoaded(pos); - } - - public static boolean isRegionLoaded(WorldView world, BlockPos min, BlockPos max) { - return world.isRegionLoaded(min, max); - } - - public static DimensionType getDimensionType(WorldView world) { - return world.getDimension(); - } - - public static boolean isAirBlock(WorldView world, BlockPos pos) { - return getBlockState(world, pos).isAir(); - } - - public static boolean isOpaqueBlock(WorldView world, BlockPos pos) { - return getBlockState(world, pos).isOpaque(); - } - - public static boolean isWater(WorldView world, BlockPos pos) { - return getFluidState(world, pos).isIn(FluidTags.WATER); - } - - public static List getEntitiesByClass(WorldAccess world, Class entityClass, Box box, Predicate predicate) { - return world.getEntitiesByClass(entityClass, box, predicate); - } - - public static List getEntitiesByClass(WorldAccess world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { - return getEntitiesByClass(world, entityClass, box.toMinecraft(), predicate); - } - - public static List getEntitiesByType(WorldAccess world, EntityType entityType, Box box, Predicate predicate) { - return world.getEntitiesByType(entityType, box, predicate); - } - - public static List getEntitiesByType(WorldAccess world, EntityType entityType, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { - return getEntitiesByType(world, entityType, box.toMinecraft(), predicate); - } - - public static List getEntitiesByType(WorldAccess world, EntityTypeWrapper entityType, Box box, Predicate predicate) { - return getEntitiesByType(world, entityType.get(), box, predicate); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java b/common/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java deleted file mode 100644 index 9f8bdd766..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.pitan76.mcpitanlib.api.world; - -import net.minecraft.nbt.NbtCompound; -import net.minecraft.world.PersistentState; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; - -public abstract class CompatiblePersistentState extends PersistentState { - // 1.16 - public CompatiblePersistentState(String key) { - super(); - } - - public CompatiblePersistentState() { - super(); - } - - // 1.16 - @Deprecated - public void readNbt(NbtCompound tag) { - readNbt(new ReadNbtArgs(tag)); - } - - public abstract void readNbt(ReadNbtArgs args); - - public abstract NbtCompound writeNbt(WriteNbtArgs args); - - @Deprecated - @Override - public void markDirty() { - callMarkDirty(); - } - - public void callMarkDirty() { - super.markDirty(); - } - - @Deprecated - @Override - public void setDirty(boolean dirty) { - callSetDirty(dirty); - } - - public void callSetDirty(boolean dirty) { - super.setDirty(dirty); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java b/common/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java deleted file mode 100644 index 865a2694f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.pitan76.mcpitanlib.api.world; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.util.WorldUtil; - -public class ExtendWorld { - public World world; - public ExtendWorld(World world) { - this.world = world; - } - - public boolean isDay() { - return WorldUtil.isDay(world); - } - - public boolean isThundering() { - return WorldUtil.isThundering(world); - } - - public boolean isSkyVisible(BlockPos pos) { - return WorldUtil.isSkyVisible(world, pos); - } - - public boolean isRaining() { - return WorldUtil.isRaining(world); - } - - public boolean hasSkyLight() { - return WorldUtil.hasSkyLight(world); - } - - public boolean isNight() { - return WorldUtil.isNight(world); - } - - public boolean isClient() { - return WorldUtil.isClient(world); - } - - public boolean isServer() { - return WorldUtil.isServer(world); - } - - public World getMinecraftWorld() { - return world; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java b/common/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java deleted file mode 100644 index 0386ac276..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java +++ /dev/null @@ -1,4 +0,0 @@ -package net.pitan76.mcpitanlib.core; - -public class Dummy { -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java b/common/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java deleted file mode 100644 index c93a48bcd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java +++ /dev/null @@ -1,73 +0,0 @@ -package net.pitan76.mcpitanlib.core.command; - -import net.minecraft.server.command.ServerCommandSource; - -public class CommandResult { - private boolean isSuccess = false; - private String message = ""; - private int result = 0; - private ErrorType errorType = ErrorType.NONE; - private ServerCommandSource source; - - public CommandResult() { - - } - - public CommandResult(boolean isSuccess, String message) { - this.isSuccess = isSuccess; - this.message = message; - } - - public void setResult(int result) { - this.result = result; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setSuccess(boolean success) { - isSuccess = success; - } - - public boolean isSuccess() { - return isSuccess; - } - - public String getMessage() { - return message; - } - - public int getResult() { - return result; - } - - public void setErrorType(ErrorType errorType) { - this.errorType = errorType; - } - - public ErrorType getErrorType() { - return errorType; - } - - public void setSource(ServerCommandSource source) { - this.source = source; - } - - public ServerCommandSource getSource() { - return source; - } - - public boolean hasError() { - return errorType != ErrorType.NONE; - } - - public enum ErrorType { - NONE, - COMMAND_SYNTAX_ERROR, - COMMAND_NOT_FOUND, - COMMAND_PERMISSION_ERROR, - COMMAND_UNKNOWN_ERROR, - RUNTIME_ERROR - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java b/common/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java deleted file mode 100644 index d6d85643f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.pitan76.mcpitanlib.core.datafixer; - -public class Pair { - private A a; - private B b; - - public Pair(A a, B b) { - this.a = a; - this.b = b; - } - - public A getA() { - return a; - } - - public B getB() { - return b; - } - - public void setA(A a) { - this.a = a; - } - - public void setB(B b) { - this.b = b; - } - - public static Pair of(A a, B b) { - return new Pair<>(a, b); - } - - public static Pair of() { - return new Pair<>(null, null); - } - - public static Pair ofA(A a) { - return new Pair<>(a, null); - } - - public static Pair ofB(B b) { - return new Pair<>(null, b); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java b/common/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java deleted file mode 100644 index ccf22d47d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java +++ /dev/null @@ -1,198 +0,0 @@ -package net.pitan76.mcpitanlib.core.mc1216; - -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ErrorReporter; -import net.pitan76.mcpitanlib.api.nbt.NbtTypeBytes; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.NbtUtil; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -public class NbtDataConverter { - public static void nbt2writeData(NbtCompound nbt, WriteView view) { - if (nbt == null || view == null) return; - - List keys = new ArrayList<>(nbt.getKeys()); - for (String key : keys) { - NbtElement value = nbt.get(key); - if (value == null) continue; - - byte type = value.getType(); - view.putByte("__nbttype_" + key + "__", type); - - switch (type) { - case NbtTypeBytes.BYTE: - Optional optional = value.asByte(); - if (optional.isEmpty()) continue; - view.putByte(key, optional.get()); - break; - case NbtTypeBytes.SHORT: - Optional optionalShort = value.asShort(); - if (optionalShort.isEmpty()) continue; - view.putShort(key, optionalShort.get()); - break; - case NbtTypeBytes.INT: - Optional optionalInt = value.asInt(); - if (optionalInt.isEmpty()) continue; - view.putInt(key, optionalInt.get()); - break; - case NbtTypeBytes.LONG: - Optional optionalLong = value.asLong(); - if (optionalLong.isEmpty()) continue; - view.putLong(key, optionalLong.get()); - break; - case NbtTypeBytes.FLOAT: - Optional optionalFloat = value.asFloat(); - if (optionalFloat.isEmpty()) continue; - view.putFloat(key, optionalFloat.get()); - break; - case NbtTypeBytes.DOUBLE: - Optional optionalDouble = value.asDouble(); - if (optionalDouble.isEmpty()) continue; - view.putDouble(key, optionalDouble.get()); - break; - case NbtTypeBytes.STRING: - Optional optionalString = value.asString(); - if (optionalString.isEmpty()) continue; - view.putString(key, optionalString.get()); - break; - case NbtTypeBytes.BYTE_ARRAY: - Optional optionalByteArray = value.asByteArray(); - if (optionalByteArray.isEmpty()) continue; - byte[] byteArray = optionalByteArray.get(); - int[] intArray = new int[byteArray.length]; - for (int i = 0; i < byteArray.length; i++) - intArray[i] = byteArray[i]; - view.putIntArray(key, intArray); - break; - case NbtTypeBytes.INT_ARRAY: - Optional optionalIntArray = value.asIntArray(); - if (optionalIntArray.isEmpty()) continue; - view.putIntArray(key, optionalIntArray.get()); - break; - case NbtTypeBytes.LONG_ARRAY: - Optional optionalLongArray = value.asLongArray(); - if (optionalLongArray.isEmpty()) continue; - long[] longArray = optionalLongArray.get(); - int[] longIntArray = new int[longArray.length]; - for (int i = 0; i < longArray.length; i++) - longIntArray[i] = (int) (longArray[i] & 0xFFFFFFFFL); - view.putIntArray(key, longIntArray); - break; - case NbtTypeBytes.COMPOUND: - Optional optionalCompound = value.asCompound(); - if (optionalCompound.isEmpty()) continue; - NbtCompound nbt2 = optionalCompound.get(); - - //System.out.println("NbtDataConverter nbt(" + key + "): " + nbt2); - - view.put(key, NbtCompound.CODEC, nbt2); - break; - } - } - - view.putString("__all_keys__", String.join(",", keys)); - } - - public static void data2nbt(ReadView view, NbtCompound nbt) { - if (view == null || nbt == null) return; - - // ReadViewだとgetKeys()がないので__all_keys__からキーを取得する - String keysStr = view.getString("__all_keys__", ""); - if (keysStr.isEmpty()) return; - String[] keys = keysStr.split(","); - for (String key : keys) { - if (key == null || key.isEmpty()) continue; - - byte type = view.getByte("__nbttype_" + key + "__", (byte) -1); - if (type == -1) continue; - - switch (type) { - case NbtTypeBytes.BYTE: - nbt.putByte(key, view.getByte(key, (byte) 0)); - break; - case NbtTypeBytes.SHORT: - nbt.putShort(key, (short) view.getShort(key, (short) 0)); - break; - case NbtTypeBytes.INT: - nbt.putInt(key, view.getInt(key, 0)); - break; - case NbtTypeBytes.LONG: - nbt.putLong(key, view.getLong(key, 0)); - break; - case NbtTypeBytes.FLOAT: - nbt.putFloat(key, view.getFloat(key, 0)); - break; - case NbtTypeBytes.DOUBLE: - nbt.putDouble(key, view.getDouble(key, 0)); - break; - case NbtTypeBytes.STRING: - nbt.putString(key, view.getString(key, "")); - break; - case NbtTypeBytes.BYTE_ARRAY: - int[] intArray = view.getOptionalIntArray(key).get(); - byte[] byteArray = new byte[intArray.length]; - for (int i = 0; i < intArray.length; i++) - byteArray[i] = (byte) intArray[i]; - nbt.putByteArray(key, byteArray); - break; - case NbtTypeBytes.INT_ARRAY: - nbt.putIntArray(key, view.getOptionalIntArray(key).get()); - break; - case NbtTypeBytes.LONG_ARRAY: - int[] longIntArray = view.getOptionalIntArray(key).get(); - long[] longArray = new long[longIntArray.length]; - for (int i = 0; i < longIntArray.length; i++) - longArray[i] = longIntArray[i] & 0xFFFFFFFFL; - nbt.putLongArray(key, longArray); - break; - case NbtTypeBytes.COMPOUND: - NbtCompound nbt2 = view.read(key, NbtCompound.CODEC).get(); - nbt.put(key, nbt2); - break; - default: - nbt.putString(key, "Unsupported NBT type: " + type); - break; - } - } - } - - public static void data2nbt(WriteView view, NbtCompound nbt) { - if (view == null || nbt == null) return; - - if (view instanceof NbtWriteView) { - //System.out.println("data2nbt(): " + ((NbtWriteView) view).getNbt()); - NbtUtil.copyFrom(((NbtWriteView) view).getNbt(), nbt); - } - } - - public static WriteView nbt2writeData(NbtCompound nbt, CompatRegistryLookup registryLookup) { - WriteView view = NbtWriteView.create(ErrorReporter.EMPTY); - nbt2writeData(nbt, view); - return view; - } - - public static ReadView nbt2readData(NbtCompound nbt, CompatRegistryLookup registryLookup) { - if (nbt == null) nbt = NbtUtil.create(); - return NbtReadView.create(ErrorReporter.EMPTY, registryLookup.getRegistryLookup(), nbt); - } - - public static NbtCompound data2nbt(ReadView view) { - NbtCompound nbt = new NbtCompound(); - data2nbt(view, nbt); - return nbt; - } - - public static NbtCompound data2nbt(WriteView view) { - NbtCompound nbt = new NbtCompound(); - data2nbt(view, nbt); - return nbt; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java b/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java deleted file mode 100644 index ca4b437c2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java +++ /dev/null @@ -1,67 +0,0 @@ -package net.pitan76.mcpitanlib.core.network; - -import io.netty.buffer.ByteBufUtil; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.network.packet.CustomPayload; -import net.minecraft.util.Identifier; - -import java.util.HashMap; -import java.util.Map; - -public class BufPayload implements CustomPayload { - - public final Id ID; - - public BufPayload(byte[] data, Id id) { - this.data = data; - this.ID = id; - - createCodec(id); - } - - public BufPayload(PacketByteBuf buf, Id id) { - this(ByteBufUtil.getBytes(buf), id); - } - - public BufPayload(PacketByteBuf buf, Identifier id) { - this(ByteBufUtil.getBytes(buf), id(id)); - } - - public byte[] data; - - public byte[] getData() { - return data; - } - - private static final Map, PacketCodec> CODEC_CACHE = new HashMap<>(); - - public static PacketCodec getCodec(Id id) { - if (CODEC_CACHE.containsKey(id)) return CODEC_CACHE.get(id); - - return createCodec(id); - } - - private static PacketCodec createCodec(Id id) { - PacketCodec codec = PacketCodecs.BYTE_ARRAY.xmap((data) -> new BufPayload(data, id), BufPayload::getData).cast(); - CODEC_CACHE.put(id, codec); - return codec; - } - - @Override - public Id getId() { - return ID; - } - - public static Id id(Identifier id) { - if (CODEC_CACHE.isEmpty()) return new Id<>(id); - - for (Id key : CODEC_CACHE.keySet()) { - if (key.id().equals(id)) - return key; - } - - return new Id<>(id); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java b/common/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java deleted file mode 100644 index 00902072b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.core.player; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.entity.Player; - -public class ItemCooldown { - public final Player player; - - public ItemCooldown(Player player) { - this.player = player; - } - - public boolean isCoolingDown(Item item) { - for (ItemStack stack : player.getMain()) { - if (stack.getItem() == item) { - return player.getItemCooldownManager().isCoolingDown(stack); - } - } - - return false; - } - - public void set(Item item, int duration) { - for (ItemStack stack : player.getMain()) { - if (stack.getItem() == item) { - player.getItemCooldownManager().set(stack, duration); - } - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java deleted file mode 100644 index c3a3fade1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.core.registry; - -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public class FuelRegistry { - private FuelRegistry() { - - } - - public static void register(int time, ItemConvertible... item) { - dev.architectury.registry.fuel.FuelRegistry.register(time, item); - } - - @Deprecated - public static int get(ItemStack stack) { - return 0; - } - - public static int get(World world, ItemStack stack) { - return world.getFuelRegistry().getFuelTicks(stack); - } - - public static boolean isFuel(World world, ItemStack stack) { - return world.getFuelRegistry().isFuel(stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java deleted file mode 100644 index 526c44366..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java +++ /dev/null @@ -1,95 +0,0 @@ -package net.pitan76.mcpitanlib.core.registry; - -import com.google.common.base.Suppliers; -import dev.architectury.registry.registries.Registrar; -import dev.architectury.registry.registries.RegistrarManager; -import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.particle.ParticleType; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.Identifier; - -import java.util.function.Supplier; - -@Deprecated -public class MCPLRegistry { - - public Supplier REGISTRIES; - - public Registrar ITEMS; - public Registrar BLOCKS; - public Registrar> SCREEN_HANDLER_TYPE; - public Registrar> BLOCK_ENTITY_TYPE; - public Registrar> ENTITY_TYPE; - public Registrar SOUND_EVENT; - public Registrar FLUID; - public Registrar> PARTICLE_TYPE; - public Registrar STATUS_EFFECT; - - public MCPLRegistry(String MOD_ID) { - REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(MOD_ID)); - - ITEMS = REGISTRIES.get().get(RegistryKeys.ITEM); - BLOCKS = REGISTRIES.get().get(RegistryKeys.BLOCK); - SCREEN_HANDLER_TYPE = REGISTRIES.get().get(RegistryKeys.SCREEN_HANDLER); - BLOCK_ENTITY_TYPE = REGISTRIES.get().get(RegistryKeys.BLOCK_ENTITY_TYPE); - ENTITY_TYPE = REGISTRIES.get().get(RegistryKeys.ENTITY_TYPE); - SOUND_EVENT = REGISTRIES.get().get(RegistryKeys.SOUND_EVENT); - FLUID = REGISTRIES.get().get(RegistryKeys.FLUID); - PARTICLE_TYPE = REGISTRIES.get().get(RegistryKeys.PARTICLE_TYPE); - STATUS_EFFECT = REGISTRIES.get().get(RegistryKeys.STATUS_EFFECT); - } - - public RegistrySupplier registryItem(Identifier id, Supplier supplier) { - return ITEMS.register(id, supplier); - } - - public RegistrySupplier registryBlock(Identifier id, Supplier supplier) { - return BLOCKS.register(id, supplier); - } - - public RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { - return SCREEN_HANDLER_TYPE.register(id, supplier); - } - - public RegistrySupplier> registryBlockEntityType(Identifier id, Supplier> supplier) { - return BLOCK_ENTITY_TYPE.register(id, supplier); - } - - public RegistrySupplier> registryEntityType(Identifier id, Supplier> supplier) { - return ENTITY_TYPE.register(id, supplier); - } - - public RegistrySupplier registrySoundEvent(Identifier id, Supplier supplier) { - return SOUND_EVENT.register(id, supplier); - } - - public RegistrySupplier registryFluid(Identifier id, Supplier supplier) { - return FLUID.register(id, supplier); - } - - public RegistrySupplier> registryParticleType(Identifier id, Supplier> supplier) { - return PARTICLE_TYPE.register(id, supplier); - } - - public RegistrySupplier registryEnchantment(Identifier id, Supplier supplier) { - return null; - //return ENCHANTMENT.register(id, supplier); - } - - public RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { - return STATUS_EFFECT.register(id, supplier); - } - - public void allRegister1_16() { - - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java deleted file mode 100644 index 52a1d7fca..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.pitan76.mcpitanlib.core.registry; - -import dev.architectury.registry.registries.DeferredRegister; -import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; - -@Deprecated -public class MCPLRegistry1_20 { - @Deprecated - public static final Map> REGISTRY_SUPPLIER_ITEM_GROUP_CACHE = new HashMap<>(); - - private final MCPLRegistry mcplr; - - protected DeferredRegister ITEM_GROUP; - - public MCPLRegistry1_20(MCPLRegistry mcplr, String MOD_ID) { - this.mcplr = mcplr; - ITEM_GROUP = DeferredRegister.create(MOD_ID, RegistryKeys.ITEM_GROUP); - } - - public void register() { - ITEM_GROUP.register(); - } - - public RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { - RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); - REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); - return itemGroup; - } - - public RegistrySupplier registryItemGroup(Identifier id, CreativeTabBuilder builder) { - RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); - REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); - return itemGroup; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java deleted file mode 100644 index 463bd77d2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.pitan76.mcpitanlib.core.registry; - -import dev.architectury.registry.registries.DeferredRegister; -import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.component.ComponentType; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; - -import java.util.function.Supplier; - -@Deprecated -public class MCPLRegistry1_21 { - - public final DeferredRegister> DATA_COMPONENT_TYPE; - public final DeferredRegister TICKET_TYPE; - - private final MCPLRegistry mcplr; - - public MCPLRegistry1_21(MCPLRegistry mcplr, String MOD_ID) { - this.mcplr = mcplr; - DATA_COMPONENT_TYPE = DeferredRegister.create(MOD_ID, RegistryKeys.DATA_COMPONENT_TYPE); - TICKET_TYPE = DeferredRegister.create(MOD_ID, RegistryKeys.TICKET_TYPE); - } - - public void register() { - DATA_COMPONENT_TYPE.register(); - TICKET_TYPE.register(); - } - - public RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { - return DATA_COMPONENT_TYPE.register(id, supplier); - } - - public Supplier> registryChunkTicketType(Identifier id, Supplier> supplier) { - RegistrySupplier ticketType = TICKET_TYPE.register(id, () -> supplier.get().getRaw()); - return () -> ChunkTicketType.of(ticketType.get()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java b/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java deleted file mode 100644 index a5a70af11..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.pitan76.mcpitanlib.core.serialization; - -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.pitan76.mcpitanlib.api.block.CompatStairsBlock; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.core.serialization.codecs.CompatBlockMapCodecUtil; - -import java.util.function.BiFunction; -import java.util.function.Function; - -public class CompatMapCodec { - @Deprecated - public MapCodec codec; - - @Deprecated - public CompatMapCodec(MapCodec codec) { - this.codec = codec; - } - - @Deprecated - public static CompatMapCodec of(MapCodec codec) { - return new CompatMapCodec<>(codec); - } - - public CompatMapCodec() { - - } - - public static CompatMapCodec of() { - return new CompatMapCodec<>(); - } - - @Deprecated - public MapCodec getCodec() { - return codec; - } - - public static RecordCodecBuilder createSettingsCodec() { - return AbstractBlock.Settings.CODEC.fieldOf("properties").forGetter(AbstractBlock::getSettings); - } - - public static CompatMapCodec createCodec(Function blockFromSettings) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group(createSettingsCodec()).apply(instance, blockFromSettings))); - } - - @Deprecated - public static RecordCodecBuilder createCompatSettingsCodec() { - return net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(ExtendBlock::getCompatSettings); - } - - @Deprecated - public static CompatMapCodec createCodecOfExtendBlock(Function blockFromSettings) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group(createCompatSettingsCodec()).apply(instance, blockFromSettings))); - } - - public static RecordCodecBuilder createCompatSettingsV2Codec() { - return CompatBlockMapCodecUtil.createSettingsCodec(); - } - - public static CompatMapCodec createCodecOfCompatBlock(Function blockFromSettings) { - return CompatBlockMapCodecUtil.createCodec(blockFromSettings); - } - - public static CompatMapCodec createCodecOfCompatStairsBlock(BiFunction createFunction) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( - BlockState.CODEC.fieldOf("base_state").forGetter(CompatStairsBlock::getBaseBlockState), - net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatStairsBlock::getCompatSettings) - ).apply(instance, createFunction))); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java deleted file mode 100644 index 12d5880b6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.core.serialization.codecs; - -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.pitan76.mcpitanlib.api.block.CompatChestBlock; -import net.pitan76.mcpitanlib.api.block.CompatPillarBlock; -import net.pitan76.mcpitanlib.api.block.CompatSlabBlock; -import net.pitan76.mcpitanlib.api.block.CompatStairsBlock; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; - -import java.util.function.BiFunction; -import java.util.function.Function; - -public class CompatBlockMapCodecUtil { - - @Deprecated - protected static CompatMapCodec of(MapCodec codec) { - return new CompatMapCodec<>(codec); - } - - public static RecordCodecBuilder createSettingsCodec() { - return CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatBlock::getCompatSettings); - } - - public static CompatMapCodec createCodec(Function blockFromSettings) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group(createSettingsCodec()).apply(instance, blockFromSettings))); - } - - public static CompatMapCodec createCodecOfStairsBlock(BiFunction createFunction) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( - BlockState.CODEC.fieldOf("base_state").forGetter(CompatStairsBlock::getBaseBlockState), - CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatStairsBlock::getCompatSettings) - ).apply(instance, createFunction))); - } - - public static CompatMapCodec createCodecOfSlabBlock(Function createFunction) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( - CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatSlabBlock::getCompatSettings) - ).apply(instance, createFunction))); - } - - public static CompatMapCodec createCodecOfPillarBlock(Function createFunction) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( - CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatPillarBlock::getCompatSettings) - ).apply(instance, createFunction))); - } - - public static CompatMapCodec createCodecOfChestBlock(Function createFunction) { - return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( - CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatChestBlock::getCompatSettings) - ).apply(instance, createFunction))); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java b/common/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java deleted file mode 100644 index 55e1cffd3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.debug; - -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.v2.CompatItem; - -import static net.pitan76.mcpitanlib.MCPitanLib.*; - -/** - * A tool for debugging. - * Example of condition: item instance DebugTool - */ -public class DebugTool extends CompatItem { - - public static CompatibleItemSettings defaultSettings = CompatibleItemSettings.of(compatId("debug_tool")); - - public DebugTool() { - super(defaultSettings); - } - - public static void debug(String message) { - System.out.println(message); - } - - public static void register() { - registry.registerItem(id("debug_tool"), DebugTool::new); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java deleted file mode 100644 index c928bb1f1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.pitan76.mcpitanlib.guilib; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; -import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; -import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; -import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; -import net.pitan76.mcpitanlib.guilib.api.screen.SimpleContainerGuiScreen; - -import java.util.function.Supplier; - -public class GuiRegistry { - public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder.Factory factory) { - return register(registry, id, new SimpleScreenHandlerTypeBuilder<>(factory)); - } - - public static Supplier> register(CompatRegistryV2 registry, CompatIdentifier id, ScreenHandlerType type) { - return registry.registerScreenHandlerTypeSavingGenerics(id, () -> type); - } - - @Environment(EnvType.CLIENT) - public static > void register(String id, ScreenHandlerType type, CompatRegistryClient.ScreenFactory factory) { - CompatRegistryClient.registerScreen(id, type, factory); - } - - @Environment(EnvType.CLIENT) - public static void registerSimpleContainerGui(String id, ScreenHandlerType type) { - CompatRegistryClient.registerScreen(id, type, SimpleContainerGuiScreen::new); - } - - public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { - return registry.registerScreenHandlerType(id, builder); - } - - public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { - return registry.registerScreenHandlerType(id, builder); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java deleted file mode 100644 index fad6d9331..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.pitan76.mcpitanlib.guilib; - -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class GuiTextures { - public static CompatIdentifier GUI_PARTS = CompatIdentifier.of("mplguilib", "textures/container/gui_parts.png"); - public static CompatIdentifier BASE_FURNACE_BACKGROUND = CompatIdentifier.of("mplguilib", "textures/container/base_furnace.png"); - public static CompatIdentifier BASE_BACKGROUND = CompatIdentifier.of("mplguilib", "textures/container/base.png"); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java deleted file mode 100644 index 4d9bc3bad..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.pitan76.mcpitanlib.guilib; - -import net.pitan76.mcpitanlib.api.network.v2.ClientNetworking; -import net.pitan76.mcpitanlib.guilib.api.container.ExtendedBlockEntityContainerGui; - -import static net.pitan76.mcpitanlib.guilib.api.NetworkDefines.SYNC_GUI_WITH_TILE; - -public class MGLClientNetworks { - - public static boolean isInitialized = false; - - public static void init() { - if (isInitialized) return; - isInitialized = true; - - ClientNetworking.registerReceiver(SYNC_GUI_WITH_TILE, (e) -> { - if (e.player.getCurrentScreenHandler() instanceof ExtendedBlockEntityContainerGui) { - ExtendedBlockEntityContainerGui gui = (ExtendedBlockEntityContainerGui) e.player.getCurrentScreenHandler(); - gui.receiveSync(e.buf); - } - }); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java deleted file mode 100644 index f3122c706..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.guilib; - -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.PlatformUtil; - -public class MPLGuiLib { - public static final String MOD_ID = "mplguilib"; - public static final String MOD_NAME = "MPL GuiLib"; - - public static void init() { - if (PlatformUtil.isClient()) - MGLClientNetworks.init(); - } - - // ---- - /** - * @param path The path of the id - * @return The id - */ - public static CompatIdentifier _id(String path) { - return CompatIdentifier.of(MOD_ID, path); - } - - public String getId() { - return MOD_ID; - } - - public String getName() { - return MOD_NAME; - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java deleted file mode 100644 index 2e002e555..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api; - -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.guilib.GuiTextures; - -public interface IScreenInfo { - default int getScreenBackgroundWidth() { - return getScreenWidth(); - } - - default int getScreenBackgroundHeight() { - return getScreenHeight(); - } - - int getScreenWidth(); - - int getScreenHeight(); - - default int getScreenX() { - return -1; - } - - default int getScreenY() { - return -1; - } - - default int getScreenTitleX() { - return -1; - } - - default int getScreenTitleY() { - return -1; - } - - default CompatIdentifier getTexture() { - return GuiTextures.BASE_BACKGROUND; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java deleted file mode 100644 index 8ff931938..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api; - -public interface ISimpleScreenInfo extends IScreenInfo { - - @Override - default int getScreenWidth() { - return 176; - } - - @Override - default int getScreenHeight() { - return 166; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java deleted file mode 100644 index c0631c9ec..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api; - -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.guilib.MPLGuiLib; - -public class NetworkDefines { - public static CompatIdentifier SYNC_GUI_WITH_TILE = MPLGuiLib._id("sync_gui_with_tile"); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java deleted file mode 100644 index f6e88a29e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.block.entity; - -import net.minecraft.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; -import net.pitan76.mcpitanlib.api.gui.inventory.sided.ChestStyleSidedInventory; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; -import net.pitan76.mcpitanlib.api.util.InventoryUtil; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; - -public abstract class BlockEntityWithContainer extends CompatBlockEntity implements IInventory, ChestStyleSidedInventory { - - private final ItemStackList inventory = ItemStackList.ofSize(getDefaultInvSize(), ItemStackUtil.empty()); - - public BlockEntityWithContainer(BlockEntityType type, TileCreateEvent e) { - super(type, e); - } - - public abstract int getDefaultInvSize(); - - @Override - public void writeNbt(WriteNbtArgs args) { - super.writeNbt(args); - InventoryUtil.writeNbt(args, inventory); - } - - @Override - public void readNbt(ReadNbtArgs args) { - super.readNbt(args); - InventoryUtil.readNbt(args, inventory); - } - - @Override - public ItemStackList getItems() { - return inventory; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java deleted file mode 100644 index dfa884739..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.block.entity; - -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; -import net.pitan76.mcpitanlib.api.event.container.factory.ExtraDataArgs; -import net.pitan76.mcpitanlib.api.event.tile.TileTickEvent; -import net.pitan76.mcpitanlib.api.gui.v2.ExtendedScreenHandlerFactory; -import net.pitan76.mcpitanlib.api.network.PacketByteUtil; -import net.pitan76.mcpitanlib.api.network.v2.ServerNetworking; -import net.pitan76.mcpitanlib.api.tile.ExtendBlockEntityTicker; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.guilib.api.container.ExtendedBlockEntityContainerGui; - -import java.util.List; -import java.util.Objects; - -import static net.pitan76.mcpitanlib.guilib.api.NetworkDefines.SYNC_GUI_WITH_TILE; - -public abstract class ExtendedBlockEntityWithContainer extends BlockEntityWithContainer implements ExtendedScreenHandlerFactory, ExtendBlockEntityTicker { - - public ExtendedBlockEntityWithContainer(BlockEntityType type, TileCreateEvent e) { - super(type, e); - } - - @Override - public void tick(TileTickEvent e) { - if (isClient()) return; - - List players = WorldUtil.getPlayers(Objects.requireNonNull(getWorld())); - for (Player player : players) { - if (player.hasNetworkHandler() && player.getCurrentScreenHandler() instanceof ExtendedBlockEntityContainerGui && ((ExtendedBlockEntityContainerGui) player.getCurrentScreenHandler()).blockEntity == this ) { - PacketByteBuf buf = PacketByteUtil.create(); - sync(player, buf); - ServerNetworking.send(player, SYNC_GUI_WITH_TILE, buf); - } - } - } - - @Override - public Text getDisplayName(DisplayNameArgs args) { - if (getCachedState() == null) - return TextUtil.of("unknown"); - - return getCachedState().getBlock().getName(); - } - - @Override - public void writeExtraData(ExtraDataArgs args) { - PacketByteUtil.writeBlockPos(args.buf, getPos()); - sync(args.getCompatPlayer(), args.buf); - } - - public abstract void sync(Player player, PacketByteBuf buf); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java deleted file mode 100644 index 54445322c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.container; - -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; - -public abstract class BlockEntityContainerGui extends ContainerGui implements ISimpleScreenInfo { - protected BlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e) { - super(type, e); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java deleted file mode 100644 index 04dcc52b3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java +++ /dev/null @@ -1,66 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.container; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.slot.Slot; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.guilib.api.IScreenInfo; - -import java.util.ArrayList; -import java.util.List; - -public abstract class ContainerGui extends SimpleScreenHandler implements IScreenInfo { - - private final List INVENTORIES = new ArrayList<>(); - - protected ContainerGui(ScreenHandlerType type, int syncId) { - super(type, syncId); - } - - protected ContainerGui(ScreenHandlerType type, CreateMenuEvent e) { - super(type, e); - } - - @Override - public boolean canUse(Player player) { - return true; - } - - @Override - protected Slot addSlot(Slot slot) { - if (slot.inventory instanceof Inventory && !INVENTORIES.contains(slot.inventory)) - INVENTORIES.add(slot.inventory); - - return super.addSlot(slot); - } - - public int playerMainInventoryX = 8; - public int playerMainInventoryY = 84; - - public int playerHotbarX = 8; - public int playerHotbarY = 142; - - @Override - protected List addPlayerMainInventorySlots(PlayerInventory inventory, int x, int y) { - playerMainInventoryX = x; - playerMainInventoryY = y; - - return super.addPlayerMainInventorySlots(inventory, x, y); - } - - @Override - protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int y) { - playerHotbarX = x; - playerHotbarY = y; - - return super.addPlayerHotbarSlots(inventory, x, y); - } - - @Override - public void close(Player player) { - INVENTORIES.forEach((inv -> inv.onClose(player.getEntity()))); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java deleted file mode 100644 index 496c046c6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.container; - -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; - -public abstract class ExtendedBlockEntityContainerGui extends BlockEntityContainerGui implements ISimpleScreenInfo { - - public T blockEntity; - - public ExtendedBlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e, PacketByteBuf buf) { - this(type, e); - - if (buf == null) return; - - Player player = e.getPlayer(); - World world = player.getWorld(); - BlockPos pos = buf.readBlockPos(); - - BlockEntity blockEntity = WorldUtil.getBlockEntity(world, pos); - if (blockEntity instanceof CompatBlockEntity) - this.blockEntity = (T) blockEntity; - - receiveSync(buf); - } - - protected ExtendedBlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e) { - super(type, e); - } - - public abstract void receiveSync(PacketByteBuf buf); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java deleted file mode 100644 index 46e5fb903..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.container; - -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; - -public abstract class SimpleContainerGui extends ContainerGui implements ISimpleScreenInfo { - - protected SimpleContainerGui(ScreenHandlerType type, int syncId) { - super(type, syncId); - } - - protected SimpleContainerGui(ScreenHandlerType type, CreateMenuEvent e) { - super(type, e); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java deleted file mode 100644 index facc1262a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.render; - -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.client.RenderUtil.RendererUtil; -import net.pitan76.mcpitanlib.guilib.GuiTextures; - -public class PartsRenderer { - public static void drawBottom2TopProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { - RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); - - if (percentage > 0) { - int progress = (int) ((double) percentage / 100 * height); - RendererUtil.drawTexture(drawObjectDM, texture, x, y + height - progress, u2, v2 + height - progress, width, progress); - } - } - - public static void drawBottom2TopProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { - int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; - drawBottom2TopProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); - } - - public static void drawTop2BottomProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { - RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); - - if (percentage > 0) { - int progress = (int) ((double) percentage / 100 * height); - RendererUtil.drawTexture(drawObjectDM, texture, x, y, u2, v2, width, progress); - } - } - - public static void drawTop2BottomProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { - int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; - drawTop2BottomProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); - } - - public static void drawLeft2RightProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { - RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); - - if (percentage > 0) { - int progress = (int) ((double) percentage / 100 * width); - RendererUtil.drawTexture(drawObjectDM, texture, x, y, u2, v2, progress, height); - } - } - - public static void drawLeft2RightProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { - int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; - drawLeft2RightProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); - } - - public static void drawRight2LeftProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { - RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); - - if (percentage > 0) { - int progress = (int) ((double) percentage / 100 * width); - RendererUtil.drawTexture(drawObjectDM, texture, x + width - progress, y, u2 + width - progress, v2, progress, height); - } - } - - public static void drawRight2LeftProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { - int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; - drawRight2LeftProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); - } - - public static void drawBurningBar(DrawObjectDM drawObjectDM, int x, int y, int burnTime, int maxBurnTime) { - drawBottom2TopProgressBar(drawObjectDM, x, y, 0, 168, 0, 184, 16, 14, burnTime, maxBurnTime, GuiTextures.BASE_FURNACE_BACKGROUND); - } - - public static void drawHorizontalArrowBar(DrawObjectDM drawObjectDM, int x, int y, double value, double maxValue) { - drawLeft2RightProgressBar(drawObjectDM, x, y, 0, 168, 16, 184, 24, 16, value, maxValue, GuiTextures.BASE_FURNACE_BACKGROUND); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java deleted file mode 100644 index 0c23c9e94..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.render; - -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; -import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; -import net.pitan76.mcpitanlib.guilib.GuiTextures; - -public class SlotRenderer { - - public static void drawSlot(DrawObjectDM drawObjectDM, Slot slot, int x, int y) { - RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x + slot.x - 1, y + slot.y - 1, 0, 0, 18, 18); - } - - public static void drawSlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { - ScreenHandlerUtil.getSlots(handler).forEach((slot) -> drawSlot(drawObjectDM, slot, x, y)); - } - - public static void drawPlayerMainInventorySlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { - RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x, y, 0, 32, 162, 54); - } - - public static void drawPlayerHotbarSlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { - RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x, y, 0, 90, 162, 18); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java deleted file mode 100644 index 70b6158eb..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java +++ /dev/null @@ -1,86 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.screen; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; -import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawForegroundArgs; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; -import net.pitan76.mcpitanlib.guilib.GuiTextures; -import net.pitan76.mcpitanlib.guilib.api.container.ContainerGui; -import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; - -public class ContainerGuiScreen extends CompatInventoryScreen { - public ContainerGuiScreen(T handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - setBackgroundWidth(handler.getScreenBackgroundWidth()); - setBackgroundHeight(handler.getScreenBackgroundHeight()); - - if (handler.getScreenX() != -1) - setX(handler.getScreenX()); - if (handler.getScreenY() != -1) - setY(handler.getScreenY()); - - if (handler.getScreenTitleX() != -1) - setTitleX(handler.getScreenTitleX()); - if (handler.getScreenTitleY() != -1) - setTitleY(handler.getScreenTitleY()); - } - - @Override - public void initOverride() { - super.initOverride(); - } - - @Override - public void drawBackgroundOverride(DrawBackgroundArgs args) { - super.drawBackgroundOverride(args); - - if (handler.hasMainInventory && !containPlayerInventoryInBackground()) - drawPlayerMainInventorySlots(args.drawObjectDM); - - if (handler.hasHotbar && !containPlayerInventoryInBackground()) - drawPlayerHotbarSlots(args.drawObjectDM); - - drawSlots(args.drawObjectDM); - } - - @Override - protected void drawForegroundOverride(DrawForegroundArgs args) { - if (!handler.hasMainInventory && !containPlayerInventoryInBackground()) { - drawText(args.drawObjectDM, title, titleX, titleY); - return; - } - - super.drawForegroundOverride(args); - } - - @Override - public CompatIdentifier getCompatTexture() { - return handler.getTexture(); - } - - public void drawPlayerMainInventorySlots(DrawObjectDM drawObjectDM) { - SlotRenderer.drawPlayerMainInventorySlots(drawObjectDM, handler, x + handler.playerMainInventoryX - 1, y + handler.playerMainInventoryY - 1); - } - - public void drawPlayerHotbarSlots(DrawObjectDM drawObjectDM) { - SlotRenderer.drawPlayerHotbarSlots(drawObjectDM, handler, x + handler.playerHotbarX - 1, y + handler.playerHotbarY - 1); - } - - public boolean containPlayerInventoryInBackground() { - return getCompatTexture() == GuiTextures.BASE_FURNACE_BACKGROUND; - } - - @Override - public void drawSlots(DrawObjectDM drawObjectDM) { - ScreenHandlerUtil.getSlots(handler).forEach((slot) -> { - if (slot.inventory instanceof PlayerInventory || containPlayerInventoryInBackground()) - return; - - SlotRenderer.drawSlot(drawObjectDM, slot, x, y); - }); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java deleted file mode 100644 index 3ac5ebed4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.api.screen; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; - -public class SimpleContainerGuiScreen extends ContainerGuiScreen { - public SimpleContainerGuiScreen(SimpleContainerGui handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - @Override - public void initOverride() { - super.initOverride(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java deleted file mode 100644 index f1ce318d4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.guilib.test; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.guilib.api.container.ContainerGui; - -public class TestContainer extends ContainerGui { - public TestContainer(ScreenHandlerType type, int syncId) { - super(type, syncId); - } - - public TestContainer(int i, PlayerInventory inventory) { - this(null, i); - } - - @Override - public int getScreenBackgroundWidth() { - return 176; - } - - @Override - public int getScreenBackgroundHeight() { - return 166; - } - - @Override - public int getScreenWidth() { - return 176; - } - - @Override - public int getScreenHeight() { - return 166; - } - - @Override - public int getScreenX() { - return 0; - } - - @Override - public int getScreenY() { - return 0; - } - - @Override - public int getScreenTitleX() { - return 0; - } - - @Override - public int getScreenTitleY() { - return 0; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java deleted file mode 100644 index ba5f4535e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java +++ /dev/null @@ -1,160 +0,0 @@ -package net.pitan76.mcpitanlib.midohra; - -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; -import net.pitan76.mcpitanlib.midohra.nbt.NbtElement; -import net.pitan76.mcpitanlib.midohra.nbt.NbtList; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Direction; -import net.pitan76.mcpitanlib.midohra.world.*; - -import java.util.function.Supplier; - -public class Midohra { - - public static ItemWrapper of(Item item) { - return ItemWrapper.of(item); - } - - public static ItemGroupWrapper of(ItemGroup itemGroup) { - return ItemGroupWrapper.of(itemGroup); - } - public static BlockWrapper of(Block block) { - return BlockWrapper.of(block); - } - - public static SupplierBlockWrapper of(Supplier block) { - return SupplierBlockWrapper.of(block); - } - - public static SupplierBlockWrapper of(RegistryResult block) { - return SupplierBlockWrapper.of(block); - } - - public static BlockEntityWrapper of(BlockEntity blockEntity) { - return BlockEntityWrapper.of(blockEntity); - } - - public static FluidWrapper of(net.minecraft.fluid.Fluid fluid) { - return FluidWrapper.of(fluid); - } - - public static BlockState of(net.minecraft.block.BlockState state) { - return BlockState.of(state); - } - - public static NbtElement of(net.minecraft.nbt.NbtElement nbt) { - return NbtElement.of(nbt); - } - - public static NbtCompound of(net.minecraft.nbt.NbtCompound nbt) { - return NbtCompound.of(nbt); - } - - public static NbtList of(net.minecraft.nbt.NbtList nbt) { - return NbtList.of(nbt); - } - - public static BlockPos of(net.minecraft.util.math.BlockPos pos) { - return BlockPos.of(pos); - } - - public static Direction of(net.minecraft.util.math.Direction direction) { - return Direction.of(direction); - } - - public static World of(net.minecraft.world.World world) { - return World.of(world); - } - - public static WorldView of(net.minecraft.world.WorldView world) { - return WorldView.of(world); - } - - public static WorldAccess of(net.minecraft.world.WorldAccess world) { - return WorldAccess.of(world); - } - - public static BlockView of(net.minecraft.world.BlockView world) { - return BlockView.of(world); - } - - public static IWorldView asWV(net.minecraft.world.WorldView world) { - return of(world); - } - - public static IWorldView asWV(net.minecraft.world.BlockView world) { - return of(world); - } - - public static Item raw(ItemWrapper item) { - return item.get(); - } - - public static ItemGroup raw(ItemGroupWrapper itemGroup) { - return itemGroup.get(); - } - - public static Block raw(BlockWrapper block) { - return block.get(); - } - - public static BlockEntity raw(BlockEntityWrapper blockEntity) { - return blockEntity.get(); - } - - public static net.minecraft.fluid.Fluid raw(FluidWrapper fluid) { - return fluid.get(); - } - - public static net.minecraft.block.BlockState raw(BlockState state) { - return state.toMinecraft(); - } - - public static net.minecraft.nbt.NbtElement raw(NbtElement nbt) { - return nbt.toMinecraft(); - } - - public static net.minecraft.nbt.NbtCompound raw(NbtCompound nbt) { - return nbt.toMinecraft(); - } - - public static net.minecraft.nbt.NbtList raw(NbtList nbt) { - return nbt.toMinecraft(); - } - - public static net.minecraft.util.math.BlockPos raw(BlockPos pos) { - return pos.toMinecraft(); - } - - public static net.minecraft.util.math.Direction raw(Direction direction) { - return direction.toMinecraft(); - } - - public static net.minecraft.world.World raw(World world) { - return world.toMinecraft(); - } - - public static net.minecraft.world.WorldView raw(WorldView world) { - return world.toMinecraft(); - } - - public static net.minecraft.world.WorldAccess raw(WorldAccess world) { - return world.toMinecraft(); - } - - public static net.minecraft.world.BlockView raw(BlockView world) { - return world.toMinecraft(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java deleted file mode 100644 index d27730312..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.pitan76.mcpitanlib.midohra; - -/** - * MidohraAPI - * Experimental API of MCPitanLib - * - * @author Pitan - * @version 0.0.1 - * @since 2024.09.28 - */ -public class MidohraAPI { - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java deleted file mode 100644 index 20af1535a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java +++ /dev/null @@ -1,159 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block; - -import net.minecraft.state.property.Property; -import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; -import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; -import net.pitan76.mcpitanlib.api.state.property.IProperty; -import net.pitan76.mcpitanlib.api.util.BlockStateUtil; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.ServerWorld; -import net.pitan76.mcpitanlib.midohra.world.World; - -public class BlockState { - private final net.minecraft.block.BlockState state; - - private BlockWrapper blockWrapper; - - protected BlockState(net.minecraft.block.BlockState state) { - this.state = state; - } - - public static BlockState of(net.minecraft.block.BlockState state) { - return new BlockState(state); - } - - public static BlockState of(net.minecraft.block.Block block) { - if (block == null) - return of((net.minecraft.block.BlockState) null); - - return of(BlockStateUtil.getDefaultState(block)); - } - - public boolean isExist() { - return !isEmpty(); - } - - public boolean isEmpty() { - return toMinecraft() == null; - } - - public boolean isAir() { - return isEmpty() || BlockStateUtil.isAir(toMinecraft()); - } - - public CompatBlockSoundGroup getSoundGroup() { - return BlockStateUtil.getCompatSoundGroup(toMinecraft()); - } - - public BlockWrapper getBlock() { - if (blockWrapper == null) - blockWrapper = BlockWrapper.of(BlockStateUtil.getBlock(toMinecraft())); - - return blockWrapper; - } - - public String getName() { - return getBlock().getName(); - } - - public net.minecraft.block.BlockState toMinecraft() { - return state; - } - - public , V extends T> BlockState with(Property property, V value) { - return of(toMinecraft().with(property, value)); - } - - public , V extends T> BlockState with(IProperty property, V value) { - return with(property.getProperty(), value); - } - - public BlockState with(DirectionProperty property, net.pitan76.mcpitanlib.midohra.util.math.Direction value) { - return of(property.with(toMinecraft(), value.toMinecraft())); - } - - public > BlockState cycle(Property property) { - return of(toMinecraft().cycle(property)); - } - - public > BlockState cycle(IProperty property) { - return cycle(property.getProperty()); - } - - public BlockState cycle(DirectionProperty property) { - return of(property.cycle(toMinecraft())); - } - - public > T get(Property property) { - return toMinecraft().get(property); - } - - public > T get(IProperty property) { - return get(property.getProperty()); - } - - public net.pitan76.mcpitanlib.midohra.util.math.Direction get(DirectionProperty property) { - return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(get(property.getProperty())); - } - - public > boolean contains(Property property) { - return toMinecraft().contains(property); - } - - public > boolean contains(IProperty property) { - return contains(property.getProperty()); - } - - public boolean contains(DirectionProperty property) { - return contains(property.getProperty()); - } - - @Override - public int hashCode() { - return toMinecraft().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - BlockState state = (BlockState) obj; - return toMinecraft().equals(state.toMinecraft()); - } - - public boolean isOpaque() { - return BlockStateUtil.isOpaque(toMinecraft()); - } - - public boolean hasRandomTicks() { - return BlockStateUtil.hasRandomTicks(toMinecraft()); - } - - public boolean canPlaceAt(BlockPos pos, World world) { - return BlockStateUtil.canPlaceAt(this, pos, world); - } - - public int getLuminance() { - return BlockStateUtil.getLuminance(this); - } - - public int getOpacity() { - return BlockStateUtil.getOpacity(this); - } - - public int getComparatorOutput(World world, BlockPos pos) { - return BlockStateUtil.getComparatorOutput(this, world, pos); - } - - public float getHardness(World world, BlockPos pos) { - return BlockStateUtil.getHardness(this.toMinecraft(), world.getRaw(), pos.toRaw()); - } - - public boolean randomTick(ServerWorld world, BlockPos pos) { - if (!hasRandomTicks()) - return false; - - BlockStateUtil.randomTick(this.toMinecraft(), world.getRaw(), pos.toRaw()); - return true; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java deleted file mode 100644 index d54771d9e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ /dev/null @@ -1,136 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block; - -import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.block.BlockUtil; -import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlock; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; - -public class BlockWrapper { - private final net.minecraft.block.Block block; - - protected BlockWrapper() { - this.block = null; - } - - protected BlockWrapper(net.minecraft.block.Block block) { - this.block = block; - } - - public static BlockWrapper of(net.minecraft.block.Block block) { - return new BlockWrapper(block); - } - - public static BlockWrapper of() { - return new BlockWrapper(); - } - - public static BlockWrapper of(CompatIdentifier id) { - if (BlockUtil.isExist(id)) - return of(BlockUtil.fromId(id)); - - return of(); - } - - public static BlockWrapper of(CompatIdentifier id, CompatIdentifier... ids) { - if (of(id).isPresent()) return of(id); - - for (CompatIdentifier id1 : ids) { - if (of(id1).isPresent()) - return of(id1); - } - - return of(); - } - - public boolean isPresent() { - return !isEmpty(); - } - - public boolean isEmpty() { - return get() == null; - } - - @Nullable - public net.minecraft.block.Block get() { - return block; - } - - public net.minecraft.block.Block gerOrDefault(net.minecraft.block.Block defaultItem) { - return isEmpty() ? defaultItem : get(); - } - - public CompatIdentifier getId() { - if (isEmpty()) - return CompatIdentifier.empty(); - - return BlockUtil.toId(get()); - } - - public String getName() { - if (isEmpty()) return ""; - return BlockUtil.getNameAsString(get()); - } - - public String getTranslationKey() { - if (isEmpty()) return ""; - return BlockUtil.getTranslationKey(get()); - } - - public ItemWrapper asItem() { - if (isEmpty()) - return ItemWrapper.of(); - - return ItemWrapper.of(BlockUtil.toItem(get())); - } - - public BlockState getDefaultState() { - return BlockState.of(get()); - } - - public boolean rawEquals(BlockWrapper block) { - return get() == block.get(); - } - - @Override - public int hashCode() { - return get() != null ? get().hashCode() : 0; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - BlockWrapper other = (BlockWrapper) obj; - return rawEquals(other); - } - - public static BlockWrapper of(String id) { - return of(CompatIdentifier.of(id)); - } - - public static BlockWrapper of(String namespace, String path) { - return of(CompatIdentifier.of(namespace, path)); - } - - public static BlockWrapper of(CompatBlock block) { - return of((net.minecraft.block.Block) block); - } - - public Optional toCompatBlock() { - if (get() instanceof CompatBlock) { - return Optional.of((CompatBlock) get()); - } - return Optional.empty(); - } - - public Optional toBuiltBlock() { - if (get() instanceof BuiltBlock) { - return Optional.of((BuiltBlock) get()); - } - return Optional.empty(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java deleted file mode 100644 index 4841d1b52..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java +++ /dev/null @@ -1,771 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block; - -public class Blocks { - public static BlockWrapper AIR = of(net.minecraft.block.Blocks.AIR); - public static BlockWrapper STONE = of(net.minecraft.block.Blocks.STONE); - public static BlockWrapper GRANITE = of(net.minecraft.block.Blocks.GRANITE); - public static BlockWrapper POLISHED_GRANITE = of(net.minecraft.block.Blocks.POLISHED_GRANITE); - public static BlockWrapper DIORITE = of(net.minecraft.block.Blocks.DIORITE); - public static BlockWrapper POLISHED_DIORITE = of(net.minecraft.block.Blocks.POLISHED_DIORITE); - public static BlockWrapper ANDESITE = of(net.minecraft.block.Blocks.ANDESITE); - public static BlockWrapper POLISHED_ANDESITE = of(net.minecraft.block.Blocks.POLISHED_ANDESITE); - public static BlockWrapper GRASS_BLOCK = of(net.minecraft.block.Blocks.GRASS_BLOCK); - public static BlockWrapper DIRT = of(net.minecraft.block.Blocks.DIRT); - public static BlockWrapper COARSE_DIRT = of(net.minecraft.block.Blocks.COARSE_DIRT); - public static BlockWrapper PODZOL = of(net.minecraft.block.Blocks.PODZOL); - public static BlockWrapper COBBLESTONE = of(net.minecraft.block.Blocks.COBBLESTONE); - public static BlockWrapper OAK_PLANKS = of(net.minecraft.block.Blocks.OAK_PLANKS); - public static BlockWrapper SPRUCE_PLANKS = of(net.minecraft.block.Blocks.SPRUCE_PLANKS); - public static BlockWrapper BIRCH_PLANKS = of(net.minecraft.block.Blocks.BIRCH_PLANKS); - public static BlockWrapper JUNGLE_PLANKS = of(net.minecraft.block.Blocks.JUNGLE_PLANKS); - public static BlockWrapper ACACIA_PLANKS = of(net.minecraft.block.Blocks.ACACIA_PLANKS); - public static BlockWrapper DARK_OAK_PLANKS = of(net.minecraft.block.Blocks.DARK_OAK_PLANKS); - public static BlockWrapper OAK_SAPLING = of(net.minecraft.block.Blocks.OAK_SAPLING); - public static BlockWrapper SPRUCE_SAPLING = of(net.minecraft.block.Blocks.SPRUCE_SAPLING); - public static BlockWrapper BIRCH_SAPLING = of(net.minecraft.block.Blocks.BIRCH_SAPLING); - public static BlockWrapper JUNGLE_SAPLING = of(net.minecraft.block.Blocks.JUNGLE_SAPLING); - public static BlockWrapper ACACIA_SAPLING = of(net.minecraft.block.Blocks.ACACIA_SAPLING); - public static BlockWrapper DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.DARK_OAK_SAPLING); - public static BlockWrapper BEDROCK = of(net.minecraft.block.Blocks.BEDROCK); - public static BlockWrapper WATER = of(net.minecraft.block.Blocks.WATER); - public static BlockWrapper LAVA = of(net.minecraft.block.Blocks.LAVA); - public static BlockWrapper SAND = of(net.minecraft.block.Blocks.SAND); - public static BlockWrapper RED_SAND = of(net.minecraft.block.Blocks.RED_SAND); - public static BlockWrapper GRAVEL = of(net.minecraft.block.Blocks.GRAVEL); - public static BlockWrapper GOLD_ORE = of(net.minecraft.block.Blocks.GOLD_ORE); - public static BlockWrapper IRON_ORE = of(net.minecraft.block.Blocks.IRON_ORE); - public static BlockWrapper COAL_ORE = of(net.minecraft.block.Blocks.COAL_ORE); - public static BlockWrapper NETHER_GOLD_ORE = of(net.minecraft.block.Blocks.NETHER_GOLD_ORE); - public static BlockWrapper OAK_LOG = of(net.minecraft.block.Blocks.OAK_LOG); - public static BlockWrapper SPRUCE_LOG = of(net.minecraft.block.Blocks.SPRUCE_LOG); - public static BlockWrapper BIRCH_LOG = of(net.minecraft.block.Blocks.BIRCH_LOG); - public static BlockWrapper JUNGLE_LOG = of(net.minecraft.block.Blocks.JUNGLE_LOG); - public static BlockWrapper ACACIA_LOG = of(net.minecraft.block.Blocks.ACACIA_LOG); - public static BlockWrapper DARK_OAK_LOG = of(net.minecraft.block.Blocks.DARK_OAK_LOG); - public static BlockWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_LOG); - public static BlockWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_LOG); - public static BlockWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_LOG); - public static BlockWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_LOG); - public static BlockWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_LOG); - public static BlockWrapper STRIPPED_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_OAK_LOG); - public static BlockWrapper OAK_WOOD = of(net.minecraft.block.Blocks.OAK_WOOD); - public static BlockWrapper SPRUCE_WOOD = of(net.minecraft.block.Blocks.SPRUCE_WOOD); - public static BlockWrapper BIRCH_WOOD = of(net.minecraft.block.Blocks.BIRCH_WOOD); - public static BlockWrapper JUNGLE_WOOD = of(net.minecraft.block.Blocks.JUNGLE_WOOD); - public static BlockWrapper ACACIA_WOOD = of(net.minecraft.block.Blocks.ACACIA_WOOD); - public static BlockWrapper DARK_OAK_WOOD = of(net.minecraft.block.Blocks.DARK_OAK_WOOD); - public static BlockWrapper STRIPPED_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_OAK_WOOD); - public static BlockWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_WOOD); - public static BlockWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_WOOD); - public static BlockWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_WOOD); - public static BlockWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_WOOD); - public static BlockWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_WOOD); - public static BlockWrapper OAK_LEAVES = of(net.minecraft.block.Blocks.OAK_LEAVES); - public static BlockWrapper SPRUCE_LEAVES = of(net.minecraft.block.Blocks.SPRUCE_LEAVES); - public static BlockWrapper BIRCH_LEAVES = of(net.minecraft.block.Blocks.BIRCH_LEAVES); - public static BlockWrapper JUNGLE_LEAVES = of(net.minecraft.block.Blocks.JUNGLE_LEAVES); - public static BlockWrapper ACACIA_LEAVES = of(net.minecraft.block.Blocks.ACACIA_LEAVES); - public static BlockWrapper DARK_OAK_LEAVES = of(net.minecraft.block.Blocks.DARK_OAK_LEAVES); - public static BlockWrapper SPONGE = of(net.minecraft.block.Blocks.SPONGE); - public static BlockWrapper WET_SPONGE = of(net.minecraft.block.Blocks.WET_SPONGE); - public static BlockWrapper GLASS = of(net.minecraft.block.Blocks.GLASS); - public static BlockWrapper LAPIS_ORE = of(net.minecraft.block.Blocks.LAPIS_ORE); - public static BlockWrapper LAPIS_BLOCK = of(net.minecraft.block.Blocks.LAPIS_BLOCK); - public static BlockWrapper DISPENSER = of(net.minecraft.block.Blocks.DISPENSER); - public static BlockWrapper SANDSTONE = of(net.minecraft.block.Blocks.SANDSTONE); - public static BlockWrapper CHISELED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_SANDSTONE); - public static BlockWrapper CUT_SANDSTONE = of(net.minecraft.block.Blocks.CUT_SANDSTONE); - public static BlockWrapper NOTE_BLOCK = of(net.minecraft.block.Blocks.NOTE_BLOCK); - public static BlockWrapper WHITE_BED = of(net.minecraft.block.Blocks.WHITE_BED); - public static BlockWrapper ORANGE_BED = of(net.minecraft.block.Blocks.ORANGE_BED); - public static BlockWrapper MAGENTA_BED = of(net.minecraft.block.Blocks.MAGENTA_BED); - public static BlockWrapper LIGHT_BLUE_BED = of(net.minecraft.block.Blocks.LIGHT_BLUE_BED); - public static BlockWrapper YELLOW_BED = of(net.minecraft.block.Blocks.YELLOW_BED); - public static BlockWrapper LIME_BED = of(net.minecraft.block.Blocks.LIME_BED); - public static BlockWrapper PINK_BED = of(net.minecraft.block.Blocks.PINK_BED); - public static BlockWrapper GRAY_BED = of(net.minecraft.block.Blocks.GRAY_BED); - public static BlockWrapper LIGHT_GRAY_BED = of(net.minecraft.block.Blocks.LIGHT_GRAY_BED); - public static BlockWrapper CYAN_BED = of(net.minecraft.block.Blocks.CYAN_BED); - public static BlockWrapper PURPLE_BED = of(net.minecraft.block.Blocks.PURPLE_BED); - public static BlockWrapper BLUE_BED = of(net.minecraft.block.Blocks.BLUE_BED); - public static BlockWrapper BROWN_BED = of(net.minecraft.block.Blocks.BROWN_BED); - public static BlockWrapper GREEN_BED = of(net.minecraft.block.Blocks.GREEN_BED); - public static BlockWrapper RED_BED = of(net.minecraft.block.Blocks.RED_BED); - public static BlockWrapper BLACK_BED = of(net.minecraft.block.Blocks.BLACK_BED); - public static BlockWrapper POWERED_RAIL = of(net.minecraft.block.Blocks.POWERED_RAIL); - public static BlockWrapper DETECTOR_RAIL = of(net.minecraft.block.Blocks.DETECTOR_RAIL); - public static BlockWrapper STICKY_PISTON = of(net.minecraft.block.Blocks.STICKY_PISTON); - public static BlockWrapper COBWEB = of(net.minecraft.block.Blocks.COBWEB); - public static BlockWrapper GRASS = of(net.minecraft.block.Blocks.SHORT_GRASS); - public static BlockWrapper FERN = of(net.minecraft.block.Blocks.FERN); - public static BlockWrapper DEAD_BUSH = of(net.minecraft.block.Blocks.DEAD_BUSH); - public static BlockWrapper SEAGRASS = of(net.minecraft.block.Blocks.SEAGRASS); - public static BlockWrapper TALL_SEAGRASS = of(net.minecraft.block.Blocks.TALL_SEAGRASS); - public static BlockWrapper PISTON = of(net.minecraft.block.Blocks.PISTON); - public static BlockWrapper PISTON_HEAD = of(net.minecraft.block.Blocks.PISTON_HEAD); - public static BlockWrapper WHITE_WOOL = of(net.minecraft.block.Blocks.WHITE_WOOL); - public static BlockWrapper ORANGE_WOOL = of(net.minecraft.block.Blocks.ORANGE_WOOL); - public static BlockWrapper MAGENTA_WOOL = of(net.minecraft.block.Blocks.MAGENTA_WOOL); - public static BlockWrapper LIGHT_BLUE_WOOL = of(net.minecraft.block.Blocks.LIGHT_BLUE_WOOL); - public static BlockWrapper YELLOW_WOOL = of(net.minecraft.block.Blocks.YELLOW_WOOL); - public static BlockWrapper LIME_WOOL = of(net.minecraft.block.Blocks.LIME_WOOL); - public static BlockWrapper PINK_WOOL = of(net.minecraft.block.Blocks.PINK_WOOL); - public static BlockWrapper GRAY_WOOL = of(net.minecraft.block.Blocks.GRAY_WOOL); - public static BlockWrapper LIGHT_GRAY_WOOL = of(net.minecraft.block.Blocks.LIGHT_GRAY_WOOL); - public static BlockWrapper CYAN_WOOL = of(net.minecraft.block.Blocks.CYAN_WOOL); - public static BlockWrapper PURPLE_WOOL = of(net.minecraft.block.Blocks.PURPLE_WOOL); - public static BlockWrapper BLUE_WOOL = of(net.minecraft.block.Blocks.BLUE_WOOL); - public static BlockWrapper BROWN_WOOL = of(net.minecraft.block.Blocks.BROWN_WOOL); - public static BlockWrapper GREEN_WOOL = of(net.minecraft.block.Blocks.GREEN_WOOL); - public static BlockWrapper RED_WOOL = of(net.minecraft.block.Blocks.RED_WOOL); - public static BlockWrapper BLACK_WOOL = of(net.minecraft.block.Blocks.BLACK_WOOL); - public static BlockWrapper MOVING_PISTON = of(net.minecraft.block.Blocks.MOVING_PISTON); - public static BlockWrapper DANDELION = of(net.minecraft.block.Blocks.DANDELION); - public static BlockWrapper POPPY = of(net.minecraft.block.Blocks.POPPY); - public static BlockWrapper BLUE_ORCHID = of(net.minecraft.block.Blocks.BLUE_ORCHID); - public static BlockWrapper ALLIUM = of(net.minecraft.block.Blocks.ALLIUM); - public static BlockWrapper AZURE_BLUET = of(net.minecraft.block.Blocks.AZURE_BLUET); - public static BlockWrapper RED_TULIP = of(net.minecraft.block.Blocks.RED_TULIP); - public static BlockWrapper ORANGE_TULIP = of(net.minecraft.block.Blocks.ORANGE_TULIP); - public static BlockWrapper WHITE_TULIP = of(net.minecraft.block.Blocks.WHITE_TULIP); - public static BlockWrapper PINK_TULIP = of(net.minecraft.block.Blocks.PINK_TULIP); - public static BlockWrapper OXEYE_DAISY = of(net.minecraft.block.Blocks.OXEYE_DAISY); - public static BlockWrapper CORNFLOWER = of(net.minecraft.block.Blocks.CORNFLOWER); - public static BlockWrapper WITHER_ROSE = of(net.minecraft.block.Blocks.WITHER_ROSE); - public static BlockWrapper LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.LILY_OF_THE_VALLEY); - public static BlockWrapper BROWN_MUSHROOM = of(net.minecraft.block.Blocks.BROWN_MUSHROOM); - public static BlockWrapper RED_MUSHROOM = of(net.minecraft.block.Blocks.RED_MUSHROOM); - public static BlockWrapper GOLD_BLOCK = of(net.minecraft.block.Blocks.GOLD_BLOCK); - public static BlockWrapper IRON_BLOCK = of(net.minecraft.block.Blocks.IRON_BLOCK); - public static BlockWrapper BRICKS = of(net.minecraft.block.Blocks.BRICKS); - public static BlockWrapper TNT = of(net.minecraft.block.Blocks.TNT); - public static BlockWrapper BOOKSHELF = of(net.minecraft.block.Blocks.BOOKSHELF); - public static BlockWrapper MOSSY_COBBLESTONE = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE); - public static BlockWrapper OBSIDIAN = of(net.minecraft.block.Blocks.OBSIDIAN); - public static BlockWrapper TORCH = of(net.minecraft.block.Blocks.TORCH); - public static BlockWrapper WALL_TORCH = of(net.minecraft.block.Blocks.WALL_TORCH); - public static BlockWrapper FIRE = of(net.minecraft.block.Blocks.FIRE); - public static BlockWrapper SOUL_FIRE = of(net.minecraft.block.Blocks.SOUL_FIRE); - public static BlockWrapper SPAWNER = of(net.minecraft.block.Blocks.SPAWNER); - public static BlockWrapper OAK_STAIRS = of(net.minecraft.block.Blocks.OAK_STAIRS); - public static BlockWrapper CHEST = of(net.minecraft.block.Blocks.CHEST); - public static BlockWrapper REDSTONE_WIRE = of(net.minecraft.block.Blocks.REDSTONE_WIRE); - public static BlockWrapper DIAMOND_ORE = of(net.minecraft.block.Blocks.DIAMOND_ORE); - public static BlockWrapper DIAMOND_BLOCK = of(net.minecraft.block.Blocks.DIAMOND_BLOCK); - public static BlockWrapper CRAFTING_TABLE = of(net.minecraft.block.Blocks.CRAFTING_TABLE); - public static BlockWrapper WHEAT = of(net.minecraft.block.Blocks.WHEAT); - public static BlockWrapper FARMLAND = of(net.minecraft.block.Blocks.FARMLAND); - public static BlockWrapper FURNACE = of(net.minecraft.block.Blocks.FURNACE); - public static BlockWrapper OAK_SIGN = of(net.minecraft.block.Blocks.OAK_SIGN); - public static BlockWrapper SPRUCE_SIGN = of(net.minecraft.block.Blocks.SPRUCE_SIGN); - public static BlockWrapper BIRCH_SIGN = of(net.minecraft.block.Blocks.BIRCH_SIGN); - public static BlockWrapper ACACIA_SIGN = of(net.minecraft.block.Blocks.ACACIA_SIGN); - public static BlockWrapper JUNGLE_SIGN = of(net.minecraft.block.Blocks.JUNGLE_SIGN); - public static BlockWrapper DARK_OAK_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_SIGN); - public static BlockWrapper OAK_DOOR = of(net.minecraft.block.Blocks.OAK_DOOR); - public static BlockWrapper LADDER = of(net.minecraft.block.Blocks.LADDER); - public static BlockWrapper RAIL = of(net.minecraft.block.Blocks.RAIL); - public static BlockWrapper COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.COBBLESTONE_STAIRS); - public static BlockWrapper OAK_WALL_SIGN = of(net.minecraft.block.Blocks.OAK_WALL_SIGN); - public static BlockWrapper SPRUCE_WALL_SIGN = of(net.minecraft.block.Blocks.SPRUCE_WALL_SIGN); - public static BlockWrapper BIRCH_WALL_SIGN = of(net.minecraft.block.Blocks.BIRCH_WALL_SIGN); - public static BlockWrapper ACACIA_WALL_SIGN = of(net.minecraft.block.Blocks.ACACIA_WALL_SIGN); - public static BlockWrapper JUNGLE_WALL_SIGN = of(net.minecraft.block.Blocks.JUNGLE_WALL_SIGN); - public static BlockWrapper DARK_OAK_WALL_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_WALL_SIGN); - public static BlockWrapper LEVER = of(net.minecraft.block.Blocks.LEVER); - public static BlockWrapper STONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.STONE_PRESSURE_PLATE); - public static BlockWrapper IRON_DOOR = of(net.minecraft.block.Blocks.IRON_DOOR); - public static BlockWrapper OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.OAK_PRESSURE_PLATE); - public static BlockWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.SPRUCE_PRESSURE_PLATE); - public static BlockWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.block.Blocks.BIRCH_PRESSURE_PLATE); - public static BlockWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.JUNGLE_PRESSURE_PLATE); - public static BlockWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.block.Blocks.ACACIA_PRESSURE_PLATE); - public static BlockWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.DARK_OAK_PRESSURE_PLATE); - public static BlockWrapper REDSTONE_ORE = of(net.minecraft.block.Blocks.REDSTONE_ORE); - public static BlockWrapper REDSTONE_TORCH = of(net.minecraft.block.Blocks.REDSTONE_TORCH); - public static BlockWrapper REDSTONE_WALL_TORCH = of(net.minecraft.block.Blocks.REDSTONE_WALL_TORCH); - public static BlockWrapper STONE_BUTTON = of(net.minecraft.block.Blocks.STONE_BUTTON); - public static BlockWrapper SNOW = of(net.minecraft.block.Blocks.SNOW); - public static BlockWrapper ICE = of(net.minecraft.block.Blocks.ICE); - public static BlockWrapper SNOW_BLOCK = of(net.minecraft.block.Blocks.SNOW_BLOCK); - public static BlockWrapper CACTUS = of(net.minecraft.block.Blocks.CACTUS); - public static BlockWrapper CLAY = of(net.minecraft.block.Blocks.CLAY); - public static BlockWrapper SUGAR_CANE = of(net.minecraft.block.Blocks.SUGAR_CANE); - public static BlockWrapper JUKEBOX = of(net.minecraft.block.Blocks.JUKEBOX); - public static BlockWrapper OAK_FENCE = of(net.minecraft.block.Blocks.OAK_FENCE); - public static BlockWrapper PUMPKIN = of(net.minecraft.block.Blocks.PUMPKIN); - public static BlockWrapper NETHERRACK = of(net.minecraft.block.Blocks.NETHERRACK); - public static BlockWrapper SOUL_SAND = of(net.minecraft.block.Blocks.SOUL_SAND); - public static BlockWrapper SOUL_SOIL = of(net.minecraft.block.Blocks.SOUL_SOIL); - public static BlockWrapper BASALT = of(net.minecraft.block.Blocks.BASALT); - public static BlockWrapper POLISHED_BASALT = of(net.minecraft.block.Blocks.POLISHED_BASALT); - public static BlockWrapper SOUL_TORCH = of(net.minecraft.block.Blocks.SOUL_TORCH); - public static BlockWrapper SOUL_WALL_TORCH = of(net.minecraft.block.Blocks.SOUL_WALL_TORCH); - public static BlockWrapper GLOWSTONE = of(net.minecraft.block.Blocks.GLOWSTONE); - public static BlockWrapper NETHER_PORTAL = of(net.minecraft.block.Blocks.NETHER_PORTAL); - public static BlockWrapper CARVED_PUMPKIN = of(net.minecraft.block.Blocks.CARVED_PUMPKIN); - public static BlockWrapper JACK_O_LANTERN = of(net.minecraft.block.Blocks.JACK_O_LANTERN); - public static BlockWrapper CAKE = of(net.minecraft.block.Blocks.CAKE); - public static BlockWrapper REPEATER = of(net.minecraft.block.Blocks.REPEATER); - public static BlockWrapper WHITE_STAINED_GLASS = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS); - public static BlockWrapper ORANGE_STAINED_GLASS = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS); - public static BlockWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS); - public static BlockWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS); - public static BlockWrapper YELLOW_STAINED_GLASS = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS); - public static BlockWrapper LIME_STAINED_GLASS = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS); - public static BlockWrapper PINK_STAINED_GLASS = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS); - public static BlockWrapper GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS); - public static BlockWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS); - public static BlockWrapper CYAN_STAINED_GLASS = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS); - public static BlockWrapper PURPLE_STAINED_GLASS = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS); - public static BlockWrapper BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS); - public static BlockWrapper BROWN_STAINED_GLASS = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS); - public static BlockWrapper GREEN_STAINED_GLASS = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS); - public static BlockWrapper RED_STAINED_GLASS = of(net.minecraft.block.Blocks.RED_STAINED_GLASS); - public static BlockWrapper BLACK_STAINED_GLASS = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS); - public static BlockWrapper OAK_TRAPDOOR = of(net.minecraft.block.Blocks.OAK_TRAPDOOR); - public static BlockWrapper SPRUCE_TRAPDOOR = of(net.minecraft.block.Blocks.SPRUCE_TRAPDOOR); - public static BlockWrapper BIRCH_TRAPDOOR = of(net.minecraft.block.Blocks.BIRCH_TRAPDOOR); - public static BlockWrapper JUNGLE_TRAPDOOR = of(net.minecraft.block.Blocks.JUNGLE_TRAPDOOR); - public static BlockWrapper ACACIA_TRAPDOOR = of(net.minecraft.block.Blocks.ACACIA_TRAPDOOR); - public static BlockWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.block.Blocks.DARK_OAK_TRAPDOOR); - public static BlockWrapper STONE_BRICKS = of(net.minecraft.block.Blocks.STONE_BRICKS); - public static BlockWrapper MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICKS); - public static BlockWrapper CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_STONE_BRICKS); - public static BlockWrapper CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.CHISELED_STONE_BRICKS); - public static BlockWrapper INFESTED_STONE = of(net.minecraft.block.Blocks.INFESTED_STONE); - public static BlockWrapper INFESTED_COBBLESTONE = of(net.minecraft.block.Blocks.INFESTED_COBBLESTONE); - public static BlockWrapper INFESTED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_STONE_BRICKS); - public static BlockWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_MOSSY_STONE_BRICKS); - public static BlockWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CRACKED_STONE_BRICKS); - public static BlockWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CHISELED_STONE_BRICKS); - public static BlockWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.BROWN_MUSHROOM_BLOCK); - public static BlockWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.RED_MUSHROOM_BLOCK); - public static BlockWrapper MUSHROOM_STEM = of(net.minecraft.block.Blocks.MUSHROOM_STEM); - public static BlockWrapper IRON_BARS = of(net.minecraft.block.Blocks.IRON_BARS); - public static BlockWrapper CHAIN = of(net.minecraft.block.Blocks.IRON_CHAIN); - public static BlockWrapper GLASS_PANE = of(net.minecraft.block.Blocks.GLASS_PANE); - public static BlockWrapper MELON = of(net.minecraft.block.Blocks.MELON); - public static BlockWrapper ATTACHED_PUMPKIN_STEM = of(net.minecraft.block.Blocks.ATTACHED_PUMPKIN_STEM); - public static BlockWrapper ATTACHED_MELON_STEM = of(net.minecraft.block.Blocks.ATTACHED_MELON_STEM); - public static BlockWrapper PUMPKIN_STEM = of(net.minecraft.block.Blocks.PUMPKIN_STEM); - public static BlockWrapper MELON_STEM = of(net.minecraft.block.Blocks.MELON_STEM); - public static BlockWrapper VINE = of(net.minecraft.block.Blocks.VINE); - public static BlockWrapper OAK_FENCE_GATE = of(net.minecraft.block.Blocks.OAK_FENCE_GATE); - public static BlockWrapper BRICK_STAIRS = of(net.minecraft.block.Blocks.BRICK_STAIRS); - public static BlockWrapper STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.STONE_BRICK_STAIRS); - public static BlockWrapper MYCELIUM = of(net.minecraft.block.Blocks.MYCELIUM); - public static BlockWrapper LILY_PAD = of(net.minecraft.block.Blocks.LILY_PAD); - public static BlockWrapper NETHER_BRICKS = of(net.minecraft.block.Blocks.NETHER_BRICKS); - public static BlockWrapper NETHER_BRICK_FENCE = of(net.minecraft.block.Blocks.NETHER_BRICK_FENCE); - public static BlockWrapper NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.NETHER_BRICK_STAIRS); - public static BlockWrapper NETHER_WART = of(net.minecraft.block.Blocks.NETHER_WART); - public static BlockWrapper ENCHANTING_TABLE = of(net.minecraft.block.Blocks.ENCHANTING_TABLE); - public static BlockWrapper BREWING_STAND = of(net.minecraft.block.Blocks.BREWING_STAND); - public static BlockWrapper CAULDRON = of(net.minecraft.block.Blocks.CAULDRON); - public static BlockWrapper END_PORTAL = of(net.minecraft.block.Blocks.END_PORTAL); - public static BlockWrapper END_PORTAL_FRAME = of(net.minecraft.block.Blocks.END_PORTAL_FRAME); - public static BlockWrapper END_STONE = of(net.minecraft.block.Blocks.END_STONE); - public static BlockWrapper DRAGON_EGG = of(net.minecraft.block.Blocks.DRAGON_EGG); - public static BlockWrapper REDSTONE_LAMP = of(net.minecraft.block.Blocks.REDSTONE_LAMP); - public static BlockWrapper COCOA = of(net.minecraft.block.Blocks.COCOA); - public static BlockWrapper SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SANDSTONE_STAIRS); - public static BlockWrapper EMERALD_ORE = of(net.minecraft.block.Blocks.EMERALD_ORE); - public static BlockWrapper ENDER_CHEST = of(net.minecraft.block.Blocks.ENDER_CHEST); - public static BlockWrapper TRIPWIRE_HOOK = of(net.minecraft.block.Blocks.TRIPWIRE_HOOK); - public static BlockWrapper TRIPWIRE = of(net.minecraft.block.Blocks.TRIPWIRE); - public static BlockWrapper EMERALD_BLOCK = of(net.minecraft.block.Blocks.EMERALD_BLOCK); - public static BlockWrapper SPRUCE_STAIRS = of(net.minecraft.block.Blocks.SPRUCE_STAIRS); - public static BlockWrapper BIRCH_STAIRS = of(net.minecraft.block.Blocks.BIRCH_STAIRS); - public static BlockWrapper JUNGLE_STAIRS = of(net.minecraft.block.Blocks.JUNGLE_STAIRS); - public static BlockWrapper COMMAND_BLOCK = of(net.minecraft.block.Blocks.COMMAND_BLOCK); - public static BlockWrapper BEACON = of(net.minecraft.block.Blocks.BEACON); - public static BlockWrapper COBBLESTONE_WALL = of(net.minecraft.block.Blocks.COBBLESTONE_WALL); - public static BlockWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_WALL); - public static BlockWrapper FLOWER_POT = of(net.minecraft.block.Blocks.FLOWER_POT); - public static BlockWrapper POTTED_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_OAK_SAPLING); - public static BlockWrapper POTTED_SPRUCE_SAPLING = of(net.minecraft.block.Blocks.POTTED_SPRUCE_SAPLING); - public static BlockWrapper POTTED_BIRCH_SAPLING = of(net.minecraft.block.Blocks.POTTED_BIRCH_SAPLING); - public static BlockWrapper POTTED_JUNGLE_SAPLING = of(net.minecraft.block.Blocks.POTTED_JUNGLE_SAPLING); - public static BlockWrapper POTTED_ACACIA_SAPLING = of(net.minecraft.block.Blocks.POTTED_ACACIA_SAPLING); - public static BlockWrapper POTTED_DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_DARK_OAK_SAPLING); - public static BlockWrapper POTTED_FERN = of(net.minecraft.block.Blocks.POTTED_FERN); - public static BlockWrapper POTTED_DANDELION = of(net.minecraft.block.Blocks.POTTED_DANDELION); - public static BlockWrapper POTTED_POPPY = of(net.minecraft.block.Blocks.POTTED_POPPY); - public static BlockWrapper POTTED_BLUE_ORCHID = of(net.minecraft.block.Blocks.POTTED_BLUE_ORCHID); - public static BlockWrapper POTTED_ALLIUM = of(net.minecraft.block.Blocks.POTTED_ALLIUM); - public static BlockWrapper POTTED_AZURE_BLUET = of(net.minecraft.block.Blocks.POTTED_AZURE_BLUET); - public static BlockWrapper POTTED_RED_TULIP = of(net.minecraft.block.Blocks.POTTED_RED_TULIP); - public static BlockWrapper POTTED_ORANGE_TULIP = of(net.minecraft.block.Blocks.POTTED_ORANGE_TULIP); - public static BlockWrapper POTTED_WHITE_TULIP = of(net.minecraft.block.Blocks.POTTED_WHITE_TULIP); - public static BlockWrapper POTTED_PINK_TULIP = of(net.minecraft.block.Blocks.POTTED_PINK_TULIP); - public static BlockWrapper POTTED_OXEYE_DAISY = of(net.minecraft.block.Blocks.POTTED_OXEYE_DAISY); - public static BlockWrapper POTTED_CORNFLOWER = of(net.minecraft.block.Blocks.POTTED_CORNFLOWER); - public static BlockWrapper POTTED_LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.POTTED_LILY_OF_THE_VALLEY); - public static BlockWrapper POTTED_WITHER_ROSE = of(net.minecraft.block.Blocks.POTTED_WITHER_ROSE); - public static BlockWrapper POTTED_RED_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_RED_MUSHROOM); - public static BlockWrapper POTTED_BROWN_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_BROWN_MUSHROOM); - public static BlockWrapper POTTED_DEAD_BUSH = of(net.minecraft.block.Blocks.POTTED_DEAD_BUSH); - public static BlockWrapper POTTED_CACTUS = of(net.minecraft.block.Blocks.POTTED_CACTUS); - public static BlockWrapper CARROTS = of(net.minecraft.block.Blocks.CARROTS); - public static BlockWrapper POTATOES = of(net.minecraft.block.Blocks.POTATOES); - public static BlockWrapper OAK_BUTTON = of(net.minecraft.block.Blocks.OAK_BUTTON); - public static BlockWrapper SPRUCE_BUTTON = of(net.minecraft.block.Blocks.SPRUCE_BUTTON); - public static BlockWrapper BIRCH_BUTTON = of(net.minecraft.block.Blocks.BIRCH_BUTTON); - public static BlockWrapper JUNGLE_BUTTON = of(net.minecraft.block.Blocks.JUNGLE_BUTTON); - public static BlockWrapper ACACIA_BUTTON = of(net.minecraft.block.Blocks.ACACIA_BUTTON); - public static BlockWrapper DARK_OAK_BUTTON = of(net.minecraft.block.Blocks.DARK_OAK_BUTTON); - public static BlockWrapper SKELETON_SKULL = of(net.minecraft.block.Blocks.SKELETON_SKULL); - public static BlockWrapper SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.SKELETON_WALL_SKULL); - public static BlockWrapper WITHER_SKELETON_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_SKULL); - public static BlockWrapper WITHER_SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_WALL_SKULL); - public static BlockWrapper ZOMBIE_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_HEAD); - public static BlockWrapper ZOMBIE_WALL_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_WALL_HEAD); - public static BlockWrapper PLAYER_HEAD = of(net.minecraft.block.Blocks.PLAYER_HEAD); - public static BlockWrapper PLAYER_WALL_HEAD = of(net.minecraft.block.Blocks.PLAYER_WALL_HEAD); - public static BlockWrapper CREEPER_HEAD = of(net.minecraft.block.Blocks.CREEPER_HEAD); - public static BlockWrapper CREEPER_WALL_HEAD = of(net.minecraft.block.Blocks.CREEPER_WALL_HEAD); - public static BlockWrapper DRAGON_HEAD = of(net.minecraft.block.Blocks.DRAGON_HEAD); - public static BlockWrapper DRAGON_WALL_HEAD = of(net.minecraft.block.Blocks.DRAGON_WALL_HEAD); - public static BlockWrapper ANVIL = of(net.minecraft.block.Blocks.ANVIL); - public static BlockWrapper CHIPPED_ANVIL = of(net.minecraft.block.Blocks.CHIPPED_ANVIL); - public static BlockWrapper DAMAGED_ANVIL = of(net.minecraft.block.Blocks.DAMAGED_ANVIL); - public static BlockWrapper TRAPPED_CHEST = of(net.minecraft.block.Blocks.TRAPPED_CHEST); - public static BlockWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE); - public static BlockWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE); - public static BlockWrapper COMPARATOR = of(net.minecraft.block.Blocks.COMPARATOR); - public static BlockWrapper DAYLIGHT_DETECTOR = of(net.minecraft.block.Blocks.DAYLIGHT_DETECTOR); - public static BlockWrapper REDSTONE_BLOCK = of(net.minecraft.block.Blocks.REDSTONE_BLOCK); - public static BlockWrapper NETHER_QUARTZ_ORE = of(net.minecraft.block.Blocks.NETHER_QUARTZ_ORE); - public static BlockWrapper HOPPER = of(net.minecraft.block.Blocks.HOPPER); - public static BlockWrapper QUARTZ_BLOCK = of(net.minecraft.block.Blocks.QUARTZ_BLOCK); - public static BlockWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.block.Blocks.CHISELED_QUARTZ_BLOCK); - public static BlockWrapper QUARTZ_PILLAR = of(net.minecraft.block.Blocks.QUARTZ_PILLAR); - public static BlockWrapper QUARTZ_STAIRS = of(net.minecraft.block.Blocks.QUARTZ_STAIRS); - public static BlockWrapper ACTIVATOR_RAIL = of(net.minecraft.block.Blocks.ACTIVATOR_RAIL); - public static BlockWrapper DROPPER = of(net.minecraft.block.Blocks.DROPPER); - public static BlockWrapper WHITE_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_TERRACOTTA); - public static BlockWrapper ORANGE_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_TERRACOTTA); - public static BlockWrapper MAGENTA_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_TERRACOTTA); - public static BlockWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_TERRACOTTA); - public static BlockWrapper YELLOW_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_TERRACOTTA); - public static BlockWrapper LIME_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_TERRACOTTA); - public static BlockWrapper PINK_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_TERRACOTTA); - public static BlockWrapper GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_TERRACOTTA); - public static BlockWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_TERRACOTTA); - public static BlockWrapper CYAN_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_TERRACOTTA); - public static BlockWrapper PURPLE_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_TERRACOTTA); - public static BlockWrapper BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_TERRACOTTA); - public static BlockWrapper BROWN_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_TERRACOTTA); - public static BlockWrapper GREEN_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_TERRACOTTA); - public static BlockWrapper RED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_TERRACOTTA); - public static BlockWrapper BLACK_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_TERRACOTTA); - public static BlockWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS_PANE); - public static BlockWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS_PANE); - public static BlockWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS_PANE); - public static BlockWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS_PANE); - public static BlockWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS_PANE); - public static BlockWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS_PANE); - public static BlockWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS_PANE); - public static BlockWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS_PANE); - public static BlockWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS_PANE); - public static BlockWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS_PANE); - public static BlockWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS_PANE); - public static BlockWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS_PANE); - public static BlockWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS_PANE); - public static BlockWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS_PANE); - public static BlockWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.RED_STAINED_GLASS_PANE); - public static BlockWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS_PANE); - public static BlockWrapper ACACIA_STAIRS = of(net.minecraft.block.Blocks.ACACIA_STAIRS); - public static BlockWrapper DARK_OAK_STAIRS = of(net.minecraft.block.Blocks.DARK_OAK_STAIRS); - public static BlockWrapper SLIME_BLOCK = of(net.minecraft.block.Blocks.SLIME_BLOCK); - public static BlockWrapper BARRIER = of(net.minecraft.block.Blocks.BARRIER); - public static BlockWrapper IRON_TRAPDOOR = of(net.minecraft.block.Blocks.IRON_TRAPDOOR); - public static BlockWrapper PRISMARINE = of(net.minecraft.block.Blocks.PRISMARINE); - public static BlockWrapper PRISMARINE_BRICKS = of(net.minecraft.block.Blocks.PRISMARINE_BRICKS); - public static BlockWrapper DARK_PRISMARINE = of(net.minecraft.block.Blocks.DARK_PRISMARINE); - public static BlockWrapper PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_STAIRS); - public static BlockWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_STAIRS); - public static BlockWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.DARK_PRISMARINE_STAIRS); - public static BlockWrapper PRISMARINE_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_SLAB); - public static BlockWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_SLAB); - public static BlockWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.block.Blocks.DARK_PRISMARINE_SLAB); - public static BlockWrapper SEA_LANTERN = of(net.minecraft.block.Blocks.SEA_LANTERN); - public static BlockWrapper HAY_BLOCK = of(net.minecraft.block.Blocks.HAY_BLOCK); - public static BlockWrapper WHITE_CARPET = of(net.minecraft.block.Blocks.WHITE_CARPET); - public static BlockWrapper ORANGE_CARPET = of(net.minecraft.block.Blocks.ORANGE_CARPET); - public static BlockWrapper MAGENTA_CARPET = of(net.minecraft.block.Blocks.MAGENTA_CARPET); - public static BlockWrapper LIGHT_BLUE_CARPET = of(net.minecraft.block.Blocks.LIGHT_BLUE_CARPET); - public static BlockWrapper YELLOW_CARPET = of(net.minecraft.block.Blocks.YELLOW_CARPET); - public static BlockWrapper LIME_CARPET = of(net.minecraft.block.Blocks.LIME_CARPET); - public static BlockWrapper PINK_CARPET = of(net.minecraft.block.Blocks.PINK_CARPET); - public static BlockWrapper GRAY_CARPET = of(net.minecraft.block.Blocks.GRAY_CARPET); - public static BlockWrapper LIGHT_GRAY_CARPET = of(net.minecraft.block.Blocks.LIGHT_GRAY_CARPET); - public static BlockWrapper CYAN_CARPET = of(net.minecraft.block.Blocks.CYAN_CARPET); - public static BlockWrapper PURPLE_CARPET = of(net.minecraft.block.Blocks.PURPLE_CARPET); - public static BlockWrapper BLUE_CARPET = of(net.minecraft.block.Blocks.BLUE_CARPET); - public static BlockWrapper BROWN_CARPET = of(net.minecraft.block.Blocks.BROWN_CARPET); - public static BlockWrapper GREEN_CARPET = of(net.minecraft.block.Blocks.GREEN_CARPET); - public static BlockWrapper RED_CARPET = of(net.minecraft.block.Blocks.RED_CARPET); - public static BlockWrapper BLACK_CARPET = of(net.minecraft.block.Blocks.BLACK_CARPET); - public static BlockWrapper TERRACOTTA = of(net.minecraft.block.Blocks.TERRACOTTA); - public static BlockWrapper COAL_BLOCK = of(net.minecraft.block.Blocks.COAL_BLOCK); - public static BlockWrapper PACKED_ICE = of(net.minecraft.block.Blocks.PACKED_ICE); - public static BlockWrapper SUNFLOWER = of(net.minecraft.block.Blocks.SUNFLOWER); - public static BlockWrapper LILAC = of(net.minecraft.block.Blocks.LILAC); - public static BlockWrapper ROSE_BUSH = of(net.minecraft.block.Blocks.ROSE_BUSH); - public static BlockWrapper PEONY = of(net.minecraft.block.Blocks.PEONY); - public static BlockWrapper TALL_GRASS = of(net.minecraft.block.Blocks.TALL_GRASS); - public static BlockWrapper LARGE_FERN = of(net.minecraft.block.Blocks.LARGE_FERN); - public static BlockWrapper WHITE_BANNER = of(net.minecraft.block.Blocks.WHITE_BANNER); - public static BlockWrapper ORANGE_BANNER = of(net.minecraft.block.Blocks.ORANGE_BANNER); - public static BlockWrapper MAGENTA_BANNER = of(net.minecraft.block.Blocks.MAGENTA_BANNER); - public static BlockWrapper LIGHT_BLUE_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_BANNER); - public static BlockWrapper YELLOW_BANNER = of(net.minecraft.block.Blocks.YELLOW_BANNER); - public static BlockWrapper LIME_BANNER = of(net.minecraft.block.Blocks.LIME_BANNER); - public static BlockWrapper PINK_BANNER = of(net.minecraft.block.Blocks.PINK_BANNER); - public static BlockWrapper GRAY_BANNER = of(net.minecraft.block.Blocks.GRAY_BANNER); - public static BlockWrapper LIGHT_GRAY_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_BANNER); - public static BlockWrapper CYAN_BANNER = of(net.minecraft.block.Blocks.CYAN_BANNER); - public static BlockWrapper PURPLE_BANNER = of(net.minecraft.block.Blocks.PURPLE_BANNER); - public static BlockWrapper BLUE_BANNER = of(net.minecraft.block.Blocks.BLUE_BANNER); - public static BlockWrapper BROWN_BANNER = of(net.minecraft.block.Blocks.BROWN_BANNER); - public static BlockWrapper GREEN_BANNER = of(net.minecraft.block.Blocks.GREEN_BANNER); - public static BlockWrapper RED_BANNER = of(net.minecraft.block.Blocks.RED_BANNER); - public static BlockWrapper BLACK_BANNER = of(net.minecraft.block.Blocks.BLACK_BANNER); - public static BlockWrapper WHITE_WALL_BANNER = of(net.minecraft.block.Blocks.WHITE_WALL_BANNER); - public static BlockWrapper ORANGE_WALL_BANNER = of(net.minecraft.block.Blocks.ORANGE_WALL_BANNER); - public static BlockWrapper MAGENTA_WALL_BANNER = of(net.minecraft.block.Blocks.MAGENTA_WALL_BANNER); - public static BlockWrapper LIGHT_BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_WALL_BANNER); - public static BlockWrapper YELLOW_WALL_BANNER = of(net.minecraft.block.Blocks.YELLOW_WALL_BANNER); - public static BlockWrapper LIME_WALL_BANNER = of(net.minecraft.block.Blocks.LIME_WALL_BANNER); - public static BlockWrapper PINK_WALL_BANNER = of(net.minecraft.block.Blocks.PINK_WALL_BANNER); - public static BlockWrapper GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.GRAY_WALL_BANNER); - public static BlockWrapper LIGHT_GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_WALL_BANNER); - public static BlockWrapper CYAN_WALL_BANNER = of(net.minecraft.block.Blocks.CYAN_WALL_BANNER); - public static BlockWrapper PURPLE_WALL_BANNER = of(net.minecraft.block.Blocks.PURPLE_WALL_BANNER); - public static BlockWrapper BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.BLUE_WALL_BANNER); - public static BlockWrapper BROWN_WALL_BANNER = of(net.minecraft.block.Blocks.BROWN_WALL_BANNER); - public static BlockWrapper GREEN_WALL_BANNER = of(net.minecraft.block.Blocks.GREEN_WALL_BANNER); - public static BlockWrapper RED_WALL_BANNER = of(net.minecraft.block.Blocks.RED_WALL_BANNER); - public static BlockWrapper BLACK_WALL_BANNER = of(net.minecraft.block.Blocks.BLACK_WALL_BANNER); - public static BlockWrapper RED_SANDSTONE = of(net.minecraft.block.Blocks.RED_SANDSTONE); - public static BlockWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_RED_SANDSTONE); - public static BlockWrapper CUT_RED_SANDSTONE = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE); - public static BlockWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.RED_SANDSTONE_STAIRS); - public static BlockWrapper OAK_SLAB = of(net.minecraft.block.Blocks.OAK_SLAB); - public static BlockWrapper SPRUCE_SLAB = of(net.minecraft.block.Blocks.SPRUCE_SLAB); - public static BlockWrapper BIRCH_SLAB = of(net.minecraft.block.Blocks.BIRCH_SLAB); - public static BlockWrapper JUNGLE_SLAB = of(net.minecraft.block.Blocks.JUNGLE_SLAB); - public static BlockWrapper ACACIA_SLAB = of(net.minecraft.block.Blocks.ACACIA_SLAB); - public static BlockWrapper DARK_OAK_SLAB = of(net.minecraft.block.Blocks.DARK_OAK_SLAB); - public static BlockWrapper STONE_SLAB = of(net.minecraft.block.Blocks.STONE_SLAB); - public static BlockWrapper SMOOTH_STONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_STONE_SLAB); - public static BlockWrapper SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SANDSTONE_SLAB); - public static BlockWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_SANDSTONE_SLAB); - public static BlockWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.block.Blocks.PETRIFIED_OAK_SLAB); - public static BlockWrapper COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.COBBLESTONE_SLAB); - public static BlockWrapper BRICK_SLAB = of(net.minecraft.block.Blocks.BRICK_SLAB); - public static BlockWrapper STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.STONE_BRICK_SLAB); - public static BlockWrapper NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.NETHER_BRICK_SLAB); - public static BlockWrapper QUARTZ_SLAB = of(net.minecraft.block.Blocks.QUARTZ_SLAB); - public static BlockWrapper RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.RED_SANDSTONE_SLAB); - public static BlockWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE_SLAB); - public static BlockWrapper PURPUR_SLAB = of(net.minecraft.block.Blocks.PURPUR_SLAB); - public static BlockWrapper SMOOTH_STONE = of(net.minecraft.block.Blocks.SMOOTH_STONE); - public static BlockWrapper SMOOTH_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE); - public static BlockWrapper SMOOTH_QUARTZ = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ); - public static BlockWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE); - public static BlockWrapper SPRUCE_FENCE_GATE = of(net.minecraft.block.Blocks.SPRUCE_FENCE_GATE); - public static BlockWrapper BIRCH_FENCE_GATE = of(net.minecraft.block.Blocks.BIRCH_FENCE_GATE); - public static BlockWrapper JUNGLE_FENCE_GATE = of(net.minecraft.block.Blocks.JUNGLE_FENCE_GATE); - public static BlockWrapper ACACIA_FENCE_GATE = of(net.minecraft.block.Blocks.ACACIA_FENCE_GATE); - public static BlockWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE_GATE); - public static BlockWrapper SPRUCE_FENCE = of(net.minecraft.block.Blocks.SPRUCE_FENCE); - public static BlockWrapper BIRCH_FENCE = of(net.minecraft.block.Blocks.BIRCH_FENCE); - public static BlockWrapper JUNGLE_FENCE = of(net.minecraft.block.Blocks.JUNGLE_FENCE); - public static BlockWrapper ACACIA_FENCE = of(net.minecraft.block.Blocks.ACACIA_FENCE); - public static BlockWrapper DARK_OAK_FENCE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE); - public static BlockWrapper SPRUCE_DOOR = of(net.minecraft.block.Blocks.SPRUCE_DOOR); - public static BlockWrapper BIRCH_DOOR = of(net.minecraft.block.Blocks.BIRCH_DOOR); - public static BlockWrapper JUNGLE_DOOR = of(net.minecraft.block.Blocks.JUNGLE_DOOR); - public static BlockWrapper ACACIA_DOOR = of(net.minecraft.block.Blocks.ACACIA_DOOR); - public static BlockWrapper DARK_OAK_DOOR = of(net.minecraft.block.Blocks.DARK_OAK_DOOR); - public static BlockWrapper END_ROD = of(net.minecraft.block.Blocks.END_ROD); - public static BlockWrapper CHORUS_PLANT = of(net.minecraft.block.Blocks.CHORUS_PLANT); - public static BlockWrapper CHORUS_FLOWER = of(net.minecraft.block.Blocks.CHORUS_FLOWER); - public static BlockWrapper PURPUR_BLOCK = of(net.minecraft.block.Blocks.PURPUR_BLOCK); - public static BlockWrapper PURPUR_PILLAR = of(net.minecraft.block.Blocks.PURPUR_PILLAR); - public static BlockWrapper PURPUR_STAIRS = of(net.minecraft.block.Blocks.PURPUR_STAIRS); - public static BlockWrapper END_STONE_BRICKS = of(net.minecraft.block.Blocks.END_STONE_BRICKS); - public static BlockWrapper BEETROOTS = of(net.minecraft.block.Blocks.BEETROOTS); - public static BlockWrapper GRASS_PATH = of(net.minecraft.block.Blocks.DIRT_PATH); - public static BlockWrapper END_GATEWAY = of(net.minecraft.block.Blocks.END_GATEWAY); - public static BlockWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.block.Blocks.REPEATING_COMMAND_BLOCK); - public static BlockWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.block.Blocks.CHAIN_COMMAND_BLOCK); - public static BlockWrapper FROSTED_ICE = of(net.minecraft.block.Blocks.FROSTED_ICE); - public static BlockWrapper MAGMA_BLOCK = of(net.minecraft.block.Blocks.MAGMA_BLOCK); - public static BlockWrapper NETHER_WART_BLOCK = of(net.minecraft.block.Blocks.NETHER_WART_BLOCK); - public static BlockWrapper RED_NETHER_BRICKS = of(net.minecraft.block.Blocks.RED_NETHER_BRICKS); - public static BlockWrapper BONE_BLOCK = of(net.minecraft.block.Blocks.BONE_BLOCK); - public static BlockWrapper STRUCTURE_VOID = of(net.minecraft.block.Blocks.STRUCTURE_VOID); - public static BlockWrapper OBSERVER = of(net.minecraft.block.Blocks.OBSERVER); - public static BlockWrapper SHULKER_BOX = of(net.minecraft.block.Blocks.SHULKER_BOX); - public static BlockWrapper WHITE_SHULKER_BOX = of(net.minecraft.block.Blocks.WHITE_SHULKER_BOX); - public static BlockWrapper ORANGE_SHULKER_BOX = of(net.minecraft.block.Blocks.ORANGE_SHULKER_BOX); - public static BlockWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.block.Blocks.MAGENTA_SHULKER_BOX); - public static BlockWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_BLUE_SHULKER_BOX); - public static BlockWrapper YELLOW_SHULKER_BOX = of(net.minecraft.block.Blocks.YELLOW_SHULKER_BOX); - public static BlockWrapper LIME_SHULKER_BOX = of(net.minecraft.block.Blocks.LIME_SHULKER_BOX); - public static BlockWrapper PINK_SHULKER_BOX = of(net.minecraft.block.Blocks.PINK_SHULKER_BOX); - public static BlockWrapper GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.GRAY_SHULKER_BOX); - public static BlockWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_GRAY_SHULKER_BOX); - public static BlockWrapper CYAN_SHULKER_BOX = of(net.minecraft.block.Blocks.CYAN_SHULKER_BOX); - public static BlockWrapper PURPLE_SHULKER_BOX = of(net.minecraft.block.Blocks.PURPLE_SHULKER_BOX); - public static BlockWrapper BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.BLUE_SHULKER_BOX); - public static BlockWrapper BROWN_SHULKER_BOX = of(net.minecraft.block.Blocks.BROWN_SHULKER_BOX); - public static BlockWrapper GREEN_SHULKER_BOX = of(net.minecraft.block.Blocks.GREEN_SHULKER_BOX); - public static BlockWrapper RED_SHULKER_BOX = of(net.minecraft.block.Blocks.RED_SHULKER_BOX); - public static BlockWrapper BLACK_SHULKER_BOX = of(net.minecraft.block.Blocks.BLACK_SHULKER_BOX); - public static BlockWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_GLAZED_TERRACOTTA); - public static BlockWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_GLAZED_TERRACOTTA); - public static BlockWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_GLAZED_TERRACOTTA); - public static BlockWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA); - public static BlockWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_GLAZED_TERRACOTTA); - public static BlockWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_GLAZED_TERRACOTTA); - public static BlockWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_GLAZED_TERRACOTTA); - public static BlockWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_GLAZED_TERRACOTTA); - public static BlockWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA); - public static BlockWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_GLAZED_TERRACOTTA); - public static BlockWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_GLAZED_TERRACOTTA); - public static BlockWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_GLAZED_TERRACOTTA); - public static BlockWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_GLAZED_TERRACOTTA); - public static BlockWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_GLAZED_TERRACOTTA); - public static BlockWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_GLAZED_TERRACOTTA); - public static BlockWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_GLAZED_TERRACOTTA); - public static BlockWrapper WHITE_CONCRETE = of(net.minecraft.block.Blocks.WHITE_CONCRETE); - public static BlockWrapper ORANGE_CONCRETE = of(net.minecraft.block.Blocks.ORANGE_CONCRETE); - public static BlockWrapper MAGENTA_CONCRETE = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE); - public static BlockWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE); - public static BlockWrapper YELLOW_CONCRETE = of(net.minecraft.block.Blocks.YELLOW_CONCRETE); - public static BlockWrapper LIME_CONCRETE = of(net.minecraft.block.Blocks.LIME_CONCRETE); - public static BlockWrapper PINK_CONCRETE = of(net.minecraft.block.Blocks.PINK_CONCRETE); - public static BlockWrapper GRAY_CONCRETE = of(net.minecraft.block.Blocks.GRAY_CONCRETE); - public static BlockWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE); - public static BlockWrapper CYAN_CONCRETE = of(net.minecraft.block.Blocks.CYAN_CONCRETE); - public static BlockWrapper PURPLE_CONCRETE = of(net.minecraft.block.Blocks.PURPLE_CONCRETE); - public static BlockWrapper BLUE_CONCRETE = of(net.minecraft.block.Blocks.BLUE_CONCRETE); - public static BlockWrapper BROWN_CONCRETE = of(net.minecraft.block.Blocks.BROWN_CONCRETE); - public static BlockWrapper GREEN_CONCRETE = of(net.minecraft.block.Blocks.GREEN_CONCRETE); - public static BlockWrapper RED_CONCRETE = of(net.minecraft.block.Blocks.RED_CONCRETE); - public static BlockWrapper BLACK_CONCRETE = of(net.minecraft.block.Blocks.BLACK_CONCRETE); - public static BlockWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.WHITE_CONCRETE_POWDER); - public static BlockWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.ORANGE_CONCRETE_POWDER); - public static BlockWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE_POWDER); - public static BlockWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE_POWDER); - public static BlockWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.block.Blocks.YELLOW_CONCRETE_POWDER); - public static BlockWrapper LIME_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIME_CONCRETE_POWDER); - public static BlockWrapper PINK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PINK_CONCRETE_POWDER); - public static BlockWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GRAY_CONCRETE_POWDER); - public static BlockWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE_POWDER); - public static BlockWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.CYAN_CONCRETE_POWDER); - public static BlockWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PURPLE_CONCRETE_POWDER); - public static BlockWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLUE_CONCRETE_POWDER); - public static BlockWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BROWN_CONCRETE_POWDER); - public static BlockWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GREEN_CONCRETE_POWDER); - public static BlockWrapper RED_CONCRETE_POWDER = of(net.minecraft.block.Blocks.RED_CONCRETE_POWDER); - public static BlockWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLACK_CONCRETE_POWDER); - public static BlockWrapper KELP = of(net.minecraft.block.Blocks.KELP); - public static BlockWrapper KELP_PLANT = of(net.minecraft.block.Blocks.KELP_PLANT); - public static BlockWrapper DRIED_KELP_BLOCK = of(net.minecraft.block.Blocks.DRIED_KELP_BLOCK); - public static BlockWrapper TURTLE_EGG = of(net.minecraft.block.Blocks.TURTLE_EGG); - public static BlockWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_BLOCK); - public static BlockWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_BLOCK); - public static BlockWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_BLOCK); - public static BlockWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_BLOCK); - public static BlockWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_BLOCK); - public static BlockWrapper TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.TUBE_CORAL_BLOCK); - public static BlockWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.BRAIN_CORAL_BLOCK); - public static BlockWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.BUBBLE_CORAL_BLOCK); - public static BlockWrapper FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.FIRE_CORAL_BLOCK); - public static BlockWrapper HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.HORN_CORAL_BLOCK); - public static BlockWrapper DEAD_TUBE_CORAL = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL); - public static BlockWrapper DEAD_BRAIN_CORAL = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL); - public static BlockWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL); - public static BlockWrapper DEAD_FIRE_CORAL = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL); - public static BlockWrapper DEAD_HORN_CORAL = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL); - public static BlockWrapper TUBE_CORAL = of(net.minecraft.block.Blocks.TUBE_CORAL); - public static BlockWrapper BRAIN_CORAL = of(net.minecraft.block.Blocks.BRAIN_CORAL); - public static BlockWrapper BUBBLE_CORAL = of(net.minecraft.block.Blocks.BUBBLE_CORAL); - public static BlockWrapper FIRE_CORAL = of(net.minecraft.block.Blocks.FIRE_CORAL); - public static BlockWrapper HORN_CORAL = of(net.minecraft.block.Blocks.HORN_CORAL); - public static BlockWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_FAN); - public static BlockWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_FAN); - public static BlockWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_FAN); - public static BlockWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_FAN); - public static BlockWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_FAN); - public static BlockWrapper TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_FAN); - public static BlockWrapper BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_FAN); - public static BlockWrapper BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_FAN); - public static BlockWrapper FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_FAN); - public static BlockWrapper HORN_CORAL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_FAN); - public static BlockWrapper DEAD_TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_WALL_FAN); - public static BlockWrapper DEAD_BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_WALL_FAN); - public static BlockWrapper DEAD_BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_WALL_FAN); - public static BlockWrapper DEAD_FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_WALL_FAN); - public static BlockWrapper DEAD_HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_WALL_FAN); - public static BlockWrapper TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_WALL_FAN); - public static BlockWrapper BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_WALL_FAN); - public static BlockWrapper BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_WALL_FAN); - public static BlockWrapper FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_WALL_FAN); - public static BlockWrapper HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_WALL_FAN); - public static BlockWrapper SEA_PICKLE = of(net.minecraft.block.Blocks.SEA_PICKLE); - public static BlockWrapper BLUE_ICE = of(net.minecraft.block.Blocks.BLUE_ICE); - public static BlockWrapper CONDUIT = of(net.minecraft.block.Blocks.CONDUIT); - public static BlockWrapper BAMBOO_SAPLING = of(net.minecraft.block.Blocks.BAMBOO_SAPLING); - public static BlockWrapper BAMBOO = of(net.minecraft.block.Blocks.BAMBOO); - public static BlockWrapper POTTED_BAMBOO = of(net.minecraft.block.Blocks.POTTED_BAMBOO); - public static BlockWrapper VOID_AIR = of(net.minecraft.block.Blocks.VOID_AIR); - public static BlockWrapper CAVE_AIR = of(net.minecraft.block.Blocks.CAVE_AIR); - public static BlockWrapper BUBBLE_COLUMN = of(net.minecraft.block.Blocks.BUBBLE_COLUMN); - public static BlockWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_GRANITE_STAIRS); - public static BlockWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_STAIRS); - public static BlockWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_STAIRS); - public static BlockWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_DIORITE_STAIRS); - public static BlockWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_STAIRS); - public static BlockWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.END_STONE_BRICK_STAIRS); - public static BlockWrapper STONE_STAIRS = of(net.minecraft.block.Blocks.STONE_STAIRS); - public static BlockWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_STAIRS); - public static BlockWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_STAIRS); - public static BlockWrapper GRANITE_STAIRS = of(net.minecraft.block.Blocks.GRANITE_STAIRS); - public static BlockWrapper ANDESITE_STAIRS = of(net.minecraft.block.Blocks.ANDESITE_STAIRS); - public static BlockWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_STAIRS); - public static BlockWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_STAIRS); - public static BlockWrapper DIORITE_STAIRS = of(net.minecraft.block.Blocks.DIORITE_STAIRS); - public static BlockWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_GRANITE_SLAB); - public static BlockWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_SLAB); - public static BlockWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_SLAB); - public static BlockWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_DIORITE_SLAB); - public static BlockWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_SLAB); - public static BlockWrapper END_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.END_STONE_BRICK_SLAB); - public static BlockWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_SLAB); - public static BlockWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_SLAB); - public static BlockWrapper GRANITE_SLAB = of(net.minecraft.block.Blocks.GRANITE_SLAB); - public static BlockWrapper ANDESITE_SLAB = of(net.minecraft.block.Blocks.ANDESITE_SLAB); - public static BlockWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_SLAB); - public static BlockWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_SLAB); - public static BlockWrapper DIORITE_SLAB = of(net.minecraft.block.Blocks.DIORITE_SLAB); - public static BlockWrapper BRICK_WALL = of(net.minecraft.block.Blocks.BRICK_WALL); - public static BlockWrapper PRISMARINE_WALL = of(net.minecraft.block.Blocks.PRISMARINE_WALL); - public static BlockWrapper RED_SANDSTONE_WALL = of(net.minecraft.block.Blocks.RED_SANDSTONE_WALL); - public static BlockWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_WALL); - public static BlockWrapper GRANITE_WALL = of(net.minecraft.block.Blocks.GRANITE_WALL); - public static BlockWrapper STONE_BRICK_WALL = of(net.minecraft.block.Blocks.STONE_BRICK_WALL); - public static BlockWrapper NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.NETHER_BRICK_WALL); - public static BlockWrapper ANDESITE_WALL = of(net.minecraft.block.Blocks.ANDESITE_WALL); - public static BlockWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_WALL); - public static BlockWrapper SANDSTONE_WALL = of(net.minecraft.block.Blocks.SANDSTONE_WALL); - public static BlockWrapper END_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.END_STONE_BRICK_WALL); - public static BlockWrapper DIORITE_WALL = of(net.minecraft.block.Blocks.DIORITE_WALL); - public static BlockWrapper SCAFFOLDING = of(net.minecraft.block.Blocks.SCAFFOLDING); - public static BlockWrapper LOOM = of(net.minecraft.block.Blocks.LOOM); - public static BlockWrapper BARREL = of(net.minecraft.block.Blocks.BARREL); - public static BlockWrapper SMOKER = of(net.minecraft.block.Blocks.SMOKER); - public static BlockWrapper BLAST_FURNACE = of(net.minecraft.block.Blocks.BLAST_FURNACE); - public static BlockWrapper CARTOGRAPHY_TABLE = of(net.minecraft.block.Blocks.CARTOGRAPHY_TABLE); - public static BlockWrapper FLETCHING_TABLE = of(net.minecraft.block.Blocks.FLETCHING_TABLE); - public static BlockWrapper GRINDSTONE = of(net.minecraft.block.Blocks.GRINDSTONE); - public static BlockWrapper LECTERN = of(net.minecraft.block.Blocks.LECTERN); - public static BlockWrapper SMITHING_TABLE = of(net.minecraft.block.Blocks.SMITHING_TABLE); - public static BlockWrapper STONECUTTER = of(net.minecraft.block.Blocks.STONECUTTER); - public static BlockWrapper BELL = of(net.minecraft.block.Blocks.BELL); - public static BlockWrapper LANTERN = of(net.minecraft.block.Blocks.LANTERN); - public static BlockWrapper SOUL_LANTERN = of(net.minecraft.block.Blocks.SOUL_LANTERN); - public static BlockWrapper CAMPFIRE = of(net.minecraft.block.Blocks.CAMPFIRE); - public static BlockWrapper SOUL_CAMPFIRE = of(net.minecraft.block.Blocks.SOUL_CAMPFIRE); - public static BlockWrapper SWEET_BERRY_BUSH = of(net.minecraft.block.Blocks.SWEET_BERRY_BUSH); - public static BlockWrapper WARPED_STEM = of(net.minecraft.block.Blocks.WARPED_STEM); - public static BlockWrapper STRIPPED_WARPED_STEM = of(net.minecraft.block.Blocks.STRIPPED_WARPED_STEM); - public static BlockWrapper WARPED_HYPHAE = of(net.minecraft.block.Blocks.WARPED_HYPHAE); - public static BlockWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_WARPED_HYPHAE); - public static BlockWrapper WARPED_NYLIUM = of(net.minecraft.block.Blocks.WARPED_NYLIUM); - public static BlockWrapper WARPED_FUNGUS = of(net.minecraft.block.Blocks.WARPED_FUNGUS); - public static BlockWrapper WARPED_WART_BLOCK = of(net.minecraft.block.Blocks.WARPED_WART_BLOCK); - public static BlockWrapper WARPED_ROOTS = of(net.minecraft.block.Blocks.WARPED_ROOTS); - public static BlockWrapper NETHER_SPROUTS = of(net.minecraft.block.Blocks.NETHER_SPROUTS); - public static BlockWrapper CRIMSON_STEM = of(net.minecraft.block.Blocks.CRIMSON_STEM); - public static BlockWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_STEM); - public static BlockWrapper CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.CRIMSON_HYPHAE); - public static BlockWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_HYPHAE); - public static BlockWrapper CRIMSON_NYLIUM = of(net.minecraft.block.Blocks.CRIMSON_NYLIUM); - public static BlockWrapper CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.CRIMSON_FUNGUS); - public static BlockWrapper SHROOMLIGHT = of(net.minecraft.block.Blocks.SHROOMLIGHT); - public static BlockWrapper WEEPING_VINES = of(net.minecraft.block.Blocks.WEEPING_VINES); - public static BlockWrapper WEEPING_VINES_PLANT = of(net.minecraft.block.Blocks.WEEPING_VINES_PLANT); - public static BlockWrapper TWISTING_VINES = of(net.minecraft.block.Blocks.TWISTING_VINES); - public static BlockWrapper TWISTING_VINES_PLANT = of(net.minecraft.block.Blocks.TWISTING_VINES_PLANT); - public static BlockWrapper CRIMSON_ROOTS = of(net.minecraft.block.Blocks.CRIMSON_ROOTS); - public static BlockWrapper CRIMSON_PLANKS = of(net.minecraft.block.Blocks.CRIMSON_PLANKS); - public static BlockWrapper WARPED_PLANKS = of(net.minecraft.block.Blocks.WARPED_PLANKS); - public static BlockWrapper CRIMSON_SLAB = of(net.minecraft.block.Blocks.CRIMSON_SLAB); - public static BlockWrapper WARPED_SLAB = of(net.minecraft.block.Blocks.WARPED_SLAB); - public static BlockWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.block.Blocks.CRIMSON_PRESSURE_PLATE); - public static BlockWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.WARPED_PRESSURE_PLATE); - public static BlockWrapper CRIMSON_FENCE = of(net.minecraft.block.Blocks.CRIMSON_FENCE); - public static BlockWrapper WARPED_FENCE = of(net.minecraft.block.Blocks.WARPED_FENCE); - public static BlockWrapper CRIMSON_TRAPDOOR = of(net.minecraft.block.Blocks.CRIMSON_TRAPDOOR); - public static BlockWrapper WARPED_TRAPDOOR = of(net.minecraft.block.Blocks.WARPED_TRAPDOOR); - public static BlockWrapper CRIMSON_FENCE_GATE = of(net.minecraft.block.Blocks.CRIMSON_FENCE_GATE); - public static BlockWrapper WARPED_FENCE_GATE = of(net.minecraft.block.Blocks.WARPED_FENCE_GATE); - public static BlockWrapper CRIMSON_STAIRS = of(net.minecraft.block.Blocks.CRIMSON_STAIRS); - public static BlockWrapper WARPED_STAIRS = of(net.minecraft.block.Blocks.WARPED_STAIRS); - public static BlockWrapper CRIMSON_BUTTON = of(net.minecraft.block.Blocks.CRIMSON_BUTTON); - public static BlockWrapper WARPED_BUTTON = of(net.minecraft.block.Blocks.WARPED_BUTTON); - public static BlockWrapper CRIMSON_DOOR = of(net.minecraft.block.Blocks.CRIMSON_DOOR); - public static BlockWrapper WARPED_DOOR = of(net.minecraft.block.Blocks.WARPED_DOOR); - public static BlockWrapper CRIMSON_SIGN = of(net.minecraft.block.Blocks.CRIMSON_SIGN); - public static BlockWrapper WARPED_SIGN = of(net.minecraft.block.Blocks.WARPED_SIGN); - public static BlockWrapper CRIMSON_WALL_SIGN = of(net.minecraft.block.Blocks.CRIMSON_WALL_SIGN); - public static BlockWrapper WARPED_WALL_SIGN = of(net.minecraft.block.Blocks.WARPED_WALL_SIGN); - public static BlockWrapper STRUCTURE_BLOCK = of(net.minecraft.block.Blocks.STRUCTURE_BLOCK); - public static BlockWrapper JIGSAW = of(net.minecraft.block.Blocks.JIGSAW); - public static BlockWrapper COMPOSTER = of(net.minecraft.block.Blocks.COMPOSTER); - public static BlockWrapper TARGET = of(net.minecraft.block.Blocks.TARGET); - public static BlockWrapper BEE_NEST = of(net.minecraft.block.Blocks.BEE_NEST); - public static BlockWrapper BEEHIVE = of(net.minecraft.block.Blocks.BEEHIVE); - public static BlockWrapper HONEY_BLOCK = of(net.minecraft.block.Blocks.HONEY_BLOCK); - public static BlockWrapper HONEYCOMB_BLOCK = of(net.minecraft.block.Blocks.HONEYCOMB_BLOCK); - public static BlockWrapper NETHERITE_BLOCK = of(net.minecraft.block.Blocks.NETHERITE_BLOCK); - public static BlockWrapper ANCIENT_DEBRIS = of(net.minecraft.block.Blocks.ANCIENT_DEBRIS); - public static BlockWrapper CRYING_OBSIDIAN = of(net.minecraft.block.Blocks.CRYING_OBSIDIAN); - public static BlockWrapper RESPAWN_ANCHOR = of(net.minecraft.block.Blocks.RESPAWN_ANCHOR); - public static BlockWrapper POTTED_CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_FUNGUS); - public static BlockWrapper POTTED_WARPED_FUNGUS = of(net.minecraft.block.Blocks.POTTED_WARPED_FUNGUS); - public static BlockWrapper POTTED_CRIMSON_ROOTS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_ROOTS); - public static BlockWrapper POTTED_WARPED_ROOTS = of(net.minecraft.block.Blocks.POTTED_WARPED_ROOTS); - public static BlockWrapper LODESTONE = of(net.minecraft.block.Blocks.LODESTONE); - public static BlockWrapper BLACKSTONE = of(net.minecraft.block.Blocks.BLACKSTONE); - public static BlockWrapper BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.BLACKSTONE_STAIRS); - public static BlockWrapper BLACKSTONE_WALL = of(net.minecraft.block.Blocks.BLACKSTONE_WALL); - public static BlockWrapper BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.BLACKSTONE_SLAB); - public static BlockWrapper POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE); - public static BlockWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICKS); - public static BlockWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_POLISHED_BLACKSTONE_BRICKS); - public static BlockWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.CHISELED_POLISHED_BLACKSTONE); - public static BlockWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_SLAB); - public static BlockWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS); - public static BlockWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_WALL); - public static BlockWrapper GILDED_BLACKSTONE = of(net.minecraft.block.Blocks.GILDED_BLACKSTONE); - public static BlockWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_STAIRS); - public static BlockWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_SLAB); - public static BlockWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_PRESSURE_PLATE); - public static BlockWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BUTTON); - public static BlockWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_WALL); - public static BlockWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CHISELED_NETHER_BRICKS); - public static BlockWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CRACKED_NETHER_BRICKS); - public static BlockWrapper QUARTZ_BRICKS = of(net.minecraft.block.Blocks.QUARTZ_BRICKS); - - public static BlockWrapper of(net.minecraft.block.Block block) { - return BlockWrapper.of(block); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java deleted file mode 100644 index ba604f61b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block; - -import net.minecraft.block.Block; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; - -import java.util.function.Supplier; - -public class SupplierBlockWrapper extends BlockWrapper { - private final Supplier supplier; - - protected SupplierBlockWrapper(Supplier supplier) { - this.supplier = supplier; - } - - public static SupplierBlockWrapper of(Supplier supplier) { - return new SupplierBlockWrapper(supplier); - } - - public static SupplierBlockWrapper of(RegistryResult result) { - return new SupplierBlockWrapper(result::get); - } - - @Override - public Block get() { - return supplier.get(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java deleted file mode 100644 index 0a066a984..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block.entity; - -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.BlockView; - -public class BlockEntityTypeWrapper { - private final net.minecraft.block.entity.BlockEntityType type; - - public static final BlockEntityTypeWrapper EMPTY = new BlockEntityTypeWrapper(); - - protected BlockEntityTypeWrapper() { - this.type = null; - } - - protected BlockEntityTypeWrapper(net.minecraft.block.entity.BlockEntityType blockEntity) { - this.type = blockEntity; - } - - public static BlockEntityTypeWrapper of(net.minecraft.block.entity.BlockEntityType blockEntity) { - return new BlockEntityTypeWrapper(blockEntity); - } - - public static BlockEntityTypeWrapper of() { - return EMPTY; - } - - public net.minecraft.block.entity.BlockEntityType get() { - return type; - } - - public boolean isEmpty() { - return get() == null; - } - - public boolean isPresent() { - return get() != null; - } - - public boolean supports(BlockState state) { - return isPresent() && get().supports(state.toMinecraft()); - } - - public BlockEntityWrapper getBlockEntity(BlockView world, BlockPos pos) { - if (isEmpty()) - return BlockEntityWrapper.EMPTY; - - return SupplierBlockEntityWrapper.of(get().get(world.getRaw(), pos.toMinecraft())); - } - - public BlockEntityWrapper createBlockEntity(TileCreateEvent e) { - if (isEmpty()) - return BlockEntityWrapper.EMPTY; - - return SupplierBlockEntityWrapper.of(get().instantiate(e.getBlockPos(), e.getBlockState())); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java deleted file mode 100644 index 7b3ac02d8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java +++ /dev/null @@ -1,133 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block.entity; - -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; -import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; -import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockEntity; -import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.World; - -import java.util.Optional; - -public class BlockEntityWrapper { - private final net.minecraft.block.entity.BlockEntity blockEntity; - - public static final BlockEntityWrapper EMPTY = new BlockEntityWrapper(null); - - protected BlockEntityWrapper() { - this.blockEntity = null; - } - - protected BlockEntityWrapper(net.minecraft.block.entity.BlockEntity blockEntity) { - this.blockEntity = blockEntity; - } - - public static BlockEntityWrapper of(net.minecraft.block.entity.BlockEntity blockEntity) { - return new BlockEntityWrapper(blockEntity); - } - - public static BlockEntityWrapper of() { - return EMPTY; - } - - public net.minecraft.block.entity.BlockEntity get() { - return blockEntity; - } - - public BlockPos getPos() { - return BlockPos.of(get().getPos()); - } - - public boolean isPresent() { - return !isEmpty(); - } - - public boolean isEmpty() { - return this == EMPTY || get() == null; - } - - public boolean isRemoved() { - return get().isRemoved(); - } - - public void markDirty() { - BlockEntityUtil.markDirty(get()); - } - - public World getWorld() { - return World.of(BlockEntityUtil.getWorld(get())); - } - - public BlockWrapper getBlock() { - return BlockWrapper.of(BlockEntityUtil.getBlock(get())); - } - - - public BlockState getBlockState() { - return BlockState.of(BlockEntityUtil.getBlockState(get())); - } - - public BlockState getCachedState() { - return BlockState.of(BlockEntityUtil.getCachedState(get())); - } - - public NbtCompound createNbt() { - return NbtCompound.of(BlockEntityUtil.getBlockEntityNbt(get())); - } - - public void markRemoved() { - BlockEntityUtil.markRemoved(get()); - } - - public void writeNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { - BlockEntityUtil.writeNbt(get(), nbt.toMinecraft(), registryLookup); - } - - public void readNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { - BlockEntityUtil.readNbt(get(), nbt.toMinecraft(), registryLookup); - } - - public void writeNbt(NbtCompound nbt) { - writeNbt(nbt, RegistryLookupUtil.getRegistryLookup(get())); - } - - public void readNbt(NbtCompound nbt) { - readNbt(nbt, RegistryLookupUtil.getRegistryLookup(get())); - } - - @Override - public int hashCode() { - return get() != null ? get().hashCode() : 0; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - BlockEntityWrapper blockEntity = (BlockEntityWrapper) obj; - return get() == blockEntity.get(); - } - - public static BlockEntityWrapper of(BlockPos pos, World world) { - net.minecraft.block.entity.BlockEntity blockEntity = BlockEntityUtil.getBlockEntity(world.toMinecraft(), pos.toMinecraft()); - return of(blockEntity); - } - - public Optional toCompatBlockEntity() { - if (get() instanceof CompatBlockEntity) { - return Optional.of((CompatBlockEntity) get()); - } - return Optional.empty(); - } - - public Optional toBuiltBlockEntity() { - if (get() instanceof BuiltBlockEntity) { - return Optional.of((BuiltBlockEntity) get()); - } - return Optional.empty(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java deleted file mode 100644 index c8f5b38cf..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block.entity; - -import net.minecraft.block.entity.BlockEntityType; - -public class RewritableBlockEntityTypeWrapper extends BlockEntityTypeWrapper { - private BlockEntityType type; - - protected RewritableBlockEntityTypeWrapper(BlockEntityType type) { - this.type = type; - } - - protected RewritableBlockEntityTypeWrapper() { - - } - - public static RewritableBlockEntityTypeWrapper of(BlockEntityType type) { - return new RewritableBlockEntityTypeWrapper(type); - } - - public static RewritableBlockEntityTypeWrapper of() { - return new RewritableBlockEntityTypeWrapper(); - } - - public void set(BlockEntityType type) { - this.type = type; - } - - @Override - public BlockEntityType get() { - return type; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java deleted file mode 100644 index c0ea96ed4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block.entity; - -import net.minecraft.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; - -import java.util.function.Supplier; - -public class SupplierBlockEntityTypeWrapper extends BlockEntityTypeWrapper { - private final Supplier> supplier; - - protected SupplierBlockEntityTypeWrapper(Supplier> supplier) { - this.supplier = supplier; - } - - public static SupplierBlockEntityTypeWrapper of(Supplier> supplier) { - return new SupplierBlockEntityTypeWrapper(supplier); - } - - public static SupplierBlockEntityTypeWrapper of(RegistryResult> result) { - return new SupplierBlockEntityTypeWrapper(result::get); - } - - @Override - public BlockEntityType get() { - return supplier.get(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java deleted file mode 100644 index 202a0d31a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.block.entity; - -import net.minecraft.block.entity.BlockEntity; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; - -import java.util.function.Supplier; - -public class SupplierBlockEntityWrapper extends BlockEntityWrapper { - private final Supplier supplier; - - protected SupplierBlockEntityWrapper(Supplier supplier) { - this.supplier = supplier; - } - - public static SupplierBlockEntityWrapper of(Supplier supplier) { - return new SupplierBlockEntityWrapper(supplier); - } - - public static SupplierBlockEntityWrapper of(RegistryResult result) { - return new SupplierBlockEntityWrapper(result::get); - } - - @Override - public BlockEntity get() { - return supplier.get(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java deleted file mode 100644 index 87e288635..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.client.render; - -import net.minecraft.client.render.Camera; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; - -import java.util.Objects; - -public class CameraWrapper { - private final Camera camera; - - protected CameraWrapper(Camera camera) { - this.camera = camera; - } - - protected CameraWrapper() { - this.camera = null; - } - - public static CameraWrapper of(Camera camera) { - return new CameraWrapper(camera); - } - - public static CameraWrapper of() { - return new CameraWrapper(); - } - - public Camera get() { - return camera; - } - - public boolean isPresent() { - return !isEmpty(); - } - - public boolean isEmpty() { - return camera == null; - } - - public Vector3d getCameraPos() { - if (isEmpty()) return Vector3d.zero(); - return Vector3d.of(camera.getCameraPos()); - } - - public BlockPos getBlockPos() { - if (isEmpty()) return BlockPos.of(0, 0, 0); - return BlockPos.of(camera.getBlockPos()); - } - - public float getYaw() { - if (isEmpty()) return 0f; - return camera.getYaw(); - } - - public float getPitch() { - if (isEmpty()) return 0f; - return camera.getPitch(); - } - - @Override - public int hashCode() { - return camera != null ? camera.hashCode() : 0; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - CameraWrapper other = (CameraWrapper) obj; - return Objects.equals(camera, other.camera); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java deleted file mode 100644 index 24c454008..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java +++ /dev/null @@ -1,132 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.component; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.TypedEntityData; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.text.Text; -import net.minecraft.util.Rarity; -import net.minecraft.util.Unit; -import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; -import net.pitan76.mcpitanlib.api.util.*; -import net.pitan76.mcpitanlib.midohra.component.item.CustomNameComponentType; -import net.pitan76.mcpitanlib.midohra.component.item.ItemComponentType; -import net.pitan76.mcpitanlib.midohra.component.item.RarityComponentType; - -import java.util.List; - -public class ItemComponentTypes { - public static final ItemComponentType CUSTOM_DATA = new ItemComponentType<>(DataComponentTypes.CUSTOM_DATA) { - @Override - public void put(ItemStack stack, NbtCompound value) { - CustomDataUtil.setNbt(stack, value); - } - - @Override - public NbtCompound get(ItemStack stack) { - return CustomDataUtil.getNbt(stack); - } - }; - - public static final ItemComponentType MAX_STACK_SIZE = new ItemComponentType<>(DataComponentTypes.MAX_STACK_SIZE) { - @Override - public void put(ItemStack stack, Integer value) { - stack.set(DataComponentTypes.MAX_STACK_SIZE, value); - } - - @Override - public Integer get(ItemStack stack) { - return stack.getMaxCount(); - } - }; - - public static final ItemComponentType MAX_DAMAGE = new ItemComponentType<>(DataComponentTypes.MAX_DAMAGE) { - @Override - public void put(ItemStack stack, Integer value) { - stack.set(DataComponentTypes.MAX_DAMAGE, value); - } - - @Override - public Integer get(ItemStack stack) { - return stack.getMaxDamage(); - } - }; - - public static final ItemComponentType DAMAGE = new ItemComponentType<>(DataComponentTypes.DAMAGE) { - @Override - public void put(ItemStack stack, Integer value) { - stack.setDamage(value); - } - - @Override - public Integer get(ItemStack stack) { - return stack.getDamage(); - } - }; - - public static final ItemComponentType UNBREAKABLE = new ItemComponentType<>(DataComponentTypes.UNBREAKABLE) { - @Override - public void put(ItemStack stack, Boolean value) { - if (value) { - stack.set(DataComponentTypes.UNBREAKABLE, Unit.valueOf("")); - } else { - stack.remove(DataComponentTypes.UNBREAKABLE); - } - } - - @Override - public Boolean get(ItemStack stack) { - return has(stack); - } - }; - - public static final ItemComponentType RARITY = new RarityComponentType(); - - public static final CustomNameComponentType CUSTOM_NAME = new CustomNameComponentType(); - - public static final ItemComponentType BLOCK_ENTITY_DATA = new ItemComponentType<>(DataComponentTypes.BLOCK_ENTITY_DATA) { - @Override - public void put(ItemStack stack, NbtCompound value) { - BlockEntityDataUtil.setBlockEntityNbt(stack, value); - } - - @Override - public NbtCompound get(ItemStack stack) { - return BlockEntityDataUtil.getBlockEntityNbt(stack); - } - }; - - public static final ItemComponentType ENTITY_DATA = new ItemComponentType<>(DataComponentTypes.ENTITY_DATA) { - @Override - public void put(ItemStack stack, NbtCompound value) { - EntityType type = EntityTypeUtil.fromId(CompatIdentifier.of(NbtUtil.getString(value, "id"))); - stack.set(DataComponentTypes.ENTITY_DATA, TypedEntityData.create(type, value)); - } - - @Override - public NbtCompound get(ItemStack stack) { - if (!has(stack)) return NbtUtil.create(); - if (!stack.contains(DataComponentTypes.ENTITY_DATA)) return NbtUtil.create(); - - TypedEntityData> data = stack.get(DataComponentTypes.ENTITY_DATA); - NbtCompound nbt = data.copyNbtWithoutId(); - - String id = EntityTypeUtil.toID(data.getType()).toString(); - NbtUtil.putString(nbt, "id", id); - return nbt; - } - }; - - public static final ItemComponentType> LORE = new ItemComponentType<>(DataComponentTypes.LORE) { - @Override - public void put(ItemStack stack, List value) { - LoreUtil.setLore(stack, value); - } - - @Override - public List get(ItemStack stack) { - return LoreUtil.getLore(stack); - } - }; -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java deleted file mode 100644 index b4fd2b700..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.component.item; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; - -public class CustomNameComponentType extends ItemComponentType { - - public CustomNameComponentType() { - super(DataComponentTypes.CUSTOM_NAME); - } - - @Override - public void put(ItemStack stack, Text value) { - stack.set(DataComponentTypes.CUSTOM_NAME, value); - } - - @Override - public Text get(ItemStack stack) { - if (!has(stack)) return Text.empty(); - return stack.get(DataComponentTypes.CUSTOM_NAME); - } - - public String getAsString(ItemStack stack) { - return get(stack).getString(); - } - - public void put(ItemStack stack, String name) { - put(stack, Text.literal(name)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java deleted file mode 100644 index e45e00eef..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.component.item; - -import net.minecraft.component.ComponentType; -import net.minecraft.item.ItemStack; - -public abstract class ItemComponentType { - - private final ComponentType type; - - protected ItemComponentType(ComponentType type) { - this.type = type; - } - - public abstract void put(ItemStack stack, T value); - - public abstract T get(ItemStack stack); - - public boolean has(ItemStack stack) { - return stack.contains(type); - } - - public void putOrDefault(ItemStack stack, T value, T defaultValue) { - if (value.equals(defaultValue)) return; - put(stack, value); - } - - public T getOrDefault(ItemStack stack, T defaultValue) { - if (!has(stack)) return defaultValue; - return get(stack); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java deleted file mode 100644 index 2fb1ef26e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.component.item; - -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Rarity; -import net.pitan76.mcpitanlib.api.util.CompatRarity; - -public class RarityComponentType extends ItemComponentType { - - public RarityComponentType() { - super(DataComponentTypes.RARITY); - } - - @Override - public void put(ItemStack stack, Rarity value) { - stack.set(DataComponentTypes.RARITY, value); - } - - @Override - public Rarity get(ItemStack stack) { - return stack.getRarity(); - } - - public void put(ItemStack stack, CompatRarity rarity) { - put(stack, rarity.get()); - } - - public CompatRarity getCompatRarity(ItemStack stack) { - return CompatRarity.of(get(stack)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java deleted file mode 100644 index 587531855..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder; - -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.CommonModInitializer; -import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; -import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; -import net.pitan76.mcpitanlib.api.block.v2.BlockSettingsBuilder; -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; -import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; -import net.pitan76.mcpitanlib.api.event.block.DroppedStacksArgs; -import net.pitan76.mcpitanlib.api.event.block.StateReplacedEvent; -import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.color.CompatDyeColor; -import net.pitan76.mcpitanlib.api.util.color.CompatMapColor; -import net.pitan76.mcpitanlib.api.util.item.ItemUtil; -import net.pitan76.mcpitanlib.core.datafixer.Pair; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; -import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlock; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import net.pitan76.mcpitanlib.midohra.item.SupplierItemWrapper; -import net.pitan76.mcpitanlib.midohra.util.shape.VoxelShape; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.*; - -public class BlockBuilder { - - public BlockSettingsBuilder settingsBuilder; - public Function onRightClick; - public Consumer onStateReplaced; - public Consumer onAppendTooltip; - public Consumer onAppendProperties; - public BlockState defaultState; - public BiConsumer onInit; - public Function onOutlineShape; - public Function onCollisionShape; - public Function onRenderType; - public Function onPlacementState; - public Function onStateForNeighborUpdate; - public Function> onDroppedStacks; - - public BlockBuilder(BlockSettingsBuilder settingsBuilder) { - this.settingsBuilder = settingsBuilder; - } - - public BlockBuilder(CompatIdentifier id) { - this(new BlockSettingsBuilder(id)); - } - - public static BlockBuilder of(CompatIdentifier id) { - return new BlockBuilder(id); - } - - public static BlockBuilder of(BlockSettingsBuilder settingsBuilder) { - return new BlockBuilder(settingsBuilder); - } - - public SupplierBlockWrapper build(CompatRegistryV2 registry) { - if (settingsBuilder.id == null) - throw new IllegalStateException("Block id is not set. hint: use build(CompatRegistryV2, CompatIdentifier)"); - - Supplier result = registry.registerExtendBlock(settingsBuilder.id, () -> new BuiltBlock(this)); - - return SupplierBlockWrapper.of(result::get); - } - - public SupplierBlockWrapper build(CompatRegistryV2 registry, CompatIdentifier id) { - Supplier result = registry.registerExtendBlock(id, () -> new BuiltBlock(this, id)); - - return SupplierBlockWrapper.of(result::get); - } - - public SupplierBlockWrapper build(CommonModInitializer initializer) { - return build(initializer.registry); - } - - public SupplierBlockWrapper build(CommonModInitializer initializer, CompatIdentifier id) { - return build(initializer.registry, id); - } - - public Pair buildWithItem(CompatRegistryV2 registry, CompatibleItemSettings settings) { - SupplierBlockWrapper block = build(registry); - - RegistryResult result = registry.registerItem(settingsBuilder.id, () -> ItemUtil.create(block.get(), settings)); - - return Pair.of(block, SupplierItemWrapper.of(result::get)); - } - - public Pair buildWithItem(CompatRegistryV2 registry, CompatIdentifier id, CompatibleItemSettings settings) { - SupplierBlockWrapper block = build(registry, id); - - RegistryResult result = registry.registerItem(id, () -> ItemUtil.create(block.get(), settings.setId(id))); - - return Pair.of(block, SupplierItemWrapper.of(result::get)); - } - - public Pair buildWithItem(CommonModInitializer initializer, CompatibleItemSettings settings) { - return buildWithItem(initializer.registry, settings); - } - - public Pair buildWithItem(CommonModInitializer initializer, CompatIdentifier id, CompatibleItemSettings settings) { - return buildWithItem(initializer.registry, id, settings); - } - - public BlockBuilder material(CompatibleMaterial material) { - settingsBuilder.material(material); - return this; - } - - public BlockBuilder sounds(CompatBlockSoundGroup sounds) { - settingsBuilder.sounds(sounds); - return this; - } - - public BlockBuilder strength(float hardness, float resistance) { - settingsBuilder.strength(hardness, resistance); - return this; - } - - public BlockBuilder strength(float hardness) { - settingsBuilder.hardness(hardness); - return this; - } - - public BlockBuilder resistance(float resistance) { - settingsBuilder.resistance(resistance); - return this; - } - - public BlockBuilder mapColor(CompatMapColor color) { - settingsBuilder.mapColor(color); - return this; - } - - public BlockBuilder mapColor(CompatDyeColor color) { - settingsBuilder.dyeColor(color); - return this; - } - - public BlockBuilder luminance(ToIntFunction luminance) { - settingsBuilder.luminance(luminance); - return this; - } - - public BlockBuilder requiresTool() { - settingsBuilder.requiresTool(); - return this; - } - - public BlockBuilder dropsNothing() { - settingsBuilder.dropsNothing(); - return this; - } - - public BlockBuilder onRightClick(Function onRightClick) { - this.onRightClick = onRightClick; - return this; - } - - public BlockBuilder onStateReplaced(Consumer onStateReplaced) { - this.onStateReplaced = onStateReplaced; - return this; - } - - public BlockBuilder onAppendTooltip(Consumer onAppendTooltip) { - this.onAppendTooltip = onAppendTooltip; - return this; - } - - public BlockBuilder onAppendProperties(Consumer onAppendProperties) { - this.onAppendProperties = onAppendProperties; - return this; - } - - public BlockBuilder onOutlineShape(Function onOutlineShape) { - return onOutlineShapeRaw(e -> onOutlineShape.apply(e).raw()); - } - - public BlockBuilder onCollisionShape(Function onCollisionShape) { - return onCollisionShapeRaw(e -> onCollisionShape.apply(e).raw()); - } - - public BlockBuilder onOutlineShapeRaw(Function onOutlineShape) { - this.onOutlineShape = onOutlineShape; - return this; - } - - public BlockBuilder onCollisionShapeRaw(Function onCollisionShape) { - this.onCollisionShape = onCollisionShape; - return this; - } - - public BlockBuilder onRenderType(Function onRenderType) { - this.onRenderType = onRenderType; - return this; - } - - public BlockBuilder onPlacementState(Function onPlacementState) { - this.onPlacementState = onPlacementState; - return this; - } - - public BlockBuilder onStateForNeighborUpdate(Function onStateForNeighborUpdate) { - this.onStateForNeighborUpdate = onStateForNeighborUpdate; - return this; - } - - public BlockBuilder setOutlineShape(VoxelShape shape) { - return onOutlineShape(e -> shape); - } - - public BlockBuilder setCollisionShape(VoxelShape shape) { - return onCollisionShape(e -> shape); - } - - public BlockBuilder setOutlineShape(net.minecraft.util.shape.VoxelShape shape) { - return onOutlineShapeRaw(e -> shape); - } - - public BlockBuilder setCollisionShape(net.minecraft.util.shape.VoxelShape shape) { - return onCollisionShapeRaw(e -> shape); - } - - public BlockBuilder setRenderType(CompatBlockRenderType renderType) { - return onRenderType(e -> renderType); - } - - public BlockBuilder onInit(BiConsumer onInit) { - this.onInit = onInit; - return this; - } - - public BlockBuilder setDefaultState(BlockState defaultState) { - this.defaultState = defaultState; - return this; - } - - private final List tooltip = new ArrayList<>(); - - public BlockBuilder addTooltip(TextComponent text) { - if (tooltip.isEmpty()) { - onAppendTooltip = e -> e.getTooltip().add(text.getText()); - } else { - onAppendTooltip = e -> { - for (TextComponent t : tooltip) { - e.getTooltip().add(t.getText()); - } - e.getTooltip().add(text.getText()); - }; - } - - this.tooltip.add(text); - return this; - } - - public BlockBuilder onDroppedStacksRaw(Function> onDroppedStacks) { - this.onDroppedStacks = onDroppedStacks; - return this; - } - - public BlockBuilder onDroppedStacks(Function> onDroppedStacks) { - return onDroppedStacksRaw(e -> onDroppedStacks.apply(e).stream() - .map(ItemStack::toMinecraft) - .toList()); - } - - public BlockBuilder write(BlockBuilder copy) { - copy.onRightClick = onRightClick; - copy.onStateReplaced = onStateReplaced; - copy.onAppendTooltip = onAppendTooltip; - copy.onAppendProperties = onAppendProperties; - copy.defaultState = defaultState; - copy.onInit = onInit; - copy.onOutlineShape = onOutlineShape; - copy.onCollisionShape = onCollisionShape; - copy.onRenderType = onRenderType; - copy.onPlacementState = onPlacementState; - copy.onStateForNeighborUpdate = onStateForNeighborUpdate; - copy.onDroppedStacks = onDroppedStacks; - - return copy; - } - - public BlockBuilder copy(BlockSettingsBuilder settingsBuilder) { - return write(new BlockBuilder(settingsBuilder)); - } - - public BlockBuilder copy() { - return copy(this.settingsBuilder.copy()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java deleted file mode 100644 index b85331534..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java +++ /dev/null @@ -1,88 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder; - -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.RewritableBlockEntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockEntity; - -import java.util.Arrays; -import java.util.function.BiConsumer; - -public class BlockEntityBuilder { - - public BiConsumer onWriteNbt; - public BiConsumer onReadNbt; - public BiConsumer onInit; - - public CompatIdentifier id; - - public BlockEntityBuilder(CompatIdentifier id) { - this.id = id; - } - - public static BlockEntityBuilder of(CompatIdentifier id) { - return new BlockEntityBuilder(id); - } - - public BlockEntityTypeWrapper build(CompatRegistryV2 registry, CompatIdentifier id, BlockWrapper... blocks) { - RewritableBlockEntityTypeWrapper type = RewritableBlockEntityTypeWrapper.of(); - BlockEntityBuilder builder = this; - - SupplierResult> result = registry.registerBlockEntityType(id, BlockEntityTypeBuilder.create( - e -> new BuiltBlockEntity(type, builder, e), - Arrays.stream(blocks).map(BlockWrapper::get).toArray(Block[]::new) - )); - - type.set(result.get()); - - return type; - } - - public BlockEntityTypeWrapper build(CompatRegistryV2 registry, BlockWrapper... blocks) { - if (id == null) - throw new IllegalStateException("BlockEntity id is not set. hint: use build(CompatRegistryV2, CompatIdentifier, BlockWrapper...)"); - - return build(registry, id, blocks); - } - - public BlockEntityBuilder onInit(BiConsumer onInit) { - this.onInit = onInit; - return this; - } - - public BlockEntityBuilder onWriteNbt(BiConsumer onWriteNbt) { - this.onWriteNbt = onWriteNbt; - return this; - } - - public BlockEntityBuilder onReadNbt(BiConsumer onReadNbt) { - this.onReadNbt = onReadNbt; - return this; - } - - public BlockEntityBuilder write(BlockEntityBuilder copy) { - copy.onInit = this.onInit; - copy.onWriteNbt = this.onWriteNbt; - copy.onReadNbt = this.onReadNbt; - - return copy; - } - - public BlockEntityBuilder copy(CompatIdentifier id) { - return write(new BlockEntityBuilder(id)); - } - - public BlockEntityBuilder copy() { - return copy(this.id); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java deleted file mode 100644 index 16ce75a16..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java +++ /dev/null @@ -1,107 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder; - -import net.minecraft.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.api.CommonModInitializer; -import net.pitan76.mcpitanlib.api.block.ExtendBlock; -import net.pitan76.mcpitanlib.api.block.v2.BlockSettingsBuilder; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.util.BlockEntityTypeUtil; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; -import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockWithEntity; - -import java.util.function.Supplier; - -public class BlockWithBlockEntityBuilder extends BlockBuilder { - - public Supplier> blockEntityType; - - public BlockWithBlockEntityBuilder(BlockSettingsBuilder settingsBuilder) { - super(settingsBuilder); - } - - public BlockWithBlockEntityBuilder(CompatIdentifier id) { - super(id); - } - - public BlockWithBlockEntityBuilder(BlockSettingsBuilder settingsBuilder, Supplier> blockEntityType) { - super(settingsBuilder); - this.blockEntityType = blockEntityType; - } - - public BlockWithBlockEntityBuilder(CompatIdentifier id, Supplier> blockEntityType) { - super(id); - this.blockEntityType = blockEntityType; - } - - @Override - public SupplierBlockWrapper build(CompatRegistryV2 registry) { - if (settingsBuilder.id == null) - throw new IllegalStateException("Block id is not set. hint: use build(CompatRegistryV2, CompatIdentifier)"); - - Supplier result = registry.registerExtendBlock(settingsBuilder.id, () -> new BuiltBlockWithEntity(this)); - - return SupplierBlockWrapper.of(result::get); - } - - @Override - public SupplierBlockWrapper build(CompatRegistryV2 registry, CompatIdentifier id) { - Supplier result = registry.registerExtendBlock(id, () -> new BuiltBlockWithEntity(this, id)); - - return SupplierBlockWrapper.of(result::get); - } - - public SupplierBlockWrapper build(CommonModInitializer initializer) { - return build(initializer.registry); - } - - public SupplierBlockWrapper build(CommonModInitializer initializer, CompatIdentifier id) { - return build(initializer.registry, id); - } - - public static BlockWithBlockEntityBuilder of(CompatIdentifier id) { - return new BlockWithBlockEntityBuilder(id); - } - - public static BlockWithBlockEntityBuilder of(BlockSettingsBuilder settingsBuilder) { - return new BlockWithBlockEntityBuilder(settingsBuilder); - } - - public static BlockWithBlockEntityBuilder of(CompatIdentifier id, Supplier> blockEntityType) { - return new BlockWithBlockEntityBuilder(id, blockEntityType); - } - - public static BlockWithBlockEntityBuilder of(BlockSettingsBuilder settingsBuilder, Supplier> blockEntityType) { - return new BlockWithBlockEntityBuilder(settingsBuilder, blockEntityType); - } - - public BlockWithBlockEntityBuilder applyBlockEntity(Supplier> blockEntityType) { - this.blockEntityType = blockEntityType; - return this; - } - - public BlockWithBlockEntityBuilder applyBlockEntity(BlockEntityType blockEntityType) { - this.blockEntityType = () -> blockEntityType; - return this; - } - - public BlockWithBlockEntityBuilder applyBlockEntity(CompatIdentifier id) { - return applyBlockEntity(BlockEntityTypeUtil.fromId(id)); - } - - public BlockWithBlockEntityBuilder write(BlockWithBlockEntityBuilder copy) { - copy.settingsBuilder = this.settingsBuilder; - copy.blockEntityType = this.blockEntityType; - super.write(copy); - - return copy; - } - - public BlockWithBlockEntityBuilder copy(BlockSettingsBuilder settingsBuilder) { - return write(new BlockWithBlockEntityBuilder(settingsBuilder)); - } - - public BlockWithBlockEntityBuilder copy() { - return copy(this.settingsBuilder.copy()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java deleted file mode 100644 index 14c4b6a1b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java +++ /dev/null @@ -1,198 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder; - -import net.pitan76.mcpitanlib.api.CommonModInitializer; -import net.pitan76.mcpitanlib.api.event.item.*; -import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; -import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; -import net.pitan76.mcpitanlib.api.item.ExtendItem; -import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.CompatRarity; -import net.pitan76.mcpitanlib.api.util.StackActionResult; -import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltItem; -import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import net.pitan76.mcpitanlib.midohra.item.SupplierItemWrapper; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Supplier; - -public class ItemBuilder { - - public ItemSettingsBuilder settingsBuilder; - public Function onRightClick; - public Function onRightClickOnBlock; - public Function onRightClickOnEntity; - public Consumer onAppendTooltip; - public Function onItemBarColor; - public Function onItemBarStep; - - public ItemBuilder(ItemSettingsBuilder settingsBuilder) { - this.settingsBuilder = settingsBuilder; - } - - public ItemBuilder(CompatIdentifier id) { - this(new ItemSettingsBuilder(id)); - } - - public static ItemBuilder of(CompatIdentifier id) { - return new ItemBuilder(id); - } - - public static ItemBuilder of(ItemSettingsBuilder settingsBuilder) { - return new ItemBuilder(settingsBuilder); - } - - public SupplierItemWrapper build(CompatRegistryV2 registry) { - if (settingsBuilder.id == null) - throw new IllegalStateException("Item id is not set. hint: use build(CompatRegistryV2, CompatIdentifier)"); - - Supplier result = registry.registerExtendItem(settingsBuilder.id, () -> new BuiltItem(this)); - - return SupplierItemWrapper.of(result::get); - } - - public SupplierItemWrapper build(CompatRegistryV2 registry, CompatIdentifier id) { - Supplier result = registry.registerExtendItem(settingsBuilder.id, () -> new BuiltItem(this, id)); - - return SupplierItemWrapper.of(result::get); - } - - public SupplierItemWrapper build(CommonModInitializer initializer) { - return build(initializer.registry); - } - - public SupplierItemWrapper build(CommonModInitializer initializer, CompatIdentifier id) { - return build(initializer.registry, id); - } - - public ItemBuilder maxCount(int maxCount) { - settingsBuilder.maxCount(maxCount); - return this; - } - - public ItemBuilder maxDamage(int maxDamage) { - settingsBuilder.maxDamage(maxDamage); - return this; - } - - public ItemBuilder maxDamageIfAbsent(int maxDamage) { - settingsBuilder.maxDamageIfAbsent(maxDamage); - return this; - } - - public ItemBuilder food(CompatFoodComponent foodComponent) { - settingsBuilder.foodComponent(foodComponent); - return this; - } - - public ItemBuilder recipeRemainder(ItemWrapper recipeRemainder) { - settingsBuilder.recipeRemainder(recipeRemainder); - return this; - } - - public ItemBuilder enchantability(int enchantability) { - settingsBuilder.enchantability(enchantability); - return this; - } - - public ItemBuilder repairable(CompatIdentifier repairIngredientTag) { - settingsBuilder.repairable(repairIngredientTag); - return this; - } - - public ItemBuilder repairable(RepairIngredientTag repairIngredientTag) { - settingsBuilder.repairable(repairIngredientTag); - return this; - } - - public ItemBuilder rarity(CompatRarity rarity) { - settingsBuilder.rarity(rarity); - return this; - } - - public ItemBuilder group(ItemGroupWrapper itemGroup) { - settingsBuilder.addGroup(itemGroup); - return this; - } - - public ItemBuilder group(CreativeTabBuilder itemGroup) { - settingsBuilder.addGroup(itemGroup); - return this; - } - - public ItemBuilder onRightClick(Function onRightClick) { - this.onRightClick = onRightClick; - return this; - } - - public ItemBuilder onRightClickOnBlock(Function onRightClickOnBlock) { - this.onRightClickOnBlock = onRightClickOnBlock; - return this; - } - - public ItemBuilder onRightClickOnEntity(Function onRightClickOnEntity) { - this.onRightClickOnEntity = onRightClickOnEntity; - return this; - } - - public ItemBuilder onAppendTooltip(Consumer onAppendTooltip) { - this.onAppendTooltip = onAppendTooltip; - return this; - } - - public ItemBuilder onItemBarColor(Function onItemBarColor) { - this.onItemBarColor = onItemBarColor; - return this; - } - - public ItemBuilder onItemBarStep(Function onItemBarStep) { - this.onItemBarStep = onItemBarStep; - return this; - } - - private final List tooltip = new ArrayList<>(); - - public ItemBuilder addTooltip(TextComponent text) { - if (tooltip.isEmpty()) { - onAppendTooltip = e -> e.getTooltip().add(text.getText()); - } else { - onAppendTooltip = e -> { - for (TextComponent t : tooltip) { - e.getTooltip().add(t.getText()); - } - e.getTooltip().add(text.getText()); - }; - } - - this.tooltip.add(text); - return this; - } - - public ItemBuilder write(ItemBuilder copy) { - copy.settingsBuilder = this.settingsBuilder; - copy.onRightClick = this.onRightClick; - copy.onRightClickOnBlock = this.onRightClickOnBlock; - copy.onRightClickOnEntity = this.onRightClickOnEntity; - copy.onAppendTooltip = this.onAppendTooltip; - copy.onItemBarColor = this.onItemBarColor; - copy.onItemBarStep = this.onItemBarStep; - - return copy; - } - - public ItemBuilder copy(ItemSettingsBuilder builder) { - return write(new ItemBuilder(builder)); - } - - public ItemBuilder copy() { - return copy(this.settingsBuilder.copy()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java deleted file mode 100644 index c74686013..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java +++ /dev/null @@ -1,146 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder.built; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.shape.VoxelShape; -import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; -import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; -import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; -import net.pitan76.mcpitanlib.api.event.block.DroppedStacksArgs; -import net.pitan76.mcpitanlib.api.event.block.StateReplacedEvent; -import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.easybuilder.BlockBuilder; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.function.Consumer; -import java.util.function.Function; - -public class BuiltBlock extends CompatBlock { - - protected Function onRightClick; - protected Consumer onStateReplaced; - protected Consumer onAppendTooltip; - protected Consumer onAppendProperties; - protected Function onOutlineShape; - protected Function onCollisionShape; - protected Function onRenderType; - protected Function onPlacementState; - protected Function onStateForNeighborUpdate; - protected Function> onDroppedStacks; - - public BuiltBlock(CompatibleBlockSettings settings) { - super(settings); - } - - public BuiltBlock(BlockBuilder builder) { - this(builder.settingsBuilder.build()); - init(builder); - } - - public BuiltBlock(BlockBuilder builder, CompatIdentifier id) { - this(builder.settingsBuilder.build(id)); - init(builder); - } - - protected void init(BlockBuilder builder) { - this.onRightClick = builder.onRightClick; - this.onStateReplaced = builder.onStateReplaced; - this.onAppendTooltip = builder.onAppendTooltip; - this.onAppendProperties = builder.onAppendProperties; - this.onOutlineShape = builder.onOutlineShape; - this.onCollisionShape = builder.onCollisionShape; - this.onRenderType = builder.onRenderType; - this.onPlacementState = builder.onPlacementState; - this.onStateForNeighborUpdate = builder.onStateForNeighborUpdate; - - if (builder.onInit != null) - builder.onInit.accept(this.getWrapper(), builder); - - if (builder.defaultState != null) - this.setDefaultState(builder.defaultState); - } - - @Override - public CompatActionResult onRightClick(BlockUseEvent e) { - if (onRightClick == null) - return e.pass(); - - return onRightClick.apply(e); - } - - @Override - public void onStateReplaced(StateReplacedEvent e) { - if (onStateReplaced != null) - onStateReplaced.accept(e); - } - - @Override - public void appendTooltip(ItemAppendTooltipEvent e) { - if (onAppendTooltip != null) - onAppendTooltip.accept(e); - } - - @Override - public void appendProperties(AppendPropertiesArgs args) { - if (onAppendProperties != null) - onAppendProperties.accept(args); - } - - @Override - public VoxelShape getOutlineShape(OutlineShapeEvent e) { - if (onOutlineShape != null) - return onOutlineShape.apply(e); - - return super.getOutlineShape(e); - } - - @Override - public VoxelShape getCollisionShape(CollisionShapeEvent e) { - if (onCollisionShape != null) - return onCollisionShape.apply(e); - - return super.getCollisionShape(e); - } - - @Override - public CompatBlockRenderType getRenderType(RenderTypeArgs args) { - if (onRenderType != null) - return onRenderType.apply(args); - - return super.getRenderType(args); - } - - @Override - public @Nullable BlockState getPlacementState(PlacementStateArgs args) { - if (onPlacementState != null) - return onPlacementState.apply(args); - - return super.getPlacementState(args); - } - - @Override - public BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { - if (onStateForNeighborUpdate != null) - return onStateForNeighborUpdate.apply(args); - - return super.getStateForNeighborUpdate(args); - } - - @Override - public List getDroppedStacks(DroppedStacksArgs args) { - if (onDroppedStacks != null) - return onDroppedStacks.apply(args); - - return super.getDroppedStacks(args); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java deleted file mode 100644 index 4143b69e7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java +++ /dev/null @@ -1,65 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder.built; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.easybuilder.BlockEntityBuilder; - -import java.util.function.BiConsumer; - -public class BuiltBlockEntity extends CompatBlockEntity { - - public BiConsumer onWriteNbt; - public BiConsumer onReadNbt; - - public BuiltBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { - super(type, pos, state); - } - - public BuiltBlockEntity(BlockEntityType type, TileCreateEvent e) { - super(type, e); - } - - public BuiltBlockEntity(BlockEntityTypeWrapper type, TileCreateEvent e) { - super(type.get(), e); - } - - public BuiltBlockEntity(BlockEntityTypeWrapper type, BlockEntityBuilder builder, TileCreateEvent e) { - this(type, e); - init(builder); - } - - protected void init(BlockEntityBuilder builder) { - this.onWriteNbt = builder.onWriteNbt; - this.onReadNbt = builder.onReadNbt; - - if (builder.onInit != null) - builder.onInit.accept(_wrap(), builder); - } - - @Override - public void writeNbt(WriteNbtArgs args) { - super.writeNbt(args); - if (onWriteNbt != null) { - onWriteNbt.accept(_wrap(), args); - } - } - - @Override - public void readNbt(ReadNbtArgs args) { - super.readNbt(args); - if (onReadNbt != null) { - onReadNbt.accept(_wrap(), args); - } - } - - public BlockEntityWrapper _wrap() { - return BlockEntityWrapper.of(this); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java deleted file mode 100644 index 6297eb9c0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder.built; - -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.api.block.ExtendBlockEntityProvider; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.easybuilder.BlockWithBlockEntityBuilder; -import org.jetbrains.annotations.Nullable; - -import java.util.function.Supplier; - -public class BuiltBlockWithEntity extends BuiltBlock implements ExtendBlockEntityProvider { - - public Supplier> blockEntityType; - - public BuiltBlockWithEntity(CompatibleBlockSettings settings) { - super(settings); - } - - public BuiltBlockWithEntity(BlockWithBlockEntityBuilder builder) { - super(builder); - - this.blockEntityType = builder.blockEntityType; - } - - public BuiltBlockWithEntity(BlockWithBlockEntityBuilder builder, CompatIdentifier id) { - super(builder, id); - - this.blockEntityType = builder.blockEntityType; - } - - @Override - public @Nullable BlockEntityType getBlockEntityType() { - if (blockEntityType == null) - return null; - - return (BlockEntityType) blockEntityType.get(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java deleted file mode 100644 index bd7ff8330..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java +++ /dev/null @@ -1,91 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.easybuilder.built; - -import net.pitan76.mcpitanlib.api.event.item.*; -import net.pitan76.mcpitanlib.api.item.v2.CompatItem; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.StackActionResult; -import net.pitan76.mcpitanlib.midohra.easybuilder.ItemBuilder; - -import java.util.function.Consumer; -import java.util.function.Function; - -public class BuiltItem extends CompatItem { - - protected Function onRightClick; - protected Function onRightClickOnBlock; - protected Function onRightClickOnEntity; - protected Consumer onAppendTooltip; - protected Function onItemBarColor; - protected Function onItemBarStep; - - protected BuiltItem(CompatibleItemSettings settings) { - super(settings); - } - - public BuiltItem(ItemBuilder builder) { - this(builder.settingsBuilder.build()); - init(builder); - } - - public BuiltItem(ItemBuilder builder, CompatIdentifier id) { - this(builder.settingsBuilder.build(id)); - init(builder); - } - - protected void init(ItemBuilder builder) { - this.onRightClick = builder.onRightClick; - this.onRightClickOnBlock = builder.onRightClickOnBlock; - this.onRightClickOnEntity = builder.onRightClickOnEntity; - this.onAppendTooltip = builder.onAppendTooltip; - this.onItemBarColor = builder.onItemBarColor; - this.onItemBarStep = builder.onItemBarStep; - } - - @Override - public StackActionResult onRightClick(ItemUseEvent e) { - if (onRightClick == null) - return e.pass(); - - return onRightClick.apply(e); - } - - @Override - public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent e) { - if (onRightClickOnBlock == null) - return e.pass(); - - return onRightClickOnBlock.apply(e); - } - - @Override - public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent e) { - if (onRightClickOnEntity == null) - return e.pass(); - - return onRightClickOnEntity.apply(e); - } - - @Override - public void appendTooltip(ItemAppendTooltipEvent e) { - if (onAppendTooltip != null) - onAppendTooltip.accept(e); - } - - @Override - public int getItemBarColor(ItemBarColorArgs args) { - if (onItemBarColor != null) - return onItemBarColor.apply(args); - - return super.getItemBarColor(args); - } - - @Override - public int getItemBarStep(ItemBarStepArgs args) { - if (onItemBarStep != null) - return onItemBarStep.apply(args); - - return super.getItemBarStep(args); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java deleted file mode 100644 index d8a931e3c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java +++ /dev/null @@ -1,95 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.entity; - -import net.minecraft.entity.Entity; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.EntityTypeUtil; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.ServerWorld; -import org.jspecify.annotations.Nullable; - -import java.util.function.Consumer; - -public class EntityTypeWrapper { - private final net.minecraft.entity.EntityType entityType; - - protected EntityTypeWrapper() { - this.entityType = null; - } - - protected EntityTypeWrapper(net.minecraft.entity.EntityType entityType) { - this.entityType = entityType; - } - - public static EntityTypeWrapper of(net.minecraft.entity.EntityType entityType) { - return new EntityTypeWrapper(entityType); - } - - public static EntityTypeWrapper of() { - return new EntityTypeWrapper(); - } - - public boolean isExist() { - return !isEmpty(); - } - - public boolean isEmpty() { - return entityType == null; - } - - public net.minecraft.entity.EntityType get() { - return entityType; - } - - public CompatIdentifier getId() { - if (isEmpty()) return CompatIdentifier.empty(); - return EntityTypeUtil.toCompatID(entityType); - } - - public TextComponent getName() { - if (isEmpty()) return TextComponent.of(""); - return new TextComponent(EntityTypeUtil.getName(entityType)); - } - - public String getTranslationKey() { - if (isEmpty()) return ""; - return EntityTypeUtil.getTranslationKey(entityType); - } - - public boolean rawEquals(EntityTypeWrapper other) { - return entityType == other.entityType; - } - - @Override - public int hashCode() { - return get() != null ? get().hashCode() : 0; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - EntityTypeWrapper other = (EntityTypeWrapper) obj; - return rawEquals(other); - } - - public EntityWrapper createEntity(ServerWorld world, SpawnReason spawnReason) { - if (isEmpty()) return EntityWrapper.of(); - return EntityWrapper.of(get().create(world.getRaw(), spawnReason.getRaw())); - } - - public EntityWrapper createEntity(ServerWorld world) { - return createEntity(world, SpawnReason.NATURAL); - } - - public EntityWrapper createEntity(ServerWorld world, @Nullable Consumer afterConsumer, BlockPos pos, SpawnReason reason, boolean alignPosition, boolean invertY) { - if (isEmpty()) return EntityWrapper.of(); - - Consumer consumer = afterConsumer != null ? entity -> { - EntityWrapper wrapper = EntityWrapper.of((Entity) entity); - afterConsumer.accept(wrapper); - } : null; - - return EntityWrapper.of(get().create(world.getRaw(), consumer, pos.toMinecraft(), reason.getRaw(), alignPosition, invertY)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java deleted file mode 100644 index a7c65bbfe..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java +++ /dev/null @@ -1,75 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.entity; - -import net.minecraft.entity.EntityType; - -public class EntityTypes { - public static final EntityTypeWrapper BOAT = EntityTypeWrapper.of(EntityType.OAK_BOAT); - public static final EntityTypeWrapper ACACIA_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ACACIA_BOAT); - public static final EntityTypeWrapper ACACIA_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ACACIA_CHEST_BOAT); - public static final EntityTypeWrapper BIRCH_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BIRCH_BOAT); - public static final EntityTypeWrapper BIRCH_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BIRCH_CHEST_BOAT); - public static final EntityTypeWrapper DARK_OAK_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DARK_OAK_BOAT); - public static final EntityTypeWrapper DARK_OAK_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DARK_OAK_CHEST_BOAT); - public static final EntityTypeWrapper JUNGLE_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.JUNGLE_BOAT); - public static final EntityTypeWrapper JUNGLE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.JUNGLE_CHEST_BOAT); - public static final EntityTypeWrapper SPRUCE_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SPRUCE_BOAT); - public static final EntityTypeWrapper SPRUCE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SPRUCE_CHEST_BOAT); - public static final EntityTypeWrapper FURNACE_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FURNACE_MINECART); - public static final EntityTypeWrapper HOPPER_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HOPPER_MINECART); - public static final EntityTypeWrapper MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MINECART); - public static final EntityTypeWrapper TNT_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.TNT_MINECART); - public static final EntityTypeWrapper CHEST_MINECART = EntityTypeWrapper.of(EntityType.CHEST_MINECART); - public static final EntityTypeWrapper HORSE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HORSE); - public static final EntityTypeWrapper LLAMA = EntityTypeWrapper.of(net.minecraft.entity.EntityType.LLAMA); - - public static final EntityTypeWrapper ITEM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ITEM); - public static final EntityTypeWrapper ITEM_DISPLAY = EntityTypeWrapper.of(EntityType.ITEM_DISPLAY); - public static final EntityTypeWrapper ITEM_FRAME = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ITEM_FRAME); - public static final EntityTypeWrapper GLOW_ITEM_FRAME = EntityTypeWrapper.of(EntityType.GLOW_ITEM_FRAME); - public static final EntityTypeWrapper EXPERIENCE_BOTTLE = EntityTypeWrapper.of(EntityType.EXPERIENCE_BOTTLE); - public static final EntityTypeWrapper EXPERIENCE_ORB = EntityTypeWrapper.of(EntityType.EXPERIENCE_ORB); - - public static final EntityTypeWrapper SNOWBALL = EntityTypeWrapper.of(EntityType.SNOWBALL); - public static final EntityTypeWrapper FIREBALL = EntityTypeWrapper.of(EntityType.FIREBALL); - public static final EntityTypeWrapper SMALL_FIREBALL = EntityTypeWrapper.of(EntityType.SMALL_FIREBALL); - public static final EntityTypeWrapper DRAGON_FIREBALL = EntityTypeWrapper.of(EntityType.DRAGON_FIREBALL); - public static final EntityTypeWrapper FIREWORK_ROCKET = EntityTypeWrapper.of(EntityType.FIREWORK_ROCKET); - - public static final EntityTypeWrapper ALLAY = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ALLAY); - public static final EntityTypeWrapper AXOLOTL = EntityTypeWrapper.of(net.minecraft.entity.EntityType.AXOLOTL); - public static final EntityTypeWrapper BAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BAT); - public static final EntityTypeWrapper BEE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BEE); - public static final EntityTypeWrapper BLAZE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BLAZE); - public static final EntityTypeWrapper CAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CAT); - public static final EntityTypeWrapper CHICKEN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CHICKEN); - public static final EntityTypeWrapper COD = EntityTypeWrapper.of(net.minecraft.entity.EntityType.COD); - public static final EntityTypeWrapper COW = EntityTypeWrapper.of(net.minecraft.entity.EntityType.COW); - public static final EntityTypeWrapper CREEPER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CREEPER); - public static final EntityTypeWrapper DOLPHIN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DOLPHIN); - public static final EntityTypeWrapper DONKEY = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DONKEY); - public static final EntityTypeWrapper DROWNED = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DROWNED); - public static final EntityTypeWrapper ELDER_GUARDIAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ELDER_GUARDIAN); - public static final EntityTypeWrapper ENDER_DRAGON = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDER_DRAGON); - public static final EntityTypeWrapper ENDERMAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDERMAN); - public static final EntityTypeWrapper ENDERMITE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDERMITE); - public static final EntityTypeWrapper EVOKER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.EVOKER); - public static final EntityTypeWrapper FOX = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FOX); - public static final EntityTypeWrapper FROG = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FROG); - public static final EntityTypeWrapper GHAST = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GHAST); - public static final EntityTypeWrapper GIANT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GIANT); - public static final EntityTypeWrapper GLOW_SQUID = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GLOW_SQUID); - public static final EntityTypeWrapper GOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GOAT); - public static final EntityTypeWrapper GUARDIAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GUARDIAN); - public static final EntityTypeWrapper HUSK = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HUSK); - public static final EntityTypeWrapper ILLUSIONER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ILLUSIONER); - public static final EntityTypeWrapper IRON_GOLEM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.IRON_GOLEM); - public static final EntityTypeWrapper LLAMA_SPIT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.LLAMA_SPIT); - public static final EntityTypeWrapper MAGMA_CUBE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MAGMA_CUBE); - public static final EntityTypeWrapper MARKER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MARKER); - public static final EntityTypeWrapper MOOSHROOM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MOOSHROOM); - public static final EntityTypeWrapper MULE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MULE); - public static final EntityTypeWrapper SKELETON = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SKELETON); - public static final EntityTypeWrapper VILLAGER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.VILLAGER); - public static final EntityTypeWrapper ZOMBIE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ZOMBIE); - public static final EntityTypeWrapper ZOMBIE_VILLAGER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ZOMBIE_VILLAGER); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java deleted file mode 100644 index 5a019773e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java +++ /dev/null @@ -1,334 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.entity; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.pitan76.mcpitanlib.api.entity.CompatEntity; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.EntityUtil; -import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; -import net.pitan76.mcpitanlib.midohra.world.ServerWorld; -import net.pitan76.mcpitanlib.midohra.world.World; - -import java.util.Optional; -import java.util.UUID; - -public class EntityWrapper { - private final net.minecraft.entity.Entity entity; - - public static final EntityWrapper EMPTY = new EntityWrapper(null); - - protected EntityWrapper() { - this.entity = null; - } - - protected EntityWrapper(net.minecraft.entity.Entity entity) { - this.entity = entity; - } - - public static EntityWrapper of(net.minecraft.entity.Entity entity) { - return new EntityWrapper(entity); - } - - public static EntityWrapper of() { - return EMPTY; - } - - public boolean isPresent() { - return !isEmpty(); - } - - public boolean isEmpty() { - return get() == null; - } - - public net.minecraft.entity.Entity get() { - return entity; - } - - public EntityTypeWrapper getType() { - return EntityTypeWrapper.of(get().getType()); - } - - public Vector3d getPos() { - return EntityUtil.getPosM(get()); - } - - public void setPos(double x, double y, double z) { - EntityUtil.setPos(get(), x, y, z); - } - - public void setPos(Vector3d pos) { - EntityUtil.setPos(get(), pos); - } - - public void setPos(BlockPos pos) { - EntityUtil.setPos(get(), pos); - } - - public void teleport(double x, double y, double z) { - EntityUtil.teleport(get(), x, y, z); - } - - public void teleport(Vector3d pos) { - EntityUtil.teleport(get(), pos); - } - - public void teleport(BlockPos pos) { - EntityUtil.teleport(get(), pos); - } - - public void teleport(ServerWorld world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - EntityUtil.teleport(get(), world.getRaw(), x, y, z, yaw, pitch, resetCamera); - } - - public void teleport(ServerWorld world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { - EntityUtil.teleport(get(), world.getRaw(), pos, yaw, pitch, resetCamera); - } - - public void teleport(ServerWorld world, BlockPos pos, float yaw, float pitch, boolean resetCamera) { - EntityUtil.teleport(get(), world.getRaw(), pos, yaw, pitch, resetCamera); - } - - public void teleport(ServerWorld world, double x, double y, double z) { - EntityUtil.teleport(get(), world.getRaw(), x, y, z); - } - - public void teleport(ServerWorld world, Vector3d pos) { - EntityUtil.teleport(get(), world.getRaw(), pos); - } - - public void teleport(ServerWorld world, BlockPos pos) { - EntityUtil.teleport(get(), world.getRaw(), pos); - } - - public BlockPos getBlockPos() { - return BlockPos.of(get().getBlockPos()); - } - - public World getWorld() { - return World.of(EntityUtil.getWorld(get())); - } - - public boolean isRemoved() { - return get().isRemoved(); - } - - public void discard() { - EntityUtil.discard(get()); - } - - public void kill() { - EntityUtil.kill(get()); - } - - public float getPitch() { - return EntityUtil.getPitch(get()); - } - - public float getYaw() { - return EntityUtil.getYaw(get()); - } - - public float getSpeed() { - return EntityUtil.getSpeed(get()); - } - - public TextComponent getCustomName() { - return new TextComponent(EntityUtil.getCustomName(get())); - } - - public TextComponent getName() { - return new TextComponent(EntityUtil.getName(get())); - } - - public String getNameAsString() { - return EntityUtil.getNameAsString(get()); - } - - public String getCustomNameAsString() { - return EntityUtil.getCustomNameAsString(get()); - } - - public UUID getUuid() { - return EntityUtil.getUuid(get()); - } - - public String getUuidString() { - return EntityUtil.getUuidString(get()); - } - - public boolean isSneaking() { - return EntityUtil.isSneaking(get()); - } - - public boolean isSprinting() { - return EntityUtil.isSprinting(get()); - } - - public boolean isSwimming() { - return EntityUtil.isSwimming(get()); - } - - public boolean isAlive() { - return EntityUtil.isAlive(get()); - } - - public boolean isOnGround() { - return EntityUtil.isOnGround(get()); - } - - public boolean isGlowing() { - return EntityUtil.isGlowing(get()); - } - - public boolean isInvisible() { - return EntityUtil.isInvisible(get()); - } - - public boolean isInvulnerable() { - return EntityUtil.isInvulnerable(get()); - } - - public boolean isSilent() { - return EntityUtil.isSilent(get()); - } - - public boolean isOnFire() { - return EntityUtil.isOnFire(get()); - } - - public boolean isRiding() { - return EntityUtil.isRiding(get()); - } - - public boolean isVelocityModified() { - return EntityUtil.isVelocityModified(get()); - } - - public boolean isCustomNameVisible() { - return EntityUtil.isCustomNameVisible(get()); - } - - public TextComponent getDisplayName() { - return new TextComponent(EntityUtil.getDisplayName(get())); - } - - public double getFallDistance() { - return EntityUtil.getFallDistance(get()); - } - - public boolean isLivingEntity() { - return get() instanceof LivingEntity; - } - - public boolean damageByMobAttack(float damageAmount, EntityWrapper source, EntityWrapper attacker) { - return EntityUtil.damageWithMobAttack(get(), damageAmount, source.get(), (LivingEntity) attacker.get()); - } - - public boolean damageByPlayerAttack(float damageAmount, EntityWrapper source, Player attacker) { - return EntityUtil.damageWithPlayerAttack(get(), damageAmount, source.get(), attacker); - } - - public boolean damageWithThrownProjectile(float damageAmount, EntityWrapper source, EntityWrapper projectile) { - return EntityUtil.damageWithThrownProjectile(get(), damageAmount, source.get(), projectile.get()); - } - - public boolean damageWithMobProjectile(float damageAmount, EntityWrapper projectile, EntityWrapper attacker) { - return EntityUtil.damageWithMobProjectile(get(), damageAmount, projectile.get(), (LivingEntity) attacker.get()); - } - - public boolean setVelocity(double x, double y, double z) { - EntityUtil.setVelocity(get(), x, y, z); - return true; - } - - public void setVelocity(Vector3d velocity) { - EntityUtil.setVelocity(get(), velocity); - } - - public void addVelocity(double x, double y, double z) { - EntityUtil.addVelocity(get(), x, y, z); - } - - public void addVelocity(Vector3d velocity) { - EntityUtil.addVelocity(get(), velocity); - } - - public Vector3d getVelocity() { - return Vector3d.of(EntityUtil.getVelocity(get())); - } - - public boolean setCustomName(TextComponent name) { - EntityUtil.setCustomName(get(), name.getText()); - return true; - } - - public boolean setInvulnerable(boolean invulnerable) { - EntityUtil.setInvulnerable(get(), invulnerable); - return true; - } - - public boolean setNoGravity(boolean noGravity) { - EntityUtil.setNoGravity(get(), noGravity); - return true; - } - - public boolean setGlowing(boolean glowing) { - EntityUtil.setGlowing(get(), glowing); - return true; - } - - public boolean setInvisible(boolean invisible) { - EntityUtil.setInvisible(get(), invisible); - return true; - } - - public boolean setSilent(boolean silent) { - EntityUtil.setSilent(get(), silent); - return true; - } - - public boolean setFire(int seconds) { - EntityUtil.setFire(get(), seconds); - return true; - } - - public boolean setCustomNameVisible(boolean visible) { - EntityUtil.setCustomNameVisible(get(), visible); - return true; - } - - public EntityWrapper getVehicle() { - return EntityWrapper.of(get().getVehicle()); - } - - public EntityWrapper getRootVehicle() { - return EntityWrapper.of(get().getRootVehicle()); - } - - public EntityWrapper getPassenger(int index) { - return EntityWrapper.of(get().getPassengerList().get(index)); - } - - public int getPassengerCount() { - return get().getPassengerList().size(); - } - - public Class getEntityClass() { - return get().getClass(); - } - - public Optional toCompatEntity() { - if (get() instanceof CompatEntity) { - return Optional.of((CompatEntity) get()); - } - return Optional.empty(); - } - - public void spawn(World world) { - world.spawnEntity(this); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java deleted file mode 100644 index 0336723b2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.entity; - -import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; -import net.pitan76.mcpitanlib.midohra.world.World; - -public class ItemEntityWrapper extends EntityWrapper { - public ItemEntityWrapper(net.minecraft.entity.ItemEntity entity) { - super(entity); - } - - public static ItemEntityWrapper of(net.minecraft.entity.ItemEntity entity) { - return new ItemEntityWrapper(entity); - } - - @Override - public net.minecraft.entity.ItemEntity get() { - return (net.minecraft.entity.ItemEntity) super.get(); - } - - public net.minecraft.item.ItemStack getStackRaw() { - return ItemEntityUtil.getStack(get()); - } - - public ItemStack getStack() { - return ItemStack.of(getStackRaw()); - } - - public void setStack(net.minecraft.item.ItemStack stack) { - get().setStack(stack); - } - - public void setStack(ItemStack stack) { - setStack(stack.toMinecraft()); - } - - public ItemWrapper getItem() { - return getStack().getItem(); - } - - public static ItemEntityWrapper create(ItemStack stack, World world, double x, double y, double z) { - return of(ItemEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft())); - } - - public static ItemEntityWrapper create(ItemStack stack, World world, Vector3d pos) { - return create(stack, world, pos.getX(), pos.getY(), pos.getZ()); - } - - public static ItemEntityWrapper create(ItemStack stack, World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - return of(ItemEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft(), velocityX, velocityY, velocityZ)); - } - - public static ItemEntityWrapper create(ItemStack stack, World world, Vector3d pos, Vector3d velocity) { - return create(stack, world, pos.getX(), pos.getY(), pos.getZ(), velocity.getX(), velocity.getY(), velocity.getZ()); - } - - public static ItemEntityWrapper create(ItemStack stack, World world, BlockPos pos) { - return create(stack, world, pos.getX(), pos.getY(), pos.getZ()); - } - - public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, double x, double y, double z) { - return of(ItemEntityUtil.createWithSpawn(world.toMinecraft(), stack.toMinecraft(), x, y, z)); - } - - public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, Vector3d pos) { - return createWithSpawn(stack, world, pos.getX(), pos.getY(), pos.getZ()); - } - - public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, BlockPos pos) { - return createWithSpawn(stack, world, pos.getX(), pos.getY(), pos.getZ()); - } - - public void setToDefaultPickupDelay() { - ItemEntityUtil.setToDefaultPickupDelay(get()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java deleted file mode 100644 index c5fe6a6d3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.entity; - -public class SpawnReason { - private final net.minecraft.entity.SpawnReason raw; - - public static final SpawnReason NATURAL = of(net.minecraft.entity.SpawnReason.NATURAL); - public static final SpawnReason CHUNK_GENERATION = of(net.minecraft.entity.SpawnReason.CHUNK_GENERATION); - public static final SpawnReason SPAWNER = of(net.minecraft.entity.SpawnReason.SPAWNER); - public static final SpawnReason STRUCTURE = of(net.minecraft.entity.SpawnReason.STRUCTURE); - public static final SpawnReason BREEDING = of(net.minecraft.entity.SpawnReason.BREEDING); - public static final SpawnReason MOB_SUMMONED = of(net.minecraft.entity.SpawnReason.MOB_SUMMONED); - public static final SpawnReason JOCKEY = of(net.minecraft.entity.SpawnReason.JOCKEY); - public static final SpawnReason EVENT = of(net.minecraft.entity.SpawnReason.EVENT); - public static final SpawnReason CONVERSION = of(net.minecraft.entity.SpawnReason.CONVERSION); - public static final SpawnReason REINFORCEMENT = of(net.minecraft.entity.SpawnReason.REINFORCEMENT); - public static final SpawnReason TRIGGERED = of(net.minecraft.entity.SpawnReason.TRIGGERED); - public static final SpawnReason BUCKET = of(net.minecraft.entity.SpawnReason.BUCKET); - public static final SpawnReason SPAWN_ITEM_USE = of(net.minecraft.entity.SpawnReason.SPAWN_ITEM_USE); - public static final SpawnReason COMMAND = of(net.minecraft.entity.SpawnReason.COMMAND); - public static final SpawnReason DISPENSER = of(net.minecraft.entity.SpawnReason.DISPENSER); - public static final SpawnReason PATROL = of(net.minecraft.entity.SpawnReason.PATROL); - public static final SpawnReason TRIAL_SPAWNER = of(net.minecraft.entity.SpawnReason.TRIAL_SPAWNER); - public static final SpawnReason LOAD = of(net.minecraft.entity.SpawnReason.LOAD); - public static final SpawnReason DIMENSION_TRAVEL = of(net.minecraft.entity.SpawnReason.DIMENSION_TRAVEL); - - protected SpawnReason(net.minecraft.entity.SpawnReason raw) { - this.raw = raw; - } - - public static SpawnReason of(net.minecraft.entity.SpawnReason raw) { - return new SpawnReason(raw); - } - - public net.minecraft.entity.SpawnReason getRaw() { - return raw; - } - - @Override - public int hashCode() { - return raw.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - SpawnReason other = (SpawnReason) obj; - return raw == other.raw; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java deleted file mode 100644 index 720de5698..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.fluid; - -import net.minecraft.fluid.FluidState; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.FluidStateUtil; -import net.pitan76.mcpitanlib.api.util.FluidUtil; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; -import org.jetbrains.annotations.Nullable; - -public class FluidWrapper { - private final net.minecraft.fluid.Fluid fluid; - - protected FluidWrapper() { - this.fluid = null; - } - - protected FluidWrapper(net.minecraft.fluid.Fluid fluid) { - this.fluid = fluid; - } - - public static FluidWrapper of(net.minecraft.fluid.Fluid fluid) { - return new FluidWrapper(fluid); - } - - public static FluidWrapper of() { - return new FluidWrapper(); - } - - public static FluidWrapper of(CompatIdentifier id) { - if (FluidUtil.isExist(id)) - return of(FluidUtil.fromId(id)); - - return of(); - } - - public static FluidWrapper of(CompatIdentifier id, CompatIdentifier... ids) { - if (of(id).isExist()) return of(id); - - for (CompatIdentifier id1 : ids) { - if (of(id1).isExist()) - return of(id1); - } - - return of(); - } - - public boolean isExist() { - return !isEmpty(); - } - - public boolean isEmpty() { - return get() == null; - } - - @Nullable - public net.minecraft.fluid.Fluid get() { - return fluid; - } - - public net.minecraft.fluid.Fluid gerOrDefault(net.minecraft.fluid.Fluid defaultFluid) { - return isEmpty() ? defaultFluid : get(); - } - - public CompatIdentifier getId() { - if (isEmpty()) - return CompatIdentifier.empty(); - - return FluidUtil.toCompatId(get()); - } - - public String getName() { - if (isEmpty()) return ""; - return get().toString(); - } - - public FluidState getDefaultState() { - return FluidStateUtil.getDefaultState(get()); - } - - public ItemWrapper getBucketItem() { - return ItemWrapper.of(FluidUtil.getBucketItem(get())); - } - - public boolean rawEquals(FluidWrapper fluid) { - return get() == fluid.get(); - } - - @Override - public int hashCode() { - return isEmpty() ? 0 : get().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - FluidWrapper other = (FluidWrapper) obj; - return rawEquals(other); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java deleted file mode 100644 index 15a200faa..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.fluid; - -public class Fluids { - public static final FluidWrapper EMPTY = FluidWrapper.of(net.minecraft.fluid.Fluids.EMPTY); - public static final FluidWrapper WATER = FluidWrapper.of(net.minecraft.fluid.Fluids.WATER); - public static final FluidWrapper LAVA = FluidWrapper.of(net.minecraft.fluid.Fluids.LAVA); - public static final FluidWrapper FLOWING_WATER = FluidWrapper.of(net.minecraft.fluid.Fluids.FLOWING_WATER); - public static final FluidWrapper FLOWING_LAVA = FluidWrapper.of(net.minecraft.fluid.Fluids.FLOWING_LAVA); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java deleted file mode 100644 index 9601ef3d1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.holder; - -import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; -import net.pitan76.mcpitanlib.api.state.property.IProperty; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.util.math.Direction; - -public interface BlockStatePropertyHolder { - BlockState getBlockState(); - - default , V extends T> BlockState with(IProperty property, V value) { - return getBlockState().with(property, value); - } - - default boolean has(IProperty property) { - return getBlockState().contains(property); - } - - default > T get(IProperty property) { - return getBlockState().get(property); - } - - default > BlockState cycle(IProperty property) { - return getBlockState().cycle(property); - } - - // DirectionProperty - default BlockState with(DirectionProperty property, Direction value) { - return with(property, value.toMinecraft()); - } - - default Direction get(DirectionProperty property) { - return Direction.of(get((IProperty) property)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java deleted file mode 100644 index 2773aaa7a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.item; - -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.item.ItemGroupUtil; - -public class ItemGroupWrapper { - private final net.minecraft.item.ItemGroup itemGroup; - - protected ItemGroupWrapper() { - this.itemGroup = null; - } - - protected ItemGroupWrapper(net.minecraft.item.ItemGroup itemGroup) { - this.itemGroup = itemGroup; - } - - public static ItemGroupWrapper of(net.minecraft.item.ItemGroup itemGroup) { - return new ItemGroupWrapper(itemGroup); - } - - public static ItemGroupWrapper of(CompatIdentifier id) { - if (ItemGroupUtil.isExist(id)) - return of(ItemGroupUtil.fromId(id)); - - return of(); - } - - public static ItemGroupWrapper of() { - return new ItemGroupWrapper(); - } - - public boolean isPresent() { - return !isEmpty(); - } - - public boolean isEmpty() { - return itemGroup == null; - } - - public net.minecraft.item.ItemGroup get() { - return itemGroup; - } - - public CompatIdentifier getId() { - if (isEmpty()) return CompatIdentifier.empty(); - return ItemGroupUtil.toCompatID(itemGroup); - } - - public ItemStack getIcon() { - if (isEmpty()) return ItemStack.EMPTY; - return ItemStack.of(itemGroup.getIcon()); - } - - public boolean rawEquals(ItemGroupWrapper other) { - return itemGroup == other.itemGroup; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java deleted file mode 100644 index 7ceefce5a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.item; - -import net.pitan76.mcpitanlib.api.item.DefaultItemGroups; - -public class ItemGroups { - public static final ItemGroupWrapper BUILDING_BLOCKS = of(DefaultItemGroups.BUILDING_BLOCKS); - public static final ItemGroupWrapper COLORED_BLOCKS = of(DefaultItemGroups.COLORED_BLOCKS); - public static final ItemGroupWrapper NATURAL = of(DefaultItemGroups.NATURAL); - public static final ItemGroupWrapper FUNCTIONAL = of(DefaultItemGroups.FUNCTIONAL); - public static final ItemGroupWrapper REDSTONE = of(DefaultItemGroups.REDSTONE); - public static final ItemGroupWrapper HOTBAR = of(DefaultItemGroups.HOTBAR); - public static final ItemGroupWrapper SEARCH = of(DefaultItemGroups.SEARCH); - public static final ItemGroupWrapper TOOLS = of(DefaultItemGroups.TOOLS); - public static final ItemGroupWrapper COMBAT = of(DefaultItemGroups.COMBAT); - public static final ItemGroupWrapper FOOD_AND_DRINK = of(DefaultItemGroups.FOOD_AND_DRINK); - public static final ItemGroupWrapper INGREDIENTS = of(DefaultItemGroups.INGREDIENTS); - public static final ItemGroupWrapper SPAWN_EGGS = of(DefaultItemGroups.SPAWN_EGGS); - public static final ItemGroupWrapper OPERATOR = of(DefaultItemGroups.OPERATOR); - public static final ItemGroupWrapper INVENTORY = of(DefaultItemGroups.INVENTORY); - - // - 1.19.2 Item Group - public static final ItemGroupWrapper BREWING = FOOD_AND_DRINK; - public static final ItemGroupWrapper TRANSPORTATION = FUNCTIONAL; - public static final ItemGroupWrapper DECORATIONS = NATURAL; - public static final ItemGroupWrapper MISC = INGREDIENTS; - - private static ItemGroupWrapper of(net.minecraft.item.ItemGroup itemGroup) { - return ItemGroupWrapper.of(itemGroup); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java deleted file mode 100644 index 4bf936e58..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +++ /dev/null @@ -1,222 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.item; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.text.Text; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; -import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.*; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Map; - -public class ItemStack { - private final net.minecraft.item.ItemStack stack; - public static final ItemStack EMPTY = new ItemStack(ItemStackUtil.empty()); - - protected ItemStack(net.minecraft.item.ItemStack stack) { - this.stack = stack; - } - - public static ItemStack of(net.minecraft.item.ItemStack stack) { - if (stack == null || stack.isEmpty()) - return EMPTY; - - return new ItemStack(stack); - } - - public static ItemStack of(ItemConvertible item) { - return new Builder().item(item).build(); - } - - public static ItemStack of(ItemConvertible item, int count) { - return new Builder().item(item).count(count).build(); - } - - public static ItemStack empty() { - return EMPTY; - } - - public int getCount() { - return stack.getCount(); - } - - public void setCount(int count) { - stack.setCount(count); - } - - public NbtCompound getCustomNbt() { - return CustomDataUtil.getNbt(stack); - } - - public void setCustomNbt(NbtCompound nbt) { - CustomDataUtil.setNbt(stack, nbt); - } - - public void removeCustomNbt() { - CustomDataUtil.remove(stack); - } - - public boolean hasCustomNbt() { - return CustomDataUtil.hasNbt(stack); - } - - public boolean isEmpty() { - return stack.isEmpty(); - } - - public CompatIdentifier getItemId() { - return ItemUtil.toCompatID(stack.getItem()); - } - - public ItemStack copy() { - return new ItemStack(stack.copy()); - } - - public ItemStack copyWithCount(int count) { - return new ItemStack(stack.copyWithCount(count)); - } - - public Map getEnchantments(@Nullable World world) { - return EnchantmentUtil.getEnchantment(stack, world); - } - - public void setEnchantments(Map enchantments, @Nullable World world) { - EnchantmentUtil.setEnchantment(stack, enchantments, world); - } - - public int getMaxCount() { - return ItemStackUtil.getMaxCount(stack); - } - - public boolean hasLore() { - return LoreUtil.hasLore(stack); - } - - public List getLore() { - return LoreUtil.getLore(stack); - } - - public List getLoreAsStringList() { - return LoreUtil.getLoreAsStringList(stack); - } - - public void setLore(List lore) { - LoreUtil.setLore(stack, lore); - } - - public void setLoreString(List lore) { - LoreUtil.setLoreStringList(stack, lore); - } - - public void setLore(String lore) { - LoreUtil.setLore(stack, lore); - } - - @Deprecated - public net.minecraft.item.ItemStack toMinecraft() { - return stack; - } - - public ItemWrapper getItem() { - if (isEmpty()) - return ItemWrapper.of(); - - return ItemWrapper.of(getRawItem()); - } - - public Item getRawItem() { - return ItemStackUtil.getItem(stack); - } - - public static class Builder { - - protected CompatIdentifier id; - protected int count = 1; - protected NbtCompound nbt = NbtUtil.create(); - - public Builder() { - - } - - public Builder item(CompatIdentifier id) { - this.id = id; - return this; - } - - public Builder item(ItemConvertible item) { - this.id = ItemUtil.toCompatID(item.asItem()); - return this; - } - - public Builder count(int count) { - this.count = count; - return this; - } - - public Builder nbt(NbtCompound nbt) { - this.nbt = nbt; - return this; - } - - public ItemStack build() { - net.minecraft.item.ItemStack stack = new net.minecraft.item.ItemStack(ItemUtil.fromId(id), count); - CustomDataUtil.setNbt(stack, nbt); - - return new ItemStack(stack); - } - } - - @Override - public String toString() { - return stack.toString(); - } - - public void increment(int amount) { - ItemStackUtil.incrementCount(stack, amount); - } - - public void decrement(int amount) { - ItemStackUtil.decrementCount(stack, amount); - } - - public void increment() { - increment(1); - } - - public void decrement() { - decrement(1); - } - - public boolean is(ItemWrapper item) { - return getRawItem() == item.get(); - } - - public boolean is(CompatIdentifier id) { - return getItemId().equals(id); - } - - public boolean isBlockItem() { - return getItem().isBlock(); - } - - public net.pitan76.mcpitanlib.midohra.nbt.NbtCompound getCustomNbtM() { - return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(getCustomNbt()); - } - - public void setCustomNbt(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { - setCustomNbt(nbt.toMinecraft()); - } - - public void setLoreM(List lore) { - LoreUtil.setLore(stack, lore.stream().map(TextComponent::getText).toList()); - } - - public List getLoreM() { - return getLore().stream().map(TextComponent::new).toList(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java deleted file mode 100644 index 1476e2b26..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.item; - -import net.pitan76.mcpitanlib.api.item.v2.CompatItem; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.api.util.item.ItemUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltItem; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; - -public class ItemWrapper { - private final net.minecraft.item.Item item; - - protected ItemWrapper() { - this.item = null; - } - - protected ItemWrapper(net.minecraft.item.Item item) { - this.item = item; - } - - public static ItemWrapper of(net.minecraft.item.Item item) { - return new ItemWrapper(item); - } - - public static ItemWrapper of() { - return new ItemWrapper(); - } - - public static ItemWrapper of(CompatIdentifier id) { - if (ItemUtil.isExist(id)) - return of(ItemUtil.fromId(id)); - - return of(); - } - - public static ItemWrapper of(CompatIdentifier id, CompatIdentifier... ids) { - if (of(id).isPresent()) return of(id); - - for (CompatIdentifier id1 : ids) { - if (of(id1).isPresent()) - return of(id1); - } - - return of(); - } - - public boolean isPresent() { - return !isEmpty(); - } - - public boolean isEmpty() { - return get() == null; - } - - public boolean isAir() { - return isEmpty() || get() == net.minecraft.item.Items.AIR; - } - - @Nullable - public net.minecraft.item.Item get() { - return item; - } - - public net.minecraft.item.Item gerOrDefault(net.minecraft.item.Item defaultItem) { - return isEmpty() ? defaultItem : get(); - } - - public CompatIdentifier getId() { - if (isEmpty()) - return CompatIdentifier.empty(); - - return ItemUtil.toId(get()); - } - - public String getName() { - if (isEmpty()) return ""; - return ItemUtil.getNameAsString(get()); - } - - public String getTranslationKey() { - if (isEmpty()) return ""; - return ItemUtil.getTranslationKey(get()); - } - - public ItemStack createStack(int count) { - if (isEmpty()) return ItemStack.EMPTY; - return ItemStack.of(ItemStackUtil.create(get(), count)); - } - - public ItemStack createStack() { - return createStack(1); - } - - public boolean isInTag(CompatIdentifier id) { - return ItemUtil.isInTag(get(), id); - } - - public boolean isBlock() { - return !isEmpty() && get() instanceof net.minecraft.item.BlockItem; - } - - public BlockWrapper asBlock() { - if (!isBlock()) - return BlockWrapper.of(); - - return BlockWrapper.of(((net.minecraft.item.BlockItem) get()).getBlock()); - } - - public boolean rawEquals(ItemWrapper item) { - return get() == item.get(); - } - - @Override - public int hashCode() { - return get() != null ? get().hashCode() : 0; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - ItemWrapper item = (ItemWrapper) obj; - return rawEquals(item); - } - - public static ItemWrapper of(BlockWrapper block) { - if (block.isEmpty()) - return of(); - - return of(block.asItem().get()); - } - - public static ItemWrapper of(String id) { - return of(CompatIdentifier.of(id)); - } - - public static ItemWrapper of(String namespace, String path) { - return of(CompatIdentifier.of(namespace, path)); - } - - public static ItemWrapper of(CompatItem item) { - return of((net.minecraft.item.Item) item); - } - - public Optional toCompatItem() { - if (get() instanceof CompatItem) { - return Optional.of((CompatItem) get()); - } - return Optional.empty(); - } - - public Optional toBuiltItem() { - if (get() instanceof BuiltItem) { - return Optional.of((BuiltItem) get()); - } - return Optional.empty(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java deleted file mode 100644 index c79f22ff6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java +++ /dev/null @@ -1,984 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.item; - -public class Items { - public static ItemWrapper AIR = of(net.minecraft.item.Items.AIR); - public static ItemWrapper STONE = of(net.minecraft.item.Items.STONE); - public static ItemWrapper GRANITE = of(net.minecraft.item.Items.GRANITE); - public static ItemWrapper POLISHED_GRANITE = of(net.minecraft.item.Items.POLISHED_GRANITE); - public static ItemWrapper DIORITE = of(net.minecraft.item.Items.DIORITE); - public static ItemWrapper POLISHED_DIORITE = of(net.minecraft.item.Items.POLISHED_DIORITE); - public static ItemWrapper ANDESITE = of(net.minecraft.item.Items.ANDESITE); - public static ItemWrapper POLISHED_ANDESITE = of(net.minecraft.item.Items.POLISHED_ANDESITE); - public static ItemWrapper GRASS_BLOCK = of(net.minecraft.item.Items.GRASS_BLOCK); - public static ItemWrapper DIRT = of(net.minecraft.item.Items.DIRT); - public static ItemWrapper COARSE_DIRT = of(net.minecraft.item.Items.COARSE_DIRT); - public static ItemWrapper PODZOL = of(net.minecraft.item.Items.PODZOL); - public static ItemWrapper CRIMSON_NYLIUM = of(net.minecraft.item.Items.CRIMSON_NYLIUM); - public static ItemWrapper WARPED_NYLIUM = of(net.minecraft.item.Items.WARPED_NYLIUM); - public static ItemWrapper COBBLESTONE = of(net.minecraft.item.Items.COBBLESTONE); - public static ItemWrapper OAK_PLANKS = of(net.minecraft.item.Items.OAK_PLANKS); - public static ItemWrapper SPRUCE_PLANKS = of(net.minecraft.item.Items.SPRUCE_PLANKS); - public static ItemWrapper BIRCH_PLANKS = of(net.minecraft.item.Items.BIRCH_PLANKS); - public static ItemWrapper JUNGLE_PLANKS = of(net.minecraft.item.Items.JUNGLE_PLANKS); - public static ItemWrapper ACACIA_PLANKS = of(net.minecraft.item.Items.ACACIA_PLANKS); - public static ItemWrapper DARK_OAK_PLANKS = of(net.minecraft.item.Items.DARK_OAK_PLANKS); - public static ItemWrapper CRIMSON_PLANKS = of(net.minecraft.item.Items.CRIMSON_PLANKS); - public static ItemWrapper WARPED_PLANKS = of(net.minecraft.item.Items.WARPED_PLANKS); - public static ItemWrapper OAK_SAPLING = of(net.minecraft.item.Items.OAK_SAPLING); - public static ItemWrapper SPRUCE_SAPLING = of(net.minecraft.item.Items.SPRUCE_SAPLING); - public static ItemWrapper BIRCH_SAPLING = of(net.minecraft.item.Items.BIRCH_SAPLING); - public static ItemWrapper JUNGLE_SAPLING = of(net.minecraft.item.Items.JUNGLE_SAPLING); - public static ItemWrapper ACACIA_SAPLING = of(net.minecraft.item.Items.ACACIA_SAPLING); - public static ItemWrapper DARK_OAK_SAPLING = of(net.minecraft.item.Items.DARK_OAK_SAPLING); - public static ItemWrapper BEDROCK = of(net.minecraft.item.Items.BEDROCK); - public static ItemWrapper SAND = of(net.minecraft.item.Items.SAND); - public static ItemWrapper RED_SAND = of(net.minecraft.item.Items.RED_SAND); - public static ItemWrapper GRAVEL = of(net.minecraft.item.Items.GRAVEL); - public static ItemWrapper GOLD_ORE = of(net.minecraft.item.Items.GOLD_ORE); - public static ItemWrapper IRON_ORE = of(net.minecraft.item.Items.IRON_ORE); - public static ItemWrapper COAL_ORE = of(net.minecraft.item.Items.COAL_ORE); - public static ItemWrapper NETHER_GOLD_ORE = of(net.minecraft.item.Items.NETHER_GOLD_ORE); - public static ItemWrapper OAK_LOG = of(net.minecraft.item.Items.OAK_LOG); - public static ItemWrapper SPRUCE_LOG = of(net.minecraft.item.Items.SPRUCE_LOG); - public static ItemWrapper BIRCH_LOG = of(net.minecraft.item.Items.BIRCH_LOG); - public static ItemWrapper JUNGLE_LOG = of(net.minecraft.item.Items.JUNGLE_LOG); - public static ItemWrapper ACACIA_LOG = of(net.minecraft.item.Items.ACACIA_LOG); - public static ItemWrapper DARK_OAK_LOG = of(net.minecraft.item.Items.DARK_OAK_LOG); - public static ItemWrapper CRIMSON_STEM = of(net.minecraft.item.Items.CRIMSON_STEM); - public static ItemWrapper WARPED_STEM = of(net.minecraft.item.Items.WARPED_STEM); - public static ItemWrapper STRIPPED_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_OAK_LOG); - public static ItemWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.item.Items.STRIPPED_SPRUCE_LOG); - public static ItemWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.item.Items.STRIPPED_BIRCH_LOG); - public static ItemWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.item.Items.STRIPPED_JUNGLE_LOG); - public static ItemWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.item.Items.STRIPPED_ACACIA_LOG); - public static ItemWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_LOG); - public static ItemWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.item.Items.STRIPPED_CRIMSON_STEM); - public static ItemWrapper STRIPPED_WARPED_STEM = of(net.minecraft.item.Items.STRIPPED_WARPED_STEM); - public static ItemWrapper STRIPPED_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_OAK_WOOD); - public static ItemWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.item.Items.STRIPPED_SPRUCE_WOOD); - public static ItemWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.item.Items.STRIPPED_BIRCH_WOOD); - public static ItemWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.item.Items.STRIPPED_JUNGLE_WOOD); - public static ItemWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.item.Items.STRIPPED_ACACIA_WOOD); - public static ItemWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_WOOD); - public static ItemWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.item.Items.STRIPPED_CRIMSON_HYPHAE); - public static ItemWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.item.Items.STRIPPED_WARPED_HYPHAE); - public static ItemWrapper OAK_WOOD = of(net.minecraft.item.Items.OAK_WOOD); - public static ItemWrapper SPRUCE_WOOD = of(net.minecraft.item.Items.SPRUCE_WOOD); - public static ItemWrapper BIRCH_WOOD = of(net.minecraft.item.Items.BIRCH_WOOD); - public static ItemWrapper JUNGLE_WOOD = of(net.minecraft.item.Items.JUNGLE_WOOD); - public static ItemWrapper ACACIA_WOOD = of(net.minecraft.item.Items.ACACIA_WOOD); - public static ItemWrapper DARK_OAK_WOOD = of(net.minecraft.item.Items.DARK_OAK_WOOD); - public static ItemWrapper CRIMSON_HYPHAE = of(net.minecraft.item.Items.CRIMSON_HYPHAE); - public static ItemWrapper WARPED_HYPHAE = of(net.minecraft.item.Items.WARPED_HYPHAE); - public static ItemWrapper OAK_LEAVES = of(net.minecraft.item.Items.OAK_LEAVES); - public static ItemWrapper SPRUCE_LEAVES = of(net.minecraft.item.Items.SPRUCE_LEAVES); - public static ItemWrapper BIRCH_LEAVES = of(net.minecraft.item.Items.BIRCH_LEAVES); - public static ItemWrapper JUNGLE_LEAVES = of(net.minecraft.item.Items.JUNGLE_LEAVES); - public static ItemWrapper ACACIA_LEAVES = of(net.minecraft.item.Items.ACACIA_LEAVES); - public static ItemWrapper DARK_OAK_LEAVES = of(net.minecraft.item.Items.DARK_OAK_LEAVES); - public static ItemWrapper SPONGE = of(net.minecraft.item.Items.SPONGE); - public static ItemWrapper WET_SPONGE = of(net.minecraft.item.Items.WET_SPONGE); - public static ItemWrapper GLASS = of(net.minecraft.item.Items.GLASS); - public static ItemWrapper LAPIS_ORE = of(net.minecraft.item.Items.LAPIS_ORE); - public static ItemWrapper LAPIS_BLOCK = of(net.minecraft.item.Items.LAPIS_BLOCK); - public static ItemWrapper DISPENSER = of(net.minecraft.item.Items.DISPENSER); - public static ItemWrapper SANDSTONE = of(net.minecraft.item.Items.SANDSTONE); - public static ItemWrapper CHISELED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_SANDSTONE); - public static ItemWrapper CUT_SANDSTONE = of(net.minecraft.item.Items.CUT_SANDSTONE); - public static ItemWrapper NOTE_BLOCK = of(net.minecraft.item.Items.NOTE_BLOCK); - public static ItemWrapper POWERED_RAIL = of(net.minecraft.item.Items.POWERED_RAIL); - public static ItemWrapper DETECTOR_RAIL = of(net.minecraft.item.Items.DETECTOR_RAIL); - public static ItemWrapper STICKY_PISTON = of(net.minecraft.item.Items.STICKY_PISTON); - public static ItemWrapper COBWEB = of(net.minecraft.item.Items.COBWEB); - public static ItemWrapper GRASS = of(net.minecraft.item.Items.SHORT_GRASS); - public static ItemWrapper FERN = of(net.minecraft.item.Items.FERN); - public static ItemWrapper DEAD_BUSH = of(net.minecraft.item.Items.DEAD_BUSH); - public static ItemWrapper SEAGRASS = of(net.minecraft.item.Items.SEAGRASS); - public static ItemWrapper SEA_PICKLE = of(net.minecraft.item.Items.SEA_PICKLE); - public static ItemWrapper PISTON = of(net.minecraft.item.Items.PISTON); - public static ItemWrapper WHITE_WOOL = of(net.minecraft.item.Items.WHITE_WOOL); - public static ItemWrapper ORANGE_WOOL = of(net.minecraft.item.Items.ORANGE_WOOL); - public static ItemWrapper MAGENTA_WOOL = of(net.minecraft.item.Items.MAGENTA_WOOL); - public static ItemWrapper LIGHT_BLUE_WOOL = of(net.minecraft.item.Items.LIGHT_BLUE_WOOL); - public static ItemWrapper YELLOW_WOOL = of(net.minecraft.item.Items.YELLOW_WOOL); - public static ItemWrapper LIME_WOOL = of(net.minecraft.item.Items.LIME_WOOL); - public static ItemWrapper PINK_WOOL = of(net.minecraft.item.Items.PINK_WOOL); - public static ItemWrapper GRAY_WOOL = of(net.minecraft.item.Items.GRAY_WOOL); - public static ItemWrapper LIGHT_GRAY_WOOL = of(net.minecraft.item.Items.LIGHT_GRAY_WOOL); - public static ItemWrapper CYAN_WOOL = of(net.minecraft.item.Items.CYAN_WOOL); - public static ItemWrapper PURPLE_WOOL = of(net.minecraft.item.Items.PURPLE_WOOL); - public static ItemWrapper BLUE_WOOL = of(net.minecraft.item.Items.BLUE_WOOL); - public static ItemWrapper BROWN_WOOL = of(net.minecraft.item.Items.BROWN_WOOL); - public static ItemWrapper GREEN_WOOL = of(net.minecraft.item.Items.GREEN_WOOL); - public static ItemWrapper RED_WOOL = of(net.minecraft.item.Items.RED_WOOL); - public static ItemWrapper BLACK_WOOL = of(net.minecraft.item.Items.BLACK_WOOL); - public static ItemWrapper DANDELION = of(net.minecraft.item.Items.DANDELION); - public static ItemWrapper POPPY = of(net.minecraft.item.Items.POPPY); - public static ItemWrapper BLUE_ORCHID = of(net.minecraft.item.Items.BLUE_ORCHID); - public static ItemWrapper ALLIUM = of(net.minecraft.item.Items.ALLIUM); - public static ItemWrapper AZURE_BLUET = of(net.minecraft.item.Items.AZURE_BLUET); - public static ItemWrapper RED_TULIP = of(net.minecraft.item.Items.RED_TULIP); - public static ItemWrapper ORANGE_TULIP = of(net.minecraft.item.Items.ORANGE_TULIP); - public static ItemWrapper WHITE_TULIP = of(net.minecraft.item.Items.WHITE_TULIP); - public static ItemWrapper PINK_TULIP = of(net.minecraft.item.Items.PINK_TULIP); - public static ItemWrapper OXEYE_DAISY = of(net.minecraft.item.Items.OXEYE_DAISY); - public static ItemWrapper CORNFLOWER = of(net.minecraft.item.Items.CORNFLOWER); - public static ItemWrapper LILY_OF_THE_VALLEY = of(net.minecraft.item.Items.LILY_OF_THE_VALLEY); - public static ItemWrapper WITHER_ROSE = of(net.minecraft.item.Items.WITHER_ROSE); - public static ItemWrapper BROWN_MUSHROOM = of(net.minecraft.item.Items.BROWN_MUSHROOM); - public static ItemWrapper RED_MUSHROOM = of(net.minecraft.item.Items.RED_MUSHROOM); - public static ItemWrapper CRIMSON_FUNGUS = of(net.minecraft.item.Items.CRIMSON_FUNGUS); - public static ItemWrapper WARPED_FUNGUS = of(net.minecraft.item.Items.WARPED_FUNGUS); - public static ItemWrapper CRIMSON_ROOTS = of(net.minecraft.item.Items.CRIMSON_ROOTS); - public static ItemWrapper WARPED_ROOTS = of(net.minecraft.item.Items.WARPED_ROOTS); - public static ItemWrapper NETHER_SPROUTS = of(net.minecraft.item.Items.NETHER_SPROUTS); - public static ItemWrapper WEEPING_VINES = of(net.minecraft.item.Items.WEEPING_VINES); - public static ItemWrapper TWISTING_VINES = of(net.minecraft.item.Items.TWISTING_VINES); - public static ItemWrapper SUGAR_CANE = of(net.minecraft.item.Items.SUGAR_CANE); - public static ItemWrapper KELP = of(net.minecraft.item.Items.KELP); - public static ItemWrapper BAMBOO = of(net.minecraft.item.Items.BAMBOO); - public static ItemWrapper GOLD_BLOCK = of(net.minecraft.item.Items.GOLD_BLOCK); - public static ItemWrapper IRON_BLOCK = of(net.minecraft.item.Items.IRON_BLOCK); - public static ItemWrapper OAK_SLAB = of(net.minecraft.item.Items.OAK_SLAB); - public static ItemWrapper SPRUCE_SLAB = of(net.minecraft.item.Items.SPRUCE_SLAB); - public static ItemWrapper BIRCH_SLAB = of(net.minecraft.item.Items.BIRCH_SLAB); - public static ItemWrapper JUNGLE_SLAB = of(net.minecraft.item.Items.JUNGLE_SLAB); - public static ItemWrapper ACACIA_SLAB = of(net.minecraft.item.Items.ACACIA_SLAB); - public static ItemWrapper DARK_OAK_SLAB = of(net.minecraft.item.Items.DARK_OAK_SLAB); - public static ItemWrapper CRIMSON_SLAB = of(net.minecraft.item.Items.CRIMSON_SLAB); - public static ItemWrapper WARPED_SLAB = of(net.minecraft.item.Items.WARPED_SLAB); - public static ItemWrapper STONE_SLAB = of(net.minecraft.item.Items.STONE_SLAB); - public static ItemWrapper SMOOTH_STONE_SLAB = of(net.minecraft.item.Items.SMOOTH_STONE_SLAB); - public static ItemWrapper SANDSTONE_SLAB = of(net.minecraft.item.Items.SANDSTONE_SLAB); - public static ItemWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_SANDSTONE_SLAB); - public static ItemWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.item.Items.PETRIFIED_OAK_SLAB); - public static ItemWrapper COBBLESTONE_SLAB = of(net.minecraft.item.Items.COBBLESTONE_SLAB); - public static ItemWrapper BRICK_SLAB = of(net.minecraft.item.Items.BRICK_SLAB); - public static ItemWrapper STONE_BRICK_SLAB = of(net.minecraft.item.Items.STONE_BRICK_SLAB); - public static ItemWrapper NETHER_BRICK_SLAB = of(net.minecraft.item.Items.NETHER_BRICK_SLAB); - public static ItemWrapper QUARTZ_SLAB = of(net.minecraft.item.Items.QUARTZ_SLAB); - public static ItemWrapper RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.RED_SANDSTONE_SLAB); - public static ItemWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_RED_SANDSTONE_SLAB); - public static ItemWrapper PURPUR_SLAB = of(net.minecraft.item.Items.PURPUR_SLAB); - public static ItemWrapper PRISMARINE_SLAB = of(net.minecraft.item.Items.PRISMARINE_SLAB); - public static ItemWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.item.Items.PRISMARINE_BRICK_SLAB); - public static ItemWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.item.Items.DARK_PRISMARINE_SLAB); - public static ItemWrapper SMOOTH_QUARTZ = of(net.minecraft.item.Items.SMOOTH_QUARTZ); - public static ItemWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE); - public static ItemWrapper SMOOTH_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_SANDSTONE); - public static ItemWrapper SMOOTH_STONE = of(net.minecraft.item.Items.SMOOTH_STONE); - public static ItemWrapper BRICKS = of(net.minecraft.item.Items.BRICKS); - public static ItemWrapper TNT = of(net.minecraft.item.Items.TNT); - public static ItemWrapper BOOKSHELF = of(net.minecraft.item.Items.BOOKSHELF); - public static ItemWrapper MOSSY_COBBLESTONE = of(net.minecraft.item.Items.MOSSY_COBBLESTONE); - public static ItemWrapper OBSIDIAN = of(net.minecraft.item.Items.OBSIDIAN); - public static ItemWrapper TORCH = of(net.minecraft.item.Items.TORCH); - public static ItemWrapper END_ROD = of(net.minecraft.item.Items.END_ROD); - public static ItemWrapper CHORUS_PLANT = of(net.minecraft.item.Items.CHORUS_PLANT); - public static ItemWrapper CHORUS_FLOWER = of(net.minecraft.item.Items.CHORUS_FLOWER); - public static ItemWrapper PURPUR_BLOCK = of(net.minecraft.item.Items.PURPUR_BLOCK); - public static ItemWrapper PURPUR_PILLAR = of(net.minecraft.item.Items.PURPUR_PILLAR); - public static ItemWrapper PURPUR_STAIRS = of(net.minecraft.item.Items.PURPUR_STAIRS); - public static ItemWrapper SPAWNER = of(net.minecraft.item.Items.SPAWNER); - public static ItemWrapper OAK_STAIRS = of(net.minecraft.item.Items.OAK_STAIRS); - public static ItemWrapper CHEST = of(net.minecraft.item.Items.CHEST); - public static ItemWrapper DIAMOND_ORE = of(net.minecraft.item.Items.DIAMOND_ORE); - public static ItemWrapper DIAMOND_BLOCK = of(net.minecraft.item.Items.DIAMOND_BLOCK); - public static ItemWrapper CRAFTING_TABLE = of(net.minecraft.item.Items.CRAFTING_TABLE); - public static ItemWrapper FARMLAND = of(net.minecraft.item.Items.FARMLAND); - public static ItemWrapper FURNACE = of(net.minecraft.item.Items.FURNACE); - public static ItemWrapper LADDER = of(net.minecraft.item.Items.LADDER); - public static ItemWrapper RAIL = of(net.minecraft.item.Items.RAIL); - public static ItemWrapper COBBLESTONE_STAIRS = of(net.minecraft.item.Items.COBBLESTONE_STAIRS); - public static ItemWrapper LEVER = of(net.minecraft.item.Items.LEVER); - public static ItemWrapper STONE_PRESSURE_PLATE = of(net.minecraft.item.Items.STONE_PRESSURE_PLATE); - public static ItemWrapper OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.OAK_PRESSURE_PLATE); - public static ItemWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.item.Items.SPRUCE_PRESSURE_PLATE); - public static ItemWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.item.Items.BIRCH_PRESSURE_PLATE); - public static ItemWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.item.Items.JUNGLE_PRESSURE_PLATE); - public static ItemWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.item.Items.ACACIA_PRESSURE_PLATE); - public static ItemWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.DARK_OAK_PRESSURE_PLATE); - public static ItemWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.item.Items.CRIMSON_PRESSURE_PLATE); - public static ItemWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.item.Items.WARPED_PRESSURE_PLATE); - public static ItemWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_PRESSURE_PLATE); - public static ItemWrapper REDSTONE_ORE = of(net.minecraft.item.Items.REDSTONE_ORE); - public static ItemWrapper REDSTONE_TORCH = of(net.minecraft.item.Items.REDSTONE_TORCH); - public static ItemWrapper SNOW = of(net.minecraft.item.Items.SNOW); - public static ItemWrapper ICE = of(net.minecraft.item.Items.ICE); - public static ItemWrapper SNOW_BLOCK = of(net.minecraft.item.Items.SNOW_BLOCK); - public static ItemWrapper CACTUS = of(net.minecraft.item.Items.CACTUS); - public static ItemWrapper CLAY = of(net.minecraft.item.Items.CLAY); - public static ItemWrapper JUKEBOX = of(net.minecraft.item.Items.JUKEBOX); - public static ItemWrapper OAK_FENCE = of(net.minecraft.item.Items.OAK_FENCE); - public static ItemWrapper SPRUCE_FENCE = of(net.minecraft.item.Items.SPRUCE_FENCE); - public static ItemWrapper BIRCH_FENCE = of(net.minecraft.item.Items.BIRCH_FENCE); - public static ItemWrapper JUNGLE_FENCE = of(net.minecraft.item.Items.JUNGLE_FENCE); - public static ItemWrapper ACACIA_FENCE = of(net.minecraft.item.Items.ACACIA_FENCE); - public static ItemWrapper DARK_OAK_FENCE = of(net.minecraft.item.Items.DARK_OAK_FENCE); - public static ItemWrapper CRIMSON_FENCE = of(net.minecraft.item.Items.CRIMSON_FENCE); - public static ItemWrapper WARPED_FENCE = of(net.minecraft.item.Items.WARPED_FENCE); - public static ItemWrapper PUMPKIN = of(net.minecraft.item.Items.PUMPKIN); - public static ItemWrapper CARVED_PUMPKIN = of(net.minecraft.item.Items.CARVED_PUMPKIN); - public static ItemWrapper NETHERRACK = of(net.minecraft.item.Items.NETHERRACK); - public static ItemWrapper SOUL_SAND = of(net.minecraft.item.Items.SOUL_SAND); - public static ItemWrapper SOUL_SOIL = of(net.minecraft.item.Items.SOUL_SOIL); - public static ItemWrapper BASALT = of(net.minecraft.item.Items.BASALT); - public static ItemWrapper POLISHED_BASALT = of(net.minecraft.item.Items.POLISHED_BASALT); - public static ItemWrapper SOUL_TORCH = of(net.minecraft.item.Items.SOUL_TORCH); - public static ItemWrapper GLOWSTONE = of(net.minecraft.item.Items.GLOWSTONE); - public static ItemWrapper JACK_O_LANTERN = of(net.minecraft.item.Items.JACK_O_LANTERN); - public static ItemWrapper OAK_TRAPDOOR = of(net.minecraft.item.Items.OAK_TRAPDOOR); - public static ItemWrapper SPRUCE_TRAPDOOR = of(net.minecraft.item.Items.SPRUCE_TRAPDOOR); - public static ItemWrapper BIRCH_TRAPDOOR = of(net.minecraft.item.Items.BIRCH_TRAPDOOR); - public static ItemWrapper JUNGLE_TRAPDOOR = of(net.minecraft.item.Items.JUNGLE_TRAPDOOR); - public static ItemWrapper ACACIA_TRAPDOOR = of(net.minecraft.item.Items.ACACIA_TRAPDOOR); - public static ItemWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.item.Items.DARK_OAK_TRAPDOOR); - public static ItemWrapper CRIMSON_TRAPDOOR = of(net.minecraft.item.Items.CRIMSON_TRAPDOOR); - public static ItemWrapper WARPED_TRAPDOOR = of(net.minecraft.item.Items.WARPED_TRAPDOOR); - public static ItemWrapper INFESTED_STONE = of(net.minecraft.item.Items.INFESTED_STONE); - public static ItemWrapper INFESTED_COBBLESTONE = of(net.minecraft.item.Items.INFESTED_COBBLESTONE); - public static ItemWrapper INFESTED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_STONE_BRICKS); - public static ItemWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_MOSSY_STONE_BRICKS); - public static ItemWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CRACKED_STONE_BRICKS); - public static ItemWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CHISELED_STONE_BRICKS); - public static ItemWrapper STONE_BRICKS = of(net.minecraft.item.Items.STONE_BRICKS); - public static ItemWrapper MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.MOSSY_STONE_BRICKS); - public static ItemWrapper CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.CRACKED_STONE_BRICKS); - public static ItemWrapper CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.CHISELED_STONE_BRICKS); - public static ItemWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.item.Items.BROWN_MUSHROOM_BLOCK); - public static ItemWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.item.Items.RED_MUSHROOM_BLOCK); - public static ItemWrapper MUSHROOM_STEM = of(net.minecraft.item.Items.MUSHROOM_STEM); - public static ItemWrapper IRON_BARS = of(net.minecraft.item.Items.IRON_BARS); - public static ItemWrapper CHAIN = of(net.minecraft.item.Items.IRON_CHAIN); - public static ItemWrapper GLASS_PANE = of(net.minecraft.item.Items.GLASS_PANE); - public static ItemWrapper MELON = of(net.minecraft.item.Items.MELON); - public static ItemWrapper VINE = of(net.minecraft.item.Items.VINE); - public static ItemWrapper OAK_FENCE_GATE = of(net.minecraft.item.Items.OAK_FENCE_GATE); - public static ItemWrapper SPRUCE_FENCE_GATE = of(net.minecraft.item.Items.SPRUCE_FENCE_GATE); - public static ItemWrapper BIRCH_FENCE_GATE = of(net.minecraft.item.Items.BIRCH_FENCE_GATE); - public static ItemWrapper JUNGLE_FENCE_GATE = of(net.minecraft.item.Items.JUNGLE_FENCE_GATE); - public static ItemWrapper ACACIA_FENCE_GATE = of(net.minecraft.item.Items.ACACIA_FENCE_GATE); - public static ItemWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.item.Items.DARK_OAK_FENCE_GATE); - public static ItemWrapper CRIMSON_FENCE_GATE = of(net.minecraft.item.Items.CRIMSON_FENCE_GATE); - public static ItemWrapper WARPED_FENCE_GATE = of(net.minecraft.item.Items.WARPED_FENCE_GATE); - public static ItemWrapper BRICK_STAIRS = of(net.minecraft.item.Items.BRICK_STAIRS); - public static ItemWrapper STONE_BRICK_STAIRS = of(net.minecraft.item.Items.STONE_BRICK_STAIRS); - public static ItemWrapper MYCELIUM = of(net.minecraft.item.Items.MYCELIUM); - public static ItemWrapper LILY_PAD = of(net.minecraft.item.Items.LILY_PAD); - public static ItemWrapper NETHER_BRICKS = of(net.minecraft.item.Items.NETHER_BRICKS); - public static ItemWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.item.Items.CRACKED_NETHER_BRICKS); - public static ItemWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.item.Items.CHISELED_NETHER_BRICKS); - public static ItemWrapper NETHER_BRICK_FENCE = of(net.minecraft.item.Items.NETHER_BRICK_FENCE); - public static ItemWrapper NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.NETHER_BRICK_STAIRS); - public static ItemWrapper ENCHANTING_TABLE = of(net.minecraft.item.Items.ENCHANTING_TABLE); - public static ItemWrapper END_PORTAL_FRAME = of(net.minecraft.item.Items.END_PORTAL_FRAME); - public static ItemWrapper END_STONE = of(net.minecraft.item.Items.END_STONE); - public static ItemWrapper END_STONE_BRICKS = of(net.minecraft.item.Items.END_STONE_BRICKS); - public static ItemWrapper DRAGON_EGG = of(net.minecraft.item.Items.DRAGON_EGG); - public static ItemWrapper REDSTONE_LAMP = of(net.minecraft.item.Items.REDSTONE_LAMP); - public static ItemWrapper SANDSTONE_STAIRS = of(net.minecraft.item.Items.SANDSTONE_STAIRS); - public static ItemWrapper EMERALD_ORE = of(net.minecraft.item.Items.EMERALD_ORE); - public static ItemWrapper ENDER_CHEST = of(net.minecraft.item.Items.ENDER_CHEST); - public static ItemWrapper TRIPWIRE_HOOK = of(net.minecraft.item.Items.TRIPWIRE_HOOK); - public static ItemWrapper EMERALD_BLOCK = of(net.minecraft.item.Items.EMERALD_BLOCK); - public static ItemWrapper SPRUCE_STAIRS = of(net.minecraft.item.Items.SPRUCE_STAIRS); - public static ItemWrapper BIRCH_STAIRS = of(net.minecraft.item.Items.BIRCH_STAIRS); - public static ItemWrapper JUNGLE_STAIRS = of(net.minecraft.item.Items.JUNGLE_STAIRS); - public static ItemWrapper CRIMSON_STAIRS = of(net.minecraft.item.Items.CRIMSON_STAIRS); - public static ItemWrapper WARPED_STAIRS = of(net.minecraft.item.Items.WARPED_STAIRS); - public static ItemWrapper COMMAND_BLOCK = of(net.minecraft.item.Items.COMMAND_BLOCK); - public static ItemWrapper BEACON = of(net.minecraft.item.Items.BEACON); - public static ItemWrapper COBBLESTONE_WALL = of(net.minecraft.item.Items.COBBLESTONE_WALL); - public static ItemWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_WALL); - public static ItemWrapper BRICK_WALL = of(net.minecraft.item.Items.BRICK_WALL); - public static ItemWrapper PRISMARINE_WALL = of(net.minecraft.item.Items.PRISMARINE_WALL); - public static ItemWrapper RED_SANDSTONE_WALL = of(net.minecraft.item.Items.RED_SANDSTONE_WALL); - public static ItemWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_WALL); - public static ItemWrapper GRANITE_WALL = of(net.minecraft.item.Items.GRANITE_WALL); - public static ItemWrapper STONE_BRICK_WALL = of(net.minecraft.item.Items.STONE_BRICK_WALL); - public static ItemWrapper NETHER_BRICK_WALL = of(net.minecraft.item.Items.NETHER_BRICK_WALL); - public static ItemWrapper ANDESITE_WALL = of(net.minecraft.item.Items.ANDESITE_WALL); - public static ItemWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.item.Items.RED_NETHER_BRICK_WALL); - public static ItemWrapper SANDSTONE_WALL = of(net.minecraft.item.Items.SANDSTONE_WALL); - public static ItemWrapper END_STONE_BRICK_WALL = of(net.minecraft.item.Items.END_STONE_BRICK_WALL); - public static ItemWrapper DIORITE_WALL = of(net.minecraft.item.Items.DIORITE_WALL); - public static ItemWrapper BLACKSTONE_WALL = of(net.minecraft.item.Items.BLACKSTONE_WALL); - public static ItemWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_WALL); - public static ItemWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_WALL); - public static ItemWrapper STONE_BUTTON = of(net.minecraft.item.Items.STONE_BUTTON); - public static ItemWrapper OAK_BUTTON = of(net.minecraft.item.Items.OAK_BUTTON); - public static ItemWrapper SPRUCE_BUTTON = of(net.minecraft.item.Items.SPRUCE_BUTTON); - public static ItemWrapper BIRCH_BUTTON = of(net.minecraft.item.Items.BIRCH_BUTTON); - public static ItemWrapper JUNGLE_BUTTON = of(net.minecraft.item.Items.JUNGLE_BUTTON); - public static ItemWrapper ACACIA_BUTTON = of(net.minecraft.item.Items.ACACIA_BUTTON); - public static ItemWrapper DARK_OAK_BUTTON = of(net.minecraft.item.Items.DARK_OAK_BUTTON); - public static ItemWrapper CRIMSON_BUTTON = of(net.minecraft.item.Items.CRIMSON_BUTTON); - public static ItemWrapper WARPED_BUTTON = of(net.minecraft.item.Items.WARPED_BUTTON); - public static ItemWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BUTTON); - public static ItemWrapper ANVIL = of(net.minecraft.item.Items.ANVIL); - public static ItemWrapper CHIPPED_ANVIL = of(net.minecraft.item.Items.CHIPPED_ANVIL); - public static ItemWrapper DAMAGED_ANVIL = of(net.minecraft.item.Items.DAMAGED_ANVIL); - public static ItemWrapper TRAPPED_CHEST = of(net.minecraft.item.Items.TRAPPED_CHEST); - public static ItemWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.LIGHT_WEIGHTED_PRESSURE_PLATE); - public static ItemWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.HEAVY_WEIGHTED_PRESSURE_PLATE); - public static ItemWrapper DAYLIGHT_DETECTOR = of(net.minecraft.item.Items.DAYLIGHT_DETECTOR); - public static ItemWrapper REDSTONE_BLOCK = of(net.minecraft.item.Items.REDSTONE_BLOCK); - public static ItemWrapper NETHER_QUARTZ_ORE = of(net.minecraft.item.Items.NETHER_QUARTZ_ORE); - public static ItemWrapper HOPPER = of(net.minecraft.item.Items.HOPPER); - public static ItemWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.item.Items.CHISELED_QUARTZ_BLOCK); - public static ItemWrapper QUARTZ_BLOCK = of(net.minecraft.item.Items.QUARTZ_BLOCK); - public static ItemWrapper QUARTZ_BRICKS = of(net.minecraft.item.Items.QUARTZ_BRICKS); - public static ItemWrapper QUARTZ_PILLAR = of(net.minecraft.item.Items.QUARTZ_PILLAR); - public static ItemWrapper QUARTZ_STAIRS = of(net.minecraft.item.Items.QUARTZ_STAIRS); - public static ItemWrapper ACTIVATOR_RAIL = of(net.minecraft.item.Items.ACTIVATOR_RAIL); - public static ItemWrapper DROPPER = of(net.minecraft.item.Items.DROPPER); - public static ItemWrapper WHITE_TERRACOTTA = of(net.minecraft.item.Items.WHITE_TERRACOTTA); - public static ItemWrapper ORANGE_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_TERRACOTTA); - public static ItemWrapper MAGENTA_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_TERRACOTTA); - public static ItemWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_TERRACOTTA); - public static ItemWrapper YELLOW_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_TERRACOTTA); - public static ItemWrapper LIME_TERRACOTTA = of(net.minecraft.item.Items.LIME_TERRACOTTA); - public static ItemWrapper PINK_TERRACOTTA = of(net.minecraft.item.Items.PINK_TERRACOTTA); - public static ItemWrapper GRAY_TERRACOTTA = of(net.minecraft.item.Items.GRAY_TERRACOTTA); - public static ItemWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_TERRACOTTA); - public static ItemWrapper CYAN_TERRACOTTA = of(net.minecraft.item.Items.CYAN_TERRACOTTA); - public static ItemWrapper PURPLE_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_TERRACOTTA); - public static ItemWrapper BLUE_TERRACOTTA = of(net.minecraft.item.Items.BLUE_TERRACOTTA); - public static ItemWrapper BROWN_TERRACOTTA = of(net.minecraft.item.Items.BROWN_TERRACOTTA); - public static ItemWrapper GREEN_TERRACOTTA = of(net.minecraft.item.Items.GREEN_TERRACOTTA); - public static ItemWrapper RED_TERRACOTTA = of(net.minecraft.item.Items.RED_TERRACOTTA); - public static ItemWrapper BLACK_TERRACOTTA = of(net.minecraft.item.Items.BLACK_TERRACOTTA); - public static ItemWrapper BARRIER = of(net.minecraft.item.Items.BARRIER); - public static ItemWrapper IRON_TRAPDOOR = of(net.minecraft.item.Items.IRON_TRAPDOOR); - public static ItemWrapper HAY_BLOCK = of(net.minecraft.item.Items.HAY_BLOCK); - public static ItemWrapper WHITE_CARPET = of(net.minecraft.item.Items.WHITE_CARPET); - public static ItemWrapper ORANGE_CARPET = of(net.minecraft.item.Items.ORANGE_CARPET); - public static ItemWrapper MAGENTA_CARPET = of(net.minecraft.item.Items.MAGENTA_CARPET); - public static ItemWrapper LIGHT_BLUE_CARPET = of(net.minecraft.item.Items.LIGHT_BLUE_CARPET); - public static ItemWrapper YELLOW_CARPET = of(net.minecraft.item.Items.YELLOW_CARPET); - public static ItemWrapper LIME_CARPET = of(net.minecraft.item.Items.LIME_CARPET); - public static ItemWrapper PINK_CARPET = of(net.minecraft.item.Items.PINK_CARPET); - public static ItemWrapper GRAY_CARPET = of(net.minecraft.item.Items.GRAY_CARPET); - public static ItemWrapper LIGHT_GRAY_CARPET = of(net.minecraft.item.Items.LIGHT_GRAY_CARPET); - public static ItemWrapper CYAN_CARPET = of(net.minecraft.item.Items.CYAN_CARPET); - public static ItemWrapper PURPLE_CARPET = of(net.minecraft.item.Items.PURPLE_CARPET); - public static ItemWrapper BLUE_CARPET = of(net.minecraft.item.Items.BLUE_CARPET); - public static ItemWrapper BROWN_CARPET = of(net.minecraft.item.Items.BROWN_CARPET); - public static ItemWrapper GREEN_CARPET = of(net.minecraft.item.Items.GREEN_CARPET); - public static ItemWrapper RED_CARPET = of(net.minecraft.item.Items.RED_CARPET); - public static ItemWrapper BLACK_CARPET = of(net.minecraft.item.Items.BLACK_CARPET); - public static ItemWrapper TERRACOTTA = of(net.minecraft.item.Items.TERRACOTTA); - public static ItemWrapper COAL_BLOCK = of(net.minecraft.item.Items.COAL_BLOCK); - public static ItemWrapper PACKED_ICE = of(net.minecraft.item.Items.PACKED_ICE); - public static ItemWrapper ACACIA_STAIRS = of(net.minecraft.item.Items.ACACIA_STAIRS); - public static ItemWrapper DARK_OAK_STAIRS = of(net.minecraft.item.Items.DARK_OAK_STAIRS); - public static ItemWrapper SLIME_BLOCK = of(net.minecraft.item.Items.SLIME_BLOCK); - public static ItemWrapper GRASS_PATH = of(net.minecraft.item.Items.DIRT_PATH); - public static ItemWrapper SUNFLOWER = of(net.minecraft.item.Items.SUNFLOWER); - public static ItemWrapper LILAC = of(net.minecraft.item.Items.LILAC); - public static ItemWrapper ROSE_BUSH = of(net.minecraft.item.Items.ROSE_BUSH); - public static ItemWrapper PEONY = of(net.minecraft.item.Items.PEONY); - public static ItemWrapper TALL_GRASS = of(net.minecraft.item.Items.TALL_GRASS); - public static ItemWrapper LARGE_FERN = of(net.minecraft.item.Items.LARGE_FERN); - public static ItemWrapper WHITE_STAINED_GLASS = of(net.minecraft.item.Items.WHITE_STAINED_GLASS); - public static ItemWrapper ORANGE_STAINED_GLASS = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS); - public static ItemWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS); - public static ItemWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS); - public static ItemWrapper YELLOW_STAINED_GLASS = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS); - public static ItemWrapper LIME_STAINED_GLASS = of(net.minecraft.item.Items.LIME_STAINED_GLASS); - public static ItemWrapper PINK_STAINED_GLASS = of(net.minecraft.item.Items.PINK_STAINED_GLASS); - public static ItemWrapper GRAY_STAINED_GLASS = of(net.minecraft.item.Items.GRAY_STAINED_GLASS); - public static ItemWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS); - public static ItemWrapper CYAN_STAINED_GLASS = of(net.minecraft.item.Items.CYAN_STAINED_GLASS); - public static ItemWrapper PURPLE_STAINED_GLASS = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS); - public static ItemWrapper BLUE_STAINED_GLASS = of(net.minecraft.item.Items.BLUE_STAINED_GLASS); - public static ItemWrapper BROWN_STAINED_GLASS = of(net.minecraft.item.Items.BROWN_STAINED_GLASS); - public static ItemWrapper GREEN_STAINED_GLASS = of(net.minecraft.item.Items.GREEN_STAINED_GLASS); - public static ItemWrapper RED_STAINED_GLASS = of(net.minecraft.item.Items.RED_STAINED_GLASS); - public static ItemWrapper BLACK_STAINED_GLASS = of(net.minecraft.item.Items.BLACK_STAINED_GLASS); - public static ItemWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.WHITE_STAINED_GLASS_PANE); - public static ItemWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS_PANE); - public static ItemWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS_PANE); - public static ItemWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS_PANE); - public static ItemWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS_PANE); - public static ItemWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIME_STAINED_GLASS_PANE); - public static ItemWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PINK_STAINED_GLASS_PANE); - public static ItemWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GRAY_STAINED_GLASS_PANE); - public static ItemWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS_PANE); - public static ItemWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.CYAN_STAINED_GLASS_PANE); - public static ItemWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS_PANE); - public static ItemWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLUE_STAINED_GLASS_PANE); - public static ItemWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BROWN_STAINED_GLASS_PANE); - public static ItemWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GREEN_STAINED_GLASS_PANE); - public static ItemWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.item.Items.RED_STAINED_GLASS_PANE); - public static ItemWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLACK_STAINED_GLASS_PANE); - public static ItemWrapper PRISMARINE = of(net.minecraft.item.Items.PRISMARINE); - public static ItemWrapper PRISMARINE_BRICKS = of(net.minecraft.item.Items.PRISMARINE_BRICKS); - public static ItemWrapper DARK_PRISMARINE = of(net.minecraft.item.Items.DARK_PRISMARINE); - public static ItemWrapper PRISMARINE_STAIRS = of(net.minecraft.item.Items.PRISMARINE_STAIRS); - public static ItemWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.item.Items.PRISMARINE_BRICK_STAIRS); - public static ItemWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.item.Items.DARK_PRISMARINE_STAIRS); - public static ItemWrapper SEA_LANTERN = of(net.minecraft.item.Items.SEA_LANTERN); - public static ItemWrapper RED_SANDSTONE = of(net.minecraft.item.Items.RED_SANDSTONE); - public static ItemWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_RED_SANDSTONE); - public static ItemWrapper CUT_RED_SANDSTONE = of(net.minecraft.item.Items.CUT_RED_SANDSTONE); - public static ItemWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.RED_SANDSTONE_STAIRS); - public static ItemWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.item.Items.REPEATING_COMMAND_BLOCK); - public static ItemWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.item.Items.CHAIN_COMMAND_BLOCK); - public static ItemWrapper MAGMA_BLOCK = of(net.minecraft.item.Items.MAGMA_BLOCK); - public static ItemWrapper NETHER_WART_BLOCK = of(net.minecraft.item.Items.NETHER_WART_BLOCK); - public static ItemWrapper WARPED_WART_BLOCK = of(net.minecraft.item.Items.WARPED_WART_BLOCK); - public static ItemWrapper RED_NETHER_BRICKS = of(net.minecraft.item.Items.RED_NETHER_BRICKS); - public static ItemWrapper BONE_BLOCK = of(net.minecraft.item.Items.BONE_BLOCK); - public static ItemWrapper STRUCTURE_VOID = of(net.minecraft.item.Items.STRUCTURE_VOID); - public static ItemWrapper OBSERVER = of(net.minecraft.item.Items.OBSERVER); - public static ItemWrapper SHULKER_BOX = of(net.minecraft.item.Items.SHULKER_BOX); - public static ItemWrapper WHITE_SHULKER_BOX = of(net.minecraft.item.Items.WHITE_SHULKER_BOX); - public static ItemWrapper ORANGE_SHULKER_BOX = of(net.minecraft.item.Items.ORANGE_SHULKER_BOX); - public static ItemWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.item.Items.MAGENTA_SHULKER_BOX); - public static ItemWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_BLUE_SHULKER_BOX); - public static ItemWrapper YELLOW_SHULKER_BOX = of(net.minecraft.item.Items.YELLOW_SHULKER_BOX); - public static ItemWrapper LIME_SHULKER_BOX = of(net.minecraft.item.Items.LIME_SHULKER_BOX); - public static ItemWrapper PINK_SHULKER_BOX = of(net.minecraft.item.Items.PINK_SHULKER_BOX); - public static ItemWrapper GRAY_SHULKER_BOX = of(net.minecraft.item.Items.GRAY_SHULKER_BOX); - public static ItemWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_GRAY_SHULKER_BOX); - public static ItemWrapper CYAN_SHULKER_BOX = of(net.minecraft.item.Items.CYAN_SHULKER_BOX); - public static ItemWrapper PURPLE_SHULKER_BOX = of(net.minecraft.item.Items.PURPLE_SHULKER_BOX); - public static ItemWrapper BLUE_SHULKER_BOX = of(net.minecraft.item.Items.BLUE_SHULKER_BOX); - public static ItemWrapper BROWN_SHULKER_BOX = of(net.minecraft.item.Items.BROWN_SHULKER_BOX); - public static ItemWrapper GREEN_SHULKER_BOX = of(net.minecraft.item.Items.GREEN_SHULKER_BOX); - public static ItemWrapper RED_SHULKER_BOX = of(net.minecraft.item.Items.RED_SHULKER_BOX); - public static ItemWrapper BLACK_SHULKER_BOX = of(net.minecraft.item.Items.BLACK_SHULKER_BOX); - public static ItemWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.WHITE_GLAZED_TERRACOTTA); - public static ItemWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_GLAZED_TERRACOTTA); - public static ItemWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_GLAZED_TERRACOTTA); - public static ItemWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_GLAZED_TERRACOTTA); - public static ItemWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_GLAZED_TERRACOTTA); - public static ItemWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIME_GLAZED_TERRACOTTA); - public static ItemWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PINK_GLAZED_TERRACOTTA); - public static ItemWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GRAY_GLAZED_TERRACOTTA); - public static ItemWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_GLAZED_TERRACOTTA); - public static ItemWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.CYAN_GLAZED_TERRACOTTA); - public static ItemWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_GLAZED_TERRACOTTA); - public static ItemWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLUE_GLAZED_TERRACOTTA); - public static ItemWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BROWN_GLAZED_TERRACOTTA); - public static ItemWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GREEN_GLAZED_TERRACOTTA); - public static ItemWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.RED_GLAZED_TERRACOTTA); - public static ItemWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLACK_GLAZED_TERRACOTTA); - public static ItemWrapper WHITE_CONCRETE = of(net.minecraft.item.Items.WHITE_CONCRETE); - public static ItemWrapper ORANGE_CONCRETE = of(net.minecraft.item.Items.ORANGE_CONCRETE); - public static ItemWrapper MAGENTA_CONCRETE = of(net.minecraft.item.Items.MAGENTA_CONCRETE); - public static ItemWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE); - public static ItemWrapper YELLOW_CONCRETE = of(net.minecraft.item.Items.YELLOW_CONCRETE); - public static ItemWrapper LIME_CONCRETE = of(net.minecraft.item.Items.LIME_CONCRETE); - public static ItemWrapper PINK_CONCRETE = of(net.minecraft.item.Items.PINK_CONCRETE); - public static ItemWrapper GRAY_CONCRETE = of(net.minecraft.item.Items.GRAY_CONCRETE); - public static ItemWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE); - public static ItemWrapper CYAN_CONCRETE = of(net.minecraft.item.Items.CYAN_CONCRETE); - public static ItemWrapper PURPLE_CONCRETE = of(net.minecraft.item.Items.PURPLE_CONCRETE); - public static ItemWrapper BLUE_CONCRETE = of(net.minecraft.item.Items.BLUE_CONCRETE); - public static ItemWrapper BROWN_CONCRETE = of(net.minecraft.item.Items.BROWN_CONCRETE); - public static ItemWrapper GREEN_CONCRETE = of(net.minecraft.item.Items.GREEN_CONCRETE); - public static ItemWrapper RED_CONCRETE = of(net.minecraft.item.Items.RED_CONCRETE); - public static ItemWrapper BLACK_CONCRETE = of(net.minecraft.item.Items.BLACK_CONCRETE); - public static ItemWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.item.Items.WHITE_CONCRETE_POWDER); - public static ItemWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.item.Items.ORANGE_CONCRETE_POWDER); - public static ItemWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.item.Items.MAGENTA_CONCRETE_POWDER); - public static ItemWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE_POWDER); - public static ItemWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.item.Items.YELLOW_CONCRETE_POWDER); - public static ItemWrapper LIME_CONCRETE_POWDER = of(net.minecraft.item.Items.LIME_CONCRETE_POWDER); - public static ItemWrapper PINK_CONCRETE_POWDER = of(net.minecraft.item.Items.PINK_CONCRETE_POWDER); - public static ItemWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.GRAY_CONCRETE_POWDER); - public static ItemWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE_POWDER); - public static ItemWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.item.Items.CYAN_CONCRETE_POWDER); - public static ItemWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.item.Items.PURPLE_CONCRETE_POWDER); - public static ItemWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.BLUE_CONCRETE_POWDER); - public static ItemWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.item.Items.BROWN_CONCRETE_POWDER); - public static ItemWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.item.Items.GREEN_CONCRETE_POWDER); - public static ItemWrapper RED_CONCRETE_POWDER = of(net.minecraft.item.Items.RED_CONCRETE_POWDER); - public static ItemWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.item.Items.BLACK_CONCRETE_POWDER); - public static ItemWrapper TURTLE_EGG = of(net.minecraft.item.Items.TURTLE_EGG); - public static ItemWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_BLOCK); - public static ItemWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_BLOCK); - public static ItemWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_BLOCK); - public static ItemWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_BLOCK); - public static ItemWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_HORN_CORAL_BLOCK); - public static ItemWrapper TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.TUBE_CORAL_BLOCK); - public static ItemWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.BRAIN_CORAL_BLOCK); - public static ItemWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.BUBBLE_CORAL_BLOCK); - public static ItemWrapper FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.FIRE_CORAL_BLOCK); - public static ItemWrapper HORN_CORAL_BLOCK = of(net.minecraft.item.Items.HORN_CORAL_BLOCK); - public static ItemWrapper TUBE_CORAL = of(net.minecraft.item.Items.TUBE_CORAL); - public static ItemWrapper BRAIN_CORAL = of(net.minecraft.item.Items.BRAIN_CORAL); - public static ItemWrapper BUBBLE_CORAL = of(net.minecraft.item.Items.BUBBLE_CORAL); - public static ItemWrapper FIRE_CORAL = of(net.minecraft.item.Items.FIRE_CORAL); - public static ItemWrapper HORN_CORAL = of(net.minecraft.item.Items.HORN_CORAL); - public static ItemWrapper DEAD_BRAIN_CORAL = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL); - public static ItemWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL); - public static ItemWrapper DEAD_FIRE_CORAL = of(net.minecraft.item.Items.DEAD_FIRE_CORAL); - public static ItemWrapper DEAD_HORN_CORAL = of(net.minecraft.item.Items.DEAD_HORN_CORAL); - public static ItemWrapper DEAD_TUBE_CORAL = of(net.minecraft.item.Items.DEAD_TUBE_CORAL); - public static ItemWrapper TUBE_CORAL_FAN = of(net.minecraft.item.Items.TUBE_CORAL_FAN); - public static ItemWrapper BRAIN_CORAL_FAN = of(net.minecraft.item.Items.BRAIN_CORAL_FAN); - public static ItemWrapper BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.BUBBLE_CORAL_FAN); - public static ItemWrapper FIRE_CORAL_FAN = of(net.minecraft.item.Items.FIRE_CORAL_FAN); - public static ItemWrapper HORN_CORAL_FAN = of(net.minecraft.item.Items.HORN_CORAL_FAN); - public static ItemWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_FAN); - public static ItemWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_FAN); - public static ItemWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_FAN); - public static ItemWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_FAN); - public static ItemWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_HORN_CORAL_FAN); - public static ItemWrapper BLUE_ICE = of(net.minecraft.item.Items.BLUE_ICE); - public static ItemWrapper CONDUIT = of(net.minecraft.item.Items.CONDUIT); - public static ItemWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.item.Items.POLISHED_GRANITE_STAIRS); - public static ItemWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_STAIRS); - public static ItemWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_STAIRS); - public static ItemWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.item.Items.POLISHED_DIORITE_STAIRS); - public static ItemWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_STAIRS); - public static ItemWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.END_STONE_BRICK_STAIRS); - public static ItemWrapper STONE_STAIRS = of(net.minecraft.item.Items.STONE_STAIRS); - public static ItemWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_STAIRS); - public static ItemWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.item.Items.SMOOTH_QUARTZ_STAIRS); - public static ItemWrapper GRANITE_STAIRS = of(net.minecraft.item.Items.GRANITE_STAIRS); - public static ItemWrapper ANDESITE_STAIRS = of(net.minecraft.item.Items.ANDESITE_STAIRS); - public static ItemWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.RED_NETHER_BRICK_STAIRS); - public static ItemWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.item.Items.POLISHED_ANDESITE_STAIRS); - public static ItemWrapper DIORITE_STAIRS = of(net.minecraft.item.Items.DIORITE_STAIRS); - public static ItemWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.item.Items.POLISHED_GRANITE_SLAB); - public static ItemWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_SLAB); - public static ItemWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_SLAB); - public static ItemWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.item.Items.POLISHED_DIORITE_SLAB); - public static ItemWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_SLAB); - public static ItemWrapper END_STONE_BRICK_SLAB = of(net.minecraft.item.Items.END_STONE_BRICK_SLAB); - public static ItemWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_SLAB); - public static ItemWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.item.Items.SMOOTH_QUARTZ_SLAB); - public static ItemWrapper GRANITE_SLAB = of(net.minecraft.item.Items.GRANITE_SLAB); - public static ItemWrapper ANDESITE_SLAB = of(net.minecraft.item.Items.ANDESITE_SLAB); - public static ItemWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.item.Items.RED_NETHER_BRICK_SLAB); - public static ItemWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.item.Items.POLISHED_ANDESITE_SLAB); - public static ItemWrapper DIORITE_SLAB = of(net.minecraft.item.Items.DIORITE_SLAB); - public static ItemWrapper SCAFFOLDING = of(net.minecraft.item.Items.SCAFFOLDING); - public static ItemWrapper IRON_DOOR = of(net.minecraft.item.Items.IRON_DOOR); - public static ItemWrapper OAK_DOOR = of(net.minecraft.item.Items.OAK_DOOR); - public static ItemWrapper SPRUCE_DOOR = of(net.minecraft.item.Items.SPRUCE_DOOR); - public static ItemWrapper BIRCH_DOOR = of(net.minecraft.item.Items.BIRCH_DOOR); - public static ItemWrapper JUNGLE_DOOR = of(net.minecraft.item.Items.JUNGLE_DOOR); - public static ItemWrapper ACACIA_DOOR = of(net.minecraft.item.Items.ACACIA_DOOR); - public static ItemWrapper DARK_OAK_DOOR = of(net.minecraft.item.Items.DARK_OAK_DOOR); - public static ItemWrapper CRIMSON_DOOR = of(net.minecraft.item.Items.CRIMSON_DOOR); - public static ItemWrapper WARPED_DOOR = of(net.minecraft.item.Items.WARPED_DOOR); - public static ItemWrapper REPEATER = of(net.minecraft.item.Items.REPEATER); - public static ItemWrapper COMPARATOR = of(net.minecraft.item.Items.COMPARATOR); - public static ItemWrapper STRUCTURE_BLOCK = of(net.minecraft.item.Items.STRUCTURE_BLOCK); - public static ItemWrapper JIGSAW = of(net.minecraft.item.Items.JIGSAW); - public static ItemWrapper TURTLE_HELMET = of(net.minecraft.item.Items.TURTLE_HELMET); - public static ItemWrapper SCUTE = of(net.minecraft.item.Items.TURTLE_SCUTE); - public static ItemWrapper FLINT_AND_STEEL = of(net.minecraft.item.Items.FLINT_AND_STEEL); - public static ItemWrapper APPLE = of(net.minecraft.item.Items.APPLE); - public static ItemWrapper BOW = of(net.minecraft.item.Items.BOW); - public static ItemWrapper ARROW = of(net.minecraft.item.Items.ARROW); - public static ItemWrapper COAL = of(net.minecraft.item.Items.COAL); - public static ItemWrapper CHARCOAL = of(net.minecraft.item.Items.CHARCOAL); - public static ItemWrapper DIAMOND = of(net.minecraft.item.Items.DIAMOND); - public static ItemWrapper IRON_INGOT = of(net.minecraft.item.Items.IRON_INGOT); - public static ItemWrapper GOLD_INGOT = of(net.minecraft.item.Items.GOLD_INGOT); - public static ItemWrapper NETHERITE_INGOT = of(net.minecraft.item.Items.NETHERITE_INGOT); - public static ItemWrapper NETHERITE_SCRAP = of(net.minecraft.item.Items.NETHERITE_SCRAP); - public static ItemWrapper WOODEN_SWORD = of(net.minecraft.item.Items.WOODEN_SWORD); - public static ItemWrapper WOODEN_SHOVEL = of(net.minecraft.item.Items.WOODEN_SHOVEL); - public static ItemWrapper WOODEN_PICKAXE = of(net.minecraft.item.Items.WOODEN_PICKAXE); - public static ItemWrapper WOODEN_AXE = of(net.minecraft.item.Items.WOODEN_AXE); - public static ItemWrapper WOODEN_HOE = of(net.minecraft.item.Items.WOODEN_HOE); - public static ItemWrapper STONE_SWORD = of(net.minecraft.item.Items.STONE_SWORD); - public static ItemWrapper STONE_SHOVEL = of(net.minecraft.item.Items.STONE_SHOVEL); - public static ItemWrapper STONE_PICKAXE = of(net.minecraft.item.Items.STONE_PICKAXE); - public static ItemWrapper STONE_AXE = of(net.minecraft.item.Items.STONE_AXE); - public static ItemWrapper STONE_HOE = of(net.minecraft.item.Items.STONE_HOE); - public static ItemWrapper GOLDEN_SWORD = of(net.minecraft.item.Items.GOLDEN_SWORD); - public static ItemWrapper GOLDEN_SHOVEL = of(net.minecraft.item.Items.GOLDEN_SHOVEL); - public static ItemWrapper GOLDEN_PICKAXE = of(net.minecraft.item.Items.GOLDEN_PICKAXE); - public static ItemWrapper GOLDEN_AXE = of(net.minecraft.item.Items.GOLDEN_AXE); - public static ItemWrapper GOLDEN_HOE = of(net.minecraft.item.Items.GOLDEN_HOE); - public static ItemWrapper IRON_SWORD = of(net.minecraft.item.Items.IRON_SWORD); - public static ItemWrapper IRON_SHOVEL = of(net.minecraft.item.Items.IRON_SHOVEL); - public static ItemWrapper IRON_PICKAXE = of(net.minecraft.item.Items.IRON_PICKAXE); - public static ItemWrapper IRON_AXE = of(net.minecraft.item.Items.IRON_AXE); - public static ItemWrapper IRON_HOE = of(net.minecraft.item.Items.IRON_HOE); - public static ItemWrapper DIAMOND_SWORD = of(net.minecraft.item.Items.DIAMOND_SWORD); - public static ItemWrapper DIAMOND_SHOVEL = of(net.minecraft.item.Items.DIAMOND_SHOVEL); - public static ItemWrapper DIAMOND_PICKAXE = of(net.minecraft.item.Items.DIAMOND_PICKAXE); - public static ItemWrapper DIAMOND_AXE = of(net.minecraft.item.Items.DIAMOND_AXE); - public static ItemWrapper DIAMOND_HOE = of(net.minecraft.item.Items.DIAMOND_HOE); - public static ItemWrapper NETHERITE_SWORD = of(net.minecraft.item.Items.NETHERITE_SWORD); - public static ItemWrapper NETHERITE_SHOVEL = of(net.minecraft.item.Items.NETHERITE_SHOVEL); - public static ItemWrapper NETHERITE_PICKAXE = of(net.minecraft.item.Items.NETHERITE_PICKAXE); - public static ItemWrapper NETHERITE_AXE = of(net.minecraft.item.Items.NETHERITE_AXE); - public static ItemWrapper NETHERITE_HOE = of(net.minecraft.item.Items.NETHERITE_HOE); - public static ItemWrapper STICK = of(net.minecraft.item.Items.STICK); - public static ItemWrapper BOWL = of(net.minecraft.item.Items.BOWL); - public static ItemWrapper MUSHROOM_STEW = of(net.minecraft.item.Items.MUSHROOM_STEW); - public static ItemWrapper STRING = of(net.minecraft.item.Items.STRING); - public static ItemWrapper FEATHER = of(net.minecraft.item.Items.FEATHER); - public static ItemWrapper GUNPOWDER = of(net.minecraft.item.Items.GUNPOWDER); - public static ItemWrapper WHEAT_SEEDS = of(net.minecraft.item.Items.WHEAT_SEEDS); - public static ItemWrapper WHEAT = of(net.minecraft.item.Items.WHEAT); - public static ItemWrapper BREAD = of(net.minecraft.item.Items.BREAD); - public static ItemWrapper LEATHER_HELMET = of(net.minecraft.item.Items.LEATHER_HELMET); - public static ItemWrapper LEATHER_CHESTPLATE = of(net.minecraft.item.Items.LEATHER_CHESTPLATE); - public static ItemWrapper LEATHER_LEGGINGS = of(net.minecraft.item.Items.LEATHER_LEGGINGS); - public static ItemWrapper LEATHER_BOOTS = of(net.minecraft.item.Items.LEATHER_BOOTS); - public static ItemWrapper CHAINMAIL_HELMET = of(net.minecraft.item.Items.CHAINMAIL_HELMET); - public static ItemWrapper CHAINMAIL_CHESTPLATE = of(net.minecraft.item.Items.CHAINMAIL_CHESTPLATE); - public static ItemWrapper CHAINMAIL_LEGGINGS = of(net.minecraft.item.Items.CHAINMAIL_LEGGINGS); - public static ItemWrapper CHAINMAIL_BOOTS = of(net.minecraft.item.Items.CHAINMAIL_BOOTS); - public static ItemWrapper IRON_HELMET = of(net.minecraft.item.Items.IRON_HELMET); - public static ItemWrapper IRON_CHESTPLATE = of(net.minecraft.item.Items.IRON_CHESTPLATE); - public static ItemWrapper IRON_LEGGINGS = of(net.minecraft.item.Items.IRON_LEGGINGS); - public static ItemWrapper IRON_BOOTS = of(net.minecraft.item.Items.IRON_BOOTS); - public static ItemWrapper DIAMOND_HELMET = of(net.minecraft.item.Items.DIAMOND_HELMET); - public static ItemWrapper DIAMOND_CHESTPLATE = of(net.minecraft.item.Items.DIAMOND_CHESTPLATE); - public static ItemWrapper DIAMOND_LEGGINGS = of(net.minecraft.item.Items.DIAMOND_LEGGINGS); - public static ItemWrapper DIAMOND_BOOTS = of(net.minecraft.item.Items.DIAMOND_BOOTS); - public static ItemWrapper GOLDEN_HELMET = of(net.minecraft.item.Items.GOLDEN_HELMET); - public static ItemWrapper GOLDEN_CHESTPLATE = of(net.minecraft.item.Items.GOLDEN_CHESTPLATE); - public static ItemWrapper GOLDEN_LEGGINGS = of(net.minecraft.item.Items.GOLDEN_LEGGINGS); - public static ItemWrapper GOLDEN_BOOTS = of(net.minecraft.item.Items.GOLDEN_BOOTS); - public static ItemWrapper NETHERITE_HELMET = of(net.minecraft.item.Items.NETHERITE_HELMET); - public static ItemWrapper NETHERITE_CHESTPLATE = of(net.minecraft.item.Items.NETHERITE_CHESTPLATE); - public static ItemWrapper NETHERITE_LEGGINGS = of(net.minecraft.item.Items.NETHERITE_LEGGINGS); - public static ItemWrapper NETHERITE_BOOTS = of(net.minecraft.item.Items.NETHERITE_BOOTS); - public static ItemWrapper FLINT = of(net.minecraft.item.Items.FLINT); - public static ItemWrapper PORKCHOP = of(net.minecraft.item.Items.PORKCHOP); - public static ItemWrapper COOKED_PORKCHOP = of(net.minecraft.item.Items.COOKED_PORKCHOP); - public static ItemWrapper PAINTING = of(net.minecraft.item.Items.PAINTING); - public static ItemWrapper GOLDEN_APPLE = of(net.minecraft.item.Items.GOLDEN_APPLE); - public static ItemWrapper ENCHANTED_GOLDEN_APPLE = of(net.minecraft.item.Items.ENCHANTED_GOLDEN_APPLE); - public static ItemWrapper OAK_SIGN = of(net.minecraft.item.Items.OAK_SIGN); - public static ItemWrapper SPRUCE_SIGN = of(net.minecraft.item.Items.SPRUCE_SIGN); - public static ItemWrapper BIRCH_SIGN = of(net.minecraft.item.Items.BIRCH_SIGN); - public static ItemWrapper JUNGLE_SIGN = of(net.minecraft.item.Items.JUNGLE_SIGN); - public static ItemWrapper ACACIA_SIGN = of(net.minecraft.item.Items.ACACIA_SIGN); - public static ItemWrapper DARK_OAK_SIGN = of(net.minecraft.item.Items.DARK_OAK_SIGN); - public static ItemWrapper CRIMSON_SIGN = of(net.minecraft.item.Items.CRIMSON_SIGN); - public static ItemWrapper WARPED_SIGN = of(net.minecraft.item.Items.WARPED_SIGN); - public static ItemWrapper BUCKET = of(net.minecraft.item.Items.BUCKET); - public static ItemWrapper WATER_BUCKET = of(net.minecraft.item.Items.WATER_BUCKET); - public static ItemWrapper LAVA_BUCKET = of(net.minecraft.item.Items.LAVA_BUCKET); - public static ItemWrapper MINECART = of(net.minecraft.item.Items.MINECART); - public static ItemWrapper SADDLE = of(net.minecraft.item.Items.SADDLE); - public static ItemWrapper REDSTONE = of(net.minecraft.item.Items.REDSTONE); - public static ItemWrapper SNOWBALL = of(net.minecraft.item.Items.SNOWBALL); - public static ItemWrapper OAK_BOAT = of(net.minecraft.item.Items.OAK_BOAT); - public static ItemWrapper LEATHER = of(net.minecraft.item.Items.LEATHER); - public static ItemWrapper MILK_BUCKET = of(net.minecraft.item.Items.MILK_BUCKET); - public static ItemWrapper PUFFERFISH_BUCKET = of(net.minecraft.item.Items.PUFFERFISH_BUCKET); - public static ItemWrapper SALMON_BUCKET = of(net.minecraft.item.Items.SALMON_BUCKET); - public static ItemWrapper COD_BUCKET = of(net.minecraft.item.Items.COD_BUCKET); - public static ItemWrapper TROPICAL_FISH_BUCKET = of(net.minecraft.item.Items.TROPICAL_FISH_BUCKET); - public static ItemWrapper BRICK = of(net.minecraft.item.Items.BRICK); - public static ItemWrapper CLAY_BALL = of(net.minecraft.item.Items.CLAY_BALL); - public static ItemWrapper DRIED_KELP_BLOCK = of(net.minecraft.item.Items.DRIED_KELP_BLOCK); - public static ItemWrapper PAPER = of(net.minecraft.item.Items.PAPER); - public static ItemWrapper BOOK = of(net.minecraft.item.Items.BOOK); - public static ItemWrapper SLIME_BALL = of(net.minecraft.item.Items.SLIME_BALL); - public static ItemWrapper CHEST_MINECART = of(net.minecraft.item.Items.CHEST_MINECART); - public static ItemWrapper FURNACE_MINECART = of(net.minecraft.item.Items.FURNACE_MINECART); - public static ItemWrapper EGG = of(net.minecraft.item.Items.EGG); - public static ItemWrapper COMPASS = of(net.minecraft.item.Items.COMPASS); - public static ItemWrapper FISHING_ROD = of(net.minecraft.item.Items.FISHING_ROD); - public static ItemWrapper CLOCK = of(net.minecraft.item.Items.CLOCK); - public static ItemWrapper GLOWSTONE_DUST = of(net.minecraft.item.Items.GLOWSTONE_DUST); - public static ItemWrapper COD = of(net.minecraft.item.Items.COD); - public static ItemWrapper SALMON = of(net.minecraft.item.Items.SALMON); - public static ItemWrapper TROPICAL_FISH = of(net.minecraft.item.Items.TROPICAL_FISH); - public static ItemWrapper PUFFERFISH = of(net.minecraft.item.Items.PUFFERFISH); - public static ItemWrapper COOKED_COD = of(net.minecraft.item.Items.COOKED_COD); - public static ItemWrapper COOKED_SALMON = of(net.minecraft.item.Items.COOKED_SALMON); - public static ItemWrapper INK_SAC = of(net.minecraft.item.Items.INK_SAC); - public static ItemWrapper COCOA_BEANS = of(net.minecraft.item.Items.COCOA_BEANS); - public static ItemWrapper LAPIS_LAZULI = of(net.minecraft.item.Items.LAPIS_LAZULI); - public static ItemWrapper WHITE_DYE = of(net.minecraft.item.Items.WHITE_DYE); - public static ItemWrapper ORANGE_DYE = of(net.minecraft.item.Items.ORANGE_DYE); - public static ItemWrapper MAGENTA_DYE = of(net.minecraft.item.Items.MAGENTA_DYE); - public static ItemWrapper LIGHT_BLUE_DYE = of(net.minecraft.item.Items.LIGHT_BLUE_DYE); - public static ItemWrapper YELLOW_DYE = of(net.minecraft.item.Items.YELLOW_DYE); - public static ItemWrapper LIME_DYE = of(net.minecraft.item.Items.LIME_DYE); - public static ItemWrapper PINK_DYE = of(net.minecraft.item.Items.PINK_DYE); - public static ItemWrapper GRAY_DYE = of(net.minecraft.item.Items.GRAY_DYE); - public static ItemWrapper LIGHT_GRAY_DYE = of(net.minecraft.item.Items.LIGHT_GRAY_DYE); - public static ItemWrapper CYAN_DYE = of(net.minecraft.item.Items.CYAN_DYE); - public static ItemWrapper PURPLE_DYE = of(net.minecraft.item.Items.PURPLE_DYE); - public static ItemWrapper BLUE_DYE = of(net.minecraft.item.Items.BLUE_DYE); - public static ItemWrapper BROWN_DYE = of(net.minecraft.item.Items.BROWN_DYE); - public static ItemWrapper GREEN_DYE = of(net.minecraft.item.Items.GREEN_DYE); - public static ItemWrapper RED_DYE = of(net.minecraft.item.Items.RED_DYE); - public static ItemWrapper BLACK_DYE = of(net.minecraft.item.Items.BLACK_DYE); - public static ItemWrapper BONE_MEAL = of(net.minecraft.item.Items.BONE_MEAL); - public static ItemWrapper BONE = of(net.minecraft.item.Items.BONE); - public static ItemWrapper SUGAR = of(net.minecraft.item.Items.SUGAR); - public static ItemWrapper CAKE = of(net.minecraft.item.Items.CAKE); - public static ItemWrapper WHITE_BED = of(net.minecraft.item.Items.WHITE_BED); - public static ItemWrapper ORANGE_BED = of(net.minecraft.item.Items.ORANGE_BED); - public static ItemWrapper MAGENTA_BED = of(net.minecraft.item.Items.MAGENTA_BED); - public static ItemWrapper LIGHT_BLUE_BED = of(net.minecraft.item.Items.LIGHT_BLUE_BED); - public static ItemWrapper YELLOW_BED = of(net.minecraft.item.Items.YELLOW_BED); - public static ItemWrapper LIME_BED = of(net.minecraft.item.Items.LIME_BED); - public static ItemWrapper PINK_BED = of(net.minecraft.item.Items.PINK_BED); - public static ItemWrapper GRAY_BED = of(net.minecraft.item.Items.GRAY_BED); - public static ItemWrapper LIGHT_GRAY_BED = of(net.minecraft.item.Items.LIGHT_GRAY_BED); - public static ItemWrapper CYAN_BED = of(net.minecraft.item.Items.CYAN_BED); - public static ItemWrapper PURPLE_BED = of(net.minecraft.item.Items.PURPLE_BED); - public static ItemWrapper BLUE_BED = of(net.minecraft.item.Items.BLUE_BED); - public static ItemWrapper BROWN_BED = of(net.minecraft.item.Items.BROWN_BED); - public static ItemWrapper GREEN_BED = of(net.minecraft.item.Items.GREEN_BED); - public static ItemWrapper RED_BED = of(net.minecraft.item.Items.RED_BED); - public static ItemWrapper BLACK_BED = of(net.minecraft.item.Items.BLACK_BED); - public static ItemWrapper COOKIE = of(net.minecraft.item.Items.COOKIE); - public static ItemWrapper FILLED_MAP = of(net.minecraft.item.Items.FILLED_MAP); - public static ItemWrapper SHEARS = of(net.minecraft.item.Items.SHEARS); - public static ItemWrapper MELON_SLICE = of(net.minecraft.item.Items.MELON_SLICE); - public static ItemWrapper DRIED_KELP = of(net.minecraft.item.Items.DRIED_KELP); - public static ItemWrapper PUMPKIN_SEEDS = of(net.minecraft.item.Items.PUMPKIN_SEEDS); - public static ItemWrapper MELON_SEEDS = of(net.minecraft.item.Items.MELON_SEEDS); - public static ItemWrapper BEEF = of(net.minecraft.item.Items.BEEF); - public static ItemWrapper COOKED_BEEF = of(net.minecraft.item.Items.COOKED_BEEF); - public static ItemWrapper CHICKEN = of(net.minecraft.item.Items.CHICKEN); - public static ItemWrapper COOKED_CHICKEN = of(net.minecraft.item.Items.COOKED_CHICKEN); - public static ItemWrapper ROTTEN_FLESH = of(net.minecraft.item.Items.ROTTEN_FLESH); - public static ItemWrapper ENDER_PEARL = of(net.minecraft.item.Items.ENDER_PEARL); - public static ItemWrapper BLAZE_ROD = of(net.minecraft.item.Items.BLAZE_ROD); - public static ItemWrapper GHAST_TEAR = of(net.minecraft.item.Items.GHAST_TEAR); - public static ItemWrapper GOLD_NUGGET = of(net.minecraft.item.Items.GOLD_NUGGET); - public static ItemWrapper NETHER_WART = of(net.minecraft.item.Items.NETHER_WART); - public static ItemWrapper POTION = of(net.minecraft.item.Items.POTION); - public static ItemWrapper GLASS_BOTTLE = of(net.minecraft.item.Items.GLASS_BOTTLE); - public static ItemWrapper SPIDER_EYE = of(net.minecraft.item.Items.SPIDER_EYE); - public static ItemWrapper FERMENTED_SPIDER_EYE = of(net.minecraft.item.Items.FERMENTED_SPIDER_EYE); - public static ItemWrapper BLAZE_POWDER = of(net.minecraft.item.Items.BLAZE_POWDER); - public static ItemWrapper MAGMA_CREAM = of(net.minecraft.item.Items.MAGMA_CREAM); - public static ItemWrapper BREWING_STAND = of(net.minecraft.item.Items.BREWING_STAND); - public static ItemWrapper CAULDRON = of(net.minecraft.item.Items.CAULDRON); - public static ItemWrapper ENDER_EYE = of(net.minecraft.item.Items.ENDER_EYE); - public static ItemWrapper GLISTERING_MELON_SLICE = of(net.minecraft.item.Items.GLISTERING_MELON_SLICE); - public static ItemWrapper BAT_SPAWN_EGG = of(net.minecraft.item.Items.BAT_SPAWN_EGG); - public static ItemWrapper BEE_SPAWN_EGG = of(net.minecraft.item.Items.BEE_SPAWN_EGG); - public static ItemWrapper BLAZE_SPAWN_EGG = of(net.minecraft.item.Items.BLAZE_SPAWN_EGG); - public static ItemWrapper CAT_SPAWN_EGG = of(net.minecraft.item.Items.CAT_SPAWN_EGG); - public static ItemWrapper CAVE_SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.CAVE_SPIDER_SPAWN_EGG); - public static ItemWrapper CHICKEN_SPAWN_EGG = of(net.minecraft.item.Items.CHICKEN_SPAWN_EGG); - public static ItemWrapper COD_SPAWN_EGG = of(net.minecraft.item.Items.COD_SPAWN_EGG); - public static ItemWrapper COW_SPAWN_EGG = of(net.minecraft.item.Items.COW_SPAWN_EGG); - public static ItemWrapper CREEPER_SPAWN_EGG = of(net.minecraft.item.Items.CREEPER_SPAWN_EGG); - public static ItemWrapper DOLPHIN_SPAWN_EGG = of(net.minecraft.item.Items.DOLPHIN_SPAWN_EGG); - public static ItemWrapper DONKEY_SPAWN_EGG = of(net.minecraft.item.Items.DONKEY_SPAWN_EGG); - public static ItemWrapper DROWNED_SPAWN_EGG = of(net.minecraft.item.Items.DROWNED_SPAWN_EGG); - public static ItemWrapper ELDER_GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.ELDER_GUARDIAN_SPAWN_EGG); - public static ItemWrapper ENDERMAN_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMAN_SPAWN_EGG); - public static ItemWrapper ENDERMITE_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMITE_SPAWN_EGG); - public static ItemWrapper EVOKER_SPAWN_EGG = of(net.minecraft.item.Items.EVOKER_SPAWN_EGG); - public static ItemWrapper FOX_SPAWN_EGG = of(net.minecraft.item.Items.FOX_SPAWN_EGG); - public static ItemWrapper GHAST_SPAWN_EGG = of(net.minecraft.item.Items.GHAST_SPAWN_EGG); - public static ItemWrapper GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.GUARDIAN_SPAWN_EGG); - public static ItemWrapper HOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.HOGLIN_SPAWN_EGG); - public static ItemWrapper HORSE_SPAWN_EGG = of(net.minecraft.item.Items.HORSE_SPAWN_EGG); - public static ItemWrapper HUSK_SPAWN_EGG = of(net.minecraft.item.Items.HUSK_SPAWN_EGG); - public static ItemWrapper LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.LLAMA_SPAWN_EGG); - public static ItemWrapper MAGMA_CUBE_SPAWN_EGG = of(net.minecraft.item.Items.MAGMA_CUBE_SPAWN_EGG); - public static ItemWrapper MOOSHROOM_SPAWN_EGG = of(net.minecraft.item.Items.MOOSHROOM_SPAWN_EGG); - public static ItemWrapper MULE_SPAWN_EGG = of(net.minecraft.item.Items.MULE_SPAWN_EGG); - public static ItemWrapper OCELOT_SPAWN_EGG = of(net.minecraft.item.Items.OCELOT_SPAWN_EGG); - public static ItemWrapper PANDA_SPAWN_EGG = of(net.minecraft.item.Items.PANDA_SPAWN_EGG); - public static ItemWrapper PARROT_SPAWN_EGG = of(net.minecraft.item.Items.PARROT_SPAWN_EGG); - public static ItemWrapper PHANTOM_SPAWN_EGG = of(net.minecraft.item.Items.PHANTOM_SPAWN_EGG); - public static ItemWrapper PIG_SPAWN_EGG = of(net.minecraft.item.Items.PIG_SPAWN_EGG); - public static ItemWrapper PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_SPAWN_EGG); - public static ItemWrapper PIGLIN_BRUTE_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_BRUTE_SPAWN_EGG); - public static ItemWrapper PILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.PILLAGER_SPAWN_EGG); - public static ItemWrapper POLAR_BEAR_SPAWN_EGG = of(net.minecraft.item.Items.POLAR_BEAR_SPAWN_EGG); - public static ItemWrapper PUFFERFISH_SPAWN_EGG = of(net.minecraft.item.Items.PUFFERFISH_SPAWN_EGG); - public static ItemWrapper RABBIT_SPAWN_EGG = of(net.minecraft.item.Items.RABBIT_SPAWN_EGG); - public static ItemWrapper RAVAGER_SPAWN_EGG = of(net.minecraft.item.Items.RAVAGER_SPAWN_EGG); - public static ItemWrapper SALMON_SPAWN_EGG = of(net.minecraft.item.Items.SALMON_SPAWN_EGG); - public static ItemWrapper SHEEP_SPAWN_EGG = of(net.minecraft.item.Items.SHEEP_SPAWN_EGG); - public static ItemWrapper SHULKER_SPAWN_EGG = of(net.minecraft.item.Items.SHULKER_SPAWN_EGG); - public static ItemWrapper SILVERFISH_SPAWN_EGG = of(net.minecraft.item.Items.SILVERFISH_SPAWN_EGG); - public static ItemWrapper SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_SPAWN_EGG); - public static ItemWrapper SKELETON_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_HORSE_SPAWN_EGG); - public static ItemWrapper SLIME_SPAWN_EGG = of(net.minecraft.item.Items.SLIME_SPAWN_EGG); - public static ItemWrapper SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.SPIDER_SPAWN_EGG); - public static ItemWrapper SQUID_SPAWN_EGG = of(net.minecraft.item.Items.SQUID_SPAWN_EGG); - public static ItemWrapper STRAY_SPAWN_EGG = of(net.minecraft.item.Items.STRAY_SPAWN_EGG); - public static ItemWrapper STRIDER_SPAWN_EGG = of(net.minecraft.item.Items.STRIDER_SPAWN_EGG); - public static ItemWrapper TRADER_LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.TRADER_LLAMA_SPAWN_EGG); - public static ItemWrapper TROPICAL_FISH_SPAWN_EGG = of(net.minecraft.item.Items.TROPICAL_FISH_SPAWN_EGG); - public static ItemWrapper TURTLE_SPAWN_EGG = of(net.minecraft.item.Items.TURTLE_SPAWN_EGG); - public static ItemWrapper VEX_SPAWN_EGG = of(net.minecraft.item.Items.VEX_SPAWN_EGG); - public static ItemWrapper VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.VILLAGER_SPAWN_EGG); - public static ItemWrapper VINDICATOR_SPAWN_EGG = of(net.minecraft.item.Items.VINDICATOR_SPAWN_EGG); - public static ItemWrapper WANDERING_TRADER_SPAWN_EGG = of(net.minecraft.item.Items.WANDERING_TRADER_SPAWN_EGG); - public static ItemWrapper WITCH_SPAWN_EGG = of(net.minecraft.item.Items.WITCH_SPAWN_EGG); - public static ItemWrapper WITHER_SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.WITHER_SKELETON_SPAWN_EGG); - public static ItemWrapper WOLF_SPAWN_EGG = of(net.minecraft.item.Items.WOLF_SPAWN_EGG); - public static ItemWrapper ZOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOGLIN_SPAWN_EGG); - public static ItemWrapper ZOMBIE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_SPAWN_EGG); - public static ItemWrapper ZOMBIE_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_HORSE_SPAWN_EGG); - public static ItemWrapper ZOMBIE_VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_VILLAGER_SPAWN_EGG); - public static ItemWrapper ZOMBIFIED_PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIFIED_PIGLIN_SPAWN_EGG); - public static ItemWrapper EXPERIENCE_BOTTLE = of(net.minecraft.item.Items.EXPERIENCE_BOTTLE); - public static ItemWrapper FIRE_CHARGE = of(net.minecraft.item.Items.FIRE_CHARGE); - public static ItemWrapper WRITABLE_BOOK = of(net.minecraft.item.Items.WRITABLE_BOOK); - public static ItemWrapper WRITTEN_BOOK = of(net.minecraft.item.Items.WRITTEN_BOOK); - public static ItemWrapper EMERALD = of(net.minecraft.item.Items.EMERALD); - public static ItemWrapper ITEM_FRAME = of(net.minecraft.item.Items.ITEM_FRAME); - public static ItemWrapper FLOWER_POT = of(net.minecraft.item.Items.FLOWER_POT); - public static ItemWrapper CARROT = of(net.minecraft.item.Items.CARROT); - public static ItemWrapper POTATO = of(net.minecraft.item.Items.POTATO); - public static ItemWrapper BAKED_POTATO = of(net.minecraft.item.Items.BAKED_POTATO); - public static ItemWrapper POISONOUS_POTATO = of(net.minecraft.item.Items.POISONOUS_POTATO); - public static ItemWrapper MAP = of(net.minecraft.item.Items.MAP); - public static ItemWrapper GOLDEN_CARROT = of(net.minecraft.item.Items.GOLDEN_CARROT); - public static ItemWrapper SKELETON_SKULL = of(net.minecraft.item.Items.SKELETON_SKULL); - public static ItemWrapper WITHER_SKELETON_SKULL = of(net.minecraft.item.Items.WITHER_SKELETON_SKULL); - public static ItemWrapper PLAYER_HEAD = of(net.minecraft.item.Items.PLAYER_HEAD); - public static ItemWrapper ZOMBIE_HEAD = of(net.minecraft.item.Items.ZOMBIE_HEAD); - public static ItemWrapper CREEPER_HEAD = of(net.minecraft.item.Items.CREEPER_HEAD); - public static ItemWrapper DRAGON_HEAD = of(net.minecraft.item.Items.DRAGON_HEAD); - public static ItemWrapper CARROT_ON_A_STICK = of(net.minecraft.item.Items.CARROT_ON_A_STICK); - public static ItemWrapper WARPED_FUNGUS_ON_A_STICK = of(net.minecraft.item.Items.WARPED_FUNGUS_ON_A_STICK); - public static ItemWrapper NETHER_STAR = of(net.minecraft.item.Items.NETHER_STAR); - public static ItemWrapper PUMPKIN_PIE = of(net.minecraft.item.Items.PUMPKIN_PIE); - public static ItemWrapper FIREWORK_ROCKET = of(net.minecraft.item.Items.FIREWORK_ROCKET); - public static ItemWrapper FIREWORK_STAR = of(net.minecraft.item.Items.FIREWORK_STAR); - public static ItemWrapper ENCHANTED_BOOK = of(net.minecraft.item.Items.ENCHANTED_BOOK); - public static ItemWrapper NETHER_BRICK = of(net.minecraft.item.Items.NETHER_BRICK); - public static ItemWrapper QUARTZ = of(net.minecraft.item.Items.QUARTZ); - public static ItemWrapper TNT_MINECART = of(net.minecraft.item.Items.TNT_MINECART); - public static ItemWrapper HOPPER_MINECART = of(net.minecraft.item.Items.HOPPER_MINECART); - public static ItemWrapper PRISMARINE_SHARD = of(net.minecraft.item.Items.PRISMARINE_SHARD); - public static ItemWrapper PRISMARINE_CRYSTALS = of(net.minecraft.item.Items.PRISMARINE_CRYSTALS); - public static ItemWrapper RABBIT = of(net.minecraft.item.Items.RABBIT); - public static ItemWrapper COOKED_RABBIT = of(net.minecraft.item.Items.COOKED_RABBIT); - public static ItemWrapper RABBIT_STEW = of(net.minecraft.item.Items.RABBIT_STEW); - public static ItemWrapper RABBIT_FOOT = of(net.minecraft.item.Items.RABBIT_FOOT); - public static ItemWrapper RABBIT_HIDE = of(net.minecraft.item.Items.RABBIT_HIDE); - public static ItemWrapper ARMOR_STAND = of(net.minecraft.item.Items.ARMOR_STAND); - public static ItemWrapper IRON_HORSE_ARMOR = of(net.minecraft.item.Items.IRON_HORSE_ARMOR); - public static ItemWrapper GOLDEN_HORSE_ARMOR = of(net.minecraft.item.Items.GOLDEN_HORSE_ARMOR); - public static ItemWrapper DIAMOND_HORSE_ARMOR = of(net.minecraft.item.Items.DIAMOND_HORSE_ARMOR); - public static ItemWrapper LEATHER_HORSE_ARMOR = of(net.minecraft.item.Items.LEATHER_HORSE_ARMOR); - public static ItemWrapper LEAD = of(net.minecraft.item.Items.LEAD); - public static ItemWrapper NAME_TAG = of(net.minecraft.item.Items.NAME_TAG); - public static ItemWrapper COMMAND_BLOCK_MINECART = of(net.minecraft.item.Items.COMMAND_BLOCK_MINECART); - public static ItemWrapper MUTTON = of(net.minecraft.item.Items.MUTTON); - public static ItemWrapper COOKED_MUTTON = of(net.minecraft.item.Items.COOKED_MUTTON); - public static ItemWrapper WHITE_BANNER = of(net.minecraft.item.Items.WHITE_BANNER); - public static ItemWrapper ORANGE_BANNER = of(net.minecraft.item.Items.ORANGE_BANNER); - public static ItemWrapper MAGENTA_BANNER = of(net.minecraft.item.Items.MAGENTA_BANNER); - public static ItemWrapper LIGHT_BLUE_BANNER = of(net.minecraft.item.Items.LIGHT_BLUE_BANNER); - public static ItemWrapper YELLOW_BANNER = of(net.minecraft.item.Items.YELLOW_BANNER); - public static ItemWrapper LIME_BANNER = of(net.minecraft.item.Items.LIME_BANNER); - public static ItemWrapper PINK_BANNER = of(net.minecraft.item.Items.PINK_BANNER); - public static ItemWrapper GRAY_BANNER = of(net.minecraft.item.Items.GRAY_BANNER); - public static ItemWrapper LIGHT_GRAY_BANNER = of(net.minecraft.item.Items.LIGHT_GRAY_BANNER); - public static ItemWrapper CYAN_BANNER = of(net.minecraft.item.Items.CYAN_BANNER); - public static ItemWrapper PURPLE_BANNER = of(net.minecraft.item.Items.PURPLE_BANNER); - public static ItemWrapper BLUE_BANNER = of(net.minecraft.item.Items.BLUE_BANNER); - public static ItemWrapper BROWN_BANNER = of(net.minecraft.item.Items.BROWN_BANNER); - public static ItemWrapper GREEN_BANNER = of(net.minecraft.item.Items.GREEN_BANNER); - public static ItemWrapper RED_BANNER = of(net.minecraft.item.Items.RED_BANNER); - public static ItemWrapper BLACK_BANNER = of(net.minecraft.item.Items.BLACK_BANNER); - public static ItemWrapper END_CRYSTAL = of(net.minecraft.item.Items.END_CRYSTAL); - public static ItemWrapper CHORUS_FRUIT = of(net.minecraft.item.Items.CHORUS_FRUIT); - public static ItemWrapper POPPED_CHORUS_FRUIT = of(net.minecraft.item.Items.POPPED_CHORUS_FRUIT); - public static ItemWrapper BEETROOT = of(net.minecraft.item.Items.BEETROOT); - public static ItemWrapper BEETROOT_SEEDS = of(net.minecraft.item.Items.BEETROOT_SEEDS); - public static ItemWrapper BEETROOT_SOUP = of(net.minecraft.item.Items.BEETROOT_SOUP); - public static ItemWrapper DRAGON_BREATH = of(net.minecraft.item.Items.DRAGON_BREATH); - public static ItemWrapper SPLASH_POTION = of(net.minecraft.item.Items.SPLASH_POTION); - public static ItemWrapper SPECTRAL_ARROW = of(net.minecraft.item.Items.SPECTRAL_ARROW); - public static ItemWrapper TIPPED_ARROW = of(net.minecraft.item.Items.TIPPED_ARROW); - public static ItemWrapper LINGERING_POTION = of(net.minecraft.item.Items.LINGERING_POTION); - public static ItemWrapper SHIELD = of(net.minecraft.item.Items.SHIELD); - public static ItemWrapper ELYTRA = of(net.minecraft.item.Items.ELYTRA); - public static ItemWrapper SPRUCE_BOAT = of(net.minecraft.item.Items.SPRUCE_BOAT); - public static ItemWrapper BIRCH_BOAT = of(net.minecraft.item.Items.BIRCH_BOAT); - public static ItemWrapper JUNGLE_BOAT = of(net.minecraft.item.Items.JUNGLE_BOAT); - public static ItemWrapper ACACIA_BOAT = of(net.minecraft.item.Items.ACACIA_BOAT); - public static ItemWrapper DARK_OAK_BOAT = of(net.minecraft.item.Items.DARK_OAK_BOAT); - public static ItemWrapper TOTEM_OF_UNDYING = of(net.minecraft.item.Items.TOTEM_OF_UNDYING); - public static ItemWrapper SHULKER_SHELL = of(net.minecraft.item.Items.SHULKER_SHELL); - public static ItemWrapper IRON_NUGGET = of(net.minecraft.item.Items.IRON_NUGGET); - public static ItemWrapper KNOWLEDGE_BOOK = of(net.minecraft.item.Items.KNOWLEDGE_BOOK); - public static ItemWrapper DEBUG_STICK = of(net.minecraft.item.Items.DEBUG_STICK); - public static ItemWrapper MUSIC_DISC_13 = of(net.minecraft.item.Items.MUSIC_DISC_13); - public static ItemWrapper MUSIC_DISC_CAT = of(net.minecraft.item.Items.MUSIC_DISC_CAT); - public static ItemWrapper MUSIC_DISC_BLOCKS = of(net.minecraft.item.Items.MUSIC_DISC_BLOCKS); - public static ItemWrapper MUSIC_DISC_CHIRP = of(net.minecraft.item.Items.MUSIC_DISC_CHIRP); - public static ItemWrapper MUSIC_DISC_FAR = of(net.minecraft.item.Items.MUSIC_DISC_FAR); - public static ItemWrapper MUSIC_DISC_MALL = of(net.minecraft.item.Items.MUSIC_DISC_MALL); - public static ItemWrapper MUSIC_DISC_MELLOHI = of(net.minecraft.item.Items.MUSIC_DISC_MELLOHI); - public static ItemWrapper MUSIC_DISC_STAL = of(net.minecraft.item.Items.MUSIC_DISC_STAL); - public static ItemWrapper MUSIC_DISC_STRAD = of(net.minecraft.item.Items.MUSIC_DISC_STRAD); - public static ItemWrapper MUSIC_DISC_WARD = of(net.minecraft.item.Items.MUSIC_DISC_WARD); - public static ItemWrapper MUSIC_DISC_11 = of(net.minecraft.item.Items.MUSIC_DISC_11); - public static ItemWrapper MUSIC_DISC_WAIT = of(net.minecraft.item.Items.MUSIC_DISC_WAIT); - public static ItemWrapper MUSIC_DISC_PIGSTEP = of(net.minecraft.item.Items.MUSIC_DISC_PIGSTEP); - public static ItemWrapper TRIDENT = of(net.minecraft.item.Items.TRIDENT); - public static ItemWrapper PHANTOM_MEMBRANE = of(net.minecraft.item.Items.PHANTOM_MEMBRANE); - public static ItemWrapper NAUTILUS_SHELL = of(net.minecraft.item.Items.NAUTILUS_SHELL); - public static ItemWrapper HEART_OF_THE_SEA = of(net.minecraft.item.Items.HEART_OF_THE_SEA); - public static ItemWrapper CROSSBOW = of(net.minecraft.item.Items.CROSSBOW); - public static ItemWrapper SUSPICIOUS_STEW = of(net.minecraft.item.Items.SUSPICIOUS_STEW); - public static ItemWrapper LOOM = of(net.minecraft.item.Items.LOOM); - public static ItemWrapper FLOWER_BANNER_PATTERN = of(net.minecraft.item.Items.FLOWER_BANNER_PATTERN); - public static ItemWrapper CREEPER_BANNER_PATTERN = of(net.minecraft.item.Items.CREEPER_BANNER_PATTERN); - public static ItemWrapper SKULL_BANNER_PATTERN = of(net.minecraft.item.Items.SKULL_BANNER_PATTERN); - public static ItemWrapper MOJANG_BANNER_PATTERN = of(net.minecraft.item.Items.MOJANG_BANNER_PATTERN); - public static ItemWrapper GLOBE_BANNER_PATTERN = of(net.minecraft.item.Items.GLOBE_BANNER_PATTERN); - public static ItemWrapper PIGLIN_BANNER_PATTERN = of(net.minecraft.item.Items.PIGLIN_BANNER_PATTERN); - public static ItemWrapper COMPOSTER = of(net.minecraft.item.Items.COMPOSTER); - public static ItemWrapper BARREL = of(net.minecraft.item.Items.BARREL); - public static ItemWrapper SMOKER = of(net.minecraft.item.Items.SMOKER); - public static ItemWrapper BLAST_FURNACE = of(net.minecraft.item.Items.BLAST_FURNACE); - public static ItemWrapper CARTOGRAPHY_TABLE = of(net.minecraft.item.Items.CARTOGRAPHY_TABLE); - public static ItemWrapper FLETCHING_TABLE = of(net.minecraft.item.Items.FLETCHING_TABLE); - public static ItemWrapper GRINDSTONE = of(net.minecraft.item.Items.GRINDSTONE); - public static ItemWrapper LECTERN = of(net.minecraft.item.Items.LECTERN); - public static ItemWrapper SMITHING_TABLE = of(net.minecraft.item.Items.SMITHING_TABLE); - public static ItemWrapper STONECUTTER = of(net.minecraft.item.Items.STONECUTTER); - public static ItemWrapper BELL = of(net.minecraft.item.Items.BELL); - public static ItemWrapper LANTERN = of(net.minecraft.item.Items.LANTERN); - public static ItemWrapper SOUL_LANTERN = of(net.minecraft.item.Items.SOUL_LANTERN); - public static ItemWrapper SWEET_BERRIES = of(net.minecraft.item.Items.SWEET_BERRIES); - public static ItemWrapper CAMPFIRE = of(net.minecraft.item.Items.CAMPFIRE); - public static ItemWrapper SOUL_CAMPFIRE = of(net.minecraft.item.Items.SOUL_CAMPFIRE); - public static ItemWrapper SHROOMLIGHT = of(net.minecraft.item.Items.SHROOMLIGHT); - public static ItemWrapper HONEYCOMB = of(net.minecraft.item.Items.HONEYCOMB); - public static ItemWrapper BEE_NEST = of(net.minecraft.item.Items.BEE_NEST); - public static ItemWrapper BEEHIVE = of(net.minecraft.item.Items.BEEHIVE); - public static ItemWrapper HONEY_BOTTLE = of(net.minecraft.item.Items.HONEY_BOTTLE); - public static ItemWrapper HONEY_BLOCK = of(net.minecraft.item.Items.HONEY_BLOCK); - public static ItemWrapper HONEYCOMB_BLOCK = of(net.minecraft.item.Items.HONEYCOMB_BLOCK); - public static ItemWrapper LODESTONE = of(net.minecraft.item.Items.LODESTONE); - public static ItemWrapper NETHERITE_BLOCK = of(net.minecraft.item.Items.NETHERITE_BLOCK); - public static ItemWrapper ANCIENT_DEBRIS = of(net.minecraft.item.Items.ANCIENT_DEBRIS); - public static ItemWrapper TARGET = of(net.minecraft.item.Items.TARGET); - public static ItemWrapper CRYING_OBSIDIAN = of(net.minecraft.item.Items.CRYING_OBSIDIAN); - public static ItemWrapper BLACKSTONE = of(net.minecraft.item.Items.BLACKSTONE); - public static ItemWrapper BLACKSTONE_SLAB = of(net.minecraft.item.Items.BLACKSTONE_SLAB); - public static ItemWrapper BLACKSTONE_STAIRS = of(net.minecraft.item.Items.BLACKSTONE_STAIRS); - public static ItemWrapper GILDED_BLACKSTONE = of(net.minecraft.item.Items.GILDED_BLACKSTONE); - public static ItemWrapper POLISHED_BLACKSTONE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE); - public static ItemWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_SLAB); - public static ItemWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_STAIRS); - public static ItemWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.item.Items.CHISELED_POLISHED_BLACKSTONE); - public static ItemWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICKS); - public static ItemWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_SLAB); - public static ItemWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_STAIRS); - public static ItemWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.CRACKED_POLISHED_BLACKSTONE_BRICKS); - public static ItemWrapper RESPAWN_ANCHOR = of(net.minecraft.item.Items.RESPAWN_ANCHOR); - - public static ItemWrapper of(net.minecraft.item.Item item) { - return ItemWrapper.of(item); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java deleted file mode 100644 index c39629242..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.item; - -import net.minecraft.item.Item; - -import java.util.function.Supplier; - -public class SupplierItemWrapper extends ItemWrapper { - private final Supplier supplier; - - protected SupplierItemWrapper(Supplier supplier) { - this.supplier = supplier; - } - - public static SupplierItemWrapper of(Supplier supplier) { - return new SupplierItemWrapper(supplier); - } - - @Override - public Item get() { - return supplier.get(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java deleted file mode 100644 index d92a636ac..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.nbt; - -public interface ElementConvertible { - NbtElement toElement(); - - default net.minecraft.nbt.NbtElement toMinecraftNbtElement() { - return toElement().toMinecraft(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java deleted file mode 100644 index 38dff8af8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java +++ /dev/null @@ -1,155 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.nbt; - -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.NbtUtil; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; - -import java.util.Optional; -import java.util.UUID; - -@SuppressWarnings("deprecation") -public class NbtCompound implements ElementConvertible { - protected final net.minecraft.nbt.NbtCompound nbt; - - protected NbtCompound(net.minecraft.nbt.NbtCompound nbt) { - this.nbt = nbt; - } - - public static NbtCompound of(net.minecraft.nbt.NbtCompound nbt) { - return new NbtCompound(nbt); - } - - public static NbtCompound of() { - return new NbtCompound(NbtUtil.create()); - } - - public NbtCompound copy() { - return new NbtCompound(NbtUtil.copy(nbt)); - } - - public boolean has(String key) { - return NbtUtil.has(nbt, key); - } - - public void putByte(String key, byte value) { - NbtUtil.putByte(nbt, key, value); - } - - public byte getByte(String key) { - return NbtUtil.getByte(nbt, key); - } - - public void putShort(String key, short value) { - NbtUtil.putShort(nbt, key, value); - } - - public short getShort(String key) { - return NbtUtil.getShort(nbt, key); - } - - public void putInt(String key, int value) { - NbtUtil.putInt(nbt, key, value); - } - - public int getInt(String key) { - return NbtUtil.getInt(nbt, key); - } - - public void putLong(String key, long value) { - NbtUtil.putLong(nbt, key, value); - } - - public long getLong(String key) { - return NbtUtil.getLong(nbt, key); - } - - public void putFloat(String key, float value) { - NbtUtil.putFloat(nbt, key, value); - } - - public float getFloat(String key) { - return NbtUtil.getFloat(nbt, key); - } - - public void putDouble(String key, double value) { - NbtUtil.putDouble(nbt, key, value); - } - - public double getDouble(String key) { - return NbtUtil.getDouble(nbt, key); - } - - public void putString(String key, String value) { - NbtUtil.putString(nbt, key, value); - } - - public String getString(String key) { - return NbtUtil.getString(nbt, key); - } - - public void putBoolean(String key, boolean value) { - NbtUtil.putBoolean(nbt, key, value); - } - - public boolean getBoolean(String key) { - return NbtUtil.getBoolean(nbt, key); - } - - public void putUuid(String key, UUID value) { - NbtUtil.putUuid(nbt, key, value); - } - - public UUID getUuid(String key) { - return NbtUtil.getUuid(nbt, key); - } - - public void putItemStack(String key, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, CompatRegistryLookup registryLookup) { - NbtUtil.putItemStack(nbt, key, stack.toMinecraft(), registryLookup); - } - - public net.pitan76.mcpitanlib.midohra.item.ItemStack getItemStack(String key, CompatRegistryLookup registryLookup) { - return ItemStack.of(NbtUtil.getItemStack(nbt, key, registryLookup).get()); - } - - public void put(String key, NbtCompound compound) { - NbtUtil.put(nbt, key, compound.nbt); - } - - public void put(String key, net.minecraft.nbt.NbtCompound nbt) { - NbtUtil.put(this.nbt, key, nbt); - } - - public void put(String key, ElementConvertible element) { - NbtUtil.put(nbt, key, element.toMinecraftNbtElement()); - } - - public NbtCompound getCompound(String key) { - return new NbtCompound(NbtUtil.get(nbt, key)); - } - - public NbtElement get(String key) { - return NbtElement.of(NbtUtil.getElement(nbt, key)); - } - - public net.minecraft.nbt.NbtCompound toMinecraft() { - return nbt; - } - - @Override - public String toString() { - return nbt.toString(); - } - - @Override - public NbtElement toElement() { - return NbtElement.of(nbt); - } - - public void putSimpleItemStack(String key, ItemStack stack) { - NbtUtil.putSimpleItemStack(nbt, key, stack.toMinecraft()); - } - - public Optional getSimpleItemStack(String key) { - return NbtUtil.getSimpleItemStack(nbt, key).map(ItemStack::of); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java deleted file mode 100644 index b6ba2c5a3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java +++ /dev/null @@ -1,49 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.nbt; - -import net.minecraft.nbt.NbtType; - -public class NbtElement implements ElementConvertible { - protected final net.minecraft.nbt.NbtElement nbt; - - protected NbtElement(net.minecraft.nbt.NbtElement nbt) { - this.nbt = nbt; - } - - public static NbtElement of(net.minecraft.nbt.NbtElement nbt) { - return new NbtElement(nbt); - } - - public NbtElement copy() { - return new NbtElement(nbt.copy()); - } - - public byte getType() { - return nbt.getType(); - } - - public NbtType getNbtType() { - return nbt.getNbtType(); - } - - public int getSizeInBytes() { - return nbt.getSizeInBytes(); - } - - @Override - public String toString() { - return nbt.toString(); - } - - public net.minecraft.nbt.NbtElement toMinecraft() { - return nbt; - } - - @Override - public NbtElement toElement() { - return this; - } - - public String asString() { - return nbt.asString().orElse(""); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java deleted file mode 100644 index 00757eb4c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java +++ /dev/null @@ -1,110 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.nbt; - -import java.util.AbstractList; -import java.util.Optional; - -@SuppressWarnings("deprecation") -public class NbtList extends AbstractList implements ElementConvertible { - protected final net.minecraft.nbt.NbtList nbtList; - - protected NbtList(net.minecraft.nbt.NbtList nbtList) { - this.nbtList = nbtList; - } - - public static NbtList of(net.minecraft.nbt.NbtList nbtList) { - return new NbtList(nbtList); - } - - public static Optional ofOptional(NbtElement nbtElement) { - if (nbtElement.toMinecraft() instanceof net.minecraft.nbt.NbtList) - return Optional.of(new NbtList((net.minecraft.nbt.NbtList) nbtElement.toMinecraft())); - - return Optional.empty(); - } - - public NbtList copy() { - return new NbtList(nbtList.copy()); - } - - @Override - public int size() { - return nbtList.size(); - } - - public byte getType() { - return nbtList.getType(); - } - - @Override - public NbtElement get(int index) { - return NbtElement.of(nbtList.get(index)); - } - - public boolean add(net.minecraft.nbt.NbtElement nbtElement) { - return nbtList.add(nbtElement); - } - - @Override - public boolean add(NbtElement nbtElement) { - return add(nbtElement.toMinecraft()); - } - - public void add(int index, net.minecraft.nbt.NbtElement nbtElement) { - nbtList.add(index, nbtElement); - } - - @Override - public void add(int index, NbtElement nbtElement) { - add(index, nbtElement.toMinecraft()); - } - - @Override - public NbtElement set(int index, NbtElement element) { - return NbtElement.of(nbtList.set(index, element.toMinecraft())); - } - - @Override - public NbtElement remove(int index) { - return NbtElement.of(nbtList.remove(index)); - } - - @Override - public boolean isEmpty() { - return nbtList.isEmpty(); - } - - @Override - public void clear() { - nbtList.clear(); - } - - public String asString() { - return nbtList.asString().orElse(""); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - - return o instanceof NbtList && nbtList.equals(((NbtList) o).nbtList); - } - - @Override - public int hashCode() { - return nbtList.hashCode(); - } - - @Override - public String toString() { - return nbtList.toString(); - } - - public net.minecraft.nbt.NbtList toMinecraft() { - return nbtList; - } - - @Override - public NbtElement toElement() { - return NbtElement.of(nbtList); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java deleted file mode 100644 index c2c5566fe..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java +++ /dev/null @@ -1,116 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.network; - -import net.minecraft.network.PacketByteBuf; -import net.pitan76.mcpitanlib.api.network.PacketByteUtil; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; - -public class CompatPacketByteBuf extends PacketByteBuf { - public CompatPacketByteBuf(PacketByteBuf buf) { - super(buf); - } - - public CompatPacketByteBuf() { - super(PacketByteUtil.create()); - } - - public static CompatPacketByteBuf create() { - return new CompatPacketByteBuf(); - } - - public static CompatPacketByteBuf of(PacketByteBuf buf) { - return new CompatPacketByteBuf(buf); - } - - public PacketByteBuf getRaw() { - return this; - } - - public CompatPacketByteBuf writeInt(int value) { - super.writeInt(value); - return this; - } - - public int readInt() { - return super.readInt(); - } - - public CompatPacketByteBuf writeLong(long value) { - super.writeLong(value); - return this; - } - - public long readLong() { - return super.readLong(); - } - - public CompatPacketByteBuf writeBoolean(boolean value) { - super.writeBoolean(value); - return this; - } - - public boolean readBoolean() { - return super.readBoolean(); - } - - public CompatPacketByteBuf writeFloat(float value) { - super.writeFloat(value); - return this; - } - - public float readFloat() { - return super.readFloat(); - } - - public CompatPacketByteBuf writeDouble(double value) { - super.writeDouble(value); - return this; - } - - public double readDouble() { - return super.readDouble(); - } - - public CompatPacketByteBuf writeShort(short value) { - super.writeShort(value); - return this; - } - - public short readShort() { - return super.readShort(); - } - - public CompatPacketByteBuf writeByteArray(byte[] array) { - super.writeByteArray(array); - return this; - } - - public byte[] readByteArray() { - return super.readByteArray(); - } - - public CompatPacketByteBuf writeString(String string) { - super.writeString(string); - return this; - } - - public String readString() { - return super.readString(); - } - - public CompatPacketByteBuf writeBlockPos(net.minecraft.util.math.BlockPos pos) { - super.writeBlockPos(pos); - return this; - } - - public net.minecraft.util.math.BlockPos readBlockPos() { - return super.readBlockPos(); - } - - public CompatPacketByteBuf writeBlockPos(BlockPos pos) { - return writeBlockPos(pos.toMinecraft()); - } - - public BlockPos readBlockPosMidohra() { - return BlockPos.of(readBlockPos()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java deleted file mode 100644 index 65546224f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java +++ /dev/null @@ -1,74 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -import net.minecraft.recipe.book.CraftingRecipeCategory; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; -import net.pitan76.mcpitanlib.midohra.world.World; - -public class CraftingRecipe extends Recipe { - private final net.minecraft.recipe.CraftingRecipe recipe; - - protected CraftingRecipe(net.minecraft.recipe.CraftingRecipe recipe) { - super(null); - this.recipe = recipe; - } - - public static CraftingRecipe of(net.minecraft.recipe.CraftingRecipe recipe) { - return new CraftingRecipe(recipe); - } - - public net.minecraft.recipe.CraftingRecipe getRaw() { - return recipe; - } - - public net.minecraft.recipe.CraftingRecipe toMinecraft() { - return getRaw(); - } - - public CraftingRecipeCategory getRawCategory() { - return getRaw().getCategory(); - } - - public boolean matches(CraftingRecipeInputOrInventory input, World world) { - return getRaw().matches(input.getRaw(), world.getRaw()); - } - - public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, World world) { - return getRaw().craft(input.getRaw(), world.getRaw().getRegistryManager()); - } - - public ItemStack craftMidohra(CraftingRecipeInputOrInventory input, World world) { - return ItemStack.of(craft(input, world)); - } - - public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, CompatRegistryLookup registryLookup) { - return getRaw().craft(input.getRaw(), registryLookup.getRegistryLookup()); - } - - public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, net.minecraft.world.World world) { - return getRaw().craft(input.getRaw(), world.getRegistryManager()); - } - - public DefaultedList getRecipeRemaindersDefaultedList(CraftingRecipeInputOrInventory input) { - return getRaw().getRecipeRemainders(input.getRaw()); - } - - public ItemStackList getRecipeRemainders(CraftingRecipeInputOrInventory input) { - return ItemStackList.of(getRecipeRemaindersDefaultedList(input)); - } - - public net.minecraft.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, net.minecraft.world.World world) { - return craft(input, world); - } - - public net.minecraft.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, World world) { - return getOutput(input, world.getRaw()); - } - - public ItemStack getOutputMidohra(CraftingRecipeInputOrInventory input, World world) { - return ItemStack.of(getOutput(input, world)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java deleted file mode 100644 index 9b72bb7f5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java +++ /dev/null @@ -1,95 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -import net.minecraft.item.Item; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.IngredientUtil; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; - -import java.util.ArrayList; -import java.util.List; - -public class Ingredient { - private final net.minecraft.recipe.Ingredient ingredient; - - protected Ingredient(net.minecraft.recipe.Ingredient ingredient) { - this.ingredient = ingredient; - } - - public static Ingredient of(net.minecraft.recipe.Ingredient ingredient) { - return new Ingredient(ingredient); - } - - public static Ingredient ofItems(Item... items) { - return of(net.minecraft.recipe.Ingredient.ofItems(items)); - } - - public static Ingredient ofItem(Item items) { - return of(net.minecraft.recipe.Ingredient.ofItem(items)); - } - - public static Ingredient fromTagById(CompatIdentifier id) { - return of(IngredientUtil.fromTagByIdentifier(id)); - } - - public static Ingredient fromTagByString(String id) { - return of(IngredientUtil.fromTagByString(id)); - } - - public net.minecraft.recipe.Ingredient getRaw() { - return ingredient; - } - - public net.minecraft.recipe.Ingredient toMinecraft() { - return getRaw(); - } - - public boolean test(net.minecraft.item.ItemStack stack) { - return ingredient.test(stack); - } - - public boolean equals(Ingredient other) { - return ingredient.equals(other.getRaw()); - } - - public List getMatchingItems() { - return IngredientUtil.getItems(ingredient); - } - - public it.unimi.dsi.fastutil.ints.IntList getMatchingStacksIds() { - return IngredientUtil.getMatchingStacksIds(ingredient); - } - - public List getMatchingStacksAsList() { - return IngredientUtil.getMatchingStacksAsList(ingredient); - } - - public net.minecraft.item.ItemStack[] getMatchingStacks() { - return IngredientUtil.getMatchingStacks(ingredient); - } - - public List getMatchingItemWrappers() { - List wrappers = new ArrayList<>(); - - for (Item item : getMatchingItems()) { - wrappers.add(ItemWrapper.of(item)); - } - - return wrappers; - } - - public List getMatchingStacksAsMidohraList() { - List stacks = new ArrayList<>(); - - for (net.minecraft.item.ItemStack stack : getMatchingStacksAsList()) { - stacks.add(ItemStack.of(stack)); - } - - return stacks; - } - - public ItemStack[] getMatchingStacksAsMidohra() { - List stacks = getMatchingStacksAsMidohraList(); - return stacks.toArray(new ItemStack[0]); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java deleted file mode 100644 index f840f157b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java +++ /dev/null @@ -1,91 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.input.RecipeInput; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import net.pitan76.mcpitanlib.midohra.recipe.input.RecipeInputOrInventory; -import net.pitan76.mcpitanlib.midohra.recipe.input.TypedRecipeInputOrInventory; -import net.pitan76.mcpitanlib.midohra.world.World; - -import java.util.List; - -public class Recipe { - private final net.minecraft.recipe.Recipe recipe; - - protected Recipe(net.minecraft.recipe.Recipe recipe) { - this.recipe = recipe; - } - - public static Recipe of(net.minecraft.recipe.Recipe recipe) { - return new Recipe(recipe); - } - - public static CraftingRecipe of(net.minecraft.recipe.CraftingRecipe recipe) { - return new CraftingRecipe(recipe); - } - - public static ShapedRecipe of(net.minecraft.recipe.ShapedRecipe recipe) { - return new ShapedRecipe(recipe); - } - - public static ShapelessRecipe of(net.minecraft.recipe.ShapelessRecipe recipe) { - return new ShapelessRecipe(recipe); - } - - public net.minecraft.recipe.Recipe getRaw() { - return recipe; - } - - public net.minecraft.recipe.Recipe toMinecraft() { - return getRaw(); - } - - public RecipeSerializer getRawSerializer() { - return recipe.getSerializer(); - } - - public boolean matches(RecipeInputOrInventory input, World world) { - if (input instanceof TypedRecipeInputOrInventory) { - return matches((TypedRecipeInputOrInventory) input, world); - } - - return false; - } - - public net.minecraft.item.ItemStack craft(RecipeInputOrInventory input, World world) { - if (input instanceof TypedRecipeInputOrInventory) { - return craft((TypedRecipeInputOrInventory) input, world); - } - - return net.minecraft.item.ItemStack.EMPTY; - } - - public ItemStack craftMidohra(RecipeInputOrInventory input, World world) { - return ItemStack.of(craft(input, world)); - } - - public boolean matches(TypedRecipeInputOrInventory input, World world) { - return ((net.minecraft.recipe.Recipe)getRaw()).matches(input.getRecipeInput(), world.getRaw()); - } - - public net.minecraft.item.ItemStack craft(TypedRecipeInputOrInventory input, World world) { - return ((net.minecraft.recipe.Recipe)getRaw()).craft(input.getRecipeInput(), world.getRaw().getRegistryManager()); - } - - public ItemStack craftMidohra(TypedRecipeInputOrInventory input, World world) { - return ItemStack.of(craft(input, world)); - } - - public String getGroup() { - return getRaw().getGroup(); - } - - public RecipeType getType() { - return RecipeType.of(getRaw().getType()); - } - - public List getInputs() { - return getRaw().getIngredientPlacement().getIngredients(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java deleted file mode 100644 index 5b039fe10..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -public class RecipeManager { - private final net.minecraft.recipe.RecipeManager recipeManager; - - protected RecipeManager(net.minecraft.recipe.RecipeManager recipeManager) { - this.recipeManager = recipeManager; - } - - public static RecipeManager of(net.minecraft.recipe.RecipeManager recipeManager) { - return new RecipeManager(recipeManager); - } - - public net.minecraft.recipe.RecipeManager getRaw() { - return recipeManager; - } - - public net.minecraft.recipe.RecipeManager toMinecraft() { - return getRaw(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java deleted file mode 100644 index d8348bab6..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -import net.minecraft.registry.Registries; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class RecipeType { - private final net.minecraft.recipe.RecipeType recipeType; - - public static final RecipeType CRAFTING = new RecipeType(net.minecraft.recipe.RecipeType.CRAFTING); - public static final RecipeType SMELTING = new RecipeType(net.minecraft.recipe.RecipeType.SMELTING); - public static final RecipeType BLASTING = new RecipeType(net.minecraft.recipe.RecipeType.BLASTING); - public static final RecipeType SMOKING = new RecipeType(net.minecraft.recipe.RecipeType.SMOKING); - public static final RecipeType CAMPFIRE_COOKING = new RecipeType(net.minecraft.recipe.RecipeType.CAMPFIRE_COOKING); - public static final RecipeType STONECUTTING = new RecipeType(net.minecraft.recipe.RecipeType.STONECUTTING); - public static final RecipeType SMITHING = new RecipeType(net.minecraft.recipe.RecipeType.SMITHING); - - protected RecipeType(net.minecraft.recipe.RecipeType recipeType) { - this.recipeType = recipeType; - } - - public static RecipeType of(net.minecraft.recipe.RecipeType recipeType) { - if (recipeType == net.minecraft.recipe.RecipeType.CRAFTING) { - return CRAFTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.SMELTING) { - return SMELTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.BLASTING) { - return BLASTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.SMOKING) { - return SMOKING; - } else if (recipeType == net.minecraft.recipe.RecipeType.CAMPFIRE_COOKING) { - return CAMPFIRE_COOKING; - } else if (recipeType == net.minecraft.recipe.RecipeType.STONECUTTING) { - return STONECUTTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.SMITHING) { - return SMITHING; - } - - return new RecipeType(recipeType); - } - - public static RecipeType of(CompatIdentifier id) { - return of(Registries.RECIPE_TYPE.get(id.toMinecraft())); - } - - public net.minecraft.recipe.RecipeType getRaw() { - return recipeType; - } - - public net.minecraft.recipe.RecipeType toMinecraft() { - return getRaw(); - } - - public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(Registries.RECIPE_TYPE.getId(recipeType)); - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java deleted file mode 100644 index 29ebedd43..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java +++ /dev/null @@ -1,157 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -import net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry; -import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; -import net.pitan76.mcpitanlib.midohra.recipe.entry.ShapedRecipeEntry; -import net.pitan76.mcpitanlib.midohra.recipe.entry.ShapelessRecipeEntry; -import net.pitan76.mcpitanlib.midohra.world.ServerWorld; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class ServerRecipeManager extends RecipeManager { - private net.minecraft.recipe.ServerRecipeManager serverRecipeManager; - - protected ServerRecipeManager(net.minecraft.recipe.ServerRecipeManager serverRecipeManager) { - super(null); - this.serverRecipeManager = serverRecipeManager; - } - - public static ServerRecipeManager of(net.minecraft.recipe.ServerRecipeManager serverRecipeManager) { - return new ServerRecipeManager(serverRecipeManager); - } - - public static ServerRecipeManager of(net.minecraft.server.world.ServerWorld world) { - return of(world.getRecipeManager()); - } - - public static ServerRecipeManager of(ServerWorld world) { - return of(world.getRaw()); - } - - @Override - public net.minecraft.recipe.ServerRecipeManager getRaw() { - return serverRecipeManager; - } - - @Override - public net.minecraft.recipe.ServerRecipeManager toMinecraft() { - return getRaw(); - } - - @Deprecated - public Collection> getRawRecipes() { - return serverRecipeManager.values(); - } - - public Collection getRecipeEntries() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - recipes.add(RecipeEntry.of(recipe)); - } - - return recipes; - } - - public Collection getCraftingRecipeEntries() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.CraftingRecipe) { - recipes.add(CraftingRecipeEntry.of(recipe)); - } - } - - return recipes; - } - - public Collection getShapelessRecipeEntries() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { - recipes.add(ShapelessRecipeEntry.of(recipe)); - } - } - - return recipes; - } - - public Collection getShapedRecipeEntries() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { - recipes.add(ShapedRecipeEntry.of(recipe)); - } - } - - return recipes; - } - - public Collection getNormalRecipeEntries() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { - recipes.add(ShapelessRecipeEntry.of(recipe)); - } else if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { - recipes.add(ShapedRecipeEntry.of(recipe)); - } - } - - return recipes; - } - - public Collection getRecipes() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - recipes.add(Recipe.of(recipe.value())); - } - - return recipes; - } - - public Collection getCraftingRecipes() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.CraftingRecipe) { - recipes.add(CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) recipe.value())); - } - } - - return recipes; - } - - public Collection getShapelessRecipes() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { - recipes.add(ShapelessRecipe.of((net.minecraft.recipe.ShapelessRecipe) recipe.value())); - } - } - - return recipes; - } - - public Collection getShapedRecipes() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { - recipes.add(ShapedRecipe.of((net.minecraft.recipe.ShapedRecipe) recipe.value())); - } - } - - return recipes; - } - - public Collection getNormalRecipes() { - List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { - recipes.add(ShapelessRecipe.of((net.minecraft.recipe.ShapelessRecipe) recipe.value())); - } else if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { - recipes.add(ShapedRecipe.of((net.minecraft.recipe.ShapedRecipe) recipe.value())); - } - } - - return recipes; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java deleted file mode 100644 index 3d75164fe..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; - -public class ShapedRecipe extends CraftingRecipe { - private final net.minecraft.recipe.ShapedRecipe recipe; - - protected ShapedRecipe(net.minecraft.recipe.ShapedRecipe recipe) { - super(null); - this.recipe = recipe; - } - - public static ShapedRecipe of(net.minecraft.recipe.ShapedRecipe recipe) { - return new ShapedRecipe(recipe); - } - - public net.minecraft.recipe.ShapedRecipe getRaw() { - return recipe; - } - - public net.minecraft.recipe.ShapedRecipe toMinecraft() { - return getRaw(); - } - - public boolean matches(CraftingRecipeInputOrInventory input) { - return getRaw().matches(input.getRaw(), null); - } - - @Deprecated - public net.minecraft.item.ItemStack craft() { - return getRaw().craft(null, null); - } - - public net.minecraft.item.ItemStack craft(CompatRegistryLookup registryLookup) { - return getRaw().craft(null, registryLookup.getRegistryLookup()); - } - - public net.minecraft.item.ItemStack craft(World world) { - return getRaw().craft(null, world.getRegistryManager()); - } - - public net.minecraft.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { - return craft(world.getRaw()); - } - - public ItemStack craftMidohra() { - return ItemStack.of(craft()); - } - - public int getWidth() { - return getRaw().getWidth(); - } - - public int getHeight() { - return getRaw().getHeight(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java deleted file mode 100644 index 26d28b05b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe; - -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; - -public class ShapelessRecipe extends CraftingRecipe { - private final net.minecraft.recipe.ShapelessRecipe recipe; - - protected ShapelessRecipe(net.minecraft.recipe.ShapelessRecipe recipe) { - super(null); - this.recipe = recipe; - } - - public static ShapelessRecipe of(net.minecraft.recipe.ShapelessRecipe recipe) { - return new ShapelessRecipe(recipe); - } - - public net.minecraft.recipe.ShapelessRecipe getRaw() { - return recipe; - } - - public net.minecraft.recipe.ShapelessRecipe toMinecraft() { - return getRaw(); - } - - public boolean matches(CraftingRecipeInputOrInventory input) { - return getRaw().matches(input.getRaw(), null); - } - - @Deprecated - public net.minecraft.item.ItemStack craft() { - return getRaw().craft(null, null); - } - - public net.minecraft.item.ItemStack craft(CompatRegistryLookup registryLookup) { - return getRaw().craft(null, registryLookup.getRegistryLookup()); - } - - public net.minecraft.item.ItemStack craft(World world) { - return getRaw().craft(null, world.getRegistryManager()); - } - - public net.minecraft.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { - return craft(world.getRaw()); - } - - public ItemStack craftMidohra() { - return ItemStack.of(craft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java deleted file mode 100644 index 6dff1c145..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe.entry; - -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; - -public class CraftingRecipeEntry extends RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; - - protected CraftingRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { - super(null); - this.recipeEntry = recipeEntry; - } - - public static CraftingRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return new CraftingRecipeEntry(recipeEntry); - } - - public static CraftingRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); - } - - public static CraftingRecipeEntry of(net.minecraft.recipe.CraftingRecipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); - - return of(recipeEntry); - } - - public static CraftingRecipeEntry of(CraftingRecipe recipe, CompatIdentifier id) { - return of(recipe.toMinecraft(), id); - } - - @Override - public net.minecraft.recipe.RecipeEntry getRaw() { - return recipeEntry; - } - - @Override - public net.minecraft.recipe.RecipeEntry toMinecraft() { - return getRaw(); - } - - @Override - public CraftingRecipe getRecipe() { - return CraftingRecipe.of(getRawRecipe()); - } - - @Override - public net.minecraft.recipe.CraftingRecipe getRawRecipe() { - return getRaw().value(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java deleted file mode 100644 index 9e7814374..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe.entry; - -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; -import net.pitan76.mcpitanlib.midohra.recipe.Recipe; -import net.pitan76.mcpitanlib.midohra.recipe.RecipeType; - -public class RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; - - protected RecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { - this.recipeEntry = recipeEntry; - } - - public static RecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return new RecipeEntry(recipeEntry); - } - - public static RecipeEntry of(net.minecraft.recipe.Recipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); - return of(recipeEntry); - } - - public static RecipeEntry of(Recipe recipe, CompatIdentifier id) { - return of(recipe.toMinecraft(), id); - } - - public static CraftingRecipeEntry of(net.minecraft.recipe.CraftingRecipe recipe, CompatIdentifier id) { - return CraftingRecipeEntry.of(recipe, id); - } - - public static CraftingRecipeEntry of(CraftingRecipe recipe, CompatIdentifier id) { - return CraftingRecipeEntry.of(recipe, id); - } - - public static ShapedRecipeEntry of(net.minecraft.recipe.ShapedRecipe recipe, CompatIdentifier id) { - return ShapedRecipeEntry.of(recipe, id); - } - - public static ShapedRecipeEntry of(net.pitan76.mcpitanlib.midohra.recipe.ShapedRecipe recipe, CompatIdentifier id) { - return ShapedRecipeEntry.of(recipe, id); - } - - public static ShapelessRecipeEntry of(net.minecraft.recipe.ShapelessRecipe recipe, CompatIdentifier id) { - return ShapelessRecipeEntry.of(recipe, id); - } - - public static ShapelessRecipeEntry of(net.pitan76.mcpitanlib.midohra.recipe.ShapelessRecipe recipe, CompatIdentifier id) { - return ShapelessRecipeEntry.of(recipe, id); - } - - public net.minecraft.recipe.RecipeEntry getRaw() { - return recipeEntry; - } - - public net.minecraft.recipe.RecipeEntry toMinecraft() { - return getRaw(); - } - - public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(getRaw().id().getValue()); - } - - public CompatRecipeEntry toCompatRecipeEntry() { - return new CompatRecipeEntry(getRaw()); - } - - public net.minecraft.recipe.Recipe getRawRecipe() { - return getRaw().value(); - } - - public Recipe getRecipe() { - return Recipe.of(getRaw().value()); - } - - public RecipeType getRecipeType() { - return RecipeType.of(getRawRecipeType()); - } - - public net.minecraft.recipe.RecipeType getRawRecipeType() { - return getRaw().value().getType(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java deleted file mode 100644 index 569564a95..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe.entry; - -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.recipe.ShapedRecipe; - -public class ShapedRecipeEntry extends RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; - - protected ShapedRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { - super(null); - this.recipeEntry = recipeEntry; - } - - public static ShapedRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return new ShapedRecipeEntry(recipeEntry); - } - - public static ShapedRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); - } - - public static ShapedRecipeEntry of(net.minecraft.recipe.ShapedRecipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); - - return of(recipeEntry); - } - - public static ShapedRecipeEntry of(ShapedRecipe recipe, CompatIdentifier id) { - return of(recipe.toMinecraft(), id); - } - - @Override - public net.minecraft.recipe.RecipeEntry getRaw() { - return recipeEntry; - } - - @Override - public net.minecraft.recipe.RecipeEntry toMinecraft() { - return getRaw(); - } - - @Override - public ShapedRecipe getRecipe() { - return ShapedRecipe.of(getRawRecipe()); - } - - @Override - public net.minecraft.recipe.ShapedRecipe getRawRecipe() { - return getRaw().value(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java deleted file mode 100644 index 2026084bd..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe.entry; - -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.recipe.ShapelessRecipe; - -public class ShapelessRecipeEntry extends RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; - - protected ShapelessRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { - super(null); - this.recipeEntry = recipeEntry; - } - - public static ShapelessRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return new ShapelessRecipeEntry(recipeEntry); - } - - public static ShapelessRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); - } - - public static ShapelessRecipeEntry of(net.minecraft.recipe.ShapelessRecipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); - - return of(recipeEntry); - } - - public static ShapelessRecipeEntry of(ShapelessRecipe recipe, CompatIdentifier id) { - return of(recipe.toMinecraft(), id); - } - - @Override - public net.minecraft.recipe.RecipeEntry getRaw() { - return recipeEntry; - } - - @Override - public net.minecraft.recipe.RecipeEntry toMinecraft() { - return getRaw(); - } - - @Override - public ShapelessRecipe getRecipe() { - return ShapelessRecipe.of(getRawRecipe()); - } - - @Override - public net.minecraft.recipe.ShapelessRecipe getRawRecipe() { - return getRaw().value(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java deleted file mode 100644 index 2b65cfda1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java +++ /dev/null @@ -1,67 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe.input; - -import net.minecraft.inventory.CraftingInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.recipe.input.CraftingRecipeInput; -import org.jetbrains.annotations.Nullable; - -public class CraftingRecipeInputOrInventory extends RecipeInputOrInventory { - private final CraftingRecipeInput recipeInput; - private CraftingInventory inventory = null; - - public static CraftingRecipeInputOrInventory EMPTY = new CraftingRecipeInputOrInventory(CraftingRecipeInput.EMPTY); - - protected CraftingRecipeInputOrInventory(CraftingRecipeInput recipeInput) { - super(null); - this.recipeInput = recipeInput; - } - - protected CraftingRecipeInputOrInventory(CraftingInventory inventory) { - super(null); - this.recipeInput = inventory.createRecipeInput(); - this.inventory = inventory; - } - - public static CraftingRecipeInputOrInventory of(CraftingRecipeInput recipeInput) { - return new CraftingRecipeInputOrInventory(recipeInput); - } - - public static CraftingRecipeInputOrInventory of(Inventory inventory) { - if (inventory instanceof CraftingRecipeInput) { - return of((CraftingRecipeInput) inventory); - } - - return EMPTY; - } - - public static CraftingRecipeInputOrInventory of(CraftingInventory inventory) { - return new CraftingRecipeInputOrInventory(inventory); - } - - @Nullable - @Override - public CraftingRecipeInput getRaw() { - return recipeInput; - } - - @Nullable - @Override - public CraftingRecipeInput toMinecraft() { - return getRaw(); - } - - @Nullable - @Override - public CraftingRecipeInput getRecipeInput() { - return getRaw(); - } - - @Nullable - @Override - public Inventory getInventory() { - if (inventory != null) - return inventory; - - return super.getInventory(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java deleted file mode 100644 index 71ff3d195..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe.input; - -import net.minecraft.inventory.Inventory; -import net.minecraft.recipe.input.RecipeInput; -import net.pitan76.mcpitanlib.midohra.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -public class RecipeInputOrInventory { - private final RecipeInput recipeInput; - - public static RecipeInputOrInventory NONE = new RecipeInputOrInventory(null); - - protected RecipeInputOrInventory(RecipeInput recipeInput) { - this.recipeInput = recipeInput; - } - - public static RecipeInputOrInventory of(RecipeInput recipeInput) { - return new RecipeInputOrInventory(recipeInput); - } - - public static RecipeInputOrInventory of(Inventory inventory) { - if (inventory instanceof RecipeInput) { - return of((RecipeInput) inventory); - } - - return NONE; - } - - @Nullable - public RecipeInput getRaw() { - return recipeInput; - } - - @Nullable - public RecipeInput toMinecraft() { - return getRaw(); - } - - @Nullable - public RecipeInput getRecipeInput() { - return getRaw(); - } - - @Nullable - public Inventory getInventory() { - if (getRaw() instanceof Inventory) { - return (Inventory) getRaw(); - } - - return null; - } - - public boolean isNone() { - return getRaw() == null; - } - - public int size() { - if (isNone()) return 0; - - return getRaw().size(); - } - - public boolean isEmpty() { - if (isNone()) return true; - - return getRaw().isEmpty(); - } - - public net.minecraft.item.ItemStack getStack(int slot) { - if (isNone()) return net.minecraft.item.ItemStack.EMPTY; - - return getRaw().getStackInSlot(slot); - } - - public ItemStack getMidohraStack(int slot) { - if (isNone()) return ItemStack.EMPTY; - - return ItemStack.of(getStack(slot)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java deleted file mode 100644 index 66f46d30d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.recipe.input; - -import net.minecraft.inventory.Inventory; -import net.minecraft.recipe.input.RecipeInput; -import org.jetbrains.annotations.Nullable; - -public class TypedRecipeInputOrInventory extends RecipeInputOrInventory { - private final T recipeInput; - - public static TypedRecipeInputOrInventory NONE = new TypedRecipeInputOrInventory<>(null); - - protected TypedRecipeInputOrInventory(T recipeInput) { - super(null); - this.recipeInput = recipeInput; - } - - public static TypedRecipeInputOrInventory _of(T recipeInput) { - return new TypedRecipeInputOrInventory<>(recipeInput); - } - - public static TypedRecipeInputOrInventory of(Inventory inventory) { - if (inventory instanceof RecipeInput) { - return _of((RecipeInput) inventory); - } - - return NONE; - } - - @Nullable - @Override - public T getRaw() { - return recipeInput; - } - - @Nullable - @Override - public T getRecipeInput() { - return getRaw(); - } - - @Nullable - @Override - public T toMinecraft() { - return getRaw(); - } - - @Nullable - @Override - public Inventory getInventory() { - if (getRaw() instanceof Inventory) { - return (Inventory) getRaw(); - } - - return null; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java deleted file mode 100644 index ecfae63c7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java +++ /dev/null @@ -1,74 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.resource; - -import net.pitan76.mcpitanlib.api.util.LoggerUtil; -import net.pitan76.mcpitanlib.api.util.ResourceUtil; -import org.apache.commons.io.IOUtils; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; - -public class Resource { - private final net.minecraft.resource.Resource resource; - - protected Resource(net.minecraft.resource.Resource resource) { - this.resource = resource; - } - - public static Resource of(net.minecraft.resource.Resource resource) { - return new Resource(resource); - } - - public net.minecraft.resource.Resource getRaw() { - return resource; - } - - public net.minecraft.resource.Resource toMinecraft() { - return getRaw(); - } - - public BufferedReader getReader() throws IOException { - return resource.getReader(); - } - - public String getPackId() { - return resource.getPackId(); - } - - public InputStream getInputStream() { - try { - return ResourceUtil.getInputStream(resource); - } catch (IOException e) { - LoggerUtil.error(LoggerUtil.getLogger(), "Failed to read resource: " + e.getMessage()); - return null; - } - } - - public void close() { - try { - ResourceUtil.close(resource); - } catch (IOException e) { - LoggerUtil.error(LoggerUtil.getLogger(), "Failed to close resource: " + e.getMessage()); - } - } - - public String getContent() throws IOException { - String content = IOUtils.toString(getInputStream(), StandardCharsets.UTF_8); - close(); - return content; - } - - public String getContent(String encoding) throws IOException { - String content = IOUtils.toString(getInputStream(), encoding); - close(); - return content; - } - - public String getContent(Charset encoding) throws IOException { - String content = IOUtils.toString(getInputStream(), encoding); - close(); - return content; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java deleted file mode 100644 index 76b541509..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.resource; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.util.Identifier; -import net.minecraft.world.WorldAccess; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.LoggerUtil; -import net.pitan76.mcpitanlib.api.util.ResourceUtil; -import net.pitan76.mcpitanlib.midohra.server.MCServer; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -public class ResourceManager { - private final net.minecraft.resource.ResourceManager resourceManager; - - protected ResourceManager(net.minecraft.resource.ResourceManager resourceManager) { - this.resourceManager = resourceManager; - } - - public static ResourceManager of(net.minecraft.resource.ResourceManager resourceManager) { - return new ResourceManager(resourceManager); - } - - public static ResourceManager of(net.minecraft.server.MinecraftServer server) { - return of(MCServer.of(server)); - } - - public static ResourceManager of(MCServer server) { - return of(server.getRaw()); - } - - @Environment(EnvType.CLIENT) - public static ResourceManager of(MinecraftClient client) { - return of(client.getResourceManager()); - } - - public static ResourceManager of(WorldAccess worldAccess) { - return of(worldAccess.getServer()); - } - - public static ResourceManager of(net.pitan76.mcpitanlib.midohra.world.WorldAccess worldAccess) { - return of(worldAccess.getServer()); - } - - public net.minecraft.resource.ResourceManager getRaw() { - return resourceManager; - } - - public net.minecraft.resource.ResourceManager toMinecraft() { - return getRaw(); - } - - public Map findResources(String startPath, String endPath) { - Map map = new HashMap<>(); - try { - Map rawMap = ResourceUtil.findResources(resourceManager, startPath, endPath); - for (Map.Entry entry : rawMap.entrySet()) { - map.put(CompatIdentifier.fromMinecraft(entry.getKey()), Resource.of(entry.getValue())); - } - } catch (IOException e) { - LoggerUtil.error(LoggerUtil.getLogger(), "Failed to read " + startPath + ": " + e.getMessage()); - return null; - } - - return map; - } - - public Resource getResource(CompatIdentifier id) { - Optional resource = resourceManager.getResource(id.toMinecraft()); - return resource.map(Resource::of).orElse(null); - } - - public List getAllResources(CompatIdentifier id) { - return resourceManager.getAllResources(id.toMinecraft()) - .stream().map(Resource::of).toList(); - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java deleted file mode 100644 index 997dafb98..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java +++ /dev/null @@ -1,96 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.server; - -import net.minecraft.server.MinecraftServer; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.ServerUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.resource.ResourceManager; -import net.pitan76.mcpitanlib.midohra.world.ServerWorld; - -public class MCServer { - private final MinecraftServer server; - - protected MCServer(MinecraftServer server) { - this.server = server; - } - - public static MCServer of(MinecraftServer server) { - return new MCServer(server); - } - - public MinecraftServer getRaw() { - return server; - } - - public MinecraftServer toMinecraft() { - return getRaw(); - } - - public String getIP() { - return ServerUtil.getIP(server); - } - - public int getPort() { - return ServerUtil.getPort(server); - } - - public String getMotd() { - return ServerUtil.getMotd(server); - } - - public String getServerModName() { - return ServerUtil.getServerModName(server); - } - - public int getMaxPlayerCount() { - return ServerUtil.getMaxPlayerCount(server); - } - - public int getCurrentPlayerCount() { - return ServerUtil.getCurrentPlayerCount(server); - } - - public boolean isOnlineMode() { - return ServerUtil.isOnlineMode(server); - } - - public boolean isServerRunning() { - return ServerUtil.isServerRunning(server); - } - - public boolean isServerDedicated() { - return ServerUtil.isServerDedicated(server); - } - - public boolean isSingleplayer() { - return ServerUtil.isSingleplayer(server); - } - - public PlayerManager getPlayerManager() { - return PlayerManager.of(ServerUtil.getPlayerManager(server)); - } - - public ServerWorld getWorld(CompatIdentifier id) { - return ServerWorld.of(WorldUtil.getWorld(server, id)); - } - - public ServerWorld getOverworld() { - return ServerWorld.of(WorldUtil.getOverworld(server)); - } - - public ServerWorld getNether() { - return ServerWorld.of(WorldUtil.getNether(server)); - } - - public ServerWorld getEnd() { - return ServerWorld.of(WorldUtil.getEnd(server)); - } - - public ResourceManager getResourceManager() { - return ResourceManager.of(server.getResourceManager()); - } - - public void execute(Runnable runnable) { - ServerUtil.execute(getRaw(), runnable); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java deleted file mode 100644 index 36efcb21a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java +++ /dev/null @@ -1,152 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.server; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.BannedIpList; -import net.minecraft.server.BannedPlayerList; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.Whitelist; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.text.TextComponent; -import net.pitan76.mcpitanlib.api.util.TextUtil; -import net.pitan76.mcpitanlib.midohra.world.ServerWorld; -import net.pitan76.mcpitanlib.midohra.world.World; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -public class PlayerManager { - private final net.minecraft.server.PlayerManager playerManager; - - protected PlayerManager(net.minecraft.server.PlayerManager playerManager) { - this.playerManager = playerManager; - } - - public static PlayerManager of(net.minecraft.server.PlayerManager playerManager) { - return new PlayerManager(playerManager); - } - - public static PlayerManager of(MinecraftServer server) { - return of(server.getPlayerManager()); - } - - public static PlayerManager of(MCServer server) { - return of(server.getRaw()); - } - - public static PlayerManager of(ServerWorld world) { - return of(world.getServer()); - } - - public static PlayerManager of(World world) { - return of(world.getServer()); - } - - public net.minecraft.server.PlayerManager getRaw() { - return playerManager; - } - - public net.minecraft.server.PlayerManager toMinecraft() { - return getRaw(); - } - - public void broadcast(TextComponent message, boolean overlay) { - getRaw().broadcast(message.getText(), overlay); - } - - public void broadcast(TextComponent message) { - broadcast(message, false); - } - - public void broadcast(String message, boolean overlay) { - getRaw().broadcast(TextUtil.literal(message), overlay); - } - - public void broadcast(String message) { - broadcast(message, false); - } - - public void removePlayer(Player player) { - getRaw().remove(player.getServerPlayer().get()); - } - - public Player getPlayerByUUID(UUID uuid) { - return new Player(getRaw().getPlayer(uuid)); - } - - public Player getPlayerByName(String name) { - return new Player(getRaw().getPlayer(name)); - } - - public List getPlayersByIP(String ip) { - List players = new ArrayList<>(); - for (net.minecraft.entity.player.PlayerEntity p: getRaw().getPlayersByIp(ip)) { - players.add(new Player(p)); - } - return players; - } - - public List getPlayers() { - List players = new ArrayList<>(); - for (PlayerEntity p : getRaw().getPlayerList()) { - players.add(new Player(p)); - } - return players; - } - - public boolean isExistByUUID(UUID uuid) { - return getRaw().getPlayer(uuid) != null; - } - - public boolean isExistByName(String name) { - return getRaw().getPlayer(name) != null; - } - - public boolean isExistByIP(String ip) { - return !getRaw().getPlayersByIp(ip).isEmpty(); - } - - public boolean hasPlayerByUUID(UUID uuid) { - return getRaw().getPlayer(uuid) != null; - } - - public boolean hasPlayerByName(String name) { - return getRaw().getPlayer(name) != null; - } - - public boolean hasPlayerByIP(String ip) { - return !getRaw().getPlayersByIp(ip).isEmpty(); - } - - public int getCurrentPlayerCount() { - return getRaw().getCurrentPlayerCount(); - } - - public int getMaxPlayerCount() { - return getRaw().getMaxPlayerCount(); - } - - public boolean isWhitelistEnabled() { - return getRaw().isWhitelistEnabled(); - } - - public void setWhitelistEnabled(boolean enabled) { - getRaw().getServer().setUseAllowlist(enabled); - } - - public Whitelist getWhitelist() { - return getRaw().getWhitelist(); - } - - public void reloadWhitelist() { - getRaw().reloadWhitelist(); - } - - public BannedIpList getBannedIpList() { - return getRaw().getIpBanList(); - } - - public BannedPlayerList getBannedPlayerList() { - return getRaw().getUserBanList(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java deleted file mode 100644 index 2492fca64..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java +++ /dev/null @@ -1,59 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.hit; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; - -public class BlockHitResult extends HitResult { - public BlockHitResult(net.minecraft.util.hit.BlockHitResult raw) { - super(raw); - } - - public static BlockHitResult of(net.minecraft.util.hit.BlockHitResult raw) { - return new BlockHitResult(raw); - } - - @Deprecated - public net.minecraft.util.hit.BlockHitResult getRaw() { - return (net.minecraft.util.hit.BlockHitResult) super.getRaw(); - } - - public net.minecraft.util.hit.BlockHitResult withSide(Direction side) { - return getRaw().withSide(side); - } - - public net.minecraft.util.hit.BlockHitResult withBlockPos(BlockPos blockPos) { - return getRaw().withBlockPos(blockPos); - } - - public net.minecraft.util.hit.BlockHitResult againstWorldBorder() { - return getRaw().againstWorldBorder(); - } - - public BlockPos getBlockPos() { - return getRaw().getBlockPos(); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getBlockPosM() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getBlockPos()); - } - - public Direction getSide() { - return getRaw().getSide(); - } - - public net.pitan76.mcpitanlib.midohra.util.math.Direction getSideM() { - return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(getSide()); - } - - public boolean isInsideBlock() { - return getRaw().isInsideBlock(); - } - - public boolean isAgainstWorldBorder() { - return getRaw().isAgainstWorldBorder(); - } - - public HitResultType getType() { - return HitResultType.from(getRaw().getType()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java deleted file mode 100644 index 97e521de9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java +++ /dev/null @@ -1,106 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.hit; - -import net.minecraft.entity.Entity; -import net.minecraft.util.math.Vec3d; - -import java.util.Optional; - -public class HitResult { - protected final net.minecraft.util.hit.HitResult raw; - - public HitResult(net.minecraft.util.hit.HitResult raw) { - this.raw = raw; - } - - public static HitResult of(net.minecraft.util.hit.HitResult raw) { - return new HitResult(raw); - } - - @Deprecated - public net.minecraft.util.hit.HitResult getRaw() { - return raw; - } - - @Deprecated - public net.minecraft.util.hit.HitResult.Type getRawType() { - return getRaw().getType(); - } - - public Vec3d getPos() { - return getRaw().getPos(); - } - - public double getX() { - return pos().x; - } - - public double getY() { - return pos().y; - } - - public double getZ() { - return pos().z; - } - - public HitResultType getType() { - return HitResultType.of(this); - } - - public double squaredDistanceTo(Vec3d point) { - Vec3d hitPos = getPos(); - double dx = hitPos.x - point.x; - double dy = hitPos.y - point.y; - double dz = hitPos.z - point.z; - return dx * dx + dy * dy + dz * dz; - } - - public double squaredDistanceTo(Entity entity) { - return getRaw().squaredDistanceTo(entity); - } - - public Vec3d pos() { - return getPos(); - } - - public double x() { - return getX(); - } - - public double y() { - return getY(); - } - - public double z() { - return getZ(); - } - - public Optional asBlockHitResult() { - if (this instanceof BlockHitResult) { - return Optional.of((BlockHitResult) this); - } - - if (raw instanceof net.minecraft.util.hit.BlockHitResult) { - return Optional.of(BlockHitResult.of((net.minecraft.util.hit.BlockHitResult) raw)); - } - - return Optional.empty(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - HitResult other = (HitResult) obj; - return getRaw().equals(other.getRaw()); - } - - @Override - public int hashCode() { - return getRaw().hashCode(); - } - - @Override - public String toString() { - return getRaw().toString(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java deleted file mode 100644 index 6002f2195..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.hit; - -import net.minecraft.util.hit.HitResult; - -public enum HitResultType { - MISS(HitResult.Type.MISS), - BLOCK(HitResult.Type.BLOCK), - ENTITY(HitResult.Type.ENTITY); - - private final HitResult.Type raw; - - HitResultType(HitResult.Type raw) { - this.raw = raw; - } - - @Deprecated - public HitResult.Type getRaw() { - return raw; - } - - public static HitResultType from(HitResult.Type raw) { - switch (raw) { - case MISS: - return MISS; - case BLOCK: - return BLOCK; - case ENTITY: - return ENTITY; - } - throw new IllegalArgumentException("Unknown HitResult.Type: " + raw); - } - - public static HitResultType of(net.pitan76.mcpitanlib.midohra.util.hit.HitResult result) { - return from(result.getRawType()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java deleted file mode 100644 index 657c37939..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java +++ /dev/null @@ -1,138 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math; - -import net.minecraft.util.math.Vec3i; - -import java.util.Iterator; - -public class BlockPos { - private final net.minecraft.util.math.BlockPos blockPos; - - protected BlockPos(net.minecraft.util.math.BlockPos blockPos) { - this.blockPos = blockPos; - } - - public static BlockPos of(net.minecraft.util.math.BlockPos blockPos) { - return new BlockPos(blockPos); - } - - public static BlockPos of(int x, int y, int z) { - return new BlockPos(new net.minecraft.util.math.BlockPos(x, y, z)); - } - - public int getX() { - return blockPos.getX(); - } - - public int getY() { - return blockPos.getY(); - } - - public int getZ() { - return blockPos.getZ(); - } - - public net.minecraft.util.math.BlockPos toMinecraft() { - return blockPos; - } - - public net.minecraft.util.math.BlockPos toRaw() { - return toMinecraft(); - } - - public BlockPos add(int x, int y, int z) { - return new BlockPos(blockPos.add(x, y, z)); - } - - public BlockPos add(BlockPos pos) { - return new BlockPos(blockPos.add(pos.blockPos)); - } - - public BlockPos subtract(int x, int y, int z) { - return new BlockPos(blockPos.subtract(new Vec3i(x, y, z))); - } - - public BlockPos subtract(BlockPos pos) { - return new BlockPos(blockPos.subtract(pos.blockPos)); - } - - public BlockPos up() { - return new BlockPos(blockPos.up()); - } - - public BlockPos down() { - return new BlockPos(blockPos.down()); - } - - public BlockPos north() { - return new BlockPos(blockPos.north()); - } - - public BlockPos south() { - return new BlockPos(blockPos.south()); - } - - public BlockPos east() { - return new BlockPos(blockPos.east()); - } - - public BlockPos west() { - return new BlockPos(blockPos.west()); - } - - public BlockPos offset(Direction direction, int amount) { - return new BlockPos(blockPos.offset(direction.toMinecraft(), amount)); - } - - public BlockPos offset(Direction direction) { - return new BlockPos(blockPos.offset(direction.toMinecraft())); - } - - public ChunkPos toChunkPos() { - return ChunkPos.of(this); - } - - @Override - public int hashCode() { - return blockPos.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - BlockPos pos = (BlockPos) obj; - return blockPos.equals(pos.blockPos); - } - - public static Iterable iterate(BlockPos start, BlockPos end) { - return () -> new Iterator<>() { - private final Iterator rawIterator = net.minecraft.util.math.BlockPos.iterate(start.toRaw(), end.toRaw()).iterator(); - - @Override - public boolean hasNext() { - return rawIterator.hasNext(); - } - - @Override - public BlockPos next() { - return new BlockPos(rawIterator.next()); - } - }; - } - - public long asLong() { - return blockPos.asLong(); - } - - public Vector3i toVector3i() { - return new Vector3i(getX(), getY(), getZ()); - } - - public Vector3d toVector3d() { - return new Vector3d(getX(), getY(), getZ()); - } - - public Vector3d toCenterVector3d() { - return new Vector3d(getX() + 0.5, getY() + 0.5, getZ() + 0.5); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java deleted file mode 100644 index 68e46a035..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java +++ /dev/null @@ -1,144 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math; - -import net.minecraft.util.math.Vec3d; -import net.pitan76.mcpitanlib.api.util.math.BoxUtil; - -public class Box { - protected final net.minecraft.util.math.Box box; - - @Deprecated - public Box(net.minecraft.util.math.Box box) { - this.box = box; - } - - @Deprecated - public net.minecraft.util.math.Box toMinecraft() { - return box; - } - - public Box(double x1, double y1, double z1, double x2, double y2, double z2) { - this(BoxUtil.createBox(x1, y1, z1, x2, y2, z2)); - } - - public Box(double x, double y, double z, double size) { - this(x, y, z, x + size, y + size, z + size); - } - - public Box(double size) { - this(0, 0, 0, size, size, size); - } - - public Box(BlockPos pos) { - this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); - } - - public Box(net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos pos) { - this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); - } - - public Box(BlockPos pos1, BlockPos pos2) { - this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); - } - - public Box(net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos pos1, net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos pos2) { - this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); - } - - public Box(Vector3i pos) { - this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); - } - - public Box(Vector3i pos1, Vector3i pos2) { - this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); - } - - public Box(Vector3d pos) { - this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); - } - - public Box(Vector3d pos1, Vector3d pos2) { - this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); - } - - public Box expand(double x, double y, double z) { - return new Box(BoxUtil.expand(box, x, y, z)); - } - - public Box expand(double size) { - return expand(size, size, size); - } - - public Box union(Box other) { - return new Box(BoxUtil.union(box, other.box)); - } - - public double getMinX() { - return box.minX; - } - - public double getMinY() { - return box.minY; - } - - public double getMinZ() { - return box.minZ; - } - - public double getMaxX() { - return box.maxX; - } - - public double getMaxY() { - return box.maxY; - } - - public double getMaxZ() { - return box.maxZ; - } - - public Vector3d getCenter() { - Vec3d center = box.getCenter(); - return new Vector3d(center.x, center.y, center.z); - } - - public double getLengthX() { - return box.getLengthX(); - } - - public double getLengthY() { - return box.getLengthY(); - } - - public double getLengthZ() { - return box.getLengthZ(); - } - - @Override - public int hashCode() { - return box.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - Box other = (Box) obj; - return box.equals(other.box); - } - - public BlockPos getMinPos() { - return BlockPos.of((int) box.minX, (int) box.minY, (int) box.minZ); - } - - public BlockPos getMaxPos() { - return BlockPos.of((int) box.maxX, (int) box.maxY, (int) box.maxZ); - } - - public Vector3i getMinVector() { - return new Vector3i((int) box.minX, (int) box.minY, (int) box.minZ); - } - - public Vector3i getMaxVector() { - return new Vector3i((int) box.maxX, (int) box.maxY, (int) box.maxZ); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java deleted file mode 100644 index da5a979e7..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java +++ /dev/null @@ -1,154 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math; - -import java.util.stream.Stream; - -public class ChunkPos { - private final net.minecraft.util.math.ChunkPos pos; - - protected ChunkPos(net.minecraft.util.math.ChunkPos pos) { - this.pos = pos; - } - - public static ChunkPos of(net.minecraft.util.math.ChunkPos pos) { - return new ChunkPos(pos); - } - - public static ChunkPos of(int x, int z) { - return of(new net.minecraft.util.math.ChunkPos(x, z)); - } - - public static ChunkPos of(BlockPos pos) { - return of(new net.minecraft.util.math.ChunkPos(pos.toMinecraft())); - } - - public static ChunkPos of(long pos) { - return of(new net.minecraft.util.math.ChunkPos(pos)); - } - - public static ChunkPos fromRegion(int x, int z) { - return of(net.minecraft.util.math.ChunkPos.fromRegion(x, z)); - } - - public static ChunkPos fromRegionCenter(int x, int z) { - return of(net.minecraft.util.math.ChunkPos.fromRegionCenter(x, z)); - } - - public net.minecraft.util.math.ChunkPos getRaw() { - return pos; - } - - public net.minecraft.util.math.ChunkPos toMinecraft() { - return getRaw(); - } - - public int getX() { - return getRaw().x; - } - - public int getZ() { - return getRaw().z; - } - - public int getOffsetX(int offsetX) { - return getRaw().getOffsetX(offsetX); - } - - public int getOffsetZ(int offsetZ) { - return getRaw().getOffsetZ(offsetZ); - } - - public int getStartX() { - return getRaw().getStartX(); - } - - public int getStartZ() { - return getRaw().getStartZ(); - } - - public int getEndX() { - return getRaw().getEndX(); - } - - public int getEndZ() { - return getRaw().getEndZ(); - } - - public int getCenterX() { - return getRaw().getCenterX(); - } - - public int getCenterZ() { - return getRaw().getCenterZ(); - } - - public int getRegionX() { - return getRaw().getRegionX(); - } - - public int getRegionZ() { - return getRaw().getRegionZ(); - } - - public int getRegionRelativeX() { - return getRaw().getRegionRelativeX(); - } - - public int getRegionRelativeZ() { - return getRaw().getRegionRelativeZ(); - } - - public BlockPos getStartPos() { - return BlockPos.of(getRaw().getStartPos()); - } - - public BlockPos getCenterAtY(int y) { - return BlockPos.of(getRaw().getCenterAtY(y)); - } - - public BlockPos getBlockPos(int offsetX, int y, int offsetZ) { - return BlockPos.of(getRaw().getBlockPos(offsetX, y, offsetZ)); - } - - public long toLong() { - return getRaw().toLong(); - } - - @Override - public String toString() { - return getRaw().toString(); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof ChunkPos && getRaw().equals(((ChunkPos) obj).getRaw()); - } - - @Override - public int hashCode() { - return getRaw().hashCode(); - } - - public int getChebyshevDistance(ChunkPos pos) { - return getRaw().getChebyshevDistance(pos.getRaw()); - } - - public int getChebyshevDistance(int x, int z) { - return getRaw().getChebyshevDistance(x, z); - } - - public int getSquaredDistance(ChunkPos pos) { - return getRaw().getSquaredDistance(pos.getRaw()); - } - - public int getSquaredDistance(long pos) { - return getRaw().getSquaredDistance(pos); - } - - public static Stream stream(ChunkPos center, int radius) { - return net.minecraft.util.math.ChunkPos.stream(center.getRaw(), radius).map(ChunkPos::of); - } - - public static Stream stream(final ChunkPos pos1, final ChunkPos pos2) { - return net.minecraft.util.math.ChunkPos.stream(pos1.getRaw(), pos2.getRaw()).map(ChunkPos::of); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java deleted file mode 100644 index eebc3da6f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java +++ /dev/null @@ -1,133 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math; - -public class Direction { - - public static final Direction UP = new Direction(net.minecraft.util.math.Direction.UP); - public static final Direction DOWN = new Direction(net.minecraft.util.math.Direction.DOWN); - public static final Direction NORTH = new Direction(net.minecraft.util.math.Direction.NORTH); - public static final Direction SOUTH = new Direction(net.minecraft.util.math.Direction.SOUTH); - public static final Direction EAST = new Direction(net.minecraft.util.math.Direction.EAST); - public static final Direction WEST = new Direction(net.minecraft.util.math.Direction.WEST); - - private final net.minecraft.util.math.Direction direction; - - protected Direction(net.minecraft.util.math.Direction direction) { - this.direction = direction; - } - - public static Direction of(net.minecraft.util.math.Direction direction) { - switch (direction) { - case UP: - return UP; - case DOWN: - return DOWN; - case NORTH: - return NORTH; - case SOUTH: - return SOUTH; - case EAST: - return EAST; - case WEST: - return WEST; - default: - return new Direction(direction); - } - } - - public Direction getOpposite() { - switch (getRaw()) { - case UP: - return DOWN; - case DOWN: - return UP; - case NORTH: - return SOUTH; - case SOUTH: - return NORTH; - case EAST: - return WEST; - case WEST: - return EAST; - default: - return null; - } - } - - public net.minecraft.util.math.Direction getRaw() { - return direction; - } - - public net.minecraft.util.math.Direction toMinecraft() { - return getRaw(); - } - - public boolean isHorizontal() { - return getRaw().getAxis().isHorizontal(); - } - - public boolean isVertical() { - return getRaw().getAxis().isVertical(); - } - - public boolean isPositive() { - return getRaw().getDirection() == net.minecraft.util.math.Direction.AxisDirection.POSITIVE; - } - - public boolean isNegative() { - return getRaw().getDirection() == net.minecraft.util.math.Direction.AxisDirection.NEGATIVE; - } - - public int getOffsetX() { - return getRaw().getOffsetX(); - } - - public int getOffsetY() { - return getRaw().getOffsetY(); - } - - public int getOffsetZ() { - return getRaw().getOffsetZ(); - } - - public Direction rotateYClockwise() { - return of(getRaw().rotateYClockwise()); - } - - public Direction rotateYCounterclockwise() { - return of(getRaw().rotateYCounterclockwise()); - } - - @Override - public String toString() { - return getRaw().toString(); - } - - public String getName() { - return getRaw().name(); - } - - public static Direction[] values() { - return new Direction[]{UP, DOWN, NORTH, SOUTH, EAST, WEST}; - } - - public Direction[] horizontal() { - return new Direction[]{NORTH, SOUTH, EAST, WEST}; - } - - public Direction[] vertical() { - return new Direction[]{UP, DOWN}; - } - - @Override - public int hashCode() { - return getRaw().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - Direction dir = (Direction) obj; - return getRaw() == dir.getRaw(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java deleted file mode 100644 index 368d4a2a1..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java +++ /dev/null @@ -1,223 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math; - -import net.minecraft.util.math.Position; -import net.minecraft.util.math.Vec3d; - -public class Vector3d { - public final double x; - public final double y; - public final double z; - - public Vector3d(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - public static Vector3d of(double x, double y, double z) { - return new Vector3d(x, y, z); - } - - public static Vector3d of(Vector3i vec) { - return new Vector3d(vec.x, vec.y, vec.z); - } - - public static Vector3d of(Vector3f vec) { - return new Vector3d(vec.x, vec.y, vec.z); - } - - public static Vector3d of(org.joml.Vector3d vec) { - return new Vector3d(vec.x, vec.y, vec.z); - } - - public static Vector3d of(Vec3d vec) { - return new Vector3d(vec.x, vec.y, vec.z); - } - - public static Vector3d of(Position vec) { - return new Vector3d(vec.getX(), vec.getY(), vec.getZ()); - } - - public Vector3i toInt() { - return new Vector3i((int) x, (int) y, (int) z); - } - - public Vector3f toFloat() { - return new Vector3f((float) x, (float) y, (float) z); - } - - public org.joml.Vector3d toJoml() { - return new org.joml.Vector3d(x, y, z); - } - - public Vector3d add(Vector3d other) { - return new Vector3d(this.x + other.x, this.y + other.y, this.z + other.z); - } - - public Vector3d sub(Vector3d other) { - return new Vector3d(this.x - other.x, this.y - other.y, this.z - other.z); - } - - public Vector3d mul(double scalar) { - return new Vector3d(this.x * scalar, this.y * scalar, this.z * scalar); - } - - public Vector3d div(double scalar) { - return new Vector3d(this.x / scalar, this.y / scalar, this.z / scalar); - } - - public double dot(Vector3d other) { - return this.x * other.x + this.y * other.y + this.z * other.z; - } - - public Vector3d cross(Vector3d other) { - return new Vector3d( - this.y * other.z - this.z * other.y, - this.z * other.x - this.x * other.z, - this.x * other.y - this.y * other.x - ); - } - - public double length() { - return Math.sqrt(x * x + y * y + z * z); - } - - public Vector3d normalize() { - double len = length(); - if (len == 0) return new Vector3d(0, 0, 0); - return div(len); - } - - public Vector3d add(double x, double y, double z) { - return new Vector3d(this.x + x, this.y + y, this.z + z); - } - - public Vector3d sub(double x, double y, double z) { - return new Vector3d(this.x - x, this.y - y, this.z - z); - } - - public Vector3d lerp(Vector3d to, double delta) { - return this.mul(1 - delta).add(to.mul(delta)); - } - - public Vector3d rotateX(double angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - double cos = Math.cos(angleRadians); - double sin = Math.sin(angleRadians); - double newY = y * cos - z * sin; - double newZ = y * sin + z * cos; - return new Vector3d(x, newY, newZ); - } - - public Vector3d rotateY(double angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - double cos = Math.cos(angleRadians); - double sin = Math.sin(angleRadians); - double newX = x * cos - z * sin; - double newZ = x * sin + z * cos; - return new Vector3d(newX, y, newZ); - } - - public Vector3d rotateZ(double angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - double cos = Math.cos(angleRadians); - double sin = Math.sin(angleRadians); - double newX = x * cos - y * sin; - double newY = x * sin + y * cos; - return new Vector3d(newX, newY, z); - } - - public Vector3d negate() { - return new Vector3d(-x, -y, -z); - } - - public Vector3d abs() { - return new Vector3d(Math.abs(x), Math.abs(y), Math.abs(z)); - } - - public Vector3d distanceTo(Vector3d other) { - return this.sub(other); - } - - public double getX() { - return x; - } - - public double getY() { - return y; - } - - public double getZ() { - return z; - } - - public static Vector3d zero() { - return new Vector3d(0, 0, 0); - } - - public static Vector3d distance(Vector3d a, Vector3d b) { - return a.sub(b); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - Vector3d vec = (Vector3d) obj; - return x == vec.x && y == vec.y && z == vec.z; - } - - @Override - public String toString() { - return "(" + x + ", " + y + ", " + z + ")"; - } - - @Override - public int hashCode() { - int h; - h = Double.hashCode(x); - h = 31 * h + Double.hashCode(y); - h = 31 * h + Double.hashCode(z); - return h; - } - - public Vector3d ofCenter() { - return new Vector3d(x + 0.5, y + 0.5, z + 0.5); - } - - public Vec3d toMinecraft() { - return new Vec3d(x, y, z); - } - - public Vector3d mul(Vector3d other) { - return new Vector3d(this.x * other.x, this.y * other.y, this.z * other.z); - } - - public Vector3d mul(double x, double y, double z) { - return new Vector3d(this.x * x, this.y * y, this.z * z); - } - - public Vector3d div(Vector3d other) { - return new Vector3d(this.x / other.x, this.y / other.y, this.z / other.z); - } - - public Vector3d div(double x, double y, double z) { - return new Vector3d(this.x / x, this.y / y, this.z / z); - } - - public Vector3d mod(Vector3d other) { - return new Vector3d(this.x % other.x, this.y % other.y, this.z % other.z); - } - - public Vector3d mod(double x, double y, double z) { - return new Vector3d(this.x % x, this.y % y, this.z % z); - } - - public Vector3d floor() { - return new Vector3d(Math.floor(x), Math.floor(y), Math.floor(z)); - } - - public long asLong() { - return ((long) x & 0xFFFFFFFFL) << 32 | ((long) y & 0xFFFFFFFFL) << 16 | ((long) z & 0xFFFFFFFFL); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java deleted file mode 100644 index aa4b530c5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java +++ /dev/null @@ -1,212 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math; - -public class Vector3f { - public final float x; - public final float y; - public final float z; - - public Vector3f(float x, float y, float z) { - this.x = x; - this.y = y; - this.z = z; - } - - public static Vector3f of(float x, float y, float z) { - return new Vector3f(x, y, z); - } - - public static Vector3f of(Vector3i vec) { - return new Vector3f(vec.x, vec.y, vec.z); - } - - public static Vector3f of(Vector3d vec) { - return new Vector3f((float) vec.x, (float) vec.y, (float) vec.z); - } - - public static Vector3f of(org.joml.Vector3f vec) { - return new Vector3f(vec.x, vec.y, vec.z); - } - - public Vector3i toInt() { - return new Vector3i((int) x, (int) y, (int) z); - } - - public Vector3d toDouble() { - return new Vector3d((double) x, (double) y, (double) z); - } - - public org.joml.Vector3f toJoml() { - return new org.joml.Vector3f(x, y, z); - } - - public Vector3f add(Vector3f other) { - return new Vector3f(this.x + other.x, this.y + other.y, this.z + other.z); - } - - public Vector3f sub(Vector3f other) { - return new Vector3f(this.x - other.x, this.y - other.y, this.z - other.z); - } - - public Vector3f mul(float scalar) { - return new Vector3f(this.x * scalar, this.y * scalar, this.z * scalar); - } - - public Vector3f div(float scalar) { - return new Vector3f(this.x / scalar, this.y / scalar, this.z / scalar); - } - - public float dot(Vector3f other) { - return this.x * other.x + this.y * other.y + this.z * other.z; - } - - public Vector3f cross(Vector3f other) { - return new Vector3f( - this.y * other.z - this.z * other.y, - this.z * other.x - this.x * other.z, - this.x * other.y - this.y * other.x - ); - } - - public float length() { - return (float) Math.sqrt(x * x + y * y + z * z); - } - - public Vector3f normalize() { - float len = length(); - if (len == 0) return new Vector3f(0, 0, 0); - return div(len); - } - - public Vector3f add(float x, float y, float z) { - return new Vector3f(this.x + x, this.y + y, this.z + z); - } - - public Vector3f sub(float x, float y, float z) { - return new Vector3f(this.x - x, this.y - y, this.z - z); - } - - public Vector3f lerp(Vector3f to, float delta) { - return this.mul(1 - delta).add(to.mul(delta)); - } - - public Vector3f rotateX(float angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - float cos = (float) Math.cos(angleRadians); - float sin = (float) Math.sin(angleRadians); - float newY = y * cos - z * sin; - float newZ = y * sin + z * cos; - return new Vector3f(x, newY, newZ); - } - - public Vector3f rotateY(float angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - float cos = (float) Math.cos(angleRadians); - float sin = (float) Math.sin(angleRadians); - float newX = z * sin + x * cos; - float newZ = z * cos - x * sin; - return new Vector3f(newX, y, newZ); - } - - public Vector3f rotateZ(float angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - float cos = (float) Math.cos(angleRadians); - float sin = (float) Math.sin(angleRadians); - float newX = x * cos - y * sin; - float newY = x * sin + y * cos; - return new Vector3f(newX, newY, z); - } - - public Vector3f negate() { - return new Vector3f(-x, -y, -z); - } - - public Vector3f abs() { - return new Vector3f(Math.abs(x), Math.abs(y), Math.abs(z)); - } - - public Vector3f distanceTo(Vector3f other) { - return this.sub(other); - } - - public float getX() { - return x; - } - - public float getY() { - return y; - } - - public float getZ() { - return z; - } - - public static Vector3f zero() { - return new Vector3f(0, 0, 0); - } - - public static Vector3f distance(Vector3f a, Vector3f b) { - return a.sub(b); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - Vector3f vec = (Vector3f) obj; - return x == vec.x && y == vec.y && z == vec.z; - } - - @Override - public String toString() { - return "(" + x + ", " + y + ", " + z + ")"; - } - - @Override - public int hashCode() { - int h; - h = Float.hashCode(x); - h = 31 * h + Float.hashCode(y); - h = 31 * h + Float.hashCode(z); - return h; - } - - public Vector3f ofCenter() { - return this.add(0.5f, 0.5f, 0.5f); - } - - public org.joml.Vector3f toMinecraft() { - return new org.joml.Vector3f(x, y, z); - } - - public Vector3f mul(Vector3f other) { - return new Vector3f(this.x * other.x, this.y * other.y, this.z * other.z); - } - - public Vector3f mul(float x, float y, float z) { - return new Vector3f(this.x * x, this.y * y, this.z * z); - } - - public Vector3f div(Vector3f other) { - return new Vector3f(this.x / other.x, this.y / other.y, this.z / other.z); - } - - public Vector3f div(float x, float y, float z) { - return new Vector3f(this.x / x, this.y / y, this.z / z); - } - - public Vector3f mod(Vector3f other) { - return new Vector3f(this.x % other.x, this.y % other.y, this.z % other.z); - } - - public Vector3f mod(float x, float y, float z) { - return new Vector3f(this.x % x, this.y % y, this.z % z); - } - - public Vector3f floor() { - return new Vector3f((float) Math.floor(x), (float) Math.floor(y), (float) Math.floor(z)); - } - - public long asLong() { - return ((long) x & 0xFFFFFFFFL) << 32 | ((long) y & 0xFFFFFFFFL) << 16 | ((long) z & 0xFFFFFFFFL); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java deleted file mode 100644 index c38d48cf0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java +++ /dev/null @@ -1,231 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math; - -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; - -public class Vector3i { - public final int x; - public final int y; - public final int z; - - public Vector3i(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public static Vector3i of(int x, int y, int z) { - return new Vector3i(x, y, z); - } - - public static Vector3i of(Vector3d vec) { - return new Vector3i((int) vec.x, (int) vec.y, (int) vec.z); - } - - public static Vector3i of(Vector3f vec) { - return new Vector3i((int) vec.x, (int) vec.y, (int) vec.z); - } - - public static Vector3i of(org.joml.Vector3i vec) { - return new Vector3i(vec.x, vec.y, vec.z); - } - - public static Vector3i of(Vec3i vec) { - return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); - } - - public static Vector3i of(BlockPos vec) { - return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); - } - - public static Vector3i of(net.pitan76.mcpitanlib.midohra.util.math.BlockPos vec) { - return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); - } - - public static Vector3i of(net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos vec) { - return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); - } - - public Vector3d toDouble() { - return new Vector3d(x, y, z); - } - - public Vector3f toFloat() { - return new Vector3f((float) x, (float) y, (float) z); - } - - public org.joml.Vector3i toJoml() { - return new org.joml.Vector3i(x, y, z); - } - - public Vector3i add(Vector3i other) { - return new Vector3i(this.x + other.x, this.y + other.y, this.z + other.z); - } - - public Vector3i sub(Vector3i other) { - return new Vector3i(this.x - other.x, this.y - other.y, this.z - other.z); - } - - public Vector3i mul(int scalar) { - return new Vector3i(this.x * scalar, this.y * scalar, this.z * scalar); - } - - public Vector3i div(int scalar) { - return new Vector3i(this.x / scalar, this.y / scalar, this.z / scalar); - } - - public int dot(Vector3i other) { - return this.x * other.x + this.y * other.y + this.z * other.z; - } - - public Vector3i cross(Vector3i other) { - return new Vector3i( - this.y * other.z - this.z * other.y, - this.z * other.x - this.x * other.z, - this.x * other.y - this.y * other.x - ); - } - - public int length() { - return (int) Math.sqrt(x * x + y * y + z * z); - } - - public Vector3i normalize() { - int len = length(); - if (len == 0) return new Vector3i(0, 0, 0); - return div(len); - } - - public Vector3i add(int x, int y, int z) { - return new Vector3i(this.x + x, this.y + y, this.z + z); - } - - public Vector3i sub(int x, int y, int z) { - return new Vector3i(this.x - x, this.y - y, this.z - z); - } - - public Vector3i lerp(Vector3i to, int delta) { - return this.mul(1 - delta).add(to.mul(delta)); - } - - public Vector3i rotateX(double angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - int cos = (int) Math.cos(angleRadians); - int sin = (int) Math.sin(angleRadians); - int newY = this.y * cos - this.z * sin; - int newZ = this.y * sin + this.z * cos; - return new Vector3i(this.x, newY, newZ); - } - - public Vector3i rotateY(double angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - int cos = (int) Math.cos(angleRadians); - int sin = (int) Math.sin(angleRadians); - int newX = this.z * sin + this.x * cos; - int newZ = this.z * cos - this.x * sin; - return new Vector3i(newX, this.y, newZ); - } - - public Vector3i rotateZ(double angleDegrees) { - double angleRadians = Math.toRadians(angleDegrees); - int cos = (int) Math.cos(angleRadians); - int sin = (int) Math.sin(angleRadians); - int newX = this.x * cos - this.y * sin; - int newY = this.x * sin + this.y * cos; - return new Vector3i(newX, newY, this.z); - } - - public Vector3i negate() { - return new Vector3i(-this.x, -this.y, -this.z); - } - - public Vector3i abs() { - return new Vector3i(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z)); - } - - public Vector3i distanceTo(Vector3i other) { - return this.sub(other); - } - - public int getX() { - return x; - } - - public int getY() { - return y; - } - - public int getZ() { - return z; - } - - public static Vector3i zero() { - return new Vector3i(0, 0, 0); - } - - public static Vector3i distance(Vector3i a, Vector3i b) { - return a.sub(b); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - Vector3i vec = (Vector3i) obj; - return x == vec.x && y == vec.y && z == vec.z; - } - - @Override - public String toString() { - return "(" + x + ", " + y + ", " + z + ")"; - } - - @Override - public int hashCode() { - int h; - h = Integer.hashCode(x); - h = 31 * h + Integer.hashCode(y); - h = 31 * h + Integer.hashCode(z); - return h; - } - - public Vec3i toMinecraft() { - return new Vec3i(x, y, z); - } - - public Vector3i mul(Vector3i other) { - return new Vector3i(this.x * other.x, this.y * other.y, this.z * other.z); - } - - public Vector3i mul(int x, int y, int z) { - return new Vector3i(this.x * x, this.y * y, this.z * z); - } - - public Vector3i div(Vector3i other) { - return new Vector3i(this.x / other.x, this.y / other.y, this.z / other.z); - } - - public Vector3i div(int x, int y, int z) { - return new Vector3i(this.x / x, this.y / y, this.z / z); - } - - public Vector3i mod(Vector3i other) { - return new Vector3i(this.x % other.x, this.y % other.y, this.z % other.z); - } - - public Vector3i mod(int x, int y, int z) { - return new Vector3i(this.x % x, this.y % y, this.z % z); - } - - public long asLong() { - return ((long) x & 0xFFFFFFFFL) << 32 | ((long) y & 0xFFFFFFFFL) << 16 | ((long) z & 0xFFFFFFFFL); - } - - public net.pitan76.mcpitanlib.midohra.util.math.BlockPos toPos() { - return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(x, y, z); - } - - public Vector3d toCenter() { - return new Vector3d(x + 0.5, y + 0.5, z + 0.5); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java deleted file mode 100644 index fb0f6d0c3..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java +++ /dev/null @@ -1,90 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.math.v0; - -import net.minecraft.util.math.Vec3i; -import net.pitan76.mcpitanlib.midohra.util.math.Direction; - -public class BlockPos extends net.minecraft.util.math.BlockPos { - private final net.minecraft.util.math.BlockPos blockPos; - - protected BlockPos(net.minecraft.util.math.BlockPos blockPos) { - super(blockPos.getX(), blockPos.getY(), blockPos.getZ()); - this.blockPos = blockPos; - } - - public static BlockPos of(net.minecraft.util.math.BlockPos blockPos) { - return new BlockPos(blockPos); - } - - public static BlockPos of(int x, int y, int z) { - return new BlockPos(new net.minecraft.util.math.BlockPos(x, y, z)); - } - - public int getX() { - return blockPos.getX(); - } - - public int getY() { - return blockPos.getY(); - } - - public int getZ() { - return blockPos.getZ(); - } - - public net.minecraft.util.math.BlockPos toMinecraft() { - return blockPos; - } - - public BlockPos add(int x, int y, int z) { - return new BlockPos(blockPos.add(x, y, z)); - } - - public BlockPos add(BlockPos pos) { - return new BlockPos(blockPos.add(pos.blockPos)); - } - - public BlockPos subtract(int x, int y, int z) { - return new BlockPos(blockPos.subtract(new Vec3i(x, y, z))); - } - - public BlockPos subtract(BlockPos pos) { - return new BlockPos(blockPos.subtract(pos.blockPos)); - } - - public BlockPos up() { - return new BlockPos(blockPos.up()); - } - - public BlockPos down() { - return new BlockPos(blockPos.down()); - } - - public BlockPos north() { - return new BlockPos(blockPos.north()); - } - - public BlockPos south() { - return new BlockPos(blockPos.south()); - } - - public BlockPos east() { - return new BlockPos(blockPos.east()); - } - - public BlockPos west() { - return new BlockPos(blockPos.west()); - } - - public BlockPos offset(Direction direction, int amount) { - return new BlockPos(blockPos.offset(direction.toMinecraft(), amount)); - } - - public BlockPos offset(Direction direction) { - return new BlockPos(blockPos.offset(direction.toMinecraft())); - } - - @Override - public BlockPos add(Vec3i vec3i) { - return new BlockPos(blockPos.add(vec3i)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java deleted file mode 100644 index a0e536955..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.util.shape; - -import net.pitan76.mcpitanlib.midohra.util.math.Direction; - -public class VoxelShape { - private final net.minecraft.util.shape.VoxelShape voxelShape; - - public static final VoxelShape EMPTY = of(net.minecraft.util.shape.VoxelShapes.empty()); - public static final VoxelShape FULL_CUBE = of(net.minecraft.util.shape.VoxelShapes.fullCube()); - - public VoxelShape(net.minecraft.util.shape.VoxelShape voxelShape) { - this.voxelShape = voxelShape; - } - - public static VoxelShape of(net.minecraft.util.shape.VoxelShape shape) { - return new VoxelShape(shape); - } - - @Deprecated - public net.minecraft.util.shape.VoxelShape raw() { - return voxelShape; - } - - public boolean isEmpty() { - return raw().isEmpty(); - } - - public VoxelShape union(VoxelShape other) { - return of(net.minecraft.util.shape.VoxelShapes.union(this.raw(), other.raw())); - } - - public VoxelShape asCuboid() { - return of(raw().asCuboid()); - } - - public VoxelShape offset(double x, double y, double z) { - return of(raw().offset(x, y, z)); - } - - public VoxelShape getFace(Direction direction) { - return of(raw().getFace(direction.toMinecraft())); - } - - public VoxelShape simplify() { - return of(raw().simplify()); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof VoxelShape)) return false; - VoxelShape other = (VoxelShape) obj; - return this.raw().equals(other.raw()); - } - - @Override - public int hashCode() { - return raw().hashCode(); - } - - public static VoxelShape empty() { - return EMPTY; - } - - public static VoxelShape fullCube() { - return FULL_CUBE; - } - - public static VoxelShape union(VoxelShape... shapes) { - net.minecraft.util.shape.VoxelShape result = net.minecraft.util.shape.VoxelShapes.empty(); - for (VoxelShape shape : shapes) { - result = net.minecraft.util.shape.VoxelShapes.union(result, shape.raw()); - } - return of(result); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java deleted file mode 100644 index 60a94b216..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.util.math.BlockPos; - -public class BlockView implements IWorldView { - private net.minecraft.world.BlockView blockView; - - public BlockView(net.minecraft.world.BlockView blockView) { - this.blockView = blockView; - } - - public static BlockView of(net.minecraft.world.BlockView blockView) { - return new BlockView(blockView); - } - - public net.minecraft.world.BlockView getRaw() { - return blockView; - } - - public net.minecraft.world.BlockView toMinecraft() { - return getRaw(); - } - - @Override - public BlockEntity getBlockEntity(BlockPos pos) { - return getRaw().getBlockEntity(pos); - } - - @Override - public BlockState getBlockState(BlockPos pos) { - return getRaw().getBlockState(pos); - } - - @Override - public FluidState getFluidState(BlockPos pos) { - return getRaw().getFluidState(pos); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java deleted file mode 100644 index 95d95ab78..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; - -public interface IWorldView { - BlockEntity getBlockEntity(BlockPos pos); - - BlockState getBlockState(BlockPos pos); - - FluidState getFluidState(BlockPos pos); - - default BlockEntityWrapper getBlockEntity(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return BlockEntityWrapper.of(getBlockEntity(pos.toMinecraft())); - } - - default net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState(pos.toMinecraft())); - } - - default FluidWrapper getFluid(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return FluidWrapper.of(getFluidState(pos.toMinecraft()).getFluid()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java deleted file mode 100644 index 4d8bc2f0e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world; - -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Direction; - -public interface RedstoneView { - - net.minecraft.world.RedstoneView getRedstoneView(); - - default boolean isReceivingRedstonePower(BlockPos pos) { - return getRedstoneView().isReceivingRedstonePower(pos.toMinecraft()); - } - - default int getEmittedRedstonePower(BlockPos pos, Direction direction) { - return getRedstoneView().getEmittedRedstonePower(pos.toMinecraft(), direction.toMinecraft()); - } - - default int getEmittedRedstonePower(BlockPos pos, Direction direction, boolean onlyFromGate) { - return getRedstoneView().getEmittedRedstonePower(pos.toMinecraft(), direction.toMinecraft(), onlyFromGate); - } - - default boolean isEmittingRedstonePower(BlockPos pos, Direction direction) { - return getRedstoneView().isEmittingRedstonePower(pos.toMinecraft(), direction.toMinecraft()); - } - - default int getStrongRedstonePower(BlockPos pos, Direction direction) { - return getRedstoneView().getStrongRedstonePower(pos.toMinecraft(), direction.toMinecraft()); - } - - default int getReceivedStrongRedstonePower(BlockPos pos) { - return getRedstoneView().getReceivedStrongRedstonePower(pos.toMinecraft()); - } - - static RedstoneView of(net.minecraft.world.RedstoneView redstoneView) { - return () -> redstoneView; - } - - static RedstoneView of(net.minecraft.world.WorldView world) { - return WorldView.of(world); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java deleted file mode 100644 index 9ee497435..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world; - -import net.minecraft.server.MinecraftServer; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.midohra.recipe.ServerRecipeManager; -import net.pitan76.mcpitanlib.midohra.server.MCServer; -import net.pitan76.mcpitanlib.midohra.server.PlayerManager; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.chunk.ServerChunkManager; - -public class ServerWorld extends World { - private final net.minecraft.server.world.ServerWorld world; - - protected ServerWorld(net.minecraft.server.world.ServerWorld world) { - super(null); - this.world = world; - } - - public static ServerWorld of(net.minecraft.server.world.ServerWorld world) { - return new ServerWorld(world); - } - - @Override - public net.minecraft.server.world.ServerWorld getRaw() { - return world; - } - - @Override - public net.minecraft.server.world.ServerWorld toMinecraft() { - return getRaw(); - } - - public void playSound(Player player, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, long seed) { - getRaw().playSound(player.getEntity(), pos.getX(), pos.getY(), pos.getZ(), sound.getEntry(), category.get(), volume, pitch, seed); - } - - public void playSoundFromEntity(Player player, Player target, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, long seed) { - getRaw().playSoundFromEntity(player.getEntity(), target.getEntity(), sound.getEntry(), category.get(), volume, pitch, seed); - } - - public MinecraftServer getServer() { - return getRaw().getServer(); - } - - public MCServer getMCServer() { - return MCServer.of(getServer()); - } - - public PlayerManager getPlayerManager() { - return PlayerManager.of(this); - } - - public ServerChunkManager getChunkManager() { - return ServerChunkManager.of(this); - } - - @Override - public ServerRecipeManager getRecipeManager() { - return ServerRecipeManager.of(this); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java deleted file mode 100644 index ff3bf1da9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java +++ /dev/null @@ -1,167 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world; - -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.recipe.RecipeManager; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; - -import java.util.List; -import java.util.Optional; -import java.util.UUID; - -public class World extends WorldAccess { - - private final net.minecraft.world.World world; - - protected World(net.minecraft.world.World world) { - super(null); - this.world = world; - } - - public static World of(net.minecraft.world.World world) { - return new World(world); - } - - @Override - public net.minecraft.world.World getRaw() { - return world; - } - - public net.minecraft.world.World toMinecraft() { - return getRaw(); - } - - public void addBlockEntity(BlockEntityWrapper blockEntity) { - addBlockEntity(blockEntity.get()); - } - - public void addBlockEntity(BlockEntity blockEntity) { - getRaw().addBlockEntity(blockEntity); - } - - public void removeBlockEntity(BlockPos pos) { - getRaw().removeBlockEntity(pos.toMinecraft()); - } - - public long getTime() { - return WorldUtil.getTime(getRaw()); - } - - public long getTopY() { - return WorldUtil.getTopY(getRaw()); - } - - public long getBottomY() { - return WorldUtil.getBottomY(getRaw()); - } - - public long getDimensionHeight() { - return WorldUtil.getDimensionHeight(getRaw()); - } - - public CompatIdentifier getId() { - return WorldUtil.getCompatWorldId(getRaw()); - } - - public FluidState getRawFluidState(BlockPos pos) { - return WorldUtil.getFluidState(getRaw(), pos.toMinecraft()); - } - - public Player getPlayerByUUID(UUID uuid) { - return WorldUtil.getPlayer(getRaw(), uuid); - } - - public List getPlayers() { - return WorldUtil.getPlayers(getRaw()); - } - - public BlockPos getSpawnPos() { - return BlockPos.of(WorldUtil.getSpawnPos(getRaw())); - } - - public Optional getWorld(CompatIdentifier id) { - Optional optional = WorldUtil.getWorld(getRaw(), id); - return optional.map(World::of); - } - - public Optional getServerWorld(CompatIdentifier id) { - Optional optional = WorldUtil.getWorld(getRaw(), id); - return optional.map(ServerWorld::of); - } - - public void spawnEntity(Entity entity) { - WorldUtil.spawnEntity(getRaw(), entity); - } - - public void spawnStack(net.minecraft.item.ItemStack stack, BlockPos pos) { - WorldUtil.spawnStack(getRaw(), pos.toMinecraft(), stack); - } - - public RecipeManager getRecipeManager() { - return RecipeManager.of(getRaw().getRecipeManager()); - } - - @Deprecated - @Override - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category) { - getRaw().playSound(playerEntity, pos, sound, category); - } - - @Deprecated - @Override - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { - getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); - } - - @Override - public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { - WorldUtil.playSound(getRaw(), player, pos.toMinecraft(), soundEvent, category, volume, pitch); - } - - @Override - public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { - playSound(null, pos, soundEvent, category, 1f, 1f); - } - - @Override - public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { - playSound(player, pos, soundEvent, category, 1f, 1f); - } - - @Override - public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { - playSound(null, pos, soundEvent, category, volume, pitch); - } - - public Optional toServerWorld() { - if (getRaw() instanceof net.minecraft.server.world.ServerWorld) { - return Optional.of(ServerWorld.of((net.minecraft.server.world.ServerWorld) getRaw())); - } - return Optional.empty(); - } - - public CompatRegistryLookup getRegistryLookup() { - return RegistryLookupUtil.getRegistryLookup(getRaw()); - } - - public boolean isAir(BlockPos pos) { - return WorldUtil.isAir(getRaw(), pos.toMinecraft()); - } - - public Block getBlock(BlockPos pos) { - return WorldUtil.getBlock(getRaw(), pos.toMinecraft()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java deleted file mode 100644 index 5635acba5..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ /dev/null @@ -1,191 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world; - -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.predicate.entity.EntityPredicates; -import net.minecraft.server.MinecraftServer; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; -import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import net.pitan76.mcpitanlib.api.util.world.WorldAccessUtil; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; -import net.pitan76.mcpitanlib.midohra.server.MCServer; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Box; - -import java.util.List; -import java.util.Optional; -import java.util.function.Predicate; - -public class WorldAccess extends WorldView { - private final net.minecraft.world.WorldAccess world; - - protected WorldAccess(net.minecraft.world.WorldAccess world) { - super(null); - this.world = world; - } - - public static WorldAccess of(net.minecraft.world.WorldAccess world) { - return new WorldAccess(world); - } - - @Override - protected net.minecraft.world.WorldAccess getRaw() { - return world; - } - - public net.minecraft.world.WorldAccess toMinecraft() { - return getRaw(); - } - - public boolean isClient() { - return WorldAccessUtil.isClient(getRaw()); - } - - public boolean isServer() { - return !isClient(); - } - - public CompatRandom getRandom() { - return new CompatRandom(getRaw().getRandom()); - } - - public MinecraftServer getServer() { - return WorldAccessUtil.getServer(getRaw()); - } - - public BlockEntityWrapper getBlockEntity(BlockPos pos) { - return BlockEntityWrapper.of(WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft())); - } - - public Optional getRawBlockEntity(BlockPos pos, BlockEntityType type) { - return WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); - } - - public BlockEntityWrapper getBlockEntity(BlockPos pos, BlockEntityType type) { - Optional blockEntity = WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); - return blockEntity.map(BlockEntityWrapper::of).orElse(BlockEntityWrapper.of()); - } - - public boolean removeBlock(BlockPos pos, boolean move) { - return WorldAccessUtil.removeBlock(getRaw(), pos.toMinecraft(), move); - } - - public boolean breakBlock(BlockPos pos, boolean drop) { - return WorldAccessUtil.breakBlock(getRaw(), pos.toMinecraft(), drop); - } - - public boolean breakBlock(BlockPos pos, boolean drop, Entity entity) { - return WorldAccessUtil.breakBlock(getRaw(), pos.toMinecraft(), drop, entity); - } - - public BlockState getBlockState(BlockPos pos) { - return BlockState.of(WorldAccessUtil.getBlockState(getRaw(), pos.toMinecraft())); - } - - public boolean setBlockState(BlockPos pos, BlockState state, int flags) { - return WorldAccessUtil.setBlockState(getRaw(), pos.toMinecraft(), state.toMinecraft(), flags); - } - - public boolean setBlockState(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { - return WorldAccessUtil.setBlockState(getRaw(), pos.toMinecraft(), state.toMinecraft(), flags, maxUpdateDepth); - } - - public boolean setBlockState(BlockPos pos, BlockState state) { - return WorldAccessUtil.setBlockState(getRaw(), pos.toMinecraft(), state.toMinecraft()); - } - - @Deprecated - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { - getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); - } - - @Deprecated - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category) { - getRaw().playSound(playerEntity, pos, sound, category); - } - - public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { - playSound(player.getEntity(), pos.toMinecraft(), soundEvent.get(), category.get(), volume, pitch); - } - - public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { - playSound(player.getEntity(), pos.toMinecraft(), soundEvent.get(), category.get()); - } - - public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { - playSound(null, pos.toMinecraft(), soundEvent.get(), category.get(), volume, pitch); - } - - public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { - playSound(null, pos.toMinecraft(), soundEvent.get(), category.get()); - } - - public MCServer getMCServer() { - return MCServer.of(getServer()); - } - - public boolean isChunkLoaded(BlockPos pos) { - return WorldAccessUtil.isChunkLoaded(getRaw(), pos.toMinecraft()); - } - - public List getEntitiesByClass(Class entityClass, Box box, Predicate predicate) { - return WorldAccessUtil.getEntitiesByClass(getRaw(), entityClass, box, predicate); - } - - public List getEntitiesByType(EntityType entityType, Box box, Predicate predicate) { - return WorldAccessUtil.getEntitiesByType(getRaw(), entityType, box, predicate); - } - - public List getEntitiesByType(EntityTypeWrapper entityType, Box box, Predicate predicate) { - return WorldAccessUtil.getEntitiesByType(getRaw(), entityType.get(), box, predicate); - } - - public List getEntitiesByClass(Class entityClass, Box box) { - return getEntitiesByClass(entityClass, box, EntityPredicates.VALID_ENTITY); - } - - public List getEntitiesByType(EntityType entityType, Box box) { - return getEntitiesByType(entityType, box, EntityPredicates.VALID_ENTITY); - } - - public boolean breakBlock(BlockPos pos, boolean drop, Player player) { - return breakBlock(pos, drop, player.getEntity()); - } - - public List getEntitiesByTypeM(EntityTypeWrapper entityType, Box box, Predicate predicate) { - return getEntitiesByType(entityType.get(), box, (e) -> predicate.test(EntityWrapper.of(e))) - .stream().map(EntityWrapper::of).toList(); - } - - public List getEntitiesByTypeM(EntityTypeWrapper entityType, Box box) { - return getEntitiesByType(entityType.get(), box).stream().map(EntityWrapper::of).toList(); - } - - public List getEntitiesByClassM(Class entityClass, Box box, Predicate predicate) { - return getEntitiesByClass((Class) entityClass, box, (e) -> predicate.test(EntityWrapper.of(e))) - .stream().map(EntityWrapper::of).toList(); - } - - public List getEntitiesByClassM(Class entityClass, Box box) { - return getEntitiesByClass((Class) entityClass, box).stream().map(EntityWrapper::of).toList(); - } - - public void spawnEntity(Entity entity) { - getRaw().spawnEntity(entity); - } - - public void spawnEntity(EntityWrapper entity) { - spawnEntity(entity.get()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java deleted file mode 100644 index 6e73462d4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java +++ /dev/null @@ -1,85 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world; - -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.fluid.FluidState; -import net.pitan76.mcpitanlib.api.util.world.WorldAccessUtil; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; - -import java.util.Optional; - -public class WorldView implements IWorldView, RedstoneView { - private final net.minecraft.world.WorldView world; - - protected WorldView(net.minecraft.world.WorldView world) { - this.world = world; - } - - public static WorldView of(net.minecraft.world.WorldView world) { - return new WorldView(world); - } - - protected net.minecraft.world.WorldView getRaw() { - return world; - } - - public net.minecraft.world.WorldView toMinecraft() { - return getRaw(); - } - - public boolean isClient() { - return WorldAccessUtil.isClient(getRaw()); - } - - public boolean isServer() { - return !isClient(); - } - - public BlockEntityWrapper getBlockEntity(BlockPos pos) { - return BlockEntityWrapper.of(WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft())); - } - - public Optional getRawBlockEntity(BlockPos pos, BlockEntityType type) { - return WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); - } - - public BlockEntityWrapper getBlockEntity(BlockPos pos, BlockEntityType type) { - Optional blockEntity = WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); - return blockEntity.map(BlockEntityWrapper::of).orElse(BlockEntityWrapper.of()); - } - - @Override - public BlockEntity getBlockEntity(net.minecraft.util.math.BlockPos pos) { - return getRaw().getBlockEntity(pos); - } - - @Override - public net.minecraft.block.BlockState getBlockState(net.minecraft.util.math.BlockPos pos) { - return getRaw().getBlockState(pos); - } - - @Override - public FluidState getFluidState(net.minecraft.util.math.BlockPos pos) { - return getRaw().getFluidState(pos); - } - - @Override - @Deprecated - public net.minecraft.world.RedstoneView getRedstoneView() { - return getRaw(); - } - - @Override - public int hashCode() { - return getRaw() != null ? getRaw().hashCode() : 0; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null || getClass() != obj.getClass()) return false; - WorldView other = (WorldView) obj; - return getRaw() != null ? getRaw().equals(other.getRaw()) : other.getRaw() == null; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java deleted file mode 100644 index 7f3084f67..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world.chunk; - -import net.pitan76.mcpitanlib.midohra.world.BlockView; -import net.pitan76.mcpitanlib.midohra.world.IWorldView; -import net.pitan76.mcpitanlib.midohra.world.World; - -public class ChunkManager { - private final net.minecraft.world.chunk.ChunkManager chunkManager; - - protected ChunkManager(net.minecraft.world.chunk.ChunkManager chunkManager) { - this.chunkManager = chunkManager; - } - - public static ChunkManager of(net.minecraft.world.chunk.ChunkManager chunkManager) { - return new ChunkManager(chunkManager); - } - - public static ChunkManager of(net.minecraft.world.World world) { - return of(world.getChunkManager()); - } - - public static ChunkManager of(World world) { - return of(world.getRaw()); - } - - public net.minecraft.world.chunk.ChunkManager getRaw() { - return chunkManager; - } - - public net.minecraft.world.chunk.ChunkManager toMinecraft() { - return getRaw(); - } - - public IWorldView getWorld() { - return BlockView.of(getRaw().getWorld()); - } - - public boolean isChunkLoaded(int x, int z) { - return getRaw().isChunkLoaded(x, z); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java deleted file mode 100644 index e1faf1d6f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world.chunk; - -import net.minecraft.util.Unit; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; - -import java.util.Comparator; - -public class ChunkTicketType { - - public static final ChunkTicketType START = of(net.minecraft.server.world.ChunkTicketType.PLAYER_SPAWN); - public static final ChunkTicketType DRAGON = of(net.minecraft.server.world.ChunkTicketType.DRAGON); - public static final ChunkTicketType PLAYER = of(net.minecraft.server.world.ChunkTicketType.PLAYER_SIMULATION); - public static final ChunkTicketType FORCED = of(net.minecraft.server.world.ChunkTicketType.FORCED); - public static final ChunkTicketType PORTAL = of(net.minecraft.server.world.ChunkTicketType.PORTAL); - public static final ChunkTicketType ENDER_PEARL = of(net.minecraft.server.world.ChunkTicketType.ENDER_PEARL); - public static final ChunkTicketType POST_TELEPORT = of(net.minecraft.server.world.ChunkTicketType.PORTAL); - public static final ChunkTicketType UNKNOWN = of(net.minecraft.server.world.ChunkTicketType.UNKNOWN); - - private final net.minecraft.server.world.ChunkTicketType ticketType; - - protected ChunkTicketType(net.minecraft.server.world.ChunkTicketType ticketType) { - this.ticketType = ticketType; - } - - public static ChunkTicketType of(net.minecraft.server.world.ChunkTicketType ticketType) { - return new ChunkTicketType<>(ticketType); - } - - public net.minecraft.server.world.ChunkTicketType getRaw() { - return ticketType; - } - - public net.minecraft.server.world.ChunkTicketType toMinecraft() { - return getRaw(); - } - - public static ChunkTicketType create(String name, Comparator argumentComparator) { - return (ChunkTicketType) create(name); - } - - public static ChunkTicketType create(String name, Comparator argumentComparator, int expiryTicks) { - return (ChunkTicketType) create(name, expiryTicks); - } - - public Comparator getArgumentComparator() { - return null; - } - - public long getExpiryTicks() { - return getRaw().expiryTicks(); - } - - @Override - public String toString() { - return getRaw().toString(); - } - - public ChunkTicketType(String name, long expiryTicks) { - this(new net.minecraft.server.world.ChunkTicketType(expiryTicks, 6)); - } - - public ChunkTicketType(String name) { - this(name, 0); - } - - public static ChunkTicketType create(String name, long expiryTicks) { - return new ChunkTicketType<>(name, expiryTicks); - } - - public static ChunkTicketType create(String name) { - return new ChunkTicketType<>(name); - } - - @Override - public int hashCode() { - return ticketType.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (!(obj instanceof ChunkTicketType)) return false; - ChunkTicketType that = (ChunkTicketType) obj; - return ticketType.equals(that.ticketType); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java deleted file mode 100644 index 40264d352..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java +++ /dev/null @@ -1,51 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world.chunk; - -import net.pitan76.mcpitanlib.api.util.world.ChunkManagerUtil; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.ChunkPos; -import net.pitan76.mcpitanlib.midohra.world.ServerWorld; -import net.pitan76.mcpitanlib.midohra.world.World; - -public class ServerChunkManager extends ChunkManager { - private final net.minecraft.server.world.ServerChunkManager chunkManager; - - protected ServerChunkManager(net.minecraft.server.world.ServerChunkManager chunkManager) { - super(null); - this.chunkManager = chunkManager; - } - - public static ServerChunkManager of(net.minecraft.server.world.ServerChunkManager chunkManager) { - return new ServerChunkManager(chunkManager); - } - - public static ServerChunkManager of(ServerWorld world) { - return of(world.getRaw().getChunkManager()); - } - - @Override - public net.minecraft.server.world.ServerChunkManager getRaw() { - return chunkManager; - } - - @Override - public net.minecraft.server.world.ServerChunkManager toMinecraft() { - return getRaw(); - } - - @Override - public World getWorld() { - return World.of(getRaw().getWorld()); - } - - public void addTicket(ChunkTicketType ticketType, ChunkPos pos, int radius, T argument) { - getRaw().addTicket(ticketType.getRaw(), pos.getRaw(), radius); - } - - public void removeTicket(ChunkTicketType ticketType, ChunkPos pos, int radius, T argument) { - getRaw().removeTicket(ticketType.getRaw(), pos.getRaw(), radius); - } - - public void markForUpdate(BlockPos pos) { - ChunkManagerUtil.markForUpdate(getRaw(), pos); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java deleted file mode 100644 index 2c5daf8fb..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.pitan76.mcpitanlib.midohra.world.tick; - -import net.minecraft.block.Block; -import net.minecraft.fluid.Fluid; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; - -public class ScheduledTickView { - private final net.minecraft.world.tick.ScheduledTickView scheduledTickView; - - public ScheduledTickView(net.minecraft.world.tick.ScheduledTickView scheduledTickView) { - this.scheduledTickView = scheduledTickView; - } - - public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.tick.ScheduledTickView scheduledTickView) { - return new net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView(scheduledTickView); - } - - public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.World world) { - return new net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView(world); - } - - public net.minecraft.world.tick.ScheduledTickView toMinecraft() { - return get(); - } - - protected net.minecraft.world.tick.ScheduledTickView get() { - return scheduledTickView; - } - - public void scheduleBlockTick(BlockPos blockPos, BlockWrapper blockWrapper, int delay) { - scheduleBlockTick(blockPos.toMinecraft(), blockWrapper.get(), delay); - } - - public void scheduleBlockTick(net.minecraft.util.math.BlockPos blockPos, Block block, int delay) { - get().scheduleBlockTick(blockPos, block, delay); - } - - public void scheduleFluidTick(BlockPos blockPos, FluidWrapper fluidWrapper, int delay) { - scheduleFluidTick(blockPos.toMinecraft(), fluidWrapper.get(), delay); - } - - public void scheduleFluidTick(net.minecraft.util.math.BlockPos blockPos, Fluid block, int delay) { - get().scheduleFluidTick(blockPos, block, delay); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java deleted file mode 100644 index 68c444246..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java +++ /dev/null @@ -1,97 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; -import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; -import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; -import net.pitan76.mcpitanlib.api.block.args.RotateArgs; -import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(AbstractBlock.class) -public class AbstractBlock4CompatProviderMixin { - @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getStateForNeighborUpdate", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random)), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toMinecraft()); - } - } - - @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getRenderType(BlockState state, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - CompatBlockRenderType returnValue = provider.getRenderType(new RenderTypeArgs(state), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toMinecraft()); - } - } - - @Inject(method = "rotate", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_rotate(BlockState state, BlockRotation rotation, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.rotate(new RotateArgs(state, rotation), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toMinecraft()); - } - } - - @Inject(method = "isSideInvisible", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_isSideInvisible(BlockState state, BlockState stateFrom, Direction direction, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - Boolean returnValue = provider.isSideInvisible(new SideInvisibleArgs(state, stateFrom, direction), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java deleted file mode 100644 index 1dc07e068..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java +++ /dev/null @@ -1,139 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.SimpleNamedScreenHandlerFactory; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; -import net.pitan76.mcpitanlib.api.event.block.*; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.List; - -@Mixin(AbstractBlock.class) -public class AbstractBlockMixin { - @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "scheduledTick", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - provider.scheduledTick(new BlockScheduledTickEvent(state, world, pos, random), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - CompatActionResult returnValue = provider.onRightClick(new BlockUseEvent(state, world, pos, player, player.getActiveHand(), hit), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toActionResult()); - } - } - - @Inject(method = "createScreenHandlerFactory", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_createScreenHandlerFactory(BlockState state, World world, BlockPos pos, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - NamedScreenHandlerFactory returnValue = new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> - provider.createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player), options), provider.getScreenTitle()); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "onStateReplaced", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved, CallbackInfo ci) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - provider.onStateReplaced(new StateReplacedEvent(state, world, pos, world.getBlockState(pos), moved), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "getDroppedStacks", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getDroppedStacks(BlockState state, LootWorldContext.Builder builder, CallbackInfoReturnable> cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - List returnValue = provider.getDroppedStacks(new DroppedStacksArgs(state, builder), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "canPathfindThrough", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_canPathfindThrough(BlockState state, NavigationType type, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - Boolean returnValue = provider.canPathfindThrough(new CanPathfindThroughArgs(state, type), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getPickStack", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData, CallbackInfoReturnable cir) { - // ExtendBlockProviderを実装している場合 (1.21.5からAbstractBlockに移転) - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - - PickStackEvent event = new PickStackEvent(world, pos, state); - event.setIncludeData(includeData); - - ItemStack returnValue = provider.getPickStack(event, options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java deleted file mode 100644 index 79e84aa7c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemPlacementContext; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; -import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(Block.class) -public class Block4CompatProviderMixin { - - @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { - // ExtendBlockProviderを実装している場合 - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.getPlacementState(new PlacementStateArgs(ctx), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toMinecraft()); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java deleted file mode 100644 index edf1d6c7b..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(Block.class) -public interface BlockInvoker { - @Invoker("setDefaultState") - void setDefaultState_invoke(BlockState state); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java deleted file mode 100644 index 946658a91..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java +++ /dev/null @@ -1,100 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; -import net.pitan76.mcpitanlib.api.event.block.*; -import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; -import net.pitan76.mcpitanlib.api.event.v1.listener.BlockBreakTask; -import net.pitan76.mcpitanlib.api.event.v1.listener.BlockPlacedTask; -import net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(Block.class) -public class BlockMixin { - - @Inject(method = "onPlaced", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack, CallbackInfo ci) { - // イベントを呼び出す - if (!BlockEventRegistry.ON_PLACED.isEmpty()) { - int maxPriority = BlockEventRegistry.ON_PLACED.getMaxPriority(); - for (int p = maxPriority; p >= 0; p--) { - for (BlockPlacedTask listener : BlockEventRegistry.ON_PLACED.getListenersAsList(p)) { - listener.onPlaced(new BlockPlacedEvent(world, pos, state, placer, stack)); - } - } - } - - // ExtendBlockProviderを実装している場合 - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - provider.onPlaced(new BlockPlacedEvent(world, pos, state, placer, stack), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "onBreak", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable cir) { - // イベントを呼び出す - if (!BlockEventRegistry.ON_BREAK.isEmpty()) { - BlockState newState = state; - int maxPriority = BlockEventRegistry.ON_BREAK.getMaxPriority(); - for (int p = maxPriority; p >= 0; p--) { - for (BlockBreakTask listener : BlockEventRegistry.ON_BREAK.getListenersAsList(p)) { - newState = listener.onBreak(new BlockBreakEvent(world, pos, newState, player)).state; - } - } - if (newState != state) { - cir.setReturnValue(newState); - state = newState; - } - } - - // ExtendBlockProviderを実装している場合 - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - BlockBreakResult returnValue = provider.onBreak(new BlockBreakEvent(world, pos, state, player), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.getState()); - } - } - - @Inject(method = "appendProperties", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$appendProperties(StateManager.Builder builder, CallbackInfo ci) { - // ExtendBlockProviderを実装している場合 - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - provider.appendProperties(new AppendPropertiesArgs(builder), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { - // ExtendBlockProviderを実装している場合 - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - BlockState returnValue = provider.getPlacementState(new PlacementStateArgs(ctx), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java deleted file mode 100644 index c8e709d41..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.CraftingRecipe; -import net.minecraft.recipe.input.CraftingRecipeInput; -import net.minecraft.util.collection.DefaultedList; -import net.pitan76.mcpitanlib.api.item.FixedRecipeRemainderItem; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(CraftingRecipe.class) -public interface CraftingRecipeMixin { - @Inject(method = "collectRecipeRemainders", at = @At("RETURN")) - private static void mcpitanlib$collectRecipeRemainders(CraftingRecipeInput input, CallbackInfoReturnable> cir) { - DefaultedList defaultedList = cir.getReturnValue(); - - int i = 0; - for (ItemStack stack : defaultedList) { - if (stack.getItem() instanceof FixedRecipeRemainderItem) { - FixedRecipeRemainderItem remainder = (FixedRecipeRemainderItem) stack.getItem(); - defaultedList.set(i, remainder.getFixedRecipeRemainder(stack.copy())); - } - i++; - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java deleted file mode 100644 index 01eac3762..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java +++ /dev/null @@ -1,255 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.block.BlockState; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.item.consume.UseAction; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.pitan76.mcpitanlib.api.event.item.*; -import net.pitan76.mcpitanlib.api.event.v2.ItemEventRegistry; -import net.pitan76.mcpitanlib.api.event.v2.listener.InventoryTickTask; -import net.pitan76.mcpitanlib.api.item.ExtendItemProvider; -import net.pitan76.mcpitanlib.api.item.ExtendItemProvider.Options; -import net.pitan76.mcpitanlib.api.item.FixedRecipeRemainderItem; -import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; -import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; -import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.function.Consumer; - -@Mixin(Item.class) -public class ItemMixin { - @Inject(method = "use", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$use(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - CompatActionResult returnValue = provider.onRightClick(new ItemUseEvent(world, user, hand), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toActionResult()); - } - } - - @Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$useOnBlock(ItemUsageContext context, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; - Options options = new Options(); - CompatActionResult returnValue = provider.onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit()), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toActionResult()); - } - } - - @Inject(method = "useOnEntity", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - CompatActionResult returnValue = provider.onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toActionResult()); - } - } - - @Inject(method = "finishUsing", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$finishUsing(ItemStack stack, World world, LivingEntity user, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - ItemStack returnValue = provider.onFinishUsing(new ItemFinishUsingEvent(stack, world, user), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - /* - @Inject(method = "hasRecipeRemainder", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$hasRecipeRemainder(CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - boolean returnValue = provider.hasRecipeRemainder(options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - */ - - @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$appendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type, CallbackInfo ci) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - provider.appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "postHit", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$postHit(ItemStack stack, LivingEntity target, LivingEntity attacker, CallbackInfo ci) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - provider.postHit(new PostHitEvent(stack, target, attacker), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "postMine", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - boolean returnValue = provider.postMine(new PostMineEvent(stack, world, state, pos, miner), options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "onCraft", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onCraft(ItemStack stack, World world, CallbackInfo ci) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - provider.onCraft(new CraftEvent(stack, world), options); - if (options.cancel) - ci.cancel(); - } - } - - /* - @Inject(method = "isEnchantable", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$isEnchantable(ItemStack stack, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - boolean returnValue = provider.isEnchantable(new EnchantableArgs(stack), options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - */ - - /* - @Inject(method = "getEnchantability", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getEnchantability(CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - int returnValue = provider.getEnchantability(new EnchantabilityArgs(), options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - */ - - @Inject(method = "getItemBarColor", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getItemBarColor(ItemStack stack, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - int returnValue = provider.getItemBarColor(new ItemBarColorArgs(stack), options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "isItemBarVisible", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$isItemBarVisible(ItemStack stack, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - boolean returnValue = provider.isItemBarVisible(new ItemBarVisibleArgs(stack), options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getItemBarStep", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getItemBarStep(ItemStack stack, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - int returnValue = provider.getItemBarStep(new ItemBarStepArgs(stack), options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getBonusAttackDamage", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getBonusAttackDamage(Entity target, float baseAttackDamage, DamageSource damageSource, CallbackInfoReturnable cir) { - if (this instanceof ExtendItemProvider) { - ExtendItemProvider provider = (ExtendItemProvider) this; - Options options = new Options(); - float returnValue = provider.getBonusAttackDamage(new BonusAttackDamageArgs(target, baseAttackDamage, damageSource), options); - if (options.cancel) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getUseAction", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getUseAction(ItemStack stack, CallbackInfoReturnable cir) { - if (this instanceof CompatItemProvider) { - CompatItemProvider provider = (CompatItemProvider) this; - Options options = new Options(); - CompatUseAction returnValue = provider.getUseAction(new UseActionArgs(stack), options); - if (options.cancel) - cir.setReturnValue(returnValue.get()); - } - } - - @Inject(method = "inventoryTick", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inventoryTick(ItemStack stack, ServerWorld world, Entity entity, EquipmentSlot slot, CallbackInfo ci) { - // イベントを呼び出す - if (!ItemEventRegistry.INVENTORY_TICK.isEmpty()) { - int maxPriority = ItemEventRegistry.INVENTORY_TICK.getMaxPriority(); - for (int p = maxPriority; p >= 0; p--) { - for (InventoryTickTask listener : ItemEventRegistry.INVENTORY_TICK.getListenersAsList(p)) { - listener.inventoryTick(new InventoryTickEvent(stack, world, entity, slot)); - } - } - } - - // CompatItemProviderを実装している場合 - if (this instanceof CompatItemProvider) { - CompatItemProvider provider = (CompatItemProvider) this; - Options options = new Options(); - provider.inventoryTick(new InventoryTickEvent(stack, world, entity, slot), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "getRecipeRemainder", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getRecipeRemainder(CallbackInfoReturnable cir) { - if (this instanceof FixedRecipeRemainderItem) { - ItemStack returnValue = ((FixedRecipeRemainderItem) this) - .getFixedRecipeRemainder(ItemStackUtil.create((Item) (Object) this)); - cir.setReturnValue(returnValue); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java deleted file mode 100644 index 86b0a5bc8..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import com.mojang.serialization.Dynamic; -import net.minecraft.datafixer.fix.ItemStackComponentizationFix; -import net.pitan76.mcpitanlib.api.datafixer.ItemStackFixer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ItemStackComponentizationFix.class) -public class ItemStackComponentizationFixMixin { - @Inject(method = "fixStack", at = @At("TAIL")) - private static void mcpitanlib$fixStack(ItemStackComponentizationFix.StackData data, Dynamic dynamic, CallbackInfo ci) { - if (!ItemStackFixer.getNbt2componentMapIfItemEqualMap().isEmpty()) { - ItemStackFixer.getNbt2componentMapIfItemEqualMap().forEach((itemId, map) -> { - for (String nbtKey : map.keySet()) { - if (data.itemEquals(itemId)) { - data.moveToComponent(nbtKey, map.get(nbtKey)); - } - } - }); - } - - if (!ItemStackFixer.getNbt2componentMapIfitemMatchesMap().isEmpty()) { - ItemStackFixer.getNbt2componentMapIfitemMatchesMap().forEach((itemIds, map) -> { - for (String nbtKey : map.keySet()) { - if (data.itemMatches(itemIds)) { - data.moveToComponent(nbtKey, map.get(nbtKey)); - } - } - }); - } - - if (!ItemStackFixer.getNbt2componentMap().isEmpty()) { - ItemStackFixer.getNbt2componentMap().forEach(data::moveToComponent); - } - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java deleted file mode 100644 index cc416d13c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.pitan76.mcpitanlib.api.event.v0.event.ItemStackActionEvent; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.function.Consumer; - -@Mixin(ItemStack.class) -public abstract class ItemStackMixin { - - @Inject(method = "damage(ILnet/minecraft/server/world/ServerWorld;Lnet/minecraft/server/network/ServerPlayerEntity;Ljava/util/function/Consumer;)V", at = @At("HEAD"), cancellable = true) - public void mcpitanlib$damage(int amount, ServerWorld world, ServerPlayerEntity player, Consumer breakCallback, CallbackInfo ci) { - ItemStackActionEvent.returnValue = null; - ItemStackActionEvent.call((ItemStack) (Object) this); - if (ItemStackActionEvent.returnValue != null) - ci.cancel(); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java deleted file mode 100644 index 5d5557f7e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.item.ItemUsageContext; -import net.minecraft.util.hit.BlockHitResult; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(ItemUsageContext.class) -public interface ItemUsageContextMixin { - @Accessor - public BlockHitResult getHit(); -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java deleted file mode 100644 index f4c81ebb0..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.server.MinecraftServer; -import net.pitan76.mcpitanlib.api.timer.MinecraftServerTimerAccess; -import net.pitan76.mcpitanlib.api.timer.TimerItem; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; - -@Mixin(MinecraftServer.class) -public class MinecraftServerTimer implements MinecraftServerTimerAccess { - @Unique - private final List mcpitanlib$timerItems = new ArrayList<>(); - - @Inject(method = "tick", at = @At("TAIL")) - private void mcpitanlib$onTick(CallbackInfo ci) { - if (mcpitanlib$timerItems.isEmpty()) return; - List items = new ArrayList<>(mcpitanlib$timerItems); - - for (TimerItem item : items) { - if (--item.ticksUntilSomething == 0L) { - if (item.executeSupplier.get()) - mcpitanlib$timerItems.remove(item); - } - } - } - - @Override - public void mcpitanlib$addTimer(long ticksUntilSomething, Supplier executeSupplier) { - mcpitanlib$timerItems.add(new TimerItem(ticksUntilSomething, executeSupplier)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java deleted file mode 100644 index 24bc30cb4..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import com.llamalad7.mixinextras.sugar.Local; -import net.minecraft.recipe.*; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.Identifier; -import net.minecraft.util.profiler.Profiler; -import net.pitan76.mcpitanlib.api.event.v0.event.RecipeManagerEvent; -import net.pitan76.mcpitanlib.api.event.v1.RecipeManagerRegistry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.SortedMap; - -@Mixin(ServerRecipeManager.class) -public class RecipeManagerMixin { - - @Inject(method = "prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Lnet/minecraft/recipe/PreparedRecipes;", - at = @At(value = "TAIL")) - private void mcpitanlib$invokeApply(ResourceManager resourceManager, Profiler profiler, CallbackInfoReturnable cir, @Local SortedMap> sortedMap) { - if (RecipeManagerRegistry.managers.isEmpty()) return; - RecipeManagerRegistry.managers.forEach((manager) -> manager.apply(new RecipeManagerEvent(sortedMap, resourceManager, profiler))); - } - -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java deleted file mode 100644 index 72663172e..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.server.world.ServerWorld; -import net.pitan76.mcpitanlib.api.timer.ServerWorldTimerAccess; -import net.pitan76.mcpitanlib.api.timer.TimerItem; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; - -@Mixin(ServerWorld.class) -public class ServerWorldTimer implements ServerWorldTimerAccess { - @Unique - private final List mcpitanlib$timerItems = new ArrayList<>(); - - @Inject(method = "tick", at = @At("TAIL")) - private void onTick(CallbackInfo ci) { - if (mcpitanlib$timerItems.isEmpty()) return; - List items = new ArrayList<>(mcpitanlib$timerItems); - - for (TimerItem item : items) { - if (--item.ticksUntilSomething == 0L) { - if (item.executeSupplier.get()) - mcpitanlib$timerItems.remove(item); - } - } - } - - @Override - public void mcpitanlib$addTimer(long ticksUntilSomething, Supplier executeSupplier) { - mcpitanlib$timerItems.add(new TimerItem(ticksUntilSomething, executeSupplier)); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java deleted file mode 100644 index 81cc4d593..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.mojang.blaze3d.buffers.GpuBufferSlice; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.client.render.state.WorldBorderRenderState; -import net.minecraft.client.render.state.WorldRenderState; -import net.minecraft.client.util.ObjectAllocator; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.border.WorldBorder; -import net.pitan76.mcpitanlib.api.client.event.WorldRenderRegistry; -import net.pitan76.mcpitanlib.api.client.event.listener.*; -import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; -import org.joml.Vector4f; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(WorldRenderer.class) -public abstract class WorldRendererMixin { - @Shadow private int ticks; - - @Shadow public abstract boolean isTerrainRenderComplete(); - - @Shadow @Nullable public abstract Frustum getCapturedFrustum(); - - @Shadow @Final private MinecraftClient client; - @Shadow @Final private WorldRenderState worldRenderState; - @Shadow @Nullable private ClientWorld world; - @Unique - private final WorldRenderContextImpl mcpitanlib$contextCache = new WorldRenderContextImpl(); - - @Inject(method = "renderTargetBlockOutline", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onRenderTargetBlockOutline(VertexConsumerProvider.Immediate immediate, MatrixStack matrices, boolean renderBlockOutline, WorldRenderState renderStates, CallbackInfo ci) { - if (WorldRenderRegistry.isEmptyBlockOutlineListeners) return; - - mcpitanlib$contextCache.worldRenderer = (WorldRenderer)(Object) this; - mcpitanlib$contextCache.advancedTranslucency = isTerrainRenderComplete(); - mcpitanlib$contextCache.consumers = immediate; - mcpitanlib$contextCache.matrixStack = matrices; - mcpitanlib$contextCache.tickDelta = ticks; - - BeforeBlockOutlineEvent event = new BeforeBlockOutlineEvent(mcpitanlib$contextCache, MinecraftClient.getInstance().crosshairTarget); - - for (BeforeBlockOutlineListener listener : WorldRenderRegistry.beforeBlockOutlineListeners) { - if (!listener.beforeBlockOutline(event)) { - ci.cancel(); - return; - } - } - } - - @Inject(method = "render", at = @At("HEAD")) - private void beforeRender(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci) { - mcpitanlib$contextCache.prepare(client.gameRenderer, (WorldRenderer) (Object) this, worldRenderState, world, tickCounter, renderBlockOutline, camera, positionMatrix, matrix4f, projectionMatrix); - } - - @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupFrustum(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/client/render/Frustum;")) - private Frustum onSetupFrustum(Frustum frustum) { - mcpitanlib$contextCache.frustum = frustum; - return frustum; - } - - - @WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldBorderRendering;updateRenderState(Lnet/minecraft/world/border/WorldBorder;FLnet/minecraft/util/math/Vec3d;DLnet/minecraft/client/render/state/WorldBorderRenderState;)V")) - private void mcpitanlib$onWorldBorderExtraction(WorldBorderRendering instance, WorldBorder worldBorder, float tickDelta, Vec3d vec3d, double d, WorldBorderRenderState worldBorderRenderState, Operation original) { - original.call(instance, worldBorder, tickDelta, vec3d, d, worldBorderRenderState); - if (WorldRenderRegistry.isEmptyWorldRenderAfterLevelListeners) return; - - for (WorldRenderContextListener listener : WorldRenderRegistry.worldRenderAfterLevelListeners) { - listener.render(mcpitanlib$contextCache); - } - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java deleted file mode 100644 index 568fa9c5d..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.command.CommandSettings; -import net.pitan76.mcpitanlib.api.command.LiteralCommand; -import net.pitan76.mcpitanlib.api.command.argument.IntegerCommand; -import net.pitan76.mcpitanlib.api.event.IntegerCommandEvent; -import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; - -public class ExampleCommand extends LiteralCommand { - - @Override - public void init(CommandSettings settings) { - addArgumentCommand("item", new LiteralCommand() { - @Override - public void init(CommandSettings settings) { - addArgumentCommand(new IntegerCommand() { - @Override - public void execute(IntegerCommandEvent event) { - try { - event.getPlayer().offerOrDrop(new ItemStack(ExampleMod.EXAMPLE_ITEM.getOrNull(), event.getValue())); - } catch (CommandSyntaxException ignored) { - - } - } - - @Override - public String getArgumentName() { - return "count"; - } - }); - } - - @Override - public void execute(ServerCommandEvent event) { - try { - event.getPlayer().offerOrDrop(new ItemStack(ExampleMod.EXAMPLE_ITEM.getOrNull())); - } catch (CommandSyntaxException ignored) { - - } - } - }); - } - - @Override - public void execute(ServerCommandEvent event) { - System.out.println(event.getInput()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java deleted file mode 100644 index ab182e28c..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.minecraft.inventory.Inventory; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.api.util.InventoryUtil; -import net.pitan76.mcpitanlib.api.util.debug.OutputUtil; -import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; - -public class ExampleContainerGui extends SimpleContainerGui { - - public static Inventory EXAMPLE_INVENTORY = InventoryUtil.createSimpleInventory(1); - - public ExampleContainerGui(CreateMenuEvent e) { - super(ExampleMod.EXAMPLE_CONTAINER_GUI.get(), e); - addPlayerMainInventorySlots(e.playerInventory, 8, 84); - addPlayerHotbarSlots(e.playerInventory, 8, 142); - - addNormalSlot(EXAMPLE_INVENTORY, 0, 24, 24); - } - - @Override - public void close(Player player) { - OutputUtil.print(EXAMPLE_INVENTORY); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java deleted file mode 100644 index 3e6d42413..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; -import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class ExampleContainerGuiScreen extends CompatInventoryScreen { - - public static CompatIdentifier GUI = CompatIdentifier.of("textures/gui/container/blast_furnace.png"); - - public ExampleContainerGuiScreen(ExampleScreenHandler handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - @Override - public CompatIdentifier getCompatTexture() { - return GUI; - } - - @Override - public void initOverride() { - super.initOverride(); - System.out.println("hogehogehoge1111"); - this.addDrawableCTBW(new CompatibleTexturedButtonWidget(0, 0, 30, 30, 0, 0, GUI, (buttonWidget) -> { - System.out.println("hogehoge"); - })); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java deleted file mode 100644 index 7a52d1587..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; -import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; -import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; - -public class ExampleGuiBlock extends CompatBlock implements SimpleScreenHandlerFactory { - - public ExampleGuiBlock(CompatibleBlockSettings settings) { - super(settings); - } - - @Override - public CompatActionResult onRightClick(BlockUseEvent e) { - if (e.isClient()) - e.player.openGuiScreen(this); - - return e.success(); - } - - @Override - public Text getDisplayName(DisplayNameArgs args) { - return getName(); - } - - @Override - public ScreenHandler createMenu(CreateMenuEvent e) { - return new ExampleScreenHandler(e); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java deleted file mode 100644 index 7f3571e0a..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; -import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.item.v2.CompatItem; -import net.pitan76.mcpitanlib.api.util.StackActionResult; -import net.pitan76.mcpitanlib.api.util.TextUtil; - -public class ExampleGuiItem extends CompatItem implements SimpleScreenHandlerFactory { - - public ExampleGuiItem(CompatibleItemSettings settings) { - super(settings); - } - - @Override - public StackActionResult onRightClick(ItemUseEvent e) { - if (!e.isClient()) - e.user.openGuiScreen(this); - - return e.success(); - } - - @Override - public Text getDisplayName(DisplayNameArgs args) { - return TextUtil.literal("Example Title"); - } - - @Override - public ScreenHandler createMenu(CreateMenuEvent e) { - return new ExampleScreenHandler(e); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java deleted file mode 100644 index 0f33c0938..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java +++ /dev/null @@ -1,88 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.CommonModInitializer; -import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; -import net.pitan76.mcpitanlib.api.command.CommandRegistry; -import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; -import net.pitan76.mcpitanlib.api.item.v2.CompatItem; -import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; -import net.pitan76.mcpitanlib.api.simple.item.SimpleGuiItem; -import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; -import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; -import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.api.util.item.ItemUtil; -import net.pitan76.mcpitanlib.guilib.GuiRegistry; -import net.pitan76.mcpitanlib.midohra.item.ItemGroups; - -public class ExampleMod extends CommonModInitializer { - public static final String MOD_ID = "examplemod"; - public static final String MOD_NAME = "ExampleMod"; - - public static ExampleMod INSTANCE; - public static CompatRegistryV2 registry; - - public static SupplierResult> EXAMPLE_SCREENHANDLER; - public static SupplierResult> EXAMPLE_CONTAINER_GUI; - - public static RegistryResult EXAMPLE_ITEM; - public static RegistryResult EXAMPLE_BLOCK; - public static RegistryResult EXAMPLE_BLOCK_ITEM; - public static RegistryResult EXAMPLE_GUI_ITEM; - public static RegistryResult EXAMPLE_CONTAINER_GUI_ITEM; - public static RegistryResult EXAMPLE_GUI_BLOCK; - public static RegistryResult EXAMPLE_GUI_BLOCK_ITEM; - - public static CompatIdentifier EXAMPLE_ITEM_ID = _id("example_item"); - public static CompatIdentifier EXAMPLE_BLOCK_ID = _id("example_block"); - public static CompatIdentifier EXAMPLE_GUI_ITEM_ID = _id("example_gui_item"); - public static CompatIdentifier EXAMPLE_GUI_BLOCK_ID = _id("example_gui_block"); - public static CompatIdentifier EXAMPLE_CONTAINER_GUI_ITEM_ID = _id("example_container_gui_item"); - - - public void init() { - INSTANCE = this; - registry = super.registry; - - // en: Register all items, blocks and others. , ja: 全てのアイテム、ブロック、その他を登録します。 - EXAMPLE_SCREENHANDLER = registry.registerScreenHandlerType(compatId("example_gui"), new SimpleScreenHandlerTypeBuilder<>(ExampleScreenHandler::new)); - EXAMPLE_CONTAINER_GUI = GuiRegistry.register(registry, compatId("example_container_gui"), new SimpleScreenHandlerTypeBuilder<>(ExampleContainerGui::new)); - - EXAMPLE_ITEM = registry.registerItem(EXAMPLE_ITEM_ID, () -> new CompatItem(CompatibleItemSettings.of(EXAMPLE_ITEM_ID).addGroup(ItemGroups.INGREDIENTS))); - EXAMPLE_BLOCK = registry.registerBlock(EXAMPLE_BLOCK_ID, () -> new CompatBlock(CompatibleBlockSettings.of(EXAMPLE_BLOCK_ID, CompatibleMaterial.STONE))); - EXAMPLE_BLOCK_ITEM = registry.registerItem(EXAMPLE_BLOCK_ID, () -> ItemUtil.create(EXAMPLE_BLOCK.supplier.get(), CompatibleItemSettings.of(EXAMPLE_BLOCK_ID).addGroup(ItemGroups.INGREDIENTS))); - - EXAMPLE_GUI_ITEM = registry.registerItem(EXAMPLE_GUI_ITEM_ID, () -> new ExampleGuiItem(CompatibleItemSettings.of(EXAMPLE_GUI_ITEM_ID).addGroup(ItemGroups.INGREDIENTS))); - - EXAMPLE_GUI_BLOCK = registry.registerBlock(EXAMPLE_GUI_BLOCK_ID, () -> new ExampleGuiBlock(CompatibleBlockSettings.of(EXAMPLE_GUI_BLOCK_ID, CompatibleMaterial.STONE))); - EXAMPLE_GUI_BLOCK_ITEM = registry.registerItem(EXAMPLE_GUI_BLOCK_ID, () -> ItemUtil.create(EXAMPLE_GUI_BLOCK.supplier.get(), CompatibleItemSettings.of(EXAMPLE_GUI_BLOCK_ID).addGroup(ItemGroups.INGREDIENTS))); - - EXAMPLE_CONTAINER_GUI_ITEM = registry.registerItem(EXAMPLE_CONTAINER_GUI_ITEM_ID, - () -> new SimpleGuiItem(CompatibleItemSettings.of(EXAMPLE_CONTAINER_GUI_ITEM_ID) - .addGroup(ItemGroups.INGREDIENTS), - ExampleContainerGui::new) - ); - - // en: Register the command , ja: コマンドを登録します - CommandRegistry.register("mpla", new ExampleCommand()); - } - - public static CompatIdentifier _id(String id) { - return CompatIdentifier.of(MOD_ID, id); - } - - @Override - public String getId() { - return MOD_ID; - } - - @Override - public String getName() { - return MOD_NAME; - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java deleted file mode 100644 index aa3b041be..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; -import net.pitan76.mcpitanlib.guilib.GuiRegistry; - -public class ExampleModClient { - public static void init() { - CompatRegistryClient.registerScreen(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_SCREENHANDLER.get(), ExampleScreen::new); - - GuiRegistry.registerSimpleContainerGui(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_CONTAINER_GUI.get()); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java deleted file mode 100644 index 17bd18c72..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; -import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; -import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; - -public class ExampleScreen extends CompatInventoryScreen { - - public static CompatIdentifier GUI = CompatIdentifier.of("textures/gui/container/blast_furnace.png"); - - public ExampleScreen(ExampleScreenHandler handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - @Override - public CompatIdentifier getCompatTexture() { - return GUI; - } - - @Override - public void initOverride() { - super.initOverride(); - System.out.println("hogehogehoge1111"); - this.addDrawableCTBW(new CompatibleTexturedButtonWidget(0, 0, 30, 30, 0, 0, GUI, (buttonWidget) -> { - System.out.println("hogehoge"); - })); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java deleted file mode 100644 index ff99d6ae9..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.pitan76.mcpitanlib.test; - -import net.minecraft.item.ItemStack; -import net.pitan76.mcpitanlib.api.entity.Player; -import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; -import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; - -public class ExampleScreenHandler extends SimpleScreenHandler { - - public ExampleScreenHandler(CreateMenuEvent e) { - super(ExampleMod.EXAMPLE_SCREENHANDLER.get(), e); - - } - - @Override - public ItemStack quickMoveOverride(Player player, int slot) { - return null; - } - - @Override - public boolean canUse(Player player) { - return true; - } -} diff --git a/common/src/main/resources/assets/mplguilib/textures/container/base.png b/common/src/main/resources/assets/mplguilib/textures/container/base.png deleted file mode 100644 index e5fca7df1dcdcaf7beb026735c99d427a7987853..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 802 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6%U;1OBOz`%C|gc+x5^GP!> zFkSI#jVhAMCfcojr4A z-+N=d#{Zvw{6752`Sj!0@eSpw3<7GSXt;&Iom1O#!}~vk)tx;Pl|A=(VMR>G&m9cc zKL6ZPBJiWH_I`TWwX4NPBj_rAkj9gqc{u6{1- HoD!M<`Rb86 diff --git a/common/src/main/resources/assets/mplguilib/textures/container/base_furnace.png b/common/src/main/resources/assets/mplguilib/textures/container/base_furnace.png deleted file mode 100644 index 20a8bd98b0ce4d77ab5f07d0e246e8145127f82f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1637 zcmds1dr;C@6u$hFQZ}&0bu3fawq4sEDm@G<3tyYsini4+vruTa%pR*?Nk)pIV=rGj z%aE>*Y_{2KXh4lsQ$%Q3A;!r-OJxbAp%O&t;e$|w#hq#PZ}-nVGk4BC_sspych7g{ zT;HD%gGTwF008K?*ysZQAe>tSa9iSZq^x^sPUlXIO+F6*=Ff$N;B3UK24IPITy(^t zoZ1O3A3z7<=@c0;z;{itww)4iX#J)- z)}dbHmUh+wLq*_^Jr6pCzf9)c+VJ5LEC#rC6ejV5)g~(Nb3bcffL_n*%AwLg?{DLiD&n@ z?{mWV+}R90au>Af)M{CK$6BRI^*s#xVX;X>J6aI1aBh+}uibx{V~`??)cPQUBs_}j?=OPc$y&^&I$FMeG^%wM%``` zi^VEDbnzub*~(|S$X8$Trd|vn0Lf8?^d*&d(qXqV8@Xq+1TvgWr_)W1dDS9}veWvL zL?94w>=N$NV{pG7abI(z-eoyrsPq!RU@%=Z*9LcInD8w(z=h0>hr!k_f%Yf^P2s>1 z{n4O9;8YN9p&f7H9YpIQ#ba;Wa|avoihba(HY!@zny3vTaCqQ$9{v{e;9~$ zTV+$06?;jD-cY4qX0^gYYfRGS^|ge=5t)Vo9$~5Sd3Puq+tD@^Bq3Ip7b-kzngvFO zruWs=Cu&0lRAXyO-sOCd?W1&Vc65}Sk@w;CXh?I`kVZ4v6H6(Yg<)Z4*MQ#Rtv7~b z$+0{cls$D=W@dc+JdUJ@xo4)*k2v!|z7Ngs4XP#%eht*LYMyIsm@ipZQg05vwTTbi zt8G6jg1hT@LKkJ3{X}wp>Iif0w7px=;ILje ziQBwuSXNhHI^rHaH!Fx^&W>Ac(8yOP!n3x@#L>js7Y+jXT4YVCn5k8m!XMPB+Z{Uj z#Sm^!o3+<8rEaj^5#?J zu+H^#aSW-L^Y-puKj};nwg<+7;sS-tIig)L4b7TCxhh;%mzVL!s`zi_z17C1GVAIy zp=}DXtU)WbefS}Dqib(t#`^=&HyY0R|M+;r_=%0bXn*@>-$irE_s!gB-{rU5xXbcu z)n1L$n<~zozh?N)S+25%+rCdT{CH64)y>D=mhC=jV=pggD8Z9dT>Lrk@rUB5P6_i9 zHoyMXO-cRvX8!#0KkYV;ez+~Z`03YvjjlkSR)-^xXMNQCZ5wv?Yei(7X)S~9hAYqd zJ65dHO4@1MCojdr<}1&{8=3iw;Z~Z3j9yL8;>C+^+`QTO`0?Y_0ypm5*;8s(_o8&} z8I~d=<{6uMp5+@GH`cH?c;C5NGktSY`?u&Xg&#f_aefe9u{$%C?@1!t1*Y$&AA+}E zKk1{u&UitIe{SjY$}ltL69-ityltQI{JE31H=pP1{B}u)?mOkmAKc$x_x=1_i6QF2 zO5g1()UN*d$u>vgexAlQVaBuLJPQ&- zLwm!%e}D8lf4}{X_h0Ht&&ZgWnO&;?uef_^+>y;YICqahX4O_(o z#f@j{o&R@zb5r;2%`L0~Ogk&ME^N5^cW=k!4hvnSM-Q@o|2k8 zxBsYnY_#CrveIM&e&dF=-sNA#3;#V|AAb8-`v2~eXA<6g`up|n=A|_@H^9NU#dGrf zJ^SnSnDe#9KdSkC_G;c^_a<@Ug&REP+to&$vM^cw(VJnu^Nx;=j(@j}+5*q!*jLt9 ze9d~iKkv@=Nk58be?2{2|NFJyKR!O*ob_pwi5x>}q}b;_K@+FHtNHD`W`2$I{Rh@_ z)*Ll2owmQ~jrq;8eSg&+{mtpMnjQN2`6HnPiPz_U+r8s!-2VT^udM#~`|@=`;2n{V=Z8<&h z$F8n}4-}+ zzu4N-68W9UcRfD`msri+`Tz3ws=YsceSLk0eX-v?tJFv{xeiIuxqj(aUVnY2b?N>0 z$9H#^FYL2AzxJ{A)3YB$7=(lwCd^=HIKsl9qQ;8C`;E=?GRqDi>2M-cL z*h{a>biZ6XVXA23l}uMzZ6?#hT@J6dEb0?&ob^zSIFpbpiM$=w7O0*+ciC?RZEdEN zm%FUOShCs>X4~R(5t2Cwe{9~imS?fwIV<1qj$y8$q5nQ+#%#a6Rl$Qfh6(1g8>gP1 zpZ{F%(y`FAtCf+Z8Ev7BSAl+6&18O9l^h?mhk|_oEFK3NP+0t*kzpgF%dxj#c7xpJ M>FVdQ&MBb@07kxbtN;K2 diff --git a/fabric/build.gradle b/fabric/build.gradle deleted file mode 100644 index ba6c830c6..000000000 --- a/fabric/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -plugins { - id "com.github.johnrengelman.shadow" version "8.1.1" -} - -architectury { - platformSetupLoomIde() - fabric() -} - -loom { - accessWidenerPath = project(":common").loom.accessWidenerPath -} - -configurations { - common { - canBeResolved = true - canBeConsumed = false - } - // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. - shadowBundle { - canBeResolved = true - canBeConsumed = false - } - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentFabric.extendsFrom common -} - -dependencies { - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - modCompileOnly "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - // Remove the next line if you don't want to depend on the API - modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" - - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowBundle(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } - - shadowBundle 'org.yaml:snakeyaml:2.0' - - modApi("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") - - modImplementation("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - modImplementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") - include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") -} - -processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } - - project.version = project.version + "-fabric" -} - -shadowJar { - relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" - - exclude "architectury.common.json" - - configurations = [project.configurations.shadowBundle] - archiveClassifier.set "dev-shadow" -} - -remapJar { - injectAccessWidener = true - inputFile.set shadowJar.archiveFile - dependsOn shadowJar - archiveClassifier.set null -} - -jar { - archiveClassifier.set "dev" -} - -sourcesJar { - def commonSources = project(":common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } -} - -components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } -} - -publishing { - publications { - mavenFabric(MavenPublication) { - artifactId = info.archives_base_name + "-" + project.name + "-" + rootProject.minecraft_version - version = info.mod_version - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/PTOM76/maven") - credentials { - username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") - password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") - } - } - } -} - -tasks.runClient.doFirst { - def from = new File("../common/src/main/resources/mcpitanlib.accesswidener") - def to = new File("src/main/resources/mcpitanlib.accesswidener") - to.bytes = from.bytes -} - -tasks.remapJar.doFirst { - if (file("src/main/resources/mcpitanlib.accesswidener").exists()) { - delete file("src/main/resources/mcpitanlib.accesswidener") - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8692e7921..9791843bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.jvmargs=-Xmx3G -minecraft_version=26.1-rc-3 +minecraft_version=26.1 # https://www.curseforge.com/minecraft/mc-mods/architectury-api #architectury_version=19.0.1 @@ -10,9 +10,9 @@ fabric_loader_version=0.18.4 fabric_api_version=0.144.0+26.1 # https://projects.neoforged.net/neoforged/neoforge -neoforge_version=21.11.38-beta +neoforge_version=26.1.0.1-beta -#cloth_config_version=20.0.148 +#cloth_config_version=21.11.153 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.14.2111 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d706aba60..63e0e8303 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-9.1.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mappings/121-1fix.tiny b/mappings/121-1fix.tiny deleted file mode 100644 index 08cb84244..000000000 --- a/mappings/121-1fix.tiny +++ /dev/null @@ -1,5 +0,0 @@ -tiny 2 0 intermediary named -c net/minecraft/class_1496 - m ()Lnet/minecraft/class_1263; method_56680 getInventoryYarn -c net/minecraft/class_329 - m (Lnet/minecraft/class_332;Lnet/minecraft/class_9779;)V method_1759 renderHotbarYarn diff --git a/mappings/yarnpatch.tiny b/mappings/yarnpatch.tiny deleted file mode 100644 index c47c3f32f..000000000 --- a/mappings/yarnpatch.tiny +++ /dev/null @@ -1,3 +0,0 @@ -tiny 2 0 intermediary named -c net/minecraft/class_1927 net/minecraft/world/explosion/Explosion - m ()Lnet/minecraft/class_243; method_55109 getPositionYarn diff --git a/neoforge/build.gradle b/neoforge/build.gradle deleted file mode 100644 index 353f1f55e..000000000 --- a/neoforge/build.gradle +++ /dev/null @@ -1,112 +0,0 @@ -plugins { - id "com.github.johnrengelman.shadow" version "8.1.1" -} -architectury { - platformSetupLoomIde() - neoForge() -} - -loom { - accessWidenerPath = project(":common").loom.accessWidenerPath - - /* - forge { - convertAccessWideners = true - extraAccessWideners.add loom.accessWidenerPath.get().asFile.name - - mixinConfig "mcpitanlib-common.mixins.json" - mixinConfig "mcpitanlib.mixins.json" - } - - */ -} - -configurations { - common - shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentNeoForge.extendsFrom common -} - -dependencies { - neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" - // Remove the next line if you don't want to depend on the API - modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_version}" - - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false } - - shadowCommon 'org.yaml:snakeyaml:2.0' - - include("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.cloth_config_version}") - - include("net.pitan76:compatdatapacks76-neoforge:${rootProject.compatdatapacks76_version}") - include("net.pitan76:legacyitemmodels-neoforge:${rootProject.legacyitemmodels_version}") -} - -processResources { - inputs.property "version", project.version - - filesMatching("META-INF/neoforge.mods.toml") { - expand "version": project.version - } - - project.version = project.version + "-neoforge" -} - -shadowJar { - relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" - - exclude "fabric.mod.json" - exclude "architectury.common.json" - - configurations = [project.configurations.shadowCommon] - archiveClassifier.set "dev-shadow" -} - -remapJar { - inputFile.set shadowJar.archiveFile - dependsOn shadowJar - archiveClassifier.set null - - atAccessWideners.add(loom.accessWidenerPath.get().asFile.name) -} - -jar { - archiveClassifier.set "dev" -} - -sourcesJar { - def commonSources = project(":common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } -} - -components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } -} - -publishing { - publications { - mavenNeoForge(MavenPublication) { - artifactId = info.archives_base_name + "-" + project.name + "-" + rootProject.minecraft_version - version = info.mod_version - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/PTOM76/maven") - credentials { - username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") - password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") - } - } - } -} \ No newline at end of file diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties deleted file mode 100644 index 2914393db..000000000 --- a/neoforge/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -loom.platform=neoforge \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java deleted file mode 100644 index 0ad42f08c..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java +++ /dev/null @@ -1,227 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.neoforge; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.neoforged.neoforge.client.event.ExtractBlockOutlineRenderStateEvent; -import net.neoforged.neoforge.client.event.RenderFrameEvent; -import net.neoforged.neoforge.client.event.RenderLevelStageEvent; -import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineEvent; -import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineListener; -import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContext; -import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContextListener; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; -import org.joml.Matrix4f; - -import java.util.ArrayList; -import java.util.List; - -public class WorldRenderRegistryImpl { - - public static List beforeBlockOutlineListeners = new ArrayList<>(); - public static List worldRenderAfterLevelListeners = new ArrayList<>(); - - public static void renderOutlineEventBlock(ExtractBlockOutlineRenderStateEvent event) { - for (BeforeBlockOutlineListener listener : beforeBlockOutlineListeners) { - boolean eventContinue = listener.beforeBlockOutline(new BeforeBlockOutlineEvent(new WorldRenderContext() { - @Override - public WorldRenderer getWorldRenderer() { - return event.getLevelRenderer(); - } - - @Override - public MatrixStack getMatrixStack() { - return new MatrixStack(); - } - - @Override - public float getTickDelta() { - return ClientUtil.getClient().getRenderTickCounter().getDynamicDeltaTicks(); - } - - @Override - public Camera getCamera() { - return event.getCamera(); - } - - @Override - public GameRenderer getGameRenderer() { - return MinecraftClient.getInstance().gameRenderer; - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); - } - - @Deprecated - @Override - public Matrix4f getProjectionMatrix() { - return null; - } - - @Override - public ClientWorld getWorld() { - return MinecraftClient.getInstance().world; - } - - @Deprecated - @Override - public boolean isAdvancedTranslucency() { - return event.isInTranslucentPass(); - } - - @Override - public VertexConsumerProvider getConsumers() { - return ClientUtil.getClient().getBufferBuilders().getOutlineVertexConsumers(); - } - - @Override - public Frustum getFrustum() { - return event.getLevelRenderer().getCapturedFrustum(); - } - }, event.getLevelRenderState().outlineRenderState)); - - if (!eventContinue) { - event.setCanceled(true); - break; - } - } - } -// -// public static void renderOutlineEvent(RenderHighlightEvent.Entity event) { -// for (BeforeBlockOutlineListener listener : beforeBlockOutlineListeners) { -// listener.beforeBlockOutline(new BeforeBlockOutlineEvent(new WorldRenderContext() { -// @Override -// public WorldRenderer getWorldRenderer() { -// return event.getLevelRenderer(); -// } -// -// @Override -// public MatrixStack getMatrixStack() { -// return event.getPoseStack(); -// } -// -// @Override -// public float getTickDelta() { -// return event.getDeltaTracker().getDynamicDeltaTicks(); -// } -// -// @Override -// public Camera getCamera() { -// return event.getCamera(); -// } -// -// @Override -// public GameRenderer getGameRenderer() { -// return MinecraftClient.getInstance().gameRenderer; -// } -// -// @Override -// public LightmapTextureManager getLightmapTextureManager() { -// return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); -// } -// -// @Deprecated -// @Override -// public Matrix4f getProjectionMatrix() { -// return null; -// } -// -// @Override -// public ClientWorld getWorld() { -// return MinecraftClient.getInstance().world; -// } -// -// @Deprecated -// @Override -// public boolean isAdvancedTranslucency() { -// return event.getLevelRenderer().isTerrainRenderComplete(); -// } -// -// @Override -// public VertexConsumerProvider getConsumers() { -// return event.getMultiBufferSource(); -// } -// -// @Override -// public Frustum getFrustum() { -// return event.getLevelRenderer().getFrustum(); -// } -// }, event.getTarget())); -// } -// } - - public static void renderLevelStageEvent(RenderLevelStageEvent.AfterLevel event) { - for (WorldRenderContextListener listener : worldRenderAfterLevelListeners) { - listener.render(new WorldRenderContext() { - @Override - public WorldRenderer getWorldRenderer() { - return event.getLevelRenderer(); - } - - @Override - public MatrixStack getMatrixStack() { - return event.getPoseStack(); - } - - @Override - public float getTickDelta() { - return event.getLevelRenderer().getTicks(); - } - - @Override - public Camera getCamera() { - return MinecraftClient.getInstance().gameRenderer.getCamera(); - } - - @Override - public GameRenderer getGameRenderer() { - return MinecraftClient.getInstance().gameRenderer; - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); - } - - @Deprecated - @Override - public Matrix4f getProjectionMatrix() { - return event.getModelViewMatrix(); - } - - @Override - public ClientWorld getWorld() { - return MinecraftClient.getInstance().world; - } - - @Deprecated - @Override - public boolean isAdvancedTranslucency() { - return event.getLevelRenderer().isTerrainRenderComplete(); - } - - @Override - public VertexConsumerProvider getConsumers() { - return MinecraftClient.getInstance().getBufferBuilders().getOutlineVertexConsumers(); - } - - @Override - public Frustum getFrustum() { - return event.getLevelRenderer().getCapturedFrustum(); - } - }); - } - } - - public static void _registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { - beforeBlockOutlineListeners.add(listener); - } - - public static void _registerWorldRenderAfterLevel(WorldRenderContextListener listener) { - worldRenderAfterLevelListeners.add(listener); - } -} - diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java deleted file mode 100644 index a639bf61e..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry.neoforge; - -import net.minecraft.block.Block; -import net.minecraft.client.color.block.BlockColorProvider; -import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; - -import java.util.HashMap; -import java.util.Map; - -public class CompatRegistryClientImpl { - - public static Map blockColorProviders = new HashMap<>(); - - public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { - blockColorProviders.put(provider, blocks); - } - - public static void registerBlockColors(RegisterColorHandlersEvent.Block event){ - if (blockColorProviders.isEmpty()) return; - - for (Map.Entry entry : blockColorProviders.entrySet()) { - BlockColorProvider provider = entry.getKey(); - Block[] blocks = entry.getValue(); - - if (blocks == null || blocks.length == 0) { - event.register(provider); - } else { - event.register(provider, blocks); - } - } - } -} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java deleted file mode 100644 index 1d132e365..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile.neoforge; - -import com.mojang.datafixers.types.Type; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; - -public class BlockEntityTypeBuilderImpl { - @Deprecated - public static BlockEntityType build(Type type, BlockEntityTypeBuilder.Factory factory, Block... blocks) { - return new BlockEntityType<>(factory::create, blocks); - } -} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java deleted file mode 100644 index 594c27330..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; - -import net.minecraft.fluid.Fluid; -import net.neoforged.neoforge.fluids.FluidStack; -import net.neoforged.neoforge.transfer.fluid.FluidStacksResourceHandler; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; - -public class FluidStorageUtilImpl { - public static IFluidStorage withFixedCapacity(long capacity, Runnable onChange) { - return new NeoForgeFluidStorage(new FluidStacksResourceHandler(1, (int) capacity), capacity, onChange); - } - - public static IFluidVariant getVariant(Fluid fluid) { - return new NeoForgeFluidVariant(new FluidStack(fluid, 1)); - } -} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java deleted file mode 100644 index 5d9c75a00..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java +++ /dev/null @@ -1,89 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; - -import net.neoforged.neoforge.fluids.FluidStack; -import net.neoforged.neoforge.transfer.fluid.FluidResource; -import net.neoforged.neoforge.transfer.fluid.FluidStacksResourceHandler; -import net.neoforged.neoforge.transfer.transaction.Transaction; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; - -public class NeoForgeFluidStorage implements IFluidStorage { - - public final FluidStacksResourceHandler handler; - public FluidStack fluid = FluidStack.EMPTY; - public long capacity; - - public Runnable onChange; - - public NeoForgeFluidStorage(FluidStacksResourceHandler handler, long capacity, Runnable onChange) { - this.handler = handler; - this.onChange = onChange; - this.capacity = capacity; - } - - @Override - public long getAmount() { - return handler.getAmountFrom(fluid); - } - - @Override - public long getCapacity() { - return capacity; - } - - @Override - public IFluidVariant getResource() { - return new NeoForgeFluidVariant(fluid); - } - - @Override - public void setResource(IFluidVariant variant) { - fluid = ((NeoForgeFluidVariant) variant).raw; - } - - @Override - public boolean isResourceBlank() { - return fluid.isEmpty(); - } - - @Override - public long insert(IFluidVariant variant, long maxAmount, boolean simulate) { - if (simulate) - return handler.insert(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, Transaction.open(null)); - - onChange.run(); - long inserted = 0; - - try (Transaction transaction = Transaction.open(null)) { - inserted += handler.insert(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, transaction); - transaction.commit(); - } - return inserted; - } - - @Override - public long extract(IFluidVariant variant, long maxAmount, boolean simulate) { - if (simulate) - return handler.extract(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, Transaction.open(null)); - - onChange.run(); - long extracted = 0; - try (Transaction transaction = Transaction.open(null)) { - extracted += handler.extract(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, transaction); - transaction.commit(); - } - return extracted; - } - - @Override - public void writeNbt(WriteNbtArgs args) { - handler.serialize(args.view); - } - - @Override - public void readNbt(ReadNbtArgs args) { - handler.deserialize(args.view); - } -} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java deleted file mode 100644 index 8c5e0a995..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; - -import net.minecraft.fluid.Fluid; -import net.neoforged.neoforge.fluids.FluidStack; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; - -public class NeoForgeFluidVariant implements IFluidVariant { - - public final FluidStack raw; - - public NeoForgeFluidVariant() { - this.raw = FluidStack.EMPTY; - } - - public NeoForgeFluidVariant(FluidStack stack) { - this.raw = stack; - } - - @Override - public Fluid getFluid() { - return raw.getFluid(); - } - - @Override - public boolean isBlank() { - return raw.isEmpty(); - } - - @Override - public boolean isSame(Fluid fluid) { - return raw.is(fluid); - } -} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java deleted file mode 100644 index 6be8273a8..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.pitan76.mcpitanlib.api.util.neoforge; - -import net.neoforged.api.distmarker.Dist; -import net.neoforged.fml.ModList; -import net.neoforged.fml.loading.FMLEnvironment; -import net.neoforged.fml.loading.FMLPaths; - -import java.nio.file.Path; - -public class PlatformUtilImpl { - public static boolean isClient() { - return FMLEnvironment.getDist() == Dist.CLIENT; - } - - public static boolean isServer() { - return FMLEnvironment.getDist() == Dist.DEDICATED_SERVER; - } - - public static Path getConfigFolder() { - return FMLPaths.CONFIGDIR.get(); - } - - public static boolean isModLoaded(String id) { - return ModList.get().isLoaded(id); - } -} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java deleted file mode 100644 index 33374d614..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.pitan76.mcpitanlib.neoforge; - -import net.neoforged.bus.api.IEventBus; -import net.neoforged.fml.ModContainer; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.common.NeoForge; -import net.pitan76.mcpitanlib.MCPitanLib; -import net.pitan76.mcpitanlib.api.client.event.neoforge.WorldRenderRegistryImpl; -import net.pitan76.mcpitanlib.api.client.registry.neoforge.CompatRegistryClientImpl; -import net.pitan76.mcpitanlib.api.util.PlatformUtil; - -@Mod(MCPitanLib.MOD_ID) -public class MCPitanLibNeoForge { - public MCPitanLibNeoForge(ModContainer modContainer) { - IEventBus bus = modContainer.getEventBus(); - - if (PlatformUtil.isClient()) { - IEventBus nfBus = NeoForge.EVENT_BUS; - // TODO: re-implement outline rendering event -// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEventBlock); -// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEvent); - nfBus.addListener(WorldRenderRegistryImpl::renderLevelStageEvent); - if (bus != null) - bus.addListener(CompatRegistryClientImpl::registerBlockColors); - } - - MCPitanLib.init(); - } -} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java deleted file mode 100644 index d5ae9a7c4..000000000 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.pitan76.mcpitanlib.neoforge.client; - -import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; - -public class MCPitanLibNeoForgeClient { - public static void clientInit(FMLClientSetupEvent event) { - //if (PlatformUtil.isDevelopmentEnvironment()) - // ExampleModClient.init(); - } -} diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml deleted file mode 100644 index b6d488a0d..000000000 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ /dev/null @@ -1,42 +0,0 @@ -modLoader = "javafml" -loaderVersion = "[1,)" -license = "MIT" -issueTrackerURL = "https://github.com/Pitan76/MCPitanLib/issue" - -[[mods]] -modId = "mcpitanlib" -version = "${version}" -displayName = "MCPitanLib" -displayURL = "https://www.curseforge.com/minecraft/mc-mods/mcpitanlibarch" -logoFile = "icon.png" -authors = "Pitan" -description = ''' -Pitan's Minecraft Mod Library -''' - -[[dependencies.mcpitanlib]] -modId = "neoforge" -type = "required" -versionRange = "[20,)" -ordering = "NONE" -side = "BOTH" - -[[dependencies.mcpitanlib]] -modId = "minecraft" -type = "required" -versionRange = "[1.21,)" -ordering = "NONE" -side = "BOTH" - -[[dependencies.mcpitanlib]] -modId = "architectury" -type = "required" -versionRange = "[19.0.0,)" -ordering = "NONE" -side = "BOTH" - -[[mixins]] -config = "mcpitanlib-common.mixins.json" - -[[mixins]] -config = "mcpitanlib.mixins.json" \ No newline at end of file diff --git a/neoforge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta deleted file mode 100644 index 03e89dcaa..000000000 --- a/neoforge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,8 +0,0 @@ -{ - "pack": { - "description": "mcpitanlib resources", - "pack_format": 8, - "forge:resource_pack_format": 8, - "forge:data_pack_format": 9 - } -} diff --git a/settings.gradle b/settings.gradle index cd6bd15df..bae4a571d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,15 +1,9 @@ pluginManagement { repositories { maven { url "https://maven.fabricmc.net/" } - maven { url "https://maven.architectury.dev/" } - maven { url "https://maven.minecraftforge.net/" } +// maven { url "https://maven.architectury.dev/" } +// maven { url "https://maven.minecraftforge.net/" } maven { url "https://maven.pitan76.net/" } gradlePluginPortal() } } - -include("common") -if (fabricEnabled.toBoolean()) - include("fabric") -if (neoforgeEnabled.toBoolean()) - include("neoforge") diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java b/src/main/java/net/pitan76/fabric/ExtendModInitializer.java similarity index 97% rename from fabric/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java rename to src/main/java/net/pitan76/fabric/ExtendModInitializer.java index e0244894c..f9c5389a6 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java +++ b/src/main/java/net/pitan76/fabric/ExtendModInitializer.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.fabric; import net.fabricmc.api.ModInitializer; -import net.minecraft.util.Identifier; +import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.IdentifierUtil; diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java b/src/main/java/net/pitan76/fabric/MCPitanLibFabric.java similarity index 91% rename from fabric/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java rename to src/main/java/net/pitan76/fabric/MCPitanLibFabric.java index 939cd37a0..e491a3dbc 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java +++ b/src/main/java/net/pitan76/fabric/MCPitanLibFabric.java @@ -1,4 +1,4 @@ -package net.pitan76.mcpitanlib.fabric; +package net.pitan76.mcpitanlib; import net.fabricmc.api.ModInitializer; import net.pitan76.mcpitanlib.MCPitanLib; diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/mixin/RecipeMixin.java b/src/main/java/net/pitan76/fabric/mixin/RecipeMixin.java similarity index 94% rename from fabric/src/main/java/net/pitan76/mcpitanlib/fabric/mixin/RecipeMixin.java rename to src/main/java/net/pitan76/fabric/mixin/RecipeMixin.java index 13ecb0947..0b86fecfc 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/mixin/RecipeMixin.java +++ b/src/main/java/net/pitan76/fabric/mixin/RecipeMixin.java @@ -4,6 +4,7 @@ import net.minecraft.recipe.input.RecipeInput; import org.spongepowered.asm.mixin.Mixin; +// TODO(Ravel): can not resolve target class Recipe @Mixin(Recipe.class) public interface RecipeMixin { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java new file mode 100644 index 000000000..15de7ac95 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.client.registry.fabric; + +import dev.architectury.registry.client.gui.MenuScreenRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; +import net.minecraft.block.Block; +import net.minecraft.client.color.block.BlockColorProvider; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; + +public class CompatRegistryClientImpl { + public static > void registerScreen(String modId, ScreenHandlerType type, CompatRegistryClient.ScreenFactory factory) { + MenuScreenRegistry.registerScreenFactory(type, factory::create); + } + + public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { + if (blocks == null || blocks.length == 0) { + ColorProviderRegistry.BLOCK.register(provider); + } else { + ColorProviderRegistry.BLOCK.register(provider, blocks); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java new file mode 100644 index 000000000..0d85026f5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java @@ -0,0 +1,99 @@ +package net.pitan76.mcpitanlib.api.extra.transfer.util; + +import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; +import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; +import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; +import net.minecraft.fluid.FluidState; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; + +public class FluidStorageUtil { + public static SingleFluidStorage withFixedCapacity(long capacity, Runnable onChange) { + return SingleFluidStorage.withFixedCapacity(capacity, onChange); + } + + public static void readNbt(SingleFluidStorage storage, NbtRWArgs args) { + if (args instanceof ReadNbtArgs) + storage.readData(((ReadNbtArgs) args).view); + } + + public static void writeNbt(SingleFluidStorage storage, NbtRWArgs args) { + if (args instanceof WriteNbtArgs) + storage.writeData(((WriteNbtArgs) args).view); + } + + public static void readNbt(SingleFluidStorage storage, NbtCompound nbt, CompatRegistryLookup registryLookup) { + storage.readData(NbtDataConverter.nbt2readData(nbt, registryLookup)); + } + + public static void writeNbt(SingleFluidStorage storage, NbtCompound nbt, CompatRegistryLookup registryLookup) { + storage.writeData(NbtDataConverter.nbt2writeData(nbt, registryLookup)); + } + + /** + * @deprecated Use {@link #readNbt(SingleFluidStorage, NbtRWArgs)} instead + */ + @Deprecated + public static void readNbt(SingleFluidStorage storage, NbtCompound nbt, World world) { + readNbt(storage, nbt, new CompatRegistryLookup(world.getRegistryManager())); + } + + /** + * @deprecated Use {@link #writeNbt(SingleFluidStorage, NbtRWArgs)} instead + */ + @Deprecated + public static void writeNbt(SingleFluidStorage storage, NbtCompound nbt, World world) { + writeNbt(storage, nbt, new CompatRegistryLookup(world.getRegistryManager())); + } + + public static long getAmount(SingleFluidStorage storage) { + return storage.getAmount(); + } + + public static long getCapacity(SingleFluidStorage storage) { + return storage.getCapacity(); + } + + public static FluidVariant getResource(SingleFluidStorage storage) { + return storage.getResource(); + } + + public static boolean isResourceBlank(SingleFluidStorage storage) { + return storage.isResourceBlank(); + } + + public static long insert(SingleFluidStorage storage, FluidVariant insertedVariant, long maxAmount, Transaction transaction) { + return storage.insert(insertedVariant, maxAmount, transaction); + } + + public static long extract(SingleFluidStorage storage, FluidVariant extractedVariant, long maxAmount, Transaction transaction) { + return storage.extract(extractedVariant, maxAmount, transaction); + } + + public static void insert(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { + try (Transaction transaction = Transaction.openOuter()) { + insert(storage, FluidVariant.of(fluidState.getFluid()), maxAmount, transaction); + transaction.commit(); + } + } + + public static void extract(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { + try (Transaction transaction = Transaction.openOuter()) { + extract(storage, FluidVariant.of(fluidState.getFluid()), maxAmount, transaction); + transaction.commit(); + } + } + + public static boolean isEmpty(SingleFluidStorage storage) { + return getAmount(storage) == 0; + } + + public static boolean isFull(SingleFluidStorage storage) { + return getAmount(storage) >= getCapacity(storage); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java new file mode 100644 index 000000000..9f5e6d946 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java @@ -0,0 +1,56 @@ +package net.pitan76.mcpitanlib.api.lookup.block; + +import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Direction; +import net.pitan76.mcpitanlib.midohra.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.function.BiFunction; + +public class BlockApiLookupWithDirection extends BlockApiLookupWrapper { + + public BlockApiLookupWithDirection(BlockApiLookup<@NotNull A, net.minecraft.util.math.Direction> lookup) { + super(lookup); + } + + @Deprecated + public static BlockApiLookupWrapper of(BlockApiLookup<@NotNull A, C> lookup) { + return new BlockApiLookupWrapper<>(lookup); + } + + public static BlockApiLookupWithDirection ofDir(BlockApiLookup<@NotNull A, net.minecraft.util.math.Direction> lookup) { + return new BlockApiLookupWithDirection<>(lookup); + } + + public @Nullable A find(World world, BlockPos pos, Direction direction) { + return super.find(world, pos, direction.toMinecraft()); + } + + public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntity blockEntity, Direction direction) { + return super.find(world, pos, state, blockEntity, direction.toMinecraft()); + } + + public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntityWrapper blockEntity, Direction direction) { + return super.find(world, pos, state, blockEntity, direction.toMinecraft()); + } + + public void registerForBlockEntityM(BiFunction provider, BlockEntityType blockEntityType) { + super.registerForBlockEntity((blockEntity, direction) -> provider.apply(blockEntity, Direction.of(direction)), blockEntityType); + } + + @Deprecated + public void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { + super.registerForBlockEntity(provider, blockEntityType); + } + + public void registerForBlockEntityWrapperM(BiFunction provider, BlockEntityTypeWrapper blockEntityType) { + super.registerForBlockEntityWrapper((blockEntity, direction) -> provider.apply(blockEntity, Direction.of(direction)), blockEntityType); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java new file mode 100644 index 000000000..0651be594 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.api.lookup.block; + +import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.World; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.function.BiFunction; + +public class BlockApiLookupWrapper { + + private final BlockApiLookup<@NotNull A, C> lookup; + + public BlockApiLookupWrapper(BlockApiLookup<@NotNull A, C> lookup) { + this.lookup = lookup; + } + + public BlockApiLookup<@NotNull A, C> getRaw() { + return lookup; + } + + public static BlockApiLookupWrapper of(BlockApiLookup<@NotNull A, C> lookup) { + return new BlockApiLookupWrapper<>(lookup); + } + + public @Nullable A find(World world, BlockPos pos, C context) { + return lookup.find(world.getRaw(), pos.toMinecraft(), context); + } + + public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntity blockEntity, C context) { + return lookup.find(world.getRaw(), pos.toMinecraft(), state.toMinecraft(), blockEntity, context); + } + + public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntityWrapper blockEntity, C context) { + return lookup.find(world.getRaw(), pos.toMinecraft(), state.toMinecraft(), blockEntity.get(), context); + } + + public void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { + lookup.registerForBlockEntity(provider, blockEntityType); + } + + public void registerForBlockEntityWrapper(BiFunction provider, BlockEntityTypeWrapper blockEntityWrapperType) { + lookup.registerForBlockEntity((blockEntity, context) -> + provider.apply(BlockEntityWrapper.of(blockEntity), context), blockEntityWrapperType.get()); + } + + public CompatIdentifier getId() { + return CompatIdentifier.fromMinecraft(lookup.getId()); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java new file mode 100644 index 000000000..94bf987ba --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.tile; + +import net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity; +import org.jetbrains.annotations.Nullable; + +public interface RenderAttachmentBlockEntity extends RenderDataBlockEntity { + + @Override + @Nullable + @Deprecated + default Object getRenderData() { + return getCompatRenderData(); + } + + default boolean hasCompatRenderData() { + return getCompatRenderData() != null; + } + + @Nullable + Object getCompatRenderData(); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java new file mode 100644 index 000000000..c42266ec7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java @@ -0,0 +1,79 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric; + +import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; +import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; + +public class FabricFluidStorage implements IFluidStorage { + + public final SingleFluidStorage storage; + + public FabricFluidStorage(SingleFluidStorage storage) { + this.storage = storage; + } + + @Override + public long getAmount() { + return storage.getAmount(); + } + + @Override + public long getCapacity() { + return storage.getCapacity(); + } + + @Override + public IFluidVariant getResource() { + return new FabricFluidVariant(storage.getResource()); + } + + @Override + public void setResource(IFluidVariant variant) { + storage.variant = ((FabricFluidVariant) variant).raw; + } + + @Override + public boolean isResourceBlank() { + return storage.isResourceBlank(); + } + + @Override + public long insert(IFluidVariant variant, long maxAmount, boolean simulate) { + if (simulate) + return storage.insert(((FabricFluidVariant) variant).raw, maxAmount, Transaction.openOuter()); + + long inserted = 0; + try (Transaction transaction = Transaction.openOuter()) { + inserted += storage.insert(((FabricFluidVariant) variant).raw, maxAmount, transaction); + transaction.commit(); + } + return inserted; + } + + @Override + public long extract(IFluidVariant variant, long maxAmount, boolean simulate) { + if (simulate) + return storage.extract(((FabricFluidVariant) variant).raw, maxAmount, Transaction.openOuter()); + + long extracted = 0; + try (Transaction transaction = Transaction.openOuter()) { + extracted += storage.extract(((FabricFluidVariant) variant).raw, maxAmount, transaction); + transaction.commit(); + } + return extracted; + } + + @Override + public void writeNbt(WriteNbtArgs args) { + storage.writeData(args.view); + } + + @Override + public void readNbt(ReadNbtArgs args) { + storage.readData(args.view); + + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java new file mode 100644 index 000000000..fe003ced9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java @@ -0,0 +1,33 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric; + +import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; +import net.minecraft.fluid.Fluid; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; + +public class FabricFluidVariant implements IFluidVariant { + + public final FluidVariant raw; + + public FabricFluidVariant() { + this.raw = FluidVariant.blank(); + } + + public FabricFluidVariant(FluidVariant variant) { + this.raw = variant; + } + + @Override + public Fluid getFluid() { + return raw.getFluid(); + } + + @Override + public boolean isBlank() { + return raw.isBlank(); + } + + @Override + public boolean isSame(Fluid fluid) { + return raw.isOf(fluid); + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..43d653478 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,42 @@ +{ + "schemaVersion": 1, + "id": "mcpitanlib", + "version": "${version}", + "name": "MCPitanLib", + "description": "Pitan's Minecraft Mod Library", + "authors": [ + "Pitan" + ], + "contact": { + "website": "https://www.curseforge.com/minecraft/mc-mods/mcpitanlibarch", + "repo": "https://github.com/Pitan76/MCPitanLib", + "issues": "https://github.com/Pitan76/MCPitanLib/issue" + }, + "license": "MIT", + "icon": "icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "net.pitan76.mcpitanlib.fabric.MCPitanLibFabric" + ] + }, + "provides": [ + "mcpitanlibarch", + "mcpitanlib-impl" + ], + "custom": { + "modmenu": { + "badges": ["library"] + } + }, + "mixins": [ + "mcpitanlib.mixins.json", + "mcpitanlib-common.mixins.json" + ], + "accessWidener": "mcpitanlib.accesswidener", + "depends": { + "minecraft": ">1.21.10", + "fabricloader": "*", + "architectury": "*" + } +} diff --git a/common/src/main/resources/icon.png b/src/main/resources/icon.png similarity index 100% rename from common/src/main/resources/icon.png rename to src/main/resources/icon.png diff --git a/common/src/main/resources/mcpitanlib-common.mixins.json b/src/main/resources/mcpitanlib-common.mixins.json similarity index 100% rename from common/src/main/resources/mcpitanlib-common.mixins.json rename to src/main/resources/mcpitanlib-common.mixins.json diff --git a/common/src/main/resources/mcpitanlib.accesswidener b/src/main/resources/mcpitanlib.accesswidener similarity index 100% rename from common/src/main/resources/mcpitanlib.accesswidener rename to src/main/resources/mcpitanlib.accesswidener diff --git a/neoforge/src/main/resources/mcpitanlib.mixins.json b/src/main/resources/mcpitanlib.mixins.json similarity index 70% rename from neoforge/src/main/resources/mcpitanlib.mixins.json rename to src/main/resources/mcpitanlib.mixins.json index df01c3ab5..0a36c5829 100644 --- a/neoforge/src/main/resources/mcpitanlib.mixins.json +++ b/src/main/resources/mcpitanlib.mixins.json @@ -1,9 +1,10 @@ { "required": true, "minVersion": "0.8", - "package": "net.pitan76.mcpitanlib.forge.mixin", + "package": "net.pitan76.mcpitanlib.fabric.mixin", "compatibilityLevel": "JAVA_8", "mixins": [ + "RecipeMixin" ], "client": [ ], From f03cc4069e65f636604e7e5110d170c3eb8a715e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 09:18:14 +0900 Subject: [PATCH 008/151] port to 26.1 --- common/build.gradle | 37 + fabric/build.gradle | 129 ++ .../java/net/pitan76/easyapi/FileControl.java | 173 ++ .../net/pitan76/easyapi/config/Config.java | 456 +++++ .../net/pitan76/easyapi/config/IConfig.java | 37 + .../pitan76/easyapi/config/JsonConfig.java | 102 ++ .../pitan76/easyapi/config/YamlConfig.java | 114 ++ .../pitan76/easyapi/config/package-info.java | 4 + .../net/pitan76/mcpitanlib/MCPitanLib.java | 127 ++ .../mcpitanlib/api/CommonModInitializer.java | 66 + .../api/block/BlockItemByExtendBlock1215.java | 36 + .../api/block/CompatBlockRenderType.java | 25 + .../mcpitanlib/api/block/CompatBlocks.java | 96 + .../api/block/CompatChestBlock.java | 47 + .../api/block/CompatPillarBlock.java | 80 + .../mcpitanlib/api/block/CompatSlabBlock.java | 100 + .../api/block/CompatStairsBlock.java | 129 ++ .../api/block/CompatWaterloggable.java | 21 + .../api/block/CompatibleBlockSettings.java | 253 +++ .../api/block/CompatibleMaterial.java | 206 +++ .../mcpitanlib/api/block/ExtendBlock.java | 369 ++++ .../api/block/ExtendBlockEntityProvider.java | 79 + .../api/block/ExtendBlockProvider.java | 161 ++ .../api/block/args/RenderTypeArgs.java | 21 + .../mcpitanlib/api/block/args/RotateArgs.java | 38 + .../api/block/args/SideInvisibleArgs.java | 46 + .../api/block/args/v2/CanPlaceAtArgs.java | 54 + .../block/args/v2/CollisionShapeEvent.java | 17 + .../args/v2/GetComparatorOutputArgs.java | 60 + .../args/v2/HasComparatorOutputArgs.java | 16 + .../api/block/args/v2/OutlineShapeEvent.java | 64 + .../api/block/args/v2/PlacementStateArgs.java | 175 ++ .../args/v2/StateForNeighborUpdateArgs.java | 109 ++ .../api/block/v2/BlockSettingsBuilder.java | 170 ++ .../mcpitanlib/api/block/v2/CompatBlock.java | 179 ++ .../api/block/v2/CompatBlockProvider.java | 91 + .../api/block/v2/CompatStairsBlock.java | 69 + .../api/block/v2/CompatibleBlockSettings.java | 292 +++ .../api/client/CompatInventoryScreen.java | 22 + .../api/client/SimpleHandledScreen.java | 317 ++++ .../api/client/SimpleInventoryScreen.java | 39 + .../api/client/SimpleOptionsScreen.java | 27 + .../mcpitanlib/api/client/SimpleScreen.java | 191 ++ .../api/client/color/BlockColorEvent.java | 87 + .../color/CompatBlockColorProvider.java | 15 + .../api/client/event/ItemTooltipRegistry.java | 10 + .../api/client/event/WorldRenderRegistry.java | 160 ++ .../listener/BeforeBlockOutlineEvent.java | 122 ++ .../listener/BeforeBlockOutlineListener.java | 11 + .../event/listener/ItemTooltipContext.java | 68 + .../event/listener/ItemTooltipListener.java | 17 + .../event/listener/WorldRenderContext.java | 140 ++ .../listener/WorldRenderContextImpl.java | 113 ++ .../listener/WorldRenderContextListener.java | 10 + .../gui/screen/CompatInventoryScreen.java | 33 + .../api/client/gui/screen/ScreenTexts.java | 21 + .../gui/screen/SimpleHandledScreen.java | 364 ++++ .../gui/screen/SimpleInventoryScreen.java | 38 + .../gui/widget/CompatTextFieldWidget.java | 145 ++ .../CompatibleTexturedButtonWidget.java | 74 + .../RedrawableTexturedButtonWidget.java | 51 + .../client/gui/widget/SimpleListWidget.java | 114 ++ .../client/gui/widget/SimpleSliderWidget.java | 82 + .../api/client/option/CompatKeyBinding.java | 78 + .../api/client/option/GameOptionsWrapper.java | 19 + .../api/client/option/KeyCodes.java | 127 ++ .../client/registry/ArchRegistryClient.java | 189 ++ .../client/registry/CompatRegistryClient.java | 281 +++ .../registry/EntityRendererRegistry.java | 13 + .../client/registry/KeybindingRegistry.java | 38 + .../registry/v2/KeybindingRegistry.java | 24 + .../registry/v3/KeybindingRegistry.java | 37 + .../api/client/render/CompatRenderLayer.java | 46 + .../api/client/render/DrawObjectDM.java | 101 + .../api/client/render/DrawObjectMV.java | 119 ++ .../render/EntityModelLayerContext.java | 27 + .../entity/CompatBlockEntityRenderer.java | 45 + .../entity/event/BlockEntityRenderEvent.java | 200 ++ ...ompatBlockEntityRendererConstructArgs.java | 16 + .../entity/v2/CompatBlockEntityRenderer.java | 25 + .../handledscreen/DrawBackgroundArgs.java | 48 + .../handledscreen/DrawForegroundArgs.java | 38 + .../DrawMouseoverTooltipArgs.java | 38 + .../render/handledscreen/KeyEventArgs.java | 35 + .../render/handledscreen/RenderArgs.java | 48 + .../screen/RenderBackgroundTextureArgs.java | 34 + .../api/command/AbstractCommand.java | 47 + .../api/command/CommandRegistry.java | 125 ++ .../api/command/CommandSettings.java | 43 + .../mcpitanlib/api/command/ConfigCommand.java | 173 ++ .../api/command/LiteralCommand.java | 7 + .../api/command/argument/BlockCommand.java | 21 + .../api/command/argument/BooleanCommand.java | 19 + .../api/command/argument/DoubleCommand.java | 19 + .../api/command/argument/EntitiesCommand.java | 20 + .../api/command/argument/EntityCommand.java | 20 + .../api/command/argument/FloatCommand.java | 19 + .../command/argument/GreedyStringCommand.java | 10 + .../api/command/argument/IntegerCommand.java | 19 + .../api/command/argument/ItemCommand.java | 21 + .../api/command/argument/LongCommand.java | 19 + .../api/command/argument/PlayerCommand.java | 20 + .../api/command/argument/PlayersCommand.java | 20 + .../api/command/argument/RequiredCommand.java | 10 + .../api/command/argument/StringCommand.java | 19 + .../api/datafixer/ItemStackFixer.java | 52 + .../api/enchantment/CompatEnchantment.java | 69 + .../api/entity/CompatContainerUser.java | 34 + .../mcpitanlib/api/entity/CompatEntity.java | 135 ++ .../api/entity/CompatThrownItemEntity.java | 159 ++ .../api/entity/EntityTypeBuilder.java | 133 ++ .../mcpitanlib/api/entity/ExtendEntity.java | 102 ++ .../api/entity/ExtendEntityType.java | 41 + .../pitan76/mcpitanlib/api/entity/Player.java | 547 ++++++ .../attribute/AttrModifierOperation.java | 54 + .../AttributeModifiersComponentBuilder.java | 26 + .../CompatAttributeModifierSlot.java | 64 + .../CompatAttributeModifiersComponent.java | 34 + .../attribute/CompatEntityAttribute.java | 49 + .../CompatEntityAttributeInstance.java | 70 + .../CompatEntityAttributeModifier.java | 57 + .../attribute/CompatEntityAttributes.java | 28 + .../api/entity/effect/CompatStatusEffect.java | 62 + .../effect/CompatStatusEffectInstance.java | 74 + .../mcpitanlib/api/event/BaseEvent.java | 4 + .../api/event/BlockCommandEvent.java | 11 + .../api/event/BooleanCommandEvent.java | 10 + .../mcpitanlib/api/event/CommandEvent.java | 38 + .../api/event/DoubleCommandEvent.java | 10 + .../api/event/EntitiesCommandEvent.java | 16 + .../api/event/EntityCommandEvent.java | 16 + .../api/event/FloatCommandEvent.java | 10 + .../api/event/IntegerCommandEvent.java | 10 + .../api/event/ItemCommandEvent.java | 11 + .../api/event/LongCommandEvent.java | 10 + .../api/event/PlayerCommandEvent.java | 16 + .../api/event/PlayersCommandEvent.java | 16 + .../api/event/RequiredCommandEvent.java | 5 + .../api/event/ServerCommandEvent.java | 134 ++ .../api/event/StringCommandEvent.java | 10 + .../api/event/block/AppendPropertiesArgs.java | 35 + .../api/event/block/BlockBreakEvent.java | 79 + .../api/event/block/BlockBreakStartEvent.java | 61 + .../api/event/block/BlockPlacedEvent.java | 82 + .../event/block/BlockScheduledTickEvent.java | 50 + .../api/event/block/BlockUseEvent.java | 143 ++ .../event/block/CanPathfindThroughArgs.java | 50 + .../api/event/block/CollisionShapeEvent.java | 13 + .../api/event/block/DroppedStacksArgs.java | 30 + .../api/event/block/EntityCollisionEvent.java | 112 ++ .../api/event/block/FluidStateArgs.java | 19 + .../api/event/block/ItemScattererUtil.java | 50 + .../api/event/block/NeighborUpdateEvent.java | 98 + .../api/event/block/OutlineShapeEvent.java | 63 + .../api/event/block/PickStackEvent.java | 93 + .../api/event/block/PlacementStateArgs.java | 125 ++ .../event/block/ScreenHandlerCreateEvent.java | 56 + .../api/event/block/ShapesForStatesArgs.java | 22 + .../block/StateForNeighborUpdateArgs.java | 86 + .../api/event/block/StateReplacedEvent.java | 132 ++ .../api/event/block/TileCreateEvent.java | 66 + .../event/block/result/BlockBreakResult.java | 15 + .../container/factory/DisplayNameArgs.java | 9 + .../container/factory/ExtraDataArgs.java | 55 + .../api/event/entity/CollisionEvent.java | 34 + .../api/event/entity/EntityHitEvent.java | 26 + .../api/event/entity/InitDataTrackerArgs.java | 47 + .../api/event/item/BonusAttackDamageArgs.java | 29 + .../api/event/item/CanMineArgs.java | 76 + .../api/event/item/CanRepairArgs.java | 22 + .../mcpitanlib/api/event/item/CraftEvent.java | 48 + .../api/event/item/EnchantabilityArgs.java | 7 + .../api/event/item/EnchantableArgs.java | 16 + .../api/event/item/InventoryTickEvent.java | 81 + .../event/item/ItemAppendTooltipEvent.java | 100 + .../api/event/item/ItemBarColorArgs.java | 16 + .../api/event/item/ItemBarStepArgs.java | 16 + .../api/event/item/ItemBarVisibleArgs.java | 16 + .../api/event/item/ItemFinishUsingEvent.java | 52 + .../api/event/item/ItemUseEvent.java | 124 ++ .../api/event/item/ItemUseOnBlockEvent.java | 158 ++ .../api/event/item/ItemUseOnEntityEvent.java | 85 + .../api/event/item/PostHitEvent.java | 39 + .../api/event/item/PostMineEvent.java | 118 ++ .../mcpitanlib/api/event/nbt/NbtRWArgs.java | 64 + .../mcpitanlib/api/event/nbt/ReadNbtArgs.java | 60 + .../api/event/nbt/WriteNbtArgs.java | 57 + .../api/event/result/EventResult.java | 48 + .../api/event/result/TypedEventResult.java | 60 + .../api/event/tile/TileTickEvent.java | 92 + .../event/v0/AttackEntityEventRegistry.java | 26 + .../api/event/v0/ClientTickEventRegistry.java | 35 + .../api/event/v0/EventRegistry.java | 87 + .../event/v0/InteractionEventRegistry.java | 80 + .../api/event/v0/LivingHurtEventRegistry.java | 21 + .../api/event/v0/event/ClickBlockEvent.java | 78 + .../event/v0/event/ItemStackActionEvent.java | 34 + .../api/event/v0/event/LivingHurtEvent.java | 83 + .../event/v0/event/RecipeManagerEvent.java | 59 + .../event/v0/event/ServerConnectionEvent.java | 15 + .../event/v1/AttackEntityEventRegistry.java | 26 + .../api/event/v1/BlockEventRegistry.java | 26 + .../api/event/v1/LivingHurtEventRegistry.java | 23 + .../api/event/v1/RecipeManagerRegistry.java | 19 + .../api/event/v1/event/AttackEntityEvent.java | 73 + .../api/event/v1/listener/BlockBreakTask.java | 9 + .../event/v1/listener/BlockPlacedTask.java | 8 + .../api/event/v2/AbstractEvent.java | 18 + .../api/event/v2/BlockEventRegistry.java | 25 + .../api/event/v2/ItemEventRegistry.java | 7 + .../mcpitanlib/api/event/v2/OrderedEvent.java | 167 ++ .../event/v2/listener/InventoryTickTask.java | 8 + .../mcpitanlib/api/gen/OreRegistry.java | 42 + .../ExtendedNamedScreenHandlerFactory.java | 46 + .../api/gui/ExtendedScreenHandler.java | 15 + .../api/gui/ExtendedScreenHandlerFactory.java | 24 + .../gui/ExtendedScreenHandlerTypeBuilder.java | 40 + .../api/gui/SimpleScreenHandler.java | 276 +++ .../gui/SimpleScreenHandlerTypeBuilder.java | 39 + .../api/gui/args/CreateMenuEvent.java | 58 + .../api/gui/args/SlotClickEvent.java | 67 + .../api/gui/inventory/IInventory.java | 77 + .../sided/ChestStyleSidedInventory.java | 10 + .../inventory/sided/CompatSidedInventory.java | 35 + .../sided/VanillaStyleSidedInventory.java | 20 + .../sided/args/AvailableSlotsArgs.java | 38 + .../inventory/sided/args/CanExtractArgs.java | 32 + .../inventory/sided/args/CanInsertArgs.java | 35 + .../api/gui/slot/CompatSlotActionType.java | 50 + .../api/gui/slot/CompatibleSlot.java | 125 ++ .../gui/v2/ExtendedScreenHandlerFactory.java | 17 + .../gui/v2/SimpleScreenHandlerFactory.java | 25 + .../mcpitanlib/api/helper/SimpleRegister.java | 69 + .../api/item/ArmorEquipmentType.java | 75 + .../api/item/CompatFoodComponent.java | 120 ++ .../mcpitanlib/api/item/CompatItems.java | 69 + .../api/item/CompatibleArmorItem.java | 41 + .../api/item/CompatibleArmorMaterial.java | 64 + .../api/item/CompatibleItemSettings.java | 111 ++ .../api/item/CreativeTabBuilder.java | 112 ++ .../api/item/CreativeTabManager.java | 112 ++ .../api/item/DefaultItemGroups.java | 28 + .../mcpitanlib/api/item/ExtendBlockItem.java | 138 ++ .../mcpitanlib/api/item/ExtendItem.java | 262 +++ .../api/item/ExtendItemProvider.java | 136 ++ .../mcpitanlib/api/item/ExtendSettings.java | 34 + .../api/item/FixedRecipeRemainderItem.java | 7 + .../pitan76/mcpitanlib/api/item/FoodItem.java | 28 + .../mcpitanlib/api/item/args/RarityArgs.java | 19 + .../api/item/args/StoppedUsingArgs.java | 80 + .../api/item/args/UseActionArgs.java | 27 + .../api/item/consume/CompatUseAction.java | 45 + .../item/equipment/CompatEquipmentAsset.java | 50 + .../equipment/CompatEquippableComponent.java | 36 + .../equipment/EquippableComponentBuilder.java | 94 + .../mcpitanlib/api/item/stack/LoreUtil.java | 46 + .../api/item/tool/CompatibleAxeItem.java | 90 + .../api/item/tool/CompatibleHoeItem.java | 90 + .../item/tool/CompatibleMiningToolItem.java | 125 ++ .../api/item/tool/CompatiblePickaxeItem.java | 90 + .../api/item/tool/CompatibleShearsItem.java | 89 + .../api/item/tool/CompatibleShovelItem.java | 90 + .../api/item/tool/CompatibleSwordItem.java | 90 + .../api/item/tool/CompatibleToolItem.java | 86 + .../api/item/tool/CompatibleToolMaterial.java | 85 + .../api/item/v2/CompatArmorMaterial.java | 25 + .../mcpitanlib/api/item/v2/CompatItem.java | 103 ++ .../api/item/v2/CompatItemProvider.java | 48 + .../api/item/v2/CompatibleItemSettings.java | 202 ++ .../api/item/v2/ExtendBlockItem.java | 75 + .../api/item/v2/ItemSettingsBuilder.java | 153 ++ .../api/item/v3/CompatArmorMaterial.java | 16 + .../api/item/v3/CompatToolMaterial.java | 16 + .../item/v3/VanillaCompatToolMaterial.java | 72 + .../pitan76/mcpitanlib/api/nbt/NbtTag.java | 102 ++ .../mcpitanlib/api/nbt/NbtTypeBytes.java | 20 + .../api/network/ClientNetworking.java | 61 + .../api/network/PacketByteUtil.java | 259 +++ .../api/network/ServerNetworking.java | 65 + .../api/network/v2/ClientNetworking.java | 29 + .../api/network/v2/ServerNetworking.java | 97 + .../network/v2/args/ClientReceiveEvent.java | 50 + .../network/v2/args/ServerReceiveEvent.java | 59 + .../api/offlineplayer/OfflinePlayer.java | 37 + .../offlineplayer/OfflinePlayerManager.java | 229 +++ .../api/packet/UpdatePacketType.java | 26 + .../api/recipe/CompatRecipeType.java | 57 + .../api/recipe/CompatibleRecipeEntry.java | 76 + .../mcpitanlib/api/recipe/MatchGetter.java | 14 + .../api/recipe/input/CompatRecipeInput.java | 32 + .../api/recipe/v2/CompatRecipeEntry.java | 76 + .../api/recipe/v2/CompatRecipeNonEntry.java | 25 + .../api/recipe/v3/CompatRecipe.java | 87 + .../api/registry/CompatRegistry.java | 191 ++ .../api/registry/CompatRegistryLookup.java | 42 + .../mcpitanlib/api/registry/FuelRegistry.java | 31 + .../api/registry/WorldGenRegistry.java | 107 ++ .../api/registry/result/RegistryResult.java | 31 + .../api/registry/result/SupplierResult.java | 52 + .../api/registry/v2/CompatRegistryV2.java | 179 ++ .../api/simple/block/SimpleGuiBlock.java | 28 + .../api/simple/item/SimpleGuiItem.java | 61 + .../api/sound/CompatBlockSoundGroup.java | 221 +++ .../api/sound/CompatSoundCategory.java | 35 + .../api/sound/CompatSoundEvent.java | 55 + .../api/sound/CompatSoundEvents.java | 1625 +++++++++++++++++ .../sound/RegistryResultCompatSoundEvent.java | 26 + .../api/state/property/BooleanProperty.java | 27 + .../api/state/property/CompatProperties.java | 117 ++ .../api/state/property/DirectionProperty.java | 50 + .../api/state/property/EnumProperty.java | 40 + .../api/state/property/IProperty.java | 49 + .../api/state/property/IntProperty.java | 35 + .../api/state/property/UnknownProperty.java | 21 + .../mcpitanlib/api/tag/MineableToolTags.java | 11 + .../pitan76/mcpitanlib/api/tag/TagKey.java | 57 + .../api/tag/item/RepairIngredientTag.java | 64 + .../mcpitanlib/api/tag/v2/CompatTagKey.java | 29 + .../api/tag/v2/CompatTagKeyType.java | 48 + .../api/tag/v2/typed/BlockTagKey.java | 25 + .../api/tag/v2/typed/EntityTagKey.java | 20 + .../api/tag/v2/typed/FluidTagKey.java | 18 + .../api/tag/v2/typed/ItemTagKey.java | 31 + .../mcpitanlib/api/text/CompatFormatting.java | 86 + .../mcpitanlib/api/text/CompatStyle.java | 105 ++ .../mcpitanlib/api/text/CompatTextColor.java | 79 + .../mcpitanlib/api/text/TextComponent.java | 130 ++ .../mcpitanlib/api/text/TextConverter.java | 102 ++ .../api/text/VariableTextComponent.java | 19 + .../api/tile/BlockEntityTypeBuilder.java | 66 + .../api/tile/CompatBlockEntity.java | 198 ++ .../api/tile/CompatChestBlockEntity.java | 111 ++ .../api/tile/ExtendBlockEntity.java | 26 + .../api/tile/ExtendBlockEntityTicker.java | 17 + .../api/tile/RenderDataBlockEntity.java | 21 + .../api/tile/v2/BlockEntityTypeBuilder.java | 69 + .../api/timer/MinecraftServerTimerAccess.java | 7 + .../api/timer/ServerWorldTimerAccess.java | 7 + .../mcpitanlib/api/timer/TimerItem.java | 14 + .../transfer/fluid/v1/FluidStorageUtil.java | 13 + .../api/transfer/fluid/v1/IFluidStorage.java | 104 ++ .../api/transfer/fluid/v1/IFluidVariant.java | 29 + .../api/util/ArmorMaterialUtil.java | 138 ++ .../api/util/BlockEntityDataUtil.java | 49 + .../api/util/BlockEntityTypeUtil.java | 39 + .../mcpitanlib/api/util/BlockEntityUtil.java | 115 ++ .../mcpitanlib/api/util/BlockStateUtil.java | 169 ++ .../mcpitanlib/api/util/BlockUtil.java | 258 +++ .../mcpitanlib/api/util/BlockViewUtil.java | 24 + .../api/util/CommandManagerUtil.java | 87 + .../mcpitanlib/api/util/CommandUtil.java | 53 + .../api/util/CompatActionResult.java | 123 ++ .../mcpitanlib/api/util/CompatIdentifier.java | 173 ++ .../mcpitanlib/api/util/CompatRarity.java | 54 + .../api/util/CompatStringIdentifiable.java | 17 + .../api/util/CompatibleRecipeEntryUtil.java | 27 + .../mcpitanlib/api/util/CustomDataUtil.java | 175 ++ .../mcpitanlib/api/util/DamageSourceUtil.java | 44 + .../api/util/DirectionBoolPropertyUtil.java | 68 + .../mcpitanlib/api/util/EnchantmentUtil.java | 82 + .../mcpitanlib/api/util/EntityTypeUtil.java | 48 + .../mcpitanlib/api/util/EntityUtil.java | 364 ++++ .../api/util/EquipMaterialUtil.java | 46 + .../api/util/FeatureConfigUtil.java | 81 + .../mcpitanlib/api/util/FluidStateUtil.java | 48 + .../mcpitanlib/api/util/FluidUtil.java | 109 ++ .../pitan76/mcpitanlib/api/util/HandUtil.java | 38 + .../mcpitanlib/api/util/IdentifierUtil.java | 32 + .../mcpitanlib/api/util/IngredientUtil.java | 96 + .../mcpitanlib/api/util/InteractUtil.java | 56 + .../mcpitanlib/api/util/InventoryUtil.java | 202 ++ .../mcpitanlib/api/util/ItemStackUtil.java | 193 ++ .../pitan76/mcpitanlib/api/util/ItemUtil.java | 275 +++ .../pitan76/mcpitanlib/api/util/Logger.java | 190 ++ .../mcpitanlib/api/util/LoggerUtil.java | 38 + .../mcpitanlib/api/util/MCVersionUtil.java | 19 + .../pitan76/mcpitanlib/api/util/MathUtil.java | 33 + .../pitan76/mcpitanlib/api/util/NbtUtil.java | 560 ++++++ .../api/util/ParticleEffectUtil.java | 13 + .../api/util/PersistentStateUtil.java | 55 + .../mcpitanlib/api/util/PlacedFutureUtil.java | 38 + .../mcpitanlib/api/util/PlatformUtil.java | 76 + .../api/util/PlayerManagerUtil.java | 130 ++ .../mcpitanlib/api/util/PlayerUtil.java | 98 + .../mcpitanlib/api/util/PropertyUtil.java | 161 ++ .../mcpitanlib/api/util/RecipeUtil.java | 223 +++ .../api/util/RegistryLookupUtil.java | 40 + .../mcpitanlib/api/util/ResourceUtil.java | 27 + .../api/util/ScreenHandlerUtil.java | 54 + .../mcpitanlib/api/util/ServerUtil.java | 64 + .../api/util/SimpleInventoryUtil.java | 35 + .../pitan76/mcpitanlib/api/util/SlotUtil.java | 44 + .../mcpitanlib/api/util/SoundEventUtil.java | 35 + .../api/util/StackActionResult.java | 107 ++ .../mcpitanlib/api/util/StateManagerUtil.java | 15 + .../mcpitanlib/api/util/StatusEffectUtil.java | 27 + .../mcpitanlib/api/util/StyleUtil.java | 61 + .../pitan76/mcpitanlib/api/util/TextUtil.java | 72 + .../mcpitanlib/api/util/TimerUtil.java | 18 + .../mcpitanlib/api/util/ToolMaterialUtil.java | 55 + .../mcpitanlib/api/util/VoxelShapeUtil.java | 43 + .../mcpitanlib/api/util/WorldRandomUtil.java | 37 + .../mcpitanlib/api/util/WorldUtil.java | 482 +++++ .../api/util/block/BlockHitResultUtil.java | 33 + .../mcpitanlib/api/util/block/BlockUtil.java | 235 +++ .../api/util/block/entity/FurnaceUtil.java | 44 + .../util/client/BlockEntityRendererUtil.java | 14 + .../api/util/client/ClientUtil.java | 117 ++ .../api/util/client/LanguageUtil.java | 47 + .../api/util/client/MatrixStackUtil.java | 32 + .../mcpitanlib/api/util/client/MouseUtil.java | 46 + .../api/util/client/RenderUtil.java | 32 + .../api/util/client/ScreenUtil.java | 224 +++ .../api/util/client/WindowUtil.java | 42 + .../render/CompatItemDisplayContext.java | 40 + .../client/render/CompatItemRenderUtil.java | 36 + .../client/render/VertexConsumerUtil.java | 203 ++ .../client/render/VertexRenderingUtil.java | 114 ++ .../util/client/render/WorldRendererUtil.java | 15 + .../api/util/client/v2/RenderUtil.java | 9 + .../api/util/client/v2/ScreenUtil.java | 35 + .../client/widget/ClickableWidgetUtil.java | 10 + .../api/util/client/widget/TextFieldUtil.java | 79 + .../util/collection/ClippedItemStackList.java | 100 + .../util/collection/DefaultedListUtil.java | 15 + .../api/util/collection/ItemStackList.java | 214 +++ .../api/util/color/CompatBrightness.java | 40 + .../api/util/color/CompatDyeColor.java | 46 + .../api/util/color/CompatMapColor.java | 94 + .../mcpitanlib/api/util/debug/OutputUtil.java | 69 + .../api/util/entity/ArrowEntityUtil.java | 26 + .../api/util/entity/EquipmentSlotUtil.java | 55 + .../api/util/entity/ItemEntityUtil.java | 118 ++ .../api/util/entity/LivingEntityUtil.java | 57 + .../api/util/entity/ProjectileEntityUtil.java | 14 + .../api/util/entity/ServerPlayerUtil.java | 102 ++ .../util/entity/SmallFireballEntityUtil.java | 29 + .../api/util/entity/SnowballEntityUtil.java | 28 + .../util/entity/SpectralArrowEntityUtil.java | 26 + .../api/util/entity/ThrownItemEntityUtil.java | 36 + .../api/util/event/BlockEventGenerator.java | 21 + .../api/util/event/ItemEventGenerator.java | 11 + .../api/util/inventory/ClippedInventory.java | 91 + .../api/util/inventory/CompatInventory.java | 229 +++ .../util/inventory/CompatPlayerInventory.java | 42 + .../util/inventory/ContainerInventory.java | 17 + .../api/util/inventory/ICompatInventory.java | 60 + .../util/inventory/PlayerInventoryUtil.java | 47 + .../util/inventory/args/CanInsertArgs.java | 23 + .../mcpitanlib/api/util/item/FuelUtil.java | 16 + .../api/util/item/ItemGroupUtil.java | 40 + .../mcpitanlib/api/util/item/ItemUtil.java | 263 +++ .../api/util/math/BlockRotations.java | 19 + .../mcpitanlib/api/util/math/BoxUtil.java | 54 + .../api/util/math/DirectionUtil.java | 34 + .../mcpitanlib/api/util/math/PointUtil.java | 15 + .../mcpitanlib/api/util/math/PosUtil.java | 116 ++ .../mcpitanlib/api/util/math/Vec3dUtil.java | 69 + .../mcpitanlib/api/util/math/Vec3iUtil.java | 33 + .../api/util/math/random/CompatRandom.java | 140 ++ .../mcpitanlib/api/util/nbt/InvRWUtil.java | 26 + .../mcpitanlib/api/util/nbt/NbtListUtil.java | 88 + .../mcpitanlib/api/util/nbt/NbtRWUtil.java | 141 ++ .../mcpitanlib/api/util/nbt/v2/NbtRWUtil.java | 126 ++ .../api/util/particle/CompatParticleType.java | 34 + .../util/particle/CompatParticleTypes.java | 121 ++ .../effect/ItemStackParticleEffectUtil.java | 22 + .../api/util/recipe/RecipeMatcherUtil.java | 43 + .../api/util/recipe/RecipeUtil.java | 101 + .../recipe/input/CraftingRecipeInputUtil.java | 97 + .../input/SingleStackRecipeInputUtil.java | 32 + .../api/util/screen/ScreenHandlerUtil.java | 28 + .../mcpitanlib/api/util/v1/BlockUtilV1.java | 73 + .../mcpitanlib/api/util/v1/ItemUtilV1.java | 92 + .../mcpitanlib/api/util/v2/BlockUtilV2.java | 125 ++ .../api/util/v2/CustomNameUtil.java | 50 + .../mcpitanlib/api/util/v2/ItemUtilV2.java | 94 + .../api/util/world/ChunkManagerUtil.java | 26 + .../api/util/world/ServerWorldUtil.java | 44 + .../mcpitanlib/api/util/world/TickerUtil.java | 53 + .../api/util/world/WorldAccessUtil.java | 52 + .../api/util/world/WorldViewUtil.java | 104 ++ .../api/world/CompatiblePersistentState.java | 47 + .../mcpitanlib/api/world/ExtendWorld.java | 48 + .../net/pitan76/mcpitanlib/core/Dummy.java | 4 + .../core/command/CommandResult.java | 73 + .../mcpitanlib/core/datafixer/Pair.java | 43 + .../core/mc1216/NbtDataConverter.java | 198 ++ .../mcpitanlib/core/network/BufPayload.java | 67 + .../mcpitanlib/core/player/ItemCooldown.java | 31 + .../core/registry/FuelRegistry.java | 28 + .../core/registry/MCPLRegistry.java | 95 + .../core/registry/MCPLRegistry1_20.java | 43 + .../core/registry/MCPLRegistry1_21.java | 39 + .../core/serialization/CompatMapCodec.java | 76 + .../codecs/CompatBlockMapCodecUtil.java | 57 + .../pitan76/mcpitanlib/debug/DebugTool.java | 27 + .../mcpitanlib/guilib/GuiRegistry.java | 46 + .../mcpitanlib/guilib/GuiTextures.java | 9 + .../mcpitanlib/guilib/MGLClientNetworks.java | 23 + .../pitan76/mcpitanlib/guilib/MPLGuiLib.java | 31 + .../mcpitanlib/guilib/api/IScreenInfo.java | 38 + .../guilib/api/ISimpleScreenInfo.java | 14 + .../mcpitanlib/guilib/api/NetworkDefines.java | 8 + .../entity/BlockEntityWithContainer.java | 40 + .../ExtendedBlockEntityWithContainer.java | 59 + .../container/BlockEntityContainerGui.java | 11 + .../guilib/api/container/ContainerGui.java | 66 + .../ExtendedBlockEntityContainerGui.java | 39 + .../api/container/SimpleContainerGui.java | 16 + .../guilib/api/render/PartsRenderer.java | 72 + .../guilib/api/render/SlotRenderer.java | 27 + .../guilib/api/screen/ContainerGuiScreen.java | 86 + .../api/screen/SimpleContainerGuiScreen.java | 16 + .../mcpitanlib/guilib/test/TestContainer.java | 55 + .../pitan76/mcpitanlib/midohra/Midohra.java | 160 ++ .../mcpitanlib/midohra/MidohraAPI.java | 13 + .../mcpitanlib/midohra/block/BlockState.java | 159 ++ .../midohra/block/BlockWrapper.java | 136 ++ .../mcpitanlib/midohra/block/Blocks.java | 771 ++++++++ .../midohra/block/SupplierBlockWrapper.java | 27 + .../block/entity/BlockEntityTypeWrapper.java | 58 + .../block/entity/BlockEntityWrapper.java | 133 ++ .../RewritableBlockEntityTypeWrapper.java | 32 + .../SupplierBlockEntityTypeWrapper.java | 27 + .../entity/SupplierBlockEntityWrapper.java | 27 + .../midohra/client/render/CameraWrapper.java | 72 + .../midohra/component/ItemComponentTypes.java | 134 ++ .../item/CustomNameComponentType.java | 31 + .../component/item/ItemComponentType.java | 31 + .../component/item/RarityComponentType.java | 31 + .../midohra/easybuilder/BlockBuilder.java | 308 ++++ .../easybuilder/BlockEntityBuilder.java | 88 + .../BlockWithBlockEntityBuilder.java | 107 ++ .../midohra/easybuilder/ItemBuilder.java | 198 ++ .../midohra/easybuilder/built/BuiltBlock.java | 146 ++ .../easybuilder/built/BuiltBlockEntity.java | 65 + .../built/BuiltBlockWithEntity.java | 40 + .../midohra/easybuilder/built/BuiltItem.java | 91 + .../midohra/entity/EntityTypeWrapper.java | 95 + .../midohra/entity/EntityTypes.java | 75 + .../midohra/entity/EntityWrapper.java | 334 ++++ .../midohra/entity/ItemEntityWrapper.java | 79 + .../midohra/entity/SpawnReason.java | 50 + .../midohra/fluid/FluidWrapper.java | 100 + .../mcpitanlib/midohra/fluid/Fluids.java | 9 + .../holder/BlockStatePropertyHolder.java | 35 + .../midohra/item/ItemGroupWrapper.java | 57 + .../mcpitanlib/midohra/item/ItemGroups.java | 30 + .../mcpitanlib/midohra/item/ItemStack.java | 222 +++ .../mcpitanlib/midohra/item/ItemWrapper.java | 161 ++ .../mcpitanlib/midohra/item/Items.java | 984 ++++++++++ .../midohra/item/SupplierItemWrapper.java | 22 + .../midohra/nbt/ElementConvertible.java | 9 + .../mcpitanlib/midohra/nbt/NbtCompound.java | 155 ++ .../mcpitanlib/midohra/nbt/NbtElement.java | 49 + .../mcpitanlib/midohra/nbt/NbtList.java | 110 ++ .../midohra/network/CompatPacketByteBuf.java | 116 ++ .../midohra/recipe/CraftingRecipe.java | 74 + .../mcpitanlib/midohra/recipe/Ingredient.java | 95 + .../mcpitanlib/midohra/recipe/Recipe.java | 91 + .../midohra/recipe/RecipeManager.java | 21 + .../mcpitanlib/midohra/recipe/RecipeType.java | 57 + .../midohra/recipe/ServerRecipeManager.java | 157 ++ .../midohra/recipe/ShapedRecipe.java | 60 + .../midohra/recipe/ShapelessRecipe.java | 52 + .../recipe/entry/CraftingRecipeEntry.java | 55 + .../midohra/recipe/entry/RecipeEntry.java | 87 + .../recipe/entry/ShapedRecipeEntry.java | 55 + .../recipe/entry/ShapelessRecipeEntry.java | 55 + .../input/CraftingRecipeInputOrInventory.java | 67 + .../recipe/input/RecipeInputOrInventory.java | 80 + .../input/TypedRecipeInputOrInventory.java | 56 + .../mcpitanlib/midohra/resource/Resource.java | 74 + .../midohra/resource/ResourceManager.java | 84 + .../mcpitanlib/midohra/server/MCServer.java | 96 + .../midohra/server/PlayerManager.java | 152 ++ .../midohra/util/hit/BlockHitResult.java | 59 + .../midohra/util/hit/HitResult.java | 106 ++ .../midohra/util/hit/HitResultType.java | 36 + .../midohra/util/math/BlockPos.java | 138 ++ .../mcpitanlib/midohra/util/math/Box.java | 144 ++ .../midohra/util/math/ChunkPos.java | 154 ++ .../midohra/util/math/Direction.java | 133 ++ .../midohra/util/math/Vector3d.java | 223 +++ .../midohra/util/math/Vector3f.java | 212 +++ .../midohra/util/math/Vector3i.java | 231 +++ .../midohra/util/math/v0/BlockPos.java | 90 + .../midohra/util/shape/VoxelShape.java | 76 + .../mcpitanlib/midohra/world/BlockView.java | 41 + .../mcpitanlib/midohra/world/IWorldView.java | 28 + .../midohra/world/RedstoneView.java | 41 + .../mcpitanlib/midohra/world/ServerWorld.java | 63 + .../mcpitanlib/midohra/world/World.java | 167 ++ .../mcpitanlib/midohra/world/WorldAccess.java | 191 ++ .../mcpitanlib/midohra/world/WorldView.java | 85 + .../midohra/world/chunk/ChunkManager.java | 41 + .../midohra/world/chunk/ChunkTicketType.java | 87 + .../world/chunk/ServerChunkManager.java | 51 + .../midohra/world/tick/ScheduledTickView.java | 47 + .../AbstractBlock4CompatProviderMixin.java | 104 ++ .../mcpitanlib/mixin/AbstractBlockMixin.java | 149 ++ .../mixin/Block4CompatProviderMixin.java | 30 + .../mcpitanlib/mixin/BlockInvoker.java | 14 + .../pitan76/mcpitanlib/mixin/BlockMixin.java | 105 ++ .../mcpitanlib/mixin/CraftingRecipeMixin.java | 30 + .../pitan76/mcpitanlib/mixin/ItemMixin.java | 271 +++ .../ItemStackComponentizationFixMixin.java | 42 + .../mcpitanlib/mixin/ItemStackMixin.java | 27 + .../mixin/ItemUsageContextMixin.java | 14 + .../mixin/MinecraftServerTimer.java | 38 + .../mcpitanlib/mixin/RecipeManagerMixin.java | 31 + .../mcpitanlib/mixin/ServerWorldTimer.java | 40 + .../mcpitanlib/mixin/WorldRendererMixin.java | 106 ++ .../mcpitanlib/test/ExampleCommand.java | 50 + .../mcpitanlib/test/ExampleContainerGui.java | 26 + .../test/ExampleContainerGuiScreen.java | 30 + .../mcpitanlib/test/ExampleGuiBlock.java | 36 + .../mcpitanlib/test/ExampleGuiItem.java | 37 + .../pitan76/mcpitanlib/test/ExampleMod.java | 88 + .../mcpitanlib/test/ExampleModClient.java | 12 + .../mcpitanlib/test/ExampleScreen.java | 30 + .../mcpitanlib/test/ExampleScreenHandler.java | 24 + .../mplguilib/textures/container/base.png | Bin 0 -> 802 bytes .../textures/container/base_furnace.png | Bin 0 -> 1637 bytes .../textures/container/gui_parts.png | Bin 0 -> 1515 bytes 626 files changed, 49100 insertions(+) create mode 100644 common/build.gradle create mode 100644 fabric/build.gradle create mode 100644 src/main/java/net/pitan76/easyapi/FileControl.java create mode 100644 src/main/java/net/pitan76/easyapi/config/Config.java create mode 100644 src/main/java/net/pitan76/easyapi/config/IConfig.java create mode 100644 src/main/java/net/pitan76/easyapi/config/JsonConfig.java create mode 100644 src/main/java/net/pitan76/easyapi/config/YamlConfig.java create mode 100644 src/main/java/net/pitan76/easyapi/config/package-info.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/Dummy.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java create mode 100644 src/main/resources/assets/mplguilib/textures/container/base.png create mode 100644 src/main/resources/assets/mplguilib/textures/container/base_furnace.png create mode 100644 src/main/resources/assets/mplguilib/textures/container/gui_parts.png diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 000000000..0c17b9439 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,37 @@ +dependencies { + // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies + // Do NOT use other classes from fabric loader + modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + // Remove the next line if you don't want to depend on the API +// modApi "dev.architectury:architectury:${rootProject.architectury_version}" +} + +architectury { + common("fabric", "neoforge") +} + +loom { + accessWidenerPath = file("src/main/resources/mcpitanlib.accesswidener") +} + +publishing { + publications { + mavenCommon(MavenPublication) { + artifactId = info.archives_base_name + "-" + project.name + "-" + rootProject.minecraft_version + version = info.mod_version + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/PTOM76/maven") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 000000000..ba6c830c6 --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,129 @@ +plugins { + id "com.github.johnrengelman.shadow" version "8.1.1" +} + +architectury { + platformSetupLoomIde() + fabric() +} + +loom { + accessWidenerPath = project(":common").loom.accessWidenerPath +} + +configurations { + common { + canBeResolved = true + canBeConsumed = false + } + // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. + shadowBundle { + canBeResolved = true + canBeConsumed = false + } + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentFabric.extendsFrom common +} + +dependencies { + modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + modCompileOnly "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" + // Remove the next line if you don't want to depend on the API + modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowBundle(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } + + shadowBundle 'org.yaml:snakeyaml:2.0' + + modApi("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") + + modImplementation("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + modImplementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") + include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") +} + +processResources { + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } + + project.version = project.version + "-fabric" +} + +shadowJar { + relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" + + exclude "architectury.common.json" + + configurations = [project.configurations.shadowBundle] + archiveClassifier.set "dev-shadow" +} + +remapJar { + injectAccessWidener = true + inputFile.set shadowJar.archiveFile + dependsOn shadowJar + archiveClassifier.set null +} + +jar { + archiveClassifier.set "dev" +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + +publishing { + publications { + mavenFabric(MavenPublication) { + artifactId = info.archives_base_name + "-" + project.name + "-" + rootProject.minecraft_version + version = info.mod_version + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/PTOM76/maven") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") + } + } + } +} + +tasks.runClient.doFirst { + def from = new File("../common/src/main/resources/mcpitanlib.accesswidener") + def to = new File("src/main/resources/mcpitanlib.accesswidener") + to.bytes = from.bytes +} + +tasks.remapJar.doFirst { + if (file("src/main/resources/mcpitanlib.accesswidener").exists()) { + delete file("src/main/resources/mcpitanlib.accesswidener") + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/easyapi/FileControl.java b/src/main/java/net/pitan76/easyapi/FileControl.java new file mode 100644 index 000000000..673c29ab2 --- /dev/null +++ b/src/main/java/net/pitan76/easyapi/FileControl.java @@ -0,0 +1,173 @@ +package net.pitan76.easyapi; + +import java.io.*; +import java.nio.channels.FileChannel; + +public class FileControl { + + public static boolean fileWriteContents(String pathName, String contents){ return fileWriteContents(new File(pathName), contents); } + + public static String fileReadContents(String pathName) { return fileReadContents(new File(pathName)); } + + public static boolean fileCopy(String inPathName, String outPathName) { return fileCopy(new File(inPathName), new File(outPathName)); } + + public static boolean fileExists(String pathName) { return fileExists(new File(pathName)); } + + public static long getFileTime(String pathName) { return getFileTime(new File(pathName)); } + + public static boolean setFileTime(String pathName, long time) { return setFileTime(new File(pathName), time); } + + public static boolean fileRename(String pathName, String renamedPathName) { return fileRename(new File(pathName), new File(renamedPathName)); } + + public static String basename(String pathName) { return basename(new File(pathName)); } + + public static String dirname(String pathName) { return dirname(new File(pathName)); } + + public static String dirname(String pathName, int levels) { return dirname(new File(pathName), levels); } + + /** + * ファイルにデータを書き込みます。 + * 失敗した場合falseを返します。 + * + * @param file ファイル + * @param contents データ + */ + public static boolean fileWriteContents(File file, String contents) { + try { + PrintWriter writer = new PrintWriter( + new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"))); + writer.println(contents); + writer.close(); + return true; + } catch (IOException e) { + e.printStackTrace(); + return false; + } + } + + /** + * ファイルからデータを読み込みます。 + * 失敗した場合nullを返します。 + * + * @param file ファイル + * @return ファイルのデータ or null + */ + public static String fileReadContents(File file) { + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); + String line = ""; + String contents = ""; + while ((line = reader.readLine()) != null) { + contents += line + "\n"; + } + reader.close(); + return contents; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + /** + * ファイルからデータを読み込みます。 + * 失敗した場合falseを返します。 + * + * @param inFile コピー元ファイル + * @param outFile コピー先ファイル + */ + public static boolean fileCopy(File inFile, File outFile) { + try { + FileChannel inCh, outCh = null; + FileInputStream inStream = new FileInputStream(inFile); + FileOutputStream outStream = new FileOutputStream(outFile); + inCh = inStream.getChannel(); + outCh = outStream.getChannel(); + outCh.transferFrom(inCh, 0, inCh.size()); + inCh.close(); + outCh.close(); + inStream.close(); + outStream.close(); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + * File.exists()のエイリアス関数です。 + * + * @param file 確認するファイル + */ + public static boolean fileExists(File file) { + return file.exists(); + } + + /** + * File.lastModified()のエイリアス関数です。 + * + * @param file 更新日時を取得するファイル + * @return ファイルの更新日時 + */ + public static long getFileTime(File file) { + return file.lastModified(); + } + + + /** + * File.setLastModified()のエイリアス関数です。 + * + * @param file 日時変更されるファイル + * @param time 変更後の更新日時 + */ + public static boolean setFileTime(File file, long time) { + return file.setLastModified(time); + } + + /** + * File.renameTo()のエイリアス関数です。 + * + * @param file 名前変更されるファイル + * @param renamedFile 名前変更後のファイル + */ + public static boolean fileRename(File file, File renamedFile) { + return file.renameTo(renamedFile); + } + + /** + * StringからFileへ変換します。 + * + * @param pathName ファイルのパス + * @return File + */ + public static File stringToFile(String pathName) { + return new File(pathName); + } + + public static String basename(File file) { + return file.getName(); + } + + public static String dirname(File file) { + return file.getParent(); + } + + public static String dirname(File file, int levels) { + for (int i = 0; i < levels; i++) { + file = dirfile(file); + } + return file.toString(); + } + + public static File dirfile(File file) { + return file.getParentFile(); + } + + public static File dirfile(File file, int count) { + for (int i = 0; i > count; i++) { + file = dirfile(file); + } + return file; + } + +} diff --git a/src/main/java/net/pitan76/easyapi/config/Config.java b/src/main/java/net/pitan76/easyapi/config/Config.java new file mode 100644 index 000000000..cdbabbcc1 --- /dev/null +++ b/src/main/java/net/pitan76/easyapi/config/Config.java @@ -0,0 +1,456 @@ +package net.pitan76.easyapi.config; + +import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; + +public class Config implements IConfig { + public Map configMap = new LinkedHashMap<>(); + + /** + * 任意ファイルを読み込み、Mapへ変換 + * + * @param file ファイル + */ + public Config(File file) { + load(file); + } + + /** + * 任意ファイルを読み込み、Mapへ変換 + * + * @param file ファイル名 + */ + public Config(String file) { + this(new File(file)); + } + + public Config() {}; + + /** + * Configの変換 + * + * @param config Config + */ + public Config(Config config) { + configMap = config.configMap; + }; + + public boolean has(String key) { + if (configMap == null) + return false; + + return configMap.containsKey(key); + } + + /** + * マップのキーから値を取得 + * "."でパスを区切る + * + * @param key キー + * @return 取得した値 + */ + @SuppressWarnings("unchecked") + public Object get(String key) { + try { + key = key.replace("\\.", "$\$"); + String[] keyList = key.split("\\."); + if (keyList.length == 1) { + key = key.replace("$\$", "."); + return configMap.get(key); + } + int i = 0; + Map inMap = new LinkedHashMap<>(); + for (String k : keyList) { + i++; + k = k.replace("$\$", "."); + if (keyList.length == i) { + return inMap.get(k); + } + if (i == 1) { + inMap = (Map) configMap.get(k); + continue; + } + inMap = (Map) inMap.get(k); + } + return null; + } catch (Exception e) { + return null; + } + + } + + /** + * マップのキーから値(文字列)を取得 + * "."でパスを区切る + * + * @param key キー + * @return 取得した値 + */ + public String getString(String key) { + return (String) get(key); + } + + /** + * マップのキーから値(整数)を取得 + * "."でパスを区切る + * + * @param key キー + * @return 取得した値 + */ + public int getInt(String key) { + Object obj = get(key); + if (obj instanceof Double) { + return ((Double)obj).intValue(); + } + if (obj instanceof Short) { + return ((Short)obj).intValue(); + } + if (obj instanceof Long) { + return ((Long)obj).intValue(); + } + return (Integer) obj; + } + + /** + * マップのキーから値(数値)を取得 + * "."でパスを区切る + * + * @param key キー + * @return 取得した値 + */ + public double getDouble(String key) { + return (Double) get(key); + } + + /** + * マップのキーから値(真偽値)を取得 + * "."でパスを区切る + * + * @param key キー + * @return 取得した値 + */ + public boolean getBoolean(String key) { + try { + return (Boolean) get(key); + } catch (Exception e) { + return false; + } + } + + /** + * マップのキーから値を取得、存在しない場合はデフォルト値を返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public Object getOrDefault(String key, Object defaultValue) { + if (has(key)) { + return get(key); + } + return defaultValue; + } + + /** + * マップのキーから値(文字列)を取得、存在しない場合はデフォルト値を返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public String getStringOrDefault(String key, String defaultValue) { + if (has(key)) { + return getString(key); + } + return defaultValue; + } + + /** + * マップのキーから値(整数)を取得、存在しない場合はデフォルト値を返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public int getIntOrDefault(String key, int defaultValue) { + if (has(key)) { + return getInt(key); + } + return defaultValue; + } + + /** + * マップのキーから値(数値)を取得、存在しない場合はデフォルト値を返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public double getDoubleOrDefault(String key, double defaultValue) { + if (has(key)) { + return getDouble(key); + } + return defaultValue; + } + /** + * マップのキーから値(真偽値)を取得、存在しない場合はデフォルト値を返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public boolean getBooleanOrDefault(String key, boolean defaultValue) { + if (has(key)) { + return getBoolean(key); + } + return defaultValue; + } + + /** + * マップのキーから値を取得、存在しない場合はデフォルト値を保存して返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public Object getOrCreate(String key, Object defaultValue) { + if (has(key)) return get(key); + + set(key, defaultValue); + return defaultValue; + } + + /** + * マップのキーから値(文字列)を取得、存在しない場合はデフォルト値を保存して返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public String getStringOrCreate(String key, String defaultValue) { + if (has(key)) return getString(key); + + setString(key, defaultValue); + return defaultValue; + } + + /** + * マップのキーから値(整数)を取得、存在しない場合はデフォルト値を保存して返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public int getIntOrCreate(String key, int defaultValue) { + if (has(key)) return getInt(key); + + setInt(key, defaultValue); + return defaultValue; + } + + /** + * マップのキーから値(数値)を取得、存在しない場合はデフォルト値を保存して返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public double getDoubleOrCreate(String key, double defaultValue) { + if (has(key)) return getDouble(key); + + setDouble(key, defaultValue); + return defaultValue; + } + + /** + * マップのキーから値(真偽値)を取得、存在しない場合はデフォルト値を保存して返す + * "."でパスを区切る + * + * @param key キー + * @param defaultValue デフォルト値 + * @return 取得した値 + */ + public boolean getBooleanOrCreate(String key, boolean defaultValue) { + if (has(key)) return getBoolean(key); + + setBoolean(key, defaultValue); + return defaultValue; + } + + /** + * マップのキーに値をセット + * "."でパスを区切る + * 失敗するとfalseを返す + * + * @param key キー + * @param value 値 + * @return 真偽値 + */ + @SuppressWarnings("unchecked") + public boolean set(String key, Object value) { + try { + key = key.replace("\\.", "$\$"); + String[] keyList = key.split("\\."); + if (keyList.length == 1) { + key = key.replace("$\$", "."); + configMap.put(key, value); + return true; + } + int i = 0; + Map inMap = new LinkedHashMap<>(); + for (String k : keyList) { + i++; + k = k.replace("$\$", "."); + if (keyList.length == i) { + inMap.put(k, value); + continue; + } + Map beforeInMap = inMap; + if (configMap.containsKey(k) && i == 1) { + inMap = (LinkedHashMap) configMap.get(k); + }else if (beforeInMap.containsKey(k)){ + inMap = (LinkedHashMap) beforeInMap.get(k); + }else { + inMap = new LinkedHashMap(); + } + if (i == 1) { + configMap.put(k, inMap); + continue; + } + beforeInMap.put(k, inMap); + } + return true; + } catch (Exception e) { + return false; + } + } + + /** + * マップのキーに値(文字列)をセット + * "."でパスを区切る + * 失敗するとfalseを返す + * + * @param key キー + * @param value 値 + * @return 真偽値 + */ + public boolean setString(String key, String value) { + return set(key, value); + } + + /** + * マップのキーに値(整数)をセット + * "."でパスを区切る + * 失敗するとfalseを返す + * + * @param key キー + * @param value 値 + * @return 真偽値 + */ + public boolean setInt(String key, int value) { + return set(key, value); + } + + /** + * マップのキーに値(数値)をセット + * "."でパスを区切る + * 失敗するとfalseを返す + * + * @param key キー + * @param value 値 + * @return 真偽値 + */ + public boolean setDouble(String key, double value) { + return set(key, value); + } + + /** + * マップのキーに値(真偽値)をセット + * "."でパスを区切る + * 失敗するとfalseを返す + * + * @param key キー + * @param value 値 + * @return 真偽値 + */ + public boolean setBoolean(String key, boolean value) { + return set(key, value); + } + + /** + * マップのキーから値を削除 + * "."でパスを区切る + * + * @param key キー + * @return 真偽値 + */ + public boolean remove(String key) { + return configMap.remove(key) != null; + } + + /** + * StringをFileにして読み込み、継承先で処理 + * + * @param file ファイル名 + */ + public boolean load(String file) { + return load(new File(file)); + } + + /** + * この関数は継承先で定義 + * + * @param file ファイル + */ + public boolean load(File file) { + return false; + } + + /** + * StringをFileにし、継承先で処理して保存 + * + * @param file ファイル名 + */ + public boolean save(String file) { + return save(new File(file)); + } + + /** + * ファイルを継承先で処理して保存 + * + * @param file ファイル + */ + public boolean save(File file) { + return save(file, true); + } + + /** + * ファイルを継承先で処理して保存 + * + * @param file ファイル名 + * @param pretty 整形 + */ + public boolean save(String file, boolean pretty) { + return save(new File(file), pretty); + } + + /** + * この関数は継承先で定義 + * + * @param file ファイル + * @param pretty 整形 + */ + public boolean save(File file, boolean pretty) { + return false; + } +} diff --git a/src/main/java/net/pitan76/easyapi/config/IConfig.java b/src/main/java/net/pitan76/easyapi/config/IConfig.java new file mode 100644 index 000000000..09d0b68e8 --- /dev/null +++ b/src/main/java/net/pitan76/easyapi/config/IConfig.java @@ -0,0 +1,37 @@ +package net.pitan76.easyapi.config; + +import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; + +public interface IConfig { + Map configMap = new LinkedHashMap<>(); + + Object get(String key); + + String getString(String key); + + int getInt(String key); + + boolean getBoolean(String key); + + boolean set(String key, Object value); + + boolean setString(String key, String value); + + boolean setInt(String key, int value); + + boolean setBoolean(String key, boolean value); + + boolean load(String file); + + boolean load(File file); + + boolean save(String file); + + boolean save(File file); + + boolean save(String file, boolean pretty); + + boolean save(File file, boolean pretty); +} diff --git a/src/main/java/net/pitan76/easyapi/config/JsonConfig.java b/src/main/java/net/pitan76/easyapi/config/JsonConfig.java new file mode 100644 index 000000000..c549f09da --- /dev/null +++ b/src/main/java/net/pitan76/easyapi/config/JsonConfig.java @@ -0,0 +1,102 @@ +package net.pitan76.easyapi.config; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import net.pitan76.easyapi.FileControl; + +import java.io.File; +import java.lang.reflect.Type; +import java.util.LinkedHashMap; + +public class JsonConfig extends Config { + /** + * + * @param file ファイル + */ + public JsonConfig(File file) { + super(file); + } + + /** + * + * @param file ファイル名 + */ + public JsonConfig(String file) { + super(file); + } + + public JsonConfig() { + super(); + } + + /** + * Config→JsonConfigへ変換 + * + * @param config Config + */ + public JsonConfig(Config config) { + super(config); + } + + /** + * Jsonファイルを読み込んでMapへ変換 + * + * @param file ファイル + * @return 成功→true / 失敗→false + */ + public boolean load(File file) { + if (!file.exists()) { + configMap = new LinkedHashMap<>(); + return false; + } + + try { + String configData = FileControl.fileReadContents(file); + Gson gson = new Gson(); + Type jsonMap = new TypeToken>() { + }.getType(); + configMap = gson.fromJson(configData, jsonMap); + return true; + } catch (Exception e) { + configMap = new LinkedHashMap<>(); + return false; + } + } + + /** + * MapをJsonへ変換し、Jsonファイルとして保存 + * + * @param file ファイル + * @param pretty 整形 + * @return 成功→true / 失敗→false + */ + public boolean save(File file, boolean pretty) { + try { + String configData = this.toJson(pretty); + FileControl.fileWriteContents(file, configData); + return true; + } catch (Exception e) { + return false; + } + } + + /** + * MapをJsonへ変換 失敗した場合はnullを返す + * + * @param pretty 整形 + * @return Jsonの文字列 + */ + public String toJson(boolean pretty) { + try { + Gson gson = new Gson(); + if (pretty) { + gson = new GsonBuilder().setPrettyPrinting().create(); + } + String configData = gson.toJson(configMap); + return configData; + } catch (Exception e) { + return null; + } + } +} diff --git a/src/main/java/net/pitan76/easyapi/config/YamlConfig.java b/src/main/java/net/pitan76/easyapi/config/YamlConfig.java new file mode 100644 index 000000000..cc3774746 --- /dev/null +++ b/src/main/java/net/pitan76/easyapi/config/YamlConfig.java @@ -0,0 +1,114 @@ +package net.pitan76.easyapi.config; + +import net.pitan76.easyapi.FileControl; +import org.yaml.snakeyaml.DumperOptions; +import org.yaml.snakeyaml.Yaml; + +import java.io.File; +import java.util.LinkedHashMap; +import java.util.Map; + +public class YamlConfig extends Config { + + /** + * + * @param file ファイル + */ + public YamlConfig(File file) { + super(file); + } + + /** + * + * @param file ファイル名 + */ + public YamlConfig(String file) { + super(file); + } + + public YamlConfig() { + super(); + } + + /** + * Config→JsonConfigへ変換 + * + * @param config Config + */ + public YamlConfig(Config config) { + super(config); + } + + private DumperOptions.FlowStyle style = DumperOptions.FlowStyle.BLOCK; + + /** + * 出力するYamlのスタイルの設定 + * + * @param flowStyle FlowStyle + */ + public void setStyle(DumperOptions.FlowStyle flowStyle) { + style = flowStyle; + } + + /** + * Yamlファイルを読み込んでMapへ変換 + * + * @param file ファイル + * @return 成功→true / 失敗→false + */ + @SuppressWarnings("unchecked") + public boolean load(File file) { + if (!file.exists()) { + configMap = new LinkedHashMap<>(); + return false; + } + + try { + String configData = FileControl.fileReadContents(file); + Yaml yaml = new Yaml(); + configMap = (Map) yaml.load(configData); + return true; + } catch (Exception e) { + configMap = new LinkedHashMap<>(); + return false; + } + } + + /** + * MapをYamlへ変換し、Yamlファイルとして保存 + * + * @param file ファイル + * @param pretty 整形 + * @return 成功→true / 失敗→false + */ + public boolean save(File file, boolean pretty) { + try { + String configData = this.toYaml(pretty); + FileControl.fileWriteContents(file, configData); + return true; + } catch (Exception e) { + return false; + } + } + + /** + * MapをYamlへ変換 失敗した場合はnullを返す + * + * @param pretty 整形 + * @return Yamlの文字列 + */ + public String toYaml(boolean pretty) { + try { + DumperOptions options = new DumperOptions(); + options.setDefaultFlowStyle(style); + if (pretty) { + options.setPrettyFlow(true); + } + Yaml yaml = new Yaml(options); + String configData = yaml.dump(configMap); + return configData; + } catch (Exception e) { + return null; + } + } +} diff --git a/src/main/java/net/pitan76/easyapi/config/package-info.java b/src/main/java/net/pitan76/easyapi/config/package-info.java new file mode 100644 index 000000000..88238e2bc --- /dev/null +++ b/src/main/java/net/pitan76/easyapi/config/package-info.java @@ -0,0 +1,4 @@ +/** + * Config関連のクラスが入っているパッケージ + */ +package net.pitan76.easyapi.config; diff --git a/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java b/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java new file mode 100644 index 000000000..3b56f40ad --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java @@ -0,0 +1,127 @@ +/* +Copyright (C) 2022-2024 Pitan + +MCPitanLib is under the MIT license. For more information, please refer to the LICENSE file at the root of the repository. +MCPitanLibはMITライセンスです。ライセンスについてはリポジトリ直下のLICENSEファイルを参照してください。 + */ + +package net.pitan76.mcpitanlib; + +import net.minecraft.resources.Identifier; +import net.pitan76.easyapi.config.Config; +import net.pitan76.easyapi.config.JsonConfig; +import net.pitan76.mcpitanlib.api.registry.CompatRegistry; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.PlatformUtil; +import net.pitan76.mcpitanlib.debug.DebugTool; +import net.pitan76.mcpitanlib.guilib.MPLGuiLib; +import net.pitan76.mcpitanlib.test.ExampleMod; +import net.pitan76.mcpitanlib.test.ExampleModClient; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class MCPitanLib { + public static final String MOD_ID = "mcpitanlib"; + + private static final File configFile = new File(PlatformUtil.getConfigFolder().toFile(), "mcpitanlib/blacklist.json"); + private static final File oldConfigFile = new File(PlatformUtil.getConfigFolder().toFile(), "mcpitanlibarch/blacklist.json"); + + public static Config config = new JsonConfig(); + private static boolean configLoaded = false; + + public static List itemBlackList = new ArrayList<>(); + public static List blockBlackList = new ArrayList<>(); + + // MCPitanLibのアイテム、ブロック、タイルエンティティの登録 + public static CompatRegistry registry; + + /** + * MCPitanLibの初期化 + */ + public static void init() { + configInit(); + MPLGuiLib.init(); + + if (PlatformUtil.isDevelopmentEnvironment() || (config.has("debugMode") && config.getBoolean("debugMode"))) { + System.out.println("MCPitanLib: Debug Mode"); + + registry = CompatRegistry.createRegistry(MOD_ID); + DebugTool.register(); + registry.allRegister(); + + new ExampleMod(); + if (PlatformUtil.isClient()) + ExampleModClient.init(); + } + } + + /** + * Configの初期化 + */ + public static void configInit() { + if (oldConfigFile.exists() && !configFile.exists()) { + oldConfigFile.renameTo(configFile); + } + + try { + if (configLoaded) return; + configLoaded = true; + if (!configFile.getParentFile().exists()) + if (!configFile.getParentFile().mkdirs()) + return; + + config.setString("item", "examplemod:hogehoge_item,examplemod:fuga_item"); + config.setString("block", "examplemod:hogehoge_block,examplemod:fuga_block"); + config.setBoolean("debugMode", false); + + if (configFile.exists()) + config.load(configFile); + + if (!config.has("debugMode")) + config.setBoolean("debugMode", false); + + if (config.has("item")) + itemBlackList.addAll(Arrays.asList(config.getString("item").split(","))); + + if (config.has("block")) + blockBlackList.addAll(Arrays.asList(config.getString("block").split(","))); + + config.save(configFile); + } catch (Exception e) { + System.out.println("MCPitanLib: Cannot save config file"); + } + } + + /** + * Identifierを生成 + * @param path パス + * @return Identifier + */ + public static Identifier id(String path) { + return IdentifierUtil.id(MOD_ID, path); + } + + public static CompatIdentifier compatId(String path) { + return CompatIdentifier.fromMinecraft(id(path)); + } + + public static boolean isItemBlackListed(Identifier id) { + try { + return itemBlackList.contains(id.toString()); + } catch (Exception e) { + return false; + } + } + + public static boolean isBlockBlackListed(Identifier id) { + try { + return blockBlackList.contains(id.toString()); + } catch (Exception e) { + return false; + } + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java b/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java new file mode 100644 index 000000000..95ab7a0a5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java @@ -0,0 +1,66 @@ +package net.pitan76.mcpitanlib.api; + +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.Logger; + +public abstract class CommonModInitializer { + + public final String MOD_ID; + public final String MOD_NAME; + + public final CompatRegistryV2 registry; + public final Logger logger; + + public CommonModInitializer() { + this.MOD_ID = getId(); + this.MOD_NAME = getName(); + + this.registry = CompatRegistryV2.create(MOD_ID); + this.logger = new Logger(MOD_ID); + + logger.initializeMessage(); + init(); + registry.allRegister(); + } + + public abstract void init(); + + public abstract String getId(); + + public String getName() { + return getId(); + } + + + // Utilities + public Identifier id(String path) { + return IdentifierUtil.id(MOD_ID, path); + } + + public CompatIdentifier compatId(String path) { + return CompatIdentifier.of(MOD_ID, path); + } + + public void info(String message) { + logger.info(message); + } + + public void warn(String message) { + logger.warn(message); + } + + public void error(String message) { + logger.error(message); + } + + public void debug(String message) { + logger.debug(message); + } + + public void trace(String message) { + logger.trace(message); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java b/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java new file mode 100644 index 000000000..62b2c94d6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.Block; +import net.minecraft.component.type.TooltipDisplayComponent; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; + +import java.util.function.Consumer; + +@Deprecated +public class BlockItemByExtendBlock1215 extends BlockItem { + private ExtendBlock block; + private ExtendBlockProvider provider; + + public BlockItemByExtendBlock1215(ExtendBlock block, Settings settings) { + super(block, settings); + this.block = block; + } + + public BlockItemByExtendBlock1215(ExtendBlockProvider provider, Settings settings) { + super((Block) provider, settings); + this.provider = provider; + } + + @Override + public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + if (block != null) + block.appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); + + if (provider != null) + provider.appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type), new ExtendBlockProvider.Options()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java new file mode 100644 index 000000000..982396018 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.BlockRenderType; + +public class CompatBlockRenderType { + + public static final CompatBlockRenderType MODEL = of(BlockRenderType.MODEL); + public static final CompatBlockRenderType ENTITYBLOCK_ANIMATED = of(BlockRenderType.MODEL); + public static final CompatBlockRenderType INVISIBLE = of(BlockRenderType.INVISIBLE); + + @Deprecated + public final BlockRenderType renderType; + + public CompatBlockRenderType(BlockRenderType renderType) { + this.renderType = renderType; + } + + public static CompatBlockRenderType of(BlockRenderType renderType) { + return new CompatBlockRenderType(renderType); + } + + public BlockRenderType toMinecraft() { + return renderType; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java new file mode 100644 index 000000000..e855ccf32 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java @@ -0,0 +1,96 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; + +public class CompatBlocks { + public static final Block AIR = Blocks.AIR; + public static final Block STONE = Blocks.STONE; + public static final Block COBBLESTONE = Blocks.COBBLESTONE; + public static final Block GRASS_BLOCK = Blocks.GRASS_BLOCK; + public static final Block DIRT = Blocks.DIRT; + public static final Block SAND = Blocks.SAND; + public static final Block RED_SAND = Blocks.RED_SAND; + public static final Block GRANITE = Blocks.GRANITE; + public static final Block POLISHED_GRANITE = Blocks.POLISHED_GRANITE; + public static final Block DIORITE = Blocks.DIORITE; + public static final Block POLISHED_DIORITE = Blocks.POLISHED_DIORITE; + public static final Block ANDESITE = Blocks.ANDESITE; + public static final Block POLISHED_ANDESITE = Blocks.POLISHED_ANDESITE; + public static final Block COARSE_DIRT = Blocks.COARSE_DIRT; + public static final Block PODZOL = Blocks.PODZOL; + + public static final Block OAK_LOG = Blocks.OAK_LOG; + public static final Block SPRUCE_LOG = Blocks.SPRUCE_LOG; + public static final Block BIRCH_LOG = Blocks.BIRCH_LOG; + public static final Block JUNGLE_LOG = Blocks.JUNGLE_LOG; + public static final Block ACACIA_LOG = Blocks.ACACIA_LOG; + public static final Block DARK_OAK_LOG = Blocks.DARK_OAK_LOG; + public static final Block OAK_PLANKS = Blocks.OAK_PLANKS; + public static final Block SPRUCE_PLANKS = Blocks.SPRUCE_PLANKS; + public static final Block BIRCH_PLANKS = Blocks.BIRCH_PLANKS; + public static final Block JUNGLE_PLANKS = Blocks.JUNGLE_PLANKS; + public static final Block ACACIA_PLANKS = Blocks.ACACIA_PLANKS; + public static final Block DARK_OAK_PLANKS = Blocks.DARK_OAK_PLANKS; + public static final Block OAK_SAPLING = Blocks.OAK_SAPLING; + public static final Block SPRUCE_SAPLING = Blocks.SPRUCE_SAPLING; + public static final Block BIRCH_SAPLING = Blocks.BIRCH_SAPLING; + public static final Block JUNGLE_SAPLING = Blocks.JUNGLE_SAPLING; + public static final Block ACACIA_SAPLING = Blocks.ACACIA_SAPLING; + public static final Block DARK_OAK_SAPLING = Blocks.DARK_OAK_SAPLING; + + public static final Block SANDSTONE = Blocks.SANDSTONE; + public static final Block CHISELED_SANDSTONE = Blocks.CHISELED_SANDSTONE; + public static final Block CUT_SANDSTONE = Blocks.CUT_SANDSTONE; + public static final Block NOTE_BLOCK = Blocks.NOTE_BLOCK; + public static final Block POWERED_RAIL = Blocks.POWERED_RAIL; + public static final Block DETECTOR_RAIL = Blocks.DETECTOR_RAIL; + public static final Block PISTON = Blocks.PISTON; + public static final Block STICKY_PISTON = Blocks.STICKY_PISTON; + public static final Block COBWEB = Blocks.COBWEB; + public static final Block GRAVEL = Blocks.GRAVEL; + public static final Block GLASS = Blocks.GLASS; + public static final Block DISPENSER = Blocks.DISPENSER; + + public static final Block COAL_ORE = Blocks.COAL_ORE; + public static final Block IRON_ORE = Blocks.IRON_ORE; + public static final Block COPPER_ORE = Blocks.COPPER_ORE; + public static final Block GOLD_ORE = Blocks.GOLD_ORE; + public static final Block DIAMOND_ORE = Blocks.DIAMOND_ORE; + public static final Block REDSTONE_ORE = Blocks.REDSTONE_ORE; + public static final Block EMERALD_ORE = Blocks.EMERALD_ORE; + public static final Block LAPIS_ORE = Blocks.LAPIS_ORE; + public static final Block NETHER_QUARTZ_ORE = Blocks.NETHER_QUARTZ_ORE; + + public static final Block COAL_BLOCK = Blocks.COAL_BLOCK; + public static final Block IRON_BLOCK = Blocks.IRON_BLOCK; + public static final Block COPPER_BLOCK = Blocks.COPPER_BLOCK; + public static final Block GOLD_BLOCK = Blocks.GOLD_BLOCK; + public static final Block DIAMOND_BLOCK = Blocks.DIAMOND_BLOCK; + public static final Block REDSTONE_BLOCK = Blocks.REDSTONE_BLOCK; + public static final Block EMERALD_BLOCK = Blocks.EMERALD_BLOCK; + public static final Block LAPIS_BLOCK = Blocks.LAPIS_BLOCK; + public static final Block QUARTZ_BLOCK = Blocks.QUARTZ_BLOCK; + + public static final Block TNT = Blocks.TNT; + public static final Block BOOKSHELF = Blocks.BOOKSHELF; + public static final Block OBSIDIAN = Blocks.OBSIDIAN; + public static final Block TORCH = Blocks.TORCH; + public static final Block WALL_TORCH = Blocks.WALL_TORCH; + public static final Block FIRE = Blocks.FIRE; + public static final Block SOUL_FIRE = Blocks.SOUL_FIRE; + public static final Block SPAWNER = Blocks.SPAWNER; + public static final Block OAK_STAIRS = Blocks.OAK_STAIRS; + public static final Block CHEST = Blocks.CHEST; + public static final Block REDSTONE_WIRE = Blocks.REDSTONE_WIRE; + + public static final Block WATER = Blocks.WATER; + public static final Block LAVA = Blocks.LAVA; + public static final Block BEDROCK = Blocks.BEDROCK; + + // ---- + + public static boolean isExist(Block block) { + return block != null && block != Blocks.AIR; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java new file mode 100644 index 000000000..66fe3f21b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.ChestBlock; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.block.entity.ChestBlockEntity; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvents; + +import java.util.function.Supplier; + +public class CompatChestBlock extends ChestBlock implements CompatBlockProvider { + public CompatChestBlock(Settings settings, Supplier> supplier) { + super(supplier, CompatSoundEvents.BLOCK_CHEST_OPEN.get(), CompatSoundEvents.BLOCK_CHEST_CLOSE.get(), settings); + } + + public CompatibleBlockSettings compatSettings; + + public CompatChestBlock(CompatibleBlockSettings settings, Supplier> supplier) { + this(settings.build(), supplier); + } + + /** + * @deprecated Use {@link #createBlockEntity(TileCreateEvent)} instead. + */ + @Deprecated + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return createBlockEntity(new TileCreateEvent(pos, state)); + } + + /** + * @see ExtendBlockEntityProvider#createBlockEntity(TileCreateEvent) + */ + public BlockEntity createBlockEntity(TileCreateEvent event) { + return super.createBlockEntity(event.getBlockPos(), event.getBlockState()); + } + + @Override + public CompatibleBlockSettings getCompatSettings() { + return compatSettings; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java new file mode 100644 index 000000000..d2bf93a5a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java @@ -0,0 +1,80 @@ +package net.pitan76.mcpitanlib.api.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.PillarBlock; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.StateManager; +import net.minecraft.util.math.Direction; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; +import net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs; +import net.pitan76.mcpitanlib.api.state.property.CompatProperties; +import net.pitan76.mcpitanlib.api.state.property.EnumProperty; +import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; + +public class CompatPillarBlock extends PillarBlock implements CompatBlockProvider { + + public static final EnumProperty AXIS = CompatProperties.of(PillarBlock.AXIS); + + public CompatibleBlockSettings settings; + + @Override + public CompatibleBlockSettings getCompatSettings() { + return settings; + } + + public CompatPillarBlock(Settings settings) { + super(settings); + } + + public CompatPillarBlock(CompatibleBlockSettings settings) { + this(settings.build()); + this.settings = settings; + } + + public void appendProperties(AppendPropertiesArgs args) { + super.appendProperties(args.builder); + } + + public BlockState getPlacementState(PlacementStateArgs args) { + return super.getPlacementState(args.ctx); + } + + @Deprecated + @Override + public void appendProperties(StateManager.Builder builder) { + appendProperties(new AppendPropertiesArgs(builder)); + } + + @Deprecated + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return getPlacementState(new PlacementStateArgs(ctx)); + } + + // ExtendBlockProvider + @Deprecated + @Override + public void appendProperties(AppendPropertiesArgs args, Options options) { + CompatBlockProvider.super.appendProperties(args, options); + } + + @Deprecated + @Override + public BlockState getPlacementState(PlacementStateArgs args, Options options) { + return CompatBlockProvider.super.getPlacementState(args, options); + } + + @Deprecated + @Override + public MapCodec getCodec() { + return getCompatCodec().getCodec(); + } + + public CompatMapCodec getCompatCodec() { + return CompatMapCodec.of(super.getCodec()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java new file mode 100644 index 000000000..ac7284995 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java @@ -0,0 +1,100 @@ +package net.pitan76.mcpitanlib.api.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.SlabBlock; +import net.minecraft.block.enums.SlabType; +import net.minecraft.entity.ai.pathing.NavigationType; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.StateManager; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; +import net.pitan76.mcpitanlib.api.event.block.CanPathfindThroughArgs; +import net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs; +import net.pitan76.mcpitanlib.api.state.property.BooleanProperty; +import net.pitan76.mcpitanlib.api.state.property.CompatProperties; +import net.pitan76.mcpitanlib.api.state.property.EnumProperty; +import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; + +public class CompatSlabBlock extends SlabBlock implements CompatBlockProvider { + + public static final EnumProperty TYPE = CompatProperties.of(SlabBlock.TYPE); + public static final BooleanProperty WATERLOGGED = CompatProperties.of(SlabBlock.WATERLOGGED); + + public CompatibleBlockSettings settings; + + @Override + public CompatibleBlockSettings getCompatSettings() { + return settings; + } + + public CompatSlabBlock(Settings settings) { + super(settings); + } + + public CompatSlabBlock(CompatibleBlockSettings settings) { + this(settings.build()); + } + + public void appendProperties(AppendPropertiesArgs args) { + super.appendProperties(args.builder); + } + + public BlockState getPlacementState(PlacementStateArgs args) { + return super.getPlacementState(args.ctx); + } + + @Deprecated + @Override + public void appendProperties(StateManager.Builder builder) { + appendProperties(new AppendPropertiesArgs(builder)); + } + + @Deprecated + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return getPlacementState(new PlacementStateArgs(ctx)); + } + + // ExtendBlockProvider + @Deprecated + @Override + public void appendProperties(AppendPropertiesArgs args, Options options) { + CompatBlockProvider.super.appendProperties(args, options); + } + + @Deprecated + @Override + public BlockState getPlacementState(PlacementStateArgs args, Options options) { + return CompatBlockProvider.super.getPlacementState(args, options); + } + + @Deprecated + @Override + public MapCodec getCodec() { + return getCompatCodec().getCodec(); + } + + public CompatMapCodec getCompatCodec() { + return CompatMapCodec.of(super.getCodec()); + } + + @Deprecated + @Override + public boolean canPathfindThrough(BlockState state, NavigationType type) { + return canPathfindThrough(new CanPathfindThroughArgs(state, type)); + } + + public boolean canPathfindThrough(CanPathfindThroughArgs args) { + return super.canPathfindThrough(args.state, args.type); + } + + @Override + public Boolean canPathfindThrough(CanPathfindThroughArgs args, Options options) { + return CompatBlockProvider.super.canPathfindThrough(args, options); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java new file mode 100644 index 000000000..6ad2e57ab --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java @@ -0,0 +1,129 @@ +package net.pitan76.mcpitanlib.api.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.block.*; +import net.minecraft.block.enums.BlockHalf; +import net.minecraft.block.enums.StairShape; +import net.minecraft.entity.ai.pathing.NavigationType; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.EnumProperty; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; +import net.pitan76.mcpitanlib.api.event.block.CanPathfindThroughArgs; +import net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs; +import net.pitan76.mcpitanlib.api.state.property.CompatProperties; +import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; +import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; + +public class CompatStairsBlock extends StairsBlock implements CompatBlockProvider { + + public static final DirectionProperty FACING = CompatProperties.HORIZONTAL_FACING; + public static final EnumProperty HALF = StairsBlock.HALF; + public static final EnumProperty SHAPE = StairsBlock.SHAPE; + public static final BooleanProperty WATERLOGGED = StairsBlock.WATERLOGGED; + + public CompatibleBlockSettings compatSettings; + + /** + * get compatible block settings + * @return CompatibleBlockSettings + */ + @Override + public CompatibleBlockSettings getCompatSettings() { + return compatSettings; + } + + public CompatStairsBlock(BlockState baseBlockState, Settings settings) { + super(baseBlockState, settings); + } + + public CompatStairsBlock(BlockState baseBlockState, CompatibleBlockSettings settings) { + this(baseBlockState, settings.build()); + this.compatSettings = settings; + } + + public VoxelShape getOutlineShape(OutlineShapeEvent event) { + return super.getOutlineShape(event.state, event.world, event.pos, event.context); + } + + public void appendProperties(AppendPropertiesArgs args) { + super.appendProperties(args.builder); + } + + public BlockState getPlacementState(PlacementStateArgs args) { + return super.getPlacementState(args.ctx); + } + + @Deprecated + @Override + public void appendProperties(StateManager.Builder builder) { + appendProperties(new AppendPropertiesArgs(builder)); + } + + @Deprecated + @Override + public BlockState getPlacementState(ItemPlacementContext ctx) { + return getPlacementState(new PlacementStateArgs(ctx)); + } + + @Deprecated + @Override + protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); + } + + // ExtendBlockProvider + @Deprecated + @Override + public void appendProperties(AppendPropertiesArgs args, Options options) { + CompatBlockProvider.super.appendProperties(args, options); + } + + @Deprecated + @Override + public BlockState getPlacementState(PlacementStateArgs args, Options options) { + return CompatBlockProvider.super.getPlacementState(args, options); + } + + @Deprecated + @Override + public VoxelShape getOutlineShape(OutlineShapeEvent event, Options options) { + return CompatBlockProvider.super.getOutlineShape(event, options); + } + + @Deprecated + @Override + public MapCodec getCodec() { + return getCompatCodec().getCodec(); + } + + public CompatMapCodec getCompatCodec() { + return CompatMapCodec.of(super.getCodec()); + } + + @Deprecated + @Override + public boolean canPathfindThrough(BlockState state, NavigationType type) { + return canPathfindThrough(new CanPathfindThroughArgs(state, type)); + } + + public boolean canPathfindThrough(CanPathfindThroughArgs args) { + return super.canPathfindThrough(args.state, args.type); + } + + @Override + public Boolean canPathfindThrough(CanPathfindThroughArgs args, Options options) { + return CompatBlockProvider.super.canPathfindThrough(args, options); + } + + public BlockState getBaseBlockState() { + return super.baseBlockState; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java new file mode 100644 index 000000000..0402b719d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.Waterloggable; +import net.minecraft.sound.SoundEvent; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; + +import java.util.Optional; + +public interface CompatWaterloggable extends Waterloggable { + + @Override + default Optional getBucketFillSound() { + return getCompactBucketFillSound() + .map(CompatSoundEvent::get); + } + + default Optional getCompactBucketFillSound() { + return Waterloggable.super.getBucketFillSound() + .map(CompatSoundEvent::of); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java new file mode 100644 index 000000000..7a07599bf --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java @@ -0,0 +1,253 @@ +package net.pitan76.mcpitanlib.api.block; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.MapColor; +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.util.DyeColor; +import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; + +import java.util.function.Function; +import java.util.function.ToIntFunction; + +@Deprecated +public class CompatibleBlockSettings { + public static final Codec CODEC = MapCodec.unitCodec(CompatibleBlockSettings::of); + + protected final AbstractBlock.Settings settings; + + public CompatibleBlockSettings() { + this.settings = AbstractBlock.Settings.create(); + } + + @Deprecated + public static CompatibleBlockSettings of() { + return new CompatibleBlockSettings(); + } + + @Deprecated + private static CompatibleBlockSettings copyCompatibleMaterial(CompatibleMaterial material, CompatibleBlockSettings settings) { + settings.mapColor(material.getColor()); + if (material.isLiquid()) + settings.settings.liquid(); + if (material.isSolid()) + settings.settings.solid(); + if (material.isReplaceable()) + settings.settings.replaceable(); + if (material.isSolid()) + settings.settings.solid(); + if (material.isBurnable()) + settings.settings.burnable(); + settings.settings.pistonBehavior(material.getPistonBehavior()); + return settings; + } + + public CompatibleBlockSettings(CompatibleMaterial material, MapColor mapColor) { + this.settings = AbstractBlock.Settings.create(); + copyCompatibleMaterial(material, this); + mapColor(mapColor); + } + + public CompatibleBlockSettings(CompatibleMaterial material, DyeColor dyeColor) { + this.settings = AbstractBlock.Settings.create(); + copyCompatibleMaterial(material, this); + mapColor(dyeColor); + } + + public CompatibleBlockSettings(CompatibleMaterial material) { + this.settings = AbstractBlock.Settings.create(); + copyCompatibleMaterial(material, this); + } + + public CompatibleBlockSettings(CompatibleMaterial material, Function mapColor) { + this.settings = AbstractBlock.Settings.create(); + copyCompatibleMaterial(material, this); + mapColor(mapColor); + } + + @Deprecated + public static CompatibleBlockSettings of(CompatibleMaterial material, MapColor mapColor) { + return new CompatibleBlockSettings(material, mapColor); + } + + @Deprecated + public static CompatibleBlockSettings of(CompatibleMaterial material, DyeColor dyeColor) { + return new CompatibleBlockSettings(material, dyeColor); + } + + @Deprecated + public static CompatibleBlockSettings of(CompatibleMaterial material) { + return new CompatibleBlockSettings(material); + } + + @Deprecated + public static CompatibleBlockSettings of(CompatibleMaterial material, Function mapColor) { + return new CompatibleBlockSettings(material, mapColor); + } + + public CompatibleBlockSettings(AbstractBlock block) { + this.settings = AbstractBlock.Settings.copy(block); + } + + @Deprecated + public static CompatibleBlockSettings copy(AbstractBlock block) { + return new CompatibleBlockSettings(block); + } + + public CompatibleBlockSettings air() { + settings.air(); + return this; + } + + public CompatibleBlockSettings blockVision(AbstractBlock.ContextPredicate predicate) { + settings.blockVision(predicate); + return this; + } + + public CompatibleBlockSettings postProcess(AbstractBlock.ContextPredicate predicate) { + settings.postProcess(predicate); + return this; + } + + public CompatibleBlockSettings solidBlock(AbstractBlock.ContextPredicate predicate) { + settings.solidBlock(predicate); + return this; + } + + public CompatibleBlockSettings suffocates(AbstractBlock.ContextPredicate predicate) { + settings.suffocates(predicate); + return this; + } + + public CompatibleBlockSettings mapColor(MapColor color) { + settings.mapColor(color); + return this; + } + + public CompatibleBlockSettings mapColor(DyeColor color) { + settings.mapColor(color); + return this; + } + + public CompatibleBlockSettings mapColor(Function color) { + settings.mapColor(color); + return this; + } + + @Deprecated + public CompatibleBlockSettings dropsLike(Block source) { + return this; + } + + public CompatibleBlockSettings breakInstantly() { + settings.breakInstantly(); + return this; + } + + public CompatibleBlockSettings dropsNothing() { + settings.dropsNothing(); + return this; + } + + public CompatibleBlockSettings dynamicBounds() { + settings.dynamicBounds(); + return this; + } + + public CompatibleBlockSettings hardness(float hardness) { + settings.hardness(hardness); + return this; + } + + public CompatibleBlockSettings noBlockBreakParticles() { + settings.noBlockBreakParticles(); + return this; + } + + public CompatibleBlockSettings requiresTool() { + settings.requiresTool(); + return this; + } + + public CompatibleBlockSettings noCollision() { + settings.noCollision(); + return this; + } + + public CompatibleBlockSettings nonOpaque() { + settings.nonOpaque(); + return this; + } + + public CompatibleBlockSettings resistance(float resistance) { + settings.resistance(resistance); + return this; + } + + public CompatibleBlockSettings strength(float strength) { + settings.strength(strength); + return this; + } + + public CompatibleBlockSettings strength(float hardness, float resistance) { + settings.strength(hardness, resistance); + return this; + } + + public CompatibleBlockSettings ticksRandomly() { + settings.ticksRandomly(); + return this; + } + + public CompatibleBlockSettings sounds(BlockSoundGroup blockSoundGroup) { + settings.sounds(blockSoundGroup); + return this; + } + + public CompatibleBlockSettings sounds(CompatBlockSoundGroup blockSoundGroup) { + return sounds(blockSoundGroup.get()); + } + + public CompatibleBlockSettings luminance(ToIntFunction luminance) { + settings.luminance(luminance); + return this; + } + + public CompatibleBlockSettings jumpVelocityMultiplier(float jumpVelocityMultiplier) { + settings.jumpVelocityMultiplier(jumpVelocityMultiplier); + return this; + } + + public CompatibleBlockSettings slipperiness(float slipperiness) { + settings.slipperiness(slipperiness); + return this; + } + + public CompatibleBlockSettings velocityMultiplier(float velocityMultiplier) { + settings.velocityMultiplier(velocityMultiplier); + return this; + } + + public CompatibleBlockSettings emissiveLighting(AbstractBlock.ContextPredicate predicate) { + settings.emissiveLighting(predicate); + return this; + } + + public CompatibleBlockSettings offset(AbstractBlock.OffsetType offsetType) { + settings.offset(offsetType); + return this; + } + + public CompatibleBlockSettings allowsSpawning(AbstractBlock.TypedContextPredicate> predicate) { + settings.allowsSpawning(predicate); + return this; + } + + public AbstractBlock.Settings build() { + return settings; + + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java new file mode 100644 index 000000000..e39962a99 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java @@ -0,0 +1,206 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.MapColor; +import net.minecraft.block.piston.PistonBehavior; + +public final class CompatibleMaterial { + public static final CompatibleMaterial AIR; + public static final CompatibleMaterial STRUCTURE_VOID; + public static final CompatibleMaterial PORTAL; + public static final CompatibleMaterial CARPET; + public static final CompatibleMaterial PLANT; + public static final CompatibleMaterial UNDERWATER_PLANT; + public static final CompatibleMaterial REPLACEABLE_PLANT; + public static final CompatibleMaterial NETHER_SHOOTS; + public static final CompatibleMaterial REPLACEABLE_UNDERWATER_PLANT; + public static final CompatibleMaterial WATER; + public static final CompatibleMaterial BUBBLE_COLUMN; + public static final CompatibleMaterial LAVA; + public static final CompatibleMaterial SNOW_LAYER; + public static final CompatibleMaterial FIRE; + public static final CompatibleMaterial DECORATION; + public static final CompatibleMaterial COBWEB; + public static final CompatibleMaterial SCULK; + public static final CompatibleMaterial REDSTONE_LAMP; + public static final CompatibleMaterial ORGANIC_PRODUCT; + public static final CompatibleMaterial SOIL; + public static final CompatibleMaterial SOLID_ORGANIC; + public static final CompatibleMaterial DENSE_ICE; + public static final CompatibleMaterial AGGREGATE; + public static final CompatibleMaterial SPONGE; + public static final CompatibleMaterial SHULKER_BOX; + public static final CompatibleMaterial WOOD; + public static final CompatibleMaterial NETHER_WOOD; + public static final CompatibleMaterial BAMBOO_SAPLING; + public static final CompatibleMaterial BAMBOO; + public static final CompatibleMaterial WOOL; + public static final CompatibleMaterial TNT; + public static final CompatibleMaterial LEAVES; + public static final CompatibleMaterial GLASS; + public static final CompatibleMaterial ICE; + public static final CompatibleMaterial CACTUS; + public static final CompatibleMaterial STONE; + public static final CompatibleMaterial METAL; + public static final CompatibleMaterial SNOW_BLOCK; + public static final CompatibleMaterial REPAIR_STATION; + public static final CompatibleMaterial BARRIER; + public static final CompatibleMaterial PISTON; + public static final CompatibleMaterial MOSS_BLOCK; + public static final CompatibleMaterial GOURD; + public static final CompatibleMaterial EGG; + public static final CompatibleMaterial CAKE; + public static final CompatibleMaterial AMETHYST; + public static final CompatibleMaterial POWDER_SNOW; + private final MapColor color; + private final PistonBehavior pistonBehavior; + private final boolean burnable; + private final boolean liquid; + private final boolean replaceable; + private final boolean solid; + + public CompatibleMaterial(MapColor color, boolean liquid, boolean solid, boolean burnable, boolean replaceable, PistonBehavior pistonBehavior) { + this.color = color; + this.liquid = liquid; + this.solid = solid; + this.burnable = burnable; + this.replaceable = replaceable; + this.pistonBehavior = pistonBehavior; + } + + public boolean isLiquid() { + return this.liquid; + } + + public boolean isSolid() { + return this.solid; + } + + public boolean isBurnable() { + return this.burnable; + } + + public boolean isReplaceable() { + return this.replaceable; + } + + public PistonBehavior getPistonBehavior() { + return this.pistonBehavior; + } + + public MapColor getColor() { + return this.color; + } + + static { + AIR = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); + STRUCTURE_VOID = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); + PORTAL = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().blocksPistons().build(); + CARPET = (new Builder(MapColor.WHITE_GRAY)).allowsMovement().lightPassesThrough().notSolid().burnable().build(); + PLANT = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); + UNDERWATER_PLANT = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); + REPLACEABLE_PLANT = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().burnable().build(); + NETHER_SHOOTS = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + REPLACEABLE_UNDERWATER_PLANT = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + WATER = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); + BUBBLE_COLUMN = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); + LAVA = (new Builder(MapColor.BRIGHT_RED)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); + SNOW_LAYER = (new Builder(MapColor.WHITE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + FIRE = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + DECORATION = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); + COBWEB = (new Builder(MapColor.WHITE_GRAY)).allowsMovement().lightPassesThrough().destroyedByPiston().build(); + SCULK = (new Builder(MapColor.BLACK)).build(); + REDSTONE_LAMP = (new Builder(MapColor.CLEAR)).build(); + ORGANIC_PRODUCT = (new Builder(MapColor.LIGHT_BLUE_GRAY)).build(); + SOIL = (new Builder(MapColor.DIRT_BROWN)).build(); + SOLID_ORGANIC = (new Builder(MapColor.PALE_GREEN)).build(); + DENSE_ICE = (new Builder(MapColor.PALE_PURPLE)).build(); + AGGREGATE = (new Builder(MapColor.PALE_YELLOW)).build(); + SPONGE = (new Builder(MapColor.YELLOW)).build(); + SHULKER_BOX = (new Builder(MapColor.PURPLE)).build(); + WOOD = (new Builder(MapColor.OAK_TAN)).burnable().build(); + NETHER_WOOD = (new Builder(MapColor.OAK_TAN)).build(); + BAMBOO_SAPLING = (new Builder(MapColor.OAK_TAN)).burnable().destroyedByPiston().allowsMovement().build(); + BAMBOO = (new Builder(MapColor.OAK_TAN)).burnable().destroyedByPiston().build(); + WOOL = (new Builder(MapColor.WHITE_GRAY)).burnable().build(); + TNT = (new Builder(MapColor.BRIGHT_RED)).burnable().lightPassesThrough().build(); + LEAVES = (new Builder(MapColor.DARK_GREEN)).burnable().lightPassesThrough().destroyedByPiston().build(); + GLASS = (new Builder(MapColor.CLEAR)).lightPassesThrough().build(); + ICE = (new Builder(MapColor.PALE_PURPLE)).lightPassesThrough().build(); + CACTUS = (new Builder(MapColor.DARK_GREEN)).lightPassesThrough().destroyedByPiston().build(); + STONE = (new Builder(MapColor.STONE_GRAY)).build(); + METAL = (new Builder(MapColor.IRON_GRAY)).build(); + SNOW_BLOCK = (new Builder(MapColor.WHITE)).build(); + REPAIR_STATION = (new Builder(MapColor.IRON_GRAY)).blocksPistons().build(); + BARRIER = (new Builder(MapColor.CLEAR)).blocksPistons().build(); + PISTON = (new Builder(MapColor.STONE_GRAY)).blocksPistons().build(); + MOSS_BLOCK = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); + GOURD = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); + EGG = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); + CAKE = (new Builder(MapColor.CLEAR)).destroyedByPiston().build(); + AMETHYST = (new Builder(MapColor.PURPLE)).build(); + POWDER_SNOW = (new Builder(MapColor.WHITE)).notSolid().allowsMovement().build(); + } + + public static class Builder { + private PistonBehavior pistonBehavior; + private boolean blocksMovement; + private boolean burnable; + private boolean liquid; + private boolean replaceable; + private boolean solid; + private final MapColor color; + private boolean blocksLight; + + public Builder(MapColor color) { + this.pistonBehavior = PistonBehavior.NORMAL; + this.blocksMovement = true; + this.solid = true; + this.blocksLight = true; + this.color = color; + } + + public Builder liquid() { + this.liquid = true; + return this; + } + + public Builder notSolid() { + this.solid = false; + return this; + } + + public Builder allowsMovement() { + this.blocksMovement = false; + return this; + } + + Builder lightPassesThrough() { + this.blocksLight = false; + return this; + } + + protected Builder burnable() { + this.burnable = true; + return this; + } + + public Builder replaceable() { + this.replaceable = true; + return this; + } + + protected Builder destroyedByPiston() { + this.pistonBehavior = PistonBehavior.DESTROY; + return this; + } + + protected Builder blocksPistons() { + this.pistonBehavior = PistonBehavior.BLOCK; + return this; + } + + public CompatibleMaterial build() { + return new CompatibleMaterial(this.color, this.liquid, this.solid, this.burnable, this.replaceable, this.pistonBehavior); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java new file mode 100644 index 000000000..89e9d54aa --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java @@ -0,0 +1,369 @@ +package net.pitan76.mcpitanlib.api.block; + +import com.mojang.serialization.MapCodec; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCollisionHandler; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.pathing.NavigationType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.FluidState; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.context.LootWorldContext; +import net.minecraft.screen.NamedScreenHandlerFactory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.SimpleNamedScreenHandlerFactory; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.state.StateManager; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; +import net.minecraft.world.WorldView; +import net.minecraft.world.block.WireOrientation; +import net.minecraft.world.tick.ScheduledTickView; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.block.*; +import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; +import net.pitan76.mcpitanlib.api.event.block.StateForNeighborUpdateArgs; +import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class ExtendBlock extends Block { + public CompatibleBlockSettings compatSettings; + + public ExtendBlock(Settings settings) { + super(settings); + } + + public ExtendBlock(CompatibleBlockSettings settings) { + super(settings.build()); + this.compatSettings = settings; + } + + /** + * get compatible block settings + * @return CompatibleBlockSettings + */ + public CompatibleBlockSettings getCompatSettings() { + return compatSettings; + } + + /** + * get collision voxel shape + * @param event CollisionShapeEvent + * @return VoxelShape + */ + public VoxelShape getCollisionShape(CollisionShapeEvent event) { + return super.getCollisionShape(event.state, event.world, event.pos, event.context); + } + + @Deprecated + @Override + public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); + } + + /** + * get outline voxel shape + * @param event OutlineShapeEvent + * @return VoxelShape + */ + public VoxelShape getOutlineShape(OutlineShapeEvent event) { + return super.getOutlineShape(event.state, event.world, event.pos, event.context); + } + + @Deprecated + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); + } + + /** + * block scheduled tick event + * @param event BlockScheduledTickEvent + */ + public void scheduledTick(BlockScheduledTickEvent event) { + super.scheduledTick(event.state, event.world, event.pos, event.random.getMcRandom()); + } + + @Override + @Deprecated + public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + scheduledTick(new BlockScheduledTickEvent(state, world, pos, random)); + } + + @Override + @Deprecated + protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { + return onRightClick(new BlockUseEvent(state, world, pos, player, player.getActiveHand(), hit)).toActionResult(); + } + + /** + * block right click event + * @param event ActionResultType + * @return BlockUseEvent + */ + public CompatActionResult onRightClick(BlockUseEvent event) { + return CompatActionResult.create(super.onUse(event.state, event.world, event.pos, event.player.getPlayerEntity(), event.hit)); + } + + @Deprecated + @Nullable + @Override + public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) { + return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> + createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player)), getScreenTitle() + ); + } + + /** + * screen handler create event + * @param event ScreenHandlerCreateEvent + * @return ScreenHandler + */ + @Nullable + public ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event) { + return null; + } + + /** + * get screen title + * @return Text + */ + @Nullable + public Text getScreenTitle() { + return TextUtil.literal(""); + } + + @Override + @Deprecated + public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + onPlaced(new BlockPlacedEvent(world, pos, state, placer, itemStack)); + } + + /** + * block placed event + * @param event BlockPlacedEvent + */ + public void onPlaced(BlockPlacedEvent event) { + super.onPlaced(event.world, event.pos, event.state, event.placer, event.stack); + } + + @Override + @Deprecated + public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + return onBreak(new BlockBreakEvent(world, pos, state, player)).state; + } + + /** + * block break event + * @param event BlockBreakEvent + * @return BlockBreakResult + */ + public BlockBreakResult onBreak(BlockBreakEvent event) { + BlockState state = super.onBreak(event.world, event.pos, event.state, event.getPlayerEntity()); + return new BlockBreakResult(state); + } + + @Override + @Deprecated + public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { + PickStackEvent event = new PickStackEvent(world, pos, state); + event.setIncludeData(includeData); + return getPickStack(event); + } + + /** + * block pick stack event + * @param event PickStackEvent + * @return ItemStack + */ + public ItemStack getPickStack(PickStackEvent event) { + return super.getPickStack(event.worldView, event.pos, event.state, event.includeData); + } + + @Override + @Deprecated + public void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved) { + onStateReplaced(new StateReplacedEvent(state, world, pos, world.getBlockState(pos), moved)); + } + + /** + * block state replaced event + * @param event StateReplacedEvent + */ + public void onStateReplaced(StateReplacedEvent event) { + super.onStateReplaced(event.state, (ServerWorld) event.world, event.pos, event.moved); + } + + @Deprecated + @Override + public List getDroppedStacks(BlockState state, LootWorldContext.Builder builder) { + return getDroppedStacks(new DroppedStacksArgs(state, builder)); + } + + /** + * block dropped stacks event + * @param args DroppedStacksArgs + * @return List + */ + public List getDroppedStacks(DroppedStacksArgs args) { + return super.getDroppedStacks(args.state, args.builder); + } + + @Deprecated + @Override + public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, WireOrientation wireOrientation, boolean notify) { + neighborUpdate(new NeighborUpdateEvent(state, world, pos, sourceBlock, wireOrientation, notify)); + } + + /** + * block neighbor update event + * @param event NeighborUpdateEvent + */ + public void neighborUpdate(NeighborUpdateEvent event) { + super.neighborUpdate(event.state, event.world, event.pos, event.sourceBlock, event.wireOrientation, event.notify); + } + + @Deprecated + @Override + public void appendProperties(StateManager.Builder builder) { + appendProperties(new AppendPropertiesArgs(builder)); + } + + /** + * append properties event + * @param args AppendPropertiesArgs + */ + public void appendProperties(AppendPropertiesArgs args) { + super.appendProperties(args.builder); + } + + /** + * Compatible for getDefaultState() + * @return default block state + */ + public BlockState getNewDefaultState() { + return super.getDefaultState(); + } + + /** + * Compatible for setDefaultState() + * @param state BlockState + */ + public void setNewDefaultState(BlockState state) { + super.setDefaultState(state); + } + + @Deprecated + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + return this.getPlacementState(new PlacementStateArgs(ctx, this)); + } + + /** + * get placement state + * @param args PlacementStateArgs + * @return BlockState + */ + public @Nullable BlockState getPlacementState(PlacementStateArgs args) { + return super.getPlacementState(args.ctx); + } + + /** + * append tooltip to item + * @param event ItemAppendTooltipEvent + */ + public void appendTooltip(ItemAppendTooltipEvent event) { + + } + + @Deprecated + @Override + public boolean canPathfindThrough(BlockState state, NavigationType type) { + return canPathfindThrough(new CanPathfindThroughArgs(state, type)); + } + + public boolean canPathfindThrough(CanPathfindThroughArgs args) { + return super.canPathfindThrough(args.state, args.type); + } + + @Deprecated + @Override + protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler, boolean bl) { + onEntityCollision(new EntityCollisionEvent(state, world, pos, entity, handler, bl)); + } + + public void onEntityCollision(EntityCollisionEvent e) { + super.onEntityCollision(e.state, e.world, e.pos, e.entity, e.handler, e.bl); + } + + @Deprecated + @Override + public void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) { + onBlockBreakStart(new BlockBreakStartEvent(state, world, pos, new Player(player))); + } + + public void onBlockBreakStart(BlockBreakStartEvent e) { + super.onBlockBreakStart(e.state, e.world, e.pos, e.player.getPlayerEntity()); + } + + @Deprecated + @Override + protected MapCodec getCodec() { + return getCompatCodec().getCodec(); + } + + public CompatMapCodec getCompatCodec() { + return CompatMapCodec.of(super.getCodec()); + } + + @Deprecated + @Override + protected FluidState getFluidState(BlockState state) { + return getFluidState(new FluidStateArgs(state)); + } + + public FluidState getFluidState(FluidStateArgs args) { + return super.getFluidState(args.getState()); + } + + @Deprecated + @Override + protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { + return getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random))); + } + + public BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { + return super.getStateForNeighborUpdate(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom()); + } + +// @Deprecated +// @Override +// protected ImmutableMap getShapesForStates(Function stateToShape) { +// return getShapesForStates(new ShapesForStatesArgs(stateToShape)); +// } +// +// public ImmutableMap getShapesForStates(ShapesForStatesArgs args) { +// return super.(args.stateToShape); +// } + + public StateManager callGetStateManager() { + return super.getStateManager(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java new file mode 100644 index 000000000..2b9481a95 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java @@ -0,0 +1,79 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.BlockEntityProvider; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityTicker; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.tile.ExtendBlockEntityTicker; +import org.jetbrains.annotations.Nullable; + +public interface ExtendBlockEntityProvider extends BlockEntityProvider { + + /** + * @deprecated Use {@link #createBlockEntity(TileCreateEvent)} instead. + */ + @Deprecated + @Nullable + default BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return createBlockEntity(new TileCreateEvent(pos, state)); + } + + /** + * create instance of BlockEntity + * @param event TileCreateEvent + * @return BlockEntity + * + *
{@code
+     * public BlockEntity createBlockEntity(TileCreateEvent e) {
+     *    return new ExampleBlockEntity(e); // ExampleBlockEntity extends CompatBlockEntity
+     * }
+ */ + @Nullable + default BlockEntity createBlockEntity(TileCreateEvent event) { + if (getBlockEntityType() == null) return null; + + // return new ...BlockEntity(pos, state) + return getBlockEntityType().instantiate(event.getBlockPos(), event.getBlockState()); + } + + @Nullable + default BlockEntityType getBlockEntityType() { + return null; + } + + @Nullable + @Override + default BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + if (isTick()) { + return ((world1, pos, state1, blockEntity) -> { + if (getBlockEntityType() == null || blockEntity == getBlockEntityType().get(world, pos)) { + if (blockEntity instanceof ExtendBlockEntityTicker) { + ExtendBlockEntityTicker ticker = (ExtendBlockEntityTicker) blockEntity; + ticker.tick(world, pos, state, blockEntity); + } else if (blockEntity instanceof BlockEntityTicker) { + BlockEntityTicker ticker = (BlockEntityTicker) blockEntity; + ticker.tick(world, pos, state, blockEntity); + } + } + }); + } + return BlockEntityProvider.super.getTicker(world, state, type); + } + + @Nullable + default ExtendBlockEntityTicker getCompatibleTicker(World world, BlockState state, BlockEntityType type) { + BlockEntityTicker ticker = getTicker(world, state, type); + if (ticker instanceof ExtendBlockEntityTicker) + return (ExtendBlockEntityTicker) ticker; + + return null; + } + + default boolean isTick() { + return false; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java new file mode 100644 index 000000000..996661e2f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java @@ -0,0 +1,161 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.block.BlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.minecraft.util.shape.VoxelShape; +import net.pitan76.mcpitanlib.api.event.block.*; +import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; +import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +import java.util.List; + +public interface ExtendBlockProvider { + + /** + * get collision voxel shape + * @param event CollisionShapeEvent + * @param options Options + * @return VoxelShape + */ + default VoxelShape getCollisionShape(CollisionShapeEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * get outline voxel shape + * @param event OutlineShapeEvent + * @param options Options + * @return VoxelShape + */ + default VoxelShape getOutlineShape(OutlineShapeEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * block scheduled tick event + * @param event BlockScheduledTickEvent + * @param options Options + */ + default void scheduledTick(BlockScheduledTickEvent event, Options options) { + options.cancel = false; + } + + /** + * block right click event + * @param event BlockUseEvent + * @param options Options + * @return ActionResult + */ + default CompatActionResult onRightClick(BlockUseEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * screen handler create event + * @param event ScreenHandlerCreateEvent + * @param options Options + * @return ScreenHandler + */ + default ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * get screen title + * @return Text + */ + default Text getScreenTitle() { + return TextUtil.literal(""); + } + + /** + * block placed event + * @param event BlockPlacedEvent + * @param options Options + */ + default void onPlaced(BlockPlacedEvent event, Options options) { + options.cancel = false; + } + + /** + * block break event + * @param event BlockBreakEvent + * @param options Options + * @return BlockBreakResult + */ + default BlockBreakResult onBreak(BlockBreakEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * block state replaced event + * @param event StateReplacedEvent + * @param options Options + */ + default void onStateReplaced(StateReplacedEvent event, Options options) { + options.cancel = false; + } + + /** + * get pick stack + * @param event PickStackEvent + * @param options Options + * @return ItemStack + */ + default ItemStack getPickStack(PickStackEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * get placement state + * @param args PlacementStateArgs + * @param options Options + */ + default BlockState getPlacementState(PlacementStateArgs args, Options options) { + options.cancel = false; + return null; + } + + /** + * append properties + * @param args AppendPropertiesArgs + * @param options Options + */ + default void appendProperties(AppendPropertiesArgs args, Options options) { + options.cancel = false; + } + + /** + * get dropped stacks + * @param args DroppedStacksArgs + * @param options Options + * @return List + */ + default List getDroppedStacks(DroppedStacksArgs args, Options options) { + options.cancel = false; + return null; + } + + default void appendTooltip(ItemAppendTooltipEvent event, Options options) { + options.cancel = false; + } + + default Boolean canPathfindThrough(CanPathfindThroughArgs args, Options options) { + options.cancel = false; + return null; + } + + public static class Options { + public boolean cancel = true; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java new file mode 100644 index 000000000..645b17745 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.block.args; + +import net.minecraft.block.BlockState; +import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; + +public class RenderTypeArgs implements BlockStatePropertyHolder { + public BlockState state; + + public RenderTypeArgs(BlockState state) { + this.state = state; + } + + public BlockState getRawBlockState() { + return state; + } + + @Override + public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getRawBlockState()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java new file mode 100644 index 000000000..0b4e6339e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.block.args; + +import net.minecraft.block.BlockState; +import net.minecraft.util.BlockRotation; +import net.minecraft.util.math.Direction; +import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; + +public class RotateArgs implements BlockStatePropertyHolder { + + public BlockState state; + public BlockRotation rotation; + + public RotateArgs(BlockState state, BlockRotation rotation) { + this.state = state; + this.rotation = rotation; + } + + public BlockState getRawBlockState() { + return state; + } + + public BlockRotation getRawRotation() { + return rotation; + } + + @Override + public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public Direction rotate(Direction direction) { + return rotation.rotate(direction); + } + + public net.pitan76.mcpitanlib.midohra.util.math.Direction rotate(net.pitan76.mcpitanlib.midohra.util.math.Direction direction) { + return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(rotation.rotate(direction.toMinecraft())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java new file mode 100644 index 000000000..503136183 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.api.block.args; + +import net.minecraft.block.BlockState; +import net.minecraft.util.math.Direction; + +public class SideInvisibleArgs { + public BlockState state; + public BlockState stateFrom; + public Direction direction; + + public SideInvisibleArgs(BlockState state, BlockState stateFrom, Direction direction) { + this.state = state; + this.stateFrom = stateFrom; + this.direction = direction; + } + + public SideInvisibleArgs(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.block.BlockState stateFrom, net.pitan76.mcpitanlib.midohra.util.math.Direction direction) { + this.state = state.toMinecraft(); + this.stateFrom = stateFrom.toMinecraft(); + this.direction = direction.toMinecraft(); + } + + public BlockState getState() { + return state; + } + + public BlockState getStateFrom() { + return stateFrom; + } + + public Direction getDirection() { + return direction; + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getState()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraStateFrom() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getStateFrom()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.Direction getMidohraDirection() { + return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(getDirection()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java new file mode 100644 index 000000000..c111c0aa3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java @@ -0,0 +1,54 @@ +package net.pitan76.mcpitanlib.api.block.args.v2; + +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.WorldView; + +public class CanPlaceAtArgs extends BaseEvent { + public final net.minecraft.block.BlockState state; + public final net.minecraft.world.WorldView world; + public final net.minecraft.util.math.BlockPos pos; + + public CanPlaceAtArgs(net.minecraft.block.BlockState state, net.minecraft.world.WorldView world, net.minecraft.util.math.BlockPos pos) { + this.state = state; + this.world = world; + this.pos = pos; + } + + public CanPlaceAtArgs(BlockState state, WorldView world, BlockPos pos) { + this(state.toMinecraft(), world.toMinecraft(), pos.toMinecraft()); + } + + public net.minecraft.block.BlockState getState() { + return state; + } + + public net.minecraft.world.WorldView getWorld() { + return world; + } + + public net.minecraft.util.math.BlockPos getPos() { + return pos; + } + + public BlockState getMidohraState() { + return BlockState.of(state); + } + + public WorldView getMidohraWorld() { + return WorldView.of(world); + } + + public BlockPos getMidohraPos() { + return BlockPos.of(pos); + } + + public boolean isClient() { + return world.isClient(); + } + + public boolean isServer() { + return !world.isClient(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java new file mode 100644 index 000000000..a5544b4db --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.api.block.args.v2; + +import net.minecraft.block.ShapeContext; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.BlockView; + +public class CollisionShapeEvent extends OutlineShapeEvent { + + public CollisionShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + super(state, world, pos, context); + } + + public CollisionShapeEvent(net.minecraft.block.BlockState state, net.minecraft.world.BlockView world, net.minecraft.util.math.BlockPos pos, ShapeContext context) { + super(BlockState.of(state), BlockView.of(world), BlockPos.of(pos), context); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java new file mode 100644 index 000000000..07aad3fef --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.api.block.args.v2; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.screen.ScreenHandlerUtil; + +public class GetComparatorOutputArgs extends BaseEvent { + public BlockState state; + public World world; + public BlockPos pos; + public Direction direction; + + public GetComparatorOutputArgs(BlockState state, World world, BlockPos pos) { + this(state, world, pos, Direction.NORTH); + } + + public GetComparatorOutputArgs(BlockState state, World world, BlockPos pos, Direction direction) { + this.state = state; + this.world = world; + this.pos = pos; + this.direction = direction; + } + + public BlockState getState() { + return state; + } + + public World getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(world, pos); + } + + public int calcComparatorOutputFromBlockEntity() { + return ScreenHandlerUtil.calcComparatorOutput(getBlockEntity()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java new file mode 100644 index 000000000..2fe77f18a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.block.args.v2; + +import net.minecraft.block.BlockState; +import net.pitan76.mcpitanlib.api.event.BaseEvent; + +public class HasComparatorOutputArgs extends BaseEvent { + public BlockState state; + + public HasComparatorOutputArgs(BlockState state) { + this.state = state; + } + + public BlockState getState() { + return state; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java new file mode 100644 index 000000000..225949458 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java @@ -0,0 +1,64 @@ +package net.pitan76.mcpitanlib.api.block.args.v2; + +import net.minecraft.block.ShapeContext; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.BlockView; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class OutlineShapeEvent extends BaseEvent implements BlockStatePropertyHolder { + public BlockState state; + public BlockView world; + public BlockPos pos; + public ShapeContext context; + + public OutlineShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + this.state = state; + this.world = world; + this.pos = pos; + this.context = context; + } + + public OutlineShapeEvent(net.minecraft.block.BlockState state, net.minecraft.world.BlockView world, net.minecraft.util.math.BlockPos pos, net.minecraft.block.ShapeContext context) { + this(BlockState.of(state), BlockView.of(world), BlockPos.of(pos), context); + } + + @Override + public BlockState getBlockState() { + return state; + } + + public BlockEntityWrapper getBlockEntity() { + return world.getBlockEntity(pos); + } + + public BlockEntity getRawBlockEntity() { + return getBlockEntity().get(); + } + + public IWorldView getWorldView() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public ShapeContext getContext() { + return context; + } + + public boolean isHolding(Item item) { + return getContext().isHolding(item); + } + + public boolean isHolding(ItemWrapper item) { + return isHolding(item.get()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java new file mode 100644 index 000000000..ebc3d207b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java @@ -0,0 +1,175 @@ +package net.pitan76.mcpitanlib.api.block.args.v2; + +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.property.Property; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; +import net.pitan76.mcpitanlib.api.util.BlockStateUtil; +import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; +import net.pitan76.mcpitanlib.midohra.util.math.Direction; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; +import net.pitan76.mcpitanlib.midohra.world.World; +import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; +import org.jetbrains.annotations.Nullable; + +public class PlacementStateArgs extends BaseEvent implements BlockStatePropertyHolder { + public ItemPlacementContext ctx; + + @Nullable + public Block block; + + public PlacementStateArgs(ItemPlacementContext ctx) { + this.ctx = ctx; + } + + public PlacementStateArgs(ItemPlacementContext ctx, @Nullable Block block) { + this.ctx = ctx; + this.block = block; + } + + public boolean canPlace() { + return ctx.canPlace(); + } + + public BlockPos getRawPos() { + return ctx.getBlockPos(); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getRawPos()); + } + + public Player getPlayer() { + return new Player(ctx.getPlayer()); + } + + public Direction[] getPlacementDirections() { + net.minecraft.util.math.Direction[] rawDirs = getRawPlacementDirections(); + Direction[] directions = new Direction[rawDirs.length]; + for (int i = 0; i < directions.length; i++) { + directions[i] = Direction.of(rawDirs[i]); + } + + return directions; + } + + public net.minecraft.util.math.Direction[] getRawPlacementDirections() { + return ctx.getPlacementDirections(); + } + + public Hand getHand() { + return ctx.getHand(); + } + + public Direction getSide() { + return Direction.of(getRawSide()); + } + + public net.minecraft.util.math.Direction getRawSide() { + return ctx.getSide(); + } + + public Direction getHorizontalPlayerFacing() { + return Direction.of(getRawHorizontalPlayerFacing()); + } + + public net.minecraft.util.math.Direction getRawHorizontalPlayerFacing() { + return ctx.getHorizontalPlayerFacing(); + } + + public float getPlayerYaw() { + return ctx.getPlayerYaw(); + } + + public World getWorld() { + return World.of(ctx.getWorld()); + } + + public IWorldView getWorldView() { + return getWorld(); + } + + public boolean isClient() { + return getWorld().isClient(); + } + + public Vec3d getHitPos() { + return ctx.getHitPos(); + } + + public boolean canReplaceExisting() { + return ctx.canReplaceExisting(); + } + + @Deprecated + public ItemUsageContextMixin getIUCAccessor() { + return (ItemUsageContextMixin) ctx; + } + + public BlockHitResult getHitResult() { + return getIUCAccessor().getHit(); + } + + public ItemUseOnBlockEvent toItemUseOnBlockEvent() { + return new ItemUseOnBlockEvent(getWorld().getRaw(), getPlayer().getPlayerEntity(), getHand(), ctx.getStack(), getHitResult()); + } + + public ItemPlacementContext getCtx() { + return ctx; + } + + public @Nullable Block getRawBlock() { + return block; + } + + public boolean isBlockExist() { + return block != null; + } + + public net.minecraft.block.BlockState getRawBlockState() { + return BlockStateUtil.getDefaultState(block); + } + + public BlockEntity getRawBlockEntity() { + return getWorld().getBlockEntity(getRawPos()); + } + + public BlockWrapper getBlock() { + return BlockWrapper.of(block); + } + + public , V extends T> net.minecraft.block.BlockState with(Property property, V value) { + if (block == null) + return null; + + return BlockStateUtil.with(BlockStateUtil.getDefaultState(block), property, value); + } + + @Override + public BlockState getBlockState() { + return BlockState.of(getRawBlockState()); + } + + public BlockEntityWrapper getBlockEntity() { + return getWorld().getBlockEntity(getPos()); + } + + public net.pitan76.mcpitanlib.midohra.util.hit.BlockHitResult getHitResultM() { + return net.pitan76.mcpitanlib.midohra.util.hit.BlockHitResult.of(getHitResult()); + } + + public HitResultType getHitResultTypeM() { + return HitResultType.from(getHitResult().getType()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java new file mode 100644 index 000000000..1c4972fe8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java @@ -0,0 +1,109 @@ +package net.pitan76.mcpitanlib.api.block.args.v2; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.WorldAccess; +import net.minecraft.world.WorldView; +import net.minecraft.world.tick.ScheduledTickView; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class StateForNeighborUpdateArgs implements BlockStatePropertyHolder { + public BlockState state; + public Direction direction; + public BlockState neighborState; + public WorldView world; + public BlockPos pos; + public BlockPos neighborPos; + public ScheduledTickView tickView; + public CompatRandom random; + + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + this.state = state; + this.direction = direction; + this.neighborState = neighborState; + this.world = world; + this.pos = pos; + this.neighborPos = neighborPos; + } + + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldView world, BlockPos pos, BlockPos neighborPos, ScheduledTickView tickView, CompatRandom random) { + this.state = state; + this.direction = direction; + this.neighborState = neighborState; + this.world = world; + this.pos = pos; + this.neighborPos = neighborPos; + this.tickView = tickView; + this.random = random; + } + + public Direction getDirection() { + return direction; + } + + public BlockState getRawNeighborState() { + return neighborState; + } + + public WorldView getRawWorld() { + return world; + } + + public BlockPos getRawPos() { + return pos; + } + + public BlockPos getRawNeighborPos() { + return neighborPos; + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getNeighborState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getRawNeighborState()); + } + + public net.pitan76.mcpitanlib.midohra.world.WorldView getWorld() { + return net.pitan76.mcpitanlib.midohra.world.WorldView.of(getRawWorld()); + } + + public IWorldView getWorldView() { + return getWorld(); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getRawPos()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getNeighborPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getRawNeighborPos()); + } + + public CompatRandom getRandom() { + return random; + } + + public net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView getTickView() { + return net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView.of(tickView); + } + + @Override + public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public BlockEntityWrapper getBlockEntity() { + return getWorld().getBlockEntity(getPos()); + } + + public BlockEntity getRawBlockEntity() { + return world.getBlockEntity(pos); + } + + public boolean isClient() { + return world.isClient(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java new file mode 100644 index 000000000..95b2afca6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java @@ -0,0 +1,170 @@ +package net.pitan76.mcpitanlib.api.block.v2; + +import net.minecraft.block.AbstractBlock; +import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; +import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.color.CompatDyeColor; +import net.pitan76.mcpitanlib.api.util.color.CompatMapColor; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; + +import java.util.function.ToIntFunction; + +public class BlockSettingsBuilder { + + public CompatIdentifier id; + public float hardness = -1; + public float resistance = -1; + public CompatBlockSoundGroup blockSoundGroup; + public CompatibleMaterial material; + public CompatMapColor mapColor; + public CompatDyeColor dyeColor; + public boolean requiresTool; + public boolean dropsNothing; + public ToIntFunction luminance; + + protected BlockWrapper copyFromBlock = null; + + public BlockSettingsBuilder(CompatIdentifier id) { + this.id = id; + } + + public BlockSettingsBuilder() { + + } + + public BlockSettingsBuilder hardness(float hardness) { + this.hardness = hardness; + return this; + } + + public BlockSettingsBuilder resistance(float resistance) { + this.resistance = resistance; + return this; + } + + public BlockSettingsBuilder strength(float hardness, float resistance) { + this.hardness = hardness; + this.resistance = resistance; + return this; + } + + public BlockSettingsBuilder sounds(CompatBlockSoundGroup blockSoundGroup) { + this.blockSoundGroup = blockSoundGroup; + return this; + } + + public BlockSettingsBuilder material(CompatibleMaterial material) { + this.material = material; + return this; + } + + public BlockSettingsBuilder mapColor(CompatMapColor mapColor) { + this.mapColor = mapColor; + return this; + } + + public BlockSettingsBuilder dyeColor(CompatDyeColor dyeColor) { + this.dyeColor = dyeColor; + return this; + } + + public BlockSettingsBuilder requiresTool() { + this.requiresTool = true; + return this; + } + + public BlockSettingsBuilder dropsNothing() { + this.dropsNothing = true; + return this; + } + + public BlockSettingsBuilder luminance(ToIntFunction luminance) { + this.luminance = luminance; + return this; + } + + public CompatibleBlockSettings build() { + return build(id); + } + + public AbstractBlock.Settings _build() { + return build().build(); + } + + public CompatibleBlockSettings build(CompatIdentifier id) { + CompatibleBlockSettings settings; + + if (copyFromBlock != null) { + settings = CompatibleBlockSettings.copy(id, copyFromBlock.get()); + } else { + settings = CompatibleBlockSettings.of(id); + } + + if (material != null) + settings = CompatibleBlockSettings.of(id, material); + + if (mapColor != null) { + settings = settings.mapColor(mapColor.getColor()); + } else if (dyeColor != null) { + settings = settings.mapColor(dyeColor.getColor().getMapColor()); + } + + if (requiresTool) settings.requiresTool(); + if (dropsNothing) settings.dropsNothing(); + if (luminance != null) settings.luminance((state) -> luminance.applyAsInt(BlockState.of(state))); + + if (hardness != -1 && resistance != -1) settings.strength(hardness, resistance); + else if (hardness != -1) settings.strength(hardness); + + if (blockSoundGroup != null) settings.sounds(blockSoundGroup); + + return settings; + } + + public AbstractBlock.Settings _build(CompatIdentifier id) { + return build(id).build(); + } + + public BlockSettingsBuilder copy(CompatIdentifier id) { + BlockSettingsBuilder builder = new BlockSettingsBuilder(); + + builder.copyFromBlock = this.copyFromBlock; + + builder.id = id; + builder.hardness = this.hardness; + builder.resistance = this.resistance; + builder.blockSoundGroup = this.blockSoundGroup; + builder.material = this.material; + builder.mapColor = this.mapColor; + builder.dyeColor = this.dyeColor; + builder.requiresTool = this.requiresTool; + builder.dropsNothing = this.dropsNothing; + builder.luminance = this.luminance; + return builder; + } + + public BlockSettingsBuilder copy() { + return copy(this.id); + } + + public static BlockSettingsBuilder of(CompatIdentifier id) { + return new BlockSettingsBuilder(id); + } + + public static BlockSettingsBuilder of() { + return new BlockSettingsBuilder(); + } + + public static BlockSettingsBuilder copyBlock(BlockWrapper block) { + BlockSettingsBuilder builder = new BlockSettingsBuilder(block.getId()); + builder.copyFromBlock = block; + + return builder; + } + + public static BlockSettingsBuilder copyBlock(CompatIdentifier id) { + return copyBlock(BlockWrapper.of(id)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java new file mode 100644 index 000000000..3b4b160a1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java @@ -0,0 +1,179 @@ +package net.pitan76.mcpitanlib.api.block.v2; + +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.util.BlockRotation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; +import net.minecraft.world.WorldView; +import net.minecraft.world.tick.ScheduledTickView; +import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; +import net.pitan76.mcpitanlib.api.block.args.RotateArgs; +import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.*; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import org.jetbrains.annotations.Nullable; + +public class CompatBlock extends ExtendBlock { + + public CompatibleBlockSettings settings; + + public CompatBlock(CompatibleBlockSettings settings) { + super(settings); + this.settings = settings; + } + + public CompatibleBlockSettings getCompatSettings() { + return settings; + } + + public BlockWrapper getWrapper() { + return BlockWrapper.of(this); + } + + @Override + @Deprecated + protected BlockRenderType getRenderType(BlockState state) { + return getRenderType(new RenderTypeArgs(state)).renderType; + } + + public CompatBlockRenderType getRenderType(RenderTypeArgs args) { + return new CompatBlockRenderType(super.getRenderType(args.state)); + } + + @Override + @Deprecated + protected BlockState rotate(BlockState state, BlockRotation rotation) { + return rotate(new RotateArgs(state, rotation)).toMinecraft(); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState rotate(RotateArgs args) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.rotate(args.state, args.rotation)); + } + + @Override + @Deprecated + protected boolean isSideInvisible(BlockState state, BlockState stateFrom, Direction direction) { + return isSideInvisible(new SideInvisibleArgs(state, stateFrom, direction)); + } + + public boolean isSideInvisible(SideInvisibleArgs args) { + return super.isSideInvisible(args.state, args.stateFrom, args.direction); + } + + /** + * Compatible for getDefaultState() + * @return default block state + */ + public net.pitan76.mcpitanlib.midohra.block.BlockState getDefaultMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getNewDefaultState()); + } + + /** + * Compatible for setDefaultState() + * @param state BlockState + */ + public void setDefaultState(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + setNewDefaultState(state.toMinecraft()); + } + + public @Nullable net.pitan76.mcpitanlib.midohra.block.BlockState getPlacementState(PlacementStateArgs args) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.getPlacementState(args.ctx)); + } + + @Override + public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + return getPlacementState(new PlacementStateArgs(ctx)).toMinecraft(); + } + + @Deprecated + @Override + public @Nullable BlockState getPlacementState(net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs args) { + return super.getPlacementState(args); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.getStateForNeighborUpdate(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom())); + } + + @Override + protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { + return getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random))).toMinecraft(); + } + + @Deprecated + @Override + public BlockState getStateForNeighborUpdate(net.pitan76.mcpitanlib.api.event.block.StateForNeighborUpdateArgs args) { + return super.getStateForNeighborUpdate((args)); + } + + public VoxelShape getOutlineShape(OutlineShapeEvent e) { + return super.getOutlineShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); + } + + @Deprecated + @Override + public VoxelShape getOutlineShape(net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent e) { + return super.getOutlineShape(e); + } + + public VoxelShape getCollisionShape(CollisionShapeEvent e) { + return super.getCollisionShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); + } + + @Deprecated + @Override + public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); + } + + @Deprecated + @Override + public VoxelShape getCollisionShape(net.pitan76.mcpitanlib.api.event.block.CollisionShapeEvent e) { + return super.getCollisionShape(e); + } + + @Deprecated + @Override + public boolean hasComparatorOutput(BlockState state) { + return hasComparatorOutput(new HasComparatorOutputArgs(state)); + } + + public boolean hasComparatorOutput(HasComparatorOutputArgs args) { + return super.hasComparatorOutput(args.state); + } + + @Deprecated + @Override + public int getComparatorOutput(BlockState state, World world, BlockPos pos, Direction direction) { + return getComparatorOutput(new GetComparatorOutputArgs(state, world, pos, direction)); + } + + public int getComparatorOutput(GetComparatorOutputArgs args) { + return super.getComparatorOutput(args.state, args.world, args.pos, args.direction); + } + + @Deprecated + @Override + protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + return canPlaceAt(new CanPlaceAtArgs(state, world, pos)); + } + + public boolean canPlaceAt(CanPlaceAtArgs args) { + return super.canPlaceAt(args.state, args.world, args.pos); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java new file mode 100644 index 000000000..368be8ddc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java @@ -0,0 +1,91 @@ +package net.pitan76.mcpitanlib.api.block.v2; + +import net.minecraft.block.Block; +import net.minecraft.util.shape.VoxelShape; +import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; +import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; +import net.pitan76.mcpitanlib.api.block.args.RotateArgs; +import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.mixin.BlockInvoker; + +public interface CompatBlockProvider extends ExtendBlockProvider { + CompatibleBlockSettings getCompatSettings(); + + default BlockWrapper getWrapper() { + return this instanceof Block ? BlockWrapper.of((Block) this) : BlockWrapper.of(); + } + + default CompatBlockRenderType getRenderType(RenderTypeArgs args, Options options) { + options.cancel = false; + return null; + } + + default BlockState rotate(RotateArgs args, Options options) { + options.cancel = false; + return null; + } + + default Boolean isSideInvisible(SideInvisibleArgs args, Options options) { + options.cancel = false; + return null; + } + + default BlockState getDefaultMidohraState() { + if (this instanceof Block) { + return BlockState.of(((Block) this).getDefaultState()); + } + + return null; + } + + default void setDefaultState(BlockState state) { + if (this instanceof Block) { + ((BlockInvoker) this).setDefaultState_invoke(state.toMinecraft()); + } + } + + @Override + @Deprecated + default net.minecraft.block.BlockState getPlacementState(net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs args, Options options) { + return ExtendBlockProvider.super.getPlacementState(args, options); + } + + default BlockState getPlacementState(PlacementStateArgs args, Options options) { + options.cancel = false; + return null; + } + + default BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args, Options options) { + options.cancel = false; + return null; + } + + @Override + @Deprecated + default VoxelShape getOutlineShape(net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent event, Options options) { + return ExtendBlockProvider.super.getOutlineShape(event, options); + } + + default VoxelShape getOutlineShape(OutlineShapeEvent event, Options options) { + options.cancel = false; + return null; + } + + @Deprecated + @Override + default VoxelShape getCollisionShape(net.pitan76.mcpitanlib.api.event.block.CollisionShapeEvent event, Options options) { + return ExtendBlockProvider.super.getCollisionShape(event, options); + } + + default VoxelShape getCollisionShape(CollisionShapeEvent event, Options options) { + options.cancel = false; + return null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java new file mode 100644 index 000000000..f92115a8a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.api.block.v2; + +import net.minecraft.block.ShapeContext; +import net.minecraft.block.StairsBlock; +import net.minecraft.block.enums.BlockHalf; +import net.minecraft.block.enums.StairShape; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.state.property.BooleanProperty; +import net.pitan76.mcpitanlib.api.state.property.CompatProperties; +import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; +import net.pitan76.mcpitanlib.api.state.property.EnumProperty; +import net.pitan76.mcpitanlib.midohra.block.BlockState; + +public class CompatStairsBlock extends net.pitan76.mcpitanlib.api.block.CompatStairsBlock { + + public static final DirectionProperty FACING = CompatProperties.ofDir(StairsBlock.FACING); + public static final EnumProperty HALF = CompatProperties.of(StairsBlock.HALF); + public static final EnumProperty SHAPE = CompatProperties.of(StairsBlock.SHAPE); + public static final BooleanProperty WATERLOGGED = CompatProperties.of(StairsBlock.WATERLOGGED); + + public CompatStairsBlock(net.minecraft.block.BlockState baseBlockState, CompatibleBlockSettings settings) { + super(baseBlockState, settings); + } + + public CompatStairsBlock(BlockState baseBlockState, CompatibleBlockSettings settings) { + this(baseBlockState.toMinecraft(), settings); + } + + public VoxelShape getOutlineShape(OutlineShapeEvent e) { + return super.getOutlineShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); + } + + public VoxelShape getCollisionShape(CollisionShapeEvent e) { + return super.getCollisionShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); + } + + @Deprecated + @Override + public VoxelShape getOutlineShape(net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent e) { + return getOutlineShape(new OutlineShapeEvent(e.state, e.world, e.pos, e.context)); + } + + @Deprecated + @Override + public VoxelShape getOutlineShape(net.minecraft.block.BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); + } + + @Deprecated + @Override + public VoxelShape getOutlineShape(OutlineShapeEvent e, Options options) { + return super.getOutlineShape(e, options); + } + + @Override + public VoxelShape getCollisionShape(net.minecraft.block.BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); + } + + @Deprecated + @Override + public VoxelShape getCollisionShape(CollisionShapeEvent event, Options options) { + return super.getCollisionShape(event, options); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java new file mode 100644 index 000000000..95d43c70f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java @@ -0,0 +1,292 @@ +package net.pitan76.mcpitanlib.api.block.v2; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.MapColor; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.util.DyeColor; +import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; +import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.color.CompatDyeColor; +import net.pitan76.mcpitanlib.api.util.color.CompatMapColor; + +import java.util.function.Function; +import java.util.function.ToIntFunction; + +@SuppressWarnings("deprecation") +public class CompatibleBlockSettings extends net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings { + protected CompatIdentifier identifier = null; + public boolean changedTranslationKey = false; + + public static final Codec CODEC = MapCodec.unitCodec(CompatibleBlockSettings::new); + + @Deprecated + protected CompatibleBlockSettings() { + super(); + } + + public CompatibleBlockSettings(CompatIdentifier identifier) { + super(); + setId(identifier); + } + + public static CompatibleBlockSettings of(CompatIdentifier id) { + return new CompatibleBlockSettings(id); + } + + @Deprecated + public CompatibleBlockSettings setId(CompatIdentifier identifier) { + this.identifier = identifier; + return this; + } + + private static CompatibleBlockSettings copy(CompatibleMaterial material, CompatibleBlockSettings settings) { + settings.mapColor(material.getColor()); + if (material.isLiquid()) + settings.settings.liquid(); + if (material.isSolid()) + settings.settings.solid(); + if (material.isReplaceable()) + settings.settings.replaceable(); + if (material.isSolid()) + settings.settings.solid(); + if (material.isBurnable()) + settings.settings.burnable(); + settings.settings.pistonBehavior(material.getPistonBehavior()); + return settings; + } + + public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material, MapColor mapColor) { + this(id); + copy(material, this); + mapColor(mapColor); + } + + public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material, DyeColor dyeColor) { + this(id); + copy(material, this); + mapColor(dyeColor); + } + + public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material) { + this(id); + copy(material, this); + } + + public CompatibleBlockSettings(CompatIdentifier id, CompatibleMaterial material, Function mapColor) { + this(id); + copy(material, this); + mapColor(mapColor); + } + + public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material, MapColor mapColor) { + return new CompatibleBlockSettings(id, material, mapColor); + } + + public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material, DyeColor dyeColor) { + return new CompatibleBlockSettings(id, material, dyeColor); + } + + public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material) { + return new CompatibleBlockSettings(id, material); + } + + public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial material, Function mapColor) { + return new CompatibleBlockSettings(id, material, mapColor); + } + + public CompatibleBlockSettings(CompatIdentifier id, AbstractBlock block) { + super(block); + setId(id); + } + + public static CompatibleBlockSettings copy(CompatIdentifier id, AbstractBlock block) { + return new CompatibleBlockSettings(id, block); + } + + public CompatibleBlockSettings air() { + super.air(); + return this; + } + + public CompatibleBlockSettings blockVision(AbstractBlock.ContextPredicate predicate) { + super.blockVision(predicate); + return this; + } + + public CompatibleBlockSettings postProcess(AbstractBlock.ContextPredicate predicate) { + super.postProcess(predicate); + return this; + } + + public CompatibleBlockSettings solidBlock(AbstractBlock.ContextPredicate predicate) { + super.solidBlock(predicate); + return this; + } + + public CompatibleBlockSettings suffocates(AbstractBlock.ContextPredicate predicate) { + super.suffocates(predicate); + return this; + } + + public CompatibleBlockSettings mapColor(MapColor color) { + super.mapColor(color); + return this; + } + + public CompatibleBlockSettings mapColor(DyeColor color) { + super.mapColor(color); + return this; + } + + public CompatibleBlockSettings mapColor(CompatMapColor color) { + super.mapColor(color.getColor()); + return this; + } + + public CompatibleBlockSettings mapColor(CompatDyeColor color) { + super.mapColor(color.getColor()); + return this; + } + + public CompatibleBlockSettings mapColor(Function color) { + super.mapColor(color); + return this; + } + + public CompatibleBlockSettings compatMapColor(Function color) { + super.mapColor(state -> color.apply(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state)).getColor()); + return this; + } + + @Deprecated + public CompatibleBlockSettings dropsLike(Block source) { + super.dropsLike(source); + return this; + } + + public CompatibleBlockSettings breakInstantly() { + super.breakInstantly(); + return this; + } + + public CompatibleBlockSettings dropsNothing() { + super.dropsNothing(); + return this; + } + + public CompatibleBlockSettings dynamicBounds() { + super.dynamicBounds(); + return this; + } + + public CompatibleBlockSettings hardness(float hardness) { + super.hardness(hardness); + return this; + } + + public CompatibleBlockSettings noBlockBreakParticles() { + super.noBlockBreakParticles(); + return this; + } + + public CompatibleBlockSettings requiresTool() { + super.requiresTool(); + return this; + } + + public CompatibleBlockSettings noCollision() { + super.noCollision(); + return this; + } + + public CompatibleBlockSettings nonOpaque() { + super.nonOpaque(); + return this; + } + + public CompatibleBlockSettings resistance(float resistance) { + super.resistance(resistance); + return this; + } + + public CompatibleBlockSettings strength(float strength) { + super.strength(strength); + return this; + } + + public CompatibleBlockSettings strength(float hardness, float resistance) { + super.strength(hardness, resistance); + return this; + } + + public CompatibleBlockSettings ticksRandomly() { + super.ticksRandomly(); + return this; + } + + public CompatibleBlockSettings sounds(CompatBlockSoundGroup blockSoundGroup) { + super.sounds(blockSoundGroup); + return this; + } + + public CompatibleBlockSettings luminance(ToIntFunction luminance) { + super.luminance(luminance); + return this; + } + + public CompatibleBlockSettings jumpVelocityMultiplier(float jumpVelocityMultiplier) { + super.jumpVelocityMultiplier(jumpVelocityMultiplier); + return this; + } + + public CompatibleBlockSettings slipperiness(float slipperiness) { + super.slipperiness(slipperiness); + return this; + } + + public CompatibleBlockSettings velocityMultiplier(float velocityMultiplier) { + super.velocityMultiplier(velocityMultiplier); + return this; + } + + public CompatibleBlockSettings emissiveLighting(AbstractBlock.ContextPredicate predicate) { + super.emissiveLighting(predicate); + return this; + } + + public CompatibleBlockSettings offset(AbstractBlock.OffsetType offsetType) { + super.offset(offsetType); + return this; + } + + public CompatibleBlockSettings allowsSpawning(AbstractBlock.TypedContextPredicate> predicate) { + super.allowsSpawning(predicate); + return this; + } + + public AbstractBlock.Settings build() { + super.build(); + + if (identifier != null) { + settings.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier.toMinecraft())); + } + + return settings; + } + + @Deprecated + @Override + public CompatibleBlockSettings sounds(BlockSoundGroup blockSoundGroup) { + super.sounds(blockSoundGroup); + return this; + } + + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java new file mode 100644 index 000000000..d6c273835 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.api.client; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +@Deprecated +public abstract class CompatInventoryScreen extends SimpleInventoryScreen { + + public CompatInventoryScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + } + + public abstract CompatIdentifier getCompatTexture(); + + @Override + public Identifier getTexture() { + return getCompatTexture().toMinecraft(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java new file mode 100644 index 000000000..73f5a6c72 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java @@ -0,0 +1,317 @@ +package net.pitan76.mcpitanlib.api.client; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.Selectable; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.input.KeyInput; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.*; +import net.pitan76.mcpitanlib.api.client.render.screen.RenderBackgroundTextureArgs; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import net.pitan76.mcpitanlib.api.util.client.RenderUtil; +import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; +import net.pitan76.mcpitanlib.core.datafixer.Pair; + +@Deprecated +public abstract class SimpleHandledScreen extends HandledScreen { + + public int width, height, backgroundWidth, backgroundHeight, x, y; + public ScreenHandler handler; + public TextRenderer textRenderer; + public ItemRenderer itemRenderer; + + public Text title; + public MinecraftClient client; + public SimpleHandledScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + fixScreen(); + this.handler = handler; + this.title = title; + + } + + public T addDrawableChild_compatibility(T drawableElement) { + return super.addDrawableChild(drawableElement); + // addButton + } + + public T addSelectableChild_compatibility(T selectableElement) { + return super.addSelectableChild(selectableElement); + } + + public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { + return addDrawableChild_compatibility(widget); + } + + @Deprecated + @Override + protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { + DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); + drawBackgroundOverride(new DrawBackgroundArgs(drawObjectDM, delta, mouseX, mouseY)); + } + + public abstract void drawBackgroundOverride(DrawBackgroundArgs args); + + @Deprecated + @Override + protected void drawForeground(DrawContext context, int mouseX, int mouseY) { + DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); + drawForegroundOverride(new DrawForegroundArgs(drawObjectDM, mouseX, mouseY)); + } + + protected void drawForegroundOverride(DrawForegroundArgs args) { + super.drawForeground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + } + + public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { + ScreenUtil.RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height, 256, 256); + } + + public void callDrawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, int u, int v, int width, int height) { + callDrawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); + } + + @Deprecated + public void callRenderBackground(DrawObjectDM drawObjectDM) { + callRenderBackground(new RenderArgs(drawObjectDM, 0, 0, 0)); + } + + + public void callRenderBackground(RenderArgs args) { + super.renderBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { + super.drawMouseoverTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + } + + public void renderOverride(RenderArgs args) { + super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public void resizeOverride(MinecraftClient client, int width, int height) { + } + + public void initOverride() { + } + + @Deprecated + @Override + protected void init() { + super.init(); + fixScreen(); + initOverride(); + } + + @Deprecated + @Override + public void resize(int width, int height) { + super.resize(width, height); + fixScreen(); + resizeOverride(MinecraftClient.getInstance(), width, height); + } + + public void fixScreen() { + this.backgroundWidth = getBackgroundWidth(); + this.backgroundHeight = getBackgroundHeight(); + this.x = super.x; //(this.width - this.backgroundWidth) / 2; + this.y = super.y; //(this.height - this.backgroundHeight) / 2; + this.textRenderer = super.textRenderer; + this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); + this.width = super.width; + this.height = super.height; + if (super.client == null) + this.client = MinecraftClient.getInstance(); + else + this.client = super.client; + } + + public void setX(int x) { + this.x = x; + super.x = x; + } + + public void setY(int y) { + this.y = y; + super.y = y; + } + + public void setTextRenderer(TextRenderer textRenderer) { + this.textRenderer = textRenderer; + } + + public void setItemRenderer(ItemRenderer itemRenderer) { + this.itemRenderer = itemRenderer; + } + + public void setWidth(int width) { + this.width = width; + super.width = width; + } + + public void setBackgroundWidth(int backgroundWidth) { + this.backgroundWidth = backgroundWidth; + super.backgroundWidth = backgroundWidth; + } + + public void setBackgroundHeight(int backgroundHeight) { + this.backgroundHeight = backgroundHeight; + super.backgroundHeight = backgroundHeight; + } + + public void setHeight(int height) { + this.height = height; + super.height = height; + } + + public int getBackgroundWidth() { + return super.backgroundWidth; + } + + public int getBackgroundHeight() { + return super.backgroundHeight; + } + + @Deprecated + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); + renderOverride(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); + } + + public boolean keyReleased(KeyEventArgs args) { + return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + } + + public boolean keyPressed(KeyEventArgs args) { + return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + } + + public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { + if (getBackgroundTexture() != null) + Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); + + RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); + } + + @Deprecated + @Override + public boolean keyReleased(KeyInput input) { + return this.keyReleased(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); + } + + @Deprecated + @Override + public boolean keyPressed(KeyInput input) { + return this.keyPressed(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); + } + + @Deprecated + @Override + public void renderDarkening(DrawContext context) { + this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); + } + + public void closeOverride() { + super.close(); + } + + public void removedOverride() { + super.removed(); + } + + @Override + public void close() { + closeOverride(); + } + + @Override + public void removed() { + removedOverride(); + } + + public Identifier getBackgroundTexture() { + return IdentifierUtil.from(getCompatBackgroundTexture()); + } + + public CompatIdentifier getCompatBackgroundTexture() { + return null; + } + + public void setTitleX(int x) { + this.titleX = x; + } + + public void setTitleY(int y) { + this.titleY = y; + } + + public void setTitlePos(int x, int y) { + setTitleX(x); + setTitleY(y); + } + + public void setTitleXCenter() { + if (textRenderer == null) + textRenderer = ClientUtil.getTextRenderer(); + + setTitleX(backgroundWidth / 2 - textRenderer.getWidth(title) / 2); + } + + public int getTitleX() { + return titleX; + } + + public int getTitleY() { + return titleY; + } + + @Deprecated + @Override + public Text getTitle() { + return callGetTitle(); + } + + public Text callGetTitle() { + return super.getTitle(); + } + + public Pair getTitlePosP() { + return new Pair<>(getTitleX(), getTitleY()); + } + + public int getPlayerInvTitleX() { + return playerInventoryTitleX; + } + + public int getPlayerInvTitleY() { + return playerInventoryTitleY; + } + + public void setPlayerInvTitleX(int x) { + playerInventoryTitleX = x; + } + + public void setPlayerInvTitleY(int y) { + playerInventoryTitleY = y; + } + + public void setPlayerInvTitle(int x, int y) { + setPlayerInvTitleX(x); + setPlayerInvTitleY(y); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java new file mode 100644 index 000000000..98d21aef1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.api.client; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawMouseoverTooltipArgs; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; +import net.pitan76.mcpitanlib.api.util.client.RenderUtil; + +@Deprecated +public abstract class SimpleInventoryScreen extends SimpleHandledScreen { + + public SimpleInventoryScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + } + + public abstract Identifier getTexture(); + + @Override + public Identifier getBackgroundTexture() { + return getTexture(); + } + + @Override + public void drawBackgroundOverride(DrawBackgroundArgs args) { + RenderUtil.setShaderToPositionTexProgram(); + RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + callDrawTexture(args.drawObjectDM, getTexture(), x, y, 0, 0, backgroundWidth, backgroundHeight); + } + + @Override + public void renderOverride(RenderArgs args) { + this.callRenderBackground(args); + super.renderOverride(args); + this.callDrawMouseoverTooltip(new DrawMouseoverTooltipArgs(args.drawObjectDM, args.mouseX, args.mouseY)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java new file mode 100644 index 000000000..572621b5a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.client; + +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.option.GameOptions; +import net.minecraft.text.Text; + +public class SimpleOptionsScreen extends SimpleScreen { + + protected final Screen parent; + protected final GameOptions gameOptions; + + public SimpleOptionsScreen(Text title, Screen parent, GameOptions gameOptions) { + super(title); + this.parent = parent; + this.gameOptions = gameOptions; + } + + @Override + public void removed() { + client.options.write(); + } + + @Override + public void close() { + client.setScreen(this.parent); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java new file mode 100644 index 000000000..fc0aeea52 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java @@ -0,0 +1,191 @@ +package net.pitan76.mcpitanlib.api.client; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.Selectable; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.input.KeyInput; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.*; +import net.pitan76.mcpitanlib.api.client.render.screen.RenderBackgroundTextureArgs; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.client.RenderUtil; +import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; + +public abstract class SimpleScreen extends Screen { + + public int width, height; + public TextRenderer textRenderer; + public ItemRenderer itemRenderer; + + public Text title; + public MinecraftClient client; + + public SimpleScreen(Text title) { + super(title); + fixScreen(); + this.title = title; + } + + public T addDrawableChild_compatibility(T drawableElement) { + return super.addDrawableChild(drawableElement); + // addButton + } + + public T addSelectableChild_compatibility(T selectableElement) { + return super.addSelectableChild(selectableElement); + } + + public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { + return addDrawableChild_compatibility(widget); + } + + public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { + ScreenUtil.RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); + } + + public void callDrawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, int u, int v, int width, int height) { + callDrawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); + } + + @Deprecated + @Override + public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) { + renderBackground(new RenderArgs(new DrawObjectDM(context, this), mouseX, mouseY, delta)); + } + + + public void renderBackground(RenderArgs args) { + super.renderBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public void render(RenderArgs args) { + super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public void resizeOverride(MinecraftClient client, int width, int height) { + } + + public void initOverride() { + } + + @Deprecated + @Override + protected void init() { + super.init(); + fixScreen(); + initOverride(); + } + + @Deprecated + @Override + public void resize(int width, int height) { + super.resize(width, height); + fixScreen(); + resizeOverride(MinecraftClient.getInstance(), width, height); + } + + public void fixScreen() { + this.textRenderer = super.textRenderer; + this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); + this.width = super.width; + this.height = super.height; + if (super.client == null) + this.client = MinecraftClient.getInstance(); + else + this.client = super.client; + } + + public void setTextRenderer(TextRenderer textRenderer) { + this.textRenderer = textRenderer; + } + + public void setItemRenderer(ItemRenderer itemRenderer) { + this.itemRenderer = itemRenderer; + } + + public void setWidth(int width) { + this.width = width; + super.width = width; + } + + public void setHeight(int height) { + this.height = height; + super.height = height; + } + + @Deprecated + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); + render(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); + } + + public boolean keyReleased(KeyEventArgs args) { + return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + } + + public boolean keyPressed(KeyEventArgs args) { + return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + } + + public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { + if (getBackgroundTexture() != null) + Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), 0, 0, 0, 0, this.width, this.height); + + RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); + } + + @Deprecated + @Override + public boolean keyReleased(KeyInput keyInput) { + return this.keyReleased(new KeyEventArgs(keyInput.key(), keyInput.scancode(), keyInput.modifiers())); + } + + @Deprecated + @Override + public boolean keyPressed(KeyInput keyInput) { + return this.keyPressed(new KeyEventArgs(keyInput.key(), keyInput.scancode(), keyInput.modifiers())); + } + + @Deprecated + @Override + public void renderDarkening(DrawContext context) { + this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); + } + + public void closeOverride() { + super.close(); + } + + public void removedOverride() { + super.removed(); + } + + @Override + public void close() { + closeOverride(); + } + + @Override + public void removed() { + removedOverride(); + } + + public Identifier getBackgroundTexture() { + return IdentifierUtil.from(getCompatBackgroundTexture()); + } + + public CompatIdentifier getCompatBackgroundTexture() { + return null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java new file mode 100644 index 000000000..8179cf270 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java @@ -0,0 +1,87 @@ +package net.pitan76.mcpitanlib.api.client.color; + +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockRenderView; +import net.pitan76.mcpitanlib.api.tile.RenderAttachmentBlockEntity; +import net.pitan76.mcpitanlib.midohra.world.BlockView; +import org.jetbrains.annotations.Nullable; + +public class BlockColorEvent { + private final BlockState state; + private final BlockRenderView world; + private final BlockPos pos; + private final int tintIndex; + + public BlockColorEvent(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { + this.state = state; + this.world = world; + this.pos = pos; + this.tintIndex = tintIndex; + } + + public BlockState getState() { + return state; + } + + public BlockRenderView getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public int getTintIndex() { + return tintIndex; + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getPos()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getState()); + } + + public boolean hasWorld() { + return getWorld() != null; + } + + public boolean hasPos() { + return getPos() != null; + } + + public BlockView getMidohraWorld() { + if (!hasWorld()) return null; + return net.pitan76.mcpitanlib.midohra.world.BlockView.of(getWorld()); + } + + public BlockEntity getBlockEntity() { + if (!hasWorld() || !hasPos()) return null; + return getWorld().getBlockEntity(getPos()); + } + + public int getDefaultColor() { + return 0xFFFFFF; + } + + public Object getRenderData() { + if (!hasWorld() || !hasPos()) return null; + return getRenderDataD(getBlockEntity()); + } + + public static Object getRenderDataD(BlockEntity blockEntity) { + if (blockEntity instanceof RenderAttachmentBlockEntity) { + return ((RenderAttachmentBlockEntity) blockEntity).getCompatRenderData(); + } + + if (blockEntity instanceof net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) { + return ((net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) blockEntity).getCompatRenderData(); + } + + return blockEntity.getRenderData(); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java new file mode 100644 index 000000000..50ceb12f4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.client.color; + +import net.minecraft.block.BlockState; +import net.minecraft.client.color.block.BlockColorProvider; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockRenderView; +import org.jetbrains.annotations.Nullable; + +public interface CompatBlockColorProvider extends BlockColorProvider { + default int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { + return getColor(new BlockColorEvent(state, world, pos, tintIndex)); + } + + int getColor(BlockColorEvent e); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java new file mode 100644 index 000000000..8166f7406 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.client.event; + +import dev.architectury.event.events.client.ClientTooltipEvent; +import net.pitan76.mcpitanlib.api.client.event.listener.ItemTooltipListener; + +public class ItemTooltipRegistry { + public static void registerItemTooltip(ItemTooltipListener listener) { + ClientTooltipEvent.ITEM.register(listener::onTooltip); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java new file mode 100644 index 000000000..5e88ff0da --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java @@ -0,0 +1,160 @@ +package net.pitan76.mcpitanlib.api.client.event; + +//import dev.architectury.injectables.annotations.ExpectPlatform; +import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineEvent; +import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineListener; +import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContext; +import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContextListener; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; + +import java.util.ArrayList; +import java.util.List; + +public class WorldRenderRegistry { + + public static List beforeBlockOutlineListeners = new ArrayList<>(); + public static List worldRenderAfterLevelListeners = new ArrayList<>(); + + public static boolean isEmptyBlockOutlineListeners = true; + public static boolean isEmptyWorldRenderAfterLevelListeners = true; + + public WorldRenderRegistry() { + + } + + //@ExpectPlatform + public static void registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { + beforeBlockOutlineListeners.add(listener); + isEmptyBlockOutlineListeners = false; + //throw new AssertionError(); + } + + //@ExpectPlatform + public static void registerWorldRenderAfterLevel(WorldRenderContextListener listener) { + worldRenderAfterLevelListeners.add(listener); + isEmptyWorldRenderAfterLevelListeners = false; + //throw new AssertionError(); + } + public static void _registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { + WorldRenderEvents.BEFORE_BLOCK_OUTLINE.register(((worldRenderContext, renderState) -> listener.beforeBlockOutline(new BeforeBlockOutlineEvent( + new WorldRenderContext() { + @Override + public WorldRenderer getWorldRenderer() { + return worldRenderContext.worldRenderer(); + } + + @Override + public MatrixStack getMatrixStack() { + return worldRenderContext.matrices(); + } + + @Override + public float getTickDelta() { + return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); + } + + @Override + public Camera getCamera() { + return worldRenderContext.gameRenderer().getCamera(); + } + + @Override + public GameRenderer getGameRenderer() { + return worldRenderContext.gameRenderer(); + } + + @Override + public LightmapTextureManager getLightmapTextureManager() { + return getGameRenderer().getLightmapTextureManager(); + } + + @Override + public Matrix4f getProjectionMatrix() { + return worldRenderContext.gameRenderer().getBasicProjectionMatrix(0); + } + + @Override + public ClientWorld getWorld() { + return ClientUtil.getWorld(); + } + + @Override + public boolean isAdvancedTranslucency() { + return renderState.isTranslucent(); + } + + @Override + public VertexConsumerProvider getConsumers() { + return worldRenderContext.consumers(); + } + + @Override + public Frustum getFrustum() { + return worldRenderContext.worldRenderer().getCapturedFrustum(); + } + }, renderState)))); + } + + public static void _registerWorldRenderAfterLevel(WorldRenderContextListener listener) { + WorldRenderEvents.END_MAIN.register((context -> { + listener.render(new WorldRenderContext() { + @Override + public WorldRenderer getWorldRenderer() { + return context.worldRenderer(); + } + + @Override + public MatrixStack getMatrixStack() { + return context.matrices(); + } + + @Override + public float getTickDelta() { + return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); + } + + @Override + public Camera getCamera() { + return context.gameRenderer().getCamera(); + } + + @Override + public GameRenderer getGameRenderer() { + return context.gameRenderer(); + } + + @Override + public LightmapTextureManager getLightmapTextureManager() { + return getGameRenderer().getLightmapTextureManager(); + } + + @Override + public Matrix4f getProjectionMatrix() { + return context.gameRenderer().getBasicProjectionMatrix(0); + } + + @Override + public ClientWorld getWorld() { + return ClientUtil.getWorld(); + } + + @Override + public boolean isAdvancedTranslucency() { + return true; + } + + @Override + public @Nullable VertexConsumerProvider getConsumers() { + return context.consumers(); + } + + @Override + public @Nullable Frustum getFrustum() { + return context.worldRenderer().getCapturedFrustum(); + } + }); + })); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java new file mode 100644 index 000000000..3b189df69 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java @@ -0,0 +1,122 @@ +package net.pitan76.mcpitanlib.api.client.event.listener; + +import net.minecraft.block.BlockState; +import net.minecraft.client.render.Camera; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.WorldRenderer; +import net.minecraft.client.render.state.OutlineRenderState; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; +import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; + +import java.util.Optional; + +public class BeforeBlockOutlineEvent { + public WorldRenderContext context; + public HitResult hitResult; + + public BeforeBlockOutlineEvent(WorldRenderContext context, OutlineRenderState renderState) { + this.context = context; + this.hitResult = context.getHitResult(); + } + + public BeforeBlockOutlineEvent(WorldRenderContext context, HitResult hitResult) { + this.context = context; + this.hitResult = hitResult; + } + + public HitResult getHitResult() { + return hitResult; + } + + public WorldRenderContext getContext() { + return context; + } + + public WorldRenderer getWorldRenderer() { + return context.getWorldRenderer(); + } + + public Optional getBlockState() { + return Optional.ofNullable(getWorld().getBlockState(getBlockPos().orElse(null))); + } + + public World getWorld() { + return context.getWorld(); + } + + public Optional getBlockPos() { + return Optional.ofNullable(((BlockHitResult) hitResult).getBlockPos()); + } + + public boolean isBlockType() { + return getHitResultType() == HitResult.Type.BLOCK; + } + + public HitResult.Type getHitResultType() { + return hitResult.getType(); + } + + @Deprecated + public Camera getCamera() { + return context.getCamera(); + } + + public CameraWrapper getCameraWrapper() { + return CameraWrapper.of(getCamera()); + } + + public Optional getOutlineShape() { + return context.getOutlineShape(); + } + + public MatrixStack getMatrixStack() { + return context.getMatrixStack(); + } + + public void push() { + context.push(); + } + + public void translate(double x, double y, double z) { + context.translate(x, y, z); + } + + public void pop() { + context.pop(); + } + + public Optional getVertexConsumer() { + return context.getVertexConsumer(); + } + + public void drawBox(float red, float green, float blue, float alpha) { + context.drawBox(red, green, blue, alpha); + } + + public void drawBox(Box box, float red, float green, float blue, float alpha) { + context.drawBox(box, red, green, blue, alpha); + } + + public net.pitan76.mcpitanlib.midohra.util.hit.HitResult getHitResultM() { + return net.pitan76.mcpitanlib.midohra.util.hit.HitResult.of(hitResult); + } + + public HitResultType getHitResultTypeM() { + return HitResultType.from(hitResult.getType()); + } + + public BlockState getBlockState2() { + return getWorld().getBlockState(getHitResultM().asBlockHitResult().get().getBlockPos()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockStateM() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState2()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java new file mode 100644 index 000000000..881ee7b11 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java @@ -0,0 +1,11 @@ +package net.pitan76.mcpitanlib.api.client.event.listener; + + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +@FunctionalInterface +public interface BeforeBlockOutlineListener { + boolean beforeBlockOutline(BeforeBlockOutlineEvent event); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java new file mode 100644 index 000000000..f2ac0da2e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java @@ -0,0 +1,68 @@ +package net.pitan76.mcpitanlib.api.client.event.listener; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +import java.util.List; + +public class ItemTooltipContext { + + public ItemStack stack; + public List texts; + public Item.TooltipContext tooltipContext; + + @Deprecated + public TooltipType type; + + public ItemTooltipContext(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipType type) { + this.stack = stack; + this.texts = texts; + this.tooltipContext = tooltipContext; + this.type = type; + } + + public ItemStack getStack() { + return stack; + } + + public List getTexts() { + return texts; + } + + public Item.TooltipContext getTooltipContext() { + return tooltipContext; + } + + @Deprecated + public TooltipType getType() { + return type; + } + + public void addTooltip(Text text) { + texts.add(text); + } + + public void addTooltip(List texts) { + this.texts.addAll(texts); + } + + public boolean isAdvanced() { + return type.isAdvanced(); + } + + public boolean isCreative() { + return type.isCreative(); + } + + public void addTooltip(TextComponent textComponent) { + addTooltip(textComponent.getText()); + } + + public void addTooltip(String text) { + addTooltip(TextUtil.literal(text)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java new file mode 100644 index 000000000..d86227934 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.api.client.event.listener; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.text.Text; + +import java.util.List; + +@FunctionalInterface +public interface ItemTooltipListener { + void onTooltip(ItemTooltipContext context); + + default void onTooltip(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipType type) { + onTooltip(new ItemTooltipContext(stack, texts, tooltipContext, type)); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java new file mode 100644 index 000000000..2f67d7776 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java @@ -0,0 +1,140 @@ +package net.pitan76.mcpitanlib.api.client.event.listener; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.block.BlockState; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.*; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.Entity; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.shape.VoxelShape; +import net.pitan76.mcpitanlib.api.util.VoxelShapeUtil; +import net.pitan76.mcpitanlib.api.util.client.render.VertexRenderingUtil; +import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; +import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; + +import java.util.Objects; +import java.util.Optional; + +public interface WorldRenderContext { + + WorldRenderer getWorldRenderer(); + + MatrixStack getMatrixStack(); + + float getTickDelta(); + + Camera getCamera(); + + GameRenderer getGameRenderer(); + + LightmapTextureManager getLightmapTextureManager(); + + @Deprecated + Matrix4f getProjectionMatrix(); + + ClientWorld getWorld(); + + @Deprecated + boolean isAdvancedTranslucency(); + + @Nullable VertexConsumerProvider getConsumers(); + @Nullable Frustum getFrustum(); + + @Environment(EnvType.CLIENT) + interface BlockOutlineContext { + @Deprecated + VertexConsumer vertexConsumer(); + + Entity entity(); + + double cameraX(); + + double cameraY(); + + double cameraZ(); + + BlockPos blockPos(); + + BlockState blockState(); + } + + default HitResult getHitResult() { + return MinecraftClient.getInstance().crosshairTarget; + } + + default Optional getBlockState() { + return Optional.ofNullable(getWorld().getBlockState(getBlockPos().orElse(null))); + } + + default Optional getBlockPos() { + return Optional.ofNullable(((BlockHitResult) getHitResult()).getBlockPos()); + } + + default boolean isBlockType() { + return getHitResultType() == HitResult.Type.BLOCK; + } + + default HitResult.Type getHitResultType() { + return getHitResult().getType(); + } + + default Optional getOutlineShape() { + return getBlockState().map(blockState -> blockState.getOutlineShape(getWorld(), + getBlockPos().orElse(null))); + } + + default void push() { + getMatrixStack().push(); + } + + default void translate(double x, double y, double z) { + getMatrixStack().translate(x, y, z); + } + + default void pop() { + getMatrixStack().pop(); + } + + default Optional getVertexConsumer() { + if (getConsumers() == null) + return Optional.empty(); + + return Optional.of(Objects.requireNonNull(getConsumers()).getBuffer(RenderLayers.lines())); + } + + default void drawBox(float red, float green, float blue, float alpha) { + Optional outlineShape = getOutlineShape(); + if (!outlineShape.isPresent()) return; + + drawBox(VoxelShapeUtil.getBoundingBox(outlineShape.get()), red, green, blue, alpha); + } + + default void drawBox(Box box, float red, float green, float blue, float alpha) { + Optional vertexConsumer = getVertexConsumer(); + + if (!vertexConsumer.isPresent()) + return; + + VertexConsumer consumer = vertexConsumer.get(); + + double x1 = box.minX; + double y1 = box.minY; + double z1 = box.minZ; + double x2 = box.maxX; + double y2 = box.maxY; + double z2 = box.maxZ; + + VertexRenderingUtil.drawBox(getMatrixStack(), consumer, x1, y1, z1, x2, y2, z2, red, green, blue, alpha); + } + + default CameraWrapper getCameraWrapper() { + return CameraWrapper.of(getCamera()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java new file mode 100644 index 000000000..dbe5fcd85 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java @@ -0,0 +1,113 @@ +package net.pitan76.mcpitanlib.api.client.event.listener; + +import net.minecraft.client.render.*; +import net.minecraft.client.render.state.WorldRenderState; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.util.math.RotationAxis; +import net.minecraft.util.math.Vec3d; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; + +public class WorldRenderContextImpl implements WorldRenderContext { + + public WorldRenderer worldRenderer; + public MatrixStack matrixStack; + public float tickDelta; + public Camera camera; + public GameRenderer gameRenderer; + public LightmapTextureManager lightmapTextureManager; + public Matrix4f projectionMatrix; + public ClientWorld world; + public boolean advancedTranslucency; + public @Nullable VertexConsumerProvider consumers; + public @Nullable Frustum frustum; + + @Override + public WorldRenderer getWorldRenderer() { + return worldRenderer; + } + + @Override + public MatrixStack getMatrixStack() { + return matrixStack; + } + + @Override + public float getTickDelta() { + return tickDelta; + } + + @Override + public Camera getCamera() { + if (camera == null) { + return getGameRenderer().getCamera(); + } + return camera; + } + + @Override + public GameRenderer getGameRenderer() { + if (gameRenderer == null) { + return ClientUtil.getGameRenderer(); + } + return gameRenderer; + } + + @Override + public LightmapTextureManager getLightmapTextureManager() { + return lightmapTextureManager; + } + + @Override + public Matrix4f getProjectionMatrix() { + return projectionMatrix; + } + + @Override + public ClientWorld getWorld() { + if (world == null) { + return ClientUtil.getWorld(); + } + return world; + } + + @Override + public boolean isAdvancedTranslucency() { + return advancedTranslucency; + } + + @Override + public @Nullable VertexConsumerProvider getConsumers() { + return consumers; + } + + @Override + public @Nullable Frustum getFrustum() { + return frustum; + } + + public void prepare(GameRenderer gameRenderer, WorldRenderer worldRenderer, WorldRenderState worldRenderState, @Nullable ClientWorld world, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix) { + this.gameRenderer = gameRenderer; + this.worldRenderer = worldRenderer; + this.world = world; + this.camera = camera; + this.matrixStack = new MatrixStack(); + this.matrixStack.multiplyPositionMatrix(projectionMatrix); + this.matrixStack.push(); + + matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw())); + matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); + + Vec3d camPos = camera.getCameraPos(); + matrixStack.translate(-camPos.x, -camPos.y, -camPos.z); + + this.matrixStack.pop(); + + this.projectionMatrix = projectionMatrix;; + this.tickDelta = tickCounter.getDynamicDeltaTicks(); + this.lightmapTextureManager = gameRenderer.getLightmapTextureManager(); + this.frustum = worldRenderer.getCapturedFrustum(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java new file mode 100644 index 000000000..7025eae59 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.client.event.listener; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; + +@Environment(EnvType.CLIENT) +@FunctionalInterface +public interface WorldRenderContextListener { + void render(WorldRenderContext context); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java new file mode 100644 index 000000000..0cd2b1ac5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java @@ -0,0 +1,33 @@ +package net.pitan76.mcpitanlib.api.client.gui.screen; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.Slot; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; + +public abstract class CompatInventoryScreen extends SimpleInventoryScreen { + + public CompatInventoryScreen(S handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + } + + public abstract CompatIdentifier getCompatTexture(); + + @Deprecated + @Override + public Identifier getTexture() { + return getCompatTexture().toMinecraft(); + } + + public void drawSlot(DrawObjectDM drawObjectDM, Slot slot) { + SlotRenderer.drawSlot(drawObjectDM, slot, x, y); + } + + public void drawSlots(DrawObjectDM drawObjectDM) { + SlotRenderer.drawSlots(drawObjectDM, handler, x, y); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java new file mode 100644 index 000000000..da47fb543 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.client.gui.screen; + +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +public class ScreenTexts { + public static final Text ON = TextUtil.translatable("options.on"); + public static final Text OFF = TextUtil.translatable("options.off"); + public static final Text DONE = TextUtil.translatable("gui.done"); + public static final Text CANCEL = TextUtil.translatable("gui.cancel"); + public static final Text YES = TextUtil.translatable("gui.yes"); + public static final Text NO = TextUtil.translatable("gui.no"); + public static final Text PROCEED = TextUtil.translatable("gui.proceed"); + public static final Text BACK = TextUtil.translatable("gui.back"); + public static final Text CONNECT_FAILED = TextUtil.translatable("connect.failed"); + public static final Text LINE_BREAK = TextUtil.literal("\n"); + public static final Text SENTENCE_SEPARATOR = TextUtil.literal(". "); + + public ScreenTexts() { + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java new file mode 100644 index 000000000..df171ff21 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java @@ -0,0 +1,364 @@ +package net.pitan76.mcpitanlib.api.client.gui.screen; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.Selectable; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.input.KeyInput; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.*; +import net.pitan76.mcpitanlib.api.client.render.screen.RenderBackgroundTextureArgs; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import net.pitan76.mcpitanlib.api.util.client.RenderUtil; +import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; +import net.pitan76.mcpitanlib.core.datafixer.Pair; + +public abstract class SimpleHandledScreen extends HandledScreen { + + public int width, height, backgroundWidth, backgroundHeight, x, y; + public S handler; + public TextRenderer textRenderer; + public ItemRenderer itemRenderer; + + public Text title; + public MinecraftClient client; + public SimpleHandledScreen(S handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + fixScreen(); + this.handler = handler; + this.title = title; + + } + + @Deprecated + @Override + public S getScreenHandler() { + return getScreenHandlerOverride(); + } + + public S getScreenHandlerOverride() { + return super.getScreenHandler(); + } + + public T addDrawableChild_compatibility(T drawableElement) { + return super.addDrawableChild(drawableElement); + // addButton + } + + public T addSelectableChild_compatibility(T selectableElement) { + return super.addSelectableChild(selectableElement); + } + + public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { + return addDrawableChild_compatibility(widget); + } + + @Deprecated + @Override + protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { + DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); + drawBackgroundOverride(new DrawBackgroundArgs(drawObjectDM, delta, mouseX, mouseY)); + } + + public abstract void drawBackgroundOverride(DrawBackgroundArgs args); + + @Deprecated + @Override + protected void drawForeground(DrawContext context, int mouseX, int mouseY) { + DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); + drawForegroundOverride(new DrawForegroundArgs(drawObjectDM, mouseX, mouseY)); + } + + protected void drawForegroundOverride(DrawForegroundArgs args) { + super.drawForeground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + } + + public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { + ScreenUtil.RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); + } + + public void callDrawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, int u, int v, int width, int height) { + callDrawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); + } + + @Deprecated + public void callRenderBackground(DrawObjectDM drawObjectDM) { + callRenderBackground(new RenderArgs(drawObjectDM, 0, 0, 0)); + } + + + public void callRenderBackground(RenderArgs args) { + super.renderBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { + super.drawMouseoverTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + } + + public void renderOverride(RenderArgs args) { + super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public void resizeOverride(MinecraftClient client, int width, int height) { + } + + public void initOverride() { + } + + @Deprecated + @Override + protected void init() { + super.init(); + fixScreen(); + initOverride(); + } + + @Deprecated + @Override + public void resize(int width, int height) { + super.resize(width, height); + fixScreen(); + resizeOverride(MinecraftClient.getInstance(), width, height); + } + + public void fixScreen() { + this.backgroundWidth = getBackgroundWidth(); + this.backgroundHeight = getBackgroundHeight(); + this.x = super.x; //(this.width - this.backgroundWidth) / 2; + this.y = super.y; //(this.height - this.backgroundHeight) / 2; + this.textRenderer = super.textRenderer; + this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); + this.width = super.width; + this.height = super.height; + if (super.client == null) + this.client = MinecraftClient.getInstance(); + else + this.client = super.client; + } + + public void setX(int x) { + this.x = x; + super.x = x; + } + + public void setY(int y) { + this.y = y; + super.y = y; + } + + public void setTextRenderer(TextRenderer textRenderer) { + this.textRenderer = textRenderer; + } + + public void setItemRenderer(ItemRenderer itemRenderer) { + this.itemRenderer = itemRenderer; + } + + public void setWidth(int width) { + this.width = width; + super.width = width; + } + + public void setBackgroundWidth(int backgroundWidth) { + this.backgroundWidth = backgroundWidth; + super.backgroundWidth = backgroundWidth; + } + + public void setBackgroundHeight(int backgroundHeight) { + this.backgroundHeight = backgroundHeight; + super.backgroundHeight = backgroundHeight; + } + + public void setHeight(int height) { + this.height = height; + super.height = height; + } + + public int getBackgroundWidth() { + return super.backgroundWidth; + } + + public int getBackgroundHeight() { + return super.backgroundHeight; + } + + @Deprecated + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); + renderOverride(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); + } + + public boolean keyReleased(KeyEventArgs args) { + return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + } + + public boolean keyPressed(KeyEventArgs args) { + return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + } + + public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { + if (getBackgroundTexture() != null) + Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); + + RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); + } + + @Deprecated + @Override + public boolean keyReleased(KeyInput input) { + return this.keyReleased(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); + } + + @Deprecated + @Override + public boolean keyPressed(KeyInput input) { + return this.keyPressed(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); + } + + @Deprecated + @Override + public void renderDarkening(DrawContext context) { + this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); + } + + public void closeOverride() { + super.close(); + } + + public void removedOverride() { + super.removed(); + } + + @Override + public void close() { + closeOverride(); + } + + @Override + public void removed() { + removedOverride(); + } + + public Identifier getBackgroundTexture() { + return IdentifierUtil.from(getCompatBackgroundTexture()); + } + + public CompatIdentifier getCompatBackgroundTexture() { + return null; + } + + public void setTitleX(int x) { + this.titleX = x; + } + + public void setTitleY(int y) { + this.titleY = y; + } + + public void setTitlePos(int x, int y) { + setTitleX(x); + setTitleY(y); + } + + public void setTitleXCenter() { + if (textRenderer == null) + textRenderer = ClientUtil.getTextRenderer(); + + setTitleX(backgroundWidth / 2 - textRenderer.getWidth(title) / 2); + } + + public int getTitleX() { + return titleX; + } + + public int getTitleY() { + return titleY; + } + + public void drawText(DrawObjectDM drawObjectDM, Text text, int x, int y, int color) { + ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y, color); + } + + public void drawText(DrawObjectDM drawObjectDM, TextComponent text, int x, int y, int color) { + ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y, color); + } + + public void drawText(DrawObjectDM drawObjectDM, Text text, int x, int y) { + ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y); + } + + public void drawText(DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { + ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y); + } + + @Deprecated + @Override + public Text getTitle() { + return callGetTitle(); + } + + public Text callGetTitle() { + return super.getTitle(); + } + + public Pair getTitlePosP() { + return new Pair<>(getTitleX(), getTitleY()); + } + + public int getPlayerInvTitleX() { + return playerInventoryTitleX; + } + + public int getPlayerInvTitleY() { + return playerInventoryTitleY; + } + + public void setPlayerInvTitleX(int x) { + playerInventoryTitleX = x; + } + + public void setPlayerInvTitleY(int y) { + playerInventoryTitleY = y; + } + + public void setPlayerInvTitle(int x, int y) { + setPlayerInvTitleX(x); + setPlayerInvTitleY(y); + } + + public TextRenderer callGetTextRenderer() { + if (textRenderer != null) + return textRenderer; + + if (super.getTextRenderer() != null) + return super.getTextRenderer(); + + return ClientUtil.getTextRenderer(); + } + + public ItemRenderer callGetItemRenderer() { + if (itemRenderer != null) + return itemRenderer; + + return ClientUtil.getItemRenderer(); + } + + public Text getPlayerInvTitle() { + return playerInventoryTitle; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java new file mode 100644 index 000000000..f2fadac7f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.client.gui.screen; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawMouseoverTooltipArgs; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; +import net.pitan76.mcpitanlib.api.util.client.RenderUtil; + +public abstract class SimpleInventoryScreen extends SimpleHandledScreen { + + public SimpleInventoryScreen(S handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + } + + public abstract Identifier getTexture(); + + @Override + public Identifier getBackgroundTexture() { + return getTexture(); + } + + @Override + public void drawBackgroundOverride(DrawBackgroundArgs args) { + RenderUtil.setShaderToPositionTexProgram(); + RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + callDrawTexture(args.drawObjectDM, getTexture(), x, y, 0, 0, backgroundWidth, backgroundHeight); + } + + @Override + public void renderOverride(RenderArgs args) { + this.callRenderBackground(args); + super.renderOverride(args); + this.callDrawMouseoverTooltip(new DrawMouseoverTooltipArgs(args.drawObjectDM, args.mouseX, args.mouseY)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java new file mode 100644 index 000000000..4c0d379cd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java @@ -0,0 +1,145 @@ +package net.pitan76.mcpitanlib.api.client.gui.widget; + +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.widget.TextFieldWidget; +import net.minecraft.client.input.CharInput; +import net.minecraft.client.input.KeyInput; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import org.jetbrains.annotations.Nullable; + +public class CompatTextFieldWidget extends TextFieldWidget { + public CompatTextFieldWidget(TextRenderer textRenderer, int width, int height) { + this(textRenderer, width, height, TextUtil.empty()); + } + + public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height) { + this(textRenderer, x, y, width, height, TextUtil.empty()); + } + + // ---- + + public CompatTextFieldWidget(TextRenderer textRenderer, int width, int height, Text text) { + super(textRenderer, width, height, text); + } + + public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text text) { + super(textRenderer, x, y, width, height, text); + } + + public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, @Nullable TextFieldWidget copyFrom, Text text) { + super(textRenderer, x, y, width, height, copyFrom, text); + } + + // ---- + + @Deprecated + @Override + public void setDrawsBackground(boolean drawsBackground) { + callSetDrawsBackground(drawsBackground); + } + + public void callSetDrawsBackground(boolean drawsBackground) { + super.setDrawsBackground(drawsBackground); + } + + @Deprecated + @Override + public void setFocused(boolean focused) { + callSetFocused(focused); + } + + public void callSetFocused(boolean focused) { + super.setFocused(focused); + } + + @Deprecated + @Override + public void setFocusUnlocked(boolean focusUnlocked) { + callSetFocusUnlocked(focusUnlocked); + } + + public void callSetFocusUnlocked(boolean focusUnlocked) { + super.setFocusUnlocked(focusUnlocked); + } + + @Deprecated + @Override + public void setMaxLength(int maxLength) { + callSetMaxLength(maxLength); + } + + public void callSetMaxLength(int maxLength) { + super.setMaxLength(maxLength); + } + + @Deprecated + @Override + public void setText(String text) { + callSetText(text); + } + + public void callSetText(String text) { + super.setText(text); + } + + @Deprecated + @Override + public String getText() { + return callGetText(); + } + + public String callGetText() { + return super.getText(); + } + + @Deprecated + @Override + public void setEditable(boolean editable) { + callSetEditable(editable); + } + + public void callSetEditable(boolean editable) { + super.setEditable(editable); + } + + @Deprecated + @Override + public boolean isFocused() { + return callIsFocused(); + } + + public boolean callIsFocused() { + return super.isFocused(); + } + + @Deprecated + @Override + public boolean keyPressed(KeyInput input) { + return callKeyPressed(input.key(), input.scancode(), input.modifiers()); + } + + public boolean callKeyPressed(int keyCode, int scanCode, int modifiers) { + return super.keyPressed(new KeyInput(keyCode, scanCode, modifiers)); + } + + @Deprecated + @Override + public boolean keyReleased(KeyInput input) { + return callKeyReleased(input.key(), input.scancode(), input.modifiers()); + } + + public boolean callKeyReleased(int keyCode, int scanCode, int modifiers) { + return super.keyReleased(new KeyInput(keyCode, scanCode, modifiers)); + } + + @Deprecated + @Override + public boolean charTyped(CharInput input) { + return callCharTyped((char) input.codepoint(), input.modifiers()); + } + + public boolean callCharTyped(char chr, int modifiers) { + return super.charTyped(new CharInput(chr, modifiers)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java new file mode 100644 index 000000000..9a0715a78 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java @@ -0,0 +1,74 @@ +package net.pitan76.mcpitanlib.api.client.gui.widget; + +import net.minecraft.client.gl.RenderPipelines; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.ButtonTextures; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.gui.widget.TexturedButtonWidget; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +public class CompatibleTexturedButtonWidget extends TexturedButtonWidget { + private final Identifier texture; + private final int u; + private final int v; + private final int hoveredVOffset; + private final int textureWidth; + private final int textureHeight; + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { + this(x, y, width, height, u, v, height, texture, 256, 256, pressAction); + } + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { + this(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); + } + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + this(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, TextUtil.empty()); + } + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, net.minecraft.text.Text text) { + super(x, y, width, height, new ButtonTextures(texture, texture), pressAction, text); + this.textureWidth = textureWidth; + this.textureHeight = textureHeight; + this.u = u; + this.v = v; + this.hoveredVOffset = hoveredVOffset; + this.texture = texture; + } + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + this(x, y, width, height, u, v, texture.toMinecraft(), pressAction); + } + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); + } + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); + } + + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, net.minecraft.text.Text text) { + this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, text); + } + + public void setPos(int x, int y) { + setX(x); + setY(y); + } + + @Override + public void drawIcon(DrawContext context, int mouseX, int mouseY, float delta) { + int i = v; + if (this.getNarrationMessage().toString().isEmpty()) { + i = v + hoveredVOffset * 2; + } else if (this.isHovered()) { + i += hoveredVOffset; + } + + context.drawTexture(RenderPipelines.GUI_TEXTURED, texture, this.getX(), this.getY(), u, i, this.width, this.height, textureWidth, textureHeight); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java new file mode 100644 index 000000000..ac768e311 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java @@ -0,0 +1,51 @@ +package net.pitan76.mcpitanlib.api.client.gui.widget; + +import net.minecraft.client.gui.DrawContext; +import net.minecraft.resources.Identifier; + +public class RedrawableTexturedButtonWidget extends CompatibleTexturedButtonWidget { + public Identifier texture; + public int u; + public int v; + public int hoveredVOffset; + public int textureWidth; + public int textureHeight; + + public RedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, PressAction pressAction, net.minecraft.text.Text message) { + super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); + this.textureWidth = textureWidth; + this.textureHeight = textureHeight; + this.u = u; + this.v = v; + this.hoveredVOffset = hoveredVOffset; + this.texture = texture; + } + + public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) { + super.renderWidget(context, mouseX, mouseY, delta); + } + + public void setTexture(Identifier texture) { + this.texture = texture; + } + + public void setU(int u) { + this.u = u; + } + + public void setV(int v) { + this.v = v; + } + + public void setHoveredVOffset(int hoveredVOffset) { + this.hoveredVOffset = hoveredVOffset; + } + + public void setTextureWidth(int textureWidth) { + this.textureWidth = textureWidth; + } + + public void setTextureHeight(int textureHeight) { + this.textureHeight = textureHeight; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java new file mode 100644 index 000000000..330f1e2b0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java @@ -0,0 +1,114 @@ +package net.pitan76.mcpitanlib.api.client.gui.widget; + +import com.google.common.collect.ImmutableList; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.Selectable; +import net.minecraft.client.gui.widget.ClickableWidget; +import net.minecraft.client.gui.widget.ElementListWidget; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Optional; + +@Environment(EnvType.CLIENT) +public class SimpleListWidget extends ElementListWidget { + + public SimpleListWidget(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) { + this(client, width, bottom - top, top, itemHeight); + } + + public SimpleListWidget(MinecraftClient client, int width, int height, int y, int itemHeight) { + super(client, width, height, y, itemHeight); + this.centerListVertically = false; + } + + public void add(ClickableWidget widget) { + super.addEntry(WidgetEntry.create(widget)); + } + + @Override + public int getRowWidth() { + return 400; + } + + public int getWidth() { + return this.width; + } + + public int getHeight() { + return this.height; + } + + @Override + protected int getScrollbarX() { + return super.getScrollbarX() + 32; + } + + @Nullable + public ClickableWidget getWidget(int index) { + if (index < 0 || index >= this.children().size()) { + return null; + } + return this.children().get(index).getWidget(); + } + + public Optional getHoveredWidget(double mouseX, double mouseY) { + for (WidgetEntry entry : this.children()) { + if (entry.getWidget().isMouseOver(mouseX, mouseY)) { + return Optional.of(entry.getWidget()); + } + } + return Optional.empty(); + } + + /* + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + this.render(new RenderArgs(new DrawObjectDM(context), mouseX, mouseY, delta)); + } + */ + + public void render(RenderArgs args) { + super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + @Environment(EnvType.CLIENT) + public static class WidgetEntry extends Entry { + protected final ClickableWidget widget; + + public WidgetEntry(ClickableWidget widget) { + this.widget = widget; + } + + public static WidgetEntry create(ClickableWidget widget) { + return new WidgetEntry(widget); + } + + @Deprecated + @Override + public void render(DrawContext context, int mouseX, int mouseY, boolean hovered, float deltaTicks) { + widget.render(context, mouseX, mouseY, deltaTicks); + } + + @Deprecated + @Override + public List children() { + return ImmutableList.of(widget); + } + + @Deprecated + @Override + public List selectableChildren() { + return ImmutableList.of(widget); + } + + public ClickableWidget getWidget() { + return widget; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java new file mode 100644 index 000000000..7c4b87d68 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java @@ -0,0 +1,82 @@ +package net.pitan76.mcpitanlib.api.client.gui.widget; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.widget.SliderWidget; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +import java.util.function.Consumer; +import java.util.function.Function; + +@Environment(EnvType.CLIENT) +public class SimpleSliderWidget extends SliderWidget { + protected final Function textGetter; + protected final Consumer changeCallback; + public SimpleListWidget listWidget = null; + + public SimpleSliderWidget(int x, int y, int width, int height, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + super(x, y, width, height, text, defaultValue); + this.textGetter = (Double value) -> valueTextGetter.get(text, value); + this.changeCallback = changeCallback; + this.updateMessage(); + } + public SimpleSliderWidget(int x, int y, int width, int height, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + this(x, y, width, height, TextUtil.empty(), defaultValue, valueTextGetter, changeCallback); + } + + public SimpleSliderWidget(int x, int y, int width, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + this(x, y, width, 20, text, defaultValue, valueTextGetter, changeCallback); + } + + public SimpleSliderWidget(int x, int y, int width, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + this(x, y, width, 20, defaultValue, valueTextGetter, changeCallback); + } + + public SimpleSliderWidget(SimpleListWidget listWidget, int width, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + this(listWidget.getWidth() / 2 - 155, 0, width, 20, text, defaultValue, valueTextGetter, changeCallback); + this.listWidget = listWidget; + } + + public SimpleSliderWidget(SimpleListWidget listWidget, int width, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + this(listWidget, width, TextUtil.empty(), defaultValue, valueTextGetter, changeCallback); + } + + /* + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + this.render(new RenderArgs(new DrawObjectDM(context), mouseX, mouseY, delta)); + } + */ + + public void render(RenderArgs args) { + super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public void setValue(double value) { + super.value = value; + } + + public double getValue() { + return super.value; + } + + @Override + protected void updateMessage() { + this.setMessage(this.textGetter.apply(this.getValue())); + } + + @Override + protected void applyValue() { + this.changeCallback.accept(this.getValue()); + } + + @Environment(EnvType.CLIENT) + @FunctionalInterface + public interface ValueTextGetter { + Text get(Text optionText, Double value); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java b/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java new file mode 100644 index 000000000..79e18403f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java @@ -0,0 +1,78 @@ +package net.pitan76.mcpitanlib.api.client.option; + +import net.minecraft.client.option.KeyBinding; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +public class CompatKeyBinding { + private final KeyBinding keyBinding; + public static final Map categories = new HashMap<>(); + + public CompatKeyBinding(KeyBinding keyBinding) { + this.keyBinding = keyBinding; + } + + public CompatKeyBinding(String translationKey, int defaultKeyCode, CompatIdentifier category) { + KeyBinding.Category cat; + + if (categories.containsKey(category)) { + cat = categories.get(category); + } else { + cat = KeyBinding.Category.create(category.toMinecraft()); + categories.put(category, cat); + } + + this.keyBinding = new KeyBinding(translationKey, defaultKeyCode, cat); + } + + public CompatKeyBinding(String translationKey, int defaultKeyCode) { + String[] parts = translationKey.split("\\."); + if (Objects.equals(parts[0], "key") && parts.length == 3) { + CompatIdentifier category = CompatIdentifier.of(parts[1], "main"); + KeyBinding.Category cat; + + if (categories.containsKey(category)) { + cat = categories.get(category); + } else { + cat = KeyBinding.Category.create(category.toMinecraft()); + categories.put(category, cat); + } + + this.keyBinding = new KeyBinding(translationKey, defaultKeyCode, cat); + } else { + throw new IllegalArgumentException("Cannot infer category from translation key: " + translationKey); + } + } + + public String getTranslationKey() { + return keyBinding.getBoundKeyTranslationKey(); + } + + public Text getBoundKeyLocalizedText() { + return keyBinding.getBoundKeyLocalizedText(); + } + + public int getDefaultKeyCode() { + return keyBinding.getDefaultKey().getCode(); + } + + public static CompatKeyBinding of(String translationKey, int defaultKeyCode, CompatIdentifier category) { + return new CompatKeyBinding(translationKey, defaultKeyCode, category); + } + + public static CompatKeyBinding of(String translationKey, int defaultKeyCode) { + return new CompatKeyBinding(translationKey, defaultKeyCode); + } + + public KeyBinding toMinecraft() { + return keyBinding; + } + + public KeyBinding getRaw() { + return keyBinding; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java b/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java new file mode 100644 index 000000000..3bdfa6bfe --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.client.option; + +import net.minecraft.client.option.GameOptions; + +public class GameOptionsWrapper { + public final GameOptions raw; + + public GameOptionsWrapper(GameOptions options) { + this.raw = options; + } + + public GameOptions getRaw() { + return raw; + } + + public void write() { + raw.write(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java b/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java new file mode 100644 index 000000000..27187f69f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java @@ -0,0 +1,127 @@ +package net.pitan76.mcpitanlib.api.client.option; + +import org.lwjgl.glfw.GLFW; + +public class KeyCodes { + public static final int KEY_UNKNOWN = GLFW.GLFW_KEY_UNKNOWN, + KEY_SPACE = GLFW.GLFW_KEY_SPACE, + KEY_APOSTROPHE = GLFW.GLFW_KEY_APOSTROPHE, + KEY_COMMA = GLFW.GLFW_KEY_COMMA, + KEY_MINUS = GLFW.GLFW_KEY_MINUS, + KEY_PERIOD = GLFW.GLFW_KEY_PERIOD, + KEY_SLASH = GLFW.GLFW_KEY_SLASH, + KEY_0 = GLFW.GLFW_KEY_0, + KEY_1 = GLFW.GLFW_KEY_1, + KEY_2 = GLFW.GLFW_KEY_2, + KEY_3 = GLFW.GLFW_KEY_3, + KEY_4 = GLFW.GLFW_KEY_4, + KEY_5 = GLFW.GLFW_KEY_5, + KEY_6 = GLFW.GLFW_KEY_6, + KEY_7 = GLFW.GLFW_KEY_7, + KEY_8 = GLFW.GLFW_KEY_8, + KEY_9 = GLFW.GLFW_KEY_9, + KEY_SEMICOLON = GLFW.GLFW_KEY_SEMICOLON, + KEY_EQUAL = GLFW.GLFW_KEY_EQUAL, + KEY_A = GLFW.GLFW_KEY_A, + KEY_B = GLFW.GLFW_KEY_B, + KEY_C = GLFW.GLFW_KEY_C, + KEY_D = GLFW.GLFW_KEY_D, + KEY_E = GLFW.GLFW_KEY_E, + KEY_F = GLFW.GLFW_KEY_F, + KEY_G = GLFW.GLFW_KEY_G, + KEY_H = GLFW.GLFW_KEY_H, + KEY_I = GLFW.GLFW_KEY_I, + KEY_J = GLFW.GLFW_KEY_J, + KEY_K = GLFW.GLFW_KEY_K, + KEY_L = GLFW.GLFW_KEY_L, + KEY_M = GLFW.GLFW_KEY_M, + KEY_N = GLFW.GLFW_KEY_N, + KEY_O = GLFW.GLFW_KEY_O, + KEY_P = GLFW.GLFW_KEY_P, + KEY_Q = GLFW.GLFW_KEY_Q, + KEY_R = GLFW.GLFW_KEY_R, + KEY_S = GLFW.GLFW_KEY_S, + KEY_T = GLFW.GLFW_KEY_T, + KEY_U = GLFW.GLFW_KEY_U, + KEY_V = GLFW.GLFW_KEY_V, + KEY_W = GLFW.GLFW_KEY_W, + KEY_X = GLFW.GLFW_KEY_X, + KEY_Y = GLFW.GLFW_KEY_Y, + KEY_Z = GLFW.GLFW_KEY_Z, + KEY_LEFT_BRACKET = GLFW.GLFW_KEY_LEFT_BRACKET, + KEY_BACKSLASH = GLFW.GLFW_KEY_BACKSLASH, + KEY_RIGHT_BRACKET = GLFW.GLFW_KEY_RIGHT_BRACKET, + KEY_GRAVE_ACCENT = GLFW.GLFW_KEY_GRAVE_ACCENT, + KEY_WORLD_1 = GLFW.GLFW_KEY_WORLD_1, + KEY_WORLD_2 = GLFW.GLFW_KEY_WORLD_2, + KEY_ESCAPE = GLFW.GLFW_KEY_ESCAPE, + KEY_ENTER = GLFW.GLFW_KEY_ENTER, + KEY_TAB = GLFW.GLFW_KEY_TAB, + KEY_BACKSPACE = GLFW.GLFW_KEY_BACKSPACE, + KEY_INSERT = GLFW.GLFW_KEY_INSERT, + KEY_DELETE = GLFW.GLFW_KEY_DELETE, + KEY_RIGHT = GLFW.GLFW_KEY_RIGHT, + KEY_LEFT = GLFW.GLFW_KEY_LEFT, + KEY_DOWN = GLFW.GLFW_KEY_DOWN, + KEY_UP = GLFW.GLFW_KEY_UP, + KEY_PAGE_UP = GLFW.GLFW_KEY_PAGE_UP, + KEY_PAGE_DOWN = GLFW.GLFW_KEY_PAGE_DOWN, + KEY_HOME = GLFW.GLFW_KEY_HOME, + KEY_END = GLFW.GLFW_KEY_END, + KEY_CAPS_LOCK = GLFW.GLFW_KEY_CAPS_LOCK, + KEY_SCROLL_LOCK = GLFW.GLFW_KEY_SCROLL_LOCK, + KEY_NUM_LOCK = GLFW.GLFW_KEY_NUM_LOCK, + KEY_PRINT_SCREEN = GLFW.GLFW_KEY_PRINT_SCREEN, + KEY_PAUSE = GLFW.GLFW_KEY_PAUSE, + KEY_F1 = GLFW.GLFW_KEY_F1, + KEY_F2 = GLFW.GLFW_KEY_F2, + KEY_F3 = GLFW.GLFW_KEY_F3, + KEY_F4 = GLFW.GLFW_KEY_F4, + KEY_F5 = GLFW.GLFW_KEY_F5, + KEY_F6 = GLFW.GLFW_KEY_F6, + KEY_F7 = GLFW.GLFW_KEY_F7, + KEY_F8 = GLFW.GLFW_KEY_F8, + KEY_F9 = GLFW.GLFW_KEY_F9, + KEY_F10 = GLFW.GLFW_KEY_F10, + KEY_F11 = GLFW.GLFW_KEY_F11, + KEY_F12 = GLFW.GLFW_KEY_F12, + KEY_F13 = GLFW.GLFW_KEY_F13, + KEY_F14 = GLFW.GLFW_KEY_F14, + KEY_F15 = GLFW.GLFW_KEY_F15, + KEY_F16 = GLFW.GLFW_KEY_F16, + KEY_F17 = GLFW.GLFW_KEY_F17, + KEY_F18 = GLFW.GLFW_KEY_F18, + KEY_F19 = GLFW.GLFW_KEY_F19, + KEY_F20 = GLFW.GLFW_KEY_F20, + KEY_F21 = GLFW.GLFW_KEY_F21, + KEY_F22 = GLFW.GLFW_KEY_F22, + KEY_F23 = GLFW.GLFW_KEY_F23, + KEY_F24 = GLFW.GLFW_KEY_F24, + KEY_F25 = GLFW.GLFW_KEY_F25, + KEY_KP_0 = GLFW.GLFW_KEY_KP_0, + KEY_KP_1 = GLFW.GLFW_KEY_KP_1, + KEY_KP_2 = GLFW.GLFW_KEY_KP_2, + KEY_KP_3 = GLFW.GLFW_KEY_KP_3, + KEY_KP_4 = GLFW.GLFW_KEY_KP_4, + KEY_KP_5 = GLFW.GLFW_KEY_KP_5, + KEY_KP_6 = GLFW.GLFW_KEY_KP_6, + KEY_KP_7 = GLFW.GLFW_KEY_KP_7, + KEY_KP_8 = GLFW.GLFW_KEY_KP_8, + KEY_KP_9 = GLFW.GLFW_KEY_KP_9, + KEY_KP_DECIMAL = GLFW.GLFW_KEY_KP_DECIMAL, + KEY_KP_DIVIDE = GLFW.GLFW_KEY_KP_DIVIDE, + KEY_KP_MULTIPLY = GLFW.GLFW_KEY_KP_MULTIPLY, + KEY_KP_SUBTRACT = GLFW.GLFW_KEY_KP_SUBTRACT, + KEY_KP_ADD = GLFW.GLFW_KEY_KP_ADD, + KEY_KP_ENTER = GLFW.GLFW_KEY_KP_ENTER, + KEY_KP_EQUAL = GLFW.GLFW_KEY_KP_EQUAL, + KEY_LEFT_SHIFT = GLFW.GLFW_KEY_LEFT_SHIFT, + KEY_LEFT_CONTROL = GLFW.GLFW_KEY_LEFT_CONTROL, + KEY_LEFT_ALT = GLFW.GLFW_KEY_LEFT_ALT, + KEY_LEFT_SUPER = GLFW.GLFW_KEY_LEFT_SUPER, + KEY_RIGHT_SHIFT = GLFW.GLFW_KEY_RIGHT_SHIFT, + KEY_RIGHT_CONTROL = GLFW.GLFW_KEY_RIGHT_CONTROL, + KEY_RIGHT_ALT = GLFW.GLFW_KEY_RIGHT_ALT, + KEY_RIGHT_SUPER = GLFW.GLFW_KEY_RIGHT_SUPER, + KEY_MENU = GLFW.GLFW_KEY_MENU; +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java new file mode 100644 index 000000000..93222526d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java @@ -0,0 +1,189 @@ +package net.pitan76.mcpitanlib.api.client.registry; + +import dev.architectury.event.events.client.ClientLifecycleEvent; +import dev.architectury.registry.client.gui.MenuScreenRegistry; +import dev.architectury.registry.client.level.entity.EntityRendererRegistry; +import dev.architectury.registry.client.particle.ParticleProviderRegistry; +import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; +import net.minecraft.client.model.ModelPart; +import net.minecraft.client.particle.ParticleFactory; +import net.minecraft.client.particle.SpriteProvider; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.block.BlockRenderManager; +import net.minecraft.client.render.block.entity.BlockEntityRenderManager; +import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; +import net.minecraft.client.render.entity.EntityRenderManager; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.render.entity.model.EntityModelLayer; +import net.minecraft.client.render.entity.model.LoadedEntityModels; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.texture.Sprite; +import net.minecraft.client.texture.SpriteAtlasTexture; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.fluid.Fluid; +import net.minecraft.particle.ParticleEffect; +import net.minecraft.particle.ParticleType; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.minecraft.util.math.random.Random; + +import java.util.List; +import java.util.function.Supplier; + +@Deprecated +@Environment(EnvType.CLIENT) +public class ArchRegistryClient { + public static > void registerScreen(ScreenHandlerType type, ScreenFactory factory) { + ClientLifecycleEvent.CLIENT_SETUP.register((state) -> { + + }); + MenuScreenRegistry.registerScreenFactory(type, factory::create); + } + + public interface ScreenFactory> { + S create(H handler, PlayerInventory inventory, Text text); + } + + public static void registerParticle(ParticleType type, ParticleFactory factory) { + ParticleProviderRegistry.register(type, factory); + } + + public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { + ParticleProviderRegistry.register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { + @Override + public SpriteAtlasTexture getAtlas() { + return spriteSet.getAtlas(); + } + + @Override + public List getSprites() { + return spriteSet.getSprites(); + } + + @Override + public Sprite getSprite(int age, int maxAge) { + return spriteSet.getSprite(age, maxAge); + } + + @Override + public Sprite getSprite(Random random) { + return spriteSet.getSprite(random); + } + + @Override + public Sprite getFirst() { + return spriteSet.getFirst(); + } + })); + } + + public static void registerEntityRenderer(Supplier> type, EntityRendererFactory provider) { + EntityRendererRegistry.register(type, provider); + } + + @FunctionalInterface + public interface DeferredParticleProvider { + ParticleFactory create(ExtendedSpriteSet spriteSet); + } + + public interface ExtendedSpriteSet extends SpriteProvider { + SpriteAtlasTexture getAtlas(); + + List getSprites(); + } + + public static void registryClientSpriteAtlasTexture(Identifier identifier) { + //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, identifier); + } + + public static void registryClientSpriteAtlasTexture(Sprite sprite) { + //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, sprite); + } + + public static void registryClientSprite(Identifier atlasId, Identifier identifier) { + // ~1.19.2 + } + + public static void registryClientSprite(Identifier atlasId, Sprite sprite) { + // ~1.19.2 + } + + public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { + BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( + ctx.renderDispatcher(), ctx.renderManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer() + ))); + } + + @FunctionalInterface + public interface BlockEntityRendererFactory { + BlockEntityRenderer create(BlockEntityRendererFactory.Context ctx); + + class Context { + private final BlockEntityRenderManager renderDispatcher; + private final BlockRenderManager renderManager; + private final ItemRenderer itemRenderer; + private final EntityRenderManager entityRenderDispatcher; + private final LoadedEntityModels layerRenderDispatcher; + private final TextRenderer textRenderer; + + public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager renderManager, ItemRenderer itemRenderer, EntityRenderManager entityRenderDispatcher, LoadedEntityModels layerRenderDispatcher, TextRenderer textRenderer) { + this.renderDispatcher = renderDispatcher; + this.renderManager = renderManager; + this.itemRenderer = itemRenderer; + this.entityRenderDispatcher = entityRenderDispatcher; + this.layerRenderDispatcher = layerRenderDispatcher; + this.textRenderer = textRenderer; + } + + public BlockEntityRenderManager getRenderDispatcher() { + return this.renderDispatcher; + } + + public BlockRenderManager getRenderManager() { + return this.renderManager; + } + + public EntityRenderManager getEntityRenderDispatcher() { + return this.entityRenderDispatcher; + } + + public ItemRenderer getItemRenderer() { + return this.itemRenderer; + } + + public LoadedEntityModels getLayerRenderDispatcher() { + return this.layerRenderDispatcher; + } + + public ModelPart getLayerModelPart(EntityModelLayer modelLayer) { + return this.layerRenderDispatcher.getModelPart(modelLayer); + } + + public TextRenderer getTextRenderer() { + return this.textRenderer; + } + } + } + + + public static void registerRenderTypeBlock(RenderLayer layer, Block block) { + CompatRegistryClient.registerRenderTypeBlock(layer, block); + } + + public static void registerRenderTypeFluid(RenderLayer layer, Fluid fluid) { + CompatRegistryClient.registerRenderTypeFluid(layer, fluid); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java new file mode 100644 index 000000000..243edd0af --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java @@ -0,0 +1,281 @@ +package net.pitan76.mcpitanlib.api.client.registry; + +import dev.architectury.injectables.annotations.ExpectPlatform; +import dev.architectury.registry.client.gui.MenuScreenRegistry; +import dev.architectury.registry.client.level.entity.EntityModelLayerRegistry; +import dev.architectury.registry.client.level.entity.EntityRendererRegistry; +import dev.architectury.registry.client.particle.ParticleProviderRegistry; +import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry; +import dev.architectury.registry.client.rendering.RenderTypeRegistry; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.client.color.block.BlockColorProvider; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; +import net.minecraft.client.item.ItemModelManager; +import net.minecraft.client.model.ModelPart; +import net.minecraft.client.model.TexturedModelData; +import net.minecraft.client.particle.ParticleFactory; +import net.minecraft.client.particle.SpriteProvider; +import net.minecraft.client.render.BlockRenderLayer; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.RenderLayers; +import net.minecraft.client.render.block.BlockRenderManager; +import net.minecraft.client.render.block.entity.BlockEntityRenderManager; +import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; +import net.minecraft.client.render.entity.EntityRenderManager; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.render.entity.model.EntityModelLayer; +import net.minecraft.client.render.entity.model.LoadedEntityModels; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.texture.PlayerSkinCache; +import net.minecraft.client.texture.Sprite; +import net.minecraft.client.texture.SpriteAtlasTexture; +import net.minecraft.client.texture.SpriteHolder; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.fluid.Fluid; +import net.minecraft.particle.ParticleEffect; +import net.minecraft.particle.ParticleType; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.minecraft.util.math.random.Random; +import net.pitan76.mcpitanlib.MCPitanLib; +import net.pitan76.mcpitanlib.api.client.color.CompatBlockColorProvider; +import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; +import net.pitan76.mcpitanlib.api.client.render.EntityModelLayerContext; + +import java.util.List; +import java.util.function.Supplier; + +@Environment(EnvType.CLIENT) +public class CompatRegistryClient { + public static > void registerScreen(ScreenHandlerType type, ScreenFactory factory) { + registerScreen(MCPitanLib.MOD_ID, type, factory); + } + + public static > void registerScreen(String modId, ScreenHandlerType type, ScreenFactory factory) { + MenuScreenRegistry.registerScreenFactory(type, factory::create); + } + + public interface ScreenFactory> { + S create(H handler, PlayerInventory inventory, Text text); + } + + public static void registerParticle(ParticleType type, ParticleFactory factory) { + ParticleProviderRegistry.register(type, factory); + } + + public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { + ParticleProviderRegistry.register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { + @Override + public SpriteAtlasTexture getAtlas() { + return spriteSet.getAtlas(); + } + + @Override + public List getSprites() { + return spriteSet.getSprites(); + } + + @Override + public Sprite getSprite(int age, int maxAge) { + return spriteSet.getSprite(age, maxAge); + } + + @Override + public Sprite getSprite(Random random) { + return spriteSet.getSprite(random); + } + + @Override + public Sprite getFirst() { + return spriteSet.getFirst(); + } + })); + } + + public static void registerEntityModelLayer(EntityModelLayer layer, EntityModelLayerContext context) { + EntityModelLayerRegistry.register(layer, () -> TexturedModelData.of(context.getData(), context.getWidth(), context.getHeight())); + } + + public static void registerEntityRenderer(Supplier> type, EntityRendererFactory provider) { + EntityRendererRegistry.register(type, provider); + } + + @FunctionalInterface + public interface DeferredParticleProvider { + ParticleFactory create(ExtendedSpriteSet spriteSet); + } + + public interface ExtendedSpriteSet extends SpriteProvider { + SpriteAtlasTexture getAtlas(); + + List getSprites(); + } + + public static void registryClientSpriteAtlasTexture(Identifier identifier) { + //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, identifier); + } + + public static void registryClientSpriteAtlasTexture(Sprite sprite) { + //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, sprite); + } + + public static void registryClientSprite(Identifier atlasId, Identifier identifier) { + // ~1.19.2 + } + + public static void registryClientSprite(Identifier atlasId, Sprite sprite) { + // ~1.19.2 + } + + public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { + BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( + ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache() + ))); + } + + @FunctionalInterface + public interface BlockEntityRendererFactory { + BlockEntityRenderer create(Context ctx); + + class Context { + private final BlockEntityRenderManager renderDispatcher; + private final BlockRenderManager renderManager; + private final ItemModelManager itemModelManager; + private final ItemRenderer itemRenderer; + private final EntityRenderManager entityRenderDispatcher; + private final LoadedEntityModels layerRenderDispatcher; + private final TextRenderer textRenderer; + private final SpriteHolder spriteHolder; + + private final PlayerSkinCache playerSkinRenderCache; + + public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager renderManager, ItemModelManager itemModelManager, ItemRenderer itemRenderer, EntityRenderManager entityRenderDispatcher, LoadedEntityModels layerRenderDispatcher, TextRenderer textRenderer, SpriteHolder spriteHolder, PlayerSkinCache playerSkinRenderCache) { + this.renderDispatcher = renderDispatcher; + this.renderManager = renderManager; + this.itemModelManager = itemModelManager; + this.itemRenderer = itemRenderer; + this.entityRenderDispatcher = entityRenderDispatcher; + this.layerRenderDispatcher = layerRenderDispatcher; + this.textRenderer = textRenderer; + this.spriteHolder = spriteHolder; + this.playerSkinRenderCache = playerSkinRenderCache; + } + + public BlockEntityRenderManager getRenderDispatcher() { + return this.renderDispatcher; + } + + public BlockRenderManager getRenderManager() { + return this.renderManager; + } + + public EntityRenderManager getEntityRenderDispatcher() { + return this.entityRenderDispatcher; + } + + public ItemModelManager getItemModelManager() { + return itemModelManager; + } + + public ItemRenderer getItemRenderer() { + return this.itemRenderer; + } + + public LoadedEntityModels getLayerRenderDispatcher() { + return this.layerRenderDispatcher; + } + + public ModelPart getLayerModelPart(EntityModelLayer modelLayer) { + return this.layerRenderDispatcher.getModelPart(modelLayer); + } + + public TextRenderer getTextRenderer() { + return this.textRenderer; + } + + public SpriteHolder getSpriteHolder() { + return spriteHolder; + } + + public PlayerSkinCache getPlayerSkinRenderCache() { + return playerSkinRenderCache; + } + } + } + + + public static void registerRenderTypeBlock(RenderLayer layer, Block block) { + BlockRenderLayer blockRenderLayer = null; + if (layer == RenderLayers.cutout()) { + blockRenderLayer = BlockRenderLayer.CUTOUT; + } else if (layer == RenderLayers.glintTranslucent()) { + blockRenderLayer = BlockRenderLayer.TRANSLUCENT; + } else if (layer == RenderLayers.solid()) { + blockRenderLayer = BlockRenderLayer.SOLID; + } else if (layer == RenderLayers.tripwire()) { + blockRenderLayer = BlockRenderLayer.TRIPWIRE; + } + + if (blockRenderLayer == null) return; + + RenderTypeRegistry.register(blockRenderLayer, block); + } + + public static void registerRenderTypeFluid(RenderLayer layer, Fluid fluid) { + BlockRenderLayer blockRenderLayer = null; + if (layer == RenderLayers.cutout()) { + blockRenderLayer = BlockRenderLayer.CUTOUT; + } else if (layer == RenderLayers.glintTranslucent()) { + blockRenderLayer = BlockRenderLayer.TRANSLUCENT; + } else if (layer == RenderLayers.solid()) { + blockRenderLayer = BlockRenderLayer.SOLID; + } else if (layer == RenderLayers.tripwire()) { + blockRenderLayer = BlockRenderLayer.TRIPWIRE; + } + + if (blockRenderLayer == null) return; + + RenderTypeRegistry.register(blockRenderLayer, fluid); + } + + public static void registerCutoutBlock(Block block) { + registerRenderTypeBlock(RenderLayers.cutout(), block); + } + + public static void registerCompatBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { + BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( + ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache() + ))); + } + + public static void registerRenderTypeBlock(CompatRenderLayer layer, Block block) { + registerRenderTypeBlock(layer.layer, block); + } + + public static void registerRenderTypeFluid(CompatRenderLayer layer, Fluid fluid) { + registerRenderTypeFluid(layer.layer, fluid); + } + + public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { + if (blocks == null || blocks.length == 0) { + ColorProviderRegistry.BLOCK.register(provider); + } else { + ColorProviderRegistry.BLOCK.register(provider, blocks); + } + } + + public static void registerColorProviderBlock(CompatBlockColorProvider provider, Block... blocks) { + registerColorProviderBlock((BlockColorProvider) provider, blocks); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java new file mode 100644 index 000000000..7fa99982f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java @@ -0,0 +1,13 @@ +package net.pitan76.mcpitanlib.api.client.registry; + +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.FlyingItemEntityRenderer; +import net.minecraft.entity.EntityType; + +import java.util.function.Supplier; + +public class EntityRendererRegistry { + public static void registerEntityRendererAsFlyingItem(Supplier> entityType) { + CompatRegistryClient.registerEntityRenderer(entityType, (ctx -> (EntityRenderer) new FlyingItemEntityRenderer<>(ctx))); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java new file mode 100644 index 000000000..1c081c238 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.client.registry; + +import dev.architectury.registry.client.keymappings.KeyMappingRegistry; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; +import net.pitan76.mcpitanlib.api.network.ClientNetworking; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; + +public class KeybindingRegistry { + public static void register(KeyBinding keyBinding) { + KeyMappingRegistry.register(keyBinding); + } + + public static void register(KeyBinding keyBinding, ClientTickEventRegistry.Client client) { + register(keyBinding); + ClientTickEventRegistry.registerPost(client); + } + + public static void registerOnLevel(KeyBinding keyBinding, ClientTickEventRegistry.ClientLevel level) { + register(keyBinding); + ClientTickEventRegistry.registerLevelPost(level); + } + + public static void registerWithNetwork(KeyBinding keyBinding, Identifier identifier) { + register(keyBinding, client -> { + if (keyBinding.wasPressed()) + ClientNetworking.send(identifier, PacketByteUtil.create()); + }); + } + + public static void registerOnLevelWithNetwork(KeyBinding keyBinding, Identifier identifier) { + registerOnLevel(keyBinding, client -> { + if (keyBinding.wasPressed()) + ClientNetworking.send(identifier, PacketByteUtil.create()); + }); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java new file mode 100644 index 000000000..e1c746e02 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java @@ -0,0 +1,24 @@ +package net.pitan76.mcpitanlib.api.client.registry.v2; + +import net.minecraft.client.option.KeyBinding; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class KeybindingRegistry extends net.pitan76.mcpitanlib.api.client.registry.KeybindingRegistry { + + public static void registerWithNetwork(KeyBinding keyBinding, CompatIdentifier identifier) { + registerWithNetwork(keyBinding, identifier.toMinecraft()); + } + + public static void registerOnLevelWithNetwork(KeyBinding keyBinding, CompatIdentifier identifier) { + registerOnLevelWithNetwork(keyBinding, identifier.toMinecraft()); + } + + public static void registerWithNetwork(String translationKey, int code, String category, CompatIdentifier identifier) { + registerWithNetwork(new KeyBinding(translationKey, code, KeyBinding.Category.create(CompatIdentifier.of(category).toMinecraft())), identifier); + } + + public static void registerOnLevelWithNetwork(String translationKey, int code, String category, CompatIdentifier identifier) { + // TODO: categoryの互換性 + registerOnLevelWithNetwork(new KeyBinding(translationKey, code, KeyBinding.Category.create(CompatIdentifier.of(category).toMinecraft())), identifier); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java new file mode 100644 index 000000000..91f382b28 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java @@ -0,0 +1,37 @@ +package net.pitan76.mcpitanlib.api.client.registry.v3; + +import net.pitan76.mcpitanlib.api.client.option.CompatKeyBinding; +import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class KeybindingRegistry { + public static void registerWithNetwork(CompatKeyBinding keyBinding, CompatIdentifier networkId) { + net.pitan76.mcpitanlib.api.client.registry.v2.KeybindingRegistry.registerWithNetwork(keyBinding.toMinecraft(), networkId.toMinecraft()); + } + + public static void registerOnLevelWithNetwork(CompatKeyBinding keyBinding, CompatIdentifier networkId) { + net.pitan76.mcpitanlib.api.client.registry.v2.KeybindingRegistry.registerOnLevelWithNetwork(keyBinding.toMinecraft(), networkId.toMinecraft()); + } + + public static void registerWithNetwork(String translationKey, int code, CompatIdentifier category, CompatIdentifier networkId) { + registerWithNetwork(CompatKeyBinding.of(translationKey, code, category), networkId); + } + + public static void registerOnLevelWithNetwork(String translationKey, int code, CompatIdentifier category, CompatIdentifier networkId) { + registerOnLevelWithNetwork(CompatKeyBinding.of(translationKey, code, category), networkId); + } + + public static void register(CompatKeyBinding keyBinding) { + net.pitan76.mcpitanlib.api.client.registry.KeybindingRegistry.register(keyBinding.toMinecraft()); + } + + public static void register(CompatKeyBinding keyBinding, ClientTickEventRegistry.Client client) { + register(keyBinding); + ClientTickEventRegistry.registerPost(client); + } + + public static void registerOnLevel(CompatKeyBinding keyBinding, ClientTickEventRegistry.ClientLevel level) { + register(keyBinding); + ClientTickEventRegistry.registerLevelPost(level); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java new file mode 100644 index 000000000..6961e1ffd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.api.client.render; + +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.RenderLayers; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatRenderLayer { + public static final CompatRenderLayer CUTOUT = new CompatRenderLayer(RenderLayers.cutout()); + public static final CompatRenderLayer CUTOUT_MIPPED = new CompatRenderLayer(RenderLayers.cutout()); + public static final CompatRenderLayer TRANSLUCENT = new CompatRenderLayer(RenderLayers.glintTranslucent()); + public static final CompatRenderLayer TRANSLUCENT_MOVING_BLOCK = new CompatRenderLayer(RenderLayers.translucentMovingBlock()); + public static final CompatRenderLayer SOLID = new CompatRenderLayer(RenderLayers.solid()); + public static final CompatRenderLayer LINES = new CompatRenderLayer(RenderLayers.lines()); + public static final CompatRenderLayer LINE_STRIP = new CompatRenderLayer(RenderLayers.linesTranslucent()); + public static final CompatRenderLayer GLINT = new CompatRenderLayer(RenderLayers.glint()); + + public final RenderLayer layer; + + public CompatRenderLayer(RenderLayer layer) { + this.layer = layer; + } + + public RenderLayer raw() { + return layer; + } + + public static CompatRenderLayer getEntityCutout(CompatIdentifier id) { + return new CompatRenderLayer(RenderLayers.entityCutout(id.toMinecraft())); + } + + public static CompatRenderLayer getEntityCutoutNoCull(CompatIdentifier id) { + return new CompatRenderLayer(RenderLayers.entityCutoutNoCull(id.toMinecraft())); + } + + public static CompatRenderLayer getEntityTranslucent(CompatIdentifier id) { + return new CompatRenderLayer(RenderLayers.entityTranslucent(id.toMinecraft())); + } + + public static CompatRenderLayer getArmorCutoutNoCull(CompatIdentifier id) { + return new CompatRenderLayer(RenderLayers.armorCutoutNoCull(id.toMinecraft())); + } + + public static CompatRenderLayer getEntitySolid(CompatIdentifier id) { + return new CompatRenderLayer(RenderLayers.entitySolid(id.toMinecraft())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java new file mode 100644 index 000000000..e262ba0a3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java @@ -0,0 +1,101 @@ +package net.pitan76.mcpitanlib.api.client.render; + +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; +import org.joml.Matrix3x2f; +import org.joml.Matrix3x2fStack; + +public class DrawObjectDM { + private MatrixStack stack; + private Matrix3x2fStack matrix3x2fStack; + private DrawContext context; + + private Screen screen = null; + + public DrawObjectDM(DrawContext context) { + this.context = context; + this.matrix3x2fStack = context.getMatrices(); + } + + public DrawObjectDM(Matrix3x2fStack matrix3x2fStack) { + this.matrix3x2fStack = matrix3x2fStack; + } + + public DrawObjectDM(MatrixStack stack) { + this.stack = stack; + } + + public DrawObjectDM(DrawContext context, Screen screen) { + this(context); + this.screen = screen; + } + + public DrawContext getContext() { + return context; + } + + public MatrixStack getStack() { + return stack; + } + + public Screen getScreen() { + return screen; + } + + public void setContext(DrawContext context) { + this.context = context; + } + + public void setStack(MatrixStack stack) { + this.stack = stack; + } + + public void setScreen(Screen screen) { + this.screen = screen; + } + + public boolean hasScreen() { + return screen != null; + } + + public void drawTexture(CompatIdentifier texture, int x, int y, float u, float v, int width, int height) { + RendererUtil.drawTexture(this, texture, x, y, u, v, width, height); + } + + public void drawTexture(CompatIdentifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + RendererUtil.drawTexture(this, texture, x, y, u, v, width, height, textureWidth, textureHeight); + } + + public void drawText(Text text, int x, int y) { + RendererUtil.drawText(RendererUtil.getTextRenderer(), this, text, x, y); + } + + public void drawTooltip(Text text, int x, int y) { + RendererUtil.drawTooltip(this, text, x, y); + } + + public void drawText(TextComponent text, int x, int y) { + RendererUtil.drawText(RendererUtil.getTextRenderer(), this, text, x, y); + } + + public void drawTooltip(TextComponent text, int x, int y) { + RendererUtil.drawTooltip(this, text, x, y); + } + + public void drawBorder(int x, int y, int width, int height, int color) { + RendererUtil.drawBorder(this, x, y, width, height, color); + } + + public int getWidth() { + return hasScreen() ? screen.width : -1; + } + + public int getHeight() { + return hasScreen() ? screen.height : -1; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java new file mode 100644 index 000000000..37e2df47d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java @@ -0,0 +1,119 @@ +package net.pitan76.mcpitanlib.api.client.render; + +import net.minecraft.client.render.OverlayTexture; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.util.math.MatrixStack; +import net.pitan76.mcpitanlib.api.util.client.render.VertexConsumerUtil; +import org.joml.Matrix3f; +import org.joml.Matrix4f; + +public class DrawObjectMV { + private final MatrixStack stack; + private final VertexConsumer buffer; + + public DrawObjectMV(MatrixStack stack, VertexConsumer buffer) { + this.stack = stack; + this.buffer = buffer; + } + + public DrawObjectMV(MatrixStack stack) { + this(stack, null); + } + + public DrawObjectMV(VertexConsumer buffer) { + this(null, buffer); + } + + public MatrixStack getStack() { + return stack; + } + + public VertexConsumer getBuffer() { + return buffer; + } + + public DrawObjectMV vertex(float x, float y, float z) { + return VertexConsumerUtil.vertex(this, x, y, z); + } + + public DrawObjectMV normal(float x, float y, float z) { + return VertexConsumerUtil.normal(this, x, y, z); + } + + public DrawObjectMV color(float red, float green, float blue, float alpha) { + return VertexConsumerUtil.color(this, red, green, blue, alpha); + } + + public DrawObjectMV color(int red, int green, int blue, int alpha) { + return VertexConsumerUtil.color(this, red, green, blue, alpha); + } + + public DrawObjectMV colorARGB(int argb) { + return VertexConsumerUtil.colorARGB(this, argb); + } + + public DrawObjectMV colorRGB(int rgb) { + return VertexConsumerUtil.colorRGB(this, rgb); + } + + public DrawObjectMV light(int light) { + return VertexConsumerUtil.light(this, light); + } + + public DrawObjectMV overlay(int overlay) { + return VertexConsumerUtil.overlay(this, overlay); + } + + public DrawObjectMV overlayDefaultUV() { + return VertexConsumerUtil.overlayDefaultUV(this); + } + + public Matrix4f matrix4f; + public Matrix3f matrix3f; + + public Matrix4f getMatrix4f() { + if (matrix4f == null) + matrix4f = stack.peek().getPositionMatrix(); + + return matrix4f; + } + + public Matrix3f getMatrix3f() { + if (matrix3f == null) + matrix3f = stack.peek().getNormalMatrix(); + + return matrix3f; + } + + public DrawObjectMV vertexWithMatrix4f(float x, float y, float z) { + VertexConsumerUtil.vertex(buffer, getMatrix4f(), x, y, z); + return this; + } + + public DrawObjectMV vertexWithMatrix(float x, float y, float z) { + VertexConsumerUtil.vertex(buffer, stack, x, y, z); + return this; + } + + public DrawObjectMV normalWithMatrix(float x, float y, float z) { + VertexConsumerUtil.normal(buffer, stack, x, y, z); + return this; + } + + public DrawObjectMV texture(float u, float v) { + VertexConsumerUtil.texture(buffer, u, v); + return this; + } + + public DrawObjectMV next() { + VertexConsumerUtil.next(buffer); + return this; + } + + public void renderQuad(float x1, float y1, float z1, float x2, float y2, float z2, + float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + VertexConsumerUtil.renderQuad(buffer, stack, getMatrix4f(), getMatrix3f(), + x1, y1, z1, x2, y2, z2, + normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java new file mode 100644 index 000000000..d1d343924 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.client.render; + +import net.minecraft.client.model.ModelData; + +public class EntityModelLayerContext { + private final ModelData data; + private final int width; + private final int height; + + public EntityModelLayerContext(ModelData data, int width, int height) { + this.data = data; + this.width = width; + this.height = height; + } + + public int getHeight() { + return height; + } + + public int getWidth() { + return width; + } + + public ModelData getData() { + return data; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java new file mode 100644 index 000000000..7e70f8046 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java @@ -0,0 +1,45 @@ +package net.pitan76.mcpitanlib.api.client.render.block.entity; + +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; +import net.minecraft.client.render.command.OrderedRenderCommandQueue; +import net.minecraft.client.render.state.CameraRenderState; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.Vec3d; +import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; + +@Deprecated +public interface CompatBlockEntityRenderer extends BlockEntityRenderer { + void render(BlockEntityRenderEvent event); + + default void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { + render(new BlockEntityRenderEvent<>(this, entity, tickProgress, matrices, vertexConsumers, light, overlay)); + } + + @Override + default void render(S state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { + render(new BlockEntityRenderEvent<>(this, state, matrices, queue, cameraState)); + } + + default boolean rendersOutsideBoundingBoxOverride(T blockEntity) { + return BlockEntityRenderer.super.rendersOutsideBoundingBox(); + } + + default int getRenderDistanceOverride() { + return BlockEntityRenderer.super.getRenderDistance(); + } + + @Deprecated + @Override + default boolean rendersOutsideBoundingBox() { + return rendersOutsideBoundingBoxOverride(null); + } + + @Deprecated + @Override + default int getRenderDistance() { + return getRenderDistanceOverride(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java new file mode 100644 index 000000000..67ed76f71 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java @@ -0,0 +1,200 @@ +package net.pitan76.mcpitanlib.api.client.render.block.entity.event; + +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.BlockRenderLayer; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; +import net.minecraft.client.render.command.OrderedRenderCommandQueue; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.state.CameraRenderState; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; +import net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.api.util.MathUtil; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import net.pitan76.mcpitanlib.api.util.client.MatrixStackUtil; +import net.pitan76.mcpitanlib.api.util.client.render.CompatItemRenderUtil; +import org.joml.Matrix3f; +import org.joml.Matrix4f; + +public class BlockEntityRenderEvent { + public T blockEntity; + public float tickDelta; + public MatrixStack matrices; + public VertexConsumerProvider vertexConsumers; + int light; + int overlay; + + public BlockEntityRenderEvent(T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { + this.blockEntity = blockEntity; + this.tickDelta = tickDelta; + this.matrices = matrices; + this.vertexConsumers = vertexConsumers; + this.light = light; + this.overlay = overlay; + } + + private BlockEntityRenderState state; + private OrderedRenderCommandQueue queue; + private CameraRenderState cameraState; + + + public BlockEntityRenderEvent(S state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { + this.state = state; + this.queue = queue; + this.cameraState = cameraState; + + this.matrices = matrices; + this.queue = queue; + this.cameraState = cameraState; + this.tickDelta = MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); + BlockEntity blockEntity = state.type.get(MinecraftClient.getInstance().world, state.pos); + if (blockEntity instanceof CompatBlockEntity) { + this.blockEntity = (T) blockEntity; + } else { + //throw new IllegalArgumentException("BlockEntityRenderEvent: BlockEntity is not an instance of CompatBlockEntity"); + } + + this.vertexConsumers = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers(); + this.light = state.lightmapCoordinates; + if (state.crumblingOverlay != null) + this.overlay = state.crumblingOverlay.progress(); + else + this.overlay = 0; + } + + public T getBlockEntity() { + return blockEntity; + } + + public MatrixStack getMatrices() { + return matrices; + } + + public float getTickDelta() { + return tickDelta; + } + + public int getLight() { + return light; + } + + public int getOverlay() { + return overlay; + } + + public VertexConsumer getVertexConsumer(RenderLayer layer) { + return vertexConsumers.getBuffer(layer); + } + + public VertexConsumer getVertexConsumer(CompatRenderLayer layer) { + return getVertexConsumer(layer.raw()); + } + + public VertexConsumerProvider getVertexConsumers() { + return vertexConsumers; + } + + public void push() { + MatrixStackUtil.push(matrices); + } + + public void translate(double x, double y, double z) { + MatrixStackUtil.translate(matrices, x, y, z); + } + + public void pop() { + MatrixStackUtil.pop(matrices); + } + + public void multiply(MathUtil.RotationAxisType type, float deg) { + MatrixStackUtil.multiply(matrices, type, deg); + } + + public void scale(float x, float y, float z) { + MatrixStackUtil.scale(matrices, x, y, z); + } + + public ItemRenderer getItemRenderer() { + return ClientUtil.getItemRenderer(); + } + + public boolean isRemoved() { + return blockEntity.isRemoved(); + } + + public DrawObjectMV getDrawObject(CompatRenderLayer layer) { + return new DrawObjectMV(getMatrices(), getVertexConsumer(layer)); + } + + public Matrix4f matrix4f; + public Matrix3f matrix3f; + + public Matrix4f getMatrix4f() { + if (matrix4f == null) + matrix4f = matrices.peek().getPositionMatrix(); + + return matrix4f; + } + + public Matrix3f getMatrix3f() { + if (matrix3f == null) + matrix3f = matrices.peek().getNormalMatrix(); + + return matrix3f; + } + + public BlockPos getPos() { + return state.pos; + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getPos()); + } + + //---- + + @Deprecated + public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; + + public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { + this(blockEntity, tickDelta, matrices, vertexConsumers, light, overlay); + if (renderer instanceof net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) { + this.ctx = ((net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) renderer).ctx; + } + } + + public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, BlockEntityRenderState state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { + this(state, matrices, queue, cameraState); + if (renderer instanceof net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) { + this.ctx = ((net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) renderer).ctx; + } + } + + public void renderItemFixed(ItemStack stack) { + CompatItemRenderUtil.renderItemFixed(stack, this, blockEntity.callGetWorld()); + } + + @Deprecated + public OrderedRenderCommandQueue getQueue() { + return queue; + } + + @Deprecated + public BlockEntityRenderState getState() { + return state; + } + + @Deprecated + public CameraRenderState getCameraState() { + return cameraState; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java new file mode 100644 index 000000000..8af118910 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.client.render.block.entity.event; + +import net.minecraft.client.render.block.entity.BlockEntityRenderManager; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; + +public class CompatBlockEntityRendererConstructArgs { + public final BlockEntityRenderManager dispatcher; + + public CompatBlockEntityRendererConstructArgs(BlockEntityRenderManager dispatcher) { + this.dispatcher = dispatcher; + } + + public CompatBlockEntityRendererConstructArgs() { + this(ClientUtil.getClient().getBlockEntityRenderDispatcher()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java new file mode 100644 index 000000000..c28f891a7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.client.render.block.entity.v2; + +import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.api.client.render.block.entity.event.CompatBlockEntityRendererConstructArgs; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; + +public abstract class CompatBlockEntityRenderer implements net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer { + + @Deprecated + public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; + + public CompatBlockEntityRenderer(CompatBlockEntityRendererConstructArgs args) { + + } + + public CompatBlockEntityRenderer(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { + this.ctx = ctx; + } + + @Override + public BlockEntityRenderState createRenderState() { + return new BlockEntityRenderState(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java new file mode 100644 index 000000000..4c0a4ab27 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; + +public class DrawBackgroundArgs { + public DrawObjectDM drawObjectDM; + public float delta; + public int mouseX, mouseY; + + public DrawBackgroundArgs(DrawObjectDM drawObjectDM, float delta, int mouseX, int mouseY) { + setDrawObjectDM(drawObjectDM); + setDelta(delta); + setMouseX(mouseX); + setMouseY(mouseY); + } + + public void setDrawObjectDM(DrawObjectDM drawObjectDM) { + this.drawObjectDM = drawObjectDM; + } + + public void setDelta(float delta) { + this.delta = delta; + } + + public void setMouseX(int mouseX) { + this.mouseX = mouseX; + } + + public void setMouseY(int mouseY) { + this.mouseY = mouseY; + } + + public DrawObjectDM getDrawObjectDM() { + return drawObjectDM; + } + + public float getDelta() { + return delta; + } + + public int getMouseX() { + return mouseX; + } + + public int getMouseY() { + return mouseY; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java new file mode 100644 index 000000000..643a5bf80 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; + +public class DrawForegroundArgs { + public DrawObjectDM drawObjectDM; + public int mouseX, mouseY; + + public DrawForegroundArgs(DrawObjectDM drawObjectDM, int mouseX, int mouseY) { + setDrawObjectDM(drawObjectDM); + setMouseX(mouseX); + setMouseY(mouseY); + } + + public void setDrawObjectDM(DrawObjectDM drawObjectDM) { + this.drawObjectDM = drawObjectDM; + } + + public void setMouseX(int mouseX) { + this.mouseX = mouseX; + } + + public void setMouseY(int mouseY) { + this.mouseY = mouseY; + } + + public DrawObjectDM getDrawObjectDM() { + return drawObjectDM; + } + + public int getMouseX() { + return mouseX; + } + + public int getMouseY() { + return mouseY; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java new file mode 100644 index 000000000..652c5ed68 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; + +public class DrawMouseoverTooltipArgs { + public DrawObjectDM drawObjectDM; + public int mouseX, mouseY; + + public DrawMouseoverTooltipArgs(DrawObjectDM drawObjectDM, int mouseX, int mouseY) { + setDrawObjectDM(drawObjectDM); + setMouseX(mouseX); + setMouseY(mouseY); + } + + public void setDrawObjectDM(DrawObjectDM drawObjectDM) { + this.drawObjectDM = drawObjectDM; + } + + public void setMouseX(int mouseX) { + this.mouseX = mouseX; + } + + public void setMouseY(int mouseY) { + this.mouseY = mouseY; + } + + public DrawObjectDM getDrawObjectDM() { + return drawObjectDM; + } + + public int getMouseX() { + return mouseX; + } + + public int getMouseY() { + return mouseY; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java new file mode 100644 index 000000000..45c4ceeed --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +public class KeyEventArgs { + public int keyCode, scanCode, modifiers; + + public KeyEventArgs(int keyCode, int scanCode, int modifiers) { + setKeyCode(keyCode); + setScanCode(scanCode); + setModifiers(modifiers); + } + + public void setKeyCode(int keyCode) { + this.keyCode = keyCode; + } + + public void setModifiers(int modifiers) { + this.modifiers = modifiers; + } + + public void setScanCode(int scanCode) { + this.scanCode = scanCode; + } + + public int getKeyCode() { + return keyCode; + } + + public int getModifiers() { + return modifiers; + } + + public int getScanCode() { + return scanCode; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java new file mode 100644 index 000000000..8b4905d78 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; + +public class RenderArgs { + public DrawObjectDM drawObjectDM; + public float delta; + public int mouseX, mouseY; + + public RenderArgs(DrawObjectDM drawObjectDM, int mouseX, int mouseY, float delta) { + setDrawObjectDM(drawObjectDM); + setDelta(delta); + setMouseX(mouseX); + setMouseY(mouseY); + } + + public void setDrawObjectDM(DrawObjectDM drawObjectDM) { + this.drawObjectDM = drawObjectDM; + } + + public void setDelta(float delta) { + this.delta = delta; + } + + public void setMouseX(int mouseX) { + this.mouseX = mouseX; + } + + public void setMouseY(int mouseY) { + this.mouseY = mouseY; + } + + public DrawObjectDM getDrawObjectDM() { + return drawObjectDM; + } + + public float getDelta() { + return delta; + } + + public int getMouseX() { + return mouseX; + } + + public int getMouseY() { + return mouseY; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java new file mode 100644 index 000000000..610b56280 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.client.render.screen; + +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; + +public class RenderBackgroundTextureArgs { + public DrawObjectDM drawObjectDM; + int vOffset; + + public RenderBackgroundTextureArgs(DrawObjectDM drawObjectDM, int vOffset) { + this.drawObjectDM = drawObjectDM; + this.vOffset = vOffset; + } + + public RenderBackgroundTextureArgs(RenderArgs args) { + this(args.drawObjectDM, 0); + } + + public DrawObjectDM getDrawObjectDM() { + return drawObjectDM; + } + + public int getvOffset() { + return vOffset; + } + + public void setDrawObjectDM(DrawObjectDM drawObjectDM) { + this.drawObjectDM = drawObjectDM; + } + + public void setvOffset(int vOffset) { + this.vOffset = vOffset; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java new file mode 100644 index 000000000..5b2fbdf00 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.api.command; + +import net.pitan76.mcpitanlib.api.command.argument.RequiredCommand; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +import java.util.HashMap; +import java.util.Map; + +public abstract class AbstractCommand { + + private Map> argumentCommands = new HashMap<>(); + public int isSuccess = 1; + + public void init() { + + } + + public void init(CommandSettings settings) { + init(); + } + + public void success() { + isSuccess = 1; + } + + public void failure() { + isSuccess = 0; + } + + public Map> getArgumentCommands() { + return argumentCommands; + } + + public void setArgumentCommands(Map> argumentCommands) { + this.argumentCommands = argumentCommands; + } + + public void addArgumentCommand(String name, AbstractCommand command) { + getArgumentCommands().put(name, command); + } + + public void addArgumentCommand(RequiredCommand command) { + getArgumentCommands().put(command.getArgumentName(), command); + } + + public abstract void execute(ServerCommandEvent event); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java new file mode 100644 index 000000000..03467b2a7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java @@ -0,0 +1,125 @@ +package net.pitan76.mcpitanlib.api.command; + +import com.mojang.brigadier.builder.ArgumentBuilder; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import dev.architectury.event.events.common.CommandRegistrationEvent; +import net.minecraft.command.CommandRegistryAccess; +import net.minecraft.server.command.CommandManager; +import net.minecraft.server.command.ServerCommandSource; +import net.pitan76.mcpitanlib.api.command.argument.*; +import net.pitan76.mcpitanlib.api.event.*; + +import java.util.Map; + +public class CommandRegistry { + + @Deprecated + public static CommandRegistryAccess latestCommandRegistryAccess; + + public static void register(String name, LiteralCommand command) { + CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { + latestCommandRegistryAccess = registry; + + CommandSettings settings = new CommandSettings(); + command.init(settings); + + LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(name).requires(settings::requires) + .executes(context -> { + ServerCommandEvent event = new ServerCommandEvent(); + event.setContext(context); + command.execute(event); + return command.isSuccess; + }); + + forArgsCmd(command, builder); + + //register(builder); + dispatcher.register(builder); + }); + } + + public static void register(LiteralArgumentBuilder builder) { + CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { + latestCommandRegistryAccess = registry; + dispatcher.register(builder); + } + ); + } + + private static > void forArgsCmd(AbstractCommand absCmd, ArgumentBuilder builder) { + + if (!absCmd.getArgumentCommands().isEmpty()) { + // 引数コマンド + for (Map.Entry> argCmd : absCmd.getArgumentCommands().entrySet()) { + ArgumentBuilder nextBuilder = null; + argCmd.getValue().init(new CommandSettings()); + + if (argCmd.getValue() instanceof LiteralCommand) { + LiteralCommand command = (LiteralCommand) argCmd.getValue(); + nextBuilder = CommandManager.literal(argCmd.getKey()) + .executes(context -> { + ServerCommandEvent event = new ServerCommandEvent(); + event.setContext(context); + event.setCommand(command); + command.execute(event); + return command.isSuccess; + } + ); + } + + if (argCmd.getValue() instanceof RequiredCommand) { + RequiredCommand command = (RequiredCommand) argCmd.getValue(); + + nextBuilder = CommandManager.argument(argCmd.getKey(), command.getArgumentType()) + .executes(context -> { + ServerCommandEvent event = new ServerCommandEvent(); + if (command instanceof IntegerCommand) { + event = new IntegerCommandEvent(); + } + if (command instanceof DoubleCommand) { + event = new DoubleCommandEvent(); + } + if (command instanceof FloatCommand) { + event = new FloatCommandEvent(); + } + if (command instanceof LongCommand) { + event = new LongCommandEvent(); + } + if (command instanceof BooleanCommand) { + event = new BooleanCommandEvent(); + } + if (command instanceof StringCommand) { + event = new StringCommandEvent(); + } + if (command instanceof EntityCommand) { + event = new EntityCommandEvent(); + } + if (command instanceof EntitiesCommand) { + event = new EntitiesCommandEvent(); + } + if (command instanceof PlayerCommand) { + event = new PlayerCommandEvent(); + } + if (command instanceof PlayersCommand) { + event = new PlayersCommandEvent(); + } + if (command instanceof ItemCommand) { + event = new ItemCommandEvent(); + } + if (command instanceof BlockCommand) { + event = new BlockCommandEvent(); + } + + event.setContext(context); + event.setCommand(command); + command.execute(event); + return command.isSuccess; + } + ); + } + forArgsCmd(argCmd.getValue(), nextBuilder); + builder.then(nextBuilder); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java new file mode 100644 index 000000000..724a3615a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java @@ -0,0 +1,43 @@ +package net.pitan76.mcpitanlib.api.command; + +import net.minecraft.command.permission.Permission; +import net.minecraft.command.permission.PermissionLevel; +import net.minecraft.server.command.ServerCommandSource; + +public class CommandSettings { + private int permissionLevel = -1; + private ICustom iCustom = null; + + private Permission.Level _level = null; + + public boolean requires(ServerCommandSource source) { + if (customRequires(source)) { + if (permissionLevel == -1) return true; + if (_level == null) + _level = new Permission.Level(PermissionLevel.fromLevel(permissionLevel)); + + return source.getPermissions().hasPermission(_level); + } + return false; + } + + private boolean customRequires(ServerCommandSource source) { + if (iCustom == null) return true; + return iCustom.custom(source); + } + + public CommandSettings permissionLevel(int level) { + this.permissionLevel = level; + return this; + } + + public CommandSettings custom(ICustom iCustom) { + this.iCustom = iCustom; + return this; + } + + @FunctionalInterface + public interface ICustom { + boolean custom(ServerCommandSource source); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java new file mode 100644 index 000000000..0c4a9fb54 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java @@ -0,0 +1,173 @@ +package net.pitan76.mcpitanlib.api.command; + +import com.mojang.brigadier.arguments.StringArgumentType; +import net.pitan76.easyapi.config.Config; +import net.pitan76.mcpitanlib.api.command.argument.StringCommand; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; +import net.pitan76.mcpitanlib.api.event.StringCommandEvent; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import org.jetbrains.annotations.Nullable; + +import java.io.File; +import java.util.function.Supplier; + +public class ConfigCommand extends LiteralCommand { + + public final Config config; + public File file; + public Supplier defaultConfigFunction; + public String prefix = "[MCPitanLib]"; + + public ConfigCommand(Config config, File file, String prefix) { + this.config = config; + this.file = file; + this.prefix = prefix; + } + + public ConfigCommand(Config config, File file, String prefix, @Nullable Supplier supplier) { + this.config = config; + this.file = file; + this.defaultConfigFunction = supplier; + this.prefix = prefix; + } + + public ConfigCommand(Config config, File file, @Nullable Supplier supplier) { + this.config = config; + this.file = file; + this.defaultConfigFunction = supplier; + } + + public ConfigCommand(Config config, File file) { + this.config = config; + this.file = file; + } + + public ConfigCommand(Config config) { + this.config = config; + } + + @Override + public void init(CommandSettings settings) { + settings.permissionLevel(3); + + addArgumentCommand("set", new LiteralCommand() { + @Override + public void init(CommandSettings settings) { + + addArgumentCommand("key", new StringCommand() { + @Override + public String getArgumentName() { + return "key"; + } + + + @Override + public void init(CommandSettings settings) { + + addArgumentCommand("value", new StringCommand() { + @Override + public String getArgumentName() { + return "value"; + } + + @Override + public void execute(StringCommandEvent event) { + String key = StringArgumentType.getString(event.context, "key"); + String value = StringArgumentType.getString(event.context, "value"); + if (config.get(key) == null) { + event.sendFailure(TextUtil.literal(prefix + " Key not found.")); + return; + } + if (config.get(key).getClass() == String.class) { + config.setString(key, value); + event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); + + } else if (config.get(key).getClass() == Integer.class) { + config.setInt(key, Integer.parseInt(value)); + event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); + + } else if (config.get(key).getClass() == Double.class) { + config.setDouble(key, Double.parseDouble(value)); + event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); + + } else if (config.get(key).getClass() == Boolean.class) { + config.setBoolean(key, Boolean.parseBoolean(value)); + event.sendSuccess(TextUtil.literal(prefix + " Set " + key + " to " + value), false); + + } else { + event.sendFailure(TextUtil.literal(prefix + " Not supported type.")); + } + if (file != null) + config.save(file); + } + }); + } + + @Override + public void execute(StringCommandEvent event) { + } + }); + } + + @Override + public void execute(ServerCommandEvent event) { + + } + }); + + addArgumentCommand("get", new LiteralCommand() { + @Override + public void init(CommandSettings settings) { + addArgumentCommand("key", new StringCommand() { + @Override + public String getArgumentName() { + return "key"; + } + + @Override + public void execute(StringCommandEvent event) { + String key = StringArgumentType.getString(event.context, "key"); + if (config.get(key) == null) { + event.sendFailure(TextUtil.literal(prefix + " Key not found.")); + return; + } + event.sendSuccess(TextUtil.literal(prefix + " " + key + ": " + config.get(key).toString()), false); + } + }); + } + + @Override + public void execute(ServerCommandEvent event) { + + } + }); + + addArgumentCommand("list", new LiteralCommand() { + @Override + public void execute(ServerCommandEvent event) { + event.sendSuccess(TextUtil.literal(prefix + " Config List"), false); + for (String key : config.configMap.keySet()) { + event.sendSuccess(TextUtil.literal(" - " + key + ": " + config.get(key).toString()), false); + } + } + }); + + if (defaultConfigFunction != null) { + addArgumentCommand("reset", new LiteralCommand() { + @Override + public void execute(ServerCommandEvent event) { + config.configMap.clear(); + defaultConfigFunction.get(); + if (file != null) + config.save(file); + event.sendSuccess(TextUtil.literal(prefix + " Reset config."), false); + } + }); + } + } + + @Override + public void execute(ServerCommandEvent event) { + + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java new file mode 100644 index 000000000..f382775a9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java @@ -0,0 +1,7 @@ +package net.pitan76.mcpitanlib.api.command; + +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class LiteralCommand extends AbstractCommand { + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java new file mode 100644 index 000000000..452c85dac --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import net.minecraft.block.Block; +import net.minecraft.command.argument.BlockStateArgumentType; +import net.pitan76.mcpitanlib.api.command.CommandRegistry; +import net.pitan76.mcpitanlib.api.event.BlockCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class BlockCommand extends RequiredCommand { + @Override + public BlockStateArgumentType getArgumentType() { + return BlockStateArgumentType.blockState(CommandRegistry.latestCommandRegistryAccess); + } + + public abstract void execute(BlockCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((BlockCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java new file mode 100644 index 000000000..32687d804 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.BoolArgumentType; +import net.pitan76.mcpitanlib.api.event.BooleanCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class BooleanCommand extends RequiredCommand { + @Override + public BoolArgumentType getArgumentType() { + return BoolArgumentType.bool(); + } + + public abstract void execute(BooleanCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((BooleanCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java new file mode 100644 index 000000000..b8ede9b0d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.DoubleArgumentType; +import net.pitan76.mcpitanlib.api.event.DoubleCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class DoubleCommand extends RequiredCommand { + @Override + public DoubleArgumentType getArgumentType() { + return DoubleArgumentType.doubleArg(); + } + + public abstract void execute(DoubleCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((DoubleCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java new file mode 100644 index 000000000..4157c76d3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java @@ -0,0 +1,20 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.event.EntitiesCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class EntitiesCommand extends RequiredCommand { + @Override + public EntityArgumentType getArgumentType() { + return EntityArgumentType.entities(); + } + + public abstract void execute(EntitiesCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((EntitiesCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java new file mode 100644 index 000000000..cf0c76ec6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java @@ -0,0 +1,20 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.event.EntityCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class EntityCommand extends RequiredCommand { + @Override + public EntityArgumentType getArgumentType() { + return EntityArgumentType.entity(); + } + + public abstract void execute(EntityCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((EntityCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java new file mode 100644 index 000000000..1b178e01b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.FloatArgumentType; +import net.pitan76.mcpitanlib.api.event.FloatCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class FloatCommand extends RequiredCommand { + @Override + public FloatArgumentType getArgumentType() { + return FloatArgumentType.floatArg(); + } + + public abstract void execute(FloatCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((FloatCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java new file mode 100644 index 000000000..afff6b7e8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.StringArgumentType; + +public abstract class GreedyStringCommand extends StringCommand { + @Override + public StringArgumentType getArgumentType() { + return StringArgumentType.greedyString(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java new file mode 100644 index 000000000..bfcdec912 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.IntegerArgumentType; +import net.pitan76.mcpitanlib.api.event.IntegerCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class IntegerCommand extends RequiredCommand { + @Override + public IntegerArgumentType getArgumentType() { + return IntegerArgumentType.integer(); + } + + public abstract void execute(IntegerCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((IntegerCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java new file mode 100644 index 000000000..2d24871bc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import net.minecraft.command.argument.ItemStackArgumentType; +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.command.CommandRegistry; +import net.pitan76.mcpitanlib.api.event.ItemCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class ItemCommand extends RequiredCommand { + @Override + public ItemStackArgumentType getArgumentType() { + return ItemStackArgumentType.itemStack(CommandRegistry.latestCommandRegistryAccess); + } + + public abstract void execute(ItemCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((ItemCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java new file mode 100644 index 000000000..45bd3b622 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.LongArgumentType; +import net.pitan76.mcpitanlib.api.event.LongCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class LongCommand extends RequiredCommand { + @Override + public LongArgumentType getArgumentType() { + return LongArgumentType.longArg(); + } + + public abstract void execute(LongCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((LongCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java new file mode 100644 index 000000000..3a674b908 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java @@ -0,0 +1,20 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.event.PlayerCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class PlayerCommand extends RequiredCommand { + @Override + public EntityArgumentType getArgumentType() { + return EntityArgumentType.player(); + } + + public abstract void execute(PlayerCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((PlayerCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java new file mode 100644 index 000000000..195d81d3b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java @@ -0,0 +1,20 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.event.PlayersCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public abstract class PlayersCommand extends RequiredCommand { + @Override + public EntityArgumentType getArgumentType() { + return EntityArgumentType.players(); + } + + public abstract void execute(PlayersCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((PlayersCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java new file mode 100644 index 000000000..a3428290f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.ArgumentType; +import net.pitan76.mcpitanlib.api.command.AbstractCommand; + +public abstract class RequiredCommand extends AbstractCommand { + public abstract String getArgumentName(); + + public abstract ArgumentType getArgumentType(); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java new file mode 100644 index 000000000..008bfefaf --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.command.argument; + +import com.mojang.brigadier.arguments.StringArgumentType; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; +import net.pitan76.mcpitanlib.api.event.StringCommandEvent; + +public abstract class StringCommand extends RequiredCommand { + @Override + public StringArgumentType getArgumentType() { + return StringArgumentType.string(); + } + + public abstract void execute(StringCommandEvent event); + + @Override + public void execute(ServerCommandEvent event) { + execute((StringCommandEvent) event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java b/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java new file mode 100644 index 000000000..a3b041b01 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java @@ -0,0 +1,52 @@ +package net.pitan76.mcpitanlib.api.datafixer; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class ItemStackFixer { + private static final Map> nbt2componentMapIfItemEqualMap = new HashMap<>(); + private static final Map, Map> nbt2componentMapIfitemMatchesMap = new HashMap<>(); + private static final Map nbt2componentMap = new HashMap<>(); + + public static void nbt2componentIfItemEquals(String itemId, String nbtKey, String componentId) { + Map nbt2componentMap; + if (nbt2componentMapIfItemEqualMap.containsKey(itemId)) { + nbt2componentMap = nbt2componentMapIfItemEqualMap.get(itemId); + } else { + nbt2componentMap = new HashMap<>(); + nbt2componentMapIfItemEqualMap.put(itemId, nbt2componentMap); + } + + nbt2componentMap.put(nbtKey, componentId); + } + + public static void nbt2componentIfItemMatches(Set itemId, String nbtKey, String componentId) { + Map nbt2componentMap; + if (nbt2componentMapIfitemMatchesMap.containsKey(itemId)) { + nbt2componentMap = nbt2componentMapIfitemMatchesMap.get(itemId); + } else { + nbt2componentMap = new HashMap<>(); + nbt2componentMapIfitemMatchesMap.put(itemId, nbt2componentMap); + } + + nbt2componentMap.put(nbtKey, componentId); + } + + public static void nbt2component(String nbtKey, String componentId) { + if (nbt2componentMap.containsKey(nbtKey)) return; + nbt2componentMap.put(nbtKey, componentId); + } + + public static Map> getNbt2componentMapIfItemEqualMap() { + return nbt2componentMapIfItemEqualMap; + } + + public static Map, Map> getNbt2componentMapIfitemMatchesMap() { + return nbt2componentMapIfitemMatchesMap; + } + + public static Map getNbt2componentMap() { + return nbt2componentMap; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java b/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java new file mode 100644 index 000000000..d930e9da9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.api.enchantment; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.BuiltinRegistries; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.resources.Identifier; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.EnchantmentUtil; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; + +public class CompatEnchantment { + private final RegistryKey registryKey; + + @Deprecated + public CompatEnchantment(RegistryKey registryKey) { + this.registryKey = registryKey; + } + + public CompatEnchantment of(Identifier identifier) { + return EnchantmentUtil.getEnchantment(identifier); + } + + public Identifier getId() { + return registryKey.getRegistry(); + } + + @Deprecated + public RegistryKey getRegistryKey() { + return registryKey; + } + + public String toString() { + return getId().toString(); + } + + public boolean equals(Object obj) { + if (obj instanceof CompatEnchantment) { + return ((CompatEnchantment) obj).getId().equals(getId()); + } + return false; + } + + @Deprecated + public RegistryEntry getEntry(@Nullable World world) { + Optional> optionalEntry; + if (world == null) { + optionalEntry = BuiltinRegistries.createWrapperLookup() + .getOptionalEntry(registryKey); + } else { + optionalEntry = world.getRegistryManager().getOptionalEntry(registryKey); + } + + return optionalEntry.orElseThrow(); + } + + public Enchantment getEnchantment(@Nullable World world) { + return getEntry(world).value(); + } + + public int getLevel(ItemStack stack, @Nullable World world) { + return EnchantmentHelper.getLevel(getEntry(world), stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java new file mode 100644 index 000000000..2dab01c35 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.entity; + +import net.minecraft.entity.ContainerUser; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; + +public class CompatContainerUser { + protected ContainerUser containerUser; + + public CompatContainerUser(ContainerUser containerUser) { + this.containerUser = containerUser; + } + + public double getContainerInteractionRange() { + return containerUser.getContainerInteractionRange(); + } + + public LivingEntity asLivingEntity() { + return containerUser.asLivingEntity(); + } + + public boolean isPlayer() { + return containerUser instanceof PlayerEntity; + } + + public Player asPlayer() { + return new Player((PlayerEntity) containerUser); + } + + @Deprecated + public ContainerUser getRaw() { + return containerUser; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java new file mode 100644 index 000000000..a5963fa7b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java @@ -0,0 +1,135 @@ +package net.pitan76.mcpitanlib.api.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.data.DataTracker; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.Packet; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.storage.ReadView; +import net.minecraft.storage.WriteView; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.entity.InitDataTrackerArgs; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; + +public class CompatEntity extends Entity { + public CompatEntity(EntityType type, World world) { + super(type, world); + } + + @Deprecated + @Override + public void initDataTracker(DataTracker.Builder builder) { + initDataTracker(new InitDataTrackerArgs(builder)); + } + + @Override + public boolean damage(ServerWorld world, DamageSource source, float amount) { + return false; + } + + public void initDataTracker(InitDataTrackerArgs args) { + + } + + public void readCustomDataFromNbt(ReadNbtArgs nbt) { + readCustomData(nbt.view); + } + + public void writeCustomDataToNbt(WriteNbtArgs nbt) { + writeCustomData(nbt.view); + } + + @Deprecated + @Override + protected void readCustomData(ReadView view) { + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readCustomDataFromNbt(new ReadNbtArgs(nbt, view)); + } + + @Deprecated + @Override + protected void writeCustomData(WriteView view) { + NbtCompound nbt = new NbtCompound(); + writeCustomDataToNbt(new WriteNbtArgs(nbt, view)); + NbtDataConverter.nbt2writeData(nbt, view); + } + + public Packet createSpawnPacket() { + return null; + } + + public void writeNbt(WriteNbtArgs args) { + writeData(args.view); + } + + public void readNbt(ReadNbtArgs args) { + readData(args.view); + } + + @Deprecated + @Override + public void writeData(WriteView view) { + super.writeData(view); + NbtCompound nbt = new NbtCompound(); + writeNbt(new WriteNbtArgs(nbt, view)); + NbtDataConverter.nbt2writeData(nbt, view); + } + + @Deprecated + @Override + public void readData(ReadView view) { + super.readData(view); + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readNbt(new ReadNbtArgs(nbt, view)); + } + + @Deprecated + @Override + public World getEntityWorld() { + return callGetWorld(); + } + + public World callGetWorld() { + return super.getEntityWorld(); + } + + public BlockPos callGetBlockPos() { + return getBlockPos(); + } + + public Vec3d callGetPos() { + return getEntityPos(); + } + + public boolean hasServerWorld() { + return callGetWorld() instanceof ServerWorld; + } + + public ServerWorld getServerWorld() { + return (ServerWorld) getEntityWorld(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(callGetWorld()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraBlockPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(callGetBlockPos()); + } + + public Vector3d getMidohraPos() { + return Vector3d.of(callGetPos()); + } + + public net.pitan76.mcpitanlib.midohra.world.ServerWorld getMidohraServerWorld() { + return net.pitan76.mcpitanlib.midohra.world.ServerWorld.of(getServerWorld()); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java new file mode 100644 index 000000000..128049f42 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java @@ -0,0 +1,159 @@ +package net.pitan76.mcpitanlib.api.entity; + +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.data.DataTracker; +import net.minecraft.entity.projectile.thrown.ThrownItemEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.storage.ReadView; +import net.minecraft.storage.WriteView; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.entity.CollisionEvent; +import net.pitan76.mcpitanlib.api.event.entity.EntityHitEvent; +import net.pitan76.mcpitanlib.api.event.entity.InitDataTrackerArgs; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; + +public abstract class CompatThrownItemEntity extends ThrownItemEntity { + + public CompatThrownItemEntity(EntityType entityType, World world) { + super(entityType, world); + } + + public CompatThrownItemEntity(EntityType entityType, double d, double e, double f, World world) { + super(entityType, d, e, f, world, ItemStackUtil.empty()); + } + + public CompatThrownItemEntity(EntityType entityType, LivingEntity livingEntity, World world) { + super(entityType, livingEntity, world, ItemStackUtil.empty()); + } + + public abstract Item getDefaultItemOverride(); + + @Deprecated + @Override + protected Item getDefaultItem() { + return getDefaultItemOverride(); + } + + public ItemStack callGetItem() { + return super.getStack(); + } + + @Deprecated + @Override + public ItemStack getStack() { + return callGetItem(); + } + + public void callSetItem(ItemStack stack) { + super.setItem(stack); + } + + @Deprecated + @Override + public void setItem(ItemStack stack) { + callSetItem(stack); + } + + public void callHandleStatus(byte status) { + super.handleStatus(status); + } + + @Deprecated + @Override + public void handleStatus(byte status) { + callHandleStatus(status); + } + + public void onEntityHit(EntityHitEvent event) { + super.onEntityHit(event.entityHitResult); + } + + @Deprecated + @Override + protected void onEntityHit(EntityHitResult entityHitResult) { + onEntityHit(new EntityHitEvent(entityHitResult)); + } + + public void onCollision(CollisionEvent event) { + super.onCollision(event.hitResult); + } + + @Deprecated + @Override + protected void onCollision(HitResult hitResult) { + onCollision(new CollisionEvent(hitResult)); + } + + // ------------------ ExtendEntity ------------------ + + @Deprecated + @Override + public void initDataTracker(DataTracker.Builder builder) { + initDataTracker(new InitDataTrackerArgs(builder, dataTracker)); + } + + public void initDataTracker(InitDataTrackerArgs args) { + super.initDataTracker(args.getBuilder()); + } + + public void readCustomDataFromNbt(ReadNbtArgs nbt) { + super.readCustomData(nbt.view); + } + + public void writeCustomDataToNbt(WriteNbtArgs nbt) { + super.writeCustomData(nbt.view); + } + + @Deprecated + @Override + protected void readCustomData(ReadView view) { + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readCustomDataFromNbt(new ReadNbtArgs(nbt, view)); + } + + @Deprecated + @Override + protected void writeCustomData(WriteView view) { + NbtCompound nbt = new NbtCompound(); + writeCustomDataToNbt(new WriteNbtArgs(nbt, view)); + NbtDataConverter.nbt2writeData(nbt, view); + } + + public void writeNbt(WriteNbtArgs args) { + super.writeData(args.view); + } + + public void readNbt(ReadNbtArgs args) { + super.readData(args.view); + } + + @Deprecated + @Override + public void writeData(WriteView view) { + super.writeData(view); + NbtCompound nbt = new NbtCompound(); + writeNbt(new WriteNbtArgs(nbt, view)); + NbtDataConverter.nbt2writeData(nbt, view); + } + + @Deprecated + @Override + public void readData(ReadView view) { + super.readData(view); + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readNbt(new ReadNbtArgs(nbt, view)); + } + + @Override + public World getEntityWorld() { + return super.getEntityWorld(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java new file mode 100644 index 000000000..933e0d8fc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java @@ -0,0 +1,133 @@ +package net.pitan76.mcpitanlib.api.entity; + +import com.google.common.collect.ImmutableSet; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityDimensions; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnGroup; +import net.minecraft.loot.LootTable; +import net.minecraft.registry.RegistryKey; +import net.pitan76.mcpitanlib.MCPitanLib; + +import java.util.Optional; + +public class EntityTypeBuilder { + + private SpawnGroup spawnGroup; + private ExtendEntityType.EntityFactory factory; + private EntityDimensions entityDimensions; + private boolean saveable; + private boolean summonable; + private boolean fireImmune; + private boolean spawnableFarFromPlayer; + private ImmutableSet canSpawnBlocks; + private int maxTrackDistance; + private int trackTickInterval; + private Boolean alwaysUpdateVelocity = null; + private String translationKey = "entity." + MCPitanLib.MOD_ID; + private Optional> lootTable = Optional.empty(); + + @Deprecated + // Recommend: create() + public EntityTypeBuilder() { + setSaveable(true); + setSummonable(true); + setFireImmune(false); + setChangingDimensions(-1.0f, -1.0f); + spawnableFarFromPlayer = false; + maxTrackDistance = 5; + trackTickInterval = 3; + canSpawnBlocks = ImmutableSet.of(); + } + + @Deprecated + public EntityTypeBuilder(SpawnGroup spawnGroup, ExtendEntityType.EntityFactory factory) { + this(); + this.spawnGroup = spawnGroup; + this.factory = factory; + } + + public static EntityTypeBuilder create() { + return new EntityTypeBuilder<>(); + } + + public static EntityTypeBuilder create(SpawnGroup spawnGroup, ExtendEntityType.EntityFactory factory) { + return new EntityTypeBuilder<>(spawnGroup, factory); + } + + public EntityType build() { + return new ExtendEntityType<>(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, maxTrackDistance, trackTickInterval, translationKey, lootTable, alwaysUpdateVelocity); + } + + public EntityTypeBuilder setSpawnGroup(SpawnGroup spawnGroup) { + this.spawnGroup = spawnGroup; + return this; + } + + public EntityTypeBuilder setEntityFactory(ExtendEntityType.EntityFactory factory) { + this.factory = factory; + return this; + } + + public EntityTypeBuilder setDimensions(EntityDimensions entityDimensions) { + this.entityDimensions = entityDimensions; + return this; + } + + public EntityTypeBuilder setFixedDimensions(float width, float height) { + return setDimensions(EntityDimensions.fixed(width, height)); + } + + public EntityTypeBuilder setChangingDimensions(float width, float height) { + return setDimensions(EntityDimensions.changing(width, height)); + } + + public EntityTypeBuilder setSaveable(boolean saveable) { + this.saveable = saveable; + return this; + } + + public EntityTypeBuilder setSummonable(boolean summonable) { + this.summonable = summonable; + return this; + } + + public EntityTypeBuilder setFireImmune(boolean fireImmune) { + this.fireImmune = fireImmune; + return this; + } + + public EntityTypeBuilder setSpawnableFarFromPlayer(boolean spawnableFarFromPlayer) { + this.spawnableFarFromPlayer = spawnableFarFromPlayer; + return this; + } + + public EntityTypeBuilder setCanSpawnBlocks(ImmutableSet canSpawnBlocks) { + this.canSpawnBlocks = canSpawnBlocks; + return this; + } + + public EntityTypeBuilder setMaxTrackDistance(int maxTrackDistance) { + this.maxTrackDistance = maxTrackDistance; + return this; + } + + public EntityTypeBuilder setTrackTickInterval(int trackTickInterval) { + this.trackTickInterval = trackTickInterval; + return this; + } + + public EntityTypeBuilder setAlwaysUpdateVelocity(Boolean alwaysUpdateVelocity) { + this.alwaysUpdateVelocity = alwaysUpdateVelocity; + return this; + } + + public void setTranslationKey(String translationKey) { + this.translationKey = translationKey; + } + + public void setLootTable(RegistryKey lootTable) { + this.lootTable = Optional.ofNullable(lootTable); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java new file mode 100644 index 000000000..29245d975 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java @@ -0,0 +1,102 @@ +package net.pitan76.mcpitanlib.api.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.data.DataTracker; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.Packet; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.storage.ReadView; +import net.minecraft.storage.WriteView; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.nbt.NbtTag; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; + +public class ExtendEntity extends Entity { + public ExtendEntity(EntityType type, World world) { + super(type, world); + } + + @Deprecated + @Override + public void initDataTracker(DataTracker.Builder builder) { + initDataTracker(); + } + + @Override + public boolean damage(ServerWorld world, DamageSource source, float amount) { + return false; + } + + public void initDataTracker() { + } + + public void readCustomDataFromNbt(NbtCompound nbt) { + + } + + public void writeCustomDataToNbt(NbtCompound nbt) { + + } + + public Packet createSpawnPacket() { + return null; + } + + // 互換性用 (NbtTag型をOverrideすること) + public void writeNbt(NbtTag nbt) { + + } + + public void readNbt(NbtTag nbt) { + + } + + @Deprecated + @Override + public void writeData(WriteView view) { + super.writeData(view); + NbtCompound nbt = new NbtCompound(); + writeNbt(NbtTag.from(nbt)); + NbtDataConverter.nbt2writeData(nbt, view); + } + + @Deprecated + @Override + public void readData(ReadView view) { + super.readData(view); + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readNbt(NbtTag.from(nbt)); + } + + @Override + protected void readCustomData(ReadView view) { + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readCustomDataFromNbt(nbt); + } + + @Override + protected void writeCustomData(WriteView view) { + NbtCompound nbt = new NbtCompound(); + writeCustomDataToNbt(nbt); + NbtDataConverter.nbt2writeData(nbt, view); + } + + // 1.14 + public NbtCompound toTag(NbtCompound nbt) { + this.writeNbt(NbtTag.from(nbt)); + return nbt; + } + + public NbtCompound fromTag(NbtCompound nbt) { + this.readNbt(NbtTag.from(nbt)); + return nbt; + } + + @Override + public World getEntityWorld() { + return super.getEntityWorld(); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java new file mode 100644 index 000000000..207e9c949 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.api.entity; + +import com.google.common.collect.ImmutableSet; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityDimensions; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnGroup; +import net.minecraft.loot.LootTable; +import net.minecraft.registry.RegistryKey; +import net.minecraft.resource.featuretoggle.FeatureFlags; +import net.minecraft.world.World; + +import java.util.Optional; + +public class ExtendEntityType extends EntityType { + private final Boolean alwaysUpdateVelocity; + + @Deprecated + public ExtendEntityType(EntityFactory factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { + super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_ENABLED_FEATURES, spawnGroup.isPeaceful()); + this.alwaysUpdateVelocity = alwaysUpdateVelocity; + } + + public ExtendEntityType(EntityFactory factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { + super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, 5, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_ENABLED_FEATURES, spawnGroup.isPeaceful()); + this.alwaysUpdateVelocity = alwaysUpdateVelocity; + } + + @Override + public boolean alwaysUpdateVelocity() { + if (alwaysUpdateVelocity != null) + return alwaysUpdateVelocity; + + return super.alwaysUpdateVelocity(); + } + + public interface EntityFactory { + T create(EntityType type, World world); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java new file mode 100644 index 000000000..b86188772 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -0,0 +1,547 @@ +package net.pitan76.mcpitanlib.api.entity; + +import dev.architectury.registry.menu.ExtendedMenuProvider; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.block.BlockState; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.NbtComponent; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.player.ItemCooldownManager; +import net.minecraft.entity.player.PlayerAbilities; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.screen.NamedScreenHandlerFactory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.server.network.ServerPlayNetworkHandler; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.stat.Stat; +import net.minecraft.stat.StatType; +import net.minecraft.storage.NbtReadView; +import net.minecraft.storage.NbtWriteView; +import net.minecraft.text.Text; +import net.minecraft.util.ErrorReporter; +import net.minecraft.util.Hand; +import net.minecraft.resources.Identifier; +import net.minecraft.util.collection.DefaultedList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; +import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; +import net.pitan76.mcpitanlib.api.gui.ExtendedNamedScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; +import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.NbtUtil; +import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.core.player.ItemCooldown; + +import java.util.*; +import java.util.function.Consumer; + +/* +PlayerEntity helper + */ +public class Player { + private final PlayerEntity entity; + + public PlayerEntity getEntity() { + return entity; + } + + public PlayerEntity getPlayerEntity() { + return getEntity(); + } + + public Player(PlayerEntity playerEntity) { + this.entity = playerEntity; + } + + /** + * Get player inventory + * @return PlayerInventory + */ + public PlayerInventory getInv() { + return getEntity().getInventory(); + } + + /** + * Alias of getInv() + * @return PlayerInventory + */ + public PlayerInventory getInventory() { + return getInv(); + } + + /** + * Get armor's item stack list + * @return DefaultedList + */ + public DefaultedList getArmor() { + DefaultedList stacks = DefaultedList.ofSize(4, ItemStack.EMPTY); + stacks.set(0, getInv().getStack(36)); + stacks.set(1, getInv().getStack(37)); + stacks.set(2, getInv().getStack(38)); + stacks.set(3, getInv().getStack(39)); + return stacks; + } + + /** + * Get main's item stack list + * @return DefaultedList + */ + public DefaultedList getMain() { + return getInv().getMainStacks(); + } + + /** + * Get off hand's item stack list + * @return DefaultedList + */ + public DefaultedList getOffHand() { + DefaultedList stacks = DefaultedList.ofSize(1, ItemStack.EMPTY); + stacks.set(0, getInv().getStack(PlayerInventory.OFF_HAND_SLOT)); + return stacks; + } + + /** + * Get select slot integer + * @return int + */ + public int getSelectSlot() { + return getInv().getSelectedSlot(); + } + + /** + * Get player inventory size + * @return player inventory size + */ + public int getInvSize() { + return getInv().size(); + } + + public OptionalInt openGuiScreen(NamedScreenHandlerFactory factory) { + return getEntity().openHandledScreen(factory); + } + + public OptionalInt openGuiScreen(World world, BlockState state, BlockPos pos) { + return openGuiScreen(state.createScreenHandlerFactory(world, pos)); + } + + public boolean isServerPlayerEntity() { + return this.getEntity() instanceof ServerPlayerEntity; + } + + public void openExtendedMenu(NamedScreenHandlerFactory provider, Consumer bufWriter) { + if (isServerPlayerEntity()) + ScreenHandlerUtil.openExtendedMenu((ServerPlayerEntity) this.getPlayerEntity(), provider, bufWriter); + } + + public void openExtendedMenu(ExtendedMenuProvider provider) { + if (isServerPlayerEntity()) + ScreenHandlerUtil.openExtendedMenu((ServerPlayerEntity) this.getPlayerEntity(), provider); + } + + public void openExtendedMenu(ExtendedNamedScreenHandlerFactory provider) { + this.openExtendedMenu((ExtendedMenuProvider) provider); + } + + public void openMenu(NamedScreenHandlerFactory provider) { + if (isServerPlayerEntity()) + ScreenHandlerUtil.openMenu((ServerPlayerEntity) this.getPlayerEntity(), provider); + } + + public void insertStack(ItemStack stack) { + getInv().insertStack(stack); + } + + public void insertStack(int slot, ItemStack stack) { + getInv().insertStack(slot, stack); + } + + public void offerOrDrop(ItemStack itemStack) { + getInv().offerOrDrop(itemStack); + } + + public void giveStack(ItemStack stack) { + getEntity().giveItemStack(stack); + } + + public String getName() { + return getEntity().getName().getString(); + } + + public UUID getUUID() { + return getEntity().getUuid(); + } + + public PlayerAbilities getAbilities() { + return getEntity().getAbilities(); + } + + /** + * Returns whether this player is in creative mode. + */ + public boolean isCreative() { + return getAbilities().creativeMode; + } + + public boolean isFlying() { + return getAbilities().flying; + } + + public boolean isInvulnerable() { + return getAbilities().invulnerable; + } + + public World getWorld() { + return getEntity().getEntityWorld(); + } + + public ScreenHandler getCurrentScreenHandler() { + return getEntity().currentScreenHandler; + } + + public boolean isSneaking() { + return getEntity().isSneaking(); + } + + public ItemStack getCursorStack() { + return getCurrentScreenHandler().getCursorStack(); + } + + public boolean isClient() { + return getWorld().isClient(); + } + public boolean isServer() { + return !isClient(); + } + + public void readCustomDataFromNbt(NbtCompound nbt) { + getEntity().setComponent(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt)); + } + + public void writeCustomDataToNbt(NbtCompound nbt) { + NbtCompound source = getEntity().get(DataComponentTypes.CUSTOM_DATA).copyNbt(); + NbtUtil.copyFrom(source, nbt); + } + + public void sendMessage(Text text) { + getEntity().sendMessage(text, false); + } + + public void sendActionBar(Text text) { + getEntity().sendMessage(text, true); + } + + public void equipStack(EquipmentSlot slot, ItemStack stack) { + getEntity().equipStack(slot, stack); + } + + public void dropStack(ItemStack stack, boolean throwRandomly, boolean retainOwnership) { + getEntity().dropItem(stack, throwRandomly, retainOwnership); + } + + public void dropStack(ItemStack stack, boolean retainOwnership) { + dropStack(stack, false, retainOwnership); + } + + public void dropStack(ItemStack stack) { + dropStack(stack, false, false); + } + + public BlockPos getBlockPos() { + return getEntity().getBlockPos(); + } + + public Vec3d getPos() { + return getEntity().getEntityPos(); + } + + public ItemStack getStackInHand(Hand hand) { + return this.getEntity().getStackInHand(hand); + } + + public void heal(float amount) { + this.getEntity().heal(amount); + } + + public float getYaw() { + return this.getEntity().getYaw(); + } + + public float getPitch() { + return this.getEntity().getPitch(); + } + + public void playSound(SoundEvent event, SoundCategory category, float volume, float pitch) { + if (isServerPlayerEntity()) { + Optional player = getServerPlayer(); + if (player.isPresent()) { + player.get().playSound(event, volume, pitch); + return; + } + } + + playSound(event, volume, pitch); + } + + public void playSound(SoundEvent event, float volume, float pitch) { + if (isServerPlayerEntity()) { + Optional player = getServerPlayer(); + if (player.isPresent()) { + player.get().playSound(event, volume, pitch); + return; + } + } + + getEntity().playSound(event, volume, pitch); + } + + public void playSound(CompatSoundEvent event, CompatSoundCategory category, float volume, float pitch) { + playSound(event.get(), category.get(), volume, pitch); + } + + public void playSound(CompatSoundEvent event, float volume, float pitch) { + playSound(event.get(), volume, pitch); + } + + public ItemCooldown itemCooldown = new ItemCooldown(this); + + public ItemCooldown getItemCooldown() { + return itemCooldown; + } + + public ItemCooldownManager getItemCooldownManager() { + return getEntity().getItemCooldownManager(); + } + + public void incrementStat(Stat stat) { + getEntity().incrementStat(stat); + } + + public void incrementStat(StatType type, T object) { + getEntity().incrementStat(type.getOrCreateStat(object)); + } + + public void incrementStat(Identifier id) { + getEntity().incrementStat(id); + } + + public void incrementStat(CompatIdentifier id) { + getEntity().incrementStat(id.toMinecraft()); + } + + public void teleport(double x, double y, double z) { + getEntity().teleport(x, y, z, false); + } + + public ItemStack getMainHandStack() { + return getStackInHand(Hand.MAIN_HAND); + } + + public ItemStack getOffHandStack() { + return getStackInHand(Hand.OFF_HAND); + } + + public Direction getHorizontalFacing() { + return getEntity().getHorizontalFacing(); + } + + public double getX() { + return getEntity().getX(); + } + + public double getY() { + return getEntity().getY(); + } + + public double getZ() { + return getEntity().getZ(); + } + + public boolean isServerPlayer() { + return getEntity() instanceof ServerPlayerEntity; + } + + public Optional getServerPlayer() { + if (isServerPlayer()) + return Optional.of((ServerPlayerEntity) getEntity()); + + return Optional.empty(); + } + + @Environment(EnvType.CLIENT) + public Optional getClientPlayer() { + if (getEntity() instanceof ClientPlayerEntity) + return Optional.of((ClientPlayerEntity) getEntity()); + + return Optional.empty(); + } + + public void setVelocity(double x, double y, double z) { + getEntity().setVelocity(x, y, z); + } + + public void setVelocity(Vec3d velocity) { + getEntity().setVelocity(velocity); + } + + public Vec3d getVelocity() { + return getEntity().getVelocity(); + } + + public Optional getNetworkHandler() { + Optional player = getServerPlayer(); + return player.map(sp -> sp.networkHandler); + } + + public boolean hasNetworkHandler() { + return getNetworkHandler().isPresent(); + } + + public boolean isSpectator() { + return getEntity().isSpectator(); + } + + /** + * Returns the current {@link ItemStack} in the {@link Player}'s hand, or offhand if the + * main hand is empty. + * + * @return {@code ItemStack} that the {@link Player} is holding. Can be {@link null}. + */ + public Optional getCurrentHandItem() { + boolean playerIsHoldingInMainHand = !getMainHandStack().isEmpty(); + if (playerIsHoldingInMainHand) + return Optional.ofNullable(getMainHandStack()); + + boolean playerIsHoldingInOffHand = !getOffHandStack().isEmpty(); + + if (playerIsHoldingInOffHand) + return Optional.ofNullable(getOffHandStack()); + + return Optional.empty(); + } + + public void addStatusEffect(CompatStatusEffectInstance effect) { + getEntity().addStatusEffect(effect.getInstance()); + } + + public void removeStatusEffect(CompatStatusEffect effect) { + getEntity().removeStatusEffect(effect.getEntry(getWorld())); + } + + public List getStatusEffects() { + List compatEffects = new ArrayList<>(); + + for (StatusEffectInstance effect : getEntity().getStatusEffects()) { + compatEffects.add(new CompatStatusEffectInstance(effect)); + } + + return compatEffects; + } + + public void addExperience(int experience) { + getEntity().addExperience(experience); + } + + public int getExperienceLevel() { + return getEntity().experienceLevel; + } + + public void addExperienceLevels(int levels) { + getEntity().addExperienceLevels(levels); + } + + public void setExperienceLevel(int level) { + getEntity().experienceLevel = level; + } + + public void addScore(int score) { + getEntity().addScore(score); + } + + public int getScore() { + return getEntity().getScore(); + } + + public void setScore(int score) { + getEntity().setScore(score); + } + + public int getTotalExperience() { + return getEntity().totalExperience; + } + + public void setTotalExperience(int experience) { + getEntity().totalExperience = experience; + } + + public boolean isSwimming() { + return getEntity().isSwimming(); + } + + public void setStackInHand(Hand hand, ItemStack stack) { + getEntity().setStackInHand(hand, stack); + } + + public void setStackInHand(Hand hand, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + setStackInHand(hand, stack.toMinecraft()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStackInHand(Hand hand) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStackInHand(hand)); + } + + public Hand getActiveHand() { + return getEntity().getActiveHand(); + } + + public float getBlockBreakingSpeed(BlockState state) { + return getEntity().getBlockBreakingSpeed(state); + } + + public boolean canHarvest(BlockState state) { + return getEntity().canHarvest(state); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } + + public void eatFood(ItemStack stack, CompatFoodComponent foodComponent) { + getEntity().getHungerManager().eat(foodComponent.build()); + } + + public void sendMessage(String message) { + sendMessage(TextUtil.of(message)); + } + + public void sendActionBar(String message) { + sendActionBar(TextUtil.of(message)); + } + + public void sendMessagef(String format, Object... args) { + sendMessage(TextUtil.of(String.format(format, args))); + } + + public void sendMessage(TextComponent textComponent) { + sendMessage(textComponent.getText()); + } + + public void sendActionBar(TextComponent textComponent) { + sendActionBar(textComponent.getText()); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java new file mode 100644 index 000000000..dd71d5eb8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java @@ -0,0 +1,54 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.minecraft.entity.attribute.EntityAttributeModifier; + +public class AttrModifierOperation { + private final EntityAttributeModifier.Operation raw; + + public static final AttrModifierOperation ADD = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_VALUE); + public static final AttrModifierOperation MUL_TOTAL = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL); + public static final AttrModifierOperation MUL_BASE = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE); + + @Deprecated + public AttrModifierOperation(EntityAttributeModifier.Operation raw) { + this.raw = raw; + } + + public static AttrModifierOperation of(EntityAttributeModifier.Operation raw) { + if (raw == EntityAttributeModifier.Operation.ADD_VALUE) { + return ADD; + } else if (raw == EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL) { + return MUL_TOTAL; + } else if (raw == EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE) { + return MUL_BASE; + } + + return new AttrModifierOperation(raw); + } + + public EntityAttributeModifier.Operation raw() { + return raw; + } + + public String getName() { + return raw().name(); + } + + public int getId() { + return raw().getId(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof AttrModifierOperation)) return false; + AttrModifierOperation that = (AttrModifierOperation) obj; + return raw().equals(that.raw()); + } + + @Override + public int hashCode() { + if (raw() == null) return super.hashCode(); + return raw().hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java new file mode 100644 index 000000000..120a75040 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.minecraft.component.type.AttributeModifiersComponent; + +public class AttributeModifiersComponentBuilder { + + public final AttributeModifiersComponent.Builder builder = AttributeModifiersComponent.builder(); + + public AttributeModifiersComponentBuilder() { + + } + + public AttributeModifiersComponentBuilder add(CompatEntityAttribute attribute, CompatEntityAttributeModifier modifier, CompatAttributeModifierSlot slot) { + builder.add(attribute.raw(), modifier.raw(), slot.raw()); + return this; + } + + @Deprecated + public AttributeModifiersComponent build_raw() { + return builder.build(); + } + + public CompatAttributeModifiersComponent build() { + return CompatAttributeModifiersComponent.of(build_raw()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java new file mode 100644 index 000000000..43595c06b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java @@ -0,0 +1,64 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.minecraft.component.type.AttributeModifierSlot; +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class CompatAttributeModifierSlot implements CompatStringIdentifiable { + + private final AttributeModifierSlot raw; + + public static final CompatAttributeModifierSlot ANY = new CompatAttributeModifierSlot(AttributeModifierSlot.ANY); + public static final CompatAttributeModifierSlot MAIN_HAND = new CompatAttributeModifierSlot(AttributeModifierSlot.MAINHAND); + public static final CompatAttributeModifierSlot OFF_HAND = new CompatAttributeModifierSlot(AttributeModifierSlot.OFFHAND); + public static final CompatAttributeModifierSlot HEAD = new CompatAttributeModifierSlot(AttributeModifierSlot.HEAD); + public static final CompatAttributeModifierSlot FEET = new CompatAttributeModifierSlot(AttributeModifierSlot.FEET); + public static final CompatAttributeModifierSlot LEGS = new CompatAttributeModifierSlot(AttributeModifierSlot.LEGS); + public static final CompatAttributeModifierSlot CHEST = new CompatAttributeModifierSlot(AttributeModifierSlot.CHEST); + public static final CompatAttributeModifierSlot ARMOR = new CompatAttributeModifierSlot(AttributeModifierSlot.ARMOR); + public static final CompatAttributeModifierSlot BODY = new CompatAttributeModifierSlot(AttributeModifierSlot.BODY); + public static final CompatAttributeModifierSlot SADDLE = new CompatAttributeModifierSlot(AttributeModifierSlot.SADDLE); + + @Deprecated + public CompatAttributeModifierSlot(AttributeModifierSlot raw) { + this.raw = raw; + } + + public static CompatAttributeModifierSlot of(AttributeModifierSlot slot) { + if (slot == AttributeModifierSlot.ANY) return ANY; + if (slot == AttributeModifierSlot.MAINHAND) return MAIN_HAND; + if (slot == AttributeModifierSlot.OFFHAND) return OFF_HAND; + if (slot == AttributeModifierSlot.HEAD) return HEAD; + if (slot == AttributeModifierSlot.FEET) return FEET; + if (slot == AttributeModifierSlot.LEGS) return LEGS; + if (slot == AttributeModifierSlot.CHEST) return CHEST; + if (slot == AttributeModifierSlot.ARMOR) return ARMOR; + if (slot == AttributeModifierSlot.BODY) return BODY; + if (slot == AttributeModifierSlot.SADDLE) return SADDLE; + + return new CompatAttributeModifierSlot(slot); + } + + @Deprecated + public AttributeModifierSlot raw() { + return raw; + } + + @Override + public String asString_compat() { + return raw().asString(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof CompatAttributeModifierSlot)) return false; + CompatAttributeModifierSlot that = (CompatAttributeModifierSlot) obj; + return raw().equals(that.raw()); + } + + @Override + public int hashCode() { + if (raw() == null) return super.hashCode(); + return raw().hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java new file mode 100644 index 000000000..ec9b8318c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.minecraft.component.type.AttributeModifiersComponent; + +public class CompatAttributeModifiersComponent { + private final AttributeModifiersComponent raw; + + @Deprecated + public CompatAttributeModifiersComponent(AttributeModifiersComponent component) { + this.raw = component; + } + + @Deprecated + public AttributeModifiersComponent raw() { + return raw; + } + + public static CompatAttributeModifiersComponent of(AttributeModifiersComponent component) { + return new CompatAttributeModifiersComponent(component); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatAttributeModifiersComponent that = (CompatAttributeModifiersComponent) obj; + return raw.equals(that.raw); + } + + @Override + public int hashCode() { + return raw.hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java new file mode 100644 index 000000000..0b116dc14 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java @@ -0,0 +1,49 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.minecraft.entity.attribute.EntityAttribute; +import net.minecraft.registry.entry.RegistryEntry; + +public class CompatEntityAttribute { + public final RegistryEntry raw; + + @Deprecated + public CompatEntityAttribute(RegistryEntry attribute) { + this.raw = attribute; + } + + @Deprecated + public RegistryEntry raw() { + return raw; + } + + public String getId() { + return raw.getIdAsString(); + } + + public EntityAttribute getValue() { + return raw.value(); + } + + public boolean isNull() { + return raw == null; + } + + @Deprecated + public static CompatEntityAttribute of(RegistryEntry attribute) { + return new CompatEntityAttribute(attribute); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof CompatEntityAttribute)) return false; + CompatEntityAttribute that = (CompatEntityAttribute) obj; + return raw.equals(that.raw); + } + + @Override + public int hashCode() { + if (raw == null) return super.hashCode(); + return raw.hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java new file mode 100644 index 000000000..e170013ca --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java @@ -0,0 +1,70 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.attribute.EntityAttributeInstance; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +import java.util.function.Consumer; + +public class CompatEntityAttributeInstance { + private final net.minecraft.entity.attribute.EntityAttributeInstance raw; + + @Deprecated + public CompatEntityAttributeInstance(net.minecraft.entity.attribute.EntityAttributeInstance instance) { + this.raw = instance; + } + + @Deprecated + public net.minecraft.entity.attribute.EntityAttributeInstance raw() { + return raw; + } + + @Deprecated + public static CompatEntityAttributeInstance of(net.minecraft.entity.attribute.EntityAttributeInstance instance) { + return new CompatEntityAttributeInstance(instance); + } + + public static CompatEntityAttributeInstance create(CompatEntityAttribute type, Consumer updateCallback) { + return of(new EntityAttributeInstance(type.raw(), modifier -> { + if (updateCallback != null) + updateCallback.accept(of(modifier)); + })); + } + + public static CompatEntityAttributeInstance get(LivingEntity entity, CompatEntityAttribute attribute) { + return new CompatEntityAttributeInstance(entity.getAttributeInstance(attribute.raw())); + } + + public static CompatEntityAttributeInstance get(Player player, CompatEntityAttribute attribute) { + return get(player.getEntity(), attribute); + } + + public boolean hasModifier(CompatIdentifier id) { + return raw().hasModifier(id.toMinecraft()); + } + + public double getValue() { + return raw().getValue(); + } + + public void setBaseValue(double value) { + raw().setBaseValue(value); + } + + public void addPersistentModifier(CompatEntityAttributeModifier modifier) { + raw().addPersistentModifier(modifier.raw()); + } + + public void removeModifier(CompatIdentifier id) { + raw().removeModifier(id.toMinecraft()); + } + + public CompatEntityAttribute getAttribute() { + return CompatEntityAttribute.of(raw().getAttribute()); + } + + public boolean isNull() { + return raw() == null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java new file mode 100644 index 000000000..59b4f2b74 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatEntityAttributeModifier { + private final net.minecraft.entity.attribute.EntityAttributeModifier raw; + + @Deprecated + public CompatEntityAttributeModifier(net.minecraft.entity.attribute.EntityAttributeModifier raw) { + this.raw = raw; + } + + @Deprecated + public static CompatEntityAttributeModifier of(net.minecraft.entity.attribute.EntityAttributeModifier raw) { + return new CompatEntityAttributeModifier(raw); + } + + public static CompatEntityAttributeModifier of(CompatIdentifier id, double value, AttrModifierOperation operation) { + return new CompatEntityAttributeModifier(new net.minecraft.entity.attribute.EntityAttributeModifier(id.toMinecraft(), value, operation.raw())); + } + + @Deprecated + public net.minecraft.entity.attribute.EntityAttributeModifier raw() { + return raw; + } + + public AttrModifierOperation getOperation() { + return AttrModifierOperation.of(raw().operation()); + } + + public double getValue() { + return raw().value(); + } + + public CompatIdentifier getId() { + return CompatIdentifier.fromMinecraft(raw().id()); + } + + @Override + public String toString() { + return raw().toString(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof CompatEntityAttributeModifier)) return false; + CompatEntityAttributeModifier that = (CompatEntityAttributeModifier) obj; + return raw().equals(that.raw()); + } + + @Override + public int hashCode() { + if (raw() == null) return super.hashCode(); + return raw().hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java new file mode 100644 index 000000000..d0c1f595f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.api.entity.attribute; + +import net.minecraft.entity.attribute.EntityAttribute; +import net.minecraft.entity.attribute.EntityAttributes; +import net.minecraft.registry.entry.RegistryEntry; + +public class CompatEntityAttributes { + + public static final CompatEntityAttribute ARMOR = of(EntityAttributes.ARMOR); + public static final CompatEntityAttribute ARMOR_TOUGHNESS = of(EntityAttributes.ARMOR_TOUGHNESS); + public static final CompatEntityAttribute ATTACK_DAMAGE = of(EntityAttributes.ATTACK_DAMAGE); + public static final CompatEntityAttribute ATTACK_KNOCKBACK = of(EntityAttributes.ATTACK_KNOCKBACK); + public static final CompatEntityAttribute ATTACK_SPEED = of(EntityAttributes.ATTACK_SPEED); + public static final CompatEntityAttribute FOLLOW_RANGE = of(EntityAttributes.FOLLOW_RANGE); + public static final CompatEntityAttribute KNOCKBACK_RESISTANCE = of(EntityAttributes.KNOCKBACK_RESISTANCE); + public static final CompatEntityAttribute LUCK = of(EntityAttributes.LUCK); + public static final CompatEntityAttribute MOVEMENT_SPEED = of(EntityAttributes.MOVEMENT_SPEED); + public static final CompatEntityAttribute MAX_HEALTH = of(EntityAttributes.MAX_HEALTH); + public static final CompatEntityAttribute JUMP_STRENGTH = of(EntityAttributes.JUMP_STRENGTH); + public static final CompatEntityAttribute GRAVITY = of(EntityAttributes.GRAVITY); + public static final CompatEntityAttribute FLYING_SPEED = of(EntityAttributes.FLYING_SPEED); + public static final CompatEntityAttribute BLOCK_BREAK_SPEED = of(EntityAttributes.BLOCK_BREAK_SPEED); + public static final CompatEntityAttribute BLOCK_INTERACTION_RANGE = of(EntityAttributes.BLOCK_INTERACTION_RANGE); + + public static CompatEntityAttribute of(RegistryEntry attribute) { + return CompatEntityAttribute.of(attribute); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java new file mode 100644 index 000000000..2c33c4a89 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java @@ -0,0 +1,62 @@ +package net.pitan76.mcpitanlib.api.entity.effect; + +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.registry.BuiltinRegistries; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.resources.Identifier; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.StatusEffectUtil; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; + +public class CompatStatusEffect { + private final RegistryKey registryKey; + + @Deprecated + public CompatStatusEffect(RegistryKey registryKey) { + this.registryKey = registryKey; + } + + public CompatStatusEffect of(Identifier identifier) { + return StatusEffectUtil.getStatusEffect(identifier); + } + + public Identifier getId() { + return registryKey.getRegistry(); + } + + @Deprecated + public RegistryKey getRegistryKey() { + return registryKey; + } + + public String toString() { + return getId().toString(); + } + + public boolean equals(Object obj) { + if (obj instanceof CompatStatusEffect) { + return ((CompatStatusEffect) obj).getId().equals(getId()); + } + return false; + } + + @Deprecated + public RegistryEntry getEntry(@Nullable World world) { + Optional> optionalEntry; + if (world == null) { + optionalEntry = BuiltinRegistries.createWrapperLookup() + .getOptionalEntry(registryKey); + } else { + optionalEntry = world.getRegistryManager().getOptionalEntry(registryKey); + } + + return optionalEntry.orElseThrow(); + } + + public StatusEffect getStatusEffect(@Nullable World world) { + return getEntry(world).value(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java new file mode 100644 index 000000000..fe23894f3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java @@ -0,0 +1,74 @@ +package net.pitan76.mcpitanlib.api.entity.effect; + +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.registry.RegistryKey; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; + +public class CompatStatusEffectInstance { + private final StatusEffectInstance instance; + + @Deprecated + public CompatStatusEffectInstance(StatusEffectInstance instance) { + this.instance = instance; + } + + public StatusEffectInstance getInstance() { + return instance; + } + + public Optional getCompatStatusEffect() { + Optional> optional = instance.getEffectType().getKey(); + return optional.map(CompatStatusEffect::new); + } + + public CompatStatusEffectInstance(CompatStatusEffect effect) { + this(effect, 0, 0); + } + + public CompatStatusEffectInstance(CompatStatusEffect effect, int duration) { + this(effect, duration, 0); + } + + public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier) { + this(effect, duration, amplifier, false, true); + } + + public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean visible) { + this(effect, duration, amplifier, ambient, visible, visible); + } + + public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon) { + this(effect, duration, amplifier, ambient, showParticles, showIcon, null); + } + + public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable StatusEffectInstance hiddenEffect) { + this.instance = new StatusEffectInstance(effect.getEntry(null), duration, amplifier, ambient, showParticles, showIcon, hiddenEffect); + } + + public int getDuration() { + return instance.getDuration(); + } + + public int getAmplifier() { + return instance.getAmplifier(); + } + + public boolean isAmbient() { + return instance.isAmbient(); + } + + public boolean showParticles() { + return instance.shouldShowParticles(); + } + + public boolean showIcon() { + return instance.shouldShowIcon(); + } + + public boolean isInfinite() { + return instance.isInfinite(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java new file mode 100644 index 000000000..4e770c96c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java @@ -0,0 +1,4 @@ +package net.pitan76.mcpitanlib.api.event; + +public class BaseEvent { +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java new file mode 100644 index 000000000..b54933766 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java @@ -0,0 +1,11 @@ +package net.pitan76.mcpitanlib.api.event; + +import net.minecraft.block.Block; +import net.minecraft.command.argument.BlockStateArgumentType; +import net.pitan76.mcpitanlib.api.command.argument.BlockCommand; + +public class BlockCommandEvent extends RequiredCommandEvent { + public Block getValue() { + return BlockStateArgumentType.getBlockState(context, ((BlockCommand) getCommand()).getArgumentName()).getBlockState().getBlock(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java new file mode 100644 index 000000000..e465945ee --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.arguments.BoolArgumentType; +import net.pitan76.mcpitanlib.api.command.argument.BooleanCommand; + +public class BooleanCommandEvent extends RequiredCommandEvent { + public Boolean getValue() { + return BoolArgumentType.getBool(context, ((BooleanCommand) getCommand()).getArgumentName()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java new file mode 100644 index 000000000..7b000c562 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.context.StringRange; +import net.pitan76.mcpitanlib.api.command.AbstractCommand; + +public class CommandEvent { + public CommandContext context; + public AbstractCommand command; + + public CommandContext getContext() { + return context; + } + + public void setContext(CommandContext context) { + this.context = context; + } + + public String getInput() { + return getContext().getInput(); + } + + public StringRange getRange() { + return getContext().getRange(); + } + + public void setCommand(AbstractCommand command) { + this.command = command; + } + + public AbstractCommand getCommand() { + return command; + } + + public V getArgument(String name, Class clazz) { + return getContext().getArgument(name, clazz); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java new file mode 100644 index 000000000..b67d482a7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.arguments.DoubleArgumentType; +import net.pitan76.mcpitanlib.api.command.argument.DoubleCommand; + +public class DoubleCommandEvent extends RequiredCommandEvent { + public Double getValue() { + return DoubleArgumentType.getDouble(context, ((DoubleCommand) getCommand()).getArgumentName()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java new file mode 100644 index 000000000..38110c090 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.command.argument.EntitiesCommand; + +public class EntitiesCommandEvent extends RequiredCommandEvent { + public Entity getValue() { + try { + return EntityArgumentType.getEntity(context, ((EntitiesCommand) getCommand()).getArgumentName()); + } catch (CommandSyntaxException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java new file mode 100644 index 000000000..ea90b106e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.command.argument.EntityCommand; + +public class EntityCommandEvent extends RequiredCommandEvent { + public Entity getValue() { + try { + return EntityArgumentType.getEntity(context, ((EntityCommand) getCommand()).getArgumentName()); + } catch (CommandSyntaxException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java new file mode 100644 index 000000000..931d4e194 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.arguments.FloatArgumentType; +import net.pitan76.mcpitanlib.api.command.argument.FloatCommand; + +public class FloatCommandEvent extends RequiredCommandEvent { + public Float getValue() { + return FloatArgumentType.getFloat(context, ((FloatCommand) getCommand()).getArgumentName()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java new file mode 100644 index 000000000..240e325d3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.arguments.IntegerArgumentType; +import net.pitan76.mcpitanlib.api.command.argument.IntegerCommand; + +public class IntegerCommandEvent extends RequiredCommandEvent { + public Integer getValue() { + return IntegerArgumentType.getInteger(context, ((IntegerCommand) getCommand()).getArgumentName()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java new file mode 100644 index 000000000..1888aa422 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java @@ -0,0 +1,11 @@ +package net.pitan76.mcpitanlib.api.event; + +import net.minecraft.command.argument.ItemStackArgumentType; +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.command.argument.ItemCommand; + +public class ItemCommandEvent extends RequiredCommandEvent { + public Item getValue() { + return ItemStackArgumentType.getItemStackArgument(context, ((ItemCommand) getCommand()).getArgumentName()).getItem(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java new file mode 100644 index 000000000..744678f01 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.arguments.LongArgumentType; +import net.pitan76.mcpitanlib.api.command.argument.LongCommand; + +public class LongCommandEvent extends RequiredCommandEvent { + public Long getValue() { + return LongArgumentType.getLong(context, ((LongCommand) getCommand()).getArgumentName()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java new file mode 100644 index 000000000..7fad3ba41 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.command.argument.PlayerCommand; + +public class PlayerCommandEvent extends RequiredCommandEvent { + public Entity getValue() { + try { + return EntityArgumentType.getPlayer(context, ((PlayerCommand) getCommand()).getArgumentName()); + } catch (CommandSyntaxException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java new file mode 100644 index 000000000..aa845fd17 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.command.argument.PlayersCommand; + +public class PlayersCommandEvent extends RequiredCommandEvent { + public Entity getValue() { + try { + return EntityArgumentType.getPlayer(context, ((PlayersCommand) getCommand()).getArgumentName()); + } catch (CommandSyntaxException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java new file mode 100644 index 000000000..0ac500819 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java @@ -0,0 +1,5 @@ +package net.pitan76.mcpitanlib.api.event; + +public abstract class RequiredCommandEvent extends ServerCommandEvent { + public abstract Object getValue(); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java new file mode 100644 index 000000000..8cf6a1860 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java @@ -0,0 +1,134 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.Command; +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.context.StringRange; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.text.Text; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; + +public class ServerCommandEvent extends CommandEvent { + + public CommandContext getContext() { + return context; + } + + public void setContext(CommandContext context) { + this.context = context; + } + + public ServerCommandSource getSource() { + return getContext().getSource(); + } + + public PlayerEntity getPlayerEntity() throws CommandSyntaxException { + return getSource().getPlayer(); + } + + public Player getPlayer() throws CommandSyntaxException { + return new Player(getPlayerEntity()); + } + + public World getWorld() { + return getSource().getWorld(); + } + + public Entity getEntity() { + return getSource().getEntity(); + } + + public String getInput() { + return getContext().getInput(); + } + + public Command getContextCommand() { + return getContext().getCommand(); + } + + public CommandContext getChild() { + return getContext().getChild(); + } + + public CommandContext getLastChild() { + return getContext().getLastChild(); + } + + public StringRange getRange() { + return getContext().getRange(); + } + + // Text + public void sendSuccess(Text message, boolean broadcastToOps) { + getSource().sendFeedback(() -> message, broadcastToOps); + } + + public void sendFailure(Text message) { + getSource().sendError(message); + } + + public void sendSuccess(Text message) { + sendSuccess(message, false); + } + + // String (Formatted) + public void sendSuccess(String message, boolean broadcastToOps) { + sendSuccess(TextUtil.convert(message), broadcastToOps); + } + + public void sendSuccess(String message) { + sendSuccess(message, false); + } + + public void sendFailure(String message) { + sendFailure(TextUtil.convert(message)); + } + + // Translatable + public void sendSuccessWithTranslatable(String message, boolean broadcastToOps) { + sendSuccess(TextUtil.convertWithTranslatable(message), broadcastToOps); + } + + public void sendSuccessWithTranslatable(String message) { + sendSuccessWithTranslatable(message, false); + } + + public void sendFailureWithTranslatable(String message) { + sendFailure(TextUtil.convertWithTranslatable(message)); + } + + // Raw + public void sendSuccessRaw(String message, boolean broadcastToOps) { + sendSuccess(TextUtil.literal(message), broadcastToOps); + } + + public void sendSuccessRaw(String message) { + sendSuccessRaw(message, false); + } + + public void sendFailureRaw(String message) { + sendFailure(TextUtil.literal(message)); + } + + public boolean isClient() { + return WorldUtil.isClient(getWorld()); + } + + public void sendSuccess(TextComponent message, boolean broadcastToOps) { + sendSuccess(message.getText(), broadcastToOps); + } + + public void sendSuccess(TextComponent message) { + sendSuccess(message.getText()); + } + + public void sendFailure(TextComponent message) { + sendFailure(message.getText()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java new file mode 100644 index 000000000..35042c8f6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event; + +import com.mojang.brigadier.arguments.StringArgumentType; +import net.pitan76.mcpitanlib.api.command.argument.StringCommand; + +public class StringCommandEvent extends RequiredCommandEvent { + public String getValue() { + return StringArgumentType.getString(context, ((StringCommand) getCommand()).getArgumentName()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java new file mode 100644 index 000000000..087efa37b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.Property; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.state.property.IProperty; +import net.pitan76.mcpitanlib.api.util.DirectionBoolPropertyUtil; + +public class AppendPropertiesArgs extends BaseEvent { + public StateManager.Builder builder; + + public AppendPropertiesArgs(StateManager.Builder builder) { + this.builder = builder; + } + + public StateManager.Builder getBuilder() { + return builder; + } + + public void addProperty(Property... properties) { + builder.add(properties); + } + + public void addProperty(IProperty... properties) { + for (IProperty property : properties) { + builder.add(property.getProperty()); + } + } + + public void addAllDirectionBoolProperties() { + DirectionBoolPropertyUtil.addProperties(this); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java new file mode 100644 index 000000000..a5351d2aa --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java @@ -0,0 +1,79 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class BlockBreakEvent extends BaseEvent { + public World world; + public BlockPos pos; + public BlockState state; + public Player player; + + public BlockBreakEvent(World world, BlockPos pos, BlockState state, PlayerEntity player) { + this.world = world; + this.pos = pos; + this.state = state; + this.player = new Player(player); + } + + public BlockPos getPos() { + return pos; + } + + public BlockState getState() { + return state; + } + + public Player getPlayer() { + return player; + } + + public PlayerEntity getPlayerEntity() { + return player.getPlayerEntity(); + } + + public World getWorld() { + return world; + } + + public boolean isClient() { + return world.isClient(); + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(getWorld(), getPos()); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public IWorldView getWorldView() { + return getMidohraWorld(); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); + } + + public BlockWrapper getBlockWrapper() { + return BlockWrapper.of(state.getBlock()); + } + + public BlockEntityWrapper getBlockEntityWrapper() { + return BlockEntityWrapper.of(getBlockEntity()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java new file mode 100644 index 000000000..c50170a81 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java @@ -0,0 +1,61 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; + +public class BlockBreakStartEvent extends BaseEvent { + + public BlockState state; + public World world; + public BlockPos pos; + public Player player; + + public BlockBreakStartEvent(BlockState state, World world, BlockPos pos, Player player) { + this.state = state; + this.world = world; + this.pos = pos; + this.player = player; + } + + public boolean isClient() { + return WorldUtil.isClient(world); + } + + public BlockState getState() { + return state; + } + + public World getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public Player getPlayer() { + return player; + } + + public BlockPos getPlayerPos() { + return player.getBlockPos(); + } + + public ItemStack getPlayerMainHandStack() { + return player.getMainHandStack(); + } + + public ItemStack getPlayerOffHandStack() { + return player.getOffHandStack(); + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(getWorld(), getPos()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java new file mode 100644 index 000000000..c0b365e0a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java @@ -0,0 +1,82 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class BlockPlacedEvent extends BaseEvent { + + public World world; + public BlockPos pos; + public BlockState state; + public LivingEntity placer; + public ItemStack stack; + + public BlockPlacedEvent(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + this.world = world; + this.pos = pos; + this.state = state; + this.placer = placer; + this.stack = itemStack; + } + + public BlockState getState() { + return state; + } + + public BlockPos getPos() { + return pos; + } + + public World getWorld() { + return world; + } + + public ItemStack getStack() { + return stack; + } + + public LivingEntity getPlacer() { + return placer; + } + + public boolean isClient() { + return world.isClient(); + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(getWorld(), getPos()); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public IWorldView getWorldView() { + return getMidohraWorld(); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); + } + + public BlockWrapper getBlockWrapper() { + return BlockWrapper.of(state.getBlock()); + } + + public BlockEntityWrapper getBlockEntityWrapper() { + return BlockEntityWrapper.of(getBlockEntity()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java new file mode 100644 index 000000000..f80420f5b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; + +public class BlockScheduledTickEvent extends BaseEvent implements BlockStatePropertyHolder { + public BlockState state; + public ServerWorld world; + public BlockPos pos; + public CompatRandom random; + + public BlockScheduledTickEvent(BlockState state, ServerWorld world, BlockPos pos, Random random) { + this.state = state; + this.world = world; + this.pos = pos; + this.random = new CompatRandom(random); + } + + public BlockState getState() { + return state; + } + + public BlockPos getPos() { + return pos; + } + + public ServerWorld getWorld() { + return world; + } + + public CompatRandom getRandom() { + return random; + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(getWorld(), getPos()); + } + + @Override + public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java new file mode 100644 index 000000000..9d3b86a2c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java @@ -0,0 +1,143 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class BlockUseEvent extends BaseEvent { + public BlockState state; + public World world; + public BlockPos pos; + public Player player; + public Hand hand; + public BlockHitResult hit; + public ItemStack stack; + + public BlockUseEvent(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + this.state = state; + this.world = world; + this.pos = pos; + this.player = new Player(player); + this.hand = hand; + this.hit = hit; + this.stack = this.player.getStackInHand(hand); + } + + public BlockHitResult getHit() { + return hit; + } + + public ItemStack getStack() { + return stack; + } + + public Player getPlayer() { + return player; + } + + public Hand getHand() { + return hand; + } + + public World getWorld() { + return world; + } + + public BlockState getState() { + return state; + } + + public BlockPos getPos() { + return pos; + } + + public boolean isClient() { + return world.isClient(); + } + + public CompatActionResult success() { + return CompatActionResult.SUCCESS; + } + + public CompatActionResult fail() { + return CompatActionResult.FAIL; + } + + public CompatActionResult pass() { + return CompatActionResult.PASS; + } + + public CompatActionResult consume() { + return CompatActionResult.CONSUME; + } + + /** + * check if the block has a block entity + * @return true if the block has a block entity + */ + public boolean hasBlockEntity() { + return WorldUtil.hasBlockEntity(world, pos); + } + + /** + * get the block entity of the block + * @return the block entity of the block + */ + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(world, pos); + } + + public boolean isSneaking() { + return player.isSneaking(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public IWorldView getWorldView() { + return getMidohraWorld(); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); + } + + public BlockWrapper getBlockWrapper() { + return BlockWrapper.of(state.getBlock()); + } + + public BlockEntityWrapper getBlockEntityWrapper() { + return BlockEntityWrapper.of(getBlockEntity()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java new file mode 100644 index 000000000..eb92b3f7f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.ai.pathing.NavigationType; +import net.minecraft.fluid.FluidState; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.FluidStateUtil; + +public class CanPathfindThroughArgs extends BaseEvent { + public BlockState state; + public NavigationType type; + + public CanPathfindThroughArgs(BlockState state, NavigationType type) { + this.state = state; + + this.type = type; + } + + public BlockState getState() { + return state; + } + + public NavigationType getType() { + return type; + } + + public FluidState getFluidState() { + return state.getFluidState(); + } + + public boolean isWaterNavigationType() { + return type == NavigationType.WATER; + } + + public boolean isAirNavigationType() { + return type == NavigationType.AIR; + } + + public boolean isLandNavigationType() { + return type == NavigationType.LAND; + } + + public boolean isWaterState() { + return FluidStateUtil.isWater(getFluidState()); + } + + public boolean isLavaState() { + return FluidStateUtil.isLava(getFluidState()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java new file mode 100644 index 000000000..43fab8bc5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java @@ -0,0 +1,13 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; + +public class CollisionShapeEvent extends OutlineShapeEvent { + + public CollisionShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + super(state, world, pos, context); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java new file mode 100644 index 000000000..b2d322b87 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.loot.context.LootContextParameters; +import net.minecraft.loot.context.LootWorldContext; +import net.pitan76.mcpitanlib.api.event.BaseEvent; + +public class DroppedStacksArgs extends BaseEvent { + public BlockState state; + public LootWorldContext.Builder builder; + + public DroppedStacksArgs(BlockState state, LootWorldContext.Builder builder) { + this.state = state; + this.builder = builder; + } + + public BlockState getState() { + return state; + } + + @Deprecated + public LootWorldContext.Builder getBuilder() { + return builder; + } + + public BlockEntity getBlockEntity() { + return builder.get(LootContextParameters.BLOCK_ENTITY); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java new file mode 100644 index 000000000..d5b17a6ba --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java @@ -0,0 +1,112 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCollisionHandler; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.SoundEventUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; + +import java.util.Optional; + +public class EntityCollisionEvent extends BaseEvent { + + public BlockState state; + public World world; + public BlockPos pos; + public Entity entity; + public EntityCollisionHandler handler; + public boolean bl = false; + + public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity) { + this.state = state; + this.world = world; + this.pos = pos; + this.entity = entity; + } + + public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { + this.state = state; + this.world = world; + this.pos = pos; + this.entity = entity; + this.handler = handler; + } + + public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler, boolean bl) { + this.state = state; + this.world = world; + this.pos = pos; + this.entity = entity; + this.handler = handler; + this.bl = bl; + } + + public boolean isClient() { + return WorldUtil.isClient(world); + } + + public BlockPos getEntityPos() { + return entity.getBlockPos(); + } + + public BlockPos getBlockPos() { + return pos; + } + + public BlockState getState() { + return state; + } + + public Entity getEntity() { + return entity; + } + + public World getWorld() { + return world; + } + + public void playSound(SoundEvent event, SoundCategory category, float volume, float pitch) { + WorldUtil.playSound(world, null, entity.getBlockPos(), event, category, volume, pitch); + } + + public void playSound(SoundEvent event, float volume, float pitch) { + playSound(event, SoundCategory.BLOCKS, volume, pitch); + } + + public void playSound(SoundEvent event) { + playSound(event, 1f, 1f); + } + + public void playSound(SoundEvent event, SoundCategory category) { + playSound(event, category, 1f, 1f); + } + + public void playSound(CompatIdentifier id, SoundCategory category, float volume, float pitch) { + playSound(SoundEventUtil.getSoundEvent(id), category, volume, pitch); + } + + public boolean hasPlayerEntity() { + return entity instanceof PlayerEntity; + } + + public Optional getPlayerEntity() { + if (!hasPlayerEntity()) return Optional.empty(); + return Optional.of((PlayerEntity) entity); + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(getWorld(), getBlockPos()); + } + + public EntityCollisionHandler getHandler() { + return handler; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java new file mode 100644 index 000000000..9bcda6872 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; + +public class FluidStateArgs { + public BlockState state; + + public FluidStateArgs(BlockState state) { + this.state = state; + } + + public BlockState getState() { + return state; + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java new file mode 100644 index 000000000..cb8c81462 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ItemScatterer; +import net.minecraft.util.collection.DefaultedList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public class ItemScattererUtil { + public static void spawn(World world, BlockPos pos, BlockEntity blockEntity) { + if (blockEntity instanceof Inventory) { + spawn(world, pos, (Inventory) blockEntity); + } + } + + public static void spawn(World world, BlockPos pos, Inventory inventory) { + ItemScatterer.spawn(world, pos, inventory); + } + + public static void spawn(World world, BlockPos pos, ItemStack stack) { + ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), stack); + } + + public static void spawn(World world, BlockPos pos, DefaultedList stacks) { + ItemScatterer.spawn(world, pos, stacks); + } + + public static void onStateReplaced(StateReplacedEvent e) { + onStateReplaced(e.getState(), e.getNewState(), e.getWorld(), e.getPos()); + } + + public static void onStateReplaced(BlockState state, BlockState newState, World world, BlockPos pos) { + ItemScatterer.onStateReplaced(state, world, pos); + } + + public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, ItemStack stack) { + spawn(world.getRaw(), pos.toMinecraft(), stack); + } + + public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, DefaultedList stacks) { + spawn(world.getRaw(), pos.toMinecraft(), stacks); + } + + public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, Inventory inventory) { + spawn(world.getRaw(), pos.toMinecraft(), inventory); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java new file mode 100644 index 000000000..4617ce6bc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java @@ -0,0 +1,98 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.block.WireOrientation; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import org.jetbrains.annotations.Nullable; + +public class NeighborUpdateEvent extends BaseEvent { + public BlockState state; + public World world; + public BlockPos pos; + public Block sourceBlock; + + @Nullable + public BlockPos sourcePos; + + @Nullable + public WireOrientation wireOrientation; + + public boolean notify; + + public NeighborUpdateEvent(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable BlockPos sourcePos, boolean notify) { + this.state = state; + this.world = world; + this.pos = pos; + this.sourceBlock = sourceBlock; + this.sourcePos = sourcePos; + this.notify = notify; + } + + public NeighborUpdateEvent(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) { + this(state, world, pos, sourceBlock, (BlockPos) null, notify); + this.wireOrientation = wireOrientation; + } + + public BlockState getState() { + return state; + } + + public World getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public Block getSourceBlock() { + return sourceBlock; + } + + public @Nullable BlockPos getSourcePos() { + return sourcePos; + } + + public boolean isNotify() { + return notify; + } + + public boolean isReceivingRedstonePower() { + return WorldUtil.isReceivingRedstonePower(world, pos); + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(world, pos); + } + + public boolean hasBlockEntity() { + return WorldUtil.hasBlockEntity(world, pos); + } + + @Deprecated + public @Nullable WireOrientation getWireOrientation() { + return wireOrientation; + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public BlockEntityWrapper getBlockEntityWrapper() { + return BlockEntityWrapper.of(getBlockEntity()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java new file mode 100644 index 000000000..7131ee630 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java @@ -0,0 +1,63 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.state.property.Property; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.state.property.IProperty; + +public class OutlineShapeEvent extends BaseEvent { + public BlockState state; + public BlockView world; + public BlockPos pos; + public ShapeContext context; + + public OutlineShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + this.state = state; + this.world = world; + this.pos = pos; + this.context = context; + } + + public BlockPos getPos() { + return pos; + } + + public BlockState getState() { + return state; + } + + public BlockView getWorld() { + return world; + } + + public ShapeContext getContext() { + return context; + } + + public > T getProperty(Property property) { + return state.get(property); + } + + public > boolean containsProperty(Property property) { + return state.contains(property); + } + + public , V extends T> BlockState with(Property property, V value) { + return state.with(property, value); + } + + public > T get(IProperty property) { + return getProperty(property.getProperty()); + } + + public > boolean contains(IProperty property) { + return containsProperty(property.getProperty()); + } + + public , V extends T> net.pitan76.mcpitanlib.midohra.block.BlockState with(IProperty property, V value) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(with(property.getProperty(), value)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java new file mode 100644 index 000000000..762907be8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java @@ -0,0 +1,93 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.minecraft.world.WorldView; +import org.jetbrains.annotations.Nullable; + +public class PickStackEvent { + + @Deprecated + public WorldView worldView; + + @Deprecated + public BlockView blockView; + + public BlockPos pos; + public BlockState state; + + public boolean includeData = true; + + public PickStackEvent(WorldView world, BlockPos pos, BlockState state) { + this.worldView = world; + this.pos = pos; + this.state = state; + } + + public PickStackEvent(BlockView world, BlockPos pos, BlockState state) { + this.blockView = world; + this.pos = pos; + this.state = state; + } + + public BlockState getState() { + return state; + } + + public BlockPos getPos() { + return pos; + } + + @Nullable + public BlockView getBlockView() { + return blockView; + } + + @Nullable + public WorldView getWorldView() { + return worldView; + } + + /** + * check if the block has a block entity + * @return boolean + */ + public boolean hasBlockEntity() { + return getBlockEntity() != null; + } + + /** + * @return BlockEntity + */ + public BlockEntity getBlockEntity() { + if (blockView != null) + return blockView.getBlockEntity(pos); + if (worldView != null) + return worldView.getBlockEntity(pos); + return null; + } + + public boolean isClient() { + if (blockView != null) + return getBlockEntity().getWorld().isClient(); + if (worldView != null) + return worldView.isClient(); + + try { + net.minecraft.client.MinecraftClient.getInstance(); + return true; + } catch (Error e) { + return false; + } + } + + public void setIncludeData(boolean includeData) { + this.includeData = includeData; + } + + public boolean isIncludeData() { + return includeData; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java new file mode 100644 index 000000000..63df37634 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java @@ -0,0 +1,125 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.property.Property; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; +import net.pitan76.mcpitanlib.api.state.property.IProperty; +import net.pitan76.mcpitanlib.api.util.BlockStateUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; +import org.jetbrains.annotations.Nullable; + +public class PlacementStateArgs extends BaseEvent { + public ItemPlacementContext ctx; + + @Nullable + public Block block; + + public PlacementStateArgs(ItemPlacementContext ctx) { + this.ctx = ctx; + } + + public PlacementStateArgs(ItemPlacementContext ctx, @Nullable Block block) { + this.ctx = ctx; + this.block = block; + } + + public boolean canPlace() { + return ctx.canPlace(); + } + + public BlockPos getPos() { + return ctx.getBlockPos(); + } + + public Player getPlayer() { + return new Player(ctx.getPlayer()); + } + + public Direction[] getPlacementDirections() { + return ctx.getPlacementDirections(); + } + + public Hand getHand() { + return ctx.getHand(); + } + + public Direction getSide() { + return ctx.getSide(); + } + + public Direction getHorizontalPlayerFacing() { + return ctx.getHorizontalPlayerFacing(); + } + + public float getPlayerYaw() { + return ctx.getPlayerYaw(); + } + + public World getWorld() { + return ctx.getWorld(); + } + + public boolean isClient() { + return getWorld().isClient(); + } + + public Vec3d getHitPos() { + return ctx.getHitPos(); + } + + public boolean canReplaceExisting() { + return ctx.canReplaceExisting(); + } + + @Deprecated + public ItemUsageContextMixin getIUCAccessor() { + return (ItemUsageContextMixin) ctx; + } + + public BlockHitResult getHitResult() { + return getIUCAccessor().getHit(); + } + + public ItemUseOnBlockEvent toItemUseOnBlockEvent() { + return new ItemUseOnBlockEvent(getWorld(), getPlayer().getPlayerEntity(), getHand(), ctx.getStack(), getHitResult()); + } + + public ItemPlacementContext getCtx() { + return ctx; + } + + public , V extends T> BlockState withBlockState(Property property, V value) { + if (block == null) + return null; + + return BlockStateUtil.with(BlockStateUtil.getDefaultState(block), property, value); + } + + public , V extends T> net.pitan76.mcpitanlib.midohra.block.BlockState with(IProperty property, V value) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(withBlockState(property.getProperty(), value)); + } + + public BlockState getBlockState() { + return BlockStateUtil.getDefaultState(block); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState()); + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(getWorld(), getPos()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java new file mode 100644 index 000000000..bc140e4cd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java @@ -0,0 +1,56 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; + +public class ScreenHandlerCreateEvent extends BaseEvent { + + public BlockState state; + public World world; + public BlockPos pos; + public int syncId; + public PlayerInventory inventory; + public Player player; + + public ScreenHandlerCreateEvent(BlockState state, World world, BlockPos pos, int syncId, PlayerInventory inventory, PlayerEntity player) { + this.state = state; + this.world = world; + this.pos = pos; + this.syncId = syncId; + this.inventory = inventory; + this.player = new Player(player); + } + + public BlockState getState() { + return state; + } + + public BlockPos getPos() { + return pos; + } + + public World getWorld() { + return world; + } + + public int getSyncId() { + return syncId; + } + + public PlayerInventory getInventory() { + return inventory; + } + + public Player getPlayer() { + return player; + } + + public boolean isClient() { + return world.isClient(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java new file mode 100644 index 000000000..75cacef6a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.util.shape.VoxelShape; + +import java.util.function.Function; + +public class ShapesForStatesArgs { + public Function stateToShape; + + public ShapesForStatesArgs(Function stateToShape) { + this.stateToShape = stateToShape; + } + + public Function getStateToShape() { + return stateToShape; + } + + public VoxelShape getShape(BlockState state) { + return stateToShape.apply(state); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java new file mode 100644 index 000000000..034355d4c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java @@ -0,0 +1,86 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.WorldAccess; +import net.minecraft.world.WorldView; +import net.minecraft.world.tick.ScheduledTickView; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; + +public class StateForNeighborUpdateArgs { + public BlockState state; + public Direction direction; + public BlockState neighborState; + public WorldView world; + public BlockPos pos; + public BlockPos neighborPos; + public ScheduledTickView tickView; + public CompatRandom random; + + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + this.state = state; + this.direction = direction; + this.neighborState = neighborState; + this.world = world; + this.pos = pos; + this.neighborPos = neighborPos; + } + + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldView world, BlockPos pos, BlockPos neighborPos, ScheduledTickView tickView, CompatRandom random) { + this.state = state; + this.direction = direction; + this.neighborState = neighborState; + this.world = world; + this.pos = pos; + this.neighborPos = neighborPos; + this.tickView = tickView; + this.random = random; + } + + public BlockState getState() { + return state; + } + + public BlockEntity getBlockEntity() { + return world.getBlockEntity(pos); + } + + public BlockState getBlockState(BlockPos pos) { + return world.getBlockState(pos); + } + + public BlockEntity getBlockEntity(BlockPos pos) { + return world.getBlockEntity(pos); + } + + public Direction getDirection() { + return direction; + } + + public BlockState getNeighborState() { + return neighborState; + } + + public WorldView getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public BlockPos getNeighborPos() { + return neighborPos; + } + + public CompatRandom getRandom() { + return random; + } + + @Deprecated + public ScheduledTickView getTickView() { + return tickView; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java new file mode 100644 index 000000000..4be061fb6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java @@ -0,0 +1,132 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class StateReplacedEvent extends BaseEvent { + + public BlockState state; + public World world; + public BlockPos pos; + public BlockState newState; + public boolean moved; + + // Captured at construction time so getBlockEntity() works even after the world (1.21.x) + private final BlockEntity cachedBlockEntity; + + public StateReplacedEvent(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { + this.state = state; + this.world = world; + this.pos = pos; + this.newState = newState; + this.moved = moved; + + this.cachedBlockEntity = WorldUtil.hasBlockEntity(world, pos) ? WorldUtil.getBlockEntity(world, pos) : null; + } + + public BlockState getState() { + return state; + } + + public World getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public BlockState getNewState() { + return newState; + } + + public boolean isMoved() { + return moved; + } + + public boolean isClient() { + return world.isClient(); + } + + /** + * check if the block is the same state + * @return boolean + */ + public boolean isSameState() { + return state.isOf(newState.getBlock()); + } + + /** + * check if the block has a block entity + * @return boolean + */ + public boolean hasBlockEntity() { + return getBlockEntity() != null; + } + + /** + * get the block entity + *

+ * The block entity is captured at event creation time, so this returns a valid + * reference even in MC 1.21.x where the world removes the BE before + * onStateReplaced is invoked. + * @return BlockEntity + */ + public BlockEntity getBlockEntity() { + if (cachedBlockEntity != null) return cachedBlockEntity; + return WorldUtil.getBlockEntity(world, pos); + } + + /** + * spawn the drops in the container + */ + public void spawnDropsInContainer() { + if (isSameState() || !hasInventory()) return; + + ItemScattererUtil.spawn(getWorld(), getPos(), getBlockEntity()); + updateComparators(); + } + + public boolean hasInventory() { + return getBlockEntity() instanceof Inventory; + } + + /** + * update the comparators + */ + public void updateComparators() { + WorldUtil.updateComparators(getWorld(), getPos(), getState().getBlock()); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public IWorldView getWorldView() { + return getMidohraWorld(); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(state); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(pos); + } + + public BlockWrapper getBlockWrapper() { + return BlockWrapper.of(state.getBlock()); + } + + public BlockEntityWrapper getBlockEntityWrapper() { + return BlockEntityWrapper.of(getBlockEntity()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java new file mode 100644 index 000000000..ff0ad3ed9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java @@ -0,0 +1,66 @@ +package net.pitan76.mcpitanlib.api.event.block; + +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; +import net.pitan76.mcpitanlib.api.event.BaseEvent; + +public class TileCreateEvent extends BaseEvent { + + // ~1.16.5 + private BlockView blockView; + + public TileCreateEvent(BlockView blockView) { + this.blockView = blockView; + this.blockPos = null; + this.blockState = null; + } + + public BlockView getBlockView() { + return blockView; + } + + public void setBlockView(BlockView blockView) { + this.blockView = blockView; + } + + public boolean hasBlockView() { + return (blockView != null); + } + // ---- + + // 1.17~ + private BlockPos blockPos; + private BlockState blockState; + + public TileCreateEvent(BlockPos blockPos, BlockState blockState) { + this.blockView = null; + this.blockPos = blockPos; + this.blockState = blockState; + } + + public BlockPos getBlockPos() { + return blockPos; + } + + public void setBlockPos(BlockPos blockPos) { + this.blockPos = blockPos; + } + + public boolean hasBlockPos() { + return (blockPos != null); + } + + public BlockState getBlockState() { + return blockState; + } + + public void setBlockState(BlockState blockState) { + this.blockState = blockState; + } + + public boolean hasBlockState() { + return (blockState != null); + } + // ---- +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java new file mode 100644 index 000000000..4973eee09 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.event.block.result; + +import net.minecraft.block.BlockState; + +public class BlockBreakResult { + public BlockState state; + + public BlockBreakResult(BlockState state) { + this.state = state; + } + + public BlockState getState() { + return state; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java new file mode 100644 index 000000000..b82cfe48a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java @@ -0,0 +1,9 @@ +package net.pitan76.mcpitanlib.api.event.container.factory; + +import net.pitan76.mcpitanlib.api.event.BaseEvent; + +public class DisplayNameArgs extends BaseEvent { + public DisplayNameArgs() { + super(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java new file mode 100644 index 000000000..2b8c2d729 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.api.event.container.factory; + +import net.minecraft.network.PacketByteBuf; +import net.minecraft.server.network.ServerPlayerEntity; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; + +public class ExtraDataArgs extends BaseEvent { + public PacketByteBuf buf; + public ServerPlayerEntity player; + + public ExtraDataArgs(PacketByteBuf buf, ServerPlayerEntity player) { + super(); + this.buf = buf; + this.player = player; + } + + public ExtraDataArgs() { + super(); + } + + public ExtraDataArgs(PacketByteBuf buf) { + super(); + this.buf = buf; + } + + public boolean hasPlayer() { + return player != null; + } + + public boolean hasBuf() { + return buf != null; + } + + public PacketByteBuf getBuf() { + return buf; + } + + public ServerPlayerEntity getPlayer() { + return player; + } + + public Player getCompatPlayer() { + return new Player(player); + } + + /** + * @param obj The object to write + * @see PacketByteUtil#writeVar(PacketByteBuf, Object) + */ + public void writeVar(Object obj) { + PacketByteUtil.writeVar(getBuf(), obj); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java new file mode 100644 index 000000000..0ea55b691 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.event.entity; + +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.Vec3d; +import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; + +public class CollisionEvent { + + public HitResult hitResult; + + public CollisionEvent(HitResult hitResult) { + this.hitResult = hitResult; + } + + public HitResult getHitResult() { + return hitResult; + } + + public HitResult.Type getType() { + return hitResult.getType(); + } + + public Vec3d getPos() { + return hitResult.getPos(); + } + + public net.pitan76.mcpitanlib.midohra.util.hit.HitResult getHitResultM() { + return net.pitan76.mcpitanlib.midohra.util.hit.HitResult.of(getHitResult()); + } + + public HitResultType getHitResultTypeM() { + return HitResultType.from(getType()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java new file mode 100644 index 000000000..048b496ed --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.event.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.util.hit.HitResult; + +public class EntityHitEvent { + + public EntityHitResult entityHitResult; + + public EntityHitEvent(EntityHitResult result) { + this.entityHitResult = result; + } + + public EntityHitResult getEntityHitResult() { + return entityHitResult; + } + + public Entity getEntity() { + return entityHitResult.getEntity(); + } + + public HitResult.Type getType() { + return entityHitResult.getType(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java new file mode 100644 index 000000000..875b6a939 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.api.event.entity; + +import net.minecraft.entity.data.DataTracker; +import net.minecraft.entity.data.TrackedData; +import org.jetbrains.annotations.Nullable; + +public class InitDataTrackerArgs { + public DataTracker.Builder builder; + public DataTracker tracker; + + public InitDataTrackerArgs(DataTracker.Builder builder) { + this.builder = builder; + } + + public InitDataTrackerArgs(DataTracker tracker) { + this.tracker = tracker; + } + + public InitDataTrackerArgs(DataTracker.Builder builder, @Nullable DataTracker tracker) { + this.builder = builder; + this.tracker = tracker; + } + + public DataTracker.Builder getBuilder() { + return builder; + } + + public DataTracker.Builder add(TrackedData data, T value) { + return builder.add(data, value); + } + + public void set(TrackedData data, T value) { + tracker.set(data, value); + } + + public void addTracking(TrackedData data, T value) { + if (builder != null) { + add(data, value); + return; + } + + if (tracker != null) { + set(data, value); + return; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java new file mode 100644 index 000000000..769b66b63 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.damage.DamageSource; + +public class BonusAttackDamageArgs { + + public Entity target; + public float baseAttackDamage; + public DamageSource damageSource; + + public BonusAttackDamageArgs(Entity target, float baseAttackDamage, DamageSource damageSource) { + this.target = target; + this.baseAttackDamage = baseAttackDamage; + this.damageSource = damageSource; + } + + public Entity getTarget() { + return target; + } + + public float getBaseAttackDamage() { + return baseAttackDamage; + } + + public DamageSource getDamageSource() { + return damageSource; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java new file mode 100644 index 000000000..8456d4488 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java @@ -0,0 +1,76 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.WorldUtil; + +public class CanMineArgs { + public BlockState state; + public World world; + public BlockPos pos; + + @Deprecated + public Player miner; + + @Deprecated + public ItemStack stack; + + public LivingEntity entity; + + public CanMineArgs(BlockState state, World world, BlockPos pos, PlayerEntity miner) { + this.state = state; + this.world = world; + this.pos = pos; + this.miner = new Player(miner); + this.entity = miner; + } + + public CanMineArgs(ItemStack stack, BlockState state, World world, BlockPos pos, LivingEntity entity) { + this.stack = stack; + this.state = state; + this.world = world; + this.pos = pos; + this.entity = entity; + + if (entity instanceof PlayerEntity) { + this.miner = new Player((PlayerEntity) entity); + } + } + + public BlockState getState() { + return state; + } + + public World getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public Player getMiner() { + return miner; + } + + public boolean isExistMiner() { + return miner.getEntity() != null; + } + + public boolean isClient() { + return WorldUtil.isClient(world); + } + + public ItemStack getStack() { + return stack != null ? stack : entity.getMainHandStack(); + } + + public LivingEntity getEntity() { + return entity; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java new file mode 100644 index 000000000..2bd98d890 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.event.BaseEvent; + +public class CanRepairArgs extends BaseEvent { + public ItemStack stack; + public ItemStack ingredient; + + public CanRepairArgs(ItemStack stack, ItemStack ingredient) { + this.stack = stack; + this.ingredient = ingredient; + } + + public ItemStack getStack() { + return stack; + } + + public ItemStack getIngredient() { + return ingredient; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java new file mode 100644 index 000000000..a80abdbba --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import org.jetbrains.annotations.Nullable; + +public class CraftEvent { + + public ItemStack stack; + public World world; + public Player player; + + public CraftEvent(ItemStack stack, World world, Player player) { + this.stack = stack; + this.world = world; + this.player = player; + } + + public CraftEvent(ItemStack stack, World world, PlayerEntity player) { + this.stack = stack; + this.world = world; + this.player = new Player(player); + } + + public CraftEvent(ItemStack stack, World world) { + this.stack = stack; + this.world = world; + } + + public ItemStack getStack() { + return stack; + } + + public World getWorld() { + return world; + } + + @Nullable + public Player getPlayer() { + return player; + } + + public boolean isClient() { + return world.isClient(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java new file mode 100644 index 000000000..17392a835 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java @@ -0,0 +1,7 @@ +package net.pitan76.mcpitanlib.api.event.item; + +public class EnchantabilityArgs { + public EnchantabilityArgs() { + + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java new file mode 100644 index 000000000..d466f2a51 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.item.ItemStack; + +public class EnchantableArgs { + + public ItemStack stack; + + public EnchantableArgs(ItemStack stack) { + this.stack = stack; + } + + public ItemStack getStack() { + return stack; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java new file mode 100644 index 000000000..58b0913e9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java @@ -0,0 +1,81 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.entity.EquipmentSlotUtil; +import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; + +public class InventoryTickEvent extends BaseEvent { + public ItemStack stack; + public World world; + public Entity entity; + public int slot; + public boolean selected; + public EquipmentSlot equipmentSlot; + + public InventoryTickEvent(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + this.stack = stack; + this.world = world; + this.entity = entity; + this.slot = slot; + this.selected = selected; + this.equipmentSlot = EquipmentSlotUtil.fromEntitySlotId(slot); + } + + public InventoryTickEvent(ItemStack stack, ServerWorld world, Entity entity, EquipmentSlot slot) { + this(stack, world, entity, EquipmentSlotUtil.getEntitySlotId(slot), isSelected(entity, slot, stack)); + this.equipmentSlot = slot; + } + + private static boolean isSelected(Entity entity, EquipmentSlot slot, ItemStack stack) { + if (entity instanceof LivingEntity) { + LivingEntity livingEntity = (LivingEntity) entity; + ItemStack equippedStack = LivingEntityUtil.getEquippedStack(livingEntity, slot); + return equippedStack.isOf(stack.getItem()) && equippedStack.getCount() == stack.getCount(); + } else { + return false; + } + } + + public ItemStack getStack() { + return stack; + } + + public World getWorld() { + return world; + } + + public boolean isServer() { + return !isClient(); + } + + public ServerWorld getServerWorld() { + return (ServerWorld) world; + } + + public Entity getEntity() { + return entity; + } + + public int getSlot() { + return slot; + } + + public boolean isSelected() { + return selected; + } + + public boolean isClient() { + return WorldUtil.isClient(world); + } + + public EquipmentSlot getEquipmentSlot() { + return equipmentSlot; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java new file mode 100644 index 000000000..e695b5369 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java @@ -0,0 +1,100 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.component.type.TooltipDisplayComponent; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +public class ItemAppendTooltipEvent extends BaseEvent { + public ItemStack stack; + + @Deprecated + public World world; + + @Deprecated + public List tooltip; + + public TooltipType type; + public Item.TooltipContext context; + + public TooltipDisplayComponent displayComponent; + public Consumer textConsumer; + + public ItemAppendTooltipEvent(ItemStack stack, @Nullable World world, List tooltip, TooltipType type, Item.TooltipContext context) { + this.stack = stack; + this.world = world; + this.tooltip = tooltip; + this.type = type; + this.context = context; + } + + public ItemAppendTooltipEvent(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + this.stack = stack; + this.context = context; + this.displayComponent = displayComponent; + this.textConsumer = textConsumer; + this.type = type; + } + + public ItemStack getStack() { + return stack; + } + + public World getWorld() { + return world; + } + + public List getTooltip() { + return new ArrayList<>(); + } + + public Item.TooltipContext getContext() { + return context; + } + + public void addTooltip(Text text) { + textConsumer.accept(text); + } + + public void addTooltip(List texts) { + for (Text text : texts) { + addTooltip(text); + } + } + + public boolean removeTooltip(Text text) { + return false; + } + + public boolean isCreative() { + return type.isCreative(); + } + + public boolean isAdvanced() { + return type.isAdvanced(); + } + + public CompatRegistryLookup getRegistryLookup() { + return RegistryLookupUtil.getRegistryLookup(this); + } + + public void addTooltip(TextComponent textComponent) { + addTooltip(textComponent.getText()); + } + + public void addTooltip(String text) { + addTooltip(TextUtil.literal(text)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java new file mode 100644 index 000000000..aae12a9a0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.item.ItemStack; + +public class ItemBarColorArgs { + + public ItemStack stack; + + public ItemBarColorArgs(ItemStack stack) { + this.stack = stack; + } + + public ItemStack getStack() { + return stack; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java new file mode 100644 index 000000000..86742fa45 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.item.ItemStack; + +public class ItemBarStepArgs { + + public ItemStack stack; + + public ItemBarStepArgs(ItemStack stack) { + this.stack = stack; + } + + public ItemStack getStack() { + return stack; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java new file mode 100644 index 000000000..509bb4634 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.item.ItemStack; + +public class ItemBarVisibleArgs { + + public ItemStack stack; + + public ItemBarVisibleArgs(ItemStack stack) { + this.stack = stack; + } + + public ItemStack getStack() { + return stack; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java new file mode 100644 index 000000000..6aa476db8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java @@ -0,0 +1,52 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +public class ItemFinishUsingEvent extends BaseEvent { + public ItemStack stack; + public World world; + public LivingEntity user; + + public ItemFinishUsingEvent(ItemStack stack, World world, LivingEntity user) { + this.stack = stack; + this.world = world; + this.user = user; + } + + public ItemStack getStack() { + return stack; + } + + public World getWorld() { + return world; + } + + public LivingEntity getUser() { + return user; + } + + public boolean isClient() { + return world.isClient(); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public net.pitan76.mcpitanlib.midohra.world.World getWorldM() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java new file mode 100644 index 000000000..2f76d9aa6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java @@ -0,0 +1,124 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.StackActionResult; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class ItemUseEvent extends BaseEvent { + + public World world; + public Player user; + public Hand hand; + public ItemStack stack; + + public ItemUseEvent(World world, PlayerEntity user, Hand hand) { + this.world = world; + this.user = new Player(user); + this.hand = hand; + this.stack = user.getStackInHand(hand); + } + + public ItemStack getStack() { + return stack; + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public Hand getHand() { + return hand; + } + + public World getWorld() { + return world; + } + + public Player getUser() { + return user; + } + + public boolean isClient() { + return world.isClient(); + } + + public StackActionResult success(ItemStack stack) { + if (getStack() != stack) + StackActionResult.success(stack); + + return success(); + } + + public StackActionResult success(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return success(stack.toMinecraft()); + } + + public StackActionResult success() { + return StackActionResult.create(CompatActionResult.SUCCESS); + } + + public StackActionResult fail() { + return StackActionResult.fail(); + } + + public StackActionResult fail(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return StackActionResult.fail(stack.toMinecraft()); + } + + public StackActionResult pass() { + return StackActionResult.pass(); + } + + public StackActionResult pass(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return StackActionResult.pass(stack.toMinecraft()); + } + + public StackActionResult consume(ItemStack stack) { + if (getStack() != stack) + StackActionResult.consume(stack); + + return consume(); + } + + public CompatActionResult consume(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return consume(stack.toMinecraft()); + } + + public StackActionResult consume() { + return StackActionResult.create(CompatActionResult.CONSUME); + } + + public boolean isSneaking() { + return user.isSneaking(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public IWorldView getWorldView() { + return getMidohraWorld(); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java new file mode 100644 index 000000000..06e5b9c6b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java @@ -0,0 +1,158 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; +import org.jetbrains.annotations.Nullable; + +public class ItemUseOnBlockEvent extends BaseEvent { + public Player player; + public Hand hand; + public BlockHitResult hit; + public ItemStack stack; + public World world; + public BlockPos blockPos; + + public ItemUseOnBlockEvent(PlayerEntity player, Hand hand, BlockHitResult hit) { + this(player.getEntityWorld(), player, hand, player.getStackInHand(hand), hit); + } + + public ItemUseOnBlockEvent(World world, @Nullable PlayerEntity player, Hand hand, ItemStack stack, BlockHitResult hit) { + if (player != null) + this.player = new Player(player); + this.hand = hand; + this.hit = hit; + this.stack = stack; + this.world = world; + this.blockPos = hit.getBlockPos(); + } + + public ItemUseOnBlockEvent(Player player, Hand hand, BlockHitResult hit) { + this(player.getWorld(), player.getEntity(), hand, player.getStackInHand(hand), hit); + } + + public ItemUsageContext toIUC() { + return new ItemUsageContext(player.getPlayerEntity(), hand, hit); + } + + public boolean isClient() { + return world.isClient(); + } + + public Player getPlayer() { + return player; + } + + public World getWorld() { + return world; + } + + public BlockHitResult getHit() { + return hit; + } + + public BlockPos getBlockPos() { + return blockPos; + } + + public Hand getHand() { + return hand; + } + + public ItemStack getStack() { + return stack; + } + + public CompatActionResult success() { + return CompatActionResult.SUCCESS; + } + + public CompatActionResult fail() { + return CompatActionResult.FAIL; + } + + public CompatActionResult pass() { + return CompatActionResult.PASS; + } + + public CompatActionResult consume() { + return CompatActionResult.CONSUME; + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(world, blockPos); + } + + public boolean hasBlockEntity() { + return WorldUtil.hasBlockEntity(world, blockPos); + } + + public BlockState getBlockState() { + return WorldUtil.getBlockState(world, blockPos); + } + + public Vec3d getPos() { + return hit.getPos(); + } + + public Direction getSide() { + return hit.getSide(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public IWorldView getWorldView() { + return getMidohraWorld(); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getBlockPos()); + } + + public BlockWrapper getBlockWrapper() { + return getMidohraState().getBlock(); + } + + public BlockEntityWrapper getBlockEntityWrapper() { + return BlockEntityWrapper.of(getBlockEntity()); + } + + public boolean isSneaking() { + return player.isSneaking(); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java new file mode 100644 index 000000000..e2675e4db --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java @@ -0,0 +1,85 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +public class ItemUseOnEntityEvent extends BaseEvent { + + public ItemStack stack; + public Player user; + public LivingEntity entity; + public Hand hand; + + public ItemUseOnEntityEvent(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + this.stack = stack; + this.user = new Player(user); + this.hand = hand; + this.entity = entity; + } + + public ItemUseOnEntityEvent(ItemStack stack, Player user, LivingEntity entity, Hand hand) { + this.stack = stack; + this.user = user; + this.hand = hand; + this.entity = entity; + } + + public ItemStack getStack() { + return stack; + } + + public Hand getHand() { + return hand; + } + + public Player getUser() { + return user; + } + + public LivingEntity getEntity() { + return entity; + } + + public boolean isClient() { + return user.isClient(); + } + + public CompatActionResult success() { + return CompatActionResult.SUCCESS; + } + + public CompatActionResult fail() { + return CompatActionResult.FAIL; + } + + public CompatActionResult pass() { + return CompatActionResult.PASS; + } + + public CompatActionResult consume() { + return CompatActionResult.CONSUME; + } + + public boolean isSneaking() { + return user.isSneaking(); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public Item getItem() { + return stack.getItem(); + } + + public ItemWrapper getItemWrapper() { + return ItemWrapper.of(getItem()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java new file mode 100644 index 000000000..1f5083152 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.event.BaseEvent; + +public class PostHitEvent extends BaseEvent { + public ItemStack stack; + public LivingEntity target; + public LivingEntity attacker; + + public PostHitEvent(ItemStack stack, LivingEntity target, LivingEntity attacker) { + this.stack = stack; + this.target = target; + this.attacker = attacker; + } + + public ItemStack getStack() { + return stack; + } + + public LivingEntity getAttacker() { + return attacker; + } + + public LivingEntity getTarget() { + return target; + } + + /** + * Damages the stack in the given slot + * @param amount the amount of damage to deal + * @param slot the slot to damage + */ + public void damageStack(int amount, EquipmentSlot slot) { + stack.damage(amount, attacker, slot); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java new file mode 100644 index 000000000..73ca209bc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java @@ -0,0 +1,118 @@ +package net.pitan76.mcpitanlib.api.event.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.BlockUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; + +public class PostMineEvent extends BaseEvent { + public ItemStack stack; + public World world; + public BlockState state; + public BlockPos pos; + public LivingEntity miner; + + public PostMineEvent(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + this.stack = stack; + this.world = world; + this.state = state; + this.pos = pos; + this.miner = miner; + } + + public BlockState getState() { + return state; + } + + public BlockPos getPos() { + return pos; + } + + public World getWorld() { + return world; + } + + public ItemStack getStack() { + return stack; + } + + public LivingEntity getMiner() { + return miner; + } + + public BlockEntity getBlockEntity() { + return WorldUtil.getBlockEntity(world, pos); + } + + public boolean isClient() { + return world.isClient(); + } + + public boolean stateIsIn(TagKey tagKey) { + return BlockUtil.isIn(state.getBlock(), tagKey); + } + + public boolean stateIsOf(Block block) { + return BlockUtil.isEqual(state.getBlock(), block); + } + + /** + * Damages the stack in the given slot + * @param amount the amount of damage to deal + * @param slot the slot to damage + */ + public void damageStack(int amount, EquipmentSlot slot) { + stack.damage(amount, miner, slot); + } + + /** + * Damages the stack in the given slot + * @param amount the amount of damage to deal + * @param type the type of armor equipment + */ + public void damageStack(int amount, ArmorEquipmentType type) { + stack.damage(amount, miner, type.getSlot()); + } + + /** + * Damages the stack in the main hand + * @param amount the amount of damage to deal + */ + public void damageStack(int amount) { + stack.damage(amount, miner, EquipmentSlot.MAINHAND); + } + + public boolean isPlayer() { + return miner instanceof PlayerEntity; + } + + public Player getPlayer() { + if (isPlayer()) + return new Player((PlayerEntity) miner); + + return null; + } + + public boolean isCreative() { + return isPlayer() && getPlayer().isCreative(); + } + + public boolean isSneaking() { + return miner.isSneaking(); + } + + public ItemStack getMainHandStack() { + return miner.getMainHandStack(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java new file mode 100644 index 000000000..7f935aa41 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java @@ -0,0 +1,64 @@ +package net.pitan76.mcpitanlib.api.event.nbt; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.RegistryWrapper; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; + +public class NbtRWArgs { + public NbtCompound nbt; + public CompatRegistryLookup registryLookup; + + public NbtRWArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { + this.nbt = nbt; + this.registryLookup = registryLookup; + } + + @Deprecated + public NbtRWArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { + this(nbt, new CompatRegistryLookup(wrapperLookup)); + } + + public NbtRWArgs(NbtCompound nbt) { + this(nbt, (CompatRegistryLookup) null); + } + + public NbtCompound getNbt() { + return nbt; + } + + public CompatRegistryLookup getRegistryLookup() { + return registryLookup; + } + + public boolean hasRegistryLookup() { + return registryLookup != null; + } + + @Deprecated + public RegistryWrapper.WrapperLookup getWrapperLookup() { + if (registryLookup == null) + registryLookup = new CompatRegistryLookup(); + + return registryLookup.getRegistryLookup(); + } + + public boolean isNbtEmpty() { + return nbt != null && !nbt.isEmpty(); + } + + public boolean isViewEmpty() { + return false; + } + + public boolean isEmpty() { + return isNbtEmpty() || isViewEmpty(); + } + + public NbtRWArgs copy() { + return new NbtRWArgs(nbt.copy(), registryLookup); + } + + public net.pitan76.mcpitanlib.midohra.nbt.NbtCompound getNbtM() { + return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(nbt); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java new file mode 100644 index 000000000..70f6e57a3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.api.event.nbt; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.RegistryWrapper; +import net.minecraft.storage.NbtReadView; +import net.minecraft.storage.ReadView; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; + +public class ReadNbtArgs extends NbtRWArgs { + @Deprecated + public ReadView view; + + @Deprecated + public ReadNbtArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { + super(nbt, wrapperLookup); + } + + public ReadNbtArgs(NbtCompound nbt) { + super(nbt); + if (registryLookup == null) + registryLookup = new CompatRegistryLookup(); + view = NbtDataConverter.nbt2readData(nbt, registryLookup); + } + + public ReadNbtArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { + super(nbt, registryLookup); + view = NbtDataConverter.nbt2readData(nbt, registryLookup); + } + + @Deprecated + public ReadNbtArgs(NbtCompound nbt, ReadView view) { + this(nbt); + this.view = view; + } + + @Deprecated + public ReadNbtArgs(NbtCompound nbt, ReadView view, CompatRegistryLookup registryLookup) { + this(nbt, registryLookup); + this.view = view; + } + + @Override + public boolean isViewEmpty() { + return view == null; + } + + @Override + public NbtRWArgs copy() { + return new ReadNbtArgs(nbt.copy(), view, registryLookup); + } + + public ReadNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, CompatRegistryLookup registryLookup) { + this(nbt.toMinecraft(), registryLookup); + } + + public ReadNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { + this(nbt.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java new file mode 100644 index 000000000..1403f1bb9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.api.event.nbt; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.RegistryWrapper; +import net.minecraft.storage.WriteView; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; + +public class WriteNbtArgs extends NbtRWArgs { + @Deprecated + public WriteView view; + + @Deprecated + public WriteNbtArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { + super(nbt, wrapperLookup); + } + + public WriteNbtArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { + super(nbt, registryLookup); + view = NbtDataConverter.nbt2writeData(nbt, registryLookup); + } + + public WriteNbtArgs(NbtCompound nbt) { + super(nbt); + view = NbtDataConverter.nbt2writeData(nbt, (CompatRegistryLookup) null); + } + + @Deprecated + public WriteNbtArgs(NbtCompound nbt, WriteView view) { + this(nbt); + this.view = view; + } + + @Deprecated + public WriteNbtArgs(NbtCompound nbt, WriteView view, CompatRegistryLookup registryLookup) { + this(nbt, registryLookup); + this.view = view; + } + + @Override + public boolean isViewEmpty() { + return view == null; + } + + @Override + public NbtRWArgs copy() { + return new WriteNbtArgs(nbt.copy(), view, registryLookup); + } + + public WriteNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, CompatRegistryLookup registryLookup) { + this(nbt.toMinecraft(), registryLookup); + } + + public WriteNbtArgs(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { + this(nbt.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java new file mode 100644 index 000000000..67dcae814 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.event.result; + +import net.minecraft.util.ActionResult; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; + +public class EventResult { + + protected final dev.architectury.event.EventResult result; + + private static final EventResult TRUE = new EventResult(dev.architectury.event.EventResult.interruptTrue()); + private static final EventResult STOP = new EventResult(dev.architectury.event.EventResult.interruptDefault()); + private static final EventResult PASS = new EventResult(dev.architectury.event.EventResult.pass()); + private static final EventResult FALSE = new EventResult(dev.architectury.event.EventResult.interruptFalse()); + + + protected EventResult(dev.architectury.event.EventResult result) { + this.result = result; + } + + public static EventResult success() { + return TRUE; + } + + public static EventResult stop() { + return STOP; + } + + public static EventResult pass() { + return PASS; + } + + public static EventResult fail() { + return FALSE; + } + + @Deprecated + public dev.architectury.event.EventResult getResult() { + return result; + } + + public ActionResult toActionResult() { + return result.asMinecraft(); + } + + public CompatActionResult toCompatActionResult() { + return CompatActionResult.create(toActionResult()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java new file mode 100644 index 000000000..dacb8ca36 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.api.event.result; + +import dev.architectury.event.CompoundEventResult; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; + +public class TypedEventResult { + protected final dev.architectury.event.CompoundEventResult result; + + protected TypedEventResult(dev.architectury.event.CompoundEventResult result) { + this.result = result; + } + + public static TypedEventResult success(T value) { + return new TypedEventResult<>(CompoundEventResult.interruptTrue(value)); + } + + public static TypedEventResult stop(T value) { + return new TypedEventResult<>(CompoundEventResult.interruptDefault(value)); + } + + public static TypedEventResult pass() { + return new TypedEventResult<>(CompoundEventResult.pass()); + } + + public static TypedEventResult fail(T value) { + return new TypedEventResult<>(CompoundEventResult.interruptFalse(value)); + } + + @Deprecated + public dev.architectury.event.CompoundEventResult getResult() { + return result; + } + + public ActionResult toActionResult() { + return result.result().asMinecraft(); + } + + public CompatActionResult toCompatActionResult() { + return CompatActionResult.of(result.result().asMinecraft()); + } + + public CompatActionResult toCompatActionResult(ItemStack stack) { + if (result.object() != stack) + return toCompatActionResult(); + + if (toActionResult() instanceof ActionResult.Success) { + ActionResult.Success success = (ActionResult.Success) toActionResult(); + + return CompatActionResult.create(success.withNewHandStack(stack)); + } + + return toCompatActionResult(); + } + + public CompatActionResult toCompatActionResult(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return toCompatActionResult(stack.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java new file mode 100644 index 000000000..4dea5f138 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java @@ -0,0 +1,92 @@ +package net.pitan76.mcpitanlib.api.event.tile; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; + +public class TileTickEvent implements BlockStatePropertyHolder { + public World world; + public BlockPos pos; + public BlockState state; + public T blockEntity; + + public TileTickEvent(World world, BlockPos pos, BlockState state, T blockEntity) { + this.world = world; + this.pos = pos; + this.state = state; + this.blockEntity = blockEntity; + } + + public boolean isClient() { + return world.isClient(); + } + + public boolean isServer() { + return !isClient(); + } + + public boolean hasWorld() { + return world != null; + } + + public World getWorld() { + return world; + } + + public BlockPos getPos() { + return pos; + } + + public BlockState getState() { + if (state == null) + state = getWorldView().getBlockState(getPos()); + + return state; + } + + public T getBlockEntity() { + return blockEntity; + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getPos()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraState() { + if (state == null) + return getWorldView().getBlockState(getMidohraPos()); + + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getState()); + } + + public BlockEntityWrapper getBlockEntityWrapper() { + return BlockEntityWrapper.of(getBlockEntity()); + } + + public IWorldView getWorldView() { + return getMidohraWorld(); + } + + @Override + public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState() { + return getMidohraState(); + } + + public Block getBlock() { + return getState().getBlock(); + } + + public BlockWrapper getBlockWrapper() { + return BlockWrapper.of(getBlock()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java new file mode 100644 index 000000000..466ac1f70 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.event.v0; + +import dev.architectury.event.EventResult; +import dev.architectury.event.events.common.PlayerEvent; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import org.jetbrains.annotations.Nullable; + +@Deprecated +public class AttackEntityEventRegistry { + public static void register(AttackEntity attackEntity) { + PlayerEvent.ATTACK_ENTITY.register(attackEntity::attack); + } + + public interface AttackEntity { + default EventResult attack(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + return attack(new Player(player), level, target, hand, result); + } + + EventResult attack(Player player, World level, Entity target, Hand hand, @Nullable EntityHitResult result); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java new file mode 100644 index 000000000..4c4efbe16 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.event.v0; + +import dev.architectury.event.events.client.ClientTickEvent; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.world.ClientWorld; + +public class ClientTickEventRegistry { + public static void registerPost(Client client) { + ClientTickEvent.CLIENT_POST.register(client::tick); + } + + public static void registerPre(Client client) { + ClientTickEvent.CLIENT_PRE.register(client::tick); + } + + public static void registerLevelPost(ClientLevel world) { + ClientTickEvent.CLIENT_LEVEL_POST.register(world::tick); + } + + public static void registerLevelPre(ClientLevel world) { + ClientTickEvent.CLIENT_LEVEL_PRE.register(world::tick); + } + + @Environment(EnvType.CLIENT) + public interface Client { + void tick(MinecraftClient instance); + } + + @Environment(EnvType.CLIENT) + public interface ClientLevel { + void tick(ClientWorld instance); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java new file mode 100644 index 000000000..17b2fa79d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java @@ -0,0 +1,87 @@ +package net.pitan76.mcpitanlib.api.event.v0; + +import dev.architectury.event.events.common.LifecycleEvent; +import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.v0.event.ItemStackActionEvent; +import net.pitan76.mcpitanlib.api.event.v0.event.ServerConnectionEvent; + +public class EventRegistry { + + public static class ServerConnection { + // Architectury: PlayerEvent + public static void join(PlayerJoin state) { + ServerConnectionEvent.join(state); + } + + public static void quit(PlayerQuit state) { + ServerConnectionEvent.quit(state); + } + + public interface PlayerJoin { + void join(ServerPlayerEntity player); + } + + public interface PlayerQuit { + void quit(ServerPlayerEntity player); + } + } + + public static class ItemStackAction { + public static void damage(ItemStackDamageState state) { + ItemStackActionEvent.register(state); + } + + public interface ItemStackDamageState { + void onDamage(ItemStack stack); + } + } + + public static class ServerLifecycle { + // Architectury: LifecycleEvent + public static void serverStarted(ServerState state) { + LifecycleEvent.SERVER_STARTED.register(state::stateChanged); + } + + public static void serverStarting(ServerState state) { + LifecycleEvent.SERVER_STARTING.register(state::stateChanged); + } + + public static void serverStopped(ServerState state) { + LifecycleEvent.SERVER_STOPPED.register(state::stateChanged); + } + + public static void serverStopping(ServerState state) { + LifecycleEvent.SERVER_STOPPING.register(state::stateChanged); + } + + public static void serverWorldLoad(ServerWorldState state) { + LifecycleEvent.SERVER_LEVEL_LOAD.register(state::act); + } + + public static void serverWorldSave(ServerWorldState state) { + LifecycleEvent.SERVER_LEVEL_SAVE.register(state::act); + } + + public static void serverWorldUnload(ServerWorldState state) { + LifecycleEvent.SERVER_LEVEL_UNLOAD.register(state::act); + } + + public interface ServerState extends InstanceState { + } + + public interface InstanceState { + void stateChanged(T instance); + } + + public interface WorldState { + void act(T world); + } + + public interface ServerWorldState extends WorldState { + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java new file mode 100644 index 000000000..65a8d74b9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java @@ -0,0 +1,80 @@ +package net.pitan76.mcpitanlib.api.event.v0; + +import dev.architectury.event.events.common.InteractionEvent; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.result.EventResult; +import net.pitan76.mcpitanlib.api.event.v0.event.ClickBlockEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; + +public class InteractionEventRegistry { + public static void registerRightClickBlock(RightClickBlock rightClickBlock) { + InteractionEvent.RIGHT_CLICK_BLOCK.register((player, hand, pos, direction) -> rightClickBlock.click(new ClickBlockEvent(player, hand, pos, direction)).toActionResult()); + } + + public static void registerLeftClickBlock(LeftClickBlock leftClickBlock) { + InteractionEvent.LEFT_CLICK_BLOCK.register((player, hand, pos, direction) -> leftClickBlock.click(new ClickBlockEvent(player, hand, pos, direction)).toActionResult()); + } + + public static void registerRightClickItem(RightClickItem rightClickItem) { + InteractionEvent.RIGHT_CLICK_ITEM.register(rightClickItem::click); + } + + public static void registerClientLeftClickAir(ClientLeftClickAir clientLeftClickAir) { + InteractionEvent.CLIENT_LEFT_CLICK_AIR.register(clientLeftClickAir::click); + } + + public static void registerClientRightClickAir(ClientRightClickAir clientRightClickAir) { + InteractionEvent.CLIENT_RIGHT_CLICK_AIR.register(clientRightClickAir::click); + } + + public static void registerInteractEntity(InteractEntity interactEntity) { + InteractionEvent.INTERACT_ENTITY.register(interactEntity::interact); + } + + // ---- + + public interface LeftClickBlock { + EventResult click(ClickBlockEvent event); + } + + public interface RightClickBlock { + EventResult click(ClickBlockEvent event); + } + + public interface RightClickItem { + default ActionResult click(PlayerEntity var1, Hand var2) { + return click(new Player(var1), var2).toActionResult(); + } + + CompatActionResult click(Player player, Hand hand); + } + + public interface ClientLeftClickAir { + default void click(PlayerEntity var1, Hand var2) { + click(new Player(var1), var2); + } + + void click(Player player, Hand hand); + } + + public interface ClientRightClickAir { + default void click(PlayerEntity var1, Hand var2) { + click(new Player(var1), var2); + } + + void click(Player player, Hand hand); + } + + public interface InteractEntity { + @SuppressWarnings("deprecation") + default dev.architectury.event.EventResult interact(PlayerEntity var1, Entity var2, Hand var3) { + return interact(new Player(var1), var2, var3).toEventResult().getResult(); + } + + CompatActionResult interact(Player player, Entity entity, Hand hand); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java new file mode 100644 index 000000000..3777e195e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.event.v0; + +import dev.architectury.event.EventResult; +import dev.architectury.event.events.common.EntityEvent; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; + +public class LivingHurtEventRegistry { + public static void register(LivingHurt livingHurt) { + EntityEvent.LIVING_HURT.register(livingHurt::hurt); + } + + public interface LivingHurt { + default EventResult hurt(LivingEntity var1, DamageSource var2, float var3) { + return hurt(new LivingHurtEvent(var1, var2, var3)); + } + + EventResult hurt(LivingHurtEvent event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java new file mode 100644 index 000000000..231235154 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java @@ -0,0 +1,78 @@ +package net.pitan76.mcpitanlib.api.event.v0.event; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.BlockStateUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; + +public class ClickBlockEvent { + public Player player; + public Hand hand; + public BlockPos pos; + public Direction direction; + + public ClickBlockEvent(Player player, Hand hand, BlockPos pos, Direction direction) { + this.player = player; + this.hand = hand; + this.pos = pos; + this.direction = direction; + } + + public ClickBlockEvent(PlayerEntity player, Hand hand, BlockPos pos, Direction direction) { + this.player = new Player(player); + this.hand = hand; + this.pos = pos; + this.direction = direction; + } + + public Player getPlayer() { + return player; + } + + public Hand getHand() { + return hand; + } + + public BlockPos getPos() { + return pos; + } + + public Direction getDirection() { + return direction; + } + + public boolean isExistPlayer() { + return player.getEntity() != null; + } + + public ItemStack getStackInHand() { + return player.getStackInHand(hand); + } + + public boolean isEmptyStackInHand() { + return getStackInHand().isEmpty(); + } + + public World getWorld() { + return player.getWorld(); + } + + public BlockState getBlockState() { + return WorldUtil.getBlockState(getWorld(), getPos()); + } + + public Block getBlock() { + return BlockStateUtil.getBlock(getBlockState()); + } + + + + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java new file mode 100644 index 000000000..f8872ead7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.event.v0.event; + +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; + +import java.util.ArrayList; +import java.util.List; + +public class ItemStackActionEvent { + + public static Boolean returnValue = null; + + public static void setReturnValue(boolean setReturnValue) { + ItemStackActionEvent.returnValue = setReturnValue; + } + + private static final List states = new ArrayList<>(); + + public static void register(EventRegistry.ItemStackAction.ItemStackDamageState state) { + states.add(state); + } + + public static void call(ItemStack stack) { + if (states.isEmpty()) return; + for (EventRegistry.ItemStackAction.ItemStackDamageState state : states) { + state.onDamage(stack); + } + } + + public static void unregister(EventRegistry.ItemStackAction.ItemStackDamageState state) { + states.remove(state); + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java new file mode 100644 index 000000000..078061cb0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java @@ -0,0 +1,83 @@ +package net.pitan76.mcpitanlib.api.event.v0.event; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class LivingHurtEvent { + public LivingEntity entity; + public DamageSource damageSource; + public float damageAmount; + + public LivingHurtEvent(LivingEntity entity, DamageSource damageSource, float damageAmount) { + this.entity = entity; + this.damageSource = damageSource; + this.damageAmount = damageAmount; + } + + public LivingEntity getEntity() { + return entity; + } + + public DamageSource getDamageSource() { + return damageSource; + } + + public float getDamageAmount() { + return damageAmount; + } + + public Entity getAttacker() { + return damageSource.getAttacker(); + } + + public Entity getSource() { + return damageSource.getSource(); + } + + public boolean isDirect() { + return damageSource.isDirect(); + } + + public boolean isPlayerAttacker() { + return getAttacker() instanceof PlayerEntity; + } + + public PlayerEntity getPlayerEntityAttacker() { + return (PlayerEntity) getAttacker(); + } + + public Player getPlayerAttacker() { + return new Player(getPlayerEntityAttacker()); + } + + public World getWorld() { + return entity.getEntityWorld(); + } + + public boolean isClient() { + return getWorld().isClient(); + } + + public ItemStack getWeaponStack() { + return getAttacker().getWeaponStack(); + } + + public Item getWeaponItem() { + return getWeaponStack().getItem(); + } + + public boolean isWeaponEmpty() { + return getWeaponStack().isEmpty(); + } + + public boolean isWeaponItemEqual(Item item) { + if (isWeaponEmpty()) return false; + return getWeaponItem() == item; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java new file mode 100644 index 000000000..8a955dd4e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java @@ -0,0 +1,59 @@ +package net.pitan76.mcpitanlib.api.event.v0.event; + +import net.minecraft.recipe.Recipe; +import net.minecraft.resource.ResourceManager; +import net.minecraft.resources.Identifier; +import net.minecraft.util.profiler.Profiler; +import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; +import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; +import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; +import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; + +import java.util.SortedMap; + +public class RecipeManagerEvent { + + @Deprecated + private SortedMap> sortedMap; + + public ResourceManager resourceManager; + public Profiler profiler; + + public RecipeManagerEvent(SortedMap> sortedMap, ResourceManager resourceManager, Profiler profiler) { + this.sortedMap = sortedMap; + this.resourceManager = resourceManager; + this.profiler = profiler; + } + + public Profiler getProfiler() { + return profiler; + } + + public ResourceManager getResourceManager() { + return resourceManager; + } + + public net.pitan76.mcpitanlib.midohra.resource.ResourceManager getResourceManagerM() { + return net.pitan76.mcpitanlib.midohra.resource.ResourceManager.of(resourceManager); + } + + public void putCompatibleRecipeEntry(Identifier id, CompatibleRecipeEntry entry) { + putCompatibleRecipeEntry(entry); + } + + public void putCompatibleRecipeEntry(CompatibleRecipeEntry entry) { + sortedMap.put(entry.getId(), entry.getRecipe()); + } + + public > void putCompatibleRecipeEntry(CompatRecipeEntry entry) { + sortedMap.put(entry.getId(), entry.getRecipe()); + } + + public void putRecipeEntry(RecipeEntry entry) { + sortedMap.put(entry.getId().toMinecraft(), entry.getRawRecipe()); + } + + public void putRecipe(CompatRecipe recipe) { + sortedMap.put(recipe.getId(), recipe.getRecipe()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java new file mode 100644 index 000000000..ec21cc0e7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.event.v0.event; + +import dev.architectury.event.events.common.PlayerEvent; +import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; + +public class ServerConnectionEvent { + // Architectury: PlayerEvent + public static void join(EventRegistry.ServerConnection.PlayerJoin state) { + PlayerEvent.PLAYER_JOIN.register(state::join); + } + + public static void quit(EventRegistry.ServerConnection.PlayerQuit state) { + PlayerEvent.PLAYER_QUIT.register(state::quit); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java new file mode 100644 index 000000000..894a89cd8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.event.v1; + +import dev.architectury.event.EventResult; +import dev.architectury.event.events.common.PlayerEvent; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.v1.event.AttackEntityEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import org.jetbrains.annotations.Nullable; + +public class AttackEntityEventRegistry { + public static void register(AttackEntity attackEntity) { + PlayerEvent.ATTACK_ENTITY.register(attackEntity::attack); + } + + public interface AttackEntity { + default EventResult attack(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + return attack(new AttackEntityEvent(player, level, target, hand, result)).toEventResult().getResult(); + } + + CompatActionResult attack(AttackEntityEvent event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java new file mode 100644 index 000000000..cfc8397de --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.event.v1; + +import net.pitan76.mcpitanlib.api.event.v1.listener.BlockBreakTask; +import net.pitan76.mcpitanlib.api.event.v1.listener.BlockPlacedTask; + +@Deprecated +public class BlockEventRegistry { + @Deprecated + public static void register(BlockPlacedTask listener) { + net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_PLACED.register(listener); + } + + @Deprecated + public static void register(BlockBreakTask listener) { + net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_BREAK.register(listener); + } + + public static void registerPlacedListener(BlockPlacedTask listener) { + net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_PLACED.register(listener); + + } + + public static void registerBreakListener(BlockBreakTask listener) { + net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry.ON_BREAK.register(listener); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java new file mode 100644 index 000000000..a95a7e9be --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java @@ -0,0 +1,23 @@ +package net.pitan76.mcpitanlib.api.event.v1; + +import dev.architectury.event.EventResult; +import dev.architectury.event.events.common.EntityEvent; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; + +public class LivingHurtEventRegistry { + public static void register(LivingHurt livingHurt) { + EntityEvent.LIVING_HURT.register(livingHurt::hurt); + } + + public interface LivingHurt { + + @SuppressWarnings("deprecation") + default EventResult hurt(LivingEntity var1, DamageSource var2, float var3) { + return hurt(new LivingHurtEvent(var1, var2, var3)).getResult(); + } + + net.pitan76.mcpitanlib.api.event.result.EventResult hurt(LivingHurtEvent event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java new file mode 100644 index 000000000..840b0f04e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.event.v1; + +import net.pitan76.mcpitanlib.api.event.v0.event.RecipeManagerEvent; + +import java.util.ArrayList; +import java.util.List; + +public class RecipeManagerRegistry { + public static List managers = new ArrayList<>(); + + public static void register(CustomRecipeManager manager) { + managers.add(manager); + } + + @FunctionalInterface + public interface CustomRecipeManager { + void apply(RecipeManagerEvent event); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java new file mode 100644 index 000000000..4748c9ca4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java @@ -0,0 +1,73 @@ +package net.pitan76.mcpitanlib.api.event.v1.event; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import org.jetbrains.annotations.Nullable; + +public class AttackEntityEvent { + + public Player player; + public World world; + public Entity target; + public Hand hand; + public EntityHitResult result; + + public AttackEntityEvent(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + this(new Player(player), level, target, hand, result); + } + + public AttackEntityEvent(Player player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + this.player = player; + this.world = level; + this.target = target; + this.hand = hand; + this.result = result; + } + + public Player getPlayer() { + return player; + } + + public World getWorld() { + return world; + } + + public Entity getTarget() { + return target; + } + + public EntityHitResult getResult() { + return result; + } + + public Hand getHand() { + return hand; + } + + public ItemStack getStackInPlayer() { + return player.getStackInHand(hand); + } + + public Item getItemInPlayer() { + return getStackInPlayer().getItem(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getWorldAsMidohra() { + return net.pitan76.mcpitanlib.midohra.world.World.of(world); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackInPlayerAsMidohra() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStackInPlayer()); + } + + public ItemWrapper getItemWrapperInPlayer() { + return ItemWrapper.of(getItemInPlayer()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java new file mode 100644 index 000000000..ae0300d00 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java @@ -0,0 +1,9 @@ +package net.pitan76.mcpitanlib.api.event.v1.listener; + +import net.pitan76.mcpitanlib.api.event.block.BlockBreakEvent; +import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; + +@FunctionalInterface +public interface BlockBreakTask { + BlockBreakResult onBreak(BlockBreakEvent event); +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java new file mode 100644 index 000000000..eca682318 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java @@ -0,0 +1,8 @@ +package net.pitan76.mcpitanlib.api.event.v1.listener; + +import net.pitan76.mcpitanlib.api.event.block.BlockPlacedEvent; + +@FunctionalInterface +public interface BlockPlacedTask { + void onPlaced(BlockPlacedEvent event); +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java new file mode 100644 index 000000000..4ad62500e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java @@ -0,0 +1,18 @@ +package net.pitan76.mcpitanlib.api.event.v2; + +import java.util.List; + +public abstract class AbstractEvent { + + public abstract void register(T listener); + + public abstract void unregister(T listener); + + public abstract T getListener(int index); + + public abstract List getListenersAsList(); + + public int getListenerCount() { + return getListenersAsList().size(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java new file mode 100644 index 000000000..50f50a605 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.event.v2; + +import net.pitan76.mcpitanlib.api.event.v1.listener.BlockBreakTask; +import net.pitan76.mcpitanlib.api.event.v1.listener.BlockPlacedTask; + +public class BlockEventRegistry { + /** + * Event that is called when a block is placed + *

{@code
+     * BlockEventRegistry.ON_PLACED.register((event) -> {
+     *     // Do something
+     * }
+ */ + public static OrderedEvent ON_PLACED = new OrderedEvent<>(); + + /** + * Event that is called when a block is broken + *
{@code
+     * BlockEventRegistry.ON_BREAK.register((event) -> {
+     *     // Do something
+     *     return new BlockBreakResult(event.state);
+     * }
+ */ + public static OrderedEvent ON_BREAK = new OrderedEvent<>(); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java new file mode 100644 index 000000000..822804845 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java @@ -0,0 +1,7 @@ +package net.pitan76.mcpitanlib.api.event.v2; + +import net.pitan76.mcpitanlib.api.event.v2.listener.InventoryTickTask; + +public class ItemEventRegistry { + public static OrderedEvent INVENTORY_TICK = new OrderedEvent<>(); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java new file mode 100644 index 000000000..019d5f5a7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java @@ -0,0 +1,167 @@ +package net.pitan76.mcpitanlib.api.event.v2; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OrderedEvent extends AbstractEvent { + + public volatile Map listeners = new HashMap<>(); + public volatile int maxPriority = 0; + + /** + * Check if the event has any listeners + * @return Whether the event has any listeners + */ + public boolean isEmpty() { + return listeners.isEmpty(); + } + + /** + * Check if a listener is registered + * @param listener The listener to check + * @return Whether the listener is registered + */ + public boolean isExists(T listener) { + return listeners.containsKey(listener); + } + + /** + * Alias for isExists + * @param listener The listener to check + * @return Whether the listener is registered + */ + public boolean has(T listener) { + return isExists(listener); + } + + /** + * Check if a listener has a priority + * @param listener The listener to check + * @return Whether the listener has a priority + */ + public boolean hasPriority(T listener) { + if (!isExists(listener)) return false; + return listeners.get(listener) != null && listeners.get(listener) != 0; + } + + /** + * Set the priority of a listener + * @param listener The listener to set the priority of + * @param priority The priority to set + */ + public void setPriority(T listener, int priority) { + if (!isExists(listener)) { + listeners.put(listener, priority); + return; + } + listeners.replace(listener, priority); + } + + /** + * Register a listener with a priority + * @param listener The listener to register + * @param priority The priority of the listener + */ + public void register(T listener, int priority) { + this.listeners.put(listener, priority); + if (priority > maxPriority) { + maxPriority = priority; + } + } + + /** + * Register a listener (no priority) + * @param listener The listener to register + * @throws IllegalArgumentException If the listener is already registered + */ + @Override + public void register(T listener) { + if (isExists(listener)) throw new IllegalArgumentException("Listener already exists"); + this.listeners.put(listener, 0); + } + + /** + * Register a listener (no priority) + * @param listener The listener to register + */ + public void registerNonSafe(T listener) { + if (isExists(listener)) return; + register(listener); + } + + /** + * Unregister a listener + * @param listener The listener to unregister + */ + @Override + public void unregister(T listener) { + if (!isExists(listener)) return; + this.listeners.remove(listener); + } + + /** + * Get all listeners + * @return A list of all listeners + */ + @Override + public List getListenersAsList() { + return listeners.keySet().stream().toList(); + } + + /** + * get the priority of a listener + * @param listener The listener to get the priority of + * @return The priority of the listener + */ + public int getPriority(T listener) { + return listeners.get(listener); + } + + /** + * Get the highest priority + * @return The highest priority + */ + public int getMaxPriority() { + return maxPriority; + } + + /** + * Get the next priority + * @return The next priority + */ + public int nextPriority() { + return maxPriority + 1; + } + + @Deprecated + public T getListener(int index) { + return getListenersAsList().get(index); + } + + /** + * Get all listeners with a specific priority + * @param priority The priority to get listeners for + * @return A list of listeners with the specified priority + */ + public List getListenersAsList(int priority) { + List listeners = new ArrayList<>(); + for (Map.Entry entry : this.listeners.entrySet()) { + if (entry.getValue() == priority) { + listeners.add(entry.getKey()); + } + } + return listeners; + } + + @Deprecated + @SuppressWarnings("unchecked") + public T[] getListeners(int priority) { + return (T[]) getListenersAsList(priority).toArray(); + } + + public Map getListeners() { + return listeners; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java new file mode 100644 index 000000000..4f66ba34f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java @@ -0,0 +1,8 @@ +package net.pitan76.mcpitanlib.api.event.v2.listener; + +import net.pitan76.mcpitanlib.api.event.item.InventoryTickEvent; + +@FunctionalInterface +public interface InventoryTickTask { + void inventoryTick(InventoryTickEvent event); +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java new file mode 100644 index 000000000..da542b658 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.api.gen; + +import net.minecraft.block.Block; +import net.minecraft.resources.Identifier; +import net.minecraft.world.gen.GenerationStep; +import net.minecraft.world.gen.feature.ConfiguredFeature; +import net.minecraft.world.gen.feature.PlacedFeature; +import net.pitan76.mcpitanlib.api.registry.WorldGenRegistry; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.util.BlockUtil; +import net.pitan76.mcpitanlib.api.util.FeatureConfigUtil; +import net.pitan76.mcpitanlib.api.util.PlacedFutureUtil; + +@Deprecated +public class OreRegistry { + /** + * Generating custom ore in stone + * @param registry WorldGenRegistry + * @param block Block + * @param size Ore size + * @param height generating height + * @param count generating count per chunk + * @return Identifier of feature + */ + public static Identifier registerStoneOre(WorldGenRegistry registry, Block block, int size, int height, int count) { + Identifier identifier = BlockUtil.toID(block).withSuffixedPath("_ore_feature"); + RegistryResult> configuredFuture = registry.registerFeature(identifier, + () -> FeatureConfigUtil.createConfiguredFeature( + FeatureConfigUtil.createStoneOreFeatureConfig(block.getDefaultState(), size) + ) + ); + + RegistryResult placedFeature = registry.registerPlacedFeature(identifier, + () -> PlacedFutureUtil.create(configuredFuture.getOrNull(), + PlacedFutureUtil.createPlacementModifiers(count, height) + ) + ); + + WorldGenRegistry.addProperties(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeature); + return identifier; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java new file mode 100644 index 000000000..e5324df34 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.api.gui; + +import dev.architectury.registry.menu.ExtendedMenuProvider; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerFactory; +import net.minecraft.text.Text; +import org.jetbrains.annotations.Nullable; + +@Deprecated +public class ExtendedNamedScreenHandlerFactory implements ExtendedMenuProvider { + + private final Text name; + private final ScreenHandlerFactory baseFactory; + private final PacketByteBufFactory bufFactory; + + public ExtendedNamedScreenHandlerFactory(Text name, ScreenHandlerFactory baseFactory, PacketByteBufFactory bufFactory) { + this.name = name; + this.baseFactory = baseFactory; + this.bufFactory = bufFactory; + } + + @Override + public void saveExtraData(PacketByteBuf buf) { + bufFactory.saveExtraData(buf); + } + + @Override + public Text getDisplayName() { + return name; + } + + @Nullable + @Override + public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player) { + return baseFactory.createMenu(syncId, inv, player); + + } + + @FunctionalInterface + public interface PacketByteBufFactory { + void saveExtraData(PacketByteBuf buf); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java new file mode 100644 index 000000000..45d413cfb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.gui; + +import net.minecraft.network.PacketByteBuf; +import net.minecraft.screen.ScreenHandlerType; +import org.jetbrains.annotations.Nullable; + +public class ExtendedScreenHandler extends SimpleScreenHandler { + protected ExtendedScreenHandler(@Nullable ScreenHandlerType type, int syncId, PacketByteBuf buf) { + this(type, syncId); + } + + protected ExtendedScreenHandler(@Nullable ScreenHandlerType type, int syncId) { + super(type, syncId); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java new file mode 100644 index 000000000..17d6586b0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java @@ -0,0 +1,24 @@ +package net.pitan76.mcpitanlib.api.gui; + +import dev.architectury.registry.menu.ExtendedMenuProvider; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.event.container.factory.ExtraDataArgs; + +@Deprecated +public interface ExtendedScreenHandlerFactory extends ExtendedMenuProvider { + @Override + default Text getDisplayName() { + return getDisplayName(new DisplayNameArgs()); + } + + @Override + default void saveExtraData(PacketByteBuf buf) { + writeExtraData(new ExtraDataArgs(buf)); + } + + Text getDisplayName(DisplayNameArgs args); + + void writeExtraData(ExtraDataArgs args); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java new file mode 100644 index 000000000..dd672f9a6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.api.gui; + +import dev.architectury.registry.menu.MenuRegistry; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; + +public class ExtendedScreenHandlerTypeBuilder { + + private final Factory factory; + + public ExtendedScreenHandlerTypeBuilder(Factory factory) { + this.factory = factory; + } + + public ExtendedScreenHandlerTypeBuilder(Factory2 factory) { + this.factory = factory; + } + + public ScreenHandlerType build() { + return MenuRegistry.ofExtended(factory::create); + } + + @FunctionalInterface + public interface Factory { + T create(int syncId, PlayerInventory inventory, PacketByteBuf buf); + } + + @FunctionalInterface + public interface Factory2 extends Factory { + T create(CreateMenuEvent e, PacketByteBuf buf); + + @Override + default T create(int syncId, PlayerInventory inventory, PacketByteBuf buf) { + return create(new CreateMenuEvent(syncId, inventory), buf); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java new file mode 100644 index 000000000..334c42388 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java @@ -0,0 +1,276 @@ +package net.pitan76.mcpitanlib.api.gui; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.screen.slot.Slot; +import net.minecraft.screen.slot.SlotActionType; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.gui.args.SlotClickEvent; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; +import net.pitan76.mcpitanlib.api.util.SlotUtil; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +public class SimpleScreenHandler extends ScreenHandler { + protected SimpleScreenHandler(@Nullable ScreenHandlerType type, int syncId) { + super(type, syncId); + } + + protected SimpleScreenHandler(@Nullable ScreenHandlerType type, CreateMenuEvent e) { + this(type, e.getSyncId()); + } + + public boolean hasMainInventory = false; + public boolean hasHotbar = false; + + @Deprecated + @Override + public boolean canUse(PlayerEntity player) { + return canUse(new Player(player)); + } + + public boolean canUse(Player player) { + return true; + } + + public Slot addNormalSlot(Inventory inventory, int index, int x, int y) { + Slot slot = new Slot(inventory, index, x, y); + return this.addSlot(slot); + } + + public Slot addSlot(Inventory inventory, int index, int x, int y, SlotFactory factory) { + Slot slot = factory.create(inventory, index, x, y); + return this.addSlot(slot); + } + + public interface SlotFactory { + T create(Inventory inventory, int index, int x, int y); + } + + public Slot callAddSlot(Slot slot) { + return this.addSlot(slot); + } + + @Deprecated + @Override + protected Slot addSlot(Slot slot) { + return super.addSlot(slot); + } + + @Deprecated + @Override + public void onClosed(PlayerEntity player) { + this.close(new Player(player)); + } + + public void close(Player player) { + super.onClosed(player.getPlayerEntity()); + } + + + public static final int DEFAULT_SLOT_SIZE = 18; + + /** + * Add player main inventory slots + * @param inventory target player inventory + * @param x start x + * @param y start y + */ + protected List addPlayerMainInventorySlots(PlayerInventory inventory, int x, int y) { + hasMainInventory = true; + return this.addSlots(inventory, 9, x, y, DEFAULT_SLOT_SIZE, 9, 3); + } + + /** + * Add player hotbar slots + * @param inventory target player inventory + * @param x start x + * @param y start y + */ + protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int y) { + hasHotbar = true; + return this.addSlotsX(inventory, 0, x, y, DEFAULT_SLOT_SIZE, 9); + } + + /** + * 一括でスロットを設置する + * @param inventory target inventory + * @param firstIndex fisrt index + * @param firstX first x + * @param firstY first y + * @param size a slot size (if this is -1, set 18 to this) + * @param maxAmountX x line slot max amount + * @param maxAmountY y line slot max amount + * @return Slot list + */ + protected List addSlots(Inventory inventory, int firstIndex, int firstX, int firstY, int size, int maxAmountX, int maxAmountY) { + if (size < 0) size = DEFAULT_SLOT_SIZE; + List slots = new ArrayList<>(); + for (int y = 0; y < maxAmountY; ++y) { + List xSlots = this.addSlotsX(inventory, firstIndex + (y * maxAmountX), firstX, firstY + (y * size), size, maxAmountX); + slots.addAll(xSlots); + } + return slots; + } + + /** + * 一括で横にスロットを設置する + * @param inventory target inventory + * @param firstIndex first index + * @param firstX first x + * @param y y + * @param size a slot size (if this is -1, set 18 to this) + * @param amount slot amount + * @return Slot list + */ + protected List addSlotsX(Inventory inventory, int firstIndex, int firstX, int y, int size, int amount) { + if (size < 0) size = DEFAULT_SLOT_SIZE; + List slots = new ArrayList<>(); + for (int x = 0; x < amount; ++x) { + Slot slot = this.addNormalSlot(inventory, firstIndex + x, firstX + (x * size), y); + slots.add(slot); + } + return slots; + } + + /** + * 一括で縦にスロットを設置する + * @param inventory target inventory + * @param firstIndex first index + * @param x x + * @param firstY first y + * @param size a slot size (if this is -1, set 18 to this) + * @param amount slot amount + * @return Slot list + */ + protected List addSlotsY(Inventory inventory, int firstIndex, int x, int firstY, int size, int amount) { + if (size < 0) size = DEFAULT_SLOT_SIZE; + List slots = new ArrayList<>(); + for (int y = 0; y < amount; ++y) { + Slot slot = this.addNormalSlot(inventory, firstIndex + x, x, firstY + (y * size)); + slots.add(slot); + } + return slots; + } + + @Deprecated + public ItemStack quickMoveOverride(PlayerEntity player, int index) { + return quickMoveOverride(new Player(player), index); + } + + public boolean callInsertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { + return this.insertItem(stack, startIndex, endIndex, fromLast); + } + + @Deprecated + @Override + protected boolean insertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { + return super.insertItem(stack, startIndex, endIndex, fromLast); + } + + public ItemStack quickMoveOverride(Player player, int index) { + ItemStack itemStack = ItemStackUtil.empty(); + Slot slot = ScreenHandlerUtil.getSlot(this, index); + int size = ScreenHandlerUtil.getSlots(this).size(); + + if (SlotUtil.hasStack(slot)) { + ItemStack itemStack2 = SlotUtil.getStack(slot); + itemStack = itemStack2.copy(); + + if (hasMainInventory && hasHotbar) { + if (index > 35) { + if (!this.callInsertItem(itemStack2, 0, 9, false)) { + if (!this.callInsertItem(itemStack2, 9, 36, true)) { + return ItemStackUtil.empty(); + } + } + } else if (size > 36 && !this.callInsertItem(itemStack2, 36, size, false)) { + return ItemStackUtil.empty(); + } + } + + if (itemStack2.isEmpty()) { + SlotUtil.setStack(slot, ItemStackUtil.empty()); + } else { + SlotUtil.markDirty(slot); + } + + if (itemStack2.getCount() == itemStack.getCount()) { + return ItemStackUtil.empty(); + } + + SlotUtil.onTakeItem(slot, player, itemStack2); + } + + return itemStack; + } + + + @Deprecated + @Override + public ItemStack quickMove(PlayerEntity player, int slot) { + return quickMoveOverride(player, slot); + } + + @Deprecated + @Override + public Slot getSlot(int index) { + return callGetSlot(index); + } + + public Slot callGetSlot(int index) { + return super.getSlot(index); + } + + @Deprecated + @Override + public void onSlotClick(int slotIndex, int button, SlotActionType actionType, PlayerEntity player) { + overrideOnSlotClick(slotIndex, button, actionType, new Player(player)); + } + + public void overrideOnSlotClick(int slotIndex, int button, SlotActionType actionType, Player player) { + onSlotClick(new SlotClickEvent(slotIndex, button, actionType, player)); + } + + public void onSlotClick(SlotClickEvent e) { + super.onSlotClick(e.slot, e.button, e.actionType, e.player.getEntity()); + } + + @Override + @Deprecated + public void setCursorStack(ItemStack stack) { + callSetCursorStack(stack); + } + + public void callSetCursorStack(ItemStack stack) { + super.setCursorStack(stack); + } + + @Override + @Deprecated + public void setStackInSlot(int slot, int revision, ItemStack stack) { + callSetStackInSlot(slot, revision, stack); + } + + public void callSetStackInSlot(int slot, int revision, ItemStack stack) { + super.setStackInSlot(slot, revision, stack); + } + + @Override + @Deprecated + public int getRevision() { + return callGetRevision(); + } + + public int callGetRevision() { + return super.getRevision(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java new file mode 100644 index 000000000..39d18ee67 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.api.gui; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.resource.featuretoggle.FeatureFlags; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; + +public class SimpleScreenHandlerTypeBuilder { + + private final Factory factory; + + public SimpleScreenHandlerTypeBuilder(Factory factory) { + this.factory = factory; + } + + public SimpleScreenHandlerTypeBuilder(Factory2 factory) { + this.factory = factory; + } + + public ScreenHandlerType build() { + return new ScreenHandlerType<>(factory::create, FeatureFlags.VANILLA_FEATURES); + } + + @FunctionalInterface + public interface Factory { + T create(int syncId, PlayerInventory inventory); + } + + @FunctionalInterface + public interface Factory2 extends Factory { + T create(CreateMenuEvent e); + + @Override + default T create(int syncId, PlayerInventory inventory) { + return create(new CreateMenuEvent(syncId, inventory)); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java new file mode 100644 index 000000000..1fface96e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java @@ -0,0 +1,58 @@ +package net.pitan76.mcpitanlib.api.gui.args; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class CreateMenuEvent { + public int syncId; + public PlayerInventory playerInventory; + public PlayerEntity player; + + public CreateMenuEvent(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + this.syncId = syncId; + this.playerInventory = playerInventory; + this.player = player; + } + + public CreateMenuEvent(int syncId, PlayerInventory playerInventory) { + this.syncId = syncId; + this.playerInventory = playerInventory; + this.player = playerInventory.player; + } + + public CreateMenuEvent(int syncId, Player player) { + this.syncId = syncId; + this.playerInventory = player.getInv(); + this.player = player.getEntity(); + } + + public int getSyncId() { + return syncId; + } + + public PlayerInventory getPlayerInventory() { + return playerInventory; + } + + public PlayerEntity getPlayerEntity() { + return player; + } + + public Player getPlayer() { + return new Player(player); + } + + public boolean isExistPlayer() { + return player != null; + } + + public boolean isClient() { + return getPlayer().isClient(); + } + + public World getWorld() { + return getPlayer().getWorld(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java new file mode 100644 index 000000000..2c63f0d20 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java @@ -0,0 +1,67 @@ +package net.pitan76.mcpitanlib.api.gui.args; + +import net.minecraft.screen.slot.SlotActionType; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.gui.slot.CompatSlotActionType; + +public class SlotClickEvent { + public int slot; + public int button; + public SlotActionType actionType; + public Player player; + + public SlotClickEvent(int slot, int button, SlotActionType actionType, Player player) { + this.slot = slot; + this.button = button; + this.actionType = actionType; + this.player = player; + } + + public int getSlot() { + return slot; + } + + public int getButton() { + return button; + } + + public SlotActionType getRawActionType() { + return actionType; + } + + public CompatSlotActionType getActionType() { + return CompatSlotActionType.of(actionType); + } + + public Player getPlayer() { + return player; + } + + public boolean isClient() { + return player.isClient(); + } + + public boolean isServer() { + return player.isServer(); + } + + public boolean isSwapAction() { + return actionType == SlotActionType.SWAP; + } + + public boolean isPickupAction() { + return actionType == SlotActionType.PICKUP; + } + + public boolean isQuickCraftAction() { + return actionType == SlotActionType.QUICK_CRAFT; + } + + public boolean isQuickMoveAction() { + return actionType == SlotActionType.QUICK_MOVE; + } + + public boolean isThrowAction() { + return actionType == SlotActionType.THROW; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java new file mode 100644 index 000000000..aea703cca --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java @@ -0,0 +1,77 @@ +package net.pitan76.mcpitanlib.api.gui.inventory; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventories; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; + +public interface IInventory extends Inventory { + + DefaultedList getItems(); + + static IInventory of(DefaultedList items) { + return () -> items; + } + + static IInventory ofSize(int size) { + return of(DefaultedList.ofSize(size, ItemStack.EMPTY)); + } + + @Override + default int size() { + return getItems().size(); + } + + @Override + default boolean isEmpty() { + for (int i = 0; i < size(); i++) { + ItemStack stack = getStack(i); + if (!stack.isEmpty()) { + return false; + } + } + return true; + } + + @Override + default ItemStack getStack(int slot) { + return getItems().get(slot); + } + + @Override + default ItemStack removeStack(int slot, int count) { + ItemStack result = Inventories.splitStack(getItems(), slot, count); + if (!result.isEmpty()) { + markDirty(); + } + return result; + } + + @Override + default ItemStack removeStack(int slot) { + return Inventories.removeStack(getItems(), slot); + } + + @Override + default void setStack(int slot, ItemStack stack) { + getItems().set(slot, stack); + if (stack.getCount() > getMaxCountPerStack()) { + stack.setCount(getMaxCountPerStack()); + } + } + + @Override + default void clear() { + getItems().clear(); + } + + @Override + default void markDirty() { + } + + @Override + default boolean canPlayerUse(PlayerEntity player) { + return true; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java new file mode 100644 index 000000000..a4cd6f4f3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.gui.inventory.sided; + +import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.AvailableSlotsArgs; + +public interface ChestStyleSidedInventory extends VanillaStyleSidedInventory { + @Override + default int[] getAvailableSlots(AvailableSlotsArgs args) { + return args.getAllSlots(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java new file mode 100644 index 000000000..5f4ce81b3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.gui.inventory.sided; + +import net.minecraft.inventory.SidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Direction; +import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.AvailableSlotsArgs; +import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanExtractArgs; +import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanInsertArgs; +import org.jetbrains.annotations.Nullable; + +public interface CompatSidedInventory extends SidedInventory { + @Override + @Deprecated + default int[] getAvailableSlots(Direction side) { + return getAvailableSlots(new AvailableSlotsArgs(side, this)); + } + + int[] getAvailableSlots(AvailableSlotsArgs args); + + @Override + @Deprecated + default boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { + return canInsert(new CanInsertArgs(slot, stack, dir)); + } + + boolean canInsert(CanInsertArgs args); + + @Override + @Deprecated + default boolean canExtract(int slot, ItemStack stack, Direction dir) { + return canExtract(new CanExtractArgs(slot, stack, dir)); + } + + boolean canExtract(CanExtractArgs args); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java new file mode 100644 index 000000000..119a59057 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java @@ -0,0 +1,20 @@ +package net.pitan76.mcpitanlib.api.gui.inventory.sided; + +import net.minecraft.util.math.Direction; +import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanExtractArgs; +import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanInsertArgs; + +public interface VanillaStyleSidedInventory extends CompatSidedInventory { + @Override + default boolean canInsert(CanInsertArgs args) { + if (args.getDir() == null) + return false; + + return args.getDir() != Direction.DOWN; + } + + @Override + default boolean canExtract(CanExtractArgs args) { + return args.getDir() == Direction.DOWN; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java new file mode 100644 index 000000000..748b47420 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; + +import net.minecraft.util.math.Direction; +import net.pitan76.mcpitanlib.api.gui.inventory.sided.CompatSidedInventory; +import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; + +public class AvailableSlotsArgs { + public Direction side; + public CompatSidedInventory inventory; + + public AvailableSlotsArgs(Direction side, CompatSidedInventory inventory) { + this.side = side; + this.inventory = inventory; + } + + public Direction getSide() { + return side; + } + + public CompatSidedInventory getInventory() { + return inventory; + } + + public int[] getAllSlots() { + if (!(inventory instanceof IInventory)) + return new int[0]; + + IInventory inv = (IInventory) inventory; + int size = inv.size(); + + int[] slots = new int[size]; + for (int i = 0; i < size; i++) { + slots[i] = i; + } + + return slots; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java new file mode 100644 index 000000000..568dcbe4c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Direction; + +public class CanExtractArgs { + public int slot; + public ItemStack stack; + public Direction dir; + + public CanExtractArgs(int slot, ItemStack stack, Direction dir) { + this.slot = slot; + this.stack = stack; + this.dir = dir; + } + + public int getSlot() { + return slot; + } + + public ItemStack getStack() { + return stack; + } + + public Direction getDir() { + return dir; + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStack_midohra() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java new file mode 100644 index 000000000..a6aa1a662 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Direction; +import org.jetbrains.annotations.Nullable; + +public class CanInsertArgs { + public int slot; + public ItemStack stack; + + @Nullable + public Direction dir; + + public CanInsertArgs(int slot, ItemStack stack, @Nullable Direction dir) { + this.slot = slot; + this.stack = stack; + this.dir = dir; + } + + public int getSlot() { + return slot; + } + + public ItemStack getStack() { + return stack; + } + + public @Nullable Direction getDir() { + return dir; + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStack_midohra() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java new file mode 100644 index 000000000..0addfd2a2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.gui.slot; + +import net.minecraft.screen.slot.SlotActionType; + +public class CompatSlotActionType { + public static final CompatSlotActionType PICKUP = new CompatSlotActionType(SlotActionType.PICKUP); + public static final CompatSlotActionType QUICK_MOVE = new CompatSlotActionType(SlotActionType.QUICK_MOVE); + public static final CompatSlotActionType SWAP = new CompatSlotActionType(SlotActionType.SWAP); + public static final CompatSlotActionType THROW = new CompatSlotActionType(SlotActionType.THROW); + public static final CompatSlotActionType CLONE = new CompatSlotActionType(SlotActionType.CLONE); + public static final CompatSlotActionType QUICK_CRAFT = new CompatSlotActionType(SlotActionType.QUICK_CRAFT); + public static final CompatSlotActionType PICKUP_ALL = new CompatSlotActionType(SlotActionType.PICKUP_ALL); + + public final SlotActionType raw; + + protected CompatSlotActionType(SlotActionType raw) { + this.raw = raw; + } + + public static CompatSlotActionType of(SlotActionType raw) { + if (raw == SlotActionType.PICKUP) return PICKUP; + if (raw == SlotActionType.QUICK_MOVE) return QUICK_MOVE; + if (raw == SlotActionType.SWAP) return SWAP; + if (raw == SlotActionType.THROW) return THROW; + if (raw == SlotActionType.CLONE) return CLONE; + if (raw == SlotActionType.QUICK_CRAFT) return QUICK_CRAFT; + if (raw == SlotActionType.PICKUP_ALL) return PICKUP_ALL; + return new CompatSlotActionType(raw); + } + + public boolean isSwapOrPickupOrQuickMoveOrThrow() { + return raw == SlotActionType.SWAP || raw == SlotActionType.PICKUP || raw == SlotActionType.QUICK_MOVE || raw == SlotActionType.THROW; + } + + public SlotActionType getRaw() { + return raw; + } + + public int getIndex() { + return raw.getIndex(); + } + + public String getName() { + return raw.name(); + } + + public boolean isOf(CompatSlotActionType type) { + return raw == type.raw; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java new file mode 100644 index 000000000..f49db49df --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java @@ -0,0 +1,125 @@ +package net.pitan76.mcpitanlib.api.gui.slot; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.slot.Slot; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class CompatibleSlot extends Slot { + + public Inventory inventory; + public int index; + public int x; + public int y; + + public CompatibleSlot(Inventory inventory, int index, int x, int y) { + super(inventory, index, x, y); + this.inventory = inventory; + this.index = index; + this.x = x; + this.y = y; + } + + public void callSetStack(ItemStack stack) { + super.setStack(stack); + } + + public void callSetStackNoCallbacks(ItemStack stack) { + super.setStackNoCallbacks(stack); + } + + public ItemStack callGetStack() { + return super.getStack(); + } + + public ItemStack callTakeStack(int amount) { + return super.takeStack(amount); + } + + public boolean callHasStack() { + return super.hasStack(); + } + + @Deprecated + @Override + public void setStack(ItemStack stack) { + callSetStack(stack); + } + + @Deprecated + @Override + public void setStackNoCallbacks(ItemStack stack) { + callSetStackNoCallbacks(stack); + } + + @Deprecated + @Override + public ItemStack getStack() { + return callGetStack(); + } + + @Deprecated + @Override + public ItemStack takeStack(int amount) { + return callTakeStack(amount); + } + + @Deprecated + @Override + public boolean hasStack() { + return callHasStack(); + } + + public Inventory callGetInventory() { + return inventory; + } + + public int callGetIndex() { + return super.getIndex(); + } + + public int callGetId() { + return super.id; + } + + public int callGetX() { + return super.x; + } + + public int callGetY() { + return super.y; + } + + public void callMarkDirty() { + super.markDirty(); + } + + @Override + public boolean canInsert(ItemStack stack) { + return canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack)); + } + + @Override + public boolean canTakeItems(PlayerEntity playerEntity) { + return canTakeItems(new Player(playerEntity)); + } + + public boolean canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return super.canInsert(stack.toMinecraft()); + } + + public boolean canTakeItems(Player player) { + return super.canTakeItems(player.getEntity()); + } + + @Deprecated + @Override + public boolean canTakePartial(PlayerEntity player) { + return canTakePartial(new Player(player)); + } + + public boolean canTakePartial(Player player) { + return super.canTakePartial(player.getEntity()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java new file mode 100644 index 000000000..b26d1915f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.api.gui.v2; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandler; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; + +@SuppressWarnings("deprecation") +public interface ExtendedScreenHandlerFactory extends net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerFactory { + + @Override + default ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + return createMenu(new CreateMenuEvent(syncId, playerInventory, player)); + } + + ScreenHandler createMenu(CreateMenuEvent event); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java new file mode 100644 index 000000000..8d447ebb3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.gui.v2; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.NamedScreenHandlerFactory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; + +public interface SimpleScreenHandlerFactory extends NamedScreenHandlerFactory { + @Override + default Text getDisplayName() { + return getDisplayName(new DisplayNameArgs()); + } + + Text getDisplayName(DisplayNameArgs args); + + @Override + default ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + return createMenu(new CreateMenuEvent(syncId, playerInventory, player)); + } + + ScreenHandler createMenu(CreateMenuEvent event); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java b/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java new file mode 100644 index 000000000..763444f86 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.api.helper; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; +import net.pitan76.mcpitanlib.api.item.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.item.ExtendItem; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.util.ItemUtil; +import net.pitan76.mcpitanlib.core.datafixer.Pair; + +import java.util.function.Supplier; + +public class SimpleRegister { + public static Supplier createItem(CompatRegistryV2 registry, CompatIdentifier id, CompatibleItemSettings settings) { + return registry.registerExtendItem(id, () -> new ExtendItem(settings)); + } + + public static Supplier createSimpleItem(CompatRegistryV2 registry, CompatIdentifier id) { + return createItem(registry, id, new CompatibleItemSettings()); + } + + public static Supplier createFoodItem(CompatRegistryV2 registry, CompatIdentifier id, CompatFoodComponent component) { + return createItem(registry, id, new CompatibleItemSettings().food(component)); + } + + public static Supplier createSimpleFoodItem(CompatRegistryV2 registry, CompatIdentifier id, int hunger, float saturation, boolean meat, boolean snack) { + CompatFoodComponent component = new CompatFoodComponent().setHunger(hunger).setSaturation(saturation); + if (meat) component.setMeat(); + if (snack) component.setSnack(); + return createFoodItem(registry, id, component); + } + + public static Supplier createSimpleFoodItem(CompatRegistryV2 registry, CompatIdentifier id, int hunger, float saturation) { + return createSimpleFoodItem(registry, id, hunger, saturation, false, false); + } + + public static Pair, Supplier> createBlock(CompatRegistryV2 registry, CompatIdentifier id, CompatibleBlockSettings blockSettings, CompatibleItemSettings itemSettings) { + Supplier blockSupplier = registry.registerExtendBlock(id, () -> new ExtendBlock(blockSettings)); + RegistryResult itemRegistryResult = registry.registerItem(id, () -> ItemUtil.ofBlock(blockSupplier.get(), itemSettings)); + Supplier itemSupplier = itemRegistryResult::getOrNull; + return new Pair<>(blockSupplier, itemSupplier); + } + + public static Pair, Supplier> createSimpleBlock(CompatRegistryV2 registry, CompatIdentifier id, CompatibleItemSettings itemSettings) { + return createBlock(registry, id, new CompatibleBlockSettings(), itemSettings); + } + + public static Pair, Supplier> createSimpleBlock(CompatRegistryV2 registry, CompatIdentifier id) { + return createBlock(registry, id, new CompatibleBlockSettings(), new CompatibleItemSettings()); + } + + public static CreativeTabBuilder createCreativeTab(CompatRegistryV2 registry, CompatIdentifier id, Supplier icon) { + CreativeTabBuilder builder = CreativeTabBuilder.create(id).setIcon(icon); + registry.registerItemGroup(builder); + return builder; + } + + public static CreativeTabBuilder createCreativeTabByItem(CompatRegistryV2 registry, CompatIdentifier id, Supplier item) { + return createCreativeTab(registry, id, () -> ItemStackUtil.create(item.get())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java new file mode 100644 index 000000000..14e0cf624 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java @@ -0,0 +1,75 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.item.equipment.EquipmentType; +import org.jetbrains.annotations.Nullable; + +public class ArmorEquipmentType { + public static ArmorEquipmentType HEAD = new ArmorEquipmentType(EquipmentSlot.HEAD, EquipmentType.HELMET); + public static ArmorEquipmentType CHEST = new ArmorEquipmentType(EquipmentSlot.CHEST, EquipmentType.CHESTPLATE); + public static ArmorEquipmentType LEGS = new ArmorEquipmentType(EquipmentSlot.LEGS, EquipmentType.LEGGINGS); + public static ArmorEquipmentType FEET = new ArmorEquipmentType(EquipmentSlot.FEET, EquipmentType.BOOTS); + + // New type for animals from 1.20.5 + public static ArmorEquipmentType BODY = new ArmorEquipmentType(EquipmentSlot.BODY, EquipmentType.BODY); + + protected final EquipmentSlot slot; + protected final EquipmentType type; + + protected ArmorEquipmentType(EquipmentSlot slot, EquipmentType type) { + this.slot = slot; + this.type = type; + } + + @Deprecated + public EquipmentSlot getSlot() { + return slot; + } + + @Deprecated + public EquipmentType getType() { + return type; + } + + @Nullable + public static ArmorEquipmentType of(EquipmentSlot slot) { + switch (slot) { + case HEAD -> { + return HEAD; + } + case CHEST -> { + return CHEST; + } + case LEGS -> { + return LEGS; + } + case FEET -> { + return FEET; + } + default -> { + return null; + } + } + } + + @Nullable + public static ArmorEquipmentType of(EquipmentType type) { + switch (type) { + case HELMET -> { + return HEAD; + } + case CHESTPLATE -> { + return CHEST; + } + case LEGGINGS -> { + return LEGS; + } + case BOOTS -> { + return FEET; + } + default -> { + return null; + } + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java new file mode 100644 index 000000000..c7cf23987 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java @@ -0,0 +1,120 @@ +package net.pitan76.mcpitanlib.api.item; + +import com.mojang.datafixers.util.Pair; +import net.minecraft.component.type.FoodComponent; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; + +import java.util.ArrayList; +import java.util.List; + +public class CompatFoodComponent { + private int hunger; + private float saturation; + private boolean meat; + private boolean alwaysEdible; + private boolean snack; + private final List> statusEffects = new ArrayList<>(); + + private FoodComponent latestComponent = null; + + public static CompatFoodComponent create() { + return new CompatFoodComponent(); + } + + public CompatFoodComponent setHunger(int hunger) { + this.hunger = hunger; + return this; + } + + public CompatFoodComponent setSaturation(float saturation) { + this.saturation = saturation; + return this; + } + + public CompatFoodComponent setAlwaysEdible() { + this.alwaysEdible = true; + return this; + } + + public CompatFoodComponent setSnack() { + this.snack = true; + return this; + } + + public CompatFoodComponent setMeat() { + this.meat = true; + return this; + } + + @Deprecated + public CompatFoodComponent addStatusEffect(StatusEffectInstance effect, float chance) { + statusEffects.add(Pair.of(effect, chance)); + return this; + } + + public CompatFoodComponent addStatusEffect(CompatStatusEffectInstance instance, float chance) { + return addStatusEffect(instance.getInstance(), chance); + } + + public FoodComponent.Builder getVanillaBuilder() { + FoodComponent.Builder builder = new FoodComponent.Builder(); + builder.nutrition(hunger).saturationModifier(saturation); + if (alwaysEdible) builder.alwaysEdible(); + return builder; + } + + public FoodComponent build() { + if (latestComponent != null) return latestComponent; + + float eatSeconds = 1.6f; + if (snack) eatSeconds = 0.8f; + if (meat) eatSeconds = 1.6f; + + latestComponent = new FoodComponent(hunger, saturation, alwaysEdible); + + return latestComponent; + } + + public FoodComponent vanillaBuild() { + if (latestComponent != null) return latestComponent; + + latestComponent = getVanillaBuilder().build(); + return latestComponent; + } + + // ---- + + public int getHunger() { + return hunger; + } + + public float getSaturation() { + return saturation; + } + + public boolean isMeat() { + return meat; + } + + public boolean isSnack() { + return snack; + } + + public boolean isAlwaysEdible() { + return alwaysEdible; + } + + @Deprecated + public List> getStatusEffects() { + return statusEffects; + } + + public List> getCompatStatusEffects() { + List> compatStatusEffects = new ArrayList<>(); + for (Pair pair : statusEffects) { + compatStatusEffects.add(Pair.of(new CompatStatusEffectInstance(pair.getFirst()), pair.getSecond())); + } + return compatStatusEffects; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java new file mode 100644 index 000000000..d7c0e9958 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.item.Item; +import net.minecraft.item.Items; + +public class CompatItems { + public static Item SHORT_GRASS = Items.SHORT_GRASS; + public static Item TALL_GRASS = Items.TALL_GRASS; + public static Item TURTLE_SCUTE = Items.TURTLE_SCUTE; + + // Compatibility + public static Item GRASS = SHORT_GRASS; + public static Item SCUTE = TURTLE_SCUTE; + + // ---- + + public static Item AIR = Items.AIR; + public static Item STONE = Items.STONE; + public static Item COBBLESTONE = Items.COBBLESTONE; + public static Item GRASS_BLOCK = Items.GRASS_BLOCK; + public static Item DIRT = Items.DIRT; + public static Item SAND = Items.SAND; + public static Item RED_SAND = Items.RED_SAND; + public static Item GRANITE = Items.GRANITE; + public static Item POLISHED_GRANITE = Items.POLISHED_GRANITE; + public static Item DIORITE = Items.DIORITE; + public static Item POLISHED_DIORITE = Items.POLISHED_DIORITE; + public static Item ANDESITE = Items.ANDESITE; + public static Item POLISHED_ANDESITE = Items.POLISHED_ANDESITE; + public static Item COARSE_DIRT = Items.COARSE_DIRT; + public static Item PODZOL = Items.PODZOL; + public static Item OAK_LOG = Items.OAK_LOG; + public static Item SPRUCE_LOG = Items.SPRUCE_LOG; + public static Item BIRCH_LOG = Items.BIRCH_LOG; + public static Item JUNGLE_LOG = Items.JUNGLE_LOG; + public static Item ACACIA_LOG = Items.ACACIA_LOG; + public static Item DARK_OAK_LOG = Items.DARK_OAK_LOG; + public static Item OAK_PLANKS = Items.OAK_PLANKS; + public static Item SPRUCE_PLANKS = Items.SPRUCE_PLANKS; + public static Item BIRCH_PLANKS = Items.BIRCH_PLANKS; + public static Item JUNGLE_PLANKS = Items.JUNGLE_PLANKS; + public static Item ACACIA_PLANKS = Items.ACACIA_PLANKS; + public static Item DARK_OAK_PLANKS = Items.DARK_OAK_PLANKS; + public static Item GLASS = Items.GLASS; + + public static Item STICK = Items.STICK; + public static Item GLASS_BOTTLE = Items.GLASS_BOTTLE; + public static Item EXP_BOTTLE = Items.EXPERIENCE_BOTTLE; + + public static Item GUNPOWDER = Items.GUNPOWDER; + public static Item REDSTONE = Items.REDSTONE; + public static Item COAL = Items.COAL; + public static Item CHARCOAL = Items.CHARCOAL; + public static Item IRON_INGOT = Items.IRON_INGOT; + public static Item COPPER_INGOT = Items.COPPER_INGOT; + public static Item GOLD_INGOT = Items.GOLD_INGOT; + public static Item DIAMOND = Items.DIAMOND; + public static Item EMERALD = Items.EMERALD; + public static Item LAPIS_LAZULI = Items.LAPIS_LAZULI; + public static Item NETHERITE_INGOT = Items.NETHERITE_INGOT; + public static Item NETHERITE_SCRAP = Items.NETHERITE_SCRAP; + public static Item QUARTZ = Items.QUARTZ; + + // ---- + + public static boolean isExist(Item item) { + return item != null && item != Items.AIR; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java new file mode 100644 index 000000000..0a6db5d51 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; + +public class CompatibleArmorItem extends Item implements CompatItemProvider { + public final ArmorEquipmentType type; + public final CompatibleArmorMaterial material; + + public CompatibleItemSettings settings; + + public CompatibleArmorItem(CompatibleArmorMaterial material, ArmorEquipmentType type, CompatibleItemSettings settings) { + super(settings.build().armor(material.build(), type.getType())); + this.type = type; + this.material = material; + + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + /** + * get ArmorEquipmentType + * @return ArmorEquipmentType + */ + public ArmorEquipmentType getArmorEquipmentType() { + return type; + } + + /** + * get ArmorMaterial + * @return CompatibleArmorMaterial + */ + public CompatibleArmorMaterial getArmorMaterial() { + return material; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java new file mode 100644 index 000000000..b5ee77b72 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java @@ -0,0 +1,64 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.item.Item; +import net.minecraft.item.equipment.ArmorMaterial; +import net.minecraft.item.equipment.EquipmentAssetKeys; +import net.minecraft.item.equipment.EquipmentType; +import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.IngredientUtil; + +import java.util.EnumMap; + +public interface CompatibleArmorMaterial { + int getDurability(ArmorEquipmentType type); + + int getProtection(ArmorEquipmentType type); + + int getEnchantability(); + + SoundEvent getEquipSound(); + + default Ingredient getRepairIngredient() { + return IngredientUtil.fromTagByIdentifier(getRepairTag().id()); + } + + /** + * @return the name of the material + */ + default String getName() { + return getId().getPath(); + } + + /** + * @return the id of the material + */ + Identifier getId(); + + float getToughness(); + + float getKnockbackResistance(); + + default TagKey getRepairTag() { + return ItemTags.REPAIRS_IRON_ARMOR; + } + + @Deprecated + default ArmorMaterial build() { + return new ArmorMaterial(0, getDefense(), getEnchantability(), RegistryEntry.of(getEquipSound()), getToughness(), getKnockbackResistance(), getRepairTag(), RegistryKey.of(EquipmentAssetKeys.REGISTRY_KEY, getId())); + } + + default EnumMap getDefense() { + EnumMap map = new EnumMap<>(EquipmentType.class); + map.put(EquipmentType.HELMET, this.getProtection(ArmorEquipmentType.HEAD)); + map.put(EquipmentType.CHESTPLATE, this.getProtection(ArmorEquipmentType.CHEST)); + map.put(EquipmentType.LEGGINGS, this.getProtection(ArmorEquipmentType.LEGS)); + map.put(EquipmentType.BOOTS, this.getProtection(ArmorEquipmentType.FEET)); + return map; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java new file mode 100644 index 000000000..dddfb3219 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java @@ -0,0 +1,111 @@ +package net.pitan76.mcpitanlib.api.item; + +import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.component.type.FoodComponent; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.minecraft.util.Rarity; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; + +import java.util.function.Supplier; + +@Deprecated +public class CompatibleItemSettings { + protected final ExtendSettings settings = new ExtendSettings(); + + protected Identifier itemGroupId = null; + protected Identifier _itemId = null; + + @Deprecated + public static CompatibleItemSettings of() { + return new CompatibleItemSettings(); + } + + // ~1.19.2 + public CompatibleItemSettings addGroup(ItemGroup itemGroup) { + settings.addGroup(itemGroup); + return this; + } + + // 1.19.3~ + // identifier: Item ID + public CompatibleItemSettings addGroup(ItemGroup itemGroup, Identifier identifier) { + settings.addGroup(itemGroup, identifier); + _itemId = identifier; + return this; + } + + public CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { + settings.addGroup(itemGroup, identifier); + _itemId = identifier; + return this; + } + + public CompatibleItemSettings addGroup(CreativeTabBuilder itemGroup) { + this.itemGroupId = itemGroup.getIdentifier(); + return this; + } + + public CompatibleItemSettings maxCount(int maxCount) { + settings.maxCount(maxCount); + return this; + } + + public CompatibleItemSettings maxDamage(int maxDamage) { + settings.maxDamage(maxDamage); + return this; + } + + public CompatibleItemSettings maxDamageIfAbsent(int maxDamage) { + try { + settings.maxDamage(maxDamage); + } catch (Exception ignored) {} + + return this; + } + + @Deprecated + public CompatibleItemSettings food(FoodComponent foodComponent) { + settings.food(foodComponent); + return this; + } + + public CompatibleItemSettings rarity(Rarity rarity) { + settings.rarity(rarity); + return this; + } + + public CompatibleItemSettings recipeRemainder(Item recipeRemainder) { + settings.recipeRemainder(recipeRemainder); + return this; + } + + public ExtendSettings build() { + if (itemGroupId != null) { + RegistrySupplier itemGroup = MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(itemGroupId); + settings.arch$tab(itemGroup); + } + + if (_itemId != null && !(this instanceof net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings)) { + settings.registryKey(RegistryKey.of(RegistryKeys.ITEM, _itemId)); + } + + return settings; + } + + public CompatibleItemSettings addGroup(ItemGroup itemGroup, CompatIdentifier identifier) { + return addGroup(itemGroup, identifier.toMinecraft()); + } + + public CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { + return addGroup(itemGroup, identifier.toMinecraft()); + } + + public CompatibleItemSettings food(CompatFoodComponent foodComponent) { + return food(foodComponent.build()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java new file mode 100644 index 000000000..790aa3de2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java @@ -0,0 +1,112 @@ +package net.pitan76.mcpitanlib.api.item; + +import dev.architectury.registry.CreativeTabRegistry; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; +import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; + +import java.util.function.Supplier; + +public class CreativeTabBuilder { + private final Identifier identifier; + private Text displayName = null; + private Supplier iconSupplier = null; + private boolean noRenderedName = false; + private boolean noScrollbar = false; + private boolean special = false; + private String texture; + + @Deprecated + // Recommend: create(identifier) + public CreativeTabBuilder(Identifier identifier) { + this.identifier = identifier; + } + + public static CreativeTabBuilder create(Identifier identifier) { + return new CreativeTabBuilder(identifier); + } + + public static CreativeTabBuilder create(CompatIdentifier identifier) { + return create(identifier.toMinecraft()); + } + + public CreativeTabBuilder setDisplayName(Text text) { + this.displayName = text; + return this; + } + + /** + * Set icon + * @param iconSupplier Icon supplier + * @return CreativeTabBuilder + */ + public CreativeTabBuilder setIcon(Supplier iconSupplier) { + this.iconSupplier = iconSupplier; + return this; + } + + /** + * Set icon (Already registered item only) + * @param item Item + * @return CreativeTabBuilder + */ + public CreativeTabBuilder setIcon(Item item) { + return setIcon(() -> new ItemStack(item)); + } + + public void noRenderedName() { + this.noRenderedName = true; + } + + public void noScrollbar() { + this.noScrollbar = true; + } + + public void special() { + this.special = true; + } + + public void setTexture(String texture) { + this.texture = texture; + } + + /** + * Build ItemGroup (If loader is forge, not recommended) + * @return ItemGroup + */ + public ItemGroup build() { + return CreativeTabRegistry.create((builder -> { + if (displayName != null) builder.displayName(displayName); + else builder.displayName(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); + + if (iconSupplier != null) builder.icon(iconSupplier); + if (noRenderedName) builder.noRenderedName(); + if (noScrollbar) builder.noScrollbar(); + if (special) builder.special(); + if (texture != null) builder.texture(IdentifierUtil.id(texture)); + })); + } + + @SuppressWarnings("deprecation") + public ItemGroupWrapper getBuiltWrapper() { + if (MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.containsKey(identifier)) + return ItemGroupWrapper.of(MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(identifier).getOrNull()); + + return ItemGroupWrapper.of(build()); + } + + public Identifier getIdentifier() { + return identifier; + } + + public CompatIdentifier getCompatIdentifier() { + return CompatIdentifier.fromMinecraft(identifier); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java new file mode 100644 index 000000000..91b0afabd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java @@ -0,0 +1,112 @@ +package net.pitan76.mcpitanlib.api.item; + +import dev.architectury.registry.CreativeTabRegistry; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.ItemUtil; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; + +public class CreativeTabManager { + private static List bookingItems = new ArrayList<>(); + private static List bookingStacks = new ArrayList<>(); + + // グループ予約済みアイテム + public static class BookingItem { + @Deprecated + public ItemGroup itemGroup; + + public Supplier itemGroupSupplier; + public Identifier identifier; + + @Deprecated + private BookingItem(ItemGroup itemGroup, Identifier identifier) { + this.itemGroup = itemGroup; + this.identifier = identifier; + } + + private BookingItem(Supplier itemGroup, Identifier identifier) { + this.itemGroupSupplier = itemGroup; + this.identifier = identifier; + } + + public ItemGroup getItemGroup() { + if (itemGroupSupplier != null) + return itemGroupSupplier.get(); + return itemGroup; + } + } + + // グループ予約済みアイテムスタック + public static class BookingStack { + @Deprecated + public ItemGroup itemGroup; + + public Supplier itemGroupSupplier; + public ItemStack stack; + + @Deprecated + private BookingStack(ItemGroup itemGroup, ItemStack stack) { + this.itemGroup = itemGroup; + this.stack = stack; + } + + private BookingStack(Supplier itemGroup, ItemStack stack) { + this.itemGroupSupplier = itemGroup; + this.stack = stack; + } + + public ItemGroup getItemGroup() { + if (itemGroupSupplier != null) + return itemGroupSupplier.get(); + return itemGroup; + } + } + + public static void allRegister() { + if (!bookingItems.isEmpty()) { + for (BookingItem bookingItem : bookingItems) { + CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); + } + bookingItems = new ArrayList<>(); + } + + if (!bookingStacks.isEmpty()) { + for (BookingStack bookingStack : bookingStacks) { + CreativeTabRegistry.appendBuiltinStack(bookingStack.getItemGroup(), bookingStack.stack); + } + bookingStacks = new ArrayList<>(); + } + } + + public static void register(Identifier identifier) { + if (bookingItems.isEmpty()) return; + for (BookingItem bookingItem : bookingItems) { + if (!bookingItem.identifier.toString().equals(identifier.toString())) continue; + CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); + bookingItems.remove(bookingItem); + break; + } + } + + @Deprecated + public static void addItem(ItemGroup itemGroup, Identifier identifier) { + bookingItems.add(new BookingItem(itemGroup, identifier)); + } + + @Deprecated + public static void addStack(ItemGroup itemGroup, ItemStack stack) { + bookingStacks.add(new BookingStack(itemGroup, stack)); + } + + public static void addItem(Supplier itemGroup, Identifier identifier) { + bookingItems.add(new BookingItem(itemGroup, identifier)); + } + + public static void addStack(Supplier itemGroup, ItemStack stack) { + bookingStacks.add(new BookingStack(itemGroup, stack)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java b/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java new file mode 100644 index 000000000..b5d5f17ce --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemGroups; +import net.minecraft.registry.Registries; + +public class DefaultItemGroups { + public static final ItemGroup BUILDING_BLOCKS = Registries.ITEM_GROUP.get(ItemGroups.BUILDING_BLOCKS); + public static final ItemGroup COLORED_BLOCKS = Registries.ITEM_GROUP.get(ItemGroups.COLORED_BLOCKS); // if 1.19.2 and below, BUILDING_BLOCKS + public static final ItemGroup NATURAL = Registries.ITEM_GROUP.get(ItemGroups.NATURAL); // if 1.19.2 and below, DECORATIONS + public static final ItemGroup FUNCTIONAL = Registries.ITEM_GROUP.get(ItemGroups.FUNCTIONAL); // if 1.19.2 and below, TRANSPORTATION + public static final ItemGroup REDSTONE = Registries.ITEM_GROUP.get(ItemGroups.REDSTONE); + public static final ItemGroup HOTBAR = Registries.ITEM_GROUP.get(ItemGroups.HOTBAR); + public static final ItemGroup SEARCH = Registries.ITEM_GROUP.get(ItemGroups.SEARCH); + public static final ItemGroup TOOLS = Registries.ITEM_GROUP.get(ItemGroups.TOOLS); + public static final ItemGroup COMBAT = Registries.ITEM_GROUP.get(ItemGroups.COMBAT); + public static final ItemGroup FOOD_AND_DRINK = Registries.ITEM_GROUP.get(ItemGroups.FOOD_AND_DRINK); // if 1.19.2 and below, FOOD + public static final ItemGroup INGREDIENTS = Registries.ITEM_GROUP.get(ItemGroups.INGREDIENTS); // if 1.19.2 and below, MISC + public static final ItemGroup SPAWN_EGGS = Registries.ITEM_GROUP.get(ItemGroups.SPAWN_EGGS); // if 1.19.2 and below, MISC + public static final ItemGroup OPERATOR = Registries.ITEM_GROUP.get(ItemGroups.OPERATOR); // if 1.19.2 and below, MISC + public static final ItemGroup INVENTORY = Registries.ITEM_GROUP.get(ItemGroups.INVENTORY); + + // ~1.19.2 Item Group + public static final ItemGroup BREWING = FOOD_AND_DRINK; + public static final ItemGroup TRANSPORTATION = FUNCTIONAL; + public static final ItemGroup DECORATIONS = NATURAL; + public static final ItemGroup MISC = INGREDIENTS; +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java new file mode 100644 index 000000000..d69eaa553 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java @@ -0,0 +1,138 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.block.Block; +import net.minecraft.component.type.TooltipDisplayComponent; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.*; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.StackActionResult; +import net.pitan76.mcpitanlib.core.Dummy; +import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; + +import java.util.List; +import java.util.function.Consumer; + +public class ExtendBlockItem extends BlockItem implements ExtendItemProvider { + + public ExtendBlockItem(Block block, Settings settings) { + super(block, settings); + } + + public ExtendBlockItem(Block block, CompatibleItemSettings settings) { + super(block, settings.build()); + } + + // ExtendItem + @Deprecated + @Override + public ActionResult use(World world, PlayerEntity user, Hand hand) { + return onRightClick(new ItemUseEvent(world, user, hand)).toActionResult(); + } + + @Deprecated + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; + return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); + } + + @Deprecated + @Override + public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { + return onFinishUsing(new ItemFinishUsingEvent(stack, world, user)); + } + + @Deprecated + @Override + public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); + } + + @Deprecated + public boolean hasRecipeRemainder() { + return hasRecipeRemainder(new Dummy()); + } + + @Deprecated + @Override + public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); + } + + @Deprecated + @Override + public void onCraft(ItemStack stack, World world) { + onCraft(new CraftEvent(stack, world)); + } + + /** + * item right click event + * + * @param event ItemUseEvent + * @return ActionResultType + */ + public StackActionResult onRightClick(ItemUseEvent event) { + return StackActionResult.create(CompatActionResult.create(super.use(event.world, event.user.getPlayerEntity(), event.hand)), event.stack); + } + + /** + * item right click event on block + * @param event ItemUseOnBlockEvent + * @return ActionResultType + */ + public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { + return CompatActionResult.create(super.useOnBlock(event.toIUC())); + } + + /** + * item finish using event + * @param event ItemFinishUsingEvent + * @return ItemStack + */ + public ItemStack onFinishUsing(ItemFinishUsingEvent event) { + return super.finishUsing(event.stack, event.world, event.user); + } + + /** + * item right click event on entity + * @param event ItemUseOnEntityEvent + * @return ActionResultType + */ + public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event) { + return CompatActionResult.create(super.useOnEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); + } + + /** + * check if item has recipe remainder + * @param dummy Dummy + * @return boolean + */ + public boolean hasRecipeRemainder(Dummy dummy) { + return false; + } + + /** + * append tooltip to item + * @param event ItemAppendTooltipEvent + */ + public void appendTooltip(ItemAppendTooltipEvent event) { + super.appendTooltip(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); + } + + /** + * on craft event + * @param event CraftEvent + */ + public void onCraft(CraftEvent event) { + super.onCraft(event.stack, event.world); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java new file mode 100644 index 000000000..54e1391cc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java @@ -0,0 +1,262 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.block.BlockState; +import net.minecraft.component.type.TooltipDisplayComponent; +import net.minecraft.entity.Entity; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.item.consume.UseAction; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.Rarity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.*; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.StackActionResult; +import net.pitan76.mcpitanlib.core.Dummy; +import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; + +import java.util.List; +import java.util.function.Consumer; + +public class ExtendItem extends Item { + + public ExtendItem(Settings settings) { + super(settings); + } + + public ExtendItem(CompatibleItemSettings settings) { + super(settings.build()); + } + + @Deprecated + @Override + public ActionResult use(World world, PlayerEntity user, Hand hand) { + return onRightClick(new ItemUseEvent(world, user, hand)).toActionResult(); + } + + @Deprecated + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; + return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); + } + + @Deprecated + @Override + public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { + return onFinishUsing(new ItemFinishUsingEvent(stack, world, user)); + } + + @Deprecated + @Override + public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); + } + + @Override + public UseAction getUseAction(ItemStack stack) { + return super.getUseAction(stack); + } + + @Deprecated + //@Override + public boolean hasRecipeRemainder() { + return hasRecipeRemainder(new Dummy()); + } + + @Deprecated + @Override + public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); + } + + @Deprecated + @Override + public void onCraft(ItemStack stack, World world) { + onCraft(new CraftEvent(stack, world)); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * item right click event + * + * @param event ItemUseEvent + * @return ActionResultType + */ + public StackActionResult onRightClick(ItemUseEvent event) { + return StackActionResult.create(CompatActionResult.create(super.use(event.world, event.user.getPlayerEntity(), event.hand)), event.stack); + } + + /** + * item right click event on block + * @param event ItemUseOnBlockEvent + * @return ActionResultType + */ + public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { + return CompatActionResult.create(super.useOnBlock(event.toIUC())); + } + + /** + * item finish using event + * @param event ItemFinishUsingEvent + * @return ItemStack + */ + public ItemStack onFinishUsing(ItemFinishUsingEvent event) { + return super.finishUsing(event.stack, event.world, event.user); + } + + /** + * item right click event on entity + * @param event ItemUseOnEntityEvent + * @return ActionResultType + */ + public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event) { + return CompatActionResult.create(super.useOnEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); + } + + /** + * check if item has recipe remainder + * @param dummy Dummy + * @return boolean + */ + public boolean hasRecipeRemainder(Dummy dummy) { + return false; + } + + /** + * append tooltip to item + * @param event ItemAppendTooltipEvent + */ + public void appendTooltip(ItemAppendTooltipEvent event) { + super.appendTooltip(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); + } + + /** + * on craft event + * @param event CraftEvent + */ + public void onCraft(CraftEvent event) { + super.onCraft(event.stack, event.world); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + // -1.20.6 + public Rarity getRarity(ItemStack stack) { + return Rarity.COMMON; + } + + @Deprecated + public boolean isEnchantable(ItemStack stack) { + return isEnchantable(new EnchantableArgs(stack)); + } + + public boolean isEnchantable(EnchantableArgs args) { + return false; + } + + @Deprecated + public int getEnchantability() { + return getEnchantability(new EnchantabilityArgs()); + } + + public int getEnchantability(EnchantabilityArgs args) { + return 0; + } + + @Deprecated + @Override + public int getItemBarColor(ItemStack stack) { + return getItemBarColor(new ItemBarColorArgs(stack)); + } + + public int getItemBarColor(ItemBarColorArgs args) { + return super.getItemBarColor(args.stack); + } + + @Deprecated + @Override + public boolean isItemBarVisible(ItemStack stack) { + return isItemBarVisible(new ItemBarVisibleArgs(stack)); + } + + public boolean isItemBarVisible(ItemBarVisibleArgs args) { + return super.isItemBarVisible(args.stack); + } + + @Deprecated + @Override + public int getItemBarStep(ItemStack stack) { + return getItemBarStep(new ItemBarStepArgs(stack)); + } + + public int getItemBarStep(ItemBarStepArgs args) { + return super.getItemBarStep(args.stack); + } + + @Deprecated + @Override + public float getBonusAttackDamage(Entity target, float baseAttackDamage, DamageSource damageSource) { + return getBonusAttackDamage(new BonusAttackDamageArgs(target, baseAttackDamage, damageSource)); + } + + public float getBonusAttackDamage(BonusAttackDamageArgs args) { + return super.getBonusAttackDamage(args.target, args.baseAttackDamage, args.damageSource); + } + + @Deprecated + //@Override + public boolean canRepair(ItemStack stack, ItemStack ingredient) { + return canRepair(new CanRepairArgs(stack, ingredient)); + } + + public boolean canRepair(CanRepairArgs args) { + return false; + } + + @Deprecated + @Override + public boolean canMine(ItemStack stack, BlockState state, World world, BlockPos pos, LivingEntity user) { + return canMine(new CanMineArgs(stack, state, world, pos, user)); + } + + public boolean canMine(CanMineArgs args) { + return super.canMine(args.stack, args.state, args.world, args.pos, args.entity); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java new file mode 100644 index 000000000..7742fa05e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java @@ -0,0 +1,136 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.Rarity; +import net.pitan76.mcpitanlib.api.event.item.*; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.StackActionResult; + +public interface ExtendItemProvider { + + /** + * item right click event + * + * @param event ItemUseEvent + * @return ActionResultType + */ + default StackActionResult onRightClick(ItemUseEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * item right click event on block + * @param event ItemUseOnBlockEvent + * @return ActionResultType + */ + default CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * using finish with item + * @param event ItemFinishUsingEvent + * @return ItemStack + */ + default ItemStack onFinishUsing(ItemFinishUsingEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * on click with item on entity + * @param event ItemUseOnEntityEvent + * @return ActionResult + */ + default CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event, Options options) { + options.cancel = false; + return null; + } + + /** + * item has recipe remainder + * @param options Options + * @return boolean + */ + default boolean hasRecipeRemainder(Options options) { + options.cancel = false; + return false; + } + + /** + * add tooltip + * @param event ItemAppendTooltipEvent + */ + default void appendTooltip(ItemAppendTooltipEvent event, Options options) { + options.cancel = false; + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + default boolean postHit(PostHitEvent event, Options options) { + options.cancel = false; + return false; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + default boolean postMine(PostMineEvent event, Options options) { + options.cancel = false; + return false; + } + + /** + * on craft event + * @param event CraftEvent + */ + default void onCraft(CraftEvent event, Options options) { + options.cancel = false; + } + + default Rarity getRarity(ItemStack stack, Options options) { + options.cancel = false; + return null; + } + + default boolean isEnchantable(EnchantableArgs args, Options options) { + options.cancel = false; + return false; + } + + default int getEnchantability(EnchantabilityArgs args, Options options) { + options.cancel = false; + return 0; + } + + default int getItemBarColor(ItemBarColorArgs args, Options options) { + options.cancel = false; + return 0; + } + + default boolean isItemBarVisible(ItemBarVisibleArgs args, Options options) { + options.cancel = false; + return false; + } + + default int getItemBarStep(ItemBarStepArgs args, Options options) { + options.cancel = false; + return 0; + } + + default float getBonusAttackDamage(BonusAttackDamageArgs args, Options options) { + options.cancel = false; + return 0; + } + + public static class Options { + public boolean cancel = true; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java new file mode 100644 index 000000000..5e7db67a0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.resources.Identifier; + +import java.util.function.Supplier; + +/** + * Use {@link CompatibleItemSettings} instead. + */ +public class ExtendSettings extends Item.Settings { + + // ~1.19.2 + @Deprecated + public ExtendSettings addGroup(ItemGroup itemGroup) { + return this; + } + + // 1.19.3~ + // identifier: Item ID + @Deprecated + public ExtendSettings addGroup(ItemGroup itemGroup, Identifier identifier) { + this.arch$tab(itemGroup); + CreativeTabManager.addItem(itemGroup, identifier); + return this; + } + + @Deprecated + public ExtendSettings addGroup(Supplier itemGroup, Identifier identifier) { + CreativeTabManager.addItem(itemGroup, identifier); + return this; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java new file mode 100644 index 000000000..c96382ed2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java @@ -0,0 +1,7 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.item.ItemStack; + +public interface FixedRecipeRemainderItem { + ItemStack getFixedRecipeRemainder(ItemStack stack); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java new file mode 100644 index 000000000..a188233b2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class FoodItem extends CompatItem { + public FoodItem(int hunger, float saturation, CompatIdentifier id) { + this(new ItemSettingsBuilder().foodComponent(CompatFoodComponent.create().setHunger(hunger).setSaturation(saturation)).build(id)); + } + + public FoodItem(CompatFoodComponent component, CompatIdentifier id) { + this(new ItemSettingsBuilder().foodComponent(component).build(id)); + } + + public FoodItem(CompatFoodComponent component, ItemSettingsBuilder builder, CompatIdentifier id) { + this(builder.foodComponent(component).build(id)); + } + + public FoodItem(CompatFoodComponent component, CompatibleItemSettings settings) { + this(settings.food(component)); + } + + public FoodItem(CompatibleItemSettings settings) { + super(settings); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java new file mode 100644 index 000000000..6db9d79f4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.item.args; + +import net.minecraft.item.ItemStack; + +public class RarityArgs { + public ItemStack stack; + + public RarityArgs(ItemStack stack) { + this.stack = stack; + } + + public ItemStack getStack() { + return stack; + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java new file mode 100644 index 000000000..e7c9e8446 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java @@ -0,0 +1,80 @@ +package net.pitan76.mcpitanlib.api.item.args; + +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; + +import java.util.Optional; + +public class StoppedUsingArgs { + + public ItemStack stack; + public World world; + public LivingEntity user; + public int remainingUseTicks; + + public StoppedUsingArgs(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { + this.stack = stack; + this.world = world; + this.user = user; + this.remainingUseTicks = remainingUseTicks; + } + + public StoppedUsingArgs(ItemStack stack, World world, LivingEntity user) { + this(stack, world, user, 0); + } + + public StoppedUsingArgs(ItemStack stack, World world, Player player, int remainingUseTicks) { + this(stack, world, player.getEntity(), remainingUseTicks); + } + + public StoppedUsingArgs(ItemStack stack, World world, Player player) { + this(stack, world, player, 0); + } + + public ItemStack getStack() { + return stack; + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } + + public World getWorld() { + return world; + } + + public LivingEntity getUser() { + return user; + } + + public int getRemainingUseTicks() { + return remainingUseTicks; + } + + public boolean hasRemainingUseTicks() { + return remainingUseTicks > 0; + } + + public boolean hasNoRemainingUseTicks() { + return !hasRemainingUseTicks(); + } + + public boolean isClient() { + return world.isClient(); + } + + public boolean isServer() { + return !isClient(); + } + + public boolean isPlayer() { + return user instanceof PlayerEntity; + } + + public Optional getPlayer() { + return isPlayer() ? Optional.of(new Player((PlayerEntity) user)) : Optional.empty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java new file mode 100644 index 000000000..acdbd404d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.item.args; + +import net.minecraft.item.ItemStack; + +public class UseActionArgs { + public ItemStack stack; + + public UseActionArgs(ItemStack stack) { + this.stack = stack; + } + + public static UseActionArgs of(ItemStack stack) { + return new UseActionArgs(stack); + } + + public static UseActionArgs of(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return of(stack.toMinecraft()); + } + + public ItemStack getStack() { + return stack; + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java b/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java new file mode 100644 index 000000000..e3350697c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java @@ -0,0 +1,45 @@ +package net.pitan76.mcpitanlib.api.item.consume; + +import net.minecraft.item.consume.UseAction; +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class CompatUseAction implements CompatStringIdentifiable { + private final UseAction useAction; + + public static final CompatUseAction NONE = of(UseAction.NONE); + public static final CompatUseAction EAT = of(UseAction.EAT); + public static final CompatUseAction DRINK = of(UseAction.DRINK); + public static final CompatUseAction BLOCK = of(UseAction.BLOCK); + public static final CompatUseAction BOW = of(UseAction.BOW); + public static final CompatUseAction SPEAR = of(UseAction.SPEAR); + public static final CompatUseAction CROSSBOW = of(UseAction.CROSSBOW); + public static final CompatUseAction SPYGLASS = of(UseAction.SPYGLASS); + public static final CompatUseAction TOOT_HORN = of(UseAction.TOOT_HORN); + public static final CompatUseAction BRUSH = of(UseAction.BRUSH); + + public CompatUseAction(UseAction useAction) { + this.useAction = useAction; + } + + public static CompatUseAction of(UseAction useAction) { + return new CompatUseAction(useAction); + } + + @Deprecated + public UseAction get() { + return useAction; + } + + public int getId() { + return useAction.getId(); + } + + public String getName() { + return useAction.asString(); + } + + @Override + public String asString_compat() { + return getName(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java new file mode 100644 index 000000000..3a979fc7e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.item.equipment; + +import net.minecraft.item.equipment.EquipmentAssetKeys; +import net.minecraft.registry.RegistryKey; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatEquipmentAsset { + private final RegistryKey raw; + + @Deprecated + public CompatEquipmentAsset(RegistryKey key) { + this.raw = key; + } + + @Deprecated + public RegistryKey raw() { + return raw; + } + + public CompatIdentifier getId() { + return CompatIdentifier.fromMinecraft(raw.getValue()); + } + + @Deprecated + public static CompatEquipmentAsset of(RegistryKey key) { + return new CompatEquipmentAsset(key); + } + + public static CompatEquipmentAsset of(CompatIdentifier id) { + return of(RegistryKey.of(EquipmentAssetKeys.REGISTRY_KEY, id.toMinecraft())); + } + + public static CompatEquipmentAsset of(String id) { + return of(CompatIdentifier.of(id)); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof CompatEquipmentAsset)) return false; + CompatEquipmentAsset that = (CompatEquipmentAsset) obj; + return raw.equals(that.raw); + } + + @Override + public int hashCode() { + if (raw == null) return super.hashCode(); + return raw.hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java new file mode 100644 index 000000000..e66cde67e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.api.item.equipment; + +import net.minecraft.component.type.EquippableComponent; + +public class CompatEquippableComponent { + private final EquippableComponent raw; + + @Deprecated + public CompatEquippableComponent(EquippableComponent component) { + this.raw = component; + } + + @Deprecated + public EquippableComponent raw() { + return raw; + } + + @Deprecated + public static CompatEquippableComponent of(EquippableComponent component) { + return new CompatEquippableComponent(component); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof CompatEquippableComponent)) return false; + CompatEquippableComponent that = (CompatEquippableComponent) obj; + return raw().equals(that.raw()); + } + + @Override + public int hashCode() { + if (raw() == null) return super.hashCode(); + return raw().hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java new file mode 100644 index 000000000..5ced28a55 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java @@ -0,0 +1,94 @@ +package net.pitan76.mcpitanlib.api.item.equipment; + +import net.minecraft.component.type.EquippableComponent; +import net.minecraft.entity.EntityType; +import net.minecraft.registry.Registries; +import net.minecraft.registry.RegistryEntryLookup; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class EquippableComponentBuilder { + + public ArmorEquipmentType equipmentType; + public CompatSoundEvent equipSound; + public CompatSoundEvent shearingSound; + public boolean equipOnInteract = false; + public boolean canBeSheared = false; + public CompatEquipmentAsset model; + public TagKey allowedEntities = null; + + public EquippableComponentBuilder() { + + } + + public EquippableComponentBuilder(ArmorEquipmentType equipmentType) { + this.equipmentType = equipmentType; + } + + public EquippableComponentBuilder equipmentType(ArmorEquipmentType equipmentType) { + this.equipmentType = equipmentType; + return this; + } + + public EquippableComponentBuilder equipSound(CompatSoundEvent equipSound) { + this.equipSound = equipSound; + return this; + } + + public EquippableComponentBuilder shearingSound(CompatSoundEvent shearingSound) { + this.shearingSound = shearingSound; + return this; + } + + public EquippableComponentBuilder equipOnInteract(boolean equipOnInteract) { + this.equipOnInteract = equipOnInteract; + return this; + } + + public EquippableComponentBuilder canBeSheared(boolean canBeSheared) { + this.canBeSheared = canBeSheared; + return this; + } + + public EquippableComponentBuilder model(CompatEquipmentAsset model) { + this.model = model; + return this; + } + + public EquippableComponentBuilder model(CompatIdentifier id) { + return model(CompatEquipmentAsset.of(id)); + } + + public EquippableComponentBuilder allowedEntities(TagKey allowedEntities) { + this.allowedEntities = allowedEntities; + return this; + } + + public EquippableComponentBuilder allowedEntities(CompatIdentifier tagId) { + return allowedEntities(TagKey.create(TagKey.Type.ENTITY_TYPE, tagId)); + } + + public EquippableComponentBuilder allowedEntities(String tagId) { + return allowedEntities(CompatIdentifier.of(tagId)); + } + + public CompatEquippableComponent build() { + EquippableComponent.Builder component = EquippableComponent.builder(equipmentType.getSlot()); + if (equipSound != null) + component.equipSound(equipSound.getEntry() != null ? equipSound.getEntry() : equipSound.getReference()); + if (shearingSound != null) + component.shearingSound(shearingSound.getEntry() != null ? shearingSound.getEntry() : shearingSound.getReference()); + + component.equipOnInteract(equipOnInteract); + component.canBeSheared(canBeSheared); + if (model != null) component.model(model.raw()); + if (allowedEntities != null) { + RegistryEntryLookup> registryEntryLookup = Registries.createEntryLookup(Registries.ENTITY_TYPE); + component.allowedEntities(registryEntryLookup.getOrThrow((net.minecraft.registry.tag.TagKey>) allowedEntities.getTagKey())); + } + + return CompatEquippableComponent.of(component.build()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java new file mode 100644 index 000000000..e29531d73 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.api.item.stack; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.LoreComponent; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; + +import java.util.List; + +public class LoreUtil { + public static boolean hasLore(ItemStack stack) { + return stack.contains(DataComponentTypes.LORE); + } + + public static List getLore(ItemStack stack) { + if (!hasLore(stack)) return List.of(); + return stack.get(DataComponentTypes.LORE).lines(); + } + + public static List getLoreAsStringList(ItemStack stack) { + return getLore(stack).stream() + .map(Text::getString) + .toList(); + } + + public static String getLoreAsString(ItemStack stack) { + return getLoreAsStringList(stack).stream() + .reduce("", (a, b) -> a + "\n" + b); + } + + public static void setLore(ItemStack stack, List lore) { + stack.set(DataComponentTypes.LORE, new LoreComponent(lore)); + } + + public static void setLoreStringList(ItemStack stack, List lore) { + setLore(stack, lore.stream() + .map(Text::of) + .toList()); + } + + public static void setLore(ItemStack stack, String lore) { + setLore(stack, lore.lines() + .map(Text::of) + .toList()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java new file mode 100644 index 000000000..f6023e0ac --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java @@ -0,0 +1,90 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.AxeItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +public class CompatibleAxeItem extends AxeItem implements CompatItemProvider { + + public CompatibleItemSettings settings; + + public CompatibleAxeItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material.build(), attackDamage, attackSpeed, settings.build()); + this.settings = settings; + } + + public CompatibleAxeItem(float attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings.build()); + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + // -1.20.6 + public boolean isDamageableOnDefault() { + return ItemStackUtil.getMaxDamage(this) > 0; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java new file mode 100644 index 000000000..0842a0fd9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java @@ -0,0 +1,90 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.HoeItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; + +public class CompatibleHoeItem extends HoeItem implements CompatItemProvider { + + public CompatibleItemSettings settings; + + public CompatibleHoeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material.build(), attackDamage, attackSpeed, settings.build()); + this.settings = settings; + } + + public CompatibleHoeItem(int attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings.build()); + this.settings = settings; + } + + @Override + public net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + // -1.20.6 + public boolean isDamageableOnDefault() { + return ItemStackUtil.getMaxDamage(this) > 0; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java new file mode 100644 index 000000000..153b473b2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java @@ -0,0 +1,125 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.ItemUseOnEntityEvent; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; +import net.pitan76.mcpitanlib.api.tag.v2.typed.BlockTagKey; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +public class CompatibleMiningToolItem extends Item implements CompatItemProvider { + + public CompatibleItemSettings settings; + + @Deprecated + protected CompatibleMiningToolItem(float attackDamage, float attackSpeed, ToolMaterial material, net.minecraft.registry.tag.TagKey effectiveBlocks, Settings settings) { + super(settings.tool(material, effectiveBlocks, attackDamage, attackSpeed, 0)); + } + + public CompatibleMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, TagKey tagKey, CompatibleItemSettings settings) { + this(attackDamage, attackSpeed, material.build(), tagKey.getTagKey(), settings.build()); + this.settings = settings; + } + + public CompatibleMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatTagKey tagKey, CompatibleItemSettings settings) { + this(attackDamage, attackSpeed, material.build(), tagKey.getTagKey(), settings.build()); + this.settings = settings; + } + + public CompatibleMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, BlockTagKey tagKey, CompatibleItemSettings settings) { + this(attackDamage, attackSpeed, material.build(), tagKey.getTagKey(), settings.build()); + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + // -1.20.6 + public boolean isDamageableOnDefault() { + return ItemStackUtil.getMaxDamage(this) > 0; + } + + @Deprecated + @Override + public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); + } + + @Deprecated + @Override + public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event, Options options) { + return CompatItemProvider.super.onRightClickOnEntity(event, options); + } + + public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent e) { + return CompatActionResult.of(super.useOnEntity(e.stack, e.user.getEntity(), e.entity, e.hand)); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java new file mode 100644 index 000000000..6a7d66539 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java @@ -0,0 +1,90 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; + +public class CompatiblePickaxeItem extends Item implements CompatItemProvider { + + public CompatibleItemSettings settings; + + public CompatiblePickaxeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(settings.build().pickaxe(material.build(), attackDamage, attackSpeed)); + this.settings = settings; + } + + public CompatiblePickaxeItem(int attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { + super(settings.build().pickaxe(material, attackDamage, attackSpeed)); + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + // -1.20.6 + public boolean isDamageableOnDefault() { + return ItemStackUtil.getMaxDamage(this) > 0; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java new file mode 100644 index 000000000..baf1308b3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java @@ -0,0 +1,89 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ShearsItem; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +public class CompatibleShearsItem extends ShearsItem implements CompatItemProvider { + + public CompatibleItemSettings settings; + + @Deprecated + public CompatibleShearsItem(Settings settings) { + super(settings); + } + + public CompatibleShearsItem(CompatibleItemSettings settings) { + this(settings.build()); + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + // -1.20.6 + public boolean isDamageableOnDefault() { + return ItemStackUtil.getMaxDamage(this) > 0; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java new file mode 100644 index 000000000..d3737e319 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java @@ -0,0 +1,90 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ShovelItem; +import net.minecraft.item.ToolMaterial; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +public class CompatibleShovelItem extends ShovelItem implements CompatItemProvider { + + public CompatibleItemSettings settings; + + public CompatibleShovelItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material.build(), attackDamage, attackSpeed, settings.build()); + } + + public CompatibleShovelItem(float attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings.build()); + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * post hit event + * + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + // -1.20.6 + public boolean isDamageableOnDefault() { + return ItemStackUtil.getMaxDamage(this) > 0; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java new file mode 100644 index 000000000..cba960cde --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java @@ -0,0 +1,90 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; + +public class CompatibleSwordItem extends Item implements CompatItemProvider { + + public CompatibleItemSettings settings; + + public CompatibleSwordItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(settings.build().sword(material.build(), attackDamage, attackSpeed)); + this.settings = settings; + } + + public CompatibleSwordItem(int attackDamage, float attackSpeed, ToolMaterial material, CompatibleItemSettings settings) { + super(settings.build().sword(material, attackDamage, attackSpeed)); + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } + + // -1.20.6 + public boolean isDamageableOnDefault() { + return ItemStackUtil.getMaxDamage(this) > 0; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java new file mode 100644 index 000000000..27907c3ce --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java @@ -0,0 +1,86 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; +import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; + +public class CompatibleToolItem extends Item implements CompatItemProvider { + + public CompatibleToolMaterial material; + + public CompatibleItemSettings settings; + + @Deprecated + protected CompatibleToolItem(Settings settings) { + super(settings); + } + + public CompatibleToolItem(CompatibleToolMaterial material, CompatibleItemSettings settings) { + this(settings.build().tool(material.build(), null, 0, 0, 0)); + this.material = material; + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public boolean overrideIsSuitableFor(BlockState state) { + return super.isCorrectForDrops(getDefaultStack(), state); + } + + @Deprecated + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return overrideIsSuitableFor(state); + } + + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return 1.0F; + } + + @Deprecated + @Override + public float getMiningSpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * material.getCompatMiningSpeedMultiplier(); + } + + @Deprecated + @Override + public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + postHit(new PostHitEvent(stack, target, attacker)); + } + + @Deprecated + @Override + public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + return postMine(new PostMineEvent(stack, world, state, pos, miner)); + } + + /** + * post hit event + * @param event PostHitEvent + * @return boolean + */ + public boolean postHit(PostHitEvent event) { + super.postHit(event.stack, event.target, event.attacker); + return true; + } + + /** + * post mine event + * @param event PostMineEvent + * @return boolean + */ + public boolean postMine(PostMineEvent event) { + return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java new file mode 100644 index 000000000..ab44f30bf --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java @@ -0,0 +1,85 @@ +package net.pitan76.mcpitanlib.api.item.tool; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ToolMaterial; +import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.IngredientUtil; + +public interface CompatibleToolMaterial { + + int getCompatMiningLevel(); + + float getCompatAttackDamage(); + + float getCompatMiningSpeedMultiplier(); + + default Ingredient getCompatRepairIngredient() { + return IngredientUtil.fromTagByIdentifier(getRepairTag().id()); + } + + int getCompatDurability(); + + int getCompatEnchantability(); + + default TagKey getInverseTag() { + + return level2inverseTag(getCompatMiningLevel()); + } + + public static TagKey level2inverseTag(int level) { + switch (level) { + case 1: + return BlockTags.INCORRECT_FOR_WOODEN_TOOL; + case 2: + return BlockTags.INCORRECT_FOR_STONE_TOOL; + case 3: + return BlockTags.INCORRECT_FOR_IRON_TOOL; + case 4: + return BlockTags.INCORRECT_FOR_GOLD_TOOL; + case 5: + return BlockTags.INCORRECT_FOR_DIAMOND_TOOL; + case 6: + return BlockTags.INCORRECT_FOR_NETHERITE_TOOL; + + default: + return BlockTags.INCORRECT_FOR_WOODEN_TOOL; + } + } + + @Deprecated + default float getAttackDamage() { + return getCompatAttackDamage(); + } + + @Deprecated + default float getMiningSpeedMultiplier() { + return getCompatMiningSpeedMultiplier(); + } + + @Deprecated + default Ingredient getRepairIngredient() { + return getCompatRepairIngredient(); + } + + @Deprecated + default int getDurability() { + return getCompatDurability(); + } + + @Deprecated + default int getEnchantability() { + return getCompatEnchantability(); + } + + default TagKey getRepairTag() { + return ItemTags.IRON_TOOL_MATERIALS; + } + + default ToolMaterial build() { + return new ToolMaterial(getInverseTag(), getCompatDurability(), getCompatMiningSpeedMultiplier(), getCompatAttackDamage(), getCompatEnchantability(), getRepairTag()); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java new file mode 100644 index 000000000..f43e2ad83 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.item.v2; + +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +@Deprecated +public interface CompatArmorMaterial extends CompatibleArmorMaterial { + + @Override + default SoundEvent getEquipSound() { + return getEquipCompatSound().get(); + } + + CompatSoundEvent getEquipCompatSound(); + + @Override + default Identifier getId() { + return getCompatId().toMinecraft(); + } + + CompatIdentifier getCompatId(); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java new file mode 100644 index 000000000..aa542b01b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java @@ -0,0 +1,103 @@ +package net.pitan76.mcpitanlib.api.item.v2; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.consume.UseAction; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.Rarity; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.CanRepairArgs; +import net.pitan76.mcpitanlib.api.event.item.EnchantabilityArgs; +import net.pitan76.mcpitanlib.api.event.item.EnchantableArgs; +import net.pitan76.mcpitanlib.api.event.item.InventoryTickEvent; +import net.pitan76.mcpitanlib.api.item.ExtendItem; +import net.pitan76.mcpitanlib.api.item.args.RarityArgs; +import net.pitan76.mcpitanlib.api.item.args.StoppedUsingArgs; +import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; +import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; +import net.pitan76.mcpitanlib.api.util.CompatRarity; +import net.pitan76.mcpitanlib.core.Dummy; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import org.jetbrains.annotations.Nullable; + +public class CompatItem extends ExtendItem { + + public CompatibleItemSettings settings; + + public CompatItem(CompatibleItemSettings settings) { + super(settings); + this.settings = settings; + } + + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + public ItemWrapper getWrapper() { + return ItemWrapper.of(this); + } + + @Deprecated + @Override + public UseAction getUseAction(ItemStack stack) { + return getUseAction(new UseActionArgs(stack)).get(); + } + + public CompatUseAction getUseAction(UseActionArgs args) { + return CompatUseAction.of(super.getUseAction(args.stack)); + } + + @Deprecated + @Override + public Rarity getRarity(ItemStack stack) { + return getRarity(new RarityArgs(stack)).get(); + } + + public CompatRarity getRarity(RarityArgs args) { + return settings.rarity; + } + + @Override + public boolean isEnchantable(EnchantableArgs args) { + return settings.enchantability != -1; + } + + @Override + public int getEnchantability(EnchantabilityArgs args) { + return settings.enchantability; + } + + @Override + public boolean canRepair(CanRepairArgs args) { + RepairIngredientTag tag = settings.repairIngredientTag; + return tag != null && tag.contains(args.stack); + } + + @Override + public boolean hasRecipeRemainder(Dummy dummy) { + return settings.recipeRemainder != null; + } + + @Deprecated + @Override + public boolean onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { + return onStoppedUsing(new StoppedUsingArgs(stack, world, user, remainingUseTicks)); + } + + public boolean onStoppedUsing(StoppedUsingArgs args) { + return super.onStoppedUsing(args.stack, args.world, args.user, args.remainingUseTicks); + } + + @Deprecated + @Override + public void inventoryTick(ItemStack stack, ServerWorld world, Entity entity, @Nullable EquipmentSlot slot) { + inventoryTick(new InventoryTickEvent(stack, world, entity, slot)); + } + + public void inventoryTick(InventoryTickEvent e) { + super.inventoryTick(e.stack, e.getServerWorld(), e.entity, e.equipmentSlot); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java new file mode 100644 index 000000000..67cb774ea --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.item.v2; + +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.event.item.CanRepairArgs; +import net.pitan76.mcpitanlib.api.event.item.EnchantabilityArgs; +import net.pitan76.mcpitanlib.api.event.item.EnchantableArgs; +import net.pitan76.mcpitanlib.api.event.item.InventoryTickEvent; +import net.pitan76.mcpitanlib.api.item.ExtendItemProvider; +import net.pitan76.mcpitanlib.api.item.args.RarityArgs; +import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; +import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; +import net.pitan76.mcpitanlib.api.util.CompatRarity; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +public interface CompatItemProvider extends ExtendItemProvider { + CompatibleItemSettings getCompatSettings(); + + default ItemWrapper getWrapper() { + return this instanceof Item ? ItemWrapper.of((Item) this) : ItemWrapper.of(); + } + + default CompatUseAction getUseAction(UseActionArgs args, Options options) { + options.cancel = false; + return null; + } + + default CompatRarity getRarity(RarityArgs args) { + return getCompatSettings().rarity; + } + + default boolean isEnchantable(EnchantableArgs args) { + return getCompatSettings().enchantability != -1; + } + + default int getEnchantability(EnchantabilityArgs args) { + return getCompatSettings().enchantability; + } + + default boolean canRepair(CanRepairArgs args) { + RepairIngredientTag tag = getCompatSettings().repairIngredientTag; + return tag != null && tag.contains(args.stack); + } + + default void inventoryTick(InventoryTickEvent e, Options options) { + options.cancel = false; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java new file mode 100644 index 000000000..4c823e2b2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java @@ -0,0 +1,202 @@ +package net.pitan76.mcpitanlib.api.item.v2; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.minecraft.util.Rarity; +import net.pitan76.mcpitanlib.api.entity.attribute.AttributeModifiersComponentBuilder; +import net.pitan76.mcpitanlib.api.entity.attribute.CompatAttributeModifiersComponent; +import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.item.ExtendSettings; +import net.pitan76.mcpitanlib.api.item.equipment.CompatEquippableComponent; +import net.pitan76.mcpitanlib.api.item.equipment.EquippableComponentBuilder; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.CompatRarity; +import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +import java.util.function.Supplier; + +@SuppressWarnings("deprecation") +public class CompatibleItemSettings extends net.pitan76.mcpitanlib.api.item.CompatibleItemSettings { + protected CompatIdentifier identifier = null; + public boolean changedTranslationKey = false; + public CompatRarity rarity = CompatRarity.COMMON; + public int enchantability = -1; + public RepairIngredientTag repairIngredientTag = null; + public Item recipeRemainder = null; + + public CompatibleItemSettings(CompatIdentifier identifier) { + super(); + setId(identifier); + } + + public static CompatibleItemSettings of(CompatIdentifier id) { + return new CompatibleItemSettings(id); + } + + @Deprecated + public CompatibleItemSettings setId(CompatIdentifier identifier) { + this.identifier = identifier; + return this; + } + + public CompatibleItemSettings addGroup(ItemGroup itemGroup) { + super.addGroup(itemGroup, identifier); + return this; + } + + public CompatibleItemSettings addGroup(Supplier itemGroup) { + super.addGroup(itemGroup, identifier); + return this; + } + + @Override + public CompatibleItemSettings addGroup(CreativeTabBuilder itemGroup) { + super.addGroup(itemGroup); + return this; + } + + public CompatibleItemSettings addGroup(ItemGroupWrapper itemGroup) { + return addGroup(itemGroup.get()); + } + + @Override + public CompatibleItemSettings maxCount(int maxCount) { + super.maxCount(maxCount); + return this; + } + + @Override + public CompatibleItemSettings maxDamage(int maxDamage) { + super.maxDamage(maxDamage); + return this; + } + + @Override + public CompatibleItemSettings maxDamageIfAbsent(int maxDamage) { + super.maxDamageIfAbsent(maxDamage); + return this; + } + + @Override + public CompatibleItemSettings recipeRemainder(Item recipeRemainder) { + super.recipeRemainder(recipeRemainder); + this.recipeRemainder = recipeRemainder; + return this; + } + + public CompatibleItemSettings recipeRemainder(ItemWrapper recipeRemainder) { + return recipeRemainder(recipeRemainder.get()); + } + + @Deprecated + @Override + public CompatibleItemSettings rarity(Rarity rarity) { + super.rarity(rarity); + this.rarity = CompatRarity.of(rarity); + return this; + } + + public CompatibleItemSettings rarity(CompatRarity rarity) { + super.rarity(rarity.get()); + this.rarity = rarity; + return this; + } + + @Override + public CompatibleItemSettings food(CompatFoodComponent foodComponent) { + super.food(foodComponent); + return this; + } + + public CompatibleItemSettings useItemPrefixedTranslationKey() { + settings.useItemPrefixedTranslationKey(); + changedTranslationKey = true; + return this; + } + + public CompatibleItemSettings useBlockPrefixedTranslationKey() { + settings.useBlockPrefixedTranslationKey(); + changedTranslationKey = true; + return this; + } + + public CompatibleItemSettings translationKey(String translationKey) { + settings.translationKey(translationKey); + changedTranslationKey = true; + return this; + } + + public CompatibleItemSettings enchantable(int enchantability) { + settings.enchantable(enchantability); + this.enchantability = enchantability; + return this; + } + + public CompatibleItemSettings repairable(RepairIngredientTag tag) { + settings.repairable(tag.getTag()); + this.repairIngredientTag = tag; + return this; + } + + public CompatibleItemSettings equipable(CompatEquippableComponent component) { + settings.component(DataComponentTypes.EQUIPPABLE, component.raw()); + return this; + } + + public CompatibleItemSettings equipable(EquippableComponentBuilder builder) { + return equipable(builder.build()); + } + + public CompatibleItemSettings attributeModifiers(CompatAttributeModifiersComponent component) { + settings.component(DataComponentTypes.ATTRIBUTE_MODIFIERS, component.raw()); + return this; + } + + public CompatibleItemSettings attributeModifiers(AttributeModifiersComponentBuilder builder) { + return attributeModifiers(builder.build()); + } + + @Override + public ExtendSettings build() { + super.build(); + + if (identifier != null) { + settings.registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier.toMinecraft())); + } + + return settings; + } + + // Deprecated + + @Deprecated + @Override + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(ItemGroup itemGroup, Identifier identifier) { + return super.addGroup(itemGroup, identifier); + } + + @Deprecated + @Override + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { + return super.addGroup(itemGroup, identifier); + } + + @Deprecated + @Override + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { + return super.addGroup(itemGroup, identifier); + } + + @Deprecated + @Override + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(ItemGroup itemGroup, CompatIdentifier identifier) { + return super.addGroup(itemGroup, identifier); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java new file mode 100644 index 000000000..ef6761f3e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java @@ -0,0 +1,75 @@ +package net.pitan76.mcpitanlib.api.item.v2; + +import net.minecraft.block.Block; +import net.minecraft.component.type.TooltipDisplayComponent; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; +import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; + +import java.util.List; +import java.util.function.Consumer; + +public class ExtendBlockItem extends BlockItem implements CompatItemProvider { + + public CompatibleItemSettings settings; + + @Deprecated + public ExtendBlockItem(Block block, Settings settings) { + super(block, settings); + } + + public ExtendBlockItem(Block block, CompatibleItemSettings settings) { + this(block, settings.build()); + this.settings = settings; + } + + @Override + public CompatibleItemSettings getCompatSettings() { + return settings; + } + + @Deprecated + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; + return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); + } + + @Deprecated + @Override + public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event, Options options) { + return CompatItemProvider.super.onRightClickOnBlock(event, options); + } + + public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { + return CompatActionResult.create(super.useOnBlock(event.toIUC())); + } + + @Deprecated + @Override + public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); + } + + @Deprecated + @Override + public void appendTooltip(ItemAppendTooltipEvent event, Options options) { + CompatItemProvider.super.appendTooltip(event, options); + } + + public void appendTooltip(ItemAppendTooltipEvent event) { + super.appendTooltip(event.getStack(), event.getContext(), event.displayComponent, event.textConsumer, event.type); + } + + @Override + public Block getBlock() { + return super.getBlock(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java new file mode 100644 index 000000000..a980204e6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java @@ -0,0 +1,153 @@ +package net.pitan76.mcpitanlib.api.item.v2; + +import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.item.ExtendSettings; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.CompatRarity; +import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +public class ItemSettingsBuilder { + + public CompatIdentifier id; + public int maxCount = -1; + public int maxDamage = -1; + public int maxDamageIfAbsent = -1; + public int enchantability = -1; + public RepairIngredientTag repairIngredientTag; + public CompatFoodComponent foodComponent; + public CompatRarity rarity; + public ItemWrapper recipeRemainder; + + public ItemGroupWrapper itemGroupWrapper; + public CreativeTabBuilder itemGroupBuilder; + + public ItemSettingsBuilder(CompatIdentifier id) { + this.id = id; + } + + public ItemSettingsBuilder() { + + } + + public ItemSettingsBuilder addGroup(ItemGroupWrapper itemGroup) { + itemGroupWrapper = itemGroup; + return this; + } + + public ItemSettingsBuilder addGroup(CreativeTabBuilder itemGroup) { + itemGroupBuilder = itemGroup; + return this; + } + + public ItemSettingsBuilder maxCount(int maxCount) { + this.maxCount = maxCount; + return this; + } + + public ItemSettingsBuilder maxDamage(int maxDamage) { + this.maxDamage = maxDamage; + return this; + } + + public ItemSettingsBuilder maxDamageIfAbsent(int maxDamage) { + this.maxDamageIfAbsent = maxDamage; + return this; + } + + public ItemSettingsBuilder recipeRemainder(ItemWrapper recipeRemainder) { + this.recipeRemainder = recipeRemainder; + return this; + } + + public ItemSettingsBuilder enchantability(int enchantability) { + this.enchantability = enchantability; + return this; + } + + public ItemSettingsBuilder repairable(RepairIngredientTag repairIngredientTag) { + this.repairIngredientTag = repairIngredientTag; + return this; + } + + public ItemSettingsBuilder repairable(CompatIdentifier repairIngredientTag) { + this.repairIngredientTag = new RepairIngredientTag(repairIngredientTag); + return this; + } + + public ItemSettingsBuilder foodComponent(CompatFoodComponent foodComponent) { + this.foodComponent = foodComponent; + return this; + } + + public ItemSettingsBuilder rarity(CompatRarity rarity) { + this.rarity = rarity; + return this; + } + + public CompatibleItemSettings build() { + return build(id); + } + + public ExtendSettings _build() { + return build().build(); + } + + public CompatibleItemSettings build(CompatIdentifier id) { + CompatibleItemSettings settings = new CompatibleItemSettings(id); + + if (itemGroupWrapper != null) settings.addGroup(itemGroupWrapper); + if (itemGroupBuilder != null) settings.addGroup(itemGroupBuilder); + + if (maxCount != -1) settings.maxCount(maxCount); + + if (maxDamage != -1) settings.maxDamage(maxDamage); + + if (maxDamageIfAbsent != -1) settings.maxDamageIfAbsent(maxDamageIfAbsent); + + if (rarity != null) settings.rarity(rarity); + if (foodComponent != null) settings.food(foodComponent); + + if (recipeRemainder != null) settings.recipeRemainder(recipeRemainder); + + if (enchantability != -1) settings.enchantable(enchantability); + + if (repairIngredientTag != null) settings.repairable(repairIngredientTag); + + return settings; + } + + public ExtendSettings _build(CompatIdentifier id) { + return build(id).build(); + } + + public ItemSettingsBuilder copy(CompatIdentifier id) { + ItemSettingsBuilder builder = new ItemSettingsBuilder(); + builder.id = id; + builder.maxCount = this.maxCount; + builder.maxDamage = this.maxDamage; + builder.maxDamageIfAbsent = this.maxDamageIfAbsent; + builder.enchantability = this.enchantability; + builder.repairIngredientTag = this.repairIngredientTag; + builder.foodComponent = this.foodComponent; + builder.rarity = this.rarity; + builder.recipeRemainder = this.recipeRemainder; + builder.itemGroupWrapper = this.itemGroupWrapper; + builder.itemGroupBuilder = this.itemGroupBuilder; + return builder; + } + + public ItemSettingsBuilder copy() { + return copy(this.id); + } + + public static ItemSettingsBuilder of(CompatIdentifier id) { + return new ItemSettingsBuilder(id); + } + + public static ItemSettingsBuilder of() { + return new ItemSettingsBuilder(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java new file mode 100644 index 000000000..d545d09cc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.item.v3; + +import net.minecraft.item.Item; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; + +public interface CompatArmorMaterial extends net.pitan76.mcpitanlib.api.item.v2.CompatArmorMaterial { + + @Deprecated + @Override + default TagKey getRepairTag() { + return getRepairIngredientTag().getTag(); + } + + RepairIngredientTag getRepairIngredientTag(); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java new file mode 100644 index 000000000..004134948 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.item.v3; + +import net.minecraft.item.Item; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; + +public interface CompatToolMaterial extends CompatibleToolMaterial { + @Deprecated + @Override + default TagKey getRepairTag() { + return getRepairIngredientTag().getTag(); + } + + RepairIngredientTag getRepairIngredientTag(); +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java new file mode 100644 index 000000000..41c63b9ba --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java @@ -0,0 +1,72 @@ +package net.pitan76.mcpitanlib.api.item.v3; + +import net.minecraft.block.Block; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; + +public class VanillaCompatToolMaterial implements CompatToolMaterial { + private final ToolMaterial material; + + public static final VanillaCompatToolMaterial WOOD = of(ToolMaterial.WOOD); + public static final VanillaCompatToolMaterial STONE = of(ToolMaterial.STONE); + public static final VanillaCompatToolMaterial IRON = of(ToolMaterial.IRON); + public static final VanillaCompatToolMaterial GOLD = of(ToolMaterial.GOLD); + public static final VanillaCompatToolMaterial DIAMOND = of(ToolMaterial.DIAMOND); + public static final VanillaCompatToolMaterial NETHERITE = of(ToolMaterial.NETHERITE); + + protected VanillaCompatToolMaterial(ToolMaterial material) { + this.material = material; + } + + private static VanillaCompatToolMaterial of(ToolMaterial material) { + return new VanillaCompatToolMaterial(material); + } + + @Override + public RepairIngredientTag getRepairIngredientTag() { + return new RepairIngredientTag(material.repairItems()); + } + + @Override + public int getCompatDurability() { + return material.durability(); + } + + @Override + public float getCompatMiningSpeedMultiplier() { + return material.speed(); + } + + @Override + public float getCompatAttackDamage() { + return material.attackDamageBonus(); + } + + @Override + public int getCompatMiningLevel() { + TagKey tag = material.incorrectBlocksForDrops(); + if (tag == ToolMaterial.WOOD.incorrectBlocksForDrops()) return 0; + if (tag == ToolMaterial.STONE.incorrectBlocksForDrops()) return 1; + if (tag == ToolMaterial.IRON.incorrectBlocksForDrops()) return 2; + if (tag == ToolMaterial.GOLD.incorrectBlocksForDrops()) return 2; + if (tag == ToolMaterial.DIAMOND.incorrectBlocksForDrops()) return 3; + if (tag == ToolMaterial.NETHERITE.incorrectBlocksForDrops()) return 4; + return -1; + } + + @Override + public int getCompatEnchantability() { + return material.enchantmentValue(); + } + + @Deprecated + public ToolMaterial toMinecraft() { + return material; + } + + @Override + public ToolMaterial build() { + return material; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java new file mode 100644 index 000000000..34b588f58 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java @@ -0,0 +1,102 @@ +package net.pitan76.mcpitanlib.api.nbt; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.NbtComponent; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtType; + +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.scanner.NbtScanner; +import net.minecraft.nbt.visitor.NbtElementVisitor; + +import java.io.DataOutput; +import java.io.IOException; + +@Deprecated +public class NbtTag { + public NbtCompound nbt; + + public NbtTag() { + super(); + } + + /** + * Create NbtTag instance + * @return NbtTag instance + */ + public static NbtTag create() { + return new NbtTag(); + } + + /** + * Cast to NbtTag + * @param nbt Nbt Object + * @return NbtTag + */ + public static NbtTag from(Object nbt) { + if (nbt instanceof NbtCompound) { + return (NbtTag) nbt; + } + return (NbtTag) nbt; + } + + /** + * Check item stack nbt + * @param stack Item stack + * @return boolean + */ + public static boolean hasNbt(ItemStack stack) { + return !stack.getComponents().isEmpty(); + } + + /** + * Get nbt from item stack + * @param stack Item stack + * @return NbtTag + */ + public static NbtTag getNbt(ItemStack stack) { + return from(stack.get(DataComponentTypes.CUSTOM_DATA).copyNbt()); + } + + /** + * Set nbt to item stack + * @param stack Item stack + * @param nbt NbtTag + */ + public static void setNbt(ItemStack stack, NbtTag nbt) { + stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt.nbt)); + } + + public boolean contains(String key) { + return nbt.contains(key); + } + + public void write(DataOutput output) throws IOException { + nbt.write(output); + } + + public byte getType() { + return nbt.getType(); + } + + public NbtType getNbtType() { + return nbt.getNbtType(); + } + + public NbtElement copy() { + return nbt.copy(); + } + + public int getSizeInBytes() { + return nbt.getSizeInBytes(); + } + + public void accept(NbtElementVisitor visitor) { + nbt.accept(visitor); + } + + public NbtScanner.Result doAccept(NbtScanner visitor) { + return nbt.doAccept(visitor); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java new file mode 100644 index 000000000..f034b4339 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java @@ -0,0 +1,20 @@ +package net.pitan76.mcpitanlib.api.nbt; + +import net.minecraft.nbt.NbtElement; + +public class NbtTypeBytes { + public static final byte END = NbtElement.END_TYPE; + public static final byte BYTE = NbtElement.BYTE_TYPE; + public static final byte SHORT = NbtElement.SHORT_TYPE; + public static final byte INT = NbtElement.INT_TYPE; + public static final byte LONG = NbtElement.LONG_TYPE; + public static final byte FLOAT = NbtElement.FLOAT_TYPE; + public static final byte DOUBLE = NbtElement.DOUBLE_TYPE; + public static final byte BYTE_ARRAY = NbtElement.BYTE_ARRAY_TYPE; + public static final byte STRING = NbtElement.STRING_TYPE; + public static final byte LIST = NbtElement.LIST_TYPE; + public static final byte COMPOUND = NbtElement.COMPOUND_TYPE; + public static final byte INT_ARRAY = NbtElement.INT_ARRAY_TYPE; + public static final byte LONG_ARRAY = NbtElement.LONG_ARRAY_TYPE; + public static final byte NUMBER = NbtElement.INT_TYPE; +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java new file mode 100644 index 000000000..0e915d07d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java @@ -0,0 +1,61 @@ +package net.pitan76.mcpitanlib.api.network; + +import dev.architectury.networking.NetworkManager; +import dev.architectury.networking.transformers.PacketTransformer; +import io.netty.buffer.Unpooled; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.RegistryByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.packet.CustomPayload; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +import java.util.List; + +import static dev.architectury.impl.NetworkAggregator.*; + +public class ClientNetworking { + public static void send(Identifier identifier, PacketByteBuf buf) { + /* + if (!C2S_TYPE.containsKey(identifier)) { + CustomPayload.Id type = new CustomPayload.Id<>(identifier); + C2S_TYPE.put(identifier, type); + //registerC2SType(type, NetworkAggregator.BufCustomPacketPayload.streamCodec(type), List.of()); + } + */ + + BufPayload payload = new BufPayload(buf, identifier); + NetworkManager.sendToServer(payload); + } + + public static void registerReceiver(Identifier identifier, ClientNetworkHandler handler) { + BufPayload.Id id = BufPayload.id(identifier); + + NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, BufPayload.getCodec(id), + (payload, context) -> { + PacketByteBuf buf = new PacketByteBuf(Unpooled.wrappedBuffer(payload.getData())); + + ClientPlayerEntity player = null; + if (context.getPlayer() instanceof ClientPlayerEntity) + player = (ClientPlayerEntity) context.getPlayer(); + + handler.receive(MinecraftClient.getInstance(), player, buf); + buf.release(); + }); + } + + @FunctionalInterface + public interface ClientNetworkHandler { + void receive(MinecraftClient client, ClientPlayerEntity player, PacketByteBuf buf); + } + + + public static void registerC2SType(CustomPayload.Id type, PacketCodec codec, List packetTransformers) { +// Objects.requireNonNull(type, "Cannot register a null type!"); +// packetTransformers = Objects.requireNonNullElse(packetTransformers, List.of()); +// C2S_CODECS.put(type.id(), (PacketCodec) codec); +// C2S_TRANSFORMERS.put(type.id(), PacketTransformer.concat(packetTransformers)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java new file mode 100644 index 000000000..46015f8a9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java @@ -0,0 +1,259 @@ +package net.pitan76.mcpitanlib.api.network; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtSizeTracker; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +import java.util.Map; +import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.function.Function; + +public class PacketByteUtil { + public static PacketByteBuf create() { + return new PacketByteBuf(Unpooled.buffer()); + } + + + public static PacketByteBuf empty() { + return new PacketByteBuf(Unpooled.EMPTY_BUFFER); + } + + public static Map readMap(PacketByteBuf buf, Function keyParser, Function valueParser) { + return buf.readMap(keyParser::apply, valueParser::apply); + } + + public static void writeMap(PacketByteBuf buf, Map map) { + writeMap(buf, map, PacketByteUtil::writeVar, PacketByteUtil::writeVar); + } + + public static void writeMap(PacketByteBuf buf, Map map, BiConsumer keySerializer, BiConsumer valueSerializer) { + buf.writeMap(map, keySerializer::accept, valueSerializer::accept); + } + + public static void writeVar(PacketByteBuf buf, Object obj) { + if (obj instanceof String) { + String s = (String) obj; + buf.writeString(s); + } + if (obj instanceof Integer) { + int i = (int) obj; + buf.writeInt(i); + } + if (obj instanceof Long) { + long l = (long) obj; + buf.writeLong(l); + } + if (obj instanceof Short) { + short s = (short) obj; + buf.writeShort(s); + } + if (obj instanceof Boolean) { + boolean b = (boolean) obj; + buf.writeBoolean(b); + } + if (obj instanceof Byte) { + byte b = (byte) obj; + buf.writeByte(b); + } + if (obj instanceof NbtCompound) { + NbtCompound nbt = (NbtCompound) obj; + buf.writeNbt(nbt); + } + if (obj instanceof ItemStack) { + ItemStack stack = (ItemStack) obj; + buf.encodeAsJson(ItemStack.CODEC, stack); + } + if (obj instanceof Identifier) { + Identifier identifier = (Identifier) obj; + buf.writeIdentifier(identifier); + } + if (obj instanceof Float) { + Float f = (Float) obj; + buf.writeFloat(f); + } + if (obj instanceof UUID) { + UUID uuid = (UUID) obj; + buf.writeUuid(uuid); + } + if (obj instanceof Text) { + Text text = (Text) obj; + buf.writeString(text.getString()); + } + if (obj instanceof BlockPos) { + BlockPos pos = (BlockPos) obj; + buf.writeBlockPos(pos); + } + if (obj instanceof Map) { + Map map = (Map) obj; + writeMap(buf, map); + } + } + + public static PacketByteBuf writeNbt(PacketByteBuf buf, NbtCompound nbt) { + return buf.writeNbt(nbt); + } + + public static NbtCompound readNbt(PacketByteBuf buf) { + return buf.readNbt(); + } + + public static PacketByteBuf writeItemStack(PacketByteBuf buf, ItemStack stack) { + buf.encodeAsJson(ItemStack.CODEC, stack); + return buf; + } + + public static ItemStack readItemStack(PacketByteBuf buf) { + return buf.decodeAsJson(ItemStack.CODEC); + } + + public static PacketByteBuf writeIdentifier(PacketByteBuf buf, Identifier identifier) { + return buf.writeIdentifier(identifier); + } + + public static Identifier readIdentifier(PacketByteBuf buf) { + return buf.readIdentifier(); + } + + public static PacketByteBuf writeText(PacketByteBuf buf, Text text) { + return buf.writeString(text.getString()); + } + + public static Text readText(PacketByteBuf buf) { + return TextUtil.literal(buf.readString()); + } + + public static PacketByteBuf writeBlockPos(PacketByteBuf buf, BlockPos pos) { + return buf.writeBlockPos(pos); + } + + public static BlockPos readBlockPos(PacketByteBuf buf) { + return buf.readBlockPos(); + } + + public static PacketByteBuf writeUuid(PacketByteBuf buf, UUID uuid) { + return buf.writeUuid(uuid); + } + + public static UUID readUuid(PacketByteBuf buf) { + return buf.readUuid(); + } + + public static PacketByteBuf writeVarInt(PacketByteBuf buf, int i) { + return buf.writeVarInt(i); + } + + public static int readVarInt(PacketByteBuf buf) { + return buf.readVarInt(); + } + + public static PacketByteBuf writeVarLong(PacketByteBuf buf, long l) { + return buf.writeVarLong(l); + } + + public static long readVarLong(PacketByteBuf buf) { + return buf.readVarLong(); + } + + public static ByteBuf writeBoolean(PacketByteBuf buf, boolean b) { + return buf.writeBoolean(b); + } + + public static boolean readBoolean(PacketByteBuf buf) { + return buf.readBoolean(); + } + + public static ByteBuf writeByte(PacketByteBuf buf, byte b) { + return buf.writeByte(b); + } + + public static byte readByte(PacketByteBuf buf) { + return buf.readByte(); + } + + public static ByteBuf writeShort(PacketByteBuf buf, short s) { + return buf.writeShort(s); + } + + public static short readShort(PacketByteBuf buf) { + return buf.readShort(); + } + + public static ByteBuf writeInt(PacketByteBuf buf, int i) { + return buf.writeInt(i); + } + + public static int readInt(PacketByteBuf buf) { + return buf.readInt(); + } + + public static ByteBuf writeLong(PacketByteBuf buf, long l) { + return buf.writeLong(l); + } + + public static long readLong(PacketByteBuf buf) { + return buf.readLong(); + } + + public static ByteBuf writeFloat(PacketByteBuf buf, float f) { + return buf.writeFloat(f); + } + + public static float readFloat(PacketByteBuf buf) { + return buf.readFloat(); + } + + public static ByteBuf writeDouble(PacketByteBuf buf, double d) { + return buf.writeDouble(d); + } + + public static double readDouble(PacketByteBuf buf) { + return buf.readDouble(); + } + + public static PacketByteBuf writeByteArray(PacketByteBuf buf, byte[] bytes) { + return buf.writeByteArray(bytes); + } + + public static byte[] readByteArray(PacketByteBuf buf) { + return buf.readByteArray(); + } + + public static PacketByteBuf writeString(PacketByteBuf buf, String s) { + return buf.writeString(s); + } + + public static String readString(PacketByteBuf buf) { + return buf.readString(); + } + + public static PacketByteBuf writeIntArray(PacketByteBuf buf, int[] ints) { + return buf.writeIntArray(ints); + } + + public static int[] readIntArray(PacketByteBuf buf) { + return buf.readIntArray(); + } + + public static PacketByteBuf writeLongArray(PacketByteBuf buf, long[] longs) { + return buf.writeLongArray(longs); + } + + public static long[] readLongArray(PacketByteBuf buf) { + return buf.readLongArray(); + } + + public static NbtElement readUnlimitedNbt(PacketByteBuf buf) { + return buf.readNbt(NbtSizeTracker.ofUnlimitedBytes()); + } +} + + diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java new file mode 100644 index 000000000..c63b6b33e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java @@ -0,0 +1,65 @@ +package net.pitan76.mcpitanlib.api.network; + +import dev.architectury.impl.NetworkAggregator; +import dev.architectury.networking.NetworkManager; +import io.netty.buffer.Unpooled; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +import java.util.ArrayList; +import java.util.List; + +public class ServerNetworking { + public static void send(ServerPlayerEntity player, Identifier identifier, PacketByteBuf buf) { + registerS2CPayloadType(identifier); + + BufPayload payload = new BufPayload(buf, identifier); + NetworkManager.sendToPlayer(player, payload); + } + + public static void send(Iterable players, Identifier identifier, PacketByteBuf buf) { + registerS2CPayloadType(identifier); + + BufPayload payload = new BufPayload(buf, identifier); + NetworkManager.sendToPlayers(players, payload); + } + + public static void sendAll(MinecraftServer server, Identifier identifier, PacketByteBuf buf) { + send(server.getPlayerManager().getPlayerList(), identifier, buf); + } + + public static void registerReceiver(Identifier identifier, ServerNetworkHandler handler) { + BufPayload.Id id = BufPayload.id(identifier); + NetworkManager.registerReceiver(NetworkManager.Side.C2S, id, BufPayload.getCodec(id), + (payload, context) -> { + PacketByteBuf buf = new PacketByteBuf(Unpooled.wrappedBuffer(payload.getData())); + + ServerPlayerEntity player = null; + if (context.getPlayer() instanceof ServerPlayerEntity) + player = (ServerPlayerEntity) context.getPlayer(); + + handler.receive(context.getPlayer().getEntityWorld().getServer(), player, buf); + buf.release(); + }); + } + + private static final List registeredList = new ArrayList<>(); + + public static void registerS2CPayloadType(Identifier identifier) { + if (registeredList.contains(identifier)) return; + registeredList.add(identifier); + + if (NetworkAggregator.S2C_CODECS.containsKey(identifier)) return; + + BufPayload.Id id = BufPayload.id(identifier); + NetworkManager.registerS2CPayloadType(id, BufPayload.getCodec(id)); + } + + @FunctionalInterface + public interface ServerNetworkHandler { + void receive(MinecraftServer server, ServerPlayerEntity player, PacketByteBuf buf); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java new file mode 100644 index 000000000..67fef00ce --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.api.network.v2; + +import net.minecraft.network.PacketByteBuf; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.api.network.v2.args.ClientReceiveEvent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; + +import java.util.function.Consumer; + +public class ClientNetworking { + public static void send(CompatIdentifier id, PacketByteBuf buf) { + net.pitan76.mcpitanlib.api.network.ClientNetworking.send(id.toMinecraft(), buf); + } + + public static void registerReceiver(CompatIdentifier id, Consumer consumer) { + net.pitan76.mcpitanlib.api.network.ClientNetworking.registerReceiver(id.toMinecraft(), (client, player, buf) -> { + consumer.accept(new ClientReceiveEvent(client, player, buf)); + }); + } + + public static void send(CompatIdentifier id, CompatPacketByteBuf buf) { + send(id, buf.getRaw()); + } + + public static void send(CompatIdentifier id) { + send(id, PacketByteUtil.create()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java new file mode 100644 index 000000000..f5356c9d0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java @@ -0,0 +1,97 @@ +package net.pitan76.mcpitanlib.api.network.v2; + +import net.minecraft.network.PacketByteBuf; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.api.network.v2.args.ServerReceiveEvent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Consumer; + +public class ServerNetworking { + public static void send(ServerPlayerEntity serverPlayerEntity, CompatIdentifier id, PacketByteBuf buf) { + net.pitan76.mcpitanlib.api.network.ServerNetworking.send(serverPlayerEntity, id.toMinecraft(), buf); + } + + public static void sendByServerPlayerEntity(Iterable players, CompatIdentifier id, PacketByteBuf buf) { + net.pitan76.mcpitanlib.api.network.ServerNetworking.send(players, id.toMinecraft(), buf); + } + + public static void send(Player player, CompatIdentifier id, PacketByteBuf buf) { + Optional optional = player.getServerPlayer(); + if (optional.isEmpty()) return; + + send(optional.get(), id, buf); + } + + public static void send(Iterable players, CompatIdentifier id, PacketByteBuf buf) { + List list = new ArrayList<>(); + for (Player player : players) { + Optional optional = player.getServerPlayer(); + optional.ifPresent(list::add); + } + + sendByServerPlayerEntity(list, id, buf); + } + + public static void sendAll(MinecraftServer server, CompatIdentifier id, PacketByteBuf buf) { + net.pitan76.mcpitanlib.api.network.ServerNetworking.sendAll(server, id.toMinecraft(), buf); + } + + public static void sendAll(World world, CompatIdentifier id, PacketByteBuf buf) { + sendAll(world.getServer(), id, buf); + } + + public static void registerReceiver(CompatIdentifier id, Consumer consumer) { + net.pitan76.mcpitanlib.api.network.ServerNetworking.registerReceiver(id.toMinecraft(), (server, player, buf) -> { + consumer.accept(new ServerReceiveEvent(server, player, buf)); + }); + } + + public static void send(ServerPlayerEntity serverPlayerEntity, CompatIdentifier id, CompatPacketByteBuf buf) { + send(serverPlayerEntity, id, buf.getRaw()); + } + + public static void send(Player player, CompatIdentifier id, CompatPacketByteBuf buf) { + send(player, id, buf.getRaw()); + } + + public static void send(Iterable players, CompatIdentifier id, CompatPacketByteBuf buf) { + send(players, id, buf.getRaw()); + } + + public static void sendAll(MinecraftServer server, CompatIdentifier id, CompatPacketByteBuf buf) { + sendAll(server, id, buf.getRaw()); + } + + public static void sendAll(World world, CompatIdentifier id, CompatPacketByteBuf buf) { + sendAll(world.getServer(), id, buf.getRaw()); + } + + public static void send(ServerPlayerEntity serverPlayerEntity, CompatIdentifier id) { + send(serverPlayerEntity, id, PacketByteUtil.create()); + } + + public static void send(Player player, CompatIdentifier id) { + send(player, id, PacketByteUtil.create()); + } + + public static void send(Iterable players, CompatIdentifier id) { + send(players, id, PacketByteUtil.create()); + } + + public static void sendAll(MinecraftServer server, CompatIdentifier id) { + sendAll(server, id, PacketByteUtil.create()); + } + + public static void sendAll(World world, CompatIdentifier id) { + sendAll(world.getServer(), id, PacketByteUtil.create()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java new file mode 100644 index 000000000..568c74d07 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.network.v2.args; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; + +public class ClientReceiveEvent { + public MinecraftClient client; + public ClientPlayerEntity clientPlayer; + public Player player; + public PacketByteBuf buf; + + public ClientReceiveEvent(MinecraftClient client, ClientPlayerEntity player, PacketByteBuf buf) { + this.client = client; + this.clientPlayer = player; + this.player = new Player(player); + this.buf = buf; + } + + public ClientPlayerEntity getClientPlayer() { + return clientPlayer; + } + + public Player getPlayer() { + return player; + } + + public MinecraftClient getClient() { + return client; + } + + public PacketByteBuf getBuf() { + return buf; + } + + public CompatPacketByteBuf getCompatBuf() { + return CompatPacketByteBuf.of(buf); + } + + public World getWorld() { + return getPlayer().getWorld(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java new file mode 100644 index 000000000..3fbe2834e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java @@ -0,0 +1,59 @@ +package net.pitan76.mcpitanlib.api.network.v2.args; + +import net.minecraft.network.PacketByteBuf; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; +import net.pitan76.mcpitanlib.midohra.server.MCServer; + +public class ServerReceiveEvent { + public MinecraftServer server; + public ServerPlayerEntity serverPlayer; + public Player player; + public PacketByteBuf buf; + + public ServerReceiveEvent(MinecraftServer server, ServerPlayerEntity player, PacketByteBuf buf) { + this.server = server; + this.serverPlayer = player; + this.player = new Player(player); + this.buf = buf; + } + + public ServerPlayerEntity getServerPlayer() { + return serverPlayer; + } + + public Player getPlayer() { + return player; + } + + public MinecraftServer getServer() { + return server; + } + + public PacketByteBuf getBuf() { + return buf; + } + + public World getWorld() { + return getPlayer().getWorld(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } + + public MCServer getMidohraServer() { + return MCServer.of(server); + } + + public CompatPacketByteBuf getCompatBuf() { + return CompatPacketByteBuf.of(buf); + } + + public void execute(Runnable runnable) { + server.execute(runnable); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java b/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java new file mode 100644 index 000000000..1bb470b52 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java @@ -0,0 +1,37 @@ +package net.pitan76.mcpitanlib.api.offlineplayer; + +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.midohra.server.PlayerManager; + +import java.util.Optional; +import java.util.UUID; + +public class OfflinePlayer { + public String uuid; + public String name; + + public OfflinePlayer(String uuid, String name) { + this.uuid = uuid; + this.name = name; + } + + public String getUUIDasString() { + return uuid; + } + + public String getName() { + return name; + } + + public UUID getUUID() { + return UUID.fromString(uuid); + } + + public Optional getOnlinePlayer(PlayerManager playerManager) { + return OfflinePlayerManager.getOnlinePlayer(this, playerManager); + } + + public boolean isOnline(PlayerManager playerManager) { + return playerManager.hasPlayerByUUID(getUUID()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java b/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java new file mode 100644 index 000000000..7eecbaf2c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java @@ -0,0 +1,229 @@ +package net.pitan76.mcpitanlib.api.offlineplayer; + +import net.pitan76.easyapi.FileControl; +import net.pitan76.easyapi.config.JsonConfig; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.PlatformUtil; +import net.pitan76.mcpitanlib.midohra.server.PlayerManager; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +public class OfflinePlayerManager { + public static OfflinePlayerManager INSTANCE = new OfflinePlayerManager(); + public static final File DEFAULT_FILE = new File(PlatformUtil.getConfigFolderAsFile(), "mcpitanlib/offlineplayer.json"); + + private final List offlinePlayers = new ArrayList<>(); + + protected OfflinePlayerManager() { + if (INSTANCE == null) + INSTANCE = this; + load(); + } + + public File getFile() { + return DEFAULT_FILE; + } + + public void load() { + if (FileControl.fileExists(getFile())) { + JsonConfig config = new JsonConfig(getFile()); + config.configMap.forEach((key, value) -> offlinePlayers.add(new OfflinePlayer(key, (String) value))); + } + } + + public void save() { + if (!FileControl.fileExists(getFile().getParentFile())) { + getFile().getParentFile().mkdirs(); + } + JsonConfig config = new JsonConfig(); + offlinePlayers.forEach(offlinePlayer -> config.set(offlinePlayer.uuid, offlinePlayer.name)); + config.save(getFile(), true); + } + + public OfflinePlayer getPlayer(String uuid) { + for (OfflinePlayer offlinePlayer : offlinePlayers) { + if (offlinePlayer.uuid.equals(uuid)) { + return offlinePlayer; + } + } + return null; + } + + public OfflinePlayer getPlayerByName(String name) { + for (OfflinePlayer offlinePlayer : offlinePlayers) { + if (offlinePlayer.name.equals(name)) { + return offlinePlayer; + } + } + return null; + } + + public void addPlayer(OfflinePlayer offlinePlayer) { + offlinePlayers.add(offlinePlayer); + } + + public void removePlayer(OfflinePlayer offlinePlayer) { + offlinePlayers.remove(offlinePlayer); + } + + public void addPlayer(String uuid, String name) { + if (containsPlayerByUUID(uuid)) + return; + addPlayer(new OfflinePlayer(uuid, name)); + } + + public void removePlayer(String uuid) { + removePlayer(getPlayer(uuid)); + } + + public boolean containsPlayerByUUID(String uuid) { + return getPlayer(uuid) != null; + } + + public boolean containsPlayerByName(String name) { + return getPlayerByName(name) != null; + } + + public boolean containsPlayer(OfflinePlayer offlinePlayer) { + return offlinePlayers.contains(offlinePlayer); + } + + public boolean containsPlayer(UUID uuid) { + return containsPlayerByUUID(uuid.toString()); + } + + public static Optional getOnlinePlayer(UUID uuid, PlayerManager playerManager) { + if (playerManager.hasPlayerByUUID(uuid)) + return Optional.of(playerManager.getPlayerByUUID(uuid)); + + return Optional.empty(); + } + + public static Optional getOnlinePlayerByName(String name, PlayerManager playerManager) { + if (playerManager.hasPlayerByName(name)) + return Optional.of(playerManager.getPlayerByName(name)); + + return Optional.empty(); + } + + public static Optional getOnlinePlayerByUUID(String uuid, PlayerManager playerManager) { + return getOnlinePlayer(UUID.fromString(uuid), playerManager); + } + + public static Optional getOnlinePlayer(OfflinePlayer offlinePlayer, PlayerManager playerManager) { + return getOnlinePlayer(UUID.fromString(offlinePlayer.uuid), playerManager); + } + + public UUID getUUID(String name) { + return UUID.fromString(getUUIDasString(name)); + } + + public String getName(UUID uuid) { + for (OfflinePlayer offlinePlayer : offlinePlayers) { + if (offlinePlayer.uuid.equals(uuid.toString())) { + return offlinePlayer.name; + } + } + return null; + } + + public String getUUIDasString(String name) { + for (OfflinePlayer offlinePlayer : offlinePlayers) { + if (offlinePlayer.name.equals(name)) { + return offlinePlayer.uuid; + } + } + return null; + } + + public List getOfflinePlayers() { + return offlinePlayers; + } + + public void clear() { + offlinePlayers.clear(); + } + + public void reload() { + clear(); + load(); + } + + public void saveAndReload() { + save(); + reload(); + } + + public void saveAndReloadAsync() { + new Thread(() -> { + save(); + reload(); + }).start(); + } + + public void saveAsync() { + new Thread(this::save).start(); + } + + public void reloadAsync() { + new Thread(this::reload).start(); + } + + public void clearAsync() { + new Thread(this::clear).start(); + } + + public void saveAndReloadAsync(Runnable runnable) { + new Thread(() -> { + save(); + reload(); + runnable.run(); + }).start(); + } + + public void saveAsync(Runnable runnable) { + new Thread(() -> { + save(); + runnable.run(); + }).start(); + } + + public void reloadAsync(Runnable runnable) { + new Thread(() -> { + reload(); + runnable.run(); + }).start(); + } + + public void clearAsync(Runnable runnable) { + new Thread(() -> { + clear(); + runnable.run(); + }).start(); + } + + public void saveAndReload(Runnable runnable) { + save(); + reload(); + runnable.run(); + } + + public void save(Runnable runnable) { + save(); + runnable.run(); + } + + public void reload(Runnable runnable) { + reload(); + runnable.run(); + } + + public void clear(Runnable runnable) { + clear(); + runnable.run(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java b/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java new file mode 100644 index 000000000..2690dae1c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.packet; + +public class UpdatePacketType { + public static final UpdatePacketType NONE = new UpdatePacketType("NONE"); + public static final UpdatePacketType BLOCK_ENTITY_UPDATE_S2C = new UpdatePacketType("BLOCK_ENTITY_UPDATE_S2C"); + + public final String name; + + public UpdatePacketType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public UpdatePacketType fromName(String name) { + switch (name) { + case "NONE": + return NONE; + case "BLOCK_ENTITY_UPDATE_S2C": + return BLOCK_ENTITY_UPDATE_S2C; + } + return null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java new file mode 100644 index 000000000..a5ce9e873 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.api.recipe; + +import net.minecraft.recipe.*; +import net.minecraft.registry.Registries; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +@Deprecated +public class CompatRecipeType> { + public static final CompatRecipeType CRAFTING = new CompatRecipeType<>(RecipeType.CRAFTING); + public static final CompatRecipeType SMELTING = new CompatRecipeType<>(RecipeType.SMELTING); + public static final CompatRecipeType BLASTING = new CompatRecipeType<>(RecipeType.BLASTING); + public static final CompatRecipeType SMOKING = new CompatRecipeType<>(RecipeType.SMOKING); + public static final CompatRecipeType CAMPFIRE_COOKING = new CompatRecipeType<>(RecipeType.CAMPFIRE_COOKING); + public static final CompatRecipeType STONECUTTING = new CompatRecipeType<>(RecipeType.STONECUTTING); + public static final CompatRecipeType SMITHING = new CompatRecipeType<>(RecipeType.SMITHING); + + private final RecipeType type; + + public CompatRecipeType(String id) { + this(RecipeType.register(id)); + } + + public CompatRecipeType(RecipeType type) { + this.type = type; + } + + public RecipeType getType() { + return type; + } + + public CompatIdentifier getName() { + Identifier id = Registries.RECIPE_TYPE.getId(type); + if (id == null) return CompatIdentifier.empty(); + + return CompatIdentifier.fromMinecraft(id); + } + + public static CompatRecipeType of(CompatIdentifier id) { + RecipeType type = Registries.RECIPE_TYPE.get(id.toMinecraft()); + if (type == null) return null; + + return new CompatRecipeType<>(type); + } + + public static > CompatRecipeType of(CompatIdentifier id, Class clazz) { + return (CompatRecipeType) of(id); + } + + public static > CompatRecipeType of(RecipeType type) { + return new CompatRecipeType<>(type); + } + + public net.pitan76.mcpitanlib.midohra.recipe.RecipeType toMidohra() { + return net.pitan76.mcpitanlib.midohra.recipe.RecipeType.of(type); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java new file mode 100644 index 000000000..2395df79b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java @@ -0,0 +1,76 @@ +package net.pitan76.mcpitanlib.api.recipe; + +import net.minecraft.recipe.*; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.RecipeUtil; +import org.jetbrains.annotations.Nullable; + +@Deprecated +public class CompatibleRecipeEntry { + private final RecipeEntry entry; + + public String group = ""; + public RecipeUtil.CompatibilityCraftingRecipeCategory category = null; + + @Deprecated + public CompatibleRecipeEntry(RecipeEntry entry) { + this.entry = entry; + } + + public CompatibleRecipeEntry(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ShapelessRecipe shapelessRecipe) { + this.entry = new RecipeEntry<>(RegistryKey.of(RegistryKeys.RECIPE, id), shapelessRecipe); + this.group = group; + this.category = category; + } + + public CompatibleRecipeEntry(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ShapelessRecipe shapelessRecipe) { + this(id.toMinecraft(), group, category, shapelessRecipe); + } + + @Deprecated + public RecipeEntry getRecipeEntry() { + return entry; + } + + public Recipe getRecipe() { + Object object = entry.value(); + if (object instanceof Recipe) { + return (Recipe) object; + } + return null; + } + + public Identifier getId() { + return entry.id().getValue(); + } + + public CompatIdentifier getCompatId() { + return CompatIdentifier.fromMinecraft(getId()); + } + + public RecipeType getType() { + Recipe recipe = getRecipe(); + if (recipe == null) return null; + + return recipe.getType(); + } + + public RecipeSerializer getSerializer() { + Recipe recipe = getRecipe(); + if (recipe == null) return null; + + return recipe.getSerializer(); + } + + @Nullable + public RecipeUtil.CompatibilityCraftingRecipeCategory getCategory() { + return category; + } + + public String getGroup() { + return group; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java new file mode 100644 index 000000000..e0ec74ef3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.api.recipe; + +import net.minecraft.recipe.Recipe; +import net.minecraft.recipe.input.RecipeInput; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; +import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; + +import java.util.Optional; + +@Deprecated +public interface MatchGetter> { + Optional> getFirstMatch(CompatRecipeInput input, World world); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java new file mode 100644 index 000000000..5f97fc400 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.api.recipe.input; + +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.input.RecipeInput; + +public class CompatRecipeInput { + protected I input; + + public CompatRecipeInput(I input) { + this.input = input; + } + + public I getInput() { + return input; + } + + public ItemStack getStack(int slot) { + return input.getStackInSlot(slot); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack(int slot) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(slot)); + } + + public int getSize() { + return input.size(); + } + + public boolean isEmpty() { + return input.isEmpty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java new file mode 100644 index 000000000..833622368 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java @@ -0,0 +1,76 @@ +package net.pitan76.mcpitanlib.api.recipe.v2; + +import net.minecraft.recipe.*; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.RecipeUtil; +import org.jetbrains.annotations.Nullable; + +@Deprecated +public class CompatRecipeEntry> { + private final RecipeEntry entry; + + public String group = ""; + public RecipeUtil.CompatibilityCraftingRecipeCategory category = null; + + @Deprecated + public CompatRecipeEntry(RecipeEntry entry) { + this.entry = entry; + } + + public CompatRecipeEntry(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, T recipe) { + this.entry = new RecipeEntry<>(RegistryKey.of(RegistryKeys.RECIPE, id), recipe); + this.group = group; + this.category = category; + } + + public CompatRecipeEntry(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, T recipe) { + this(id.toMinecraft(), group, category, recipe); + } + + public boolean isNull() { + return entry == null; + } + + @Deprecated + public RecipeEntry getRecipeEntry() { + return entry; + } + + public T getRecipe() { + return entry.value(); + } + + public Identifier getId() { + return entry.id().getValue(); + } + + public CompatIdentifier getCompatId() { + return CompatIdentifier.fromMinecraft(getId()); + } + + public RecipeType getType() { + T recipe = getRecipe(); + if (recipe == null) return null; + + return recipe.getType(); + } + + public RecipeSerializer getSerializer() { + Recipe recipe = getRecipe(); + if (recipe == null) return null; + + return recipe.getSerializer(); + } + + @Nullable + public RecipeUtil.CompatibilityCraftingRecipeCategory getCategory() { + return category; + } + + public String getGroup() { + return group; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java new file mode 100644 index 000000000..09b62e257 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.recipe.v2; + +import net.minecraft.recipe.Recipe; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.RecipeUtil; + +@Deprecated +public class CompatRecipeNonEntry> extends CompatRecipeEntry { + public CompatRecipeNonEntry(T recipe) { + super(CompatIdentifier.EMPTY, "", RecipeUtil.CompatibilityCraftingRecipeCategory.MISC, recipe); + } + + public static CompatRecipeNonEntry create(Recipe recipe) { + return new CompatRecipeNonEntry<>(recipe); + } + + @Override + public T getRecipe() { + return super.getRecipe(); + } + + public Recipe getRawRecipe() { + return super.getRecipe(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java new file mode 100644 index 000000000..7569fcf50 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java @@ -0,0 +1,87 @@ +package net.pitan76.mcpitanlib.api.recipe.v3; + +import net.minecraft.recipe.Recipe; +import net.minecraft.recipe.RecipeType; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; +import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.RecipeUtil; +import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; + +public class CompatRecipe { + public Recipe recipe; + public Identifier id; + + public CompatRecipe(Recipe recipe, Identifier id) { + this.recipe = recipe; + this.id = id; + } + + @Deprecated + public CompatRecipe(net.minecraft.recipe.RecipeEntry entry) { + this(entry.value(), entry.id().getValue()); + } + + @Deprecated + public CompatRecipe(Recipe recipe) { + this.recipe = recipe; + this.id = RecipeUtil.getId(recipe); + } + + public boolean isNull() { + return recipe == null; + } + + public Recipe getRecipe() { + return recipe; + } + + public Identifier getId() { + return id; + } + + public CompatIdentifier getCompatId() { + return CompatIdentifier.fromMinecraft(getId()); + } + + public RecipeType getType() { + Recipe recipe = getRecipe(); + if (recipe == null) return null; + + return recipe.getType(); + } + + @Deprecated + public CompatRecipeEntry getRecipeEntry() { + return new CompatRecipeEntry<>(getId(), "", null, getRecipe()); + } + + @Deprecated + public CompatibleRecipeEntry getCompatibleRecipeEntry() { + return new CompatibleRecipeEntry(new net.minecraft.recipe.RecipeEntry>(RegistryKey.of(RegistryKeys.RECIPE, getId()), getRecipe())); + } + + // MidohraAPI + public net.pitan76.mcpitanlib.midohra.recipe.Recipe getMidohraRecipe() { + if (getMidohraType() == net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING) { + return net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) getRecipe()); + } + + return net.pitan76.mcpitanlib.midohra.recipe.Recipe.of(getRecipe()); + } + + public net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry getMidohraRecipeEntry() { + if (getMidohraType() == net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING) { + return net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry.of((net.minecraft.recipe.CraftingRecipe) getRecipe(), getCompatId()); + } + + return RecipeEntry.of(getRecipe(), getCompatId()); + } + + public net.pitan76.mcpitanlib.midohra.recipe.RecipeType getMidohraType() { + return net.pitan76.mcpitanlib.midohra.recipe.RecipeType.of(getType()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java new file mode 100644 index 000000000..0ffb50750 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java @@ -0,0 +1,191 @@ +package net.pitan76.mcpitanlib.api.registry; + +import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.component.ComponentType; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.Item; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.ItemGroup; +import net.minecraft.particle.ParticleType; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.MCPitanLib; +import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; +import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.item.CreativeTabManager; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.block.BlockUtil; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; +import net.pitan76.mcpitanlib.core.registry.FuelRegistry; +import net.pitan76.mcpitanlib.core.registry.MCPLRegistry; +import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; +import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_21; + +import java.util.function.Supplier; + +public class CompatRegistry { + + protected final MCPLRegistry mcplr; + protected final MCPLRegistry1_20 mcplr1_20; + protected final MCPLRegistry1_21 mcplr1_21; + protected final WorldGenRegistry worldGenRegistry; + + protected String MOD_ID; + + /** + * @deprecated Use {@link #createRegistry(String)} instead + */ + @Deprecated + public CompatRegistry(String MOD_ID) { + mcplr = new MCPLRegistry(MOD_ID); + mcplr1_20 = new MCPLRegistry1_20(mcplr, MOD_ID); + mcplr1_21 = new MCPLRegistry1_21(mcplr, MOD_ID); + worldGenRegistry = new WorldGenRegistry(MOD_ID); + this.MOD_ID = MOD_ID; + } + + /** + * create(new CompatRegistry)'s alias + * @see #create(String) + */ + public static CompatRegistry createRegistry(String MOD_ID) { + return new CompatRegistry(MOD_ID); + } + + /** + * Create a new CompatRegistry + * @param MOD_ID The mod id + * @return The new CompatRegistry + */ + public static CompatRegistry create(String MOD_ID) { + return createRegistry(MOD_ID); + } + + /** + * Register an item + * @param id The item id + * @param supplier The item supplier + * @return The registry result + */ + public RegistryResult registerItem(Identifier id, Supplier supplier) { + if (MCPitanLib.isItemBlackListed(id)) supplier = () -> ItemUtil.create(CompatibleItemSettings.of(CompatIdentifier.fromMinecraft(id))); + RegistrySupplier registrySupplier = mcplr.registryItem(id, supplier); + CreativeTabManager.register(id); + return new RegistryResult<>(registrySupplier); + } + + public RegistryResult registerBlock(Identifier id, Supplier supplier) { + if (MCPitanLib.isBlockBlackListed(id)) supplier = () -> BlockUtil.create(CompatibleBlockSettings.of(CompatibleMaterial.STONE)); + return new RegistryResult<>(mcplr.registryBlock(id, supplier)); + } + + public RegistryResult> registerScreenHandlerType(Identifier id, Supplier> supplier) { + return new RegistryResult<>(mcplr.registryScreenHandlerType(id, supplier)); + } + + @Deprecated + public RegistryResult> registerExtendedScreenHandlerType(Identifier id, Supplier> supplier) { + return registerScreenHandlerType(id, () -> supplier.get().build()); + } + + public RegistryResult> registerMenu(Identifier id, Supplier> supplier) { + return registerScreenHandlerType(id, supplier); + } + + public RegistryResult> registerBlockEntityType(Identifier id, Supplier> supplier) { + return new RegistryResult<>(mcplr.registryBlockEntityType(id, supplier)); + } + + public RegistryResult> registerEntity(Identifier id, Supplier> supplier) { + return new RegistryResult<>(mcplr.registryEntityType(id, supplier)); + } + + @Deprecated + public RegistryResult registerSoundEvent(Identifier id, Supplier supplier) { + return new RegistryResult<>(mcplr.registrySoundEvent(id, supplier)); + } + + public RegistryResult registerSoundEvent(Identifier id) { + return registerSoundEvent(id, () -> SoundEvent.of(id)); + } + + public RegistryResult registerSoundEvent(Identifier id, float distanceToTravel) { + return registerSoundEvent(id, () -> SoundEvent.of(id, distanceToTravel)); + } + + public RegistryResult registerFluid(Identifier id, Supplier supplier) { + return new RegistryResult<>(mcplr.registryFluid(id, supplier)); + } + + public RegistryResult> registerParticleType(Identifier id, Supplier> supplier) { + return new RegistryResult<>(mcplr.registryParticleType(id, supplier)); + } + + public RegistryResult registerEnchantment(Identifier id, Supplier supplier) { + return new RegistryResult<>(mcplr.registryEnchantment(id, supplier)); + } + + public RegistryResult registerStatusEffect(Identifier id, Supplier supplier) { + return new RegistryResult<>(mcplr.registryStatusEffect(id, supplier)); + } + + public RegistryResult registerItemGroup(Identifier id, Supplier supplier) { + return new RegistryResult<>(mcplr1_20.registryItemGroup(id, supplier)); + } + + public RegistryResult registerItemGroup(Identifier id, CreativeTabBuilder builder) { + return new RegistryResult<>(mcplr1_20.registryItemGroup(id, builder)); + } + + public RegistryResult registerItemGroup(CreativeTabBuilder builder) { + return registerItemGroup(builder.getIdentifier(), builder); + } + + public RegistryResult> registerDataComponentType(Identifier id, Supplier> supplier) { + return new RegistryResult<>(mcplr1_21.registryDataComponentType(id, supplier)); + } + + public static void registerFuel(int time, ItemConvertible... item) { + FuelRegistry.register(time, item); + } + + public void allRegister() { + // 1.16 Register + mcplr.allRegister1_16(); + + mcplr1_20.register(); + mcplr1_21.register(); + + // ItemGroup + CreativeTabManager.allRegister(); + } + + @Deprecated + public MCPLRegistry getMcplr() { + return mcplr; + } + + @Deprecated + public MCPLRegistry1_20 getMcplr1_20() { + return mcplr1_20; + } + + @Deprecated + public MCPLRegistry1_21 getMcplr1_21() { + return mcplr1_21; + } + + public String getNamespace() { + return MOD_ID; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java new file mode 100644 index 000000000..1a3afc996 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.api.registry; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.BuiltinRegistries; +import net.minecraft.registry.RegistryWrapper; +import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; + +public class CompatRegistryLookup { + + private final RegistryWrapper.WrapperLookup registryLookup; + + @Deprecated + public CompatRegistryLookup(RegistryWrapper.WrapperLookup registryLookup) { + this.registryLookup = registryLookup; + } + + public CompatRegistryLookup() { + this.registryLookup = BuiltinRegistries.createWrapperLookup(); + } + + @Deprecated + public RegistryWrapper.WrapperLookup getRegistryLookup() { + if (registryLookup == null) + return BuiltinRegistries.createWrapperLookup(); + + return registryLookup; + } + + public NbtRWArgs getNbtRWArgs(NbtCompound nbt) { + return new NbtRWArgs(nbt, registryLookup); + } + + public WriteNbtArgs createWriteNbtArgs(NbtCompound nbt) { + return new WriteNbtArgs(nbt, registryLookup); + } + + public ReadNbtArgs createReadNbtArgs(NbtCompound nbt) { + return new ReadNbtArgs(nbt, registryLookup); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java new file mode 100644 index 000000000..f5dc51bb4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.api.registry; + +import net.minecraft.item.ItemConvertible; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +public class FuelRegistry { + + private static final Map, Integer>> FUEL_MAP = new HashMap<>(); + + public static void register(Supplier itemSupplier, int time, String namespace) { + Map, Integer> map = new HashMap<>(); + map.put(itemSupplier, time); + + FUEL_MAP.put(namespace, map); + } + + @Deprecated + public static void allRegister(String namespace) { + if (!FUEL_MAP.containsKey(namespace)) return; + + Map, Integer> map = FUEL_MAP.get(namespace); + for (Map.Entry, Integer> entry : map.entrySet()) { + net.pitan76.mcpitanlib.core.registry.FuelRegistry.register(entry.getValue(), entry.getKey().get()); + } + + FUEL_MAP.remove(namespace); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java new file mode 100644 index 000000000..615ad877b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java @@ -0,0 +1,107 @@ +package net.pitan76.mcpitanlib.api.registry; + +import dev.architectury.registry.level.biome.BiomeModifications; +import dev.architectury.registry.registries.DeferredRegister; +import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.resources.Identifier; +import net.minecraft.world.gen.GenerationStep; +import net.minecraft.world.gen.feature.ConfiguredFeature; +import net.minecraft.world.gen.feature.PlacedFeature; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; + +import java.util.function.Supplier; + +public class WorldGenRegistry { + protected String MOD_ID; + + protected DeferredRegister> CONFIGURED_FEATURE; + protected DeferredRegister PLACED_FEATURE; + + @Deprecated + public WorldGenRegistry(String MOD_ID) { + this.MOD_ID = MOD_ID; + CONFIGURED_FEATURE = DeferredRegister.create(MOD_ID, RegistryKeys.CONFIGURED_FEATURE); + PLACED_FEATURE = DeferredRegister.create(MOD_ID, RegistryKeys.PLACED_FEATURE); + } + + /** + * Create a new CompatRegistry + * @param MOD_ID The mod id + * @return The new CompatRegistry + */ + public static WorldGenRegistry createRegistry(String MOD_ID) { + return new WorldGenRegistry(MOD_ID); + } + + public static WorldGenRegistry createRegistry(CompatRegistry registry) { + return registry.worldGenRegistry; + } + + /** + * Register a configured feature + * @param id The id of the configured feature + * @param supplier The supplier of the configured feature + * @return The result of the registration + */ + public RegistryResult> registerFeature(Identifier id, Supplier> supplier) { + RegistrySupplier> feature = CONFIGURED_FEATURE.register(id, supplier); + return new RegistryResult<>(feature); + } + + /** + * Register a placed feature + * @param id The id of the placed feature + * @param supplier The supplier of the placed feature + * @return The result of the registration + */ + public RegistryResult registerPlacedFeature(Identifier id, Supplier supplier) { + RegistrySupplier feature = PLACED_FEATURE.register(id, supplier); + return new RegistryResult<>(feature); + } + + /** + * Replace the properties of a biome + * @param decoration The decoration step + * @param feature The feature to replace + */ + public static void replaceProperties(GenerationStep.Feature decoration, RegistrySupplier feature) { + BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); + } + + public static void replaceProperties(GenerationStep.Feature decoration, RegistryResult feature) { + replaceProperties(decoration, feature.supplier); + } + + /** + * Replace the properties of a biome + * @param decoration The decoration step + * @param feature The feature to replace + */ + public static void replaceProperties(GenerationStep.Feature decoration, PlacedFeature feature) { + BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, RegistryEntry.of(feature))); + } + + /** + * Add a feature to the biome properties + * @param decoration The decoration step + * @param feature The feature to add + */ + public static void addProperties(GenerationStep.Feature decoration, RegistrySupplier feature) { + BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); + } + + public static void addProperties(GenerationStep.Feature decoration, RegistryResult feature) { + addProperties(decoration, feature.supplier); + } + + /** + * Add a feature to the biome properties + * @param decoration The decoration step + * @param feature The feature to add + */ + public static void addProperties(GenerationStep.Feature decoration, PlacedFeature feature) { + BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, RegistryEntry.of(feature))); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java new file mode 100644 index 000000000..3bcf95488 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.api.registry.result; + +import dev.architectury.registry.registries.RegistrySupplier; +import org.jetbrains.annotations.Nullable; + +/** + * The result of a registry + * @param The type of the registry + * + *
{@code
+ * RegistryResult ITEM = registry.registerItem(IdentifierUtil.id("mcpitanlib", "example"), ExampleItem::new);
+ * ITEM.getOrNull(); => The item (Item.class) or null
+ * ITEM.get(); => The item (Item.class)
+ * }
+ */ +public class RegistryResult { + public RegistrySupplier supplier; + + public RegistryResult(RegistrySupplier supplier) { + this.supplier = supplier; + } + + public T get() { + return supplier.get(); + } + + @Nullable + public T getOrNull() { + return supplier.getOrNull(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java new file mode 100644 index 000000000..4e2a538c2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java @@ -0,0 +1,52 @@ +package net.pitan76.mcpitanlib.api.registry.result; + +import dev.architectury.registry.registries.RegistrySupplier; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; +import java.util.function.Supplier; + +public class SupplierResult extends RegistryResult { + protected Supplier supplier; + + protected SupplierResult(Supplier supplier) { + super(null); + this.supplier = supplier; + } + + protected SupplierResult(RegistrySupplier supplier) { + this(supplier::getOrNull); + } + + protected SupplierResult(RegistryResult result) { + this(result.supplier); + } + + public static SupplierResult of(Supplier supplier) { + return new SupplierResult<>(supplier); + } + + public static SupplierResult of(RegistrySupplier supplier) { + return new SupplierResult<>(supplier); + } + + public static SupplierResult of(RegistryResult result) { + return new SupplierResult<>(result); + } + + @Override + public T get() { + return supplier.get(); + } + + @Override + public @Nullable T getOrNull() { + if (supplier == null) + return null; + return supplier.get(); + } + + public Optional getOptional() { + return Optional.ofNullable(getOrNull()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java new file mode 100644 index 000000000..82bfbd83d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java @@ -0,0 +1,179 @@ +package net.pitan76.mcpitanlib.api.registry.v2; + +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.particle.ParticleType; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; +import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; +import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.item.ExtendItem; +import net.pitan76.mcpitanlib.api.registry.CompatRegistry; +import net.pitan76.mcpitanlib.api.registry.FuelRegistry; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.sound.RegistryResultCompatSoundEvent; +import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; + +import java.util.function.Supplier; + +public class CompatRegistryV2 { + + public final CompatRegistry cr1; + + @Deprecated + public CompatRegistryV2(CompatRegistry compatRegistry) { + this.cr1 = compatRegistry; + } + + /** + * Create a new CompatRegistryV2 + * @param MOD_ID The mod id + * @return The new CompatRegistryV2 + */ + public static CompatRegistryV2 create(String MOD_ID) { + CompatRegistry cr1 = CompatRegistry.create(MOD_ID); + return new CompatRegistryV2(cr1); + } + + public static CompatRegistryV2 create(CompatRegistry compatRegistry) { + return new CompatRegistryV2(compatRegistry); + } + + /** + * Register an item + * @param id The item id + * @param supplier The item supplier + * @return The registry result + */ + public RegistryResult registerItem(CompatIdentifier id, Supplier supplier) { + return cr1.registerItem(id.toMinecraft(), supplier); + } + + public Supplier registerExtendItem(CompatIdentifier id, Supplier supplier) { + RegistryResult result = registerItem(id, supplier::get); + return () -> (ExtendItem) result.get(); + } + + /** + * Register a block + * @param id The block id + * @param supplier The block supplier + * @return The registry result + */ + public RegistryResult registerBlock(CompatIdentifier id, Supplier supplier) { + return cr1.registerBlock(id.toMinecraft(), supplier); + } + + public Supplier registerExtendBlock(CompatIdentifier id, Supplier supplier) { + RegistryResult result = registerBlock(id, supplier::get); + return () -> (ExtendBlock) result.get(); + } + + public RegistryResult> registerScreenHandlerType(CompatIdentifier id, Supplier> supplier) { + return cr1.registerScreenHandlerType(id.toMinecraft(), supplier); + } + + public Supplier> registerScreenHandlerTypeSavingGenerics(CompatIdentifier id, Supplier> supplier) { + RegistryResult> result = cr1.registerScreenHandlerType(id.toMinecraft(), supplier::get); + return () -> (ScreenHandlerType) result.getOrNull(); + } + + public SupplierResult> registerScreenHandlerType(CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { + return SupplierResult.of(registerScreenHandlerTypeSavingGenerics(id, builder::build)); + } + + public SupplierResult> registerScreenHandlerType(CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { + return SupplierResult.of(registerScreenHandlerTypeSavingGenerics(id, builder::build)); + } + + public RegistryResult> registerBlockEntityType(CompatIdentifier id, Supplier> supplier) { + return cr1.registerBlockEntityType(id.toMinecraft(), supplier); + } + + public SupplierResult> registerBlockEntityType(CompatIdentifier id, BlockEntityTypeBuilder builder) { + RegistryResult> result = cr1.registerBlockEntityType(id.toMinecraft(), builder::build); + return SupplierResult.of(() -> (BlockEntityType) result.getOrNull()); + } + + public RegistryResult> registerEntity(CompatIdentifier id, Supplier> supplier) { + return cr1.registerEntity(id.toMinecraft(), supplier); + } + + public RegistryResult registerSoundEvent(CompatIdentifier id) { + return cr1.registerSoundEvent(id.toMinecraft()); + } + + public RegistryResult registerSoundEvent(CompatIdentifier id, float distanceToTravel) { + return cr1.registerSoundEvent(id.toMinecraft(), distanceToTravel); + } + + public CompatSoundEvent registerCompatSoundEvent(CompatIdentifier id) { + return RegistryResultCompatSoundEvent.of(registerSoundEvent(id)); + } + + public CompatSoundEvent registerCompatSoundEvent(CompatIdentifier id, float distanceToTravel) { + return RegistryResultCompatSoundEvent.of(registerSoundEvent(id, distanceToTravel)); + } + + public RegistryResult registerFluid(CompatIdentifier id, Supplier supplier) { + return cr1.registerFluid(id.toMinecraft(), supplier); + } + + public RegistryResult> registerParticleType(CompatIdentifier id, Supplier> supplier) { + return cr1.registerParticleType(id.toMinecraft(), supplier); + } + + public RegistryResult registerEnchantment(CompatIdentifier id, Supplier supplier) { + return cr1.registerEnchantment(id.toMinecraft(), () -> supplier.get().getEnchantment(null)); + } + + public RegistryResult registryStatusEffect(CompatIdentifier id, Supplier supplier) { + return cr1.registerStatusEffect(id.toMinecraft(), () -> supplier.get().getStatusEffect(null)); + } + + public RegistryResult registerItemGroup(CompatIdentifier id, Supplier supplier) { + return cr1.registerItemGroup(id.toMinecraft(), supplier); + } + + public RegistryResult registerItemGroup(CompatIdentifier id, CreativeTabBuilder builder) { + return cr1.registerItemGroup(id.toMinecraft(), builder); + } + + public RegistryResult registerItemGroup(CreativeTabBuilder builder) { + return cr1.registerItemGroup(builder.getIdentifier(), builder); + } + + public RegistryResult> registerChunkTicketType(Identifier id, Supplier> supplier) { + return SupplierResult.of(cr1.getMcplr1_21().registryChunkTicketType(id, supplier)); + } + + public RegistryResult> registerChunkTicketType(CompatIdentifier id, Supplier> supplier) { + return registerChunkTicketType(id.toMinecraft(), supplier); + } + + public void registerFuel(Supplier itemSupplier, int time) { + FuelRegistry.register(itemSupplier::get, time, cr1.getNamespace()); + } + + public void allRegister() { + cr1.allRegister(); + FuelRegistry.allRegister(cr1.getNamespace()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java new file mode 100644 index 000000000..2353be362 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.api.simple.block; + +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; + +public abstract class SimpleGuiBlock extends ExtendBlock implements SimpleScreenHandlerFactory { + + public SimpleGuiBlock(Settings settings) { + super(settings); + } + + @Override + public CompatActionResult onRightClick(BlockUseEvent e) { + if (e.isClient()) + e.player.openGuiScreen(this); + + return e.success(); + } + + @Override + public Text getDisplayName(DisplayNameArgs args) { + return getName(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java b/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java new file mode 100644 index 000000000..570410379 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java @@ -0,0 +1,61 @@ +package net.pitan76.mcpitanlib.api.simple.item; + +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.util.StackActionResult; + +public class SimpleGuiItem extends CompatItem implements SimpleScreenHandlerFactory { + + public ScreenHandlerFactory factory; + public Text name; + + public SimpleGuiItem(CompatibleItemSettings settings, ScreenHandlerFactory factory, Text name) { + super(settings); + this.factory = factory; + this.name = name; + } + + public SimpleGuiItem(CompatibleItemSettings settings, ScreenHandlerFactory factory) { + super(settings); + this.factory = factory; + } + + public SimpleGuiItem(CompatibleItemSettings settings) { + super(settings); + } + + @Override + public StackActionResult onRightClick(ItemUseEvent e) { + if (!e.isClient()) + e.user.openGuiScreen(this); + + return e.success(); + } + + @Override + public Text getDisplayName(DisplayNameArgs args) { + if (name == null) + return getName(); + + return name; + } + + @Override + public ScreenHandler createMenu(CreateMenuEvent e) { + if (factory == null) + return null; + + return factory.create(e); + } + + @FunctionalInterface + public interface ScreenHandlerFactory { + ScreenHandler create(CreateMenuEvent e); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java new file mode 100644 index 000000000..55563b8ae --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java @@ -0,0 +1,221 @@ +package net.pitan76.mcpitanlib.api.sound; + +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.sound.SoundEvent; + +public class CompatBlockSoundGroup { + public static final CompatBlockSoundGroup INTENTIONALLY_EMPTY = of(BlockSoundGroup.INTENTIONALLY_EMPTY); + public static final CompatBlockSoundGroup WOOD = of(BlockSoundGroup.WOOD); + public static final CompatBlockSoundGroup GRAVEL = of(BlockSoundGroup.GRAVEL); + public static final CompatBlockSoundGroup GRASS = of(BlockSoundGroup.GRASS); + public static final CompatBlockSoundGroup LILY_PAD = of(BlockSoundGroup.LILY_PAD); + public static final CompatBlockSoundGroup STONE = of(BlockSoundGroup.STONE); + public static final CompatBlockSoundGroup METAL = of(BlockSoundGroup.METAL); + public static final CompatBlockSoundGroup GLASS = of(BlockSoundGroup.GLASS); + public static final CompatBlockSoundGroup WOOL = of(BlockSoundGroup.WOOL); + public static final CompatBlockSoundGroup SAND = of(BlockSoundGroup.SAND); + public static final CompatBlockSoundGroup SNOW = of(BlockSoundGroup.SNOW); + public static final CompatBlockSoundGroup POWDER_SNOW = of(BlockSoundGroup.POWDER_SNOW); + public static final CompatBlockSoundGroup LADDER = of(BlockSoundGroup.LADDER); + public static final CompatBlockSoundGroup ANVIL = of(BlockSoundGroup.ANVIL); + public static final CompatBlockSoundGroup SLIME = of(BlockSoundGroup.SLIME); + public static final CompatBlockSoundGroup HONEY = of(BlockSoundGroup.HONEY); + public static final CompatBlockSoundGroup WET_GRASS = of(BlockSoundGroup.WET_GRASS); + public static final CompatBlockSoundGroup CORAL = of(BlockSoundGroup.CORAL); + public static final CompatBlockSoundGroup BAMBOO = of(BlockSoundGroup.BAMBOO); + public static final CompatBlockSoundGroup BAMBOO_SAPLING = of(BlockSoundGroup.BAMBOO_SAPLING); + public static final CompatBlockSoundGroup SCAFFOLDING = of(BlockSoundGroup.SCAFFOLDING); + public static final CompatBlockSoundGroup SWEET_BERRY_BUSH = of(BlockSoundGroup.SWEET_BERRY_BUSH); + public static final CompatBlockSoundGroup CROP = of(BlockSoundGroup.CROP); + public static final CompatBlockSoundGroup STEM = of(BlockSoundGroup.STEM); + public static final CompatBlockSoundGroup VINE = of(BlockSoundGroup.VINE); + public static final CompatBlockSoundGroup NETHER_WART = of(BlockSoundGroup.NETHER_WART); + public static final CompatBlockSoundGroup LANTERN = of(BlockSoundGroup.LANTERN); + public static final CompatBlockSoundGroup NETHER_STEM = of(BlockSoundGroup.NETHER_STEM); + public static final CompatBlockSoundGroup NYLIUM = of(BlockSoundGroup.NYLIUM); + public static final CompatBlockSoundGroup FUNGUS = of(BlockSoundGroup.FUNGUS); + public static final CompatBlockSoundGroup ROOTS = of(BlockSoundGroup.ROOTS); + public static final CompatBlockSoundGroup SHROOMLIGHT = of(BlockSoundGroup.SHROOMLIGHT); + public static final CompatBlockSoundGroup WEEPING_VINES = of(BlockSoundGroup.WEEPING_VINES); + public static final CompatBlockSoundGroup WEEPING_VINES_LOW_PITCH = of(BlockSoundGroup.WEEPING_VINES_LOW_PITCH); + public static final CompatBlockSoundGroup SOUL_SAND = of(BlockSoundGroup.SOUL_SAND); + public static final CompatBlockSoundGroup SOUL_SOIL = of(BlockSoundGroup.SOUL_SOIL); + public static final CompatBlockSoundGroup BASALT = of(BlockSoundGroup.BASALT); + public static final CompatBlockSoundGroup WART_BLOCK = of(BlockSoundGroup.WART_BLOCK); + public static final CompatBlockSoundGroup NETHERRACK = of(BlockSoundGroup.NETHERRACK); + public static final CompatBlockSoundGroup NETHER_BRICKS = of(BlockSoundGroup.NETHER_BRICKS); + public static final CompatBlockSoundGroup NETHER_SPROUTS = of(BlockSoundGroup.NETHER_SPROUTS); + public static final CompatBlockSoundGroup NETHER_ORE = of(BlockSoundGroup.NETHER_ORE); + public static final CompatBlockSoundGroup BONE = of(BlockSoundGroup.BONE); + public static final CompatBlockSoundGroup NETHERITE = of(BlockSoundGroup.NETHERITE); + public static final CompatBlockSoundGroup ANCIENT_DEBRIS = of(BlockSoundGroup.ANCIENT_DEBRIS); + public static final CompatBlockSoundGroup LODESTONE = of(BlockSoundGroup.LODESTONE); + public static final CompatBlockSoundGroup CHAIN = of(BlockSoundGroup.CHAIN); + public static final CompatBlockSoundGroup NETHER_GOLD_ORE = of(BlockSoundGroup.NETHER_GOLD_ORE); + public static final CompatBlockSoundGroup GILDED_BLACKSTONE = of(BlockSoundGroup.GILDED_BLACKSTONE); + public static final CompatBlockSoundGroup CANDLE = of(BlockSoundGroup.CANDLE); + public static final CompatBlockSoundGroup AMETHYST_BLOCK = of(BlockSoundGroup.AMETHYST_BLOCK); + public static final CompatBlockSoundGroup AMETHYST_CLUSTER = of(BlockSoundGroup.AMETHYST_CLUSTER); + public static final CompatBlockSoundGroup SMALL_AMETHYST_BUD = of(BlockSoundGroup.SMALL_AMETHYST_BUD); + public static final CompatBlockSoundGroup MEDIUM_AMETHYST_BUD = of(BlockSoundGroup.MEDIUM_AMETHYST_BUD); + public static final CompatBlockSoundGroup LARGE_AMETHYST_BUD = of(BlockSoundGroup.LARGE_AMETHYST_BUD); + public static final CompatBlockSoundGroup TUFF = of(BlockSoundGroup.TUFF); + public static final CompatBlockSoundGroup TUFF_BRICKS = of(BlockSoundGroup.TUFF_BRICKS); + public static final CompatBlockSoundGroup POLISHED_TUFF = of(BlockSoundGroup.POLISHED_TUFF); + public static final CompatBlockSoundGroup CALCITE = of(BlockSoundGroup.CALCITE); + public static final CompatBlockSoundGroup DRIPSTONE_BLOCK = of(BlockSoundGroup.DRIPSTONE_BLOCK); + public static final CompatBlockSoundGroup POINTED_DRIPSTONE = of(BlockSoundGroup.POINTED_DRIPSTONE); + public static final CompatBlockSoundGroup COPPER = of(BlockSoundGroup.COPPER); + public static final CompatBlockSoundGroup COPPER_BULB = of(BlockSoundGroup.COPPER_BULB); + public static final CompatBlockSoundGroup COPPER_GRATE = of(BlockSoundGroup.COPPER_GRATE); + public static final CompatBlockSoundGroup CAVE_VINES = of(BlockSoundGroup.CAVE_VINES); + public static final CompatBlockSoundGroup SPORE_BLOSSOM = of(BlockSoundGroup.SPORE_BLOSSOM); + public static final CompatBlockSoundGroup AZALEA = of(BlockSoundGroup.AZALEA); + public static final CompatBlockSoundGroup FLOWERING_AZALEA = of(BlockSoundGroup.FLOWERING_AZALEA); + public static final CompatBlockSoundGroup MOSS_CARPET = of(BlockSoundGroup.MOSS_CARPET); + public static final CompatBlockSoundGroup PINK_PETALS = of(BlockSoundGroup.CHERRY_LEAVES); + public static final CompatBlockSoundGroup MOSS_BLOCK = of(BlockSoundGroup.MOSS_BLOCK); + public static final CompatBlockSoundGroup BIG_DRIPLEAF = of(BlockSoundGroup.BIG_DRIPLEAF); + public static final CompatBlockSoundGroup SMALL_DRIPLEAF = of(BlockSoundGroup.SMALL_DRIPLEAF); + public static final CompatBlockSoundGroup ROOTED_DIRT = of(BlockSoundGroup.ROOTED_DIRT); + public static final CompatBlockSoundGroup HANGING_ROOTS = of(BlockSoundGroup.HANGING_ROOTS); + public static final CompatBlockSoundGroup AZALEA_LEAVES = of(BlockSoundGroup.AZALEA_LEAVES); + public static final CompatBlockSoundGroup SCULK_SENSOR = of(BlockSoundGroup.SCULK_SENSOR); + public static final CompatBlockSoundGroup SCULK_CATALYST = of(BlockSoundGroup.SCULK_CATALYST); + public static final CompatBlockSoundGroup SCULK = of(BlockSoundGroup.SCULK); + public static final CompatBlockSoundGroup SCULK_VEIN = of(BlockSoundGroup.SCULK_VEIN); + public static final CompatBlockSoundGroup SCULK_SHRIEKER = of(BlockSoundGroup.SCULK_SHRIEKER); + public static final CompatBlockSoundGroup GLOW_LICHEN = of(BlockSoundGroup.GLOW_LICHEN); + public static final CompatBlockSoundGroup DEEPSLATE = of(BlockSoundGroup.DEEPSLATE); + public static final CompatBlockSoundGroup DEEPSLATE_BRICKS = of(BlockSoundGroup.DEEPSLATE_BRICKS); + public static final CompatBlockSoundGroup DEEPSLATE_TILES = of(BlockSoundGroup.DEEPSLATE_TILES); + public static final CompatBlockSoundGroup POLISHED_DEEPSLATE = of(BlockSoundGroup.POLISHED_DEEPSLATE); + public static final CompatBlockSoundGroup FROGLIGHT = of(BlockSoundGroup.FROGLIGHT); + public static final CompatBlockSoundGroup FROGSPAWN = of(BlockSoundGroup.FROGSPAWN); + public static final CompatBlockSoundGroup MANGROVE_ROOTS = of(BlockSoundGroup.MANGROVE_ROOTS); + public static final CompatBlockSoundGroup MUDDY_MANGROVE_ROOTS = of(BlockSoundGroup.MUDDY_MANGROVE_ROOTS); + public static final CompatBlockSoundGroup MUD = of(BlockSoundGroup.MUD); + public static final CompatBlockSoundGroup MUD_BRICKS = of(BlockSoundGroup.MUD_BRICKS); + public static final CompatBlockSoundGroup PACKED_MUD = of(BlockSoundGroup.PACKED_MUD); + public static final CompatBlockSoundGroup HANGING_SIGN = of(BlockSoundGroup.HANGING_SIGN); + public static final CompatBlockSoundGroup NETHER_WOOD_HANGING_SIGN = of(BlockSoundGroup.NETHER_WOOD_HANGING_SIGN); + public static final CompatBlockSoundGroup BAMBOO_WOOD_HANGING_SIGN = of(BlockSoundGroup.BAMBOO_WOOD_HANGING_SIGN); + public static final CompatBlockSoundGroup BAMBOO_WOOD = of(BlockSoundGroup.BAMBOO_WOOD); + public static final CompatBlockSoundGroup NETHER_WOOD = of(BlockSoundGroup.NETHER_WOOD); + public static final CompatBlockSoundGroup CHERRY_WOOD = of(BlockSoundGroup.CHERRY_WOOD); + public static final CompatBlockSoundGroup CHERRY_SAPLING = of(BlockSoundGroup.CHERRY_SAPLING); + public static final CompatBlockSoundGroup CHERRY_LEAVES = of(BlockSoundGroup.CHERRY_LEAVES); + public static final CompatBlockSoundGroup CHERRY_WOOD_HANGING_SIGN = of(BlockSoundGroup.CHERRY_WOOD_HANGING_SIGN); + public static final CompatBlockSoundGroup CHISELED_BOOKSHELF = of(BlockSoundGroup.CHISELED_BOOKSHELF); + public static final CompatBlockSoundGroup SUSPICIOUS_SAND = of(BlockSoundGroup.SUSPICIOUS_SAND); + public static final CompatBlockSoundGroup SUSPICIOUS_GRAVEL = of(BlockSoundGroup.SUSPICIOUS_GRAVEL); + public static final CompatBlockSoundGroup DECORATED_POT = of(BlockSoundGroup.DECORATED_POT); + public static final CompatBlockSoundGroup DECORATED_POT_SHATTER = of(BlockSoundGroup.DECORATED_POT_SHATTER); + public static final CompatBlockSoundGroup TRIAL_SPAWNER = of(BlockSoundGroup.TRIAL_SPAWNER); + public static final CompatBlockSoundGroup SPONGE = of(BlockSoundGroup.SPONGE); + public static final CompatBlockSoundGroup WET_SPONGE = of(BlockSoundGroup.WET_SPONGE); + public static final CompatBlockSoundGroup VAULT = of(BlockSoundGroup.VAULT); + public static final CompatBlockSoundGroup HEAVY_CORE = of(BlockSoundGroup.HEAVY_CORE); + public static final CompatBlockSoundGroup COBWEB = of(BlockSoundGroup.COBWEB); + + public BlockSoundGroup blockSoundGroup; + + private final float volume; + private final float pitch; + private final SoundEvent breakSound; + private final SoundEvent stepSound; + private final SoundEvent placeSound; + private final SoundEvent hitSound; + private final SoundEvent fallSound; + + public CompatBlockSoundGroup(BlockSoundGroup blockSoundGroup) { + this.blockSoundGroup = blockSoundGroup; + + this.volume = blockSoundGroup.getVolume(); + this.pitch = blockSoundGroup.getPitch(); + this.breakSound = blockSoundGroup.getBreakSound(); + this.stepSound = blockSoundGroup.getStepSound(); + this.placeSound = blockSoundGroup.getPlaceSound(); + this.hitSound = blockSoundGroup.getHitSound(); + this.fallSound = blockSoundGroup.getFallSound(); + } + + public CompatBlockSoundGroup(float volume, float pitch, SoundEvent breakSound, SoundEvent stepSound, SoundEvent placeSound, SoundEvent hitSound, SoundEvent fallSound) { + this.blockSoundGroup = new BlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); + + this.volume = volume; + this.pitch = pitch; + this.breakSound = breakSound; + this.stepSound = stepSound; + this.placeSound = placeSound; + this.hitSound = hitSound; + this.fallSound = fallSound; + } + + public BlockSoundGroup get() { + if (blockSoundGroup == null) { + return new BlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); + } + return blockSoundGroup; + } + + public static CompatBlockSoundGroup of(BlockSoundGroup blockSoundGroup) { + return new CompatBlockSoundGroup(blockSoundGroup); + } + + public static CompatBlockSoundGroup of(float volume, float pitch, SoundEvent breakSound, SoundEvent stepSound, SoundEvent placeSound, SoundEvent hitSound, SoundEvent fallSound) { + return new CompatBlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); + } + + public static CompatBlockSoundGroup of(float volume, float pitch, CompatSoundEvent breakSound, CompatSoundEvent stepSound, CompatSoundEvent placeSound, CompatSoundEvent hitSound, CompatSoundEvent fallSound) { + return new CompatBlockSoundGroup(volume, pitch, breakSound.get(), stepSound.get(), placeSound.get(), hitSound.get(), fallSound.get()); + } + + public float getVolume() { + return volume; + } + + public float getPitch() { + return pitch; + } + + public SoundEvent getRawBreakSound() { + return breakSound; + } + + public SoundEvent getRawStepSound() { + return stepSound; + } + + public SoundEvent getRawPlaceSound() { + return placeSound; + } + + public SoundEvent getRawHitSound() { + return hitSound; + } + + public SoundEvent getRawFallSound() { + return fallSound; + } + + public CompatSoundEvent getBreakSound() { + return CompatSoundEvent.of(breakSound); + } + + public CompatSoundEvent getStepSound() { + return CompatSoundEvent.of(stepSound); + } + + public CompatSoundEvent getPlaceSound() { + return CompatSoundEvent.of(placeSound); + } + + public CompatSoundEvent getHitSound() { + return CompatSoundEvent.of(hitSound); + } + + public CompatSoundEvent getFallSound() { + return CompatSoundEvent.of(fallSound); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java new file mode 100644 index 000000000..4fdd2bd18 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.sound; + +import net.minecraft.sound.SoundCategory; + +public class CompatSoundCategory { + + public static final CompatSoundCategory MASTER = of(SoundCategory.MASTER); + public static final CompatSoundCategory MUSIC = of(SoundCategory.MUSIC); + public static final CompatSoundCategory RECORDS = of(SoundCategory.RECORDS); + public static final CompatSoundCategory WEATHER = of(SoundCategory.WEATHER); + public static final CompatSoundCategory BLOCKS = of(SoundCategory.BLOCKS); + public static final CompatSoundCategory HOSTILE = of(SoundCategory.HOSTILE); + public static final CompatSoundCategory NEUTRAL = of(SoundCategory.NEUTRAL); + public static final CompatSoundCategory PLAYERS = of(SoundCategory.PLAYERS); + public static final CompatSoundCategory AMBIENT = of(SoundCategory.AMBIENT); + public static final CompatSoundCategory VOICE = of(SoundCategory.VOICE); + + public SoundCategory soundCategory; + + public CompatSoundCategory(SoundCategory soundCategory) { + this.soundCategory = soundCategory; + } + + public static CompatSoundCategory of(SoundCategory soundCategory) { + return new CompatSoundCategory(soundCategory); + } + + public SoundCategory get() { + return soundCategory; + } + + public String getName() { + return soundCategory.getName(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java new file mode 100644 index 000000000..f18fcf204 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.api.sound; + +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.sound.SoundEvent; +import org.jetbrains.annotations.Nullable; + +public class CompatSoundEvent { + private SoundEvent soundEvent; + private RegistryEntry.Reference reference; + private RegistryEntry entry; + + public CompatSoundEvent(SoundEvent soundEvent) { + this.soundEvent = soundEvent; + } + + public CompatSoundEvent(RegistryEntry.Reference reference) { + this.reference = reference; + } + + public CompatSoundEvent(RegistryEntry entry) { + this.entry = entry; + } + + public static CompatSoundEvent of(SoundEvent soundEvent) { + return new CompatSoundEvent(soundEvent); + } + + public SoundEvent get() { + if (soundEvent == null) { + if (reference != null) { + soundEvent = reference.value(); + } else if (entry != null) { + soundEvent = entry.value(); + } + } + + return soundEvent; + } + + @Nullable + @Deprecated + public RegistryEntry.Reference getReference() { + return reference; + } + + @Nullable + @Deprecated + public RegistryEntry getEntry() { + if (entry == null) { + entry = RegistryEntry.of(soundEvent); + } + + return entry; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java new file mode 100644 index 000000000..e535953d6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java @@ -0,0 +1,1625 @@ +package net.pitan76.mcpitanlib.api.sound; + +import com.google.common.collect.ImmutableList; +import net.minecraft.entity.passive.WolfSoundVariants; +import net.minecraft.sound.SoundEvents; + +public class CompatSoundEvents { + public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITH_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_AMBIENT_WITH_ITEM); + public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM); + public static final CompatSoundEvent ENTITY_ALLAY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_DEATH); + public static final CompatSoundEvent ENTITY_ALLAY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_HURT); + public static final CompatSoundEvent ENTITY_ALLAY_ITEM_GIVEN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_GIVEN); + public static final CompatSoundEvent ENTITY_ALLAY_ITEM_TAKEN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_TAKEN); + public static final CompatSoundEvent ENTITY_ALLAY_ITEM_THROWN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_THROWN); + public static final CompatSoundEvent AMBIENT_CAVE = new CompatSoundEvent(SoundEvents.AMBIENT_CAVE); + public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_ADDITIONS); + public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_LOOP); + public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_MOOD); + public static final CompatSoundEvent AMBIENT_CRIMSON_FOREST_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_CRIMSON_FOREST_ADDITIONS); + public static final CompatSoundEvent AMBIENT_CRIMSON_FOREST_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_CRIMSON_FOREST_LOOP); + public static final CompatSoundEvent AMBIENT_CRIMSON_FOREST_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_CRIMSON_FOREST_MOOD); + public static final CompatSoundEvent AMBIENT_NETHER_WASTES_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_NETHER_WASTES_ADDITIONS); + public static final CompatSoundEvent AMBIENT_NETHER_WASTES_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_NETHER_WASTES_LOOP); + public static final CompatSoundEvent AMBIENT_NETHER_WASTES_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_NETHER_WASTES_MOOD); + public static final CompatSoundEvent AMBIENT_SOUL_SAND_VALLEY_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS); + public static final CompatSoundEvent AMBIENT_SOUL_SAND_VALLEY_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_LOOP); + public static final CompatSoundEvent AMBIENT_SOUL_SAND_VALLEY_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_MOOD); + public static final CompatSoundEvent AMBIENT_WARPED_FOREST_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_WARPED_FOREST_ADDITIONS); + public static final CompatSoundEvent AMBIENT_WARPED_FOREST_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_WARPED_FOREST_LOOP); + public static final CompatSoundEvent AMBIENT_WARPED_FOREST_MOOD = new CompatSoundEvent(SoundEvents.AMBIENT_WARPED_FOREST_MOOD); + public static final CompatSoundEvent AMBIENT_UNDERWATER_ENTER = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_ENTER); + public static final CompatSoundEvent AMBIENT_UNDERWATER_EXIT = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_EXIT); + public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP); + public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS); + public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE); + public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_RESONATE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_RESONATE); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_BREAK); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_FALL); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_HIT); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_PLACE); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_STEP); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_BREAK); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_STEP); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_PLACE); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_HIT); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_FALL); + public static final CompatSoundEvent BLOCK_ANVIL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_BREAK); + public static final CompatSoundEvent BLOCK_ANVIL_DESTROY = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_DESTROY); + public static final CompatSoundEvent BLOCK_ANVIL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_FALL); + public static final CompatSoundEvent BLOCK_ANVIL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_HIT); + public static final CompatSoundEvent BLOCK_ANVIL_LAND = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_LAND); + public static final CompatSoundEvent BLOCK_ANVIL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_PLACE); + public static final CompatSoundEvent BLOCK_ANVIL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_STEP); + public static final CompatSoundEvent BLOCK_ANVIL_USE = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_USE); + public static final CompatSoundEvent ENTITY_ARMADILLO_EAT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_EAT); + public static final CompatSoundEvent ENTITY_ARMADILLO_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_HURT); + public static final CompatSoundEvent ENTITY_ARMADILLO_HURT_REDUCED = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_HURT_REDUCED); + public static final CompatSoundEvent ENTITY_ARMADILLO_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_AMBIENT); + public static final CompatSoundEvent ENTITY_ARMADILLO_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_STEP); + public static final CompatSoundEvent ENTITY_ARMADILLO_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_DEATH); + public static final CompatSoundEvent ENTITY_ARMADILLO_ROLL = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_ROLL); + public static final CompatSoundEvent ENTITY_ARMADILLO_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_LAND); + public static final CompatSoundEvent ENTITY_ARMADILLO_SCUTE_DROP = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_SCUTE_DROP); + public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_FINISH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_UNROLL_FINISH); + public static final CompatSoundEvent ENTITY_ARMADILLO_PEEK = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_PEEK); + public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_START = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_UNROLL_START); + public static final CompatSoundEvent ENTITY_ARMADILLO_BRUSH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_BRUSH); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_CHAIN = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_CHAIN); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_DIAMOND = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_ELYTRA = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_ELYTRA); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GENERIC = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_GENERIC); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GOLD = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_GOLD); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_IRON = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_IRON); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_LEATHER = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_LEATHER); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_NETHERITE = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_TURTLE = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_TURTLE); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_WOLF = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_WOLF); + public static final CompatSoundEvent ITEM_ARMOR_UNEQUIP_WOLF = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_UNEQUIP_WOLF); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_BREAK); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_FALL = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_FALL); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_HIT = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_HIT); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_PLACE); + public static final CompatSoundEvent ENTITY_ARROW_HIT = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_HIT); + public static final CompatSoundEvent ENTITY_ARROW_HIT_PLAYER = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_HIT_PLAYER); + public static final CompatSoundEvent ENTITY_ARROW_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_SHOOT); + public static final CompatSoundEvent ITEM_AXE_STRIP = new CompatSoundEvent(SoundEvents.ITEM_AXE_STRIP); + public static final CompatSoundEvent ITEM_AXE_SCRAPE = new CompatSoundEvent(SoundEvents.ITEM_AXE_SCRAPE); + public static final CompatSoundEvent ITEM_AXE_WAX_OFF = new CompatSoundEvent(SoundEvents.ITEM_AXE_WAX_OFF); + public static final CompatSoundEvent ENTITY_AXOLOTL_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_ATTACK); + public static final CompatSoundEvent ENTITY_AXOLOTL_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_DEATH); + public static final CompatSoundEvent ENTITY_AXOLOTL_HURT = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_HURT); + public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_AIR = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_IDLE_AIR); + public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_WATER = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_IDLE_WATER); + public static final CompatSoundEvent ENTITY_AXOLOTL_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_SPLASH); + public static final CompatSoundEvent ENTITY_AXOLOTL_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_SWIM); + public static final CompatSoundEvent BLOCK_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_BREAK); + public static final CompatSoundEvent BLOCK_AZALEA_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_FALL); + public static final CompatSoundEvent BLOCK_AZALEA_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_HIT); + public static final CompatSoundEvent BLOCK_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_PLACE); + public static final CompatSoundEvent BLOCK_AZALEA_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_STEP); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_BREAK); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_FALL); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_HIT); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_PLACE); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_FALL); + public static final CompatSoundEvent BLOCK_BAMBOO_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FALL); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN); + public static final CompatSoundEvent BLOCK_BARREL_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BARREL_CLOSE); + public static final CompatSoundEvent BLOCK_BARREL_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BARREL_OPEN); + public static final CompatSoundEvent BLOCK_BASALT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_BREAK); + public static final CompatSoundEvent BLOCK_BASALT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_STEP); + public static final CompatSoundEvent BLOCK_BASALT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_PLACE); + public static final CompatSoundEvent BLOCK_BASALT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_HIT); + public static final CompatSoundEvent BLOCK_BASALT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_FALL); + public static final CompatSoundEvent ENTITY_BAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BAT_AMBIENT); + public static final CompatSoundEvent ENTITY_BAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BAT_DEATH); + public static final CompatSoundEvent ENTITY_BAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BAT_HURT); + public static final CompatSoundEvent ENTITY_BAT_LOOP = new CompatSoundEvent(SoundEvents.ENTITY_BAT_LOOP); + public static final CompatSoundEvent ENTITY_BAT_TAKEOFF = new CompatSoundEvent(SoundEvents.ENTITY_BAT_TAKEOFF); + public static final CompatSoundEvent BLOCK_BEACON_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_ACTIVATE); + public static final CompatSoundEvent BLOCK_BEACON_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_AMBIENT); + public static final CompatSoundEvent BLOCK_BEACON_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_DEACTIVATE); + public static final CompatSoundEvent BLOCK_BEACON_POWER_SELECT = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_POWER_SELECT); + public static final CompatSoundEvent ENTITY_BEE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BEE_DEATH); + public static final CompatSoundEvent ENTITY_BEE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BEE_HURT); + public static final CompatSoundEvent ENTITY_BEE_LOOP_AGGRESSIVE = new CompatSoundEvent(SoundEvents.ENTITY_BEE_LOOP_AGGRESSIVE); + public static final CompatSoundEvent ENTITY_BEE_LOOP = new CompatSoundEvent(SoundEvents.ENTITY_BEE_LOOP); + public static final CompatSoundEvent ENTITY_BEE_STING = new CompatSoundEvent(SoundEvents.ENTITY_BEE_STING); + public static final CompatSoundEvent ENTITY_BEE_POLLINATE = new CompatSoundEvent(SoundEvents.ENTITY_BEE_POLLINATE); + public static final CompatSoundEvent BLOCK_BEEHIVE_DRIP = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_DRIP); + public static final CompatSoundEvent BLOCK_BEEHIVE_ENTER = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_ENTER); + public static final CompatSoundEvent BLOCK_BEEHIVE_EXIT = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_EXIT); + public static final CompatSoundEvent BLOCK_BEEHIVE_SHEAR = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_SHEAR); + public static final CompatSoundEvent BLOCK_BEEHIVE_WORK = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_WORK); + public static final CompatSoundEvent BLOCK_BELL_USE = new CompatSoundEvent(SoundEvents.BLOCK_BELL_USE); + public static final CompatSoundEvent BLOCK_BELL_RESONATE = new CompatSoundEvent(SoundEvents.BLOCK_BELL_RESONATE); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_BREAK); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_FALL); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_HIT); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_PLACE); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_STEP); + public static final CompatSoundEvent ENTITY_BLAZE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_AMBIENT); + public static final CompatSoundEvent ENTITY_BLAZE_BURN = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_BURN); + public static final CompatSoundEvent ENTITY_BLAZE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_DEATH); + public static final CompatSoundEvent ENTITY_BLAZE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_HURT); + public static final CompatSoundEvent ENTITY_BLAZE_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_SHOOT); + public static final CompatSoundEvent ENTITY_BOAT_PADDLE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_BOAT_PADDLE_LAND); + public static final CompatSoundEvent ENTITY_BOAT_PADDLE_WATER = new CompatSoundEvent(SoundEvents.ENTITY_BOAT_PADDLE_WATER); + public static final CompatSoundEvent ENTITY_BOGGED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_AMBIENT); + public static final CompatSoundEvent ENTITY_BOGGED_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_DEATH); + public static final CompatSoundEvent ENTITY_BOGGED_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_HURT); + public static final CompatSoundEvent ENTITY_BOGGED_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_SHEAR); + public static final CompatSoundEvent ENTITY_BOGGED_STEP = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_STEP); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_STEP); + public static final CompatSoundEvent ITEM_BONE_MEAL_USE = new CompatSoundEvent(SoundEvents.ITEM_BONE_MEAL_USE); + public static final CompatSoundEvent ITEM_BOOK_PAGE_TURN = new CompatSoundEvent(SoundEvents.ITEM_BOOK_PAGE_TURN); + public static final CompatSoundEvent ITEM_BOOK_PUT = new CompatSoundEvent(SoundEvents.ITEM_BOOK_PUT); + public static final CompatSoundEvent BLOCK_BLASTFURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_BLASTFURNACE_FIRE_CRACKLE); + public static final CompatSoundEvent ITEM_BOTTLE_EMPTY = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_EMPTY); + public static final CompatSoundEvent ITEM_BOTTLE_FILL = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_FILL); + public static final CompatSoundEvent ITEM_BOTTLE_FILL_DRAGONBREATH = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH); + public static final CompatSoundEvent ENTITY_BREEZE_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_CHARGE); + public static final CompatSoundEvent ENTITY_BREEZE_DEFLECT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_DEFLECT); + public static final CompatSoundEvent ENTITY_BREEZE_INHALE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_INHALE); + public static final CompatSoundEvent ENTITY_BREEZE_IDLE_GROUND = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_IDLE_GROUND); + public static final CompatSoundEvent ENTITY_BREEZE_IDLE_AIR = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_IDLE_AIR); + public static final CompatSoundEvent ENTITY_BREEZE_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_SHOOT); + public static final CompatSoundEvent ENTITY_BREEZE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_JUMP); + public static final CompatSoundEvent ENTITY_BREEZE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_LAND); + public static final CompatSoundEvent ENTITY_BREEZE_SLIDE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_SLIDE); + public static final CompatSoundEvent ENTITY_BREEZE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_DEATH); + public static final CompatSoundEvent ENTITY_BREEZE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_HURT); + public static final CompatSoundEvent ENTITY_BREEZE_WHIRL = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_WHIRL); + public static final CompatSoundEvent ENTITY_BREEZE_WIND_BURST = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_WIND_BURST); + public static final CompatSoundEvent BLOCK_BREWING_STAND_BREW = new CompatSoundEvent(SoundEvents.BLOCK_BREWING_STAND_BREW); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GENERIC = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GENERIC); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_SAND); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GRAVEL); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND_COMPLETE = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_SAND_COMPLETE); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL_COMPLETE = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GRAVEL_COMPLETE); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_BUBBLE_POP = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_BUBBLE_POP); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_AXOLOTL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_AXOLOTL); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_FISH = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_FISH); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_LAVA = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_LAVA); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_POWDER_SNOW = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_POWDER_SNOW); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_TADPOLE = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_TADPOLE); + public static final CompatSoundEvent ITEM_BUCKET_FILL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL); + public static final CompatSoundEvent ITEM_BUCKET_FILL_AXOLOTL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_AXOLOTL); + public static final CompatSoundEvent ITEM_BUCKET_FILL_FISH = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_FISH); + public static final CompatSoundEvent ITEM_BUCKET_FILL_LAVA = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_LAVA); + public static final CompatSoundEvent ITEM_BUCKET_FILL_POWDER_SNOW = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_POWDER_SNOW); + public static final CompatSoundEvent ITEM_BUCKET_FILL_TADPOLE = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_TADPOLE); + public static final CompatSoundEvent ITEM_BUNDLE_DROP_CONTENTS = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_DROP_CONTENTS); + public static final CompatSoundEvent ITEM_BUNDLE_INSERT = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_INSERT); + public static final CompatSoundEvent ITEM_BUNDLE_REMOVE_ONE = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_REMOVE_ONE); + public static final CompatSoundEvent BLOCK_CAKE_ADD_CANDLE = new CompatSoundEvent(SoundEvents.BLOCK_CAKE_ADD_CANDLE); + public static final CompatSoundEvent BLOCK_CALCITE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_BREAK); + public static final CompatSoundEvent BLOCK_CALCITE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_STEP); + public static final CompatSoundEvent BLOCK_CALCITE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_PLACE); + public static final CompatSoundEvent BLOCK_CALCITE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_HIT); + public static final CompatSoundEvent BLOCK_CALCITE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_FALL); + public static final CompatSoundEvent ENTITY_CAMEL_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_AMBIENT); + public static final CompatSoundEvent ENTITY_CAMEL_DASH = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DASH); + public static final CompatSoundEvent ENTITY_CAMEL_DASH_READY = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DASH_READY); + public static final CompatSoundEvent ENTITY_CAMEL_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DEATH); + public static final CompatSoundEvent ENTITY_CAMEL_EAT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_EAT); + public static final CompatSoundEvent ENTITY_CAMEL_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_HURT); + public static final CompatSoundEvent ENTITY_CAMEL_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_SADDLE); + public static final CompatSoundEvent ENTITY_CAMEL_SIT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_SIT); + public static final CompatSoundEvent ENTITY_CAMEL_STAND = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STAND); + public static final CompatSoundEvent ENTITY_CAMEL_STEP = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STEP); + public static final CompatSoundEvent ENTITY_CAMEL_STEP_SAND = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STEP_SAND); + public static final CompatSoundEvent BLOCK_CAMPFIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_CAMPFIRE_CRACKLE); + public static final CompatSoundEvent BLOCK_CANDLE_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_AMBIENT); + public static final CompatSoundEvent BLOCK_CANDLE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_BREAK); + public static final CompatSoundEvent BLOCK_CANDLE_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_EXTINGUISH); + public static final CompatSoundEvent BLOCK_CANDLE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_FALL); + public static final CompatSoundEvent BLOCK_CANDLE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_HIT); + public static final CompatSoundEvent BLOCK_CANDLE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_PLACE); + public static final CompatSoundEvent BLOCK_CANDLE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_STEP); + public static final CompatSoundEvent ENTITY_CAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_AMBIENT); + public static final CompatSoundEvent ENTITY_CAT_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_STRAY_AMBIENT); + public static final CompatSoundEvent ENTITY_CAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CAT_DEATH); + public static final CompatSoundEvent ENTITY_CAT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_EAT); + public static final CompatSoundEvent ENTITY_CAT_HISS = new CompatSoundEvent(SoundEvents.ENTITY_CAT_HISS); + public static final CompatSoundEvent ENTITY_CAT_BEG_FOR_FOOD = new CompatSoundEvent(SoundEvents.ENTITY_CAT_BEG_FOR_FOOD); + public static final CompatSoundEvent ENTITY_CAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_HURT); + public static final CompatSoundEvent ENTITY_CAT_PURR = new CompatSoundEvent(SoundEvents.ENTITY_CAT_PURR); + public static final CompatSoundEvent ENTITY_CAT_PURREOW = new CompatSoundEvent(SoundEvents.ENTITY_CAT_PURREOW); + public static final CompatSoundEvent BLOCK_CAVE_VINES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_BREAK); + public static final CompatSoundEvent BLOCK_CAVE_VINES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_FALL); + public static final CompatSoundEvent BLOCK_CAVE_VINES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_HIT); + public static final CompatSoundEvent BLOCK_CAVE_VINES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_PLACE); + public static final CompatSoundEvent BLOCK_CAVE_VINES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_STEP); + public static final CompatSoundEvent BLOCK_CAVE_VINES_PICK_BERRIES = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_PICK_BERRIES); + public static final CompatSoundEvent BLOCK_CHAIN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_BREAK); + public static final CompatSoundEvent BLOCK_CHAIN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_FALL); + public static final CompatSoundEvent BLOCK_CHAIN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_HIT); + public static final CompatSoundEvent BLOCK_CHAIN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_PLACE); + public static final CompatSoundEvent BLOCK_CHAIN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN); + public static final CompatSoundEvent BLOCK_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_CLOSE); + public static final CompatSoundEvent BLOCK_CHEST_LOCKED = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_LOCKED); + public static final CompatSoundEvent BLOCK_CHEST_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_OPEN); + public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_AMBIENT); + public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_DEATH); + public static final CompatSoundEvent ENTITY_CHICKEN_EGG = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_EGG); + public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_HURT); + public static final CompatSoundEvent ENTITY_CHICKEN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_STEP); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_BREAK); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_FALL); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_HIT); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_INSERT); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT_ENCHANTED = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_INSERT_ENCHANTED); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_STEP); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PICKUP); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP_ENCHANTED = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PICKUP_ENCHANTED); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PLACE); + public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_DEATH = new CompatSoundEvent(SoundEvents.BLOCK_CHORUS_FLOWER_DEATH); + public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_GROW = new CompatSoundEvent(SoundEvents.BLOCK_CHORUS_FLOWER_GROW); + public static final CompatSoundEvent ITEM_CHORUS_FRUIT_TELEPORT = new CompatSoundEvent(SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT); + public static final CompatSoundEvent BLOCK_COBWEB_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_BREAK); + public static final CompatSoundEvent BLOCK_COBWEB_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_STEP); + public static final CompatSoundEvent BLOCK_COBWEB_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_PLACE); + public static final CompatSoundEvent BLOCK_COBWEB_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_HIT); + public static final CompatSoundEvent BLOCK_COBWEB_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_FALL); + public static final CompatSoundEvent ENTITY_COD_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_COD_AMBIENT); + public static final CompatSoundEvent ENTITY_COD_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_COD_DEATH); + public static final CompatSoundEvent ENTITY_COD_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_COD_FLOP); + public static final CompatSoundEvent ENTITY_COD_HURT = new CompatSoundEvent(SoundEvents.ENTITY_COD_HURT); + public static final CompatSoundEvent BLOCK_COMPARATOR_CLICK = new CompatSoundEvent(SoundEvents.BLOCK_COMPARATOR_CLICK); + public static final CompatSoundEvent BLOCK_COMPOSTER_EMPTY = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_EMPTY); + public static final CompatSoundEvent BLOCK_COMPOSTER_FILL = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_FILL); + public static final CompatSoundEvent BLOCK_COMPOSTER_FILL_SUCCESS = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_FILL_SUCCESS); + public static final CompatSoundEvent BLOCK_COMPOSTER_READY = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_READY); + public static final CompatSoundEvent BLOCK_CONDUIT_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_ACTIVATE); + public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_AMBIENT); + public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT_SHORT = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_AMBIENT_SHORT); + public static final CompatSoundEvent BLOCK_CONDUIT_ATTACK_TARGET = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_ATTACK_TARGET); + public static final CompatSoundEvent BLOCK_CONDUIT_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_DEACTIVATE); + public static final CompatSoundEvent BLOCK_COPPER_BULB_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_BREAK); + public static final CompatSoundEvent BLOCK_COPPER_BULB_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_STEP); + public static final CompatSoundEvent BLOCK_COPPER_BULB_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_PLACE); + public static final CompatSoundEvent BLOCK_COPPER_BULB_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_HIT); + public static final CompatSoundEvent BLOCK_COPPER_BULB_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_FALL); + public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_ON = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_TURN_ON); + public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_OFF = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_TURN_OFF); + public static final CompatSoundEvent BLOCK_COPPER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BREAK); + public static final CompatSoundEvent BLOCK_COPPER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_STEP); + public static final CompatSoundEvent BLOCK_COPPER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_PLACE); + public static final CompatSoundEvent BLOCK_COPPER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_HIT); + public static final CompatSoundEvent BLOCK_COPPER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_FALL); + public static final CompatSoundEvent BLOCK_COPPER_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_COPPER_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_BREAK); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_STEP); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_PLACE); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_HIT); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_FALL); + public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_STEP); + public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_COW_AMBIENT); + public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_COW_DEATH); + public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.ENTITY_COW_HURT); + public static final CompatSoundEvent ENTITY_COW_MILK = new CompatSoundEvent(SoundEvents.ENTITY_COW_MILK); + public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.ENTITY_COW_STEP); + public static final CompatSoundEvent BLOCK_CRAFTER_CRAFT = new CompatSoundEvent(SoundEvents.BLOCK_CRAFTER_CRAFT); + public static final CompatSoundEvent BLOCK_CRAFTER_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_CRAFTER_FAIL); + public static final CompatSoundEvent ENTITY_CREEPER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_DEATH); + public static final CompatSoundEvent ENTITY_CREEPER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_HURT); + public static final CompatSoundEvent ENTITY_CREEPER_PRIMED = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_PRIMED); + public static final CompatSoundEvent BLOCK_CROP_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CROP_BREAK); + public static final CompatSoundEvent ITEM_CROP_PLANT = new CompatSoundEvent(SoundEvents.ITEM_CROP_PLANT); + public static final CompatSoundEvent ITEM_CROSSBOW_HIT = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_HIT); + public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_END = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_END); + public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_MIDDLE = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_MIDDLE); + public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_START = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_START); + public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_1 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_1); + public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_2 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_2); + public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_3 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_3); + public static final CompatSoundEvent ITEM_CROSSBOW_SHOOT = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_SHOOT); + public static final CompatSoundEvent BLOCK_DECORATED_POT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_BREAK); + public static final CompatSoundEvent BLOCK_DECORATED_POT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_FALL); + public static final CompatSoundEvent BLOCK_DECORATED_POT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_HIT); + public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_INSERT); + public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_INSERT_FAIL); + public static final CompatSoundEvent BLOCK_DECORATED_POT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_STEP); + public static final CompatSoundEvent BLOCK_DECORATED_POT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_PLACE); + public static final CompatSoundEvent BLOCK_DECORATED_POT_SHATTER = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_SHATTER); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BREAK); + public static final CompatSoundEvent BLOCK_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_FALL); + public static final CompatSoundEvent BLOCK_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_HIT); + public static final CompatSoundEvent BLOCK_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_PLACE); + public static final CompatSoundEvent BLOCK_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_STEP); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_BREAK); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_FALL); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_HIT); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_PLACE); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_STEP); + public static final CompatSoundEvent BLOCK_DISPENSER_DISPENSE = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_DISPENSE); + public static final CompatSoundEvent BLOCK_DISPENSER_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_FAIL); + public static final CompatSoundEvent BLOCK_DISPENSER_LAUNCH = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_LAUNCH); + public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_AMBIENT); + public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_AMBIENT_WATER); + public static final CompatSoundEvent ENTITY_DOLPHIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_ATTACK); + public static final CompatSoundEvent ENTITY_DOLPHIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_DEATH); + public static final CompatSoundEvent ENTITY_DOLPHIN_EAT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_EAT); + public static final CompatSoundEvent ENTITY_DOLPHIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_HURT); + public static final CompatSoundEvent ENTITY_DOLPHIN_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_JUMP); + public static final CompatSoundEvent ENTITY_DOLPHIN_PLAY = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_PLAY); + public static final CompatSoundEvent ENTITY_DOLPHIN_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_SPLASH); + public static final CompatSoundEvent ENTITY_DOLPHIN_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_SWIM); + public static final CompatSoundEvent ENTITY_DONKEY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_AMBIENT); + public static final CompatSoundEvent ENTITY_DONKEY_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_ANGRY); + public static final CompatSoundEvent ENTITY_DONKEY_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_CHEST); + public static final CompatSoundEvent ENTITY_DONKEY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_DEATH); + public static final CompatSoundEvent ENTITY_DONKEY_EAT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_EAT); + public static final CompatSoundEvent ENTITY_DONKEY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_HURT); + public static final CompatSoundEvent ENTITY_DONKEY_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_JUMP); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_BREAK); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_STEP); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_PLACE); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_HIT); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_FALL); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_LAND = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_LAND); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_LAVA); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_WATER); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_DOWN = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_DOWN); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_UP = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_UP); + public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_AMBIENT); + public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_AMBIENT_WATER); + public static final CompatSoundEvent ENTITY_DROWNED_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_DEATH); + public static final CompatSoundEvent ENTITY_DROWNED_DEATH_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_DEATH_WATER); + public static final CompatSoundEvent ENTITY_DROWNED_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_HURT); + public static final CompatSoundEvent ENTITY_DROWNED_HURT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_HURT_WATER); + public static final CompatSoundEvent ENTITY_DROWNED_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_SHOOT); + public static final CompatSoundEvent ENTITY_DROWNED_STEP = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_STEP); + public static final CompatSoundEvent ENTITY_DROWNED_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_SWIM); + public static final CompatSoundEvent ITEM_DYE_USE = new CompatSoundEvent(SoundEvents.ITEM_DYE_USE); + public static final CompatSoundEvent ENTITY_EGG_THROW = new CompatSoundEvent(SoundEvents.ENTITY_EGG_THROW); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_AMBIENT); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_AMBIENT_LAND); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_CURSE = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_CURSE); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_DEATH); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_DEATH_LAND); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_FLOP); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_HURT); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_HURT_LAND); + public static final CompatSoundEvent ITEM_ELYTRA_FLYING = new CompatSoundEvent(SoundEvents.ITEM_ELYTRA_FLYING); + public static final CompatSoundEvent BLOCK_ENCHANTMENT_TABLE_USE = new CompatSoundEvent(SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE); + public static final CompatSoundEvent BLOCK_ENDER_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_ENDER_CHEST_CLOSE); + public static final CompatSoundEvent BLOCK_ENDER_CHEST_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_ENDER_CHEST_OPEN); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_AMBIENT); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_DEATH); + public static final CompatSoundEvent ENTITY_DRAGON_FIREBALL_EXPLODE = new CompatSoundEvent(SoundEvents.ENTITY_DRAGON_FIREBALL_EXPLODE); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_FLAP = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_FLAP); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_GROWL = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_GROWL); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_HURT); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_SHOOT); + public static final CompatSoundEvent ENTITY_ENDER_EYE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_EYE_DEATH); + public static final CompatSoundEvent ENTITY_ENDER_EYE_LAUNCH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_EYE_LAUNCH); + public static final CompatSoundEvent ENTITY_ENDERMAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_AMBIENT); + public static final CompatSoundEvent ENTITY_ENDERMAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_DEATH); + public static final CompatSoundEvent ENTITY_ENDERMAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_HURT); + public static final CompatSoundEvent ENTITY_ENDERMAN_SCREAM = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_SCREAM); + public static final CompatSoundEvent ENTITY_ENDERMAN_STARE = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_STARE); + public static final CompatSoundEvent ENTITY_ENDERMAN_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_TELEPORT); + public static final CompatSoundEvent ENTITY_ENDERMITE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_AMBIENT); + public static final CompatSoundEvent ENTITY_ENDERMITE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_DEATH); + public static final CompatSoundEvent ENTITY_ENDERMITE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_HURT); + public static final CompatSoundEvent ENTITY_ENDERMITE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_STEP); + public static final CompatSoundEvent ENTITY_ENDER_PEARL_THROW = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_PEARL_THROW); + public static final CompatSoundEvent BLOCK_END_GATEWAY_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_END_GATEWAY_SPAWN); + public static final CompatSoundEvent BLOCK_END_PORTAL_FRAME_FILL = new CompatSoundEvent(SoundEvents.BLOCK_END_PORTAL_FRAME_FILL); + public static final CompatSoundEvent BLOCK_END_PORTAL_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_END_PORTAL_SPAWN); + public static final CompatSoundEvent ENTITY_EVOKER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_AMBIENT); + public static final CompatSoundEvent ENTITY_EVOKER_CAST_SPELL = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_CAST_SPELL); + public static final CompatSoundEvent ENTITY_EVOKER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_CELEBRATE); + public static final CompatSoundEvent ENTITY_EVOKER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_DEATH); + public static final CompatSoundEvent ENTITY_EVOKER_FANGS_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_FANGS_ATTACK); + public static final CompatSoundEvent ENTITY_EVOKER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_HURT); + public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_ATTACK); + public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_SUMMON = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_SUMMON); + public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_WOLOLO = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_WOLOLO); + public static final CompatSoundEvent ENTITY_EXPERIENCE_BOTTLE_THROW = new CompatSoundEvent(SoundEvents.ENTITY_EXPERIENCE_BOTTLE_THROW); + public static final CompatSoundEvent ENTITY_EXPERIENCE_ORB_PICKUP = new CompatSoundEvent(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP); + public static final CompatSoundEvent BLOCK_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_FENCE_GATE_OPEN); + public static final CompatSoundEvent ITEM_FIRECHARGE_USE = new CompatSoundEvent(SoundEvents.ITEM_FIRECHARGE_USE); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_BLAST); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_BLAST_FAR); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LARGE_BLAST); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LAUNCH = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LAUNCH); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_SHOOT); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_TWINKLE); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_TWINKLE_FAR); + public static final CompatSoundEvent BLOCK_FIRE_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_FIRE_AMBIENT); + public static final CompatSoundEvent BLOCK_FIRE_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_FIRE_EXTINGUISH); + public static final CompatSoundEvent ENTITY_FISH_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_FISH_SWIM); + public static final CompatSoundEvent ENTITY_FISHING_BOBBER_RETRIEVE = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_RETRIEVE); + public static final CompatSoundEvent ENTITY_FISHING_BOBBER_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_SPLASH); + public static final CompatSoundEvent ENTITY_FISHING_BOBBER_THROW = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_THROW); + public static final CompatSoundEvent ITEM_FLINTANDSTEEL_USE = new CompatSoundEvent(SoundEvents.ITEM_FLINTANDSTEEL_USE); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_BREAK); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_FALL); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_HIT); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_PLACE); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_STEP); + public static final CompatSoundEvent ENTITY_FOX_AGGRO = new CompatSoundEvent(SoundEvents.ENTITY_FOX_AGGRO); + public static final CompatSoundEvent ENTITY_FOX_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_AMBIENT); + public static final CompatSoundEvent ENTITY_FOX_BITE = new CompatSoundEvent(SoundEvents.ENTITY_FOX_BITE); + public static final CompatSoundEvent ENTITY_FOX_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_FOX_DEATH); + public static final CompatSoundEvent ENTITY_FOX_EAT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_EAT); + public static final CompatSoundEvent ENTITY_FOX_HURT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_HURT); + public static final CompatSoundEvent ENTITY_FOX_SCREECH = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SCREECH); + public static final CompatSoundEvent ENTITY_FOX_SLEEP = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SLEEP); + public static final CompatSoundEvent ENTITY_FOX_SNIFF = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SNIFF); + public static final CompatSoundEvent ENTITY_FOX_SPIT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SPIT); + public static final CompatSoundEvent ENTITY_FOX_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_TELEPORT); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_BREAK); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_STEP); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_PLACE); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_HIT); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_FALL); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_BREAK); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_STEP); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_PLACE); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_HIT); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_FALL); + public static final CompatSoundEvent BLOCK_FROGLIGHT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_BREAK); + public static final CompatSoundEvent BLOCK_FROGLIGHT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_FALL); + public static final CompatSoundEvent BLOCK_FROGLIGHT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_HIT); + public static final CompatSoundEvent BLOCK_FROGLIGHT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_PLACE); + public static final CompatSoundEvent BLOCK_FROGLIGHT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_STEP); + public static final CompatSoundEvent BLOCK_FROGSPAWN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_STEP); + public static final CompatSoundEvent BLOCK_FROGSPAWN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_BREAK); + public static final CompatSoundEvent BLOCK_FROGSPAWN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_FALL); + public static final CompatSoundEvent BLOCK_FROGSPAWN_HATCH = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_HATCH); + public static final CompatSoundEvent BLOCK_FROGSPAWN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_HIT); + public static final CompatSoundEvent BLOCK_FROGSPAWN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_PLACE); + public static final CompatSoundEvent ENTITY_FROG_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_AMBIENT); + public static final CompatSoundEvent ENTITY_FROG_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_FROG_DEATH); + public static final CompatSoundEvent ENTITY_FROG_EAT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_EAT); + public static final CompatSoundEvent ENTITY_FROG_HURT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_HURT); + public static final CompatSoundEvent ENTITY_FROG_LAY_SPAWN = new CompatSoundEvent(SoundEvents.ENTITY_FROG_LAY_SPAWN); + public static final CompatSoundEvent ENTITY_FROG_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_FROG_LONG_JUMP); + public static final CompatSoundEvent ENTITY_FROG_STEP = new CompatSoundEvent(SoundEvents.ENTITY_FROG_STEP); + public static final CompatSoundEvent ENTITY_FROG_TONGUE = new CompatSoundEvent(SoundEvents.ENTITY_FROG_TONGUE); + public static final CompatSoundEvent BLOCK_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_STEP); + public static final CompatSoundEvent BLOCK_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_HIT); + public static final CompatSoundEvent BLOCK_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_FALL); + public static final CompatSoundEvent BLOCK_FURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE); + public static final CompatSoundEvent ENTITY_GENERIC_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_BIG_FALL); + public static final CompatSoundEvent ENTITY_GENERIC_BURN = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_BURN); + public static final CompatSoundEvent ENTITY_GENERIC_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_DEATH); + public static final CompatSoundEvent ENTITY_GENERIC_DRINK = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_DRINK); + public static final CompatSoundEvent ENTITY_GENERIC_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EAT); + public static final CompatSoundEvent ENTITY_GENERIC_EXPLODE = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EXPLODE); + public static final CompatSoundEvent ENTITY_GENERIC_EXTINGUISH_FIRE = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE); + public static final CompatSoundEvent ENTITY_GENERIC_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_HURT); + public static final CompatSoundEvent ENTITY_GENERIC_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SMALL_FALL); + public static final CompatSoundEvent ENTITY_GENERIC_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SPLASH); + public static final CompatSoundEvent ENTITY_GENERIC_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SWIM); + public static final CompatSoundEvent ENTITY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_AMBIENT); + public static final CompatSoundEvent ENTITY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_DEATH); + public static final CompatSoundEvent ENTITY_GHAST_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_HURT); + public static final CompatSoundEvent ENTITY_GHAST_SCREAM = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_SCREAM); + public static final CompatSoundEvent ENTITY_GHAST_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_SHOOT); + public static final CompatSoundEvent ENTITY_GHAST_WARN = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_WARN); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_BREAK); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_FALL); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_HIT); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_PLACE); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_STEP); + public static final CompatSoundEvent BLOCK_GLASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_BREAK); + public static final CompatSoundEvent BLOCK_GLASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_FALL); + public static final CompatSoundEvent BLOCK_GLASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_HIT); + public static final CompatSoundEvent BLOCK_GLASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_PLACE); + public static final CompatSoundEvent BLOCK_GLASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_STEP); + public static final CompatSoundEvent ITEM_GLOW_INK_SAC_USE = new CompatSoundEvent(SoundEvents.ITEM_GLOW_INK_SAC_USE); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_ADD_ITEM); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_BREAK); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_PLACE); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_REMOVE_ITEM); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_ROTATE_ITEM); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_AMBIENT); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_DEATH); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_HURT); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_SQUIRT); + public static final CompatSoundEvent ENTITY_GOAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_AMBIENT); + public static final CompatSoundEvent ENTITY_GOAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_DEATH); + public static final CompatSoundEvent ENTITY_GOAT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_EAT); + public static final CompatSoundEvent ENTITY_GOAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HURT); + public static final CompatSoundEvent ENTITY_GOAT_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_LONG_JUMP); + public static final CompatSoundEvent ENTITY_GOAT_MILK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_MILK); + public static final CompatSoundEvent ENTITY_GOAT_PREPARE_RAM = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_PREPARE_RAM); + public static final CompatSoundEvent ENTITY_GOAT_RAM_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_RAM_IMPACT); + public static final CompatSoundEvent ENTITY_GOAT_HORN_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HORN_BREAK); + public static final CompatSoundEvent ITEM_GOAT_HORN_PLAY = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_STEP); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_AMBIENT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_DEATH); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_EAT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_HURT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_LONG_JUMP); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_MILK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_MILK); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_PREPARE_RAM = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_PREPARE_RAM); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_RAM_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_RAM_IMPACT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HORN_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HORN_BREAK); + public static final CompatSoundEvent ENTITY_GOAT_STEP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_STEP); + public static final CompatSoundEvent BLOCK_GRASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_BREAK); + public static final CompatSoundEvent BLOCK_GRASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_FALL); + public static final CompatSoundEvent BLOCK_GRASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_HIT); + public static final CompatSoundEvent BLOCK_GRASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_PLACE); + public static final CompatSoundEvent BLOCK_GRASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_STEP); + public static final CompatSoundEvent BLOCK_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_BREAK); + public static final CompatSoundEvent BLOCK_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_FALL); + public static final CompatSoundEvent BLOCK_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_HIT); + public static final CompatSoundEvent BLOCK_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_PLACE); + public static final CompatSoundEvent BLOCK_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_STEP); + public static final CompatSoundEvent BLOCK_GRINDSTONE_USE = new CompatSoundEvent(SoundEvents.BLOCK_GRINDSTONE_USE); + public static final CompatSoundEvent BLOCK_GROWING_PLANT_CROP = new CompatSoundEvent(SoundEvents.BLOCK_GROWING_PLANT_CROP); + public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_AMBIENT); + public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_AMBIENT_LAND); + public static final CompatSoundEvent ENTITY_GUARDIAN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_ATTACK); + public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_DEATH); + public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_DEATH_LAND); + public static final CompatSoundEvent ENTITY_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_FLOP); + public static final CompatSoundEvent ENTITY_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_HURT); + public static final CompatSoundEvent ENTITY_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_HURT_LAND); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_FALL); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_HIT); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_STEP); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_BREAK); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_FALL); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_HIT); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_PLACE); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_STEP); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_BREAK); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_STEP); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_PLACE); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_HIT); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_FALL); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_MOB = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_MOB); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_ITEM); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_DETECT_PLAYER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_DETECT_PLAYER); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OMINOUS_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_OMINOUS_ACTIVATE); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_AMBIENT); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT_OMINOUS = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_AMBIENT_OMINOUS); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_EJECT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_EJECT_ITEM); + public static final CompatSoundEvent ITEM_HOE_TILL = new CompatSoundEvent(SoundEvents.ITEM_HOE_TILL); + public static final CompatSoundEvent ENTITY_HOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_HOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_HOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_ATTACK); + public static final CompatSoundEvent ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED); + public static final CompatSoundEvent ENTITY_HOGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_DEATH); + public static final CompatSoundEvent ENTITY_HOGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_HURT); + public static final CompatSoundEvent ENTITY_HOGLIN_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_RETREAT); + public static final CompatSoundEvent ENTITY_HOGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_STEP); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_SLIDE = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_SLIDE); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_STEP); + public static final CompatSoundEvent ITEM_HONEYCOMB_WAX_ON = new CompatSoundEvent(SoundEvents.ITEM_HONEYCOMB_WAX_ON); + public static final CompatSoundEvent ITEM_HONEY_BOTTLE_DRINK = new CompatSoundEvent(SoundEvents.ITEM_HONEY_BOTTLE_DRINK); + public static final int GOAT_HORN_SOUNDS_COUNT = SoundEvents.GOAT_HORN_SOUND_COUNT; + public static final ImmutableList GOAT_HORN_SOUNDS; + public static final CompatSoundEvent ENTITY_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_AMBIENT); + public static final CompatSoundEvent ENTITY_HORSE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_ANGRY); + public static final CompatSoundEvent ENTITY_HORSE_ARMOR = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_ARMOR); + public static final CompatSoundEvent ENTITY_HORSE_BREATHE = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_BREATHE); + public static final CompatSoundEvent ENTITY_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_DEATH); + public static final CompatSoundEvent ENTITY_HORSE_EAT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_EAT); + public static final CompatSoundEvent ENTITY_HORSE_GALLOP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_GALLOP); + public static final CompatSoundEvent ENTITY_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_HURT); + public static final CompatSoundEvent ENTITY_HORSE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_JUMP); + public static final CompatSoundEvent ENTITY_HORSE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_LAND); + public static final CompatSoundEvent ENTITY_HORSE_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_SADDLE); + public static final CompatSoundEvent ENTITY_HORSE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_STEP); + public static final CompatSoundEvent ENTITY_HORSE_STEP_WOOD = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_STEP_WOOD); + public static final CompatSoundEvent ENTITY_HOSTILE_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_BIG_FALL); + public static final CompatSoundEvent ENTITY_HOSTILE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_DEATH); + public static final CompatSoundEvent ENTITY_HOSTILE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_HURT); + public static final CompatSoundEvent ENTITY_HOSTILE_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SMALL_FALL); + public static final CompatSoundEvent ENTITY_HOSTILE_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SPLASH); + public static final CompatSoundEvent ENTITY_HOSTILE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SWIM); + public static final CompatSoundEvent ENTITY_HUSK_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_AMBIENT); + public static final CompatSoundEvent ENTITY_HUSK_CONVERTED_TO_ZOMBIE = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_CONVERTED_TO_ZOMBIE); + public static final CompatSoundEvent ENTITY_HUSK_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_DEATH); + public static final CompatSoundEvent ENTITY_HUSK_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_HURT); + public static final CompatSoundEvent ENTITY_HUSK_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_STEP); + public static final CompatSoundEvent ENTITY_ILLUSIONER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_AMBIENT); + public static final CompatSoundEvent ENTITY_ILLUSIONER_CAST_SPELL = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_CAST_SPELL); + public static final CompatSoundEvent ENTITY_ILLUSIONER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_DEATH); + public static final CompatSoundEvent ENTITY_ILLUSIONER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_HURT); + public static final CompatSoundEvent ENTITY_ILLUSIONER_MIRROR_MOVE = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_MIRROR_MOVE); + public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_BLINDNESS = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_PREPARE_BLINDNESS); + public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_MIRROR = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_PREPARE_MIRROR); + public static final CompatSoundEvent ITEM_INK_SAC_USE = new CompatSoundEvent(SoundEvents.ITEM_INK_SAC_USE); + public static final CompatSoundEvent BLOCK_IRON_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_IRON_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_IRON_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_IRON_DOOR_OPEN); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_ATTACK); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_DAMAGE = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_DAMAGE); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_DEATH); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_HURT); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_REPAIR = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_REPAIR); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_STEP = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_STEP); + public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_BREAK); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_PLACE); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_REMOVE_ITEM); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_ROTATE_ITEM); + public static final CompatSoundEvent ENTITY_ITEM_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_BREAK); + public static final CompatSoundEvent ENTITY_ITEM_PICKUP = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_PICKUP); + public static final CompatSoundEvent BLOCK_LADDER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_BREAK); + public static final CompatSoundEvent BLOCK_LADDER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_FALL); + public static final CompatSoundEvent BLOCK_LADDER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_HIT); + public static final CompatSoundEvent BLOCK_LADDER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_PLACE); + public static final CompatSoundEvent BLOCK_LADDER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_STEP); + public static final CompatSoundEvent BLOCK_LANTERN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_BREAK); + public static final CompatSoundEvent BLOCK_LANTERN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_FALL); + public static final CompatSoundEvent BLOCK_LANTERN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_HIT); + public static final CompatSoundEvent BLOCK_LANTERN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_PLACE); + public static final CompatSoundEvent BLOCK_LANTERN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_STEP); + public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LARGE_AMETHYST_BUD_BREAK); + public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LARGE_AMETHYST_BUD_PLACE); + public static final CompatSoundEvent BLOCK_LAVA_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_AMBIENT); + public static final CompatSoundEvent BLOCK_LAVA_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_EXTINGUISH); + public static final CompatSoundEvent BLOCK_LAVA_POP = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_POP); + public static final CompatSoundEvent ENTITY_LEASH_KNOT_BREAK = new CompatSoundEvent(SoundEvents.ITEM_LEAD_BREAK); + public static final CompatSoundEvent ENTITY_LEASH_KNOT_PLACE = new CompatSoundEvent(SoundEvents.ITEM_LEAD_TIED); + public static final CompatSoundEvent BLOCK_LEVER_CLICK = new CompatSoundEvent(SoundEvents.BLOCK_LEVER_CLICK); + public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_LIGHTNING_BOLT_IMPACT); + public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_THUNDER = new CompatSoundEvent(SoundEvents.ENTITY_LIGHTNING_BOLT_THUNDER); + public static final CompatSoundEvent ENTITY_LINGERING_POTION_THROW = new CompatSoundEvent(SoundEvents.ENTITY_LINGERING_POTION_THROW); + public static final CompatSoundEvent ENTITY_LLAMA_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_AMBIENT); + public static final CompatSoundEvent ENTITY_LLAMA_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_ANGRY); + public static final CompatSoundEvent ENTITY_LLAMA_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_CHEST); + public static final CompatSoundEvent ENTITY_LLAMA_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_DEATH); + public static final CompatSoundEvent ENTITY_LLAMA_EAT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_EAT); + public static final CompatSoundEvent ENTITY_LLAMA_HURT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_HURT); + public static final CompatSoundEvent ENTITY_LLAMA_SPIT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_SPIT); + public static final CompatSoundEvent ENTITY_LLAMA_STEP = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_STEP); + public static final CompatSoundEvent ENTITY_LLAMA_SWAG = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_SWAG); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_DEATH_SMALL); + public static final CompatSoundEvent BLOCK_LODESTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_BREAK); + public static final CompatSoundEvent BLOCK_LODESTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_STEP); + public static final CompatSoundEvent BLOCK_LODESTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_PLACE); + public static final CompatSoundEvent BLOCK_LODESTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_HIT); + public static final CompatSoundEvent BLOCK_LODESTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_FALL); + public static final CompatSoundEvent ITEM_LODESTONE_COMPASS_LOCK = new CompatSoundEvent(SoundEvents.ITEM_LODESTONE_COMPASS_LOCK); + public static final CompatSoundEvent ITEM_MACE_SMASH_AIR = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_AIR); + public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_GROUND); + public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND_HEAVY = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_GROUND_HEAVY); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_DEATH); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_HURT); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_HURT_SMALL); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_JUMP); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_SQUISH); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_SQUISH_SMALL); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_FALL); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_HIT); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_STEP); + public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MEDIUM_AMETHYST_BUD_BREAK); + public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MEDIUM_AMETHYST_BUD_PLACE); + public static final CompatSoundEvent BLOCK_METAL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_METAL_BREAK); + public static final CompatSoundEvent BLOCK_METAL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_METAL_FALL); + public static final CompatSoundEvent BLOCK_METAL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_METAL_HIT); + public static final CompatSoundEvent BLOCK_METAL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PLACE); + public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_METAL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_METAL_STEP); + public static final CompatSoundEvent ENTITY_MINECART_INSIDE_UNDERWATER = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_INSIDE_UNDERWATER); + public static final CompatSoundEvent ENTITY_MINECART_INSIDE = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_INSIDE); + public static final CompatSoundEvent ENTITY_MINECART_RIDING = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_RIDING); + public static final CompatSoundEvent ENTITY_MOOSHROOM_CONVERT = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_CONVERT); + public static final CompatSoundEvent ENTITY_MOOSHROOM_EAT = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_EAT); + public static final CompatSoundEvent ENTITY_MOOSHROOM_MILK = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_MILK); + public static final CompatSoundEvent ENTITY_MOOSHROOM_SUSPICIOUS_MILK = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_SUSPICIOUS_MILK); + public static final CompatSoundEvent ENTITY_MOOSHROOM_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_SHEAR); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_BREAK); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_FALL); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_HIT); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_PLACE); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_STEP); + public static final CompatSoundEvent BLOCK_PINK_PETALS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_BREAK); + public static final CompatSoundEvent BLOCK_PINK_PETALS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_FALL); + public static final CompatSoundEvent BLOCK_PINK_PETALS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_HIT); + public static final CompatSoundEvent BLOCK_PINK_PETALS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_PLACE); + public static final CompatSoundEvent BLOCK_PINK_PETALS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_STEP); + public static final CompatSoundEvent BLOCK_MOSS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_BREAK); + public static final CompatSoundEvent BLOCK_MOSS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_FALL); + public static final CompatSoundEvent BLOCK_MOSS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_HIT); + public static final CompatSoundEvent BLOCK_MOSS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_PLACE); + public static final CompatSoundEvent BLOCK_MOSS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_STEP); + public static final CompatSoundEvent BLOCK_MUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BREAK); + public static final CompatSoundEvent BLOCK_MUD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUD_FALL); + public static final CompatSoundEvent BLOCK_MUD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUD_HIT); + public static final CompatSoundEvent BLOCK_MUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUD_PLACE); + public static final CompatSoundEvent BLOCK_MUD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUD_STEP); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_FALL); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_HIT); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_STEP); + public static final CompatSoundEvent ENTITY_MULE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_AMBIENT); + public static final CompatSoundEvent ENTITY_MULE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_MULE_ANGRY); + public static final CompatSoundEvent ENTITY_MULE_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_MULE_CHEST); + public static final CompatSoundEvent ENTITY_MULE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_MULE_DEATH); + public static final CompatSoundEvent ENTITY_MULE_EAT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_EAT); + public static final CompatSoundEvent ENTITY_MULE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_HURT); + public static final CompatSoundEvent ENTITY_MULE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_MULE_JUMP); + public static final CompatSoundEvent MUSIC_CREATIVE = new CompatSoundEvent(SoundEvents.MUSIC_CREATIVE); + public static final CompatSoundEvent MUSIC_CREDITS = new CompatSoundEvent(SoundEvents.MUSIC_CREDITS); + public static final CompatSoundEvent MUSIC_DISC_5 = new CompatSoundEvent(SoundEvents.MUSIC_DISC_5); + public static final CompatSoundEvent MUSIC_DISC_11 = new CompatSoundEvent(SoundEvents.MUSIC_DISC_11); + public static final CompatSoundEvent MUSIC_DISC_13 = new CompatSoundEvent(SoundEvents.MUSIC_DISC_13); + public static final CompatSoundEvent MUSIC_DISC_BLOCKS = new CompatSoundEvent(SoundEvents.MUSIC_DISC_BLOCKS); + public static final CompatSoundEvent MUSIC_DISC_CAT = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CAT); + public static final CompatSoundEvent MUSIC_DISC_CHIRP = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CHIRP); + public static final CompatSoundEvent MUSIC_DISC_FAR = new CompatSoundEvent(SoundEvents.MUSIC_DISC_FAR); + public static final CompatSoundEvent MUSIC_DISC_MALL = new CompatSoundEvent(SoundEvents.MUSIC_DISC_MALL); + public static final CompatSoundEvent MUSIC_DISC_MELLOHI = new CompatSoundEvent(SoundEvents.MUSIC_DISC_MELLOHI); + public static final CompatSoundEvent MUSIC_DISC_PIGSTEP = new CompatSoundEvent(SoundEvents.MUSIC_DISC_PIGSTEP); + public static final CompatSoundEvent MUSIC_DISC_STAL = new CompatSoundEvent(SoundEvents.MUSIC_DISC_STAL); + public static final CompatSoundEvent MUSIC_DISC_STRAD = new CompatSoundEvent(SoundEvents.MUSIC_DISC_STRAD); + public static final CompatSoundEvent MUSIC_DISC_WAIT = new CompatSoundEvent(SoundEvents.MUSIC_DISC_WAIT); + public static final CompatSoundEvent MUSIC_DISC_WARD = new CompatSoundEvent(SoundEvents.MUSIC_DISC_WARD); + public static final CompatSoundEvent MUSIC_DISC_OTHERSIDE = new CompatSoundEvent(SoundEvents.MUSIC_DISC_OTHERSIDE); + public static final CompatSoundEvent MUSIC_DISC_RELIC = new CompatSoundEvent(SoundEvents.MUSIC_DISC_RELIC); + public static final CompatSoundEvent MUSIC_DISC_CREATOR = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CREATOR); + public static final CompatSoundEvent MUSIC_DISC_CREATOR_MUSIC_BOX = new CompatSoundEvent(SoundEvents.MUSIC_DISC_CREATOR_MUSIC_BOX); + public static final CompatSoundEvent MUSIC_DISC_PRECIPICE = new CompatSoundEvent(SoundEvents.MUSIC_DISC_PRECIPICE); + public static final CompatSoundEvent MUSIC_DRAGON = new CompatSoundEvent(SoundEvents.MUSIC_DRAGON); + public static final CompatSoundEvent MUSIC_END = new CompatSoundEvent(SoundEvents.MUSIC_END); + public static final CompatSoundEvent MUSIC_GAME = new CompatSoundEvent(SoundEvents.MUSIC_GAME); + public static final CompatSoundEvent MUSIC_MENU = new CompatSoundEvent(SoundEvents.MUSIC_MENU); + public static final CompatSoundEvent MUSIC_NETHER_BASALT_DELTAS = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_BASALT_DELTAS); + public static final CompatSoundEvent MUSIC_NETHER_CRIMSON_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_CRIMSON_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_DEEP_DARK = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DEEP_DARK); + public static final CompatSoundEvent MUSIC_OVERWORLD_DRIPSTONE_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DRIPSTONE_CAVES); + public static final CompatSoundEvent MUSIC_OVERWORLD_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_GROVE); + public static final CompatSoundEvent MUSIC_OVERWORLD_JAGGED_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_JAGGED_PEAKS); + public static final CompatSoundEvent MUSIC_OVERWORLD_LUSH_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_LUSH_CAVES); + public static final CompatSoundEvent MUSIC_OVERWORLD_SWAMP = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SWAMP); + public static final CompatSoundEvent MUSIC_OVERWORLD_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_OLD_GROWTH_TAIGA = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_OLD_GROWTH_TAIGA); + public static final CompatSoundEvent MUSIC_OVERWORLD_MEADOW = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_MEADOW); + public static final CompatSoundEvent MUSIC_OVERWORLD_CHERRY_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_CHERRY_GROVE); + public static final CompatSoundEvent MUSIC_NETHER_NETHER_WASTES = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_NETHER_WASTES); + public static final CompatSoundEvent MUSIC_OVERWORLD_FROZEN_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FROZEN_PEAKS); + public static final CompatSoundEvent MUSIC_OVERWORLD_SNOWY_SLOPES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SNOWY_SLOPES); + public static final CompatSoundEvent MUSIC_NETHER_SOUL_SAND_VALLEY = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_SOUL_SAND_VALLEY); + public static final CompatSoundEvent MUSIC_OVERWORLD_STONY_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_STONY_PEAKS); + public static final CompatSoundEvent MUSIC_NETHER_WARPED_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_WARPED_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_FLOWER_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FLOWER_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_DESERT = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DESERT); + public static final CompatSoundEvent MUSIC_OVERWORLD_BADLANDS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_BADLANDS); + public static final CompatSoundEvent MUSIC_OVERWORLD_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_JUNGLE); + public static final CompatSoundEvent MUSIC_OVERWORLD_SPARSE_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SPARSE_JUNGLE); + public static final CompatSoundEvent MUSIC_OVERWORLD_BAMBOO_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_BAMBOO_JUNGLE); + public static final CompatSoundEvent MUSIC_UNDER_WATER = new CompatSoundEvent(SoundEvents.MUSIC_UNDER_WATER); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_NETHER_WART_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WART_BREAK); + public static final CompatSoundEvent ITEM_NETHER_WART_PLANT = new CompatSoundEvent(SoundEvents.ITEM_NETHER_WART_PLANT); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FALL); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HIT); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_STEP); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FENCE_GATE_OPEN); + public static final CompatSoundEvent INTENTIONALLY_EMPTY = new CompatSoundEvent(SoundEvents.INTENTIONALLY_EMPTY); + public static final CompatSoundEvent BLOCK_PACKED_MUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_BREAK); + public static final CompatSoundEvent BLOCK_PACKED_MUD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_FALL); + public static final CompatSoundEvent BLOCK_PACKED_MUD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_HIT); + public static final CompatSoundEvent BLOCK_PACKED_MUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_PLACE); + public static final CompatSoundEvent BLOCK_PACKED_MUD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_STEP); + public static final CompatSoundEvent BLOCK_STEM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_STEM_BREAK); + public static final CompatSoundEvent BLOCK_STEM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_STEM_STEP); + public static final CompatSoundEvent BLOCK_STEM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_STEM_PLACE); + public static final CompatSoundEvent BLOCK_STEM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_STEM_HIT); + public static final CompatSoundEvent BLOCK_STEM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_STEM_FALL); + public static final CompatSoundEvent BLOCK_NYLIUM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_BREAK); + public static final CompatSoundEvent BLOCK_NYLIUM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_STEP); + public static final CompatSoundEvent BLOCK_NYLIUM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_PLACE); + public static final CompatSoundEvent BLOCK_NYLIUM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_HIT); + public static final CompatSoundEvent BLOCK_NYLIUM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_FALL); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_STEP); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_HIT); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_FALL); + public static final CompatSoundEvent BLOCK_FUNGUS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_BREAK); + public static final CompatSoundEvent BLOCK_FUNGUS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_STEP); + public static final CompatSoundEvent BLOCK_FUNGUS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_PLACE); + public static final CompatSoundEvent BLOCK_FUNGUS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_HIT); + public static final CompatSoundEvent BLOCK_FUNGUS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_FALL); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_BREAK); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_STEP); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_PLACE); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_HIT); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_FALL); + public static final CompatSoundEvent BLOCK_WART_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_WART_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_WART_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_WART_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_WART_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_NETHERRACK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_BREAK); + public static final CompatSoundEvent BLOCK_NETHERRACK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_STEP); + public static final CompatSoundEvent BLOCK_NETHERRACK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_PLACE); + public static final CompatSoundEvent BLOCK_NETHERRACK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_HIT); + public static final CompatSoundEvent BLOCK_NETHERRACK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_FALL); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASEDRUM = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BASEDRUM); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASS = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BASS); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BELL = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BELL); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_CHIME); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_FLUTE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_FLUTE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_GUITAR = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_GUITAR); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HARP = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_HARP); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HAT = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_HAT); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_PLING = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_PLING); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_SNARE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_SNARE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_XYLOPHONE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_XYLOPHONE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IRON_XYLOPHONE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_COW_BELL = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_COW_BELL); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_DIDGERIDOO = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BIT = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BIT); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BANJO = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BANJO); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_SKELETON); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_CREEPER); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_PIGLIN); + public static final CompatSoundEvent ENTITY_OCELOT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_HURT); + public static final CompatSoundEvent ENTITY_OCELOT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_AMBIENT); + public static final CompatSoundEvent ENTITY_OCELOT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_DEATH); + public static final CompatSoundEvent ITEM_OMINOUS_BOTTLE_DISPOSE = new CompatSoundEvent(SoundEvents.ITEM_OMINOUS_BOTTLE_DISPOSE); + public static final CompatSoundEvent ENTITY_PAINTING_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_PAINTING_BREAK); + public static final CompatSoundEvent ENTITY_PAINTING_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_PAINTING_PLACE); + public static final CompatSoundEvent ENTITY_PANDA_PRE_SNEEZE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_PRE_SNEEZE); + public static final CompatSoundEvent ENTITY_PANDA_SNEEZE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_SNEEZE); + public static final CompatSoundEvent ENTITY_PANDA_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_AMBIENT); + public static final CompatSoundEvent ENTITY_PANDA_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_DEATH); + public static final CompatSoundEvent ENTITY_PANDA_EAT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_EAT); + public static final CompatSoundEvent ENTITY_PANDA_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_STEP); + public static final CompatSoundEvent ENTITY_PANDA_CANT_BREED = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_CANT_BREED); + public static final CompatSoundEvent ENTITY_PANDA_AGGRESSIVE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_AGGRESSIVE_AMBIENT); + public static final CompatSoundEvent ENTITY_PANDA_WORRIED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_WORRIED_AMBIENT); + public static final CompatSoundEvent ENTITY_PANDA_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_HURT); + public static final CompatSoundEvent ENTITY_PANDA_BITE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_BITE); + public static final CompatSoundEvent ENTITY_PARROT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_AMBIENT); + public static final CompatSoundEvent ENTITY_PARROT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_DEATH); + public static final CompatSoundEvent ENTITY_PARROT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_EAT); + public static final CompatSoundEvent ENTITY_PARROT_FLY = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_FLY); + public static final CompatSoundEvent ENTITY_PARROT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_HURT); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BLAZE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BLAZE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BOGGED = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BOGGED); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BREEZE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BREEZE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_CREEPER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_DROWNED = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_DROWNED); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ELDER_GUARDIAN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ELDER_GUARDIAN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ENDER_DRAGON); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDERMITE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ENDERMITE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_EVOKER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_EVOKER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GHAST = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_GHAST); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GUARDIAN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_GUARDIAN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HOGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_HOGLIN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HUSK = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_HUSK); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ILLUSIONER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ILLUSIONER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_MAGMA_CUBE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_MAGMA_CUBE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PHANTOM = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PHANTOM); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PIGLIN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN_BRUTE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PIGLIN_BRUTE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PILLAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PILLAGER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_RAVAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_RAVAGER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SHULKER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SHULKER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SILVERFISH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SILVERFISH); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SKELETON); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SLIME = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SLIME); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SPIDER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SPIDER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_STRAY = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_STRAY); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VEX = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_VEX); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VINDICATOR = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_VINDICATOR); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WARDEN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WARDEN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITCH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITCH); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITHER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITHER_SKELETON); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOGLIN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOMBIE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER); + public static final CompatSoundEvent ENTITY_PARROT_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_STEP); + public static final CompatSoundEvent ENTITY_PHANTOM_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_AMBIENT); + public static final CompatSoundEvent ENTITY_PHANTOM_BITE = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_BITE); + public static final CompatSoundEvent ENTITY_PHANTOM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_DEATH); + public static final CompatSoundEvent ENTITY_PHANTOM_FLAP = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_FLAP); + public static final CompatSoundEvent ENTITY_PHANTOM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_HURT); + public static final CompatSoundEvent ENTITY_PHANTOM_SWOOP = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_SWOOP); + public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIG_AMBIENT); + public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIG_DEATH); + public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIG_HURT); + public static final CompatSoundEvent ENTITY_PIG_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_PIG_SADDLE); + public static final CompatSoundEvent ENTITY_PIG_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIG_STEP); + public static final CompatSoundEvent ENTITY_PIGLIN_ADMIRING_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_ADMIRING_ITEM); + public static final CompatSoundEvent ENTITY_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_PIGLIN_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_CELEBRATE); + public static final CompatSoundEvent ENTITY_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_DEATH); + public static final CompatSoundEvent ENTITY_PIGLIN_JEALOUS = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_JEALOUS); + public static final CompatSoundEvent ENTITY_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_HURT); + public static final CompatSoundEvent ENTITY_PIGLIN_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_RETREAT); + public static final CompatSoundEvent ENTITY_PIGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_STEP); + public static final CompatSoundEvent ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_AMBIENT); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_ANGRY); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_DEATH); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_HURT); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_STEP); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED); + public static final CompatSoundEvent ENTITY_PILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_PILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_CELEBRATE); + public static final CompatSoundEvent ENTITY_PILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_DEATH); + public static final CompatSoundEvent ENTITY_PILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_HURT); + public static final CompatSoundEvent BLOCK_PISTON_CONTRACT = new CompatSoundEvent(SoundEvents.BLOCK_PISTON_CONTRACT); + public static final CompatSoundEvent BLOCK_PISTON_EXTEND = new CompatSoundEvent(SoundEvents.BLOCK_PISTON_EXTEND); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_CRIT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_CRIT); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_KNOCKBACK = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_NODAMAGE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_STRONG = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_STRONG); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_SWEEP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_WEAK = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_WEAK); + public static final CompatSoundEvent ENTITY_PLAYER_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BIG_FALL); + public static final CompatSoundEvent ENTITY_PLAYER_BREATH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BREATH); + public static final CompatSoundEvent ENTITY_PLAYER_BURP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BURP); + public static final CompatSoundEvent ENTITY_PLAYER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_DEATH); + public static final CompatSoundEvent ENTITY_PLAYER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_DROWN = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_DROWN); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_FREEZE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_FREEZE); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_ON_FIRE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_ON_FIRE); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH); + public static final CompatSoundEvent ENTITY_PLAYER_LEVELUP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_LEVELUP); + public static final CompatSoundEvent ENTITY_PLAYER_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SMALL_FALL); + public static final CompatSoundEvent ENTITY_PLAYER_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SPLASH); + public static final CompatSoundEvent ENTITY_PLAYER_SPLASH_HIGH_SPEED = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SPLASH_HIGH_SPEED); + public static final CompatSoundEvent ENTITY_PLAYER_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SWIM); + public static final CompatSoundEvent ENTITY_PLAYER_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_TELEPORT); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_AMBIENT); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT_BABY = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_AMBIENT_BABY); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_DEATH); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_HURT = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_HURT); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_STEP = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_STEP); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_WARNING = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_WARNING); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_BREAK); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_FALL); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_HIT); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_PLACE); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_STEP); + public static final CompatSoundEvent BLOCK_PORTAL_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_AMBIENT); + public static final CompatSoundEvent BLOCK_PORTAL_TRAVEL = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_TRAVEL); + public static final CompatSoundEvent BLOCK_PORTAL_TRIGGER = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_TRIGGER); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_BREAK); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_FALL); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_HIT); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_PLACE); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_STEP); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_STING); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_OUT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_BLOW_OUT); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_UP = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_BLOW_UP); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_DEATH); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_FLOP); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_HURT); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_STING = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_STING); + public static final CompatSoundEvent BLOCK_PUMPKIN_CARVE = new CompatSoundEvent(SoundEvents.BLOCK_PUMPKIN_CARVE); + public static final CompatSoundEvent ENTITY_RABBIT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_AMBIENT); + public static final CompatSoundEvent ENTITY_RABBIT_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_ATTACK); + public static final CompatSoundEvent ENTITY_RABBIT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_DEATH); + public static final CompatSoundEvent ENTITY_RABBIT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_HURT); + public static final CompatSoundEvent ENTITY_RABBIT_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_JUMP); + public static final CompatSoundEvent EVENT_RAID_HORN = new CompatSoundEvent(SoundEvents.EVENT_RAID_HORN); + public static final CompatSoundEvent ENTITY_RAVAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_RAVAGER_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_ATTACK); + public static final CompatSoundEvent ENTITY_RAVAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_CELEBRATE); + public static final CompatSoundEvent ENTITY_RAVAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_DEATH); + public static final CompatSoundEvent ENTITY_RAVAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_HURT); + public static final CompatSoundEvent ENTITY_RAVAGER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_STEP); + public static final CompatSoundEvent ENTITY_RAVAGER_STUNNED = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_STUNNED); + public static final CompatSoundEvent ENTITY_RAVAGER_ROAR = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_ROAR); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_FALL); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_HIT); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_STEP); + public static final CompatSoundEvent BLOCK_NETHER_ORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_ORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_FALL); + public static final CompatSoundEvent BLOCK_NETHER_ORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_HIT); + public static final CompatSoundEvent BLOCK_NETHER_ORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_ORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_STEP); + public static final CompatSoundEvent BLOCK_REDSTONE_TORCH_BURNOUT = new CompatSoundEvent(SoundEvents.BLOCK_REDSTONE_TORCH_BURNOUT); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_AMBIENT); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_CHARGE = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_CHARGE); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_DEPLETE = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_DEPLETE); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_SET_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_SET_SPAWN); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_BREAK); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_FALL); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_HIT); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_PLACE); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_STEP); + public static final CompatSoundEvent ENTITY_SALMON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_AMBIENT); + public static final CompatSoundEvent ENTITY_SALMON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_DEATH); + public static final CompatSoundEvent ENTITY_SALMON_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_FLOP); + public static final CompatSoundEvent ENTITY_SALMON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_HURT); + public static final CompatSoundEvent BLOCK_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SAND_BREAK); + public static final CompatSoundEvent BLOCK_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SAND_FALL); + public static final CompatSoundEvent BLOCK_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SAND_HIT); + public static final CompatSoundEvent BLOCK_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SAND_PLACE); + public static final CompatSoundEvent BLOCK_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SAND_STEP); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_BREAK); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_FALL); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_HIT); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_PLACE); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_STEP); + public static final CompatSoundEvent BLOCK_SCULK_SPREAD = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SPREAD); + public static final CompatSoundEvent BLOCK_SCULK_CHARGE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CHARGE); + public static final CompatSoundEvent BLOCK_SCULK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_FALL); + public static final CompatSoundEvent BLOCK_SCULK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_HIT); + public static final CompatSoundEvent BLOCK_SCULK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_STEP); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BLOOM = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_BLOOM); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_FALL); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_HIT); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_STEP); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_CLICKING); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING_STOP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_CLICKING_STOP); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_FALL); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_HIT); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_STEP); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_FALL); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_HIT); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_SHRIEK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_SHRIEK); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_STEP); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_FALL); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_HIT); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_STEP); + public static final CompatSoundEvent ENTITY_SHEEP_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_AMBIENT); + public static final CompatSoundEvent ENTITY_SHEEP_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_DEATH); + public static final CompatSoundEvent ENTITY_SHEEP_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_HURT); + public static final CompatSoundEvent ENTITY_SHEEP_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_SHEAR); + public static final CompatSoundEvent ENTITY_SHEEP_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_STEP); + public static final CompatSoundEvent ITEM_SHIELD_BLOCK = new CompatSoundEvent(SoundEvents.ITEM_SHIELD_BLOCK); + public static final CompatSoundEvent ITEM_SHIELD_BREAK = new CompatSoundEvent(SoundEvents.ITEM_SHIELD_BREAK); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_BREAK); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_STEP); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_PLACE); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_HIT); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_FALL); + public static final CompatSoundEvent ITEM_SHOVEL_FLATTEN = new CompatSoundEvent(SoundEvents.ITEM_SHOVEL_FLATTEN); + public static final CompatSoundEvent ENTITY_SHULKER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_AMBIENT); + public static final CompatSoundEvent BLOCK_SHULKER_BOX_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_SHULKER_BOX_CLOSE); + public static final CompatSoundEvent BLOCK_SHULKER_BOX_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_SHULKER_BOX_OPEN); + public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HIT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_BULLET_HIT); + public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_BULLET_HURT); + public static final CompatSoundEvent ENTITY_SHULKER_CLOSE = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_CLOSE); + public static final CompatSoundEvent ENTITY_SHULKER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_DEATH); + public static final CompatSoundEvent ENTITY_SHULKER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_HURT); + public static final CompatSoundEvent ENTITY_SHULKER_HURT_CLOSED = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_HURT_CLOSED); + public static final CompatSoundEvent ENTITY_SHULKER_OPEN = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_OPEN); + public static final CompatSoundEvent ENTITY_SHULKER_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_SHOOT); + public static final CompatSoundEvent ENTITY_SHULKER_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_TELEPORT); + public static final CompatSoundEvent ENTITY_SILVERFISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_AMBIENT); + public static final CompatSoundEvent ENTITY_SILVERFISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_DEATH); + public static final CompatSoundEvent ENTITY_SILVERFISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_HURT); + public static final CompatSoundEvent ENTITY_SILVERFISH_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_STEP); + public static final CompatSoundEvent ENTITY_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_AMBIENT); + public static final CompatSoundEvent ENTITY_SKELETON_CONVERTED_TO_STRAY = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_CONVERTED_TO_STRAY); + public static final CompatSoundEvent ENTITY_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_DEATH); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_AMBIENT); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_DEATH); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_HURT); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_SWIM); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_AMBIENT_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_GALLOP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_GALLOP_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_JUMP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_JUMP_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_STEP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_STEP_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HURT); + public static final CompatSoundEvent ENTITY_SKELETON_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_SHOOT); + public static final CompatSoundEvent ENTITY_SKELETON_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_STEP); + public static final CompatSoundEvent ENTITY_SLIME_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_ATTACK); + public static final CompatSoundEvent ENTITY_SLIME_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_DEATH); + public static final CompatSoundEvent ENTITY_SLIME_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_HURT); + public static final CompatSoundEvent ENTITY_SLIME_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_JUMP); + public static final CompatSoundEvent ENTITY_SLIME_SQUISH = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_SQUISH); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_AMETHYST_BUD_BREAK); + public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_AMETHYST_BUD_PLACE); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_BREAK); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_FALL); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_HIT); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_PLACE); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_STEP); + public static final CompatSoundEvent BLOCK_SOUL_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_BREAK); + public static final CompatSoundEvent BLOCK_SOUL_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_STEP); + public static final CompatSoundEvent BLOCK_SOUL_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_PLACE); + public static final CompatSoundEvent BLOCK_SOUL_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_HIT); + public static final CompatSoundEvent BLOCK_SOUL_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_FALL); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_BREAK); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_STEP); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_PLACE); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_HIT); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_FALL); + public static final CompatSoundEvent PARTICLE_SOUL_ESCAPE = new CompatSoundEvent(SoundEvents.PARTICLE_SOUL_ESCAPE); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_BREAK); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_FALL); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_HIT); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_PLACE); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_STEP); + public static final CompatSoundEvent ENTITY_STRIDER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_AMBIENT); + public static final CompatSoundEvent ENTITY_STRIDER_HAPPY = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_HAPPY); + public static final CompatSoundEvent ENTITY_STRIDER_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_RETREAT); + public static final CompatSoundEvent ENTITY_STRIDER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_DEATH); + public static final CompatSoundEvent ENTITY_STRIDER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_HURT); + public static final CompatSoundEvent ENTITY_STRIDER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_STEP); + public static final CompatSoundEvent ENTITY_STRIDER_STEP_LAVA = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_STEP_LAVA); + public static final CompatSoundEvent ENTITY_STRIDER_EAT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_EAT); + public static final CompatSoundEvent ENTITY_STRIDER_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_SADDLE); + public static final CompatSoundEvent ENTITY_SLIME_DEATH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_DEATH_SMALL); + public static final CompatSoundEvent ENTITY_SLIME_HURT_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_HURT_SMALL); + public static final CompatSoundEvent ENTITY_SLIME_JUMP_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_JUMP_SMALL); + public static final CompatSoundEvent ENTITY_SLIME_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_SQUISH_SMALL); + public static final CompatSoundEvent BLOCK_SMITHING_TABLE_USE = new CompatSoundEvent(SoundEvents.BLOCK_SMITHING_TABLE_USE); + public static final CompatSoundEvent BLOCK_SMOKER_SMOKE = new CompatSoundEvent(SoundEvents.BLOCK_SMOKER_SMOKE); + public static final CompatSoundEvent ENTITY_SNIFFER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_STEP); + public static final CompatSoundEvent ENTITY_SNIFFER_EAT = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_EAT); + public static final CompatSoundEvent ENTITY_SNIFFER_IDLE = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_IDLE); + public static final CompatSoundEvent ENTITY_SNIFFER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_HURT); + public static final CompatSoundEvent ENTITY_SNIFFER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DEATH); + public static final CompatSoundEvent ENTITY_SNIFFER_DROP_SEED = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DROP_SEED); + public static final CompatSoundEvent ENTITY_SNIFFER_SCENTING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SCENTING); + public static final CompatSoundEvent ENTITY_SNIFFER_SNIFFING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SNIFFING); + public static final CompatSoundEvent ENTITY_SNIFFER_SEARCHING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SEARCHING); + public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DIGGING); + public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING_STOP = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DIGGING_STOP); + public static final CompatSoundEvent ENTITY_SNIFFER_HAPPY = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_HAPPY); + public static final CompatSoundEvent BLOCK_SNIFFER_EGG_PLOP = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_PLOP); + public static final CompatSoundEvent BLOCK_SNIFFER_EGG_CRACK = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_CRACK); + public static final CompatSoundEvent BLOCK_SNIFFER_EGG_HATCH = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_HATCH); + public static final CompatSoundEvent ENTITY_SNOWBALL_THROW = new CompatSoundEvent(SoundEvents.ENTITY_SNOWBALL_THROW); + public static final CompatSoundEvent BLOCK_SNOW_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_BREAK); + public static final CompatSoundEvent BLOCK_SNOW_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_FALL); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_AMBIENT); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_DEATH); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_HURT); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_SHOOT); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_SHEAR); + public static final CompatSoundEvent BLOCK_SNOW_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_HIT); + public static final CompatSoundEvent BLOCK_SNOW_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_PLACE); + public static final CompatSoundEvent BLOCK_SNOW_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_STEP); + public static final CompatSoundEvent ENTITY_SPIDER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_AMBIENT); + public static final CompatSoundEvent ENTITY_SPIDER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_DEATH); + public static final CompatSoundEvent ENTITY_SPIDER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_HURT); + public static final CompatSoundEvent ENTITY_SPIDER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_STEP); + public static final CompatSoundEvent ENTITY_SPLASH_POTION_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_SPLASH_POTION_BREAK); + public static final CompatSoundEvent ENTITY_SPLASH_POTION_THROW = new CompatSoundEvent(SoundEvents.ENTITY_SPLASH_POTION_THROW); + public static final CompatSoundEvent BLOCK_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_BREAK); + public static final CompatSoundEvent BLOCK_SPONGE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_FALL); + public static final CompatSoundEvent BLOCK_SPONGE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_HIT); + public static final CompatSoundEvent BLOCK_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_PLACE); + public static final CompatSoundEvent BLOCK_SPONGE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_STEP); + public static final CompatSoundEvent BLOCK_SPONGE_ABSORB = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_ABSORB); + public static final CompatSoundEvent ITEM_SPYGLASS_USE = new CompatSoundEvent(SoundEvents.ITEM_SPYGLASS_USE); + public static final CompatSoundEvent ITEM_SPYGLASS_STOP_USING = new CompatSoundEvent(SoundEvents.ITEM_SPYGLASS_STOP_USING); + public static final CompatSoundEvent ENTITY_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_AMBIENT); + public static final CompatSoundEvent ENTITY_SQUID_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_DEATH); + public static final CompatSoundEvent ENTITY_SQUID_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_HURT); + public static final CompatSoundEvent ENTITY_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_SQUIRT); + public static final CompatSoundEvent BLOCK_STONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BREAK); + public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_STONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_STONE_FALL); + public static final CompatSoundEvent BLOCK_STONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_STONE_HIT); + public static final CompatSoundEvent BLOCK_STONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PLACE); + public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_STONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_STONE_STEP); + public static final CompatSoundEvent ENTITY_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_AMBIENT); + public static final CompatSoundEvent ENTITY_STRAY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_DEATH); + public static final CompatSoundEvent ENTITY_STRAY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_HURT); + public static final CompatSoundEvent ENTITY_STRAY_STEP = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_STEP); + public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_BREAK); + public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_PLACE); + public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES); + public static final CompatSoundEvent ENTITY_TADPOLE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_DEATH); + public static final CompatSoundEvent ENTITY_TADPOLE_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_FLOP); + public static final CompatSoundEvent ENTITY_TADPOLE_GROW_UP = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_GROW_UP); + public static final CompatSoundEvent ENTITY_TADPOLE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_HURT); + public static final CompatSoundEvent ENCHANT_THORNS_HIT = new CompatSoundEvent(SoundEvents.ENCHANT_THORNS_HIT); + public static final CompatSoundEvent ENTITY_TNT_PRIMED = new CompatSoundEvent(SoundEvents.ENTITY_TNT_PRIMED); + public static final CompatSoundEvent ITEM_TOTEM_USE = new CompatSoundEvent(SoundEvents.ITEM_TOTEM_USE); + public static final CompatSoundEvent ITEM_TRIDENT_HIT = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_HIT); + public static final CompatSoundEvent ITEM_TRIDENT_HIT_GROUND = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_HIT_GROUND); + public static final CompatSoundEvent ITEM_TRIDENT_RETURN = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RETURN); + public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_1 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_1); + public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_2 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_2); + public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_3 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_3); + public static final CompatSoundEvent ITEM_TRIDENT_THROW = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_THROW); + public static final CompatSoundEvent ITEM_TRIDENT_THUNDER = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_THUNDER); + public static final CompatSoundEvent BLOCK_TRIPWIRE_ATTACH = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_ATTACH); + public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_CLICK_ON); + public static final CompatSoundEvent BLOCK_TRIPWIRE_DETACH = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_DETACH); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_AMBIENT); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_DEATH); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_FLOP); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_HURT); + public static final CompatSoundEvent BLOCK_TUFF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BREAK); + public static final CompatSoundEvent BLOCK_TUFF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_STEP); + public static final CompatSoundEvent BLOCK_TUFF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_PLACE); + public static final CompatSoundEvent BLOCK_TUFF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_HIT); + public static final CompatSoundEvent BLOCK_TUFF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_FALL); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_BREAK); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_FALL); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_HIT); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_PLACE); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_STEP); + public static final CompatSoundEvent ENTITY_TURTLE_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_AMBIENT_LAND); + public static final CompatSoundEvent ENTITY_TURTLE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_DEATH); + public static final CompatSoundEvent ENTITY_TURTLE_DEATH_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_DEATH_BABY); + public static final CompatSoundEvent ENTITY_TURTLE_EGG_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_BREAK); + public static final CompatSoundEvent ENTITY_TURTLE_EGG_CRACK = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_CRACK); + public static final CompatSoundEvent ENTITY_TURTLE_EGG_HATCH = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_HATCH); + public static final CompatSoundEvent ENTITY_TURTLE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_HURT); + public static final CompatSoundEvent ENTITY_TURTLE_HURT_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_HURT_BABY); + public static final CompatSoundEvent ENTITY_TURTLE_LAY_EGG = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_LAY_EGG); + public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SHAMBLE); + public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SHAMBLE_BABY); + public static final CompatSoundEvent ENTITY_TURTLE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SWIM); + public static final CompatSoundEvent UI_BUTTON_CLICK = new CompatSoundEvent(SoundEvents.UI_BUTTON_CLICK); + public static final CompatSoundEvent UI_LOOM_SELECT_PATTERN = new CompatSoundEvent(SoundEvents.UI_LOOM_SELECT_PATTERN); + public static final CompatSoundEvent UI_LOOM_TAKE_RESULT = new CompatSoundEvent(SoundEvents.UI_LOOM_TAKE_RESULT); + public static final CompatSoundEvent UI_CARTOGRAPHY_TABLE_TAKE_RESULT = new CompatSoundEvent(SoundEvents.UI_CARTOGRAPHY_TABLE_TAKE_RESULT); + public static final CompatSoundEvent UI_STONECUTTER_TAKE_RESULT = new CompatSoundEvent(SoundEvents.UI_STONECUTTER_TAKE_RESULT); + public static final CompatSoundEvent UI_STONECUTTER_SELECT_RECIPE = new CompatSoundEvent(SoundEvents.UI_STONECUTTER_SELECT_RECIPE); + public static final CompatSoundEvent UI_TOAST_CHALLENGE_COMPLETE = new CompatSoundEvent(SoundEvents.UI_TOAST_CHALLENGE_COMPLETE); + public static final CompatSoundEvent UI_TOAST_IN = new CompatSoundEvent(SoundEvents.UI_TOAST_IN); + public static final CompatSoundEvent UI_TOAST_OUT = new CompatSoundEvent(SoundEvents.UI_TOAST_OUT); + public static final CompatSoundEvent BLOCK_VAULT_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_ACTIVATE); + public static final CompatSoundEvent BLOCK_VAULT_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_AMBIENT); + public static final CompatSoundEvent BLOCK_VAULT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_BREAK); + public static final CompatSoundEvent BLOCK_VAULT_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_CLOSE_SHUTTER); + public static final CompatSoundEvent BLOCK_VAULT_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_DEACTIVATE); + public static final CompatSoundEvent BLOCK_VAULT_EJECT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_EJECT_ITEM); + public static final CompatSoundEvent BLOCK_VAULT_REJECT_REWARDED_PLAYER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_REJECT_REWARDED_PLAYER); + public static final CompatSoundEvent BLOCK_VAULT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_FALL); + public static final CompatSoundEvent BLOCK_VAULT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_HIT); + public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_INSERT_ITEM); + public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_INSERT_ITEM_FAIL); + public static final CompatSoundEvent BLOCK_VAULT_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_OPEN_SHUTTER); + public static final CompatSoundEvent BLOCK_VAULT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_PLACE); + public static final CompatSoundEvent BLOCK_VAULT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_STEP); + public static final CompatSoundEvent ENTITY_VEX_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VEX_AMBIENT); + public static final CompatSoundEvent ENTITY_VEX_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_VEX_CHARGE); + public static final CompatSoundEvent ENTITY_VEX_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VEX_DEATH); + public static final CompatSoundEvent ENTITY_VEX_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VEX_HURT); + public static final CompatSoundEvent ENTITY_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_VILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_CELEBRATE); + public static final CompatSoundEvent ENTITY_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_DEATH); + public static final CompatSoundEvent ENTITY_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_HURT); + public static final CompatSoundEvent ENTITY_VILLAGER_NO = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_NO); + public static final CompatSoundEvent ENTITY_VILLAGER_TRADE = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_TRADE); + public static final CompatSoundEvent ENTITY_VILLAGER_YES = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_YES); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_ARMORER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_ARMORER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_BUTCHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_BUTCHER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CARTOGRAPHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_CARTOGRAPHER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CLERIC = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_CLERIC); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FARMER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FARMER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FISHERMAN = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FISHERMAN); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FLETCHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FLETCHER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LEATHERWORKER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_LEATHERWORKER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LIBRARIAN = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_MASON = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_MASON); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_SHEPHERD = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_SHEPHERD); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_TOOLSMITH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_WEAPONSMITH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_WEAPONSMITH); + public static final CompatSoundEvent ENTITY_VINDICATOR_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_AMBIENT); + public static final CompatSoundEvent ENTITY_VINDICATOR_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_CELEBRATE); + public static final CompatSoundEvent ENTITY_VINDICATOR_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_DEATH); + public static final CompatSoundEvent ENTITY_VINDICATOR_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_HURT); + public static final CompatSoundEvent BLOCK_VINE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_VINE_BREAK); + public static final CompatSoundEvent BLOCK_VINE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_VINE_FALL); + public static final CompatSoundEvent BLOCK_VINE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_VINE_HIT); + public static final CompatSoundEvent BLOCK_VINE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_VINE_PLACE); + public static final CompatSoundEvent BLOCK_VINE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_VINE_STEP); + public static final CompatSoundEvent BLOCK_LILY_PAD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LILY_PAD_PLACE); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_AMBIENT); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DEATH); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DISAPPEARED = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DISAPPEARED); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_MILK = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DRINK_MILK); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_POTION = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DRINK_POTION); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_HURT); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_NO = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_NO); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_REAPPEARED = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_REAPPEARED); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_TRADE = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_TRADE); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_YES = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_YES); + public static final CompatSoundEvent ENTITY_WARDEN_AGITATED = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_AGITATED); + public static final CompatSoundEvent ENTITY_WARDEN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_AMBIENT); + public static final CompatSoundEvent ENTITY_WARDEN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ANGRY); + public static final CompatSoundEvent ENTITY_WARDEN_ATTACK_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ATTACK_IMPACT); + public static final CompatSoundEvent ENTITY_WARDEN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_DEATH); + public static final CompatSoundEvent ENTITY_WARDEN_DIG = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_DIG); + public static final CompatSoundEvent ENTITY_WARDEN_EMERGE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_EMERGE); + public static final CompatSoundEvent ENTITY_WARDEN_HEARTBEAT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_HEARTBEAT); + public static final CompatSoundEvent ENTITY_WARDEN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_HURT); + public static final CompatSoundEvent ENTITY_WARDEN_LISTENING = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_LISTENING); + public static final CompatSoundEvent ENTITY_WARDEN_LISTENING_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_LISTENING_ANGRY); + public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSE); + public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSER = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSER); + public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSEST = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSEST); + public static final CompatSoundEvent ENTITY_WARDEN_ROAR = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ROAR); + public static final CompatSoundEvent ENTITY_WARDEN_SNIFF = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SNIFF); + public static final CompatSoundEvent ENTITY_WARDEN_SONIC_BOOM = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SONIC_BOOM); + public static final CompatSoundEvent ENTITY_WARDEN_SONIC_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SONIC_CHARGE); + public static final CompatSoundEvent ENTITY_WARDEN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_STEP); + public static final CompatSoundEvent ENTITY_WARDEN_TENDRIL_CLICKS = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_TENDRIL_CLICKS); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL); + public static final CompatSoundEvent BLOCK_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_SIGN_WAXED_INTERACT_FAIL); + public static final CompatSoundEvent BLOCK_WATER_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_WATER_AMBIENT); + public static final CompatSoundEvent WEATHER_RAIN = new CompatSoundEvent(SoundEvents.WEATHER_RAIN); + public static final CompatSoundEvent WEATHER_RAIN_ABOVE = new CompatSoundEvent(SoundEvents.WEATHER_RAIN_ABOVE); + public static final CompatSoundEvent BLOCK_WET_GRASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_BREAK); + public static final CompatSoundEvent BLOCK_WET_GRASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_FALL); + public static final CompatSoundEvent BLOCK_WET_GRASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_HIT); + public static final CompatSoundEvent BLOCK_WET_GRASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_PLACE); + public static final CompatSoundEvent BLOCK_WET_GRASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_STEP); + public static final CompatSoundEvent BLOCK_WET_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_BREAK); + public static final CompatSoundEvent BLOCK_WET_SPONGE_DRIES = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_DRIES); + public static final CompatSoundEvent BLOCK_WET_SPONGE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_FALL); + public static final CompatSoundEvent BLOCK_WET_SPONGE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_HIT); + public static final CompatSoundEvent BLOCK_WET_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_PLACE); + public static final CompatSoundEvent BLOCK_WET_SPONGE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_STEP); + public static final CompatSoundEvent ENTITY_WIND_CHARGE_WIND_BURST = new CompatSoundEvent(SoundEvents.ENTITY_WIND_CHARGE_WIND_BURST); + public static final CompatSoundEvent ENTITY_WIND_CHARGE_THROW = new CompatSoundEvent(SoundEvents.ENTITY_WIND_CHARGE_THROW); + public static final CompatSoundEvent ENTITY_WITCH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_AMBIENT); + public static final CompatSoundEvent ENTITY_WITCH_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_CELEBRATE); + public static final CompatSoundEvent ENTITY_WITCH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_DEATH); + public static final CompatSoundEvent ENTITY_WITCH_DRINK = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_DRINK); + public static final CompatSoundEvent ENTITY_WITCH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_HURT); + public static final CompatSoundEvent ENTITY_WITCH_THROW = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_THROW); + public static final CompatSoundEvent ENTITY_WITHER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_AMBIENT); + public static final CompatSoundEvent ENTITY_WITHER_BREAK_BLOCK = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_BREAK_BLOCK); + public static final CompatSoundEvent ENTITY_WITHER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_DEATH); + public static final CompatSoundEvent ENTITY_WITHER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_HURT); + public static final CompatSoundEvent ENTITY_WITHER_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SHOOT); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_AMBIENT); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_DEATH); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_HURT); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_STEP); + public static final CompatSoundEvent ENTITY_WITHER_SPAWN = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SPAWN); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_BREAK = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_BREAK); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_CRACK = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_CRACK); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_DAMAGE = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_DAMAGE); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_REPAIR = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_REPAIR); + public static final CompatSoundEvent ENTITY_WOLF_AMBIENT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).ambientSound()); + public static final CompatSoundEvent ENTITY_WOLF_DEATH = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).deathSound()); + public static final CompatSoundEvent ENTITY_WOLF_GROWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).growlSound()); + public static final CompatSoundEvent ENTITY_WOLF_HOWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).ambientSound()); + public static final CompatSoundEvent ENTITY_WOLF_HURT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).hurtSound()); + public static final CompatSoundEvent ENTITY_WOLF_PANT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).pantSound()); + public static final CompatSoundEvent ENTITY_WOLF_SHAKE = new CompatSoundEvent(SoundEvents.ENTITY_WOLF_SHAKE); + public static final CompatSoundEvent ENTITY_WOLF_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WOLF_STEP); + public static final CompatSoundEvent ENTITY_WOLF_WHINE = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).whineSound()); + public static final CompatSoundEvent BLOCK_WOODEN_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_WOODEN_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_BREAK); + public static final CompatSoundEvent BLOCK_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_FALL); + public static final CompatSoundEvent BLOCK_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_HIT); + public static final CompatSoundEvent BLOCK_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_PLACE); + public static final CompatSoundEvent BLOCK_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_STEP); + public static final CompatSoundEvent BLOCK_WOOL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_BREAK); + public static final CompatSoundEvent BLOCK_WOOL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_FALL); + public static final CompatSoundEvent BLOCK_WOOL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_HIT); + public static final CompatSoundEvent BLOCK_WOOL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_PLACE); + public static final CompatSoundEvent BLOCK_WOOL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_STEP); + public static final CompatSoundEvent ENTITY_ZOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_ZOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_ATTACK); + public static final CompatSoundEvent ENTITY_ZOGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_DEATH); + public static final CompatSoundEvent ENTITY_ZOGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_HURT); + public static final CompatSoundEvent ENTITY_ZOGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_STEP); + public static final CompatSoundEvent ENTITY_ZOMBIE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR); + public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_IRON_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_ATTACK_IRON_DOOR); + public static final CompatSoundEvent ENTITY_ZOMBIE_BREAK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR); + public static final CompatSoundEvent ENTITY_ZOMBIE_CONVERTED_TO_DROWNED = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_CONVERTED_TO_DROWNED); + public static final CompatSoundEvent ENTITY_ZOMBIE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIE_DESTROY_EGG = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_DESTROY_EGG); + public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_INFECT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_INFECT); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_STEP); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CONVERTED = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CONVERTED); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CURE = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_STEP); + public static final CompatSoundEvent EVENT_MOB_EFFECT_BAD_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_BAD_OMEN); + public static final CompatSoundEvent EVENT_MOB_EFFECT_TRIAL_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_TRIAL_OMEN); + public static final CompatSoundEvent EVENT_MOB_EFFECT_RAID_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_RAID_OMEN); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_EQUIP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_EQUIP); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_AMBIENT); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_DEATH); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HURT); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_RIDING = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_RIDING); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_UNEQUIP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_UNEQUIP); + + static { + GOAT_HORN_SOUNDS = SoundEvents.GOAT_HORN_SOUNDS.stream().map(CompatSoundEvent::new).collect(ImmutableList.toImmutableList()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java new file mode 100644 index 000000000..c9a68ee56 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.sound; + +import net.minecraft.sound.SoundEvent; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; + +public class RegistryResultCompatSoundEvent extends CompatSoundEvent { + + public RegistryResult result; + + public RegistryResultCompatSoundEvent(RegistryResult result) { + super((SoundEvent) null); + this.result = result; + } + + public static RegistryResultCompatSoundEvent of(RegistryResult result) { + return new RegistryResultCompatSoundEvent(result); + } + + @Override + public SoundEvent get() { + if ((result == null || result.getOrNull() == null) && super.get() != null) + return super.get(); + + return result.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java new file mode 100644 index 000000000..a6b7775be --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.state.property; + +public class BooleanProperty implements IProperty { + + private final net.minecraft.state.property.BooleanProperty property; + + public BooleanProperty(String name) { + this(net.minecraft.state.property.BooleanProperty.of(name)); + } + + public BooleanProperty(net.minecraft.state.property.BooleanProperty property) { + this.property = property; + } + + public static BooleanProperty of(String name) { + return new BooleanProperty(name); + } + + public static BooleanProperty of(net.minecraft.state.property.BooleanProperty property) { + return new BooleanProperty(property); + } + + @Override + public net.minecraft.state.property.BooleanProperty getProperty() { + return property; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java new file mode 100644 index 000000000..92cd6000a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java @@ -0,0 +1,117 @@ +package net.pitan76.mcpitanlib.api.state.property; + +import net.minecraft.block.enums.*; +import net.minecraft.state.property.Properties; +import net.minecraft.state.property.Property; +import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.math.Direction; + +public class CompatProperties { + public static final DirectionProperty FACING = new DirectionProperty(Properties.FACING); + public static final DirectionProperty HORIZONTAL_FACING = new DirectionProperty(Properties.HORIZONTAL_FACING); + public static final DirectionProperty HOPPER_FACING = new DirectionProperty(Properties.HOPPER_FACING); + public static final DirectionProperty VERTICAL_DIRECTION = new DirectionProperty(Properties.VERTICAL_DIRECTION); + + public static final BooleanProperty POWERED = new BooleanProperty(Properties.POWERED); + public static final BooleanProperty ENABLED = new BooleanProperty(Properties.ENABLED); + public static final BooleanProperty WATERLOGGED = new BooleanProperty(Properties.WATERLOGGED); + public static final BooleanProperty LIT = new BooleanProperty(Properties.LIT); + public static final BooleanProperty OCCUPIED = new BooleanProperty(Properties.OCCUPIED); + public static final BooleanProperty ATTACHED = new BooleanProperty(Properties.ATTACHED); + public static final BooleanProperty HANGING = new BooleanProperty(Properties.HANGING); + public static final BooleanProperty BOTTOM = new BooleanProperty(Properties.BOTTOM); + public static final BooleanProperty OPEN = new BooleanProperty(Properties.OPEN); + public static final BooleanProperty UNSTABLE = new BooleanProperty(Properties.UNSTABLE); + public static final BooleanProperty UP = new BooleanProperty(Properties.UP); + public static final BooleanProperty DOWN = new BooleanProperty(Properties.DOWN); + public static final BooleanProperty NORTH = new BooleanProperty(Properties.NORTH); + public static final BooleanProperty EAST = new BooleanProperty(Properties.EAST); + public static final BooleanProperty SOUTH = new BooleanProperty(Properties.SOUTH); + public static final BooleanProperty WEST = new BooleanProperty(Properties.WEST); + + public static final IntProperty POWER = new IntProperty(Properties.POWER); + public static final IntProperty LAYERS = new IntProperty(Properties.LAYERS); + public static final IntProperty NOTE = new IntProperty(Properties.NOTE); + public static final IntProperty ROTATION = new IntProperty(Properties.ROTATION); + public static final IntProperty EGGS = new IntProperty(Properties.EGGS); + public static final IntProperty DELAY = new IntProperty(Properties.DELAY); + + public static final EnumProperty BLOCK_HALF = new EnumProperty<>(Properties.BLOCK_HALF); + public static final EnumProperty STAIR_SHAPE = new EnumProperty<>(Properties.STAIR_SHAPE); + public static final EnumProperty SLAB_TYPE = new EnumProperty<>(Properties.SLAB_TYPE); + public static final EnumProperty CHEST_TYPE = new EnumProperty<>(Properties.CHEST_TYPE); + public static final EnumProperty PISTON_TYPE = new EnumProperty<>(Properties.PISTON_TYPE); + public static final EnumProperty AXIS = new EnumProperty<>(Properties.AXIS); + public static final EnumProperty HORIZONTAL_AXIS = new EnumProperty<>(Properties.HORIZONTAL_AXIS); + public static final EnumProperty COMPARATOR_MODE = new EnumProperty<>(Properties.COMPARATOR_MODE); + + public static IProperty of(Property property) { + if (property instanceof net.minecraft.state.property.IntProperty) { + return of((net.minecraft.state.property.IntProperty) property); + } + if (property instanceof net.minecraft.state.property.BooleanProperty) { + return of((net.minecraft.state.property.BooleanProperty) property); + } + if (property instanceof net.minecraft.state.property.EnumProperty) { + if (property.getType() == Direction.class) { + return ofDir((net.minecraft.state.property.EnumProperty) property); + } + return of((net.minecraft.state.property.EnumProperty) property); + } + return UnknownProperty.of(property); + } + + public static IntProperty of(net.minecraft.state.property.IntProperty property) { + if (property == Properties.POWER) return POWER; + if (property == Properties.LAYERS) return LAYERS; + if (property == Properties.NOTE) return NOTE; + if (property == Properties.ROTATION) return ROTATION; + if (property == Properties.EGGS) return EGGS; + if (property == Properties.DELAY) return DELAY; + + return new IntProperty(property); + } + + public static BooleanProperty of(net.minecraft.state.property.BooleanProperty property) { + if (property == Properties.POWERED) return POWERED; + if (property == Properties.ENABLED) return ENABLED; + if (property == Properties.WATERLOGGED) return WATERLOGGED; + if (property == Properties.LIT) return LIT; + if (property == Properties.OCCUPIED) return OCCUPIED; + if (property == Properties.ATTACHED) return ATTACHED; + if (property == Properties.HANGING) return HANGING; + if (property == Properties.BOTTOM) return BOTTOM; + if (property == Properties.OPEN) return OPEN; + if (property == Properties.UNSTABLE) return UNSTABLE; + if (property == Properties.UP) return UP; + if (property == Properties.DOWN) return DOWN; + if (property == Properties.NORTH) return NORTH; + if (property == Properties.EAST) return EAST; + if (property == Properties.SOUTH) return SOUTH; + if (property == Properties.WEST) return WEST; + + return new BooleanProperty(property); + } + + public static & StringIdentifiable> EnumProperty of(net.minecraft.state.property.EnumProperty property) { + if (property.equals(Properties.BLOCK_HALF)) return (EnumProperty) BLOCK_HALF; + if (property.equals(Properties.STAIR_SHAPE)) return (EnumProperty) STAIR_SHAPE; + if (property.equals(Properties.SLAB_TYPE)) return (EnumProperty) SLAB_TYPE; + if (property.equals(Properties.CHEST_TYPE)) return (EnumProperty) CHEST_TYPE; + if (property.equals(Properties.PISTON_TYPE)) return (EnumProperty) PISTON_TYPE; + if (property.equals(Properties.AXIS)) return (EnumProperty) AXIS; + if (property.equals(Properties.HORIZONTAL_AXIS)) return (EnumProperty) HORIZONTAL_AXIS; + if (property.equals(Properties.COMPARATOR_MODE)) return (EnumProperty) COMPARATOR_MODE; + + return new EnumProperty<>(property); + } + + public static DirectionProperty ofDir(net.minecraft.state.property.EnumProperty property) { + if (property == Properties.FACING) return FACING; + if (property == Properties.HORIZONTAL_FACING) return HORIZONTAL_FACING; + if (property == Properties.HOPPER_FACING) return HOPPER_FACING; + if (property == Properties.VERTICAL_DIRECTION) return VERTICAL_DIRECTION; + + return new DirectionProperty(property); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java new file mode 100644 index 000000000..f1bd61a7b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.state.property; + +import net.minecraft.state.property.EnumProperty; +import net.minecraft.state.property.Property; +import net.minecraft.util.math.Direction; +import net.pitan76.mcpitanlib.midohra.block.BlockState; + +import java.util.function.Predicate; + +public class DirectionProperty implements IProperty { + + private final EnumProperty property; + + public DirectionProperty(String name, Predicate filter) { + this(EnumProperty.of(name, Direction.class, filter)); + } + + public DirectionProperty(String name) { + this(name, direction -> true); + } + + public DirectionProperty(EnumProperty property) { + this.property = property; + } + + public static DirectionProperty of(String name) { + return new DirectionProperty(name); + } + + public static DirectionProperty of(String name, Predicate filter) { + return new DirectionProperty(name, filter); + } + + public net.pitan76.mcpitanlib.midohra.util.math.Direction getAsMidohra(BlockState state) { + return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(get(state.toMinecraft())); + } + + public BlockState with(BlockState state, net.pitan76.mcpitanlib.midohra.util.math.Direction value) { + return BlockState.of(with(state.toMinecraft(), value.toMinecraft())); + } + + public BlockState cycle(BlockState state) { + return BlockState.of(cycle(state.toMinecraft())); + } + + @Override + public Property getProperty() { + return property; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java new file mode 100644 index 000000000..7e7e9522b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.api.state.property; + +import net.minecraft.util.StringIdentifiable; + +import java.util.function.Predicate; + +public class EnumProperty & StringIdentifiable> implements IProperty { + + private final net.minecraft.state.property.EnumProperty property; + + public EnumProperty(String name, Class type) { + this(net.minecraft.state.property.EnumProperty.of(name, type)); + } + + public EnumProperty(String name, Class type, Predicate filter) { + this(net.minecraft.state.property.EnumProperty.of(name, type, filter)); + } + + public EnumProperty(net.minecraft.state.property.EnumProperty property) { + this.property = property; + } + + public static & StringIdentifiable> EnumProperty of(String name, Class type) { + return new EnumProperty<>(name, type); + } + + public static & StringIdentifiable> EnumProperty of(String name, Class type, Predicate filter) { + return new EnumProperty<>(name, type, filter); + } + + + public static & StringIdentifiable> EnumProperty of(net.minecraft.state.property.EnumProperty property) { + return new EnumProperty<>(property); + } + + @Override + public net.minecraft.state.property.EnumProperty getProperty() { + return property; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java new file mode 100644 index 000000000..2274a41e3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java @@ -0,0 +1,49 @@ +package net.pitan76.mcpitanlib.api.state.property; + +import net.minecraft.block.BlockState; +import net.minecraft.state.property.Property; +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; + +public interface IProperty> { + default void apply(AppendPropertiesArgs args) { + args.addProperty(getProperty()); + } + + default T get(BlockState state) { + return state.get(getProperty()); + } + + default BlockState with(BlockState state, T value) { + return state.with(getProperty(), value); + } + + default boolean contains(BlockState state) { + return state.contains(getProperty()); + } + + default BlockState cycle(BlockState state) { + return state.cycle(getProperty()); + } + + default String getName() { + return getProperty().getName(); + } + + Property getProperty(); + + default net.pitan76.mcpitanlib.midohra.block.BlockState with(net.pitan76.mcpitanlib.midohra.block.BlockState state, T value) { + return state.with(getProperty(), value); + } + + default T get(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return state.get(getProperty()); + } + + default boolean contains(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return state.contains(getProperty()); + } + + default net.pitan76.mcpitanlib.midohra.block.BlockState cycle(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return state.cycle(getProperty()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java new file mode 100644 index 000000000..850604d9f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.state.property; + +public class IntProperty implements IProperty { + + private final net.minecraft.state.property.IntProperty property; + + public IntProperty(String name, int min, int max) { + this(net.minecraft.state.property.IntProperty.of(name, min, max)); + } + + public IntProperty(String name) { + this(name, 0, 15); + } + + public IntProperty(net.minecraft.state.property.IntProperty property) { + this.property = property; + } + + public static IntProperty of(String name) { + return new IntProperty(name); + } + + public static IntProperty of(String name, int min, int max) { + return new IntProperty(name, min, max); + } + + public static IntProperty of(net.minecraft.state.property.IntProperty property) { + return new IntProperty(property); + } + + @Override + public net.minecraft.state.property.IntProperty getProperty() { + return property; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java new file mode 100644 index 000000000..e59d0cad5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.state.property; + +import net.minecraft.state.property.Property; + +public class UnknownProperty implements IProperty { + + private final net.minecraft.state.property.Property property; + + public UnknownProperty(net.minecraft.state.property.Property property) { + this.property = property; + } + + public static UnknownProperty of(net.minecraft.state.property.Property property) { + return new UnknownProperty(property); + } + + @Override + public Property getProperty() { + return property; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java new file mode 100644 index 000000000..85aeaacf9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java @@ -0,0 +1,11 @@ +package net.pitan76.mcpitanlib.api.tag; + +public enum MineableToolTags { + NONE, + //SWORD, + AXE, + PICKAXE, + SHOVEL, + HOE, + //SHEARS +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java new file mode 100644 index 000000000..55fa28254 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.api.tag; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityType; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.Item; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.*; + +public class TagKey { + private final net.minecraft.registry.tag.TagKey tagKey; + + @Deprecated + public TagKey(net.minecraft.registry.tag.TagKey tagKey) { + this.tagKey = tagKey; + } + + public static TagKey create(Type type, Identifier identifier) { + return switch (type) { + case BLOCK -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.BLOCK, identifier)); + case ITEM -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.ITEM, identifier)); + case FLUID -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.FLUID, identifier)); + case ENTITY_TYPE -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.ENTITY_TYPE, identifier)); + }; + } + + public static TagKey create(Type type, CompatIdentifier id) { + return create(type, id.toMinecraft()); + } + + @Deprecated + public net.minecraft.registry.tag.TagKey getTagKey() { + return tagKey; + } + + public enum Type { + BLOCK, + ITEM, + FLUID, + ENTITY_TYPE, + } + + public boolean isOf(T value) { + if (value instanceof Item) + return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.ITEM, ItemUtil.toID((Item) value)); + if (value instanceof Block) + return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.BLOCK, BlockUtil.toID((Block) value)); + if (value instanceof Fluid) + return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.FLUID, FluidUtil.toID((Fluid) value)); + if (value instanceof EntityType) + return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.ENTITY_TYPE, EntityTypeUtil.toID((EntityType) value)); + + return RegistryEntry.of(value).isIn(getTagKey()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java new file mode 100644 index 000000000..ed91ce35e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java @@ -0,0 +1,64 @@ +package net.pitan76.mcpitanlib.api.tag.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IngredientUtil; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; + +public class RepairIngredientTag { + + public static final RepairIngredientTag REPAIRS_LEATHER_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_LEATHER_ARMOR); + public static final RepairIngredientTag REPAIRS_CHAIN_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_CHAIN_ARMOR); + public static final RepairIngredientTag REPAIRS_IRON_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_IRON_ARMOR); + public static final RepairIngredientTag REPAIRS_GOLD_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_GOLD_ARMOR); + public static final RepairIngredientTag REPAIRS_DIAMOND_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_DIAMOND_ARMOR); + public static final RepairIngredientTag REPAIRS_NETHERITE_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_NETHERITE_ARMOR); + public static final RepairIngredientTag REPAIRS_TURTLE_HELMET = new RepairIngredientTag(ItemTags.REPAIRS_TURTLE_HELMET); + public static final RepairIngredientTag REPAIRS_WOLF_ARMOR = new RepairIngredientTag(ItemTags.REPAIRS_WOLF_ARMOR); + public static final RepairIngredientTag WOODEN_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.WOODEN_TOOL_MATERIALS); + public static final RepairIngredientTag STONE_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.STONE_TOOL_MATERIALS); + public static final RepairIngredientTag IRON_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.IRON_TOOL_MATERIALS); + public static final RepairIngredientTag GOLDEN_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.GOLD_TOOL_MATERIALS); + public static final RepairIngredientTag DIAMOND_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.DIAMOND_TOOL_MATERIALS); + public static final RepairIngredientTag NETHERITE_TOOL_MATERIALS = new RepairIngredientTag(ItemTags.NETHERITE_TOOL_MATERIALS); + + private TagKey tag; + + public RepairIngredientTag(CompatIdentifier identifier) { + this.tag = TagKey.of(RegistryKeys.ITEM, identifier.toMinecraft()); + } + + @Deprecated + public RepairIngredientTag(TagKey tag) { + this.tag = tag; + } + + @Deprecated + public TagKey getTag() { + return tag; + } + + @Deprecated + public Ingredient getIngredient() { + return IngredientUtil.fromTagByIdentifier(tag.id()); + } + + public boolean contains(Item item) { + if (item == null || tag == null) + return false; + + return ItemUtil.isInTag(item, CompatIdentifier.fromMinecraft(tag.id())); + } + + public boolean contains(ItemStack stack) { + if (stack.isEmpty() || tag == null) + return false; + + return getIngredient().test(stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java new file mode 100644 index 000000000..63f4df308 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.api.tag.v2; + +import net.minecraft.registry.entry.RegistryEntry; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatTagKey extends TagKey { + @Deprecated + public CompatTagKey(net.minecraft.registry.tag.TagKey tagKey) { + super(tagKey); + } + + @Deprecated + public static CompatTagKey of(net.minecraft.registry.tag.TagKey tagKey) { + return new CompatTagKey<>(tagKey); + } + + public static CompatTagKey of(CompatTagKeyType type, CompatIdentifier identifier) { + return of(net.minecraft.registry.tag.TagKey.of(type.getRegistryKey(), identifier.toMinecraft())); + } + + public boolean isOf(T value) { + return RegistryEntry.of(value).isIn(getTagKey()); + } + + public CompatIdentifier getId() { + return CompatIdentifier.fromMinecraft(getTagKey().id()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java new file mode 100644 index 000000000..2a0dabc61 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.tag.v2; + +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.entity.EntityType; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.Item; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatTagKeyType { + public static final CompatTagKeyType BLOCK = of(RegistryKeys.BLOCK); + public static final CompatTagKeyType ITEM = new CompatTagKeyType<>(RegistryKeys.ITEM); + public static final CompatTagKeyType FLUID = new CompatTagKeyType<>(RegistryKeys.FLUID); + public static final CompatTagKeyType> ENTITY_TYPE = new CompatTagKeyType<>(RegistryKeys.ENTITY_TYPE); + public static final CompatTagKeyType> BLOCK_ENTITY_TYPE = new CompatTagKeyType<>(RegistryKeys.BLOCK_ENTITY_TYPE); + public static final CompatTagKeyType> SCREEN_HANDLER = new CompatTagKeyType<>(RegistryKeys.SCREEN_HANDLER); + + public final CompatIdentifier id; + + protected CompatTagKeyType(CompatIdentifier id) { + this.id = id; + } + + public static CompatTagKeyType of(CompatIdentifier id) { + return new CompatTagKeyType<>(id); + } + + // RegistryKey + private RegistryKey> key; + + protected CompatTagKeyType(RegistryKey> key) { + this.id = CompatIdentifier.fromMinecraft(key.getRegistry()); + this.key = key; + } + + public static CompatTagKeyType of(RegistryKey> key) { + return new CompatTagKeyType<>(key); + } + + @Deprecated + public RegistryKey> getRegistryKey() { + return key; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java new file mode 100644 index 000000000..382e101b8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.tag.v2.typed; + +import net.minecraft.block.Block; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.block.BlockUtil; + +import java.util.List; + +public class BlockTagKey extends CompatTagKey { + @Deprecated + public BlockTagKey(TagKey tagKey) { + super(tagKey); + } + + public static BlockTagKey of(CompatIdentifier identifier) { + return new BlockTagKey(TagKey.of(CompatTagKeyType.BLOCK.getRegistryKey(), identifier.toMinecraft())); + } + + public List values() { + return BlockUtil.getInTag(this); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java new file mode 100644 index 000000000..61d57fee9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java @@ -0,0 +1,20 @@ +package net.pitan76.mcpitanlib.api.tag.v2.typed; + +import net.minecraft.entity.EntityType; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +import java.util.List; + +public class EntityTagKey extends CompatTagKey> { + @Deprecated + public EntityTagKey(TagKey> tagKey) { + super(tagKey); + } + + public static EntityTagKey of(CompatIdentifier identifier) { + return new EntityTagKey(TagKey.of(CompatTagKeyType.ENTITY_TYPE.getRegistryKey(), identifier.toMinecraft())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java new file mode 100644 index 000000000..03cdeb507 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java @@ -0,0 +1,18 @@ +package net.pitan76.mcpitanlib.api.tag.v2.typed; + +import net.minecraft.fluid.Fluid; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class FluidTagKey extends CompatTagKey { + @Deprecated + public FluidTagKey(TagKey tagKey) { + super(tagKey); + } + + public static FluidTagKey of(CompatIdentifier identifier) { + return new FluidTagKey(TagKey.of(CompatTagKeyType.FLUID.getRegistryKey(), identifier.toMinecraft())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java new file mode 100644 index 000000000..cce0a7cb2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.api.tag.v2.typed; + +import net.minecraft.item.Item; +import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IngredientUtil; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; + +import java.util.List; + +public class ItemTagKey extends CompatTagKey { + @Deprecated + public ItemTagKey(TagKey tagKey) { + super(tagKey); + } + + public static ItemTagKey of(CompatIdentifier identifier) { + return new ItemTagKey(net.minecraft.registry.tag.TagKey.of(CompatTagKeyType.ITEM.getRegistryKey(), identifier.toMinecraft())); + } + + public Ingredient asIngredient() { + return IngredientUtil.fromTagByIdentifier(getTagKey().id()); + } + + public List values() { + return ItemUtil.getInTag(this); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java new file mode 100644 index 000000000..1de5acf72 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java @@ -0,0 +1,86 @@ +package net.pitan76.mcpitanlib.api.text; + +import net.minecraft.util.Formatting; +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class CompatFormatting implements CompatStringIdentifiable { + private final Formatting formatting; + + public static final CompatFormatting BLACK = of(Formatting.BLACK); + public static final CompatFormatting DARK_BLUE = of(Formatting.DARK_BLUE); + public static final CompatFormatting DARK_GREEN = of(Formatting.DARK_GREEN); + public static final CompatFormatting DARK_AQUA = of(Formatting.DARK_AQUA); + public static final CompatFormatting DARK_RED = of(Formatting.DARK_RED); + public static final CompatFormatting DARK_PURPLE = of(Formatting.DARK_PURPLE); + public static final CompatFormatting GOLD = of(Formatting.GOLD); + public static final CompatFormatting GRAY = of(Formatting.GRAY); + public static final CompatFormatting DARK_GRAY = of(Formatting.DARK_GRAY); + public static final CompatFormatting BLUE = of(Formatting.BLUE); + public static final CompatFormatting GREEN = of(Formatting.GREEN); + public static final CompatFormatting AQUA = of(Formatting.AQUA); + public static final CompatFormatting RED = of(Formatting.RED); + public static final CompatFormatting LIGHT_PURPLE = of(Formatting.LIGHT_PURPLE); + public static final CompatFormatting YELLOW = of(Formatting.YELLOW); + public static final CompatFormatting WHITE = of(Formatting.WHITE); + public static final CompatFormatting OBFUSCATED = of(Formatting.OBFUSCATED); + public static final CompatFormatting BOLD = of(Formatting.BOLD); + public static final CompatFormatting STRIKETHROUGH = of(Formatting.STRIKETHROUGH); + public static final CompatFormatting UNDERLINE = of(Formatting.UNDERLINE); + public static final CompatFormatting ITALIC = of(Formatting.ITALIC); + public static final CompatFormatting RESET = of(Formatting.RESET); + + public CompatFormatting(Formatting formatting) { + this.formatting = formatting; + } + + public static CompatFormatting of(Formatting formatting) { + return new CompatFormatting(formatting); + } + + public Formatting getRaw() { + return formatting; + } + + @Override + public String asString_compat() { + return formatting.asString(); + } + + public boolean isColor() { + return formatting.isColor(); + } + + public boolean isModifier() { + return formatting.isModifier(); + } + + public char getCode() { + return formatting.getCode(); + } + + public Integer getColorValue() { + return formatting.getColorValue(); + } + + public int getColorIndex() { + return formatting.getColorIndex(); + } + + @Override + public String toString() { + return formatting.toString(); + } + + @Override + public int hashCode() { + return formatting.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatFormatting other = (CompatFormatting) obj; + return formatting.equals(other.formatting); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java new file mode 100644 index 000000000..43b9aee73 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java @@ -0,0 +1,105 @@ +package net.pitan76.mcpitanlib.api.text; + +import net.minecraft.text.Style; + +public class CompatStyle { + private final Style style; + + public CompatStyle(Style style) { + this.style = style; + } + + public CompatStyle() { + this(Style.EMPTY); + } + + public static CompatStyle of(Style style) { + return new CompatStyle(style); + } + + public static CompatStyle of() { + return new CompatStyle(); + } + + public CompatStyle withColor(CompatTextColor color) { + return new CompatStyle(style.withColor(color.getRaw())); + } + + public CompatStyle withColor(CompatFormatting formatting) { + return new CompatStyle(style.withColor(formatting.getRaw())); + } + + public CompatStyle withColor(int rgbColor) { + return new CompatStyle(style.withColor(rgbColor)); + } + + public CompatStyle withBold(boolean bold) { + return new CompatStyle(style.withBold(bold)); + } + + public CompatStyle withItalic(boolean italic) { + return new CompatStyle(style.withItalic(italic)); + } + + public CompatStyle withUnderline(boolean underline) { + return new CompatStyle(style.withUnderline(underline)); + } + + public CompatStyle withStrikethrough(boolean strikethrough) { + return new CompatStyle(style.withStrikethrough(strikethrough)); + } + + public CompatStyle withObfuscated(boolean obfuscated) { + return new CompatStyle(style.withObfuscated(obfuscated)); + } + + public CompatTextColor getColor() { + if (style.getColor() == null) return null; + return new CompatTextColor(style.getColor()); + } + + public boolean isBold() { + return style.isBold(); + } + + public boolean isItalic() { + return style.isItalic(); + } + + public boolean isUnderlined() { + return style.isUnderlined(); + } + + public boolean isStrikethrough() { + return style.isStrikethrough(); + } + + public boolean isObfuscated() { + return style.isObfuscated(); + } + + public boolean isEmpty() { + return style.isEmpty(); + } + + public CompatStyle withFormatting(CompatFormatting formatting) { + return withColor(formatting); + } + + public Style getRaw() { + return style; + } + + @Override + public int hashCode() { + return style.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatStyle that = (CompatStyle) obj; + return style.equals(that.style); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java new file mode 100644 index 000000000..306034382 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java @@ -0,0 +1,79 @@ +package net.pitan76.mcpitanlib.api.text; + +import net.minecraft.text.TextColor; +import net.minecraft.util.Formatting; + +public class CompatTextColor { + private final TextColor textColor; + + public static final CompatTextColor BLACK = of(TextColor.fromFormatting(Formatting.BLACK)); + public static final CompatTextColor DARK_BLUE = of(TextColor.fromFormatting(Formatting.DARK_BLUE)); + public static final CompatTextColor DARK_GREEN = of(TextColor.fromFormatting(Formatting.DARK_GREEN)); + public static final CompatTextColor DARK_AQUA = of(TextColor.fromFormatting(Formatting.DARK_AQUA)); + public static final CompatTextColor DARK_RED = of(TextColor.fromFormatting(Formatting.DARK_RED)); + public static final CompatTextColor DARK_PURPLE = of(TextColor.fromFormatting(Formatting.DARK_PURPLE)); + public static final CompatTextColor GOLD = of(TextColor.fromFormatting(Formatting.GOLD)); + public static final CompatTextColor GRAY = of(TextColor.fromFormatting(Formatting.GRAY)); + public static final CompatTextColor DARK_GRAY = of(TextColor.fromFormatting(Formatting.DARK_GRAY)); + public static final CompatTextColor BLUE = of(TextColor.fromFormatting(Formatting.BLUE)); + public static final CompatTextColor GREEN = of(TextColor.fromFormatting(Formatting.GREEN)); + public static final CompatTextColor AQUA = of(TextColor.fromFormatting(Formatting.AQUA)); + public static final CompatTextColor RED = of(TextColor.fromFormatting(Formatting.RED)); + public static final CompatTextColor LIGHT_PURPLE = of(TextColor.fromFormatting(Formatting.LIGHT_PURPLE)); + public static final CompatTextColor YELLOW = of(TextColor.fromFormatting(Formatting.YELLOW)); + public static final CompatTextColor WHITE = of(TextColor.fromFormatting(Formatting.WHITE)); + + public CompatTextColor(TextColor textColor) { + this.textColor = textColor; + } + + public TextColor getRaw() { + return textColor; + } + + public static CompatTextColor of(TextColor textColor) { + return new CompatTextColor(textColor); + } + + public static CompatTextColor fromFormatting(Formatting formatting) { + return new CompatTextColor(TextColor.fromFormatting(formatting)); + } + + public static CompatTextColor fromFormatting(CompatFormatting formatting) { + return fromFormatting(formatting.getRaw()); + } + + public static CompatTextColor fromRgb(int rgb) { + return new CompatTextColor(TextColor.fromRgb(rgb)); + } + + public static CompatTextColor fromRgb(int r, int g, int b) { + int rgb = (r << 16) | (g << 8) | b; + return fromRgb(rgb); + } + + public static CompatTextColor parse(String string) { + try { + return parseOrThrow(string); + } catch (Exception e) { + return null; + } + } + + public static CompatTextColor parseOrThrow(String string) { + return new CompatTextColor(TextColor.parse(string).getOrThrow()); + } + + @Override + public int hashCode() { + return textColor.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatTextColor other = (CompatTextColor) obj; + return textColor.equals(other.textColor); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java new file mode 100644 index 000000000..08ee2e869 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java @@ -0,0 +1,130 @@ +package net.pitan76.mcpitanlib.api.text; + +import net.minecraft.text.MutableText; +import net.minecraft.text.Style; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import org.jetbrains.annotations.Nullable; + +public class TextComponent { + + private Text text; + + public TextComponent() { + this(TextUtil.empty()); + } + + public TextComponent(Text text) { + this.text = text; + } + + public TextComponent(String string) { + this(TextUtil.literal(string)); + } + + public Text getText() { + return text; + } + + public void setText(Text text) { + this.text = text; + } + + public MutableText asMutableText() { + return (MutableText) text; + } + + public VariableTextComponent asVariableTextComponent() { + return new VariableTextComponent(this); + } + + @Nullable + public MutableText asMutableTextOrNull() { + if (text instanceof MutableText) { + return asMutableText(); + } + return null; + } + + public static TextComponent literal(String string) { + return new TextComponent(string); + } + + public static TextComponent of(String string) { + return TextComponent.literal(string); + } + + public static TextComponent translatable(String key) { + return new TextComponent(TextUtil.translatable(key)); + } + + public static TextComponent translatable(String key, Object... args) { + return new TextComponent(TextUtil.translatable(key, args)); + } + + public static TextComponent empty() { + return new TextComponent(TextUtil.empty()); + } + + public static TextComponent format(String format, Object... args) { + return literal(String.format(format, args)); + } + + @Override + public String toString() { + return getString(); + } + + public String getString() { + return TextUtil.txt2str(getText()); + } + + public String superToString() { + return super.toString(); + } + + public TextComponent copy() { + return new TextComponent(getText()); + } + + public Style getStyle() { + return text.getStyle(); + } + + public TextComponent setStyle(Style style) { + if (text instanceof MutableText) + TextUtil.setStyle((MutableText) text, style); + + return this; + } + + public TextComponent setStyle(CompatStyle style) { + return setStyle(style.getRaw()); + } + + public CompatStyle getCompatStyle() { + return CompatStyle.of(getStyle()); + } + + public boolean contains(TextComponent other) { + return TextUtil.contains(getText(), other.getText()); + } + + /** + * Convert string to TextComponent with formatting + * @param text String + * @return TextComponent + */ + public static TextComponent convert(String text) { + return new TextComponent(TextUtil.convert(text)); + } + + /** + * Convert string to TextComponent with translatable + * @param text String + * @return TextComponent + */ + public static TextComponent convertWithTranslatable(String text) { + return new TextComponent(TextUtil.convertWithTranslatable(text)); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java b/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java new file mode 100644 index 000000000..85836c4f8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java @@ -0,0 +1,102 @@ +package net.pitan76.mcpitanlib.api.text; + +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TextConverter { + + public static MutableText convert(String string) { + return convert(string, false); + } + + /** + * Convert string to MutableText with formatting + * + * @param text String + * @param translatable boolean + * @return MutableText + */ + public static MutableText convert(String text, boolean translatable) { + String[] splits = split(text); + MutableText result = Text.literal(""); + Formatting[] currentFormatting = {}; + + for (String part : splits) { + // Section + if (part.startsWith("§") && part.length() == 2) { + char code = part.charAt(1); + // Reset + if (code == 'r') { + currentFormatting = new Formatting[]{}; + continue; + } + + Formatting format = Formatting.byCode(code); + if (format == null) + continue; + + // Bold, Italic, Underline, Strikethrough, Obfuscated + if (code >= 'k' && code <= 'o') { + ArrayList list = new ArrayList<>(Arrays.asList(currentFormatting)); + list.add(format); + currentFormatting = list.toArray(new Formatting[0]); + continue; + } + + // Color + currentFormatting = new Formatting[]{format}; + continue; + } + + // Translatable + if (translatable) { + Pattern pattern = Pattern.compile("\\{(.+?)\\}"); + Matcher matcher = pattern.matcher(part); + MutableText tempText = Text.literal(""); + int lastIndex = 0; + + while (matcher.find()) { + // {translatable key} より前の文字列を追加 + if (matcher.start() > lastIndex) { + tempText.append(Text.literal(part.substring(lastIndex, matcher.start())).formatted(currentFormatting)); + } + + // {translatable key} を追加 + String key = matcher.group(1); + tempText.append(Text.translatable(key).formatted(currentFormatting)); + + lastIndex = matcher.end(); + } + + // 最後の文字列を追加 + if (lastIndex < part.length()) { + tempText.append(Text.literal(part.substring(lastIndex)).formatted(currentFormatting)); + } + + result.append(tempText); + continue; + } + + result.append(Text.literal(part).formatted(currentFormatting)); + } + + return result; + } + + public static String[] split(String text) { + Matcher matcher = Pattern.compile("(?i)§[0-9a-fk-or]|[^§]+").matcher(text); + List parts = new ArrayList<>(); + + while (matcher.find()) + parts.add(matcher.group()); + + return parts.toArray(new String[0]); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java new file mode 100644 index 000000000..b231f4071 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.text; + +import net.pitan76.mcpitanlib.api.util.TextUtil; + +// 可変TextComponent +public class VariableTextComponent extends TextComponent { + + public VariableTextComponent(TextComponent textComponent) { + setText(textComponent.getText()); + } + + public void append(String string) { + setText(TextUtil.literal(getString() + string)); + } + + public void addLine(String string) { + setText(TextUtil.literal(getString() + "\n" + string)); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java new file mode 100644 index 000000000..d1b4b982f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java @@ -0,0 +1,66 @@ +package net.pitan76.mcpitanlib.api.tile; + +import com.mojang.datafixers.types.Type; +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class BlockEntityTypeBuilder { + private final Factory factory; + private final List blocks; + + public BlockEntityTypeBuilder(Factory factory, List blocks) { + this.factory = factory; + this.blocks = blocks; + } + + public static BlockEntityTypeBuilder create(Factory factory, Block... blocks) { + List blocksList = new ArrayList<>(blocks.length); + Collections.addAll(blocksList, blocks); + + return new BlockEntityTypeBuilder<>(factory, blocksList); + } + + public BlockEntityTypeBuilder addBlock(Block block) { + this.blocks.add(block); + return this; + } + + public BlockEntityTypeBuilder addBlocks(Block... blocks) { + Collections.addAll(this.blocks, blocks); + return this; + } + + + public BlockEntityType build() { + return build(null); + } + + public BlockEntityType build(Type type) { + return build(type, factory, blocks.toArray(new Block[0])); + } + + @Deprecated + public static BlockEntityType build(Type type, BlockEntityTypeBuilder.Factory factory, Block... blocks) { + FabricBlockEntityTypeBuilder builder = FabricBlockEntityTypeBuilder.create(factory::create, blocks); + return builder.build(type); + } + + @FunctionalInterface + public interface Factory { + T create(TileCreateEvent event); + + @Deprecated + default T create(BlockPos pos, BlockState state) { + return create(new TileCreateEvent(pos, state)); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java new file mode 100644 index 000000000..9e89cd1eb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java @@ -0,0 +1,198 @@ +package net.pitan76.mcpitanlib.api.tile; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; +import net.minecraft.registry.RegistryWrapper; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.storage.ReadView; +import net.minecraft.storage.WriteView; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.packet.UpdatePacketType; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; +import net.pitan76.mcpitanlib.api.util.NbtUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import org.jetbrains.annotations.Nullable; + +public class CompatBlockEntity extends BlockEntity { + public CompatBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + public CompatBlockEntity(BlockEntityType type, TileCreateEvent event) { + this(type, event.getBlockPos(), event.getBlockState()); + } + + @Nullable + @Override + @Deprecated + public Packet toUpdatePacket() { + switch (getUpdatePacketType().name) { + case "BLOCK_ENTITY_UPDATE_S2C": + return BlockEntityUpdateS2CPacket.create(this); + } + return super.toUpdatePacket(); + } + + public UpdatePacketType getUpdatePacketType() { + return UpdatePacketType.NONE; + } + + public void writeNbt(WriteNbtArgs args) { + + } + + public void readNbt(ReadNbtArgs args) { + + } + + public NbtCompound toInitialChunkDataNbt(CompatRegistryLookup registryLookup) { + return super.toInitialChunkDataNbt(registryLookup.getRegistryLookup()); + } + + @Deprecated + @Override + public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries) { + return toInitialChunkDataNbt(new CompatRegistryLookup(registries)); + } + + // deprecated + + /** + * @deprecated Use {@link #writeNbt(WriteNbtArgs)} instead + */ + @Deprecated + public void writeNbtOverride(NbtCompound nbt) { + //super.writeNbt(nbt, wrapperLookupCache); + } + + /** + * @deprecated Use {@link #readNbt(ReadNbtArgs)} instead + */ + @Deprecated + public void readNbtOverride(NbtCompound nbt) { + //super.readNbt(nbt, wrapperLookupCache); + } + + @Deprecated + private RegistryWrapper.WrapperLookup wrapperLookupCache; + + // ---- + + + @Override + protected void writeData(WriteView view) { + super.writeData(view); + NbtCompound nbt = NbtUtil.create(); + writeNbt(nbt, this.callGetWorld().getRegistryManager()); + writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.callGetWorld().getRegistryManager()))); + NbtDataConverter.nbt2writeData(nbt, view); + } + + @Override + protected void readData(ReadView view) { + super.readData(view); + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readNbt(nbt, view.getRegistries()); + readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.getRegistries()))); + } + + @Deprecated + public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + // deprecated + wrapperLookupCache = registryLookup; + writeNbtOverride(nbt); + // ---- + } + + @Deprecated + public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + // deprecated + wrapperLookupCache = registryLookup; + readNbtOverride(nbt); + // ---- + } + + public boolean isClient() { + if (getWorld() == null) + return false; + + return WorldUtil.isClient(getWorld()); + } + + @Deprecated + @Override + public @Nullable World getWorld() { + return callGetWorld(); + } + + @Deprecated + @Override + public BlockPos getPos() { + return callGetPos(); + } + + public World callGetWorld() { + return super.getWorld(); + } + + public BlockPos callGetPos() { + return super.getPos(); + } + + public BlockState callGetBlockState() { + return BlockEntityUtil.getBlockState(this); + } + + public BlockState callGetCachedState() { + return BlockEntityUtil.getCachedState(this); + } + + public boolean hasServerWorld() { + return callGetWorld() instanceof ServerWorld; + } + + public ServerWorld getServerWorld() { + return BlockEntityUtil.getServerWorld(this); + } + + public void callMarkDirty() { + BlockEntityUtil.markDirty(this); + } + + @Deprecated + @Override + public void markRemoved() { + markRemovedOverride(); + } + + public void markRemovedOverride() { + super.markRemoved(); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(callGetWorld()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(callGetPos()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(callGetBlockState()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraCachedState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(callGetCachedState()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java new file mode 100644 index 000000000..8b4b3d914 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java @@ -0,0 +1,111 @@ +package net.pitan76.mcpitanlib.api.tile; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.block.entity.ChestBlockEntity; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; +import net.minecraft.registry.RegistryWrapper; +import net.minecraft.storage.ReadView; +import net.minecraft.storage.WriteView; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.packet.UpdatePacketType; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.NbtUtil; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import org.jetbrains.annotations.Nullable; + +public class CompatChestBlockEntity extends ChestBlockEntity { + protected CompatChestBlockEntity(BlockEntityType blockEntityType, BlockPos blockPos, BlockState blockState) { + super(blockEntityType, blockPos, blockState); + } + + public CompatChestBlockEntity(BlockEntityType type, TileCreateEvent event) { + this(type, event.getBlockPos(), event.getBlockState()); + } + + @Nullable + @Override + @Deprecated + public Packet toUpdatePacket() { + switch (getUpdatePacketType().name) { + case "BLOCK_ENTITY_UPDATE_S2C": + return BlockEntityUpdateS2CPacket.create(this); + } + return super.toUpdatePacket(); + } + + public UpdatePacketType getUpdatePacketType() { + return UpdatePacketType.NONE; + } + + public void writeNbt(WriteNbtArgs args) { + + } + + public void readNbt(ReadNbtArgs args) { + + } + + + // deprecated + + /** + * @deprecated Use {@link #writeNbt(WriteNbtArgs)} instead + */ + @Deprecated + public void writeNbtOverride(NbtCompound nbt) { + + } + + /** + * @deprecated Use {@link #readNbt(ReadNbtArgs)} instead + */ + @Deprecated + public void readNbtOverride(NbtCompound nbt) { + + } + + @Deprecated + private RegistryWrapper.WrapperLookup wrapperLookupCache; + + // ---- + + @Override + protected void writeData(WriteView view) { + super.writeData(view); + NbtCompound nbt = NbtUtil.create(); + writeNbt(nbt, this.getWorld().getRegistryManager()); + writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.getWorld().getRegistryManager()))); + NbtDataConverter.nbt2writeData(nbt, view); + } + + @Override + protected void readData(ReadView view) { + super.readData(view); + NbtCompound nbt = NbtDataConverter.data2nbt(view); + readNbt(nbt, view.getRegistries()); + readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.getRegistries()))); + } + + @Deprecated + public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + // deprecated + wrapperLookupCache = registryLookup; + writeNbtOverride(nbt); + // ---- + } + + @Deprecated + public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + // deprecated + wrapperLookupCache = registryLookup; + readNbtOverride(nbt); + // ---- + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java new file mode 100644 index 000000000..01ea4f2e2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.tile; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.world.ExtendWorld; + +public class ExtendBlockEntity extends CompatBlockEntity { + public ExtendWorld world; + + public ExtendBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + public ExtendBlockEntity(BlockEntityType type, TileCreateEvent event) { + this(type, event.getBlockPos(), event.getBlockState()); + } + + @Override + public void setWorld(World world) { + super.setWorld(world); + this.world = new ExtendWorld(world); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java new file mode 100644 index 000000000..8bce6ee96 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.api.tile; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityTicker; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.tile.TileTickEvent; + +public interface ExtendBlockEntityTicker extends BlockEntityTicker { + @Override + default void tick(World world, BlockPos pos, BlockState state, T blockEntity) { + tick(new TileTickEvent<>(world, pos, state, blockEntity)); + } + + void tick(TileTickEvent event); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java new file mode 100644 index 000000000..991878670 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.tile; + +import org.jetbrains.annotations.Nullable; + +@Deprecated +public interface RenderDataBlockEntity extends RenderDataBlockEntity { + + @Nullable + Object getCompatRenderData(); + + default boolean hasCompatRenderData() { + return getCompatRenderData() != null; + } + + default Object getRenderData() { + if (this instanceof net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) { + return ((net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) this).getCompatRenderData(); + } + return null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java new file mode 100644 index 000000000..af90ff0c0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.api.tile.v2; + +import com.mojang.datafixers.types.Type; +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; +import java.util.function.Supplier; + +public class BlockEntityTypeBuilder extends net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder { + private final Factory factory; + private final Consumer> consumer; + + public BlockEntityTypeBuilder(Factory factory, Consumer> blocks) { + super(null, null); + + this.factory = factory; + this.consumer = blocks; + } + + @Deprecated + public static BlockEntityTypeBuilder create(Factory factory, Block... blocks) { + throw new IllegalStateException("Use create(Factory, Consumer>) instead"); + } + + public static BlockEntityTypeBuilder create(BlockEntityTypeBuilder.Factory factory, Consumer> blocks) { + return new BlockEntityTypeBuilder<>(factory, blocks); + } + + public static BlockEntityTypeBuilder createA(BlockEntityTypeBuilder.Factory factory, Supplier block) { + return new BlockEntityTypeBuilder<>(factory, blocks -> { + blocks.add(block.get()); + }); + } + + public static BlockEntityTypeBuilder create(BlockEntityTypeBuilder.Factory factory, SupplierBlockWrapper wrapper) { + return new BlockEntityTypeBuilder<>(factory, blocks -> { + blocks.add(wrapper.get()); + }); + } + + @Override + @Deprecated + public BlockEntityTypeBuilder addBlock(Block block) { + return this; + } + + @Override + @Deprecated + public BlockEntityTypeBuilder addBlocks(Block... blocks) { + return this; + } + + public BlockEntityType build() { + return build(null); + } + + public BlockEntityType build(Type type) { + List blocks = new ArrayList<>(); + if (consumer != null) + consumer.accept(blocks); + + return build(type, factory, blocks.toArray(new Block[0])); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java b/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java new file mode 100644 index 000000000..58e042b3e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java @@ -0,0 +1,7 @@ +package net.pitan76.mcpitanlib.api.timer; + +import java.util.function.Supplier; + +public interface MinecraftServerTimerAccess { + void mcpitanlib$addTimer(long ticksUntilSomething, Supplier supplier); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java b/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java new file mode 100644 index 000000000..8dbd2dc14 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java @@ -0,0 +1,7 @@ +package net.pitan76.mcpitanlib.api.timer; + +import java.util.function.Supplier; + +public interface ServerWorldTimerAccess { + void mcpitanlib$addTimer(long ticksUntilSomething, Supplier supplier); +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java b/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java new file mode 100644 index 000000000..ecf00fc80 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.api.timer; + +import java.util.function.Supplier; + +public class TimerItem { + public long ticksUntilSomething; + + public Supplier executeSupplier; + + public TimerItem(long ticksUntilSomething, Supplier executeSupplier) { + this.ticksUntilSomething = ticksUntilSomething; + this.executeSupplier = executeSupplier; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java new file mode 100644 index 000000000..85e70e38a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java @@ -0,0 +1,13 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1; + +import net.minecraft.fluid.Fluid; + +public class FluidStorageUtil { + public static IFluidStorage withFixedCapacity(long capacity, Runnable onChange) { + return new FabricFluidStorage(SingleFluidStorage.withFixedCapacity(capacity, onChange)); + } + + public static IFluidVariant getVariant(Fluid fluid) { + return new FabricFluidVariant(FluidVariant.of(fluid)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java new file mode 100644 index 000000000..f239e8608 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java @@ -0,0 +1,104 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1; + +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.nbt.NbtCompound; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; + +public interface IFluidStorage { + long getAmount(); + + long getCapacity(); + + IFluidVariant getResource(); + + void setResource(IFluidVariant variant); + + long insert(IFluidVariant variant, long maxAmount, boolean simulate); + + long extract(IFluidVariant variant, long maxAmount, boolean simulate); + + void writeNbt(WriteNbtArgs args); + + void readNbt(ReadNbtArgs args); + + default void readNbt(WriteNbtArgs args) { + readNbt(new ReadNbtArgs(args.getNbt(), args.getWrapperLookup())); + } + + default long insert(IFluidVariant variant, long maxAmount) { + return insert(variant, maxAmount, false); + } + + default long extract(IFluidVariant variant, long maxAmount) { + return extract(variant, maxAmount, false); + } + + default long insert(Fluid fluid, long maxAmount) { + return insert(FluidStorageUtil.getVariant(fluid), maxAmount); + } + + default long extract(Fluid fluid, long maxAmount) { + return extract(FluidStorageUtil.getVariant(fluid), maxAmount); + } + + default long insert(FluidWrapper wrapper, long maxAmount) { + return insert(wrapper.get(), maxAmount); + } + + default long extract(FluidWrapper wrapper, long maxAmount) { + return extract(wrapper.get(), maxAmount); + } + + default boolean isResourceBlank() { + return getResource() == null || getAmount() <= 0; + } + + default boolean isResource(IFluidVariant variant) { + return getResource() == variant; + } + + default boolean isEmpty() { + return getAmount() <= 0; + } + + default boolean isFull() { + return getAmount() >= getCapacity(); + } + + default boolean canInsert(IFluidVariant variant, long amount) { + return insert(variant, amount, true) == amount; + } + + default boolean canExtract(IFluidVariant variant, long amount) { + return extract(variant, amount, true) == amount; + } + + default boolean canInsert(Fluid fluid, long amount) { + return canInsert(FluidStorageUtil.getVariant(fluid), amount); + } + + default boolean canExtract(Fluid fluid, long amount) { + return canExtract(FluidStorageUtil.getVariant(fluid), amount); + } + + default boolean canInsert(FluidWrapper wrapper, long amount) { + return canInsert(wrapper.get(), amount); + } + + default boolean canExtract(FluidWrapper wrapper, long amount) { + return canExtract(wrapper.get(), amount); + } + + default void writeNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + writeNbt(new WriteNbtArgs(nbt, registryLookup)); + } + + default void readNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + readNbt(new WriteNbtArgs(nbt, registryLookup)); + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java new file mode 100644 index 000000000..cc78339a4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1; + +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.Fluids; +import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; + +public interface IFluidVariant { + Fluid getFluid(); + + default FluidWrapper getWrapper() { + return FluidWrapper.of(getFluid()); + } + + default boolean isSame(IFluidVariant variant) { + return getFluid() == variant.getFluid(); + } + + default boolean isSame(Fluid fluid) { + return getFluid() == fluid; + } + + default boolean isBlank() { + return getFluid() == null || getFluid() == Fluids.EMPTY; + } + + static IFluidVariant of(Fluid fluid) { + return FluidStorageUtil.getVariant(fluid); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java new file mode 100644 index 000000000..66aca0fe8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java @@ -0,0 +1,138 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.recipe.Ingredient; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; +import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; + +public class ArmorMaterialUtil { + public static CompatibleArmorMaterial create(String name, int[] durability, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { + return create(IdentifierUtil.id(name), durability, protectionAmounts, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); + } + public static CompatibleArmorMaterial create(String name, int durability, int protectionAmount, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { + return create(IdentifierUtil.id(name), durability, protectionAmount, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); + } + + @Deprecated + public static CompatibleArmorMaterial create(Identifier id, int[] durability, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { + return new CompatibleArmorMaterial() { + @Override + public int getDurability(ArmorEquipmentType type) { + switch (type.getSlot()) { + case HEAD -> { + return durability[0]; + } + case CHEST -> { + return durability[1]; + } + case LEGS -> { + return durability[2]; + } + case FEET -> { + return durability[3]; + } + default -> { + return 0; + } + } + } + + @Override + public int getProtection(ArmorEquipmentType type) { + switch (type.getSlot()) { + case HEAD -> { + return protectionAmounts[0]; + } + case CHEST -> { + return protectionAmounts[1]; + } + case LEGS -> { + return protectionAmounts[2]; + } + case FEET -> { + return protectionAmounts[3]; + } + default -> { + return 0; + } + } + } + + @Override + public int getEnchantability() { + return enchantability; + } + + @Override + public SoundEvent getEquipSound() { + return equipSound; + } + + @Override + public Ingredient getRepairIngredient() { + return repairIngredient; + } + + @Override + public Identifier getId() { + return id; + } + + @Override + public float getToughness() { + return toughness; + } + + @Override + public float getKnockbackResistance() { + return knockbackResistance; + } + }; + } + + @Deprecated + public static CompatibleArmorMaterial create(Identifier id, int durability, int protectionAmount, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Ingredient repairIngredient) { + return new CompatibleArmorMaterial() { + @Override + public int getDurability(ArmorEquipmentType type) { + return durability; + } + + @Override + public int getProtection(ArmorEquipmentType type) { + return protectionAmount; + } + + @Override + public int getEnchantability() { + return enchantability; + } + + @Override + public SoundEvent getEquipSound() { + return equipSound; + } + + @Override + public Ingredient getRepairIngredient() { + return repairIngredient; + } + + @Override + public Identifier getId() { + return id; + } + + @Override + public float getToughness() { + return toughness; + } + + @Override + public float getKnockbackResistance() { + return knockbackResistance; + } + }; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java new file mode 100644 index 000000000..6d04e40df --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java @@ -0,0 +1,49 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.entity.TypedEntityData; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; + +public class BlockEntityDataUtil { + public static NbtCompound getBlockEntityNbt(ItemStack stack) { + if (!hasBlockEntityNbt(stack)) return NbtUtil.create(); + TypedEntityData> data = stack.get(DataComponentTypes.BLOCK_ENTITY_DATA); + NbtCompound nbt = data.copyNbtWithoutId(); + + String id = BlockEntityTypeUtil.toCompatID(data.getType()).toString(); + NbtUtil.putString(nbt, "id", id); + return nbt; + } + + public static void setBlockEntityNbt(ItemStack stack, NbtCompound nbt) { + if (!nbt.contains("id")) return; + + BlockEntityType type = BlockEntityTypeUtil.fromId(CompatIdentifier.of(NbtUtil.getString(nbt, "id"))); + stack.set(DataComponentTypes.BLOCK_ENTITY_DATA, TypedEntityData.create(type, nbt)); + } + + public static boolean hasBlockEntityNbt(ItemStack stack) { + return stack.get(DataComponentTypes.BLOCK_ENTITY_DATA) != null; + } + + public static void readCompatBlockEntityNbtFromStack(ItemStack stack, CompatBlockEntity blockEntity) { + NbtCompound nbt = getBlockEntityNbt(stack); + blockEntity.readNbt(new ReadNbtArgs(nbt, RegistryLookupUtil.getRegistryLookup(blockEntity))); + } + + public static void writeCompatBlockEntityNbtToStack(ItemStack stack, CompatBlockEntity blockEntity) { + NbtCompound nbt = getBlockEntityNbt(stack); + blockEntity.writeNbt(new WriteNbtArgs(nbt, RegistryLookupUtil.getRegistryLookup(blockEntity))); + NbtUtil.putString(nbt, "id", BlockEntityTypeUtil.toCompatID(blockEntity.getType()).toString()); + setBlockEntityNbt(stack, nbt); + } + + public static void removeBlockEntityNbt(ItemStack stack) { + stack.remove(DataComponentTypes.BLOCK_ENTITY_DATA); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java new file mode 100644 index 000000000..da3ed3705 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.registry.Registries; +import net.minecraft.resources.Identifier; + +public class BlockEntityTypeUtil { + public static Identifier toID(BlockEntityType entityType) { + return Registries.BLOCK_ENTITY_TYPE.getId(entityType); + } + + public static BlockEntityType fromId(Identifier identifier) { + return Registries.BLOCK_ENTITY_TYPE.get(identifier); + } + + public static boolean isExist(Identifier identifier) { + return Registries.BLOCK_ENTITY_TYPE.containsId(identifier); + } + + public static CompatIdentifier toCompatID(BlockEntityType entityType) { + return CompatIdentifier.fromMinecraft(toID(entityType)); + } + + public static BlockEntityType fromId(CompatIdentifier identifier) { + return fromId(identifier.toMinecraft()); + } + + public static boolean isExist(CompatIdentifier identifier) { + return isExist(identifier.toMinecraft()); + } + + public static int getRawId(BlockEntityType type) { + return Registries.BLOCK_ENTITY_TYPE.getRawId(type); + } + + public static BlockEntityType fromIndex(int index) { + return Registries.BLOCK_ENTITY_TYPE.get(index); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java new file mode 100644 index 000000000..2bcea11b6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java @@ -0,0 +1,115 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.storage.NbtWriteView; +import net.minecraft.storage.ReadView; +import net.minecraft.util.ErrorReporter; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import org.jetbrains.annotations.Nullable; + +public class BlockEntityUtil { + + public static BlockEntity getBlockEntity(World world, BlockPos pos) { + return WorldUtil.getBlockEntity(world, pos); + } + + public static NbtCompound getBlockEntityNbt(@Nullable World world, BlockEntity blockEntity) { + if (world == null) + world = getWorld(blockEntity); + if (world == null) + return NbtUtil.create(); + + return blockEntity.createNbt(world.getRegistryManager()); + } + + public static NbtCompound getBlockEntityNbt(BlockEntity blockEntity) { + return getBlockEntityNbt(null, blockEntity); + } + + public static World getWorld(BlockEntity blockEntity) { + return blockEntity.getWorld(); + } + + public static boolean hasWorld(BlockEntity blockEntity) { + return blockEntity.hasWorld(); + } + + public static BlockPos getPos(BlockEntity blockEntity) { + return blockEntity.getPos(); + } + + public static BlockState getCachedState(BlockEntity blockEntity) { + return blockEntity.getCachedState(); + } + + public static BlockState getBlockState(BlockEntity blockEntity) { + return getWorld(blockEntity).getBlockState(getPos(blockEntity)); + } + + public static Block getBlock(BlockEntity blockEntity) { + return getBlockState(blockEntity).getBlock(); + } + + public static void markRemoved(BlockEntity blockEntity) { + blockEntity.markRemoved(); + } + + public static void markDirty(BlockEntity blockEntity) { + blockEntity.markDirty(); + } + + public static BlockEntityType getType(BlockEntity blockEntity) { + return blockEntity.getType(); + } + + public static void readNbt(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { + ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); + blockEntity.readComponentlessData(view); + } + + public static void writeNbt(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { + NbtWriteView view = NbtWriteView.create(ErrorReporter.EMPTY); + blockEntity.writeComponentlessData(view); + NbtDataConverter.data2nbt(view, nbt); + } + + public static void read(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { + ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); + blockEntity.read(view); + } + + public static NbtCompound createNbt(BlockEntity blockEntity, CompatRegistryLookup registryLookup) { + return blockEntity.createNbt(registryLookup.getRegistryLookup()); + } + + public static void setStackNbt(BlockEntity blockEntity, ItemStack stack, CompatRegistryLookup registryLookup) { + blockEntity.readComponents(stack); + } + + public static ServerWorld getServerWorld(BlockEntity blockEntity) { + return (ServerWorld) getWorld(blockEntity); + } + + public static void writeToStack(ItemStack stack, BlockEntity blockEntity, CompatRegistryLookup registryLookup) { + NbtCompound nbt = blockEntity.createComponentlessNbt(registryLookup.getRegistryLookup()); + if (!NbtUtil.has(nbt, "id")) + NbtUtil.putString(nbt, "id", BlockEntityTypeUtil.toID(BlockEntityUtil.getType(blockEntity)).toString()); + + BlockEntityDataUtil.setBlockEntityNbt(stack, nbt); + + blockEntity.createComponentMap().forEach(stack::set); + } + + public static boolean isRemoved(BlockEntity blockEntity) { + return blockEntity.isRemoved(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java new file mode 100644 index 000000000..d0e81a1d4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java @@ -0,0 +1,169 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.item.ItemStack; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.Property; +import net.minecraft.util.BlockRotation; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; +import net.minecraft.world.WorldAccess; +import net.minecraft.world.block.WireOrientation; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; +import net.pitan76.mcpitanlib.api.util.block.BlockHitResultUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; + +public class BlockStateUtil { + public static Block getBlock(BlockState state) { + return state.getBlock(); + } + + public static boolean isAir(BlockState state) { + return state.isAir(); + } + + public static boolean isOpaque(BlockState state) { + return state.isOpaque(); + } + + public static BlockSoundGroup getSoundGroup(BlockState state) { + return state.getSoundGroup(); + } + + public static CompatBlockSoundGroup getCompatSoundGroup(BlockState state) { + return CompatBlockSoundGroup.of(getSoundGroup(state)); + } + + public static BlockState getDefaultState(Block block) { + return block.getDefaultState(); + } + + public static StateManager getStateManager(Block block) { + return block.getStateManager(); + } + + public static , V extends T> BlockState with(BlockState state, Property property, V value) { + return state.with(property, value); + } + + public static void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { + WireOrientation wireOrientation = WireOrientation.of(pos.up() == fromPos ? Direction.UP : Direction.DOWN, pos.north() == fromPos ? Direction.NORTH : Direction.SOUTH, pos.east() == fromPos ? WireOrientation.SideBias.RIGHT : WireOrientation.SideBias.LEFT); + + state.neighborUpdate(world, pos, block, wireOrientation, notify); + } + + public static void updateNeighbors(BlockState state, WorldAccess world, BlockPos pos, int flags) { + state.updateNeighbors(world, pos, flags); + } + + public static boolean hasRandomTicks(BlockState state) { + return state.hasRandomTicks(); + } + + public static void randomTick(BlockState state, ServerWorld world, BlockPos pos) { + state.randomTick(world, pos, world.random); + } + + public static CompatActionResult onUse(BlockState state, World world, Player player, BlockHitResult hitResult) { + return CompatActionResult.create(state.onUse(world, player.getEntity(), hitResult)); + } + + public static CompatActionResult onUse(BlockState state, World world, Player player, Direction dir, BlockPos blockPos) { + return onUse(state, world, player, BlockHitResultUtil.create(player.getPos(), dir, blockPos)); + } + + public static CompatActionResult onUseWithItem(BlockState state, ItemStack stack, World world, PlayerEntity player, Hand hand, BlockHitResult hit) { + return CompatActionResult.create(state.onUseWithItem(stack, world, player, hand, hit)); + } + + public static CompatActionResult onUseWithItem_actionResult(BlockState state, ItemStack stack, World world, PlayerEntity player, Hand hand, BlockHitResult hit) { + return onUseWithItem(state, stack, world, player, hand, hit); + } + + public static FluidState getFluidState(BlockState state) { + return state.getFluidState(); + } + + public static Fluid getFluid(BlockState state) { + return getFluidState(state).getFluid(); + } + + public static BlockState rotate(BlockState state, BlockRotation rotation) { + return state.rotate(rotation); + } + + public static net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraDefaultState(Block block) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getDefaultState(block)); + } + + public static net.pitan76.mcpitanlib.midohra.block.BlockState getDefaultState(BlockWrapper block) { + return block.getDefaultState(); + } + + public static float getHardness(BlockState state, BlockView world, BlockPos pos) { + return state.getHardness(world, pos); + } + + public static float getHardness(BlockState state, World world, BlockPos pos) { + return state.getHardness(world, pos); + } + + public static int getLuminance(BlockState state) { + return state.getLuminance(); + } + + public static int getOpacity(BlockState state) { + return state.getOpacity(); + } + + public static int getComparatorOutput(BlockState state, World world, BlockPos pos) { + return state.getComparatorOutput(world, pos, Direction.NORTH); + } + + public static float getHardness(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.BlockView world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return getHardness(state.toMinecraft(), world.getRaw(), pos.toMinecraft()); + } + + public static int getLuminance(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return getLuminance(state.toMinecraft()); + } + + public static int getOpacity(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return getOpacity(state.toMinecraft()); + } + + public static int getComparatorOutput(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return getComparatorOutput(state.toMinecraft(), world.getRaw(), pos.toMinecraft()); + } + + public static boolean canPlaceAt(BlockState state, BlockPos pos, World world) { + return state.canPlaceAt(world, pos); + } + + public static boolean canPlaceAt(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.world.World world) { + return canPlaceAt(state.toMinecraft(), pos.toMinecraft(), world.getRaw()); + } + + public static boolean hasRandomTicks(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return hasRandomTicks(state.toMinecraft()); + } + + public static void randomTick(net.pitan76.mcpitanlib.midohra.block.BlockState state, ServerWorld world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + randomTick(state.toMinecraft(), world, pos.toMinecraft()); + } + + public static void randomTick(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.ServerWorld world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + randomTick(state.toMinecraft(), world.getRaw(), pos.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java new file mode 100644 index 000000000..6472e028d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java @@ -0,0 +1,258 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.tag.MineableToolTags; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.v1.BlockUtilV1; +import net.pitan76.mcpitanlib.api.util.v2.BlockUtilV2; + +import java.util.List; + +@Deprecated +public class BlockUtil { + /** + * Get block from Identifier. + * @param id Identifier of the block. + * @return Block of the Identifier. + */ + public static Block block(Identifier id) { + return BlockUtilV1.block(id); + } + + /** + * Check if two blocks are equal. + * @param block Block to compare. + * @param block2 Block to compare. + * @return If two blocks are equal. + */ + public static boolean isEqual(Block block, Block block2) { + return BlockUtilV2.isEqual(block, block2); + } + + /** + * Check if the block is in the tag. (MCPitanLib TagKey) + * @param block Block to check. + * @param tagKey TagKey of the tag. + * @return If the block is in the tag. + */ + public static boolean isIn(Block block, TagKey tagKey) { + return BlockUtilV2.isIn(block, tagKey); + } + + /** + * set break tool tag and level to block + * @param settings Block settings + * @param toolTags Tool tags + * @param level Level + * @return Block settings + */ + public static AbstractBlock.Settings breakByTool(AbstractBlock.Settings settings, MineableToolTags toolTags, int level) { + return BlockUtilV1.breakByTool(settings, toolTags, level); + } + + /** + * not drop anything when block is broken + * @param settings Block settings + * @return Block settings + */ + public static AbstractBlock.Settings dropsNothing(AbstractBlock.Settings settings) { + return BlockUtilV1.dropsNothing(settings); + } + /** + * block breaking requires any tool + * @param settings Block settings + * @return Block settings + */ + public static AbstractBlock.Settings requiresTool(AbstractBlock.Settings settings) { + return BlockUtilV1.requiresTool(settings); + } + + /** + * Check if the block is existed. + * @param identifier Identifier of the block. + * @return If the block is existed. + */ + public static boolean isExist(Identifier identifier) { + return BlockUtilV1.isExist(identifier); + } + + /** + * Get Identifier from block. + * @param block Block to get Identifier. + * @return Identifier of the block. + */ + public static Identifier toID(Block block) { + return BlockUtilV1.toID(block); + } + + /** + * Get block from Identifier. + * @param identifier Identifier of the block. + * @return Block of the Identifier. + */ + public static Block fromId(Identifier identifier) { + return BlockUtilV1.fromId(identifier); + } + + /** + * Get CompatIdentifier from block. + * @param block Block to get CompatIdentifier. + * @return CompatIdentifier of the block. + */ + public static CompatIdentifier toCompatID(Block block) { + return CompatIdentifier.fromMinecraft(toID(block)); + } + + /** + * Get block from CompatIdentifier. + * @param identifier CompatIdentifier of the block. + * @return Block of the CompatIdentifier. + */ + public static Block fromId(CompatIdentifier identifier) { + return fromId(identifier.toMinecraft()); + } + + /** + * Check if the block is existed. + * @param identifier CompatIdentifier of the block. + * @return If the block is existed. + */ + public static boolean isExist(CompatIdentifier identifier) { + return isExist(identifier.toMinecraft()); + } + + /** + * Get all blocks. + * @return List of all blocks. + */ + public static List getAllBlocks() { + return BlockUtilV1.getAllBlocks(); + } + + /** + * Create Block from Block.Settings. + * @param settings Block.Settings to create Block. + * @return Block created from Block.Settings. + */ + @Deprecated + public static Block of(AbstractBlock.Settings settings) { + return BlockUtilV1.of(settings); + } + + /** + * Create Block from CompatibleBlockSettings. + * @param settings CompatibleBlockSettings to create Block. + * @return Block created from CompatibleBlockSettings. + */ + public static Block of(CompatibleBlockSettings settings) { + return BlockUtilV1.of(settings); + } + + /** + * Get raw id of the block. + * @param block Block to get raw id. + * @return Raw id of the block. + */ + public static int getRawId(Block block) { + return BlockUtilV1.getRawId(block); + } + + /** + * Get block from raw id. + * @param index Raw id of the block. + * @return Block from raw id. + */ + public static Block fromIndex(int index) { + return BlockUtilV1.fromIndex(index); + } + + /** + * Get all blocks in the tag. (MCPitanLib TagKey) + * @param tagKey TagKey of the tag. + * @return List of blocks in the tag. + */ + public static List getBlocks(TagKey tagKey) { + return BlockUtilV2.getBlocks(tagKey); + } + + /** + * Get given the list of blocks in the tag. (MCPitanLib TagKey) + * @param tagKey TagKey of the tag. + * @param blocks List of blocks to search. + * @return List of blocks in the tag. + */ + public static List getBlocks(TagKey tagKey, List blocks) { + return BlockUtilV2.getBlocks(tagKey, blocks); + } + + /** + * Get all blocks in the tag. + * @param identifier Identifier of the tag. + * @return List of blocks in the tag. + */ + public static List getBlocks(Identifier identifier) { + return BlockUtilV2.getBlocks(identifier); + } + + /** + * Get given the list of blocks in the tag. + * @param identifier Identifier of the tag. + * @param blocks List of blocks to search. + * @return List of blocks in the tag. + */ + public static List getBlocks(Identifier identifier, List blocks) { + return BlockUtilV2.getBlocks(identifier, blocks); + } + + /** + * Get all blocks in the tag. + * @param id String of the tag. + * @return List of blocks in the tag. + */ + public static List getBlocks(String id) { + return BlockUtilV2.getBlocks(id); + } + + /** + * Get given the list of blocks in the tag. + * @param id String of the tag. + * @param blocks List of blocks to search. + * @return List of blocks in the tag. + */ + public static List getBlocks(String id, List blocks) { + return BlockUtilV2.getBlocks(id, blocks); + } + + /** + * Check if the block is in the tag. + * @param block Block to check. + * @param identifier Identifier of the tag. + * @return If the block is in the tag. + */ + public static boolean isBlockInTag(Block block, Identifier identifier) { + return BlockUtilV2.isBlockInTag(block, identifier); + } + + /** + * Check if the block is in the tag. + * @param block Block to check. + * @param id String of the tag. + * @return If the block is in the tag. + */ + public static boolean isBlockInTag(Block block, String id) { + return BlockUtilV2.isBlockInTag(block, id); + } + + public static Block fromItem(Item item) { + return BlockUtilV2.fromItem(item); + } + + public static Block fromItem(ItemStack stack) { + return BlockUtilV2.fromItem(stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java new file mode 100644 index 000000000..a95953baf --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java @@ -0,0 +1,24 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockView; + +public class BlockViewUtil { + public static BlockState getBlockState(BlockView blockView, BlockPos pos) { + return blockView.getBlockState(pos); + } + + public static BlockEntity getBlockEntity(BlockView blockView, BlockPos pos) { + return blockView.getBlockEntity(pos); + } + + public static boolean hasBlockEntity(BlockView blockView, BlockPos pos) { + return getBlockEntity(blockView, pos) != null; + } + + public static boolean isAir(BlockView blockView, BlockPos pos) { + return getBlockState(blockView, pos).isAir(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java new file mode 100644 index 000000000..8173c9737 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java @@ -0,0 +1,87 @@ +package net.pitan76.mcpitanlib.api.util; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.command.permission.LeveledPermissionPredicate; +import net.minecraft.command.permission.PermissionLevel; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.command.CommandManager; +import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.server.world.ServerWorld; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.core.command.CommandResult; + +public class CommandManagerUtil { + public static CommandManager getCommandManager(MinecraftServer server) { + return server.getCommandManager(); + } + + public static CommandResult execute(MinecraftServer server, String command) { + CommandDispatcher dispatcher = getCommandManager(server).getDispatcher(); + ServerCommandSource source = server.getCommandSource(); + + if (command.startsWith("/")) { + command = command.substring(1); + } + + CommandResult cr = new CommandResult(); + cr.setSuccess(false); + cr.setSource(source); + + try { + int result = dispatcher.execute(command, source); + cr.setResult(result); + cr.setSuccess(true); + } catch (CommandSyntaxException e) { + cr.setMessage(e.getMessage()); + cr.setErrorType(CommandResult.ErrorType.COMMAND_SYNTAX_ERROR); + } catch (RuntimeException e) { + cr.setMessage(e.getMessage()); + cr.setErrorType(CommandResult.ErrorType.RUNTIME_ERROR); + } + + return cr; + } + + public static CommandResult execute(ServerCommandSource source, String command) { + CommandDispatcher dispatcher = source.getServer().getCommandManager().getDispatcher(); + + if (command.startsWith("/")) { + command = command.substring(1); + } + + CommandResult cr = new CommandResult(); + cr.setSuccess(false); + cr.setSource(source); + + try { + int result = dispatcher.execute(command, source); + cr.setResult(result); + cr.setSuccess(true); + } catch (CommandSyntaxException e) { + cr.setMessage(e.getMessage()); + cr.setErrorType(CommandResult.ErrorType.COMMAND_SYNTAX_ERROR); + } catch (RuntimeException e) { + cr.setMessage(e.getMessage()); + cr.setErrorType(CommandResult.ErrorType.RUNTIME_ERROR); + } + + return cr; + } + + public static CommandResult execute(Player player, String command) { + return execute(getCommandSource(player), command); + } + + public static ServerCommandSource getCommandSource(MinecraftServer server) { + return server.getCommandSource(); + } + + public static ServerCommandSource getCommandSource(Player player) { + return player.getEntity().getCommandSource((ServerWorld) player.getWorld()); + } + + public static ServerCommandSource withLevel(ServerCommandSource source, int level) { + return source.withPermissions(LeveledPermissionPredicate.fromLevel(PermissionLevel.fromLevel(level))); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java new file mode 100644 index 000000000..8ba934d53 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java @@ -0,0 +1,53 @@ +package net.pitan76.mcpitanlib.api.util; + +import com.mojang.brigadier.arguments.*; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.block.Block; +import net.minecraft.command.argument.BlockStateArgumentType; +import net.minecraft.command.argument.EntityArgumentType; +import net.minecraft.command.argument.ItemStackArgumentType; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public class CommandUtil { + public static Item getItemArgument(String name, ServerCommandEvent e) { + return ItemStackArgumentType.getItemStackArgument(e.getContext(), name).getItem(); + } + + public static Block getBlockArgument(String name, ServerCommandEvent e) { + return BlockStateArgumentType.getBlockState(e.getContext(), name).getBlockState().getBlock(); + } + + public static Integer getIntegerArgument(String name, ServerCommandEvent e) { + return IntegerArgumentType.getInteger(e.getContext(), name); + } + + public static Double getDoubleArgument(String name, ServerCommandEvent e) { + return DoubleArgumentType.getDouble(e.getContext(), name); + } + + public static Float getFloatArgument(String name, ServerCommandEvent e) { + return FloatArgumentType.getFloat(e.getContext(), name); + } + + public static Long getLongArgument(String name, ServerCommandEvent e) { + return LongArgumentType.getLong(e.getContext(), name); + } + + public static Boolean getBooleanArgument(String name, ServerCommandEvent e) { + return BoolArgumentType.getBool(e.getContext(), name); + } + + public static String getStringArgument(String name, ServerCommandEvent e) { + return StringArgumentType.getString(e.getContext(), name); + } + + public static Entity getEntityArgument(String name, ServerCommandEvent e) { + try { + return EntityArgumentType.getEntity(e.getContext(), name); + } catch (CommandSyntaxException ex) { + return null; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java new file mode 100644 index 000000000..c17a5d707 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java @@ -0,0 +1,123 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.util.ActionResult; +import net.pitan76.mcpitanlib.api.event.result.EventResult; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; + +import java.util.Optional; + +public class CompatActionResult { + public static final CompatActionResult SUCCESS = new CompatActionResult(ActionResult.SUCCESS, EventResult.success()); + public static final CompatActionResult PASS = new CompatActionResult(ActionResult.PASS, EventResult.pass()); + public static final CompatActionResult FAIL = new CompatActionResult(ActionResult.FAIL, EventResult.fail()); + public static final CompatActionResult CONSUME = new CompatActionResult(ActionResult.CONSUME, EventResult.success()); + public static final CompatActionResult PASS_TO_DEFAULT_BLOCK_ACTION = new CompatActionResult(ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION, EventResult.pass()); + public static final CompatActionResult SUCCESS_SERVER = new CompatActionResult(ActionResult.SUCCESS_SERVER, EventResult.success()); + public static final CompatActionResult STOP = new CompatActionResult(ActionResult.FAIL, EventResult.stop()); + + private final ActionResult actionResult; + private final EventResult eventResult; + + protected CompatActionResult(ActionResult actionResult, EventResult eventResult) { + this.actionResult = actionResult; + this.eventResult = eventResult; + } + + public ActionResult toActionResult() { + return actionResult; + } + + public EventResult toEventResult() { + return eventResult; + } + + public Optional getNewMidohraHandStack() { + return getNewHandStack().map(ItemStack::of); + } + + public Optional getNewHandStack() { + if (!(actionResult instanceof ActionResult.Success)) return Optional.empty(); + + ActionResult.Success success = (ActionResult.Success) actionResult; + return Optional.ofNullable(success.getNewHandStack()); + } + + public static CompatActionResult of(ActionResult result) { + if (result == ActionResult.SUCCESS) + return SUCCESS; + + if (result == ActionResult.PASS) + return PASS; + + if (result == ActionResult.FAIL) + return FAIL; + + if (result == ActionResult.CONSUME) + return CONSUME; + + if (result == ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION) + return PASS_TO_DEFAULT_BLOCK_ACTION; + + if (result == ActionResult.SUCCESS_SERVER) + return SUCCESS_SERVER; + + return PASS; + } + + public static CompatActionResult of(EventResult result) { + if (result == EventResult.success()) + return SUCCESS; + + if (result == EventResult.pass()) + return PASS; + + if (result == EventResult.fail()) + return FAIL; + + if (result == EventResult.stop()) + return STOP; + + return PASS; + } + + @Deprecated + public static CompatActionResult create(ActionResult result, EventResult eventResult) { + return new CompatActionResult(result, eventResult); + } + + /** + * @deprecated Use {@link #of(ActionResult)} instead. + */ + @Deprecated + public static CompatActionResult create(ActionResult result) { + return of(result); + } + + @Deprecated + public static CompatActionResult create2(ActionResult result) { + return create(result, EventResult.stop()); + } + + @Override + public boolean equals(Object obj) { + if (super.equals(obj)) return true; + if (!(obj instanceof CompatActionResult)) return false; + if (actionResult.equals(((CompatActionResult) obj).actionResult)) { + return eventResult.equals(((CompatActionResult) obj).eventResult); + } + + return false; + } + + public String getName() { + if (this == SUCCESS) return "SUCCESS"; + if (this == PASS) return "PASS"; + if (this == FAIL) return "FAIL"; + if (this == CONSUME) return "CONSUME"; + if (this == PASS_TO_DEFAULT_BLOCK_ACTION) return "PASS_TO_DEFAULT_BLOCK_ACTION"; + if (this == SUCCESS_SERVER) return "SUCCESS_SERVER"; + if (this == STOP) return "STOP"; + + return "UNKNOWN"; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java new file mode 100644 index 000000000..2dc9ad850 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java @@ -0,0 +1,173 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.resources.Identifier; + +import java.util.Objects; + +/** + * This is the Identifier class unique to MCPitanLib. + * It is different from Minecraft's Identifier class. + */ +public class CompatIdentifier { + private final String namespace; + private final String path; + + public static final CompatIdentifier EMPTY = CompatIdentifier.of("mcpitanlib:empty"); + + /** + * Creates a new Identifier with the given namespace and path. + * @param namespace The namespace of the Identifier. + * @param path The path of the Identifier. + */ + public CompatIdentifier(String namespace, String path) { + this.namespace = namespace; + this.path = path; + } + + /** + * Creates a new Identifier with the given id. + * @param id The id of the Identifier. + */ + public CompatIdentifier(String id) { + if (!id.contains(":")) { + this.namespace = "minecraft"; + this.path = id; + return; + } + String[] split = id.split(":"); + this.namespace = split[0]; + this.path = split[1]; + } + + /** + * Creates a new Identifier with the given id. + * @param id The id of the Identifier. + * @return The Identifier. + */ + public static CompatIdentifier of(String id) { + return new CompatIdentifier(id); + } + + /** + * Creates a new Identifier with the given namespace and path. + * @param namespace The namespace of the Identifier. + * @param path The path of the Identifier. + * @return The Identifier. + */ + public static CompatIdentifier of(String namespace, String path) { + return new CompatIdentifier(namespace, path); + } + + /** + * Returns the string representation of the Identifier. + * @return The string representation of the Identifier. + */ + public String toString() { + return this.namespace + ":" + this.path; + } + + /** + * Returns the namespace of the Identifier. + * @return The namespace of the Identifier. + */ + public String getNamespace() { + return this.namespace; + } + + /** + * Returns the path of the Identifier. + * @return The path of the Identifier. + */ + public String getPath() { + return this.path; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj != null && this.getClass() == obj.getClass()) { + CompatIdentifier identifier = (CompatIdentifier)obj; + return this.namespace.equals(identifier.namespace) && this.path.equals(identifier.path); + } else if (obj instanceof Identifier) { + return this.toString().equals(obj.toString()); + } else if (obj instanceof String) { + return this.toString().equals(obj); + } else { + return false; + } + } + + public boolean equals(CompatIdentifier identifier) { + return this.namespace.equals(identifier.namespace) && this.path.equals(identifier.path); + } + + public boolean equals(String id) { + return this.toString().equals(id); + } + + public static boolean equals(CompatIdentifier id1, CompatIdentifier id2) { + return id1.namespace.equals(id2.namespace) && id1.path.equals(id2.path); + } + + public static boolean equals(CompatIdentifier id1, Identifier id2) { + return id1.toString().equals(id2.toString()); + } + + public static boolean equals(Identifier id1, CompatIdentifier id2) { + return id1.toString().equals(id2.toString()); + } + + public static boolean equals(Identifier id1, Identifier id2) { + return id1.toString().equals(id2.toString()); + } + + @Override + public int hashCode() { + return 31 * this.namespace.hashCode() + this.path.hashCode(); + } + + // ---- + + /** + * Converts this MCPitanLib Identifier to a Minecraft Identifier. + * @return The Minecraft Identifier. + */ + public Identifier toMinecraft() { + return IdentifierUtil.id(this.toString()); + } + + /** + * Converts a Minecraft Identifier to an MCPitanLib Identifier. + * @param id The Minecraft Identifier. + * @return The Identifier. + */ + public static CompatIdentifier fromMinecraft(Identifier id) { + if (id == null) return EMPTY; + return of(id.toString()); + } + + public static CompatIdentifier empty() { + return EMPTY; + } + + public boolean isEmpty() { + return equals(EMPTY); + } + + public static boolean isMinecraftNamespace(CompatIdentifier id) { + return id.getNamespace().equals("minecraft"); + } + + public boolean isMinecraftNamespace() { + return this.namespace.equals("minecraft"); + } + + public CompatIdentifier(Identifier id) { + this.namespace = id.getNamespace(); + this.path = id.getPath(); + } + + public static CompatIdentifier of(Identifier id) { + return new CompatIdentifier(id); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java new file mode 100644 index 000000000..e11866da2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java @@ -0,0 +1,54 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.util.Formatting; +import net.minecraft.util.Rarity; + +public class CompatRarity implements CompatStringIdentifiable { + private final Rarity rarity; + + public static final CompatRarity NONE = of(Rarity.COMMON); + public static final CompatRarity COMMON = of(Rarity.COMMON); + public static final CompatRarity UNCOMMON = of(Rarity.UNCOMMON); + public static final CompatRarity RARE = of(Rarity.RARE); + public static final CompatRarity EPIC = of(Rarity.EPIC); + + public CompatRarity(Rarity rarity) { + this.rarity = rarity; + } + + public static CompatRarity of(Rarity rarity) { + return new CompatRarity(rarity); + } + + public Rarity get() { + return rarity; + } + + public Formatting getFormatting() { + return rarity.getFormatting(); + } + + public String getName() { + return rarity.name(); + } + + @Override + public String asString_compat() { + return getName(); + } + + public static CompatRarity fromString(String name) { + switch (name) { + case "common": + return COMMON; + case "uncommon": + return UNCOMMON; + case "rare": + return RARE; + case "epic": + return EPIC; + default: + return NONE; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java new file mode 100644 index 000000000..2fb01f76e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.util.StringIdentifiable; + +public interface CompatStringIdentifiable extends StringIdentifiable { + @Deprecated + @Override + default String asString() { + return asString_compat(); + } + + String asString_compat(); + + default StringIdentifiable get() { + return this; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java new file mode 100644 index 000000000..bf3119a80 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.Ingredient; +import net.minecraft.resources.Identifier; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; +import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; +import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; + +public class CompatibleRecipeEntryUtil { + public static CompatibleRecipeEntry createShapelessRecipe(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + return new CompatibleRecipeEntry(id, group, category, RecipeUtil.createShapelessRecipe(id, group, category, output, input)); + } + + public static CompatibleRecipeEntry createShapelessRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + return createShapelessRecipe(id.toMinecraft(), group, category, output, input); + } + + public static RecipeEntry createShapelessRecipeM(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + return RecipeEntry.of(RecipeUtil.createShapelessRecipe(id.toMinecraft(), group, category, output, input), id); + } + + public static CompatRecipe createShapelessAsCompatRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + return new CompatRecipe(RecipeUtil.createShapelessRecipe(id.toMinecraft(), group, category, output, input), id.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java new file mode 100644 index 000000000..96507c718 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java @@ -0,0 +1,175 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.NbtComponent; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; + +import java.util.Set; + +/** + * カスタムデータのユーティリティクラス + */ +public class CustomDataUtil { + /** + * NBTを取得する。存在しない場合は新しいNBTを作成する。 + * @param stack ItemStack + * @return NBT + */ + public static NbtCompound getOrCreateNbt(ItemStack stack) { + if (!hasNbt(stack)) { + return NbtUtil.create(); + } + + return getNbt(stack); + } + + /** + * NBTを設定する。 + * @param stack ItemStack + * @param nbt NBT + */ + public static void setNbt(ItemStack stack, NbtCompound nbt) { + stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt)); + } + + /** + * NBTが存在するかどうかを取得する。 + * @param stack ItemStack + * @return NBTが存在するかどうか + */ + public static boolean hasNbt(ItemStack stack) { + return stack.get(DataComponentTypes.CUSTOM_DATA) != null; + } + + /** + * NBTを取得する。 + * @param stack ItemStack + * @return NBT + */ + public static NbtCompound getNbt(ItemStack stack) { + if (stack.get(DataComponentTypes.CUSTOM_DATA) == null) + return NbtUtil.create(); + + return stack.get(DataComponentTypes.CUSTOM_DATA).copyNbt(); + } + + /** + * 値を設定する。 + * @param stack ItemStack + * @param key キー + * @param value 値 + */ + public static void put(ItemStack stack, String key, NbtCompound value) { + NbtCompound nbt = getOrCreateNbt(stack); + NbtUtil.put(nbt, key, value); + setNbt(stack, nbt); + } + + /** + * 値を取得する。 + * @param stack ItemStack + * @param key キー + * @return 値 + */ + public static NbtCompound get(ItemStack stack, String key) { + NbtCompound nbt = getNbt(stack); + return nbt.getCompoundOrEmpty(key); + } + + /** + * 値を削除する。 + * @param stack ItemStack + * @param key キー + */ + public static void remove(ItemStack stack, String key) { + NbtCompound nbt = getNbt(stack); + nbt.remove(key); + setNbt(stack, nbt); + } + + /** + * 値が存在するかどうかを取得する。 + * @param stack ItemStack + * @param key キー + * @return 値が存在するかどうか + */ + public static boolean has(ItemStack stack, String key) { + if (!hasNbt(stack)) + return false; + + NbtCompound nbt = getNbt(stack); + return nbt.contains(key); + } + + /** + * 指定した型の値を取得する + * @param stack ItemStack + * @param key キー + * @param clazz クラス + * @param 値 + */ + public static T get(ItemStack stack, String key, Class clazz) { + NbtCompound nbt = getNbt(stack); + return NbtUtil.get(nbt, key, clazz); + } + + /** + * 値を設定する。 + * @param stack ItemStack + * @param key キー + * @param value 値 + */ + public static void set(ItemStack stack, String key, T value) { + NbtCompound nbt = getOrCreateNbt(stack); + NbtUtil.set(nbt, key, value); + setNbt(stack, nbt); + } + + /** + * キーの一覧を取得する。 + * @param stack ItemStack + * @return キーの一覧 + */ + public static Set getKeys(ItemStack stack) { + NbtCompound nbt = getNbt(stack); + return NbtUtil.getKeys(nbt); + } + + /** + * set(stack, key, value) のエイリアス + * @param stack ItemStack + * @param key キー + * @param value 値 + */ + public static void put(ItemStack stack, String key, T value) { + set(stack, key, value); + } + + /** + * has(stack, key) のエイリアス + * @param stack ItemStack + * @param key キー + * @return 値が存在するかどうか + */ + public static boolean contains(ItemStack stack, String key) { + return has(stack, key); + } + + /** + * 1.20.3以前下位互換のための修正用 + * @param stack ItemStack + * @param keys 移植するキー + */ + public static void fix_oldNbt(ItemStack stack, String[] keys) { + + } + + /** + * カスタムNBTを削除する + * @param stack ItemStack + */ + public static void remove(ItemStack stack) { + stack.remove(DataComponentTypes.CUSTOM_DATA); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java new file mode 100644 index 000000000..b5733480d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java @@ -0,0 +1,44 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class DamageSourceUtil { + public static DamageSource thrownProjectile(Entity projectile, Entity attacker, Entity source) { + return source.getDamageSources().thrown(projectile, attacker); + } + + public static DamageSource thrownProjectile(Entity projectile, Entity attacker) { + return thrownProjectile(projectile, attacker, projectile); + } + + public static DamageSource playerAttack(Player attacker, Entity source) { + return source.getDamageSources().playerAttack(attacker.getPlayerEntity()); + } + + public static DamageSource playerAttack(Player attacker) { + return playerAttack(attacker, attacker.getPlayerEntity()); + } + + public static DamageSource mobAttack(LivingEntity attacker, Entity source) { + return source.getDamageSources().mobAttack(attacker); + } + + public static DamageSource mobAttack(LivingEntity attacker) { + return mobAttack(attacker, attacker); + } + + public static DamageSource mobProjectile(Entity projectile, LivingEntity attacker, Entity source) { + return source.getDamageSources().mobProjectile(projectile, attacker); + } + + public static DamageSource mobProjectile(Entity projectile, LivingEntity attacker) { + return mobProjectile(projectile, attacker, projectile); + } + + public static DamageSource fall(Entity source) { + return source.getDamageSources().fall(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java new file mode 100644 index 000000000..13d9ad550 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java @@ -0,0 +1,68 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; +import net.pitan76.mcpitanlib.api.state.property.CompatProperties; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Direction; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class DirectionBoolPropertyUtil { + /** + * 指定位置のブロック状態に対して、方向に対応する Boolean プロパティを設定してワールドに反映する。 + * 例: Direction.UP => CompatProperties.UP + * @return プロパティが存在して設定に成功した場合は true、プロパティが存在しない場合やブロック状態が null の場合は false + */ + public static boolean setProperty(World world, BlockPos pos, Direction dir, boolean value) { + BlockState state = world.getBlockState(pos); + + if (dir == Direction.UP && state.contains(CompatProperties.UP)) { + state = state.with(CompatProperties.UP, value); + } else if (dir == Direction.DOWN && state.contains(CompatProperties.DOWN)) { + state = state.with(CompatProperties.DOWN, value); + } else if (dir == Direction.NORTH && state.contains(CompatProperties.NORTH)) { + state = state.with(CompatProperties.NORTH, value); + } else if (dir == Direction.SOUTH && state.contains(CompatProperties.SOUTH)) { + state = state.with(CompatProperties.SOUTH, value); + } else if (dir == Direction.WEST && state.contains(CompatProperties.WEST)) { + state = state.with(CompatProperties.WEST, value); + } else if (dir == Direction.EAST && state.contains(CompatProperties.EAST)) { + state = state.with(CompatProperties.EAST, value); + } else { + return false; + } + + world.setBlockState(pos, state); + return true; + } + + public static boolean hasAll(BlockState state) { + return state.contains(CompatProperties.UP) && state.contains(CompatProperties.DOWN) && state.contains(CompatProperties.NORTH) && + state.contains(CompatProperties.SOUTH) && state.contains(CompatProperties.WEST) && state.contains(CompatProperties.EAST); + } + + public static BlockState clearAll(BlockState state) { + return state + .with(CompatProperties.UP, false) + .with(CompatProperties.DOWN, false) + .with(CompatProperties.NORTH, false) + .with(CompatProperties.EAST, false) + .with(CompatProperties.SOUTH, false) + .with(CompatProperties.WEST, false); + } + + public static void addProperties(AppendPropertiesArgs args) { + args.addProperty(CompatProperties.UP, CompatProperties.DOWN, CompatProperties.NORTH, + CompatProperties.EAST, CompatProperties.SOUTH, CompatProperties.WEST); + } + + public static BlockState withAll(BlockState state, boolean value) { + return state + .with(CompatProperties.UP, value) + .with(CompatProperties.DOWN, value) + .with(CompatProperties.NORTH, value) + .with(CompatProperties.EAST, value) + .with(CompatProperties.SOUTH, value) + .with(CompatProperties.WEST, value); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java new file mode 100644 index 000000000..94224ccec --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java @@ -0,0 +1,82 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.ItemEnchantmentsComponent; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class EnchantmentUtil { + public static CompatEnchantment getEnchantment(Identifier identifier) { + RegistryKey registryKey = RegistryKey.of(RegistryKeys.ENCHANTMENT, identifier); + return new CompatEnchantment(registryKey); + } + + public static Identifier getId(CompatEnchantment enchantment) { + return enchantment.getId(); + } + + public static int getLevel(CompatEnchantment enchantment, ItemStack stack, @Nullable World world) { + return enchantment.getLevel(stack, world); + } + + // CompatIdentifier + public static CompatEnchantment getEnchantment(CompatIdentifier identifier) { + return getEnchantment(identifier.toMinecraft()); + } + + public static CompatIdentifier getCompatId(CompatEnchantment enchantment) { + return CompatIdentifier.fromMinecraft(enchantment.getId()); + } + + public static List getEnchantments(ItemStack stack) { + List enchantments = new ArrayList<>(); + + EnchantmentHelper.getEnchantments(stack).getEnchantments().forEach((enchantment) -> { + if (enchantment.getKey().isPresent()) + enchantments.add(new CompatEnchantment(enchantment.getKey().get())); + }); + + return enchantments; + } + + public static boolean hasEnchantment(ItemStack stack) { + return EnchantmentHelper.hasEnchantments(stack); + } + + public static Map getEnchantment(ItemStack stack, @Nullable World world) { + Map enchantments = new HashMap<>(); + + List enchantmentList = getEnchantments(stack); + enchantmentList.forEach((enchantment) -> { + enchantments.put(enchantment, getLevel(enchantment, stack, world)); + }); + + return enchantments; + } + + public static void setEnchantment(ItemStack stack, Map enchantments, @Nullable World world) { + ItemEnchantmentsComponent.Builder builder = new ItemEnchantmentsComponent.Builder(ItemEnchantmentsComponent.DEFAULT); + + enchantments.forEach((compatEnchantment, integer) -> { + builder.add(compatEnchantment.getEntry(world), integer); + }); + + EnchantmentHelper.set(stack, builder.build()); + } + + public static void removeEnchantment(ItemStack stack) { + stack.remove(DataComponentTypes.ENCHANTMENTS); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java new file mode 100644 index 000000000..8fc1f79ac --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.entity.EntityType; +import net.minecraft.registry.Registries; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; + +public class EntityTypeUtil { + public static Identifier toID(EntityType entityType) { + return Registries.ENTITY_TYPE.getId(entityType); + } + + public static EntityType fromId(Identifier identifier) { + return Registries.ENTITY_TYPE.get(identifier); + } + + public static boolean isExist(Identifier identifier) { + return Registries.ENTITY_TYPE.containsId(identifier); + } + + public static CompatIdentifier toCompatID(EntityType entityType) { + return CompatIdentifier.fromMinecraft(toID(entityType)); + } + + public static EntityType fromId(CompatIdentifier identifier) { + return fromId(identifier.toMinecraft()); + } + + public static boolean isExist(CompatIdentifier identifier) { + return isExist(identifier.toMinecraft()); + } + + public static int getRawId(EntityType type) { + return Registries.ENTITY_TYPE.getRawId(type); + } + + public static EntityType fromIndex(int index) { + return Registries.ENTITY_TYPE.get(index); + } + + public static Text getName(EntityType entityType) { + return entityType.getName(); + } + + public static String getTranslationKey(EntityType entityType) { + return entityType.getTranslationKey(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java new file mode 100644 index 000000000..8872d9f4a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java @@ -0,0 +1,364 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.network.packet.s2c.play.PositionFlag; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.text.Text; +import net.minecraft.util.BlockRotation; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; + +import java.util.UUID; + +public class EntityUtil { + public static World getWorld(Entity entity) { + return entity.getEntityWorld(); + } + + public static boolean damage(Entity target, DamageSource damageSource, float amount) { + return target.damage((ServerWorld) target.getEntityWorld(), damageSource, amount); + } + + public static boolean damageWithThrownProjectile(Entity target, float damageAmount, Entity projectile, Entity attacker) { + return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.thrownProjectile(projectile, attacker), damageAmount); + } + + public static boolean damageWithMobProjectile(Entity target, float damageAmount, Entity projectile, LivingEntity attacker) { + return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.mobProjectile(projectile, attacker), damageAmount); + } + + public static boolean damageWithMobAttack(Entity target, float damageAmount, Entity source, LivingEntity attacker) { + return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.mobAttack(attacker, source), damageAmount); + } + + public static boolean damageWithPlayerAttack(Entity target, float damageAmount, Entity source, Player attacker) { + return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.playerAttack(attacker, source), damageAmount); + } + + public static void discard(Entity entity) { + entity.discard(); + } + + public static void kill(Entity entity) { + if (entity.getEntityWorld() instanceof ServerWorld) + return; + + entity.kill((ServerWorld) entity.getEntityWorld()); + } + + public static void setVelocity(Entity entity, double x, double y, double z) { + entity.setVelocity(x, y, z); + } + + public static Vec3d getVelocity(Entity entity) { + return entity.getVelocity(); + } + + public static void setNoGravity(Entity entity, boolean noGravity) { + entity.setNoGravity(noGravity); + } + + public static boolean hasNoGravity(Entity entity) { + return entity.hasNoGravity(); + } + + public static void setInvulnerable(Entity entity, boolean invulnerable) { + entity.setInvulnerable(invulnerable); + } + + public static boolean isInvulnerable(Entity entity) { + return entity.isInvulnerable(); + } + + public static void setSilent(Entity entity, boolean silent) { + entity.setSilent(silent); + } + + public static boolean isSilent(Entity entity) { + return entity.isSilent(); + } + + public static void setGlowing(Entity entity, boolean glowing) { + entity.setGlowing(glowing); + } + + public static boolean isGlowing(Entity entity) { + return entity.isGlowing(); + } + + public static void setFire(Entity entity, int seconds) { + entity.setOnFireFor(seconds); + } + + public static void extinguish(Entity entity) { + entity.extinguish(); + } + + public static boolean isOnFire(Entity entity) { + return entity.isOnFire(); + } + + public static void setInvisible(Entity entity, boolean invisible) { + entity.setInvisible(invisible); + } + + public static boolean isInvisible(Entity entity) { + return entity.isInvisible(); + } + + public static void setSneaking(Entity entity, boolean sneaking) { + entity.setSneaking(sneaking); + } + + public static boolean isSneaking(Entity entity) { + return entity.isSneaking(); + } + + public static void setSprinting(Entity entity, boolean sprinting) { + entity.setSprinting(sprinting); + } + + public static boolean isSprinting(Entity entity) { + return entity.isSprinting(); + } + + public static void setSwimming(Entity entity, boolean swimming) { + entity.setSwimming(swimming); + } + + public static boolean isSwimming(Entity entity) { + return entity.isSwimming(); + } + + public static void detach(Entity entity) { + entity.detach(); + } + + public static void attach(Entity entity, Entity vehicle) { + entity.startRiding(vehicle, true, true); + } + + public static void detachFromVehicle(Entity entity) { + entity.stopRiding(); + } + + public static boolean isRiding(Entity entity) { + return entity.hasVehicle(); + } + + public static Entity getVehicle(Entity entity) { + return entity.getVehicle(); + } + + public static void setVehicle(Entity entity, Entity vehicle) { + entity.startRiding(vehicle, true, true); + } + + public static void applyRotation(Entity entity, BlockRotation rotation) { + entity.applyRotation(rotation); + } + + public static void setVelocity(Entity entity, Vec3d velocity) { + entity.setVelocity(velocity); + } + + public static void setFallDistance(Entity entity, double fallDistance) { + entity.fallDistance = fallDistance; + } + + public static double getFallDistance(Entity entity) { + return entity.fallDistance; + } + + public static void setVelocityModified(Entity entity, boolean velocityModified) { + entity.velocityDirty = velocityModified; + } + + public static boolean isVelocityModified(Entity entity) { + return entity.velocityDirty; + } + + public static float getYaw(Entity entity) { + return entity.getYaw(); + } + + public static float getPitch(Entity entity) { + return entity.getPitch(); + } + + public static void setYaw(Entity entity, float yaw) { + entity.setYaw(yaw); + } + + public static void setPitch(Entity entity, float pitch) { + entity.setPitch(pitch); + } + + public static float getSpeed(Entity entity) { + return entity.speed; + } + + public static void setSpeed(Entity entity, float speed) { + entity.speed = speed; + } + + public static boolean isOnGround(Entity entity) { + return entity.isOnGround(); + } + + public static void setOnGround(Entity entity, boolean onGround) { + entity.setOnGround(onGround); + } + + public static boolean isAlive(Entity entity) { + return entity.isAlive(); + } + + public static UUID getUuid(Entity entity) { + return entity.getUuid(); + } + + public static String getUuidString(Entity entity) { + return entity.getUuidAsString(); + } + + public static void setUuid(Entity entity, UUID uuid) { + entity.setUuid(uuid); + } + + public static Text getName(Entity entity) { + return entity.getName(); + } + + public static Text getDisplayName(Entity entity) { + return entity.getDisplayName(); + } + + public static void setCustomName(Entity entity, Text customName) { + entity.setCustomName(customName); + } + + public static Text getCustomName(Entity entity) { + return entity.getCustomName(); + } + + public static void setCustomNameVisible(Entity entity, boolean visible) { + entity.setCustomNameVisible(visible); + } + + public static boolean isCustomNameVisible(Entity entity) { + return entity.isCustomNameVisible(); + } + + public static boolean hasCustomName(Entity entity) { + return entity.hasCustomName(); + } + + public static String getNameAsString(Entity entity) { + return entity.getName().getString(); + } + + public static String getDisplayNameAsString(Entity entity) { + if (entity.getDisplayName() == null) + return null; + return entity.getDisplayName().getString(); + } + + public static String getCustomNameAsString(Entity entity) { + if (entity.getCustomName() == null) + return null; + return entity.getCustomName().getString(); + } + + public static void setCustomName(Entity entity, String customName) { + entity.setCustomName(TextUtil.literal(customName)); + } + + public static Vec3d getRotationVector(Entity entity) { + return entity.getRotationVector(); + } + + public static Vec3d getPos(Entity entity) { + return entity.getEntityPos(); + } + + public static Vector3d getPosM(Entity entity) { + return Vector3d.of(getPos(entity)); + } + + public static void setPos(Entity entity, double x, double y, double z) { + entity.setPos(x, y, z); + } + + public static void addVelocity(Entity entity, double x, double y, double z) { + entity.addVelocity(x, y, z); + } + + public static void addVelocity(Entity entity, Vec3d velocity) { + entity.addVelocity(velocity); + } + + public static void addVelocity(Entity entity, Vector3d velocity) { + addVelocity(entity, velocity.toMinecraft()); + } + + public static void setVelocity(Entity entity, Vector3d velocity) { + entity.setVelocity(velocity.toMinecraft()); + } + + public static void setPos(Entity entity, BlockPos pos) { + setPos(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void setPos(Entity entity, Vector3d pos) { + setPos(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + entity.teleport(world, x, y, z, PositionFlag.VALUES, yaw, pitch, resetCamera); + } + + public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch) { + teleport(entity, world, x, y, z, yaw, pitch, true); + } + + public static void teleport(Entity entity, ServerWorld world, double x, double y, double z) { + teleport(entity, world, x, y, z, entity.getYaw(), entity.getPitch(), true); + } + + public static void teleport(Entity entity, ServerWorld world, Vector3d pos) { + teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, ServerWorld world, BlockPos pos) { + teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, double x, double y, double z) { + if (!(entity.getEntityWorld() instanceof ServerWorld)) + return; + + teleport(entity, (ServerWorld) entity.getEntityWorld(), x, y, z, entity.getYaw(), entity.getPitch()); + } + + public static void teleport(Entity entity, Vector3d pos) { + teleport(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, BlockPos pos) { + teleport(entity, pos.getX(), pos.getY(), pos.getZ()); + } + + public static void teleport(Entity entity, ServerWorld world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { + teleport(entity, world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); + } + + public static void teleport(Entity entity, ServerWorld raw, BlockPos pos, float yaw, float pitch, boolean resetCamera) { + teleport(entity, raw, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java new file mode 100644 index 000000000..175bd2ba2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.item.ToolMaterial; +import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; +import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; + +public class EquipMaterialUtil { + @Deprecated + public static ToolMaterial createToolMaterial(int durability, float miningSpeedMultiplier, float attackDamage, int miningLevel, int enchantability, Ingredient repairIngredient) { + return new ToolMaterial(CompatibleToolMaterial.level2inverseTag(miningLevel), durability, miningSpeedMultiplier, attackDamage, enchantability, ItemTags.IRON_TOOL_MATERIALS); + } + + public static ToolMaterial createToolMaterial(int durability, float miningSpeedMultiplier, float attackDamage, int miningLevel, int enchantability, RepairIngredientTag ingredientTag) { + return new ToolMaterial(CompatibleToolMaterial.level2inverseTag(miningLevel), durability, miningSpeedMultiplier, attackDamage, enchantability, ingredientTag.getTag()); + } + + public static int toInt(ArmorEquipmentType type) { + switch (type.getSlot()) { + case HEAD: + return 0; + case CHEST: + return 1; + case LEGS: + return 2; + case FEET: + return 3; + default: + return 0; + } + } + + public static CompatibleArmorMaterial createArmorMaterial(int[] durability, int[] protection, int enchantability, SoundEvent equipSound, Ingredient repairIngredient, String name, float toughness, float knockbackResistance) { + return ArmorMaterialUtil.create(name, durability, protection, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); + } + + @Deprecated + public static CompatibleArmorMaterial createArmorMaterial(int[] durability, int[] protection, int enchantability, SoundEvent equipSound, Ingredient repairIngredient, Identifier id, float toughness, float knockbackResistance) { + return ArmorMaterialUtil.create(id, durability, protection, enchantability, equipSound, toughness, knockbackResistance, repairIngredient); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java new file mode 100644 index 000000000..5b2a4a017 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java @@ -0,0 +1,81 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.structure.rule.RuleTest; +import net.minecraft.structure.rule.TagMatchRuleTest; +import net.minecraft.world.gen.feature.ConfiguredFeature; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.OreFeatureConfig; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class FeatureConfigUtil { + + /** + * Create a new ConfiguredFeature + * @param oreFeatureConfig The ore feature config + * @return The new ConfiguredFeature + */ + public static ConfiguredFeature createConfiguredFeature(OreFeatureConfig oreFeatureConfig) { + return new ConfiguredFeature<>(Feature.ORE, oreFeatureConfig); + } + + /** + * Create a new OreFeatureConfig + * @param test The rule test + * @param state The block state + * @param size The size + * @return The new OreFeatureConfig + */ + public static OreFeatureConfig createOreFeatureConfig(RuleTest test, BlockState state, int size) { + return new OreFeatureConfig(test, state, size); + } + + /** + * Create a new OreFeatureConfig + * @param test The rule test + * @param block The block + * @param size The size + * @return The new OreFeatureConfig + */ + public static OreFeatureConfig createOreFeatureConfig(RuleTest test, Block block, int size) { + return createOreFeatureConfig(test, block.getDefaultState(), size); + } + + /** + * Create a new OreFeatureConfig + * @param targets The targets + * @param size The size + * @return The new OreFeatureConfig + */ + public static OreFeatureConfig createOreFeatureConfig(List targets, int size) { + return new OreFeatureConfig(targets, size); + } + + /** + * Create a new OreFeatureConfig + * @param targetMap The target map + * @param size The size + * @return The new OreFeatureConfig + */ + public static OreFeatureConfig createOreFeatureConfig(Map targetMap, int size) { + List targets = new ArrayList<>(); + targetMap.forEach((ruleTest, blockState) -> targets.add(OreFeatureConfig.createTarget(ruleTest, blockState))); + return createOreFeatureConfig(targets, size); + } + + /** + * Create a new OreFeatureConfig + * @param state The block state + * @param size The size + * @return The new OreFeatureConfig + */ + public static OreFeatureConfig createStoneOreFeatureConfig(BlockState state, int size) { + RuleTest ruleTest = new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD); + return createOreFeatureConfig(ruleTest, state, size); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java new file mode 100644 index 000000000..848547d07 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.BlockState; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.registry.tag.FluidTags; +import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class FluidStateUtil { + public static boolean isWater(FluidState state) { + return state.isIn(FluidTags.WATER); + } + + public static boolean isLava(FluidState state) { + return state.isIn(FluidTags.LAVA); + } + + @Deprecated + public static FluidState getFluidState(BlockState state) { + return state.getFluidState(); + } + + public static FluidState getDefaultState(Fluid state) { + return state.getDefaultState(); + } + + public static Fluid getFluid(FluidState state) { + return state.getFluid(); + } + + public static FluidWrapper getFluidWrapper(FluidState state) { + return FluidWrapper.of(getFluid(state)); + } + + public static FluidWrapper getFluidWrapper(BlockState state) { + return getFluidWrapper(getFluidState(state)); + } + + public static FluidWrapper getFluidWrapper(net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return getFluidWrapper(state.toMinecraft()); + } + + public static FluidWrapper getFluidWrapper(World world, BlockPos pos) { + return getFluidWrapper(world.getBlockState(pos)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java new file mode 100644 index 000000000..11814995c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java @@ -0,0 +1,109 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.fluid.FlowableFluid; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.fluid.Fluids; +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.world.WorldView; + +public class FluidUtil { + public static Identifier toID(Fluid fluid) { + return Registries.FLUID.getId(fluid); + } + + public static Fluid fromId(Identifier identifier) { + return Registries.FLUID.get(identifier); + } + + public static Fluid fromId(CompatIdentifier identifier) { + return fromId(identifier.toMinecraft()); + } + + public static int getRawId(Fluid fluid) { + return Registries.FLUID.getRawId(fluid); + } + + public static Fluid fromIndex(int index) { + return Registries.FLUID.get(index); + } + + public static boolean isExist(CompatIdentifier id) { + return Registries.FLUID.containsId(id.toMinecraft()); + } + + public static CompatIdentifier toCompatId(Fluid fluid) { + return CompatIdentifier.fromMinecraft(toID(fluid)); + } + + public static Fluid fromCompatId(CompatIdentifier id) { + return fromId(id.toMinecraft()); + } + + public static FlowableFluid water() { + return Fluids.WATER; + } + + public static FlowableFluid lava() { + return Fluids.LAVA; + } + + public static Fluid empty() { + return Fluids.EMPTY; + } + + public static FlowableFluid flowingWater() { + return Fluids.FLOWING_WATER; + } + + public static FlowableFluid flowingLava() { + return Fluids.FLOWING_LAVA; + } + + public static boolean isStill(Fluid fluid) { + return fluid == water() || fluid == lava(); + } + + public static boolean isStill(FluidState state) { + return state.isStill(); + } + + public static FluidState getStill(FlowableFluid fluid, boolean falling) { + return fluid.getStill(falling); + } + + public static FluidState getFlowing(FlowableFluid fluid, int level, boolean falling) { + return fluid.getFlowing(level, falling); + } + + public static FluidState getStill(FlowableFluid fluid) { + return getStill(fluid, false); + } + + public static FluidState getStillWater() { + return getStill(water()); + } + + public static FluidState getStillLava() { + return getStill(lava()); + } + + public static boolean isFlowing(Fluid fluid) { + return fluid == flowingWater() || fluid == flowingLava(); + } + + public static int getTickRate(Fluid fluid, WorldView world) { + return fluid.getTickRate(world); + } + + public static FluidState getDefaultState(Fluid fluid) { + return fluid.getDefaultState(); + } + + + public static Item getBucketItem(Fluid fluid) { + return fluid.getBucketItem(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java new file mode 100644 index 000000000..8690b4db9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.util.Hand; + +public class HandUtil { + public static Hand getOppositeHand(Hand hand) { + return hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND; + } + + public static EquipmentSlot getEquipmentSlot(Hand hand) { + return hand == Hand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; + } + + public static Hand getHand(EquipmentSlot slot) { + return slot == EquipmentSlot.MAINHAND ? Hand.MAIN_HAND : Hand.OFF_HAND; + } + + public static Hand getHand(boolean mainHand) { + return mainHand ? Hand.MAIN_HAND : Hand.OFF_HAND; + } + + public static boolean isMainHand(Hand hand) { + return hand == Hand.MAIN_HAND; + } + + public static boolean isOffHand(Hand hand) { + return hand == Hand.OFF_HAND; + } + + public static boolean isMainHand(EquipmentSlot slot) { + return slot == EquipmentSlot.MAINHAND; + } + + public static boolean isOffHand(EquipmentSlot slot) { + return slot == EquipmentSlot.OFFHAND; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java new file mode 100644 index 000000000..f4448af6d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.resources.Identifier; + +public class IdentifierUtil { + public static Identifier id(String id) { + return Identifier.of(id); + } + + public static Identifier id(String namespace, String path) { + return Identifier.of(namespace, path); + } + + public static String toString(Identifier identifier) { + return identifier.toString(); + } + + public static String getNamespace(Identifier identifier) { + return identifier.getNamespace(); + } + + public static String getPath(Identifier identifier) { + return identifier.getPath(); + } + + public static Identifier from(CompatIdentifier id) { + if (id == null) + return null; + + return id.toMinecraft(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java new file mode 100644 index 000000000..97c39bcd3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java @@ -0,0 +1,96 @@ +package net.pitan76.mcpitanlib.api.util; + +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import net.minecraft.item.Item; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.entry.RegistryEntryList; +import net.minecraft.resources.Identifier; +import net.minecraft.util.collection.DefaultedList; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class IngredientUtil { + public static Ingredient fromTagByIdentifier(Identifier id) { + List items = ItemUtil.getItems(id); + + List> entryList = new ArrayList<>(); + for (Item item : items) { + entryList.add(Registries.ITEM.getEntry(item)); + } + + RegistryEntryList entryList2 = RegistryEntryList.of(entryList); + + return Ingredient.ofTag(entryList2); + } + + public static Ingredient fromTagByString(String id) { + return fromTagByIdentifier(IdentifierUtil.id(id)); + } + + public static Ingredient fromTagByIdentifier(CompatIdentifier id) { + return fromTagByIdentifier(id.toMinecraft()); + } + + public static List getItems(Ingredient ingredient) { + List items = new ArrayList<>(); + + for (RegistryEntry entry : ingredient.getMatchingItems().toList()) { + items.add(entry.value()); + } + + return items; + } + + public static IntList getMatchingStacksIds(Ingredient ingredient) { + IntList ids = new IntArrayList(); + + for (Item item : getItems(ingredient)) { + ids.add(ItemUtil.getRawId(item)); + } + + return ids; + } + + public static List getMatchingStacksAsList(Ingredient ingredient) { + return new ArrayList<>(Arrays.asList(getMatchingStacks(ingredient))); + } + + public static ItemStack[] getMatchingStacks(Ingredient ingredient) { + List stacks = new ArrayList<>(); + for (Item item : getItems(ingredient)) { + stacks.add(new ItemStack(item)); + } + + return stacks.toArray(new ItemStack[0]); + } + + public static Ingredient empty() { + return null; + } + + public static Ingredient ofItems(ItemConvertible... items) { + return Ingredient.ofItems(items); + } + + public static DefaultedList buildInput(Object[] input) { + DefaultedList list = DefaultedList.of(); + for (Object obj : input) { + if (obj instanceof Ingredient) { + list.add((Ingredient) obj); + continue; + } + + if (obj instanceof ItemConvertible) { + list.add(ofItems((ItemConvertible) obj)); + } + } + return list; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java new file mode 100644 index 000000000..ec99294b9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java @@ -0,0 +1,56 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.BlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; +import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; +import net.pitan76.mcpitanlib.api.event.item.ItemUseOnEntityEvent; +import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; +import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; + +public class InteractUtil { + + public static StackActionResult useItem(Item item, ItemUseEvent event) { + CompatActionResult result = CompatActionResult.create(item.use(event.getWorld(), event.user.getEntity(), event.getHand())); + return StackActionResult.create(result, event.getStack()); + } + + public static CompatActionResult useItemOnBlock(Item item, ItemUsageContext context) { + return CompatActionResult.create(item.useOnBlock(context)); + } + + public static CompatActionResult useItemOnBlock(Item item, ItemUseOnBlockEvent event) { + return useItemOnBlock(item, event.toIUC()); + } + + public static CompatActionResult useItemOnEntity(Item item, ItemUseOnEntityEvent event) { + return CompatActionResult.create(item.useOnEntity(event.getStack(), event.getUser().getEntity(), event.getEntity(), event.getHand())); + } + + public static CompatUseAction getUseAction(Item item, UseActionArgs args) { + return CompatUseAction.of(item.getUseAction(args.stack)); + } + + public static CompatUseAction getUseAction(Item item, ItemStack stack) { + return CompatUseAction.of(item.getUseAction(stack)); + } + + public static CompatActionResult useBlock(BlockState state, World world, Player player, BlockHitResult hitResult) { + return BlockStateUtil.onUse(state, world, player, hitResult); + } + + public static CompatActionResult useBlock(BlockState state, World world, Player player, Direction dir, BlockPos blockPos) { + return BlockStateUtil.onUse(state, world, player, dir, blockPos); + } + + public static boolean onStoppingUsing(Item item, ItemStack stack, World world, Player player, int remainingUseTicks) { + return item.onStoppedUsing(stack, world, player.getEntity(), remainingUseTicks); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java new file mode 100644 index 000000000..8ff9c3eff --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java @@ -0,0 +1,202 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.inventory.Inventories; +import net.minecraft.inventory.Inventory; +import net.minecraft.inventory.SimpleInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.storage.NbtReadView; +import net.minecraft.storage.NbtWriteView; +import net.minecraft.storage.ReadView; +import net.minecraft.storage.WriteView; +import net.minecraft.util.ErrorReporter; +import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.nbt.NbtListUtil; +import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; + +public class InventoryUtil { + public static boolean insertItem(ItemStack insertStack, DefaultedList inventory) { + return insertItem(insertStack, inventory, false); + } + + public static boolean insertItem(ItemStack insertStack, DefaultedList inventory, boolean test) { + boolean isInserted = false; + for (int i = 0; i < inventory.size(); i++) { + ItemStack stack = inventory.get(i); + if (stack.isEmpty()) { + if (!test) inventory.set(i, insertStack); + isInserted = true; + break; + } else if (canMergeItems(stack, insertStack)) { + int j = insertStack.getCount(); + if (!test) stack.increment(j); + isInserted = j > 0; + break; + } + } + return isInserted; + + } + + public static boolean canMergeItems(ItemStack first, ItemStack second) { + if (!first.isOf(second.getItem())) { + return false; + } + if (first.getDamage() != second.getDamage()) { + return false; + } + if (first.getCount() + second.getCount() > first.getMaxCount()) { + return false; + } + return ItemStackUtil.areNbtOrComponentEqual(first, second); + } + + public static NbtCompound writeNbt(NbtRWArgs args, NbtCompound nbt, DefaultedList stacks, boolean setIfEmpty) { + boolean nbtNull = nbt == null; + + if (args instanceof WriteNbtArgs) { + WriteNbtArgs writeNbtArgs = (WriteNbtArgs) args; + if (writeNbtArgs.view == null) writeNbtArgs.view = NbtWriteView.create(ErrorReporter.EMPTY); + + Inventories.writeData(writeNbtArgs.view, stacks, setIfEmpty); + if (!nbtNull) + NbtUtil.put(nbt, "Items", NbtListUtil.create()); // dummy list to compat with old mod + + NbtDataConverter.data2nbt(writeNbtArgs.view, nbt); + return nbt; + } + + WriteView view = NbtDataConverter.nbt2writeData(nbt, args.registryLookup); + Inventories.writeData(view, stacks, setIfEmpty); + if (!nbtNull) + NbtUtil.put(nbt, "Items", NbtListUtil.create()); // dummy list to compat with old mod + + NbtDataConverter.data2nbt(view, nbt); + return nbt; + } + + public static void readNbt(NbtRWArgs args, NbtCompound nbt, DefaultedList stacks) { + if (args instanceof ReadNbtArgs) { + ReadNbtArgs readNbtArgs = (ReadNbtArgs) args; + if (readNbtArgs.view == null) return; + + Inventories.readData(readNbtArgs.view, stacks); + return; + } + + ReadView view = NbtDataConverter.nbt2readData(nbt, args.registryLookup); + Inventories.readData(view, stacks); + } + + public static NbtCompound writeNbt(NbtRWArgs args, DefaultedList stacks, boolean setIfEmpty) { + return writeNbt(args, args.getNbt(), stacks, setIfEmpty); + } + + public static NbtCompound writeNbt(NbtRWArgs args, DefaultedList stacks) { + return writeNbt(args, stacks, true); + } + + public static void readNbt(NbtRWArgs args, DefaultedList stacks) { + readNbt(args, args.getNbt(), stacks); + } + + public static void readNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks) { + ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); + Inventories.readData(view, stacks); + } + + public static NbtCompound writeNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks, boolean setIfEmpty) { + NbtUtil.put(nbt, "Items", NbtListUtil.create()); + WriteView view = NbtDataConverter.nbt2writeData(nbt, registryLookup); + Inventories.writeData(view, stacks, setIfEmpty); + + NbtDataConverter.data2nbt(view, nbt); + + System.out.println("writeNbt(): " + nbt); + + return nbt; + } + + public static NbtCompound writeNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks) { + return writeNbt(registryLookup, nbt, stacks, true); + } + + // deprecated + /** + * @deprecated Use {@link #writeNbt(NbtRWArgs, DefaultedList)} instead + */ + @Deprecated + public static NbtCompound writeNbt(World world, NbtCompound nbt, DefaultedList stacks) { + return writeNbt(world, nbt, true, stacks); + } + + /** + * @deprecated Use {@link #writeNbt(NbtRWArgs, DefaultedList, boolean)} instead + */ + @Deprecated + public static NbtCompound writeNbt(World world, NbtCompound nbt, boolean setIfEmpty, DefaultedList stacks) { + return writeNbt(new NbtRWArgs(nbt), stacks, setIfEmpty); + } + + /** + * @deprecated Use {@link #readNbt(NbtRWArgs, DefaultedList)} instead + */ + @Deprecated + public static void readNbt(World world, NbtCompound nbt, DefaultedList stacks) { + readNbt(new ReadNbtArgs(nbt), stacks); + } + // ---- + + public static SimpleInventory createSimpleInventory(int size) { + return new SimpleInventory(size); + } + + public static void copyToInv(DefaultedList from, Inventory to) { + for (int i = 0; i < from.size(); i++) { + to.setStack(i, from.get(i)); + } + } + + public static void copyToList(Inventory from, DefaultedList to) { + for (int i = 0; i < from.size(); i++) { + to.set(i, from.getStack(i)); + } + } + + public static int getSize(Inventory inventory) { + return inventory.size(); + } + + public static ItemStack getStack(Inventory inventory, int slot) { + return inventory.getStack(slot); + } + + public static void setStack(Inventory inventory, int slot, ItemStack stack) { + inventory.setStack(slot, stack); + } + + public static boolean isEmpty(Inventory inventory) { + return inventory.isEmpty(); + } + + public static ItemStack removeStack(Inventory inventory, int slot) { + return inventory.removeStack(slot); + } + + public static ItemStack removeStack(Inventory inventory, int slot, int amount) { + return inventory.removeStack(slot, amount); + } + + public static void clear(Inventory inventory) { + inventory.clear(); + } + + public static void markDirty(Inventory inventory) { + inventory.markDirty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java new file mode 100644 index 000000000..4e592d9b3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java @@ -0,0 +1,193 @@ +package net.pitan76.mcpitanlib.api.util; + +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.DataResult; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtOps; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +import java.util.Objects; +import java.util.Optional; + +public class ItemStackUtil { + public static ItemStack copy(ItemStack stack) { + return stack.copy(); + } + + public static ItemStack copyWithCount(ItemStack stack, int count) { + return stack.copyWithCount(count); + } + + public static boolean areItemsEqual(ItemStack left, ItemStack right) { + return ItemStack.areItemsEqual(left, right); + } + + @Deprecated + public static boolean areNbtEqual(ItemStack left, ItemStack right) { + return areNbtOrComponentEqual(left, right); + } + + /** + * NBT (1.20.4) か Component (1.20.5以降) が一致するかどうかを取得する。 + * @param left ItemStack + * @param right ItemStack + * @return NBTかComponentが一致するかどうか + */ + public static boolean areNbtOrComponentEqual(ItemStack left, ItemStack right) { + return Objects.equals(left.getComponents(), right.getComponents()); + } + + /** + * NBTかComponentが存在するかどうか + * @param stack ItemStack + * @return Whether NBT or Component exists + */ + public static boolean hasNbtOrComponent(ItemStack stack) { + return !stack.getComponents().isEmpty(); + } + + /** + * NBTからItemStackを取得する + * @param world World + * @param nbt NbtCompound + * @return ItemStack + */ + public static ItemStack fromNbt(World world, NbtCompound nbt) { + return fromNbt(new ReadNbtArgs(nbt)); + } + + /** + * NBTからItemStackを取得する + * @param args NbtRWArgs + * @return ItemStack + */ + public static ItemStack fromNbt(NbtRWArgs args) { + DataResult> result = ItemStack.CODEC.decode(NbtOps.INSTANCE, args.nbt); + if (result.error().isPresent()) return ItemStack.EMPTY; + + Pair pair = result.result().orElseThrow(); + return pair.getFirst(); + } + + public static ItemStack getDefaultStack(Item item) { + return item.getDefaultStack(); + } + + public static int getMaxDamage(ItemStack stack) { + return stack.getMaxDamage(); + } + + public static int getMaxDamage(Item item) { + return getMaxDamage(getDefaultStack(item)); + } + + public static int getDamage(ItemStack stack) { + return stack.getDamage(); + } + + public static void setDamage(ItemStack stack, int damage) { + stack.setDamage(damage); + } + + public static int getCount(ItemStack stack) { + return stack.getCount(); + } + + public static void setCount(ItemStack stack, int count) { + stack.setCount(count); + } + + public static void decrementCount(ItemStack stack, int count) { + stack.decrement(count); + } + + public static void incrementCount(ItemStack stack, int count) { + stack.increment(count); + } + + public static void damage(ItemStack stack, int amount, ServerPlayerEntity entity, Runnable breakCallback) { + stack.damage(amount, entity.getEntityWorld(), entity, (item) -> breakCallback.run()); + } + + public static void damage(ItemStack stack, int amount, LivingEntity entity, EquipmentSlot slot) { + stack.damage(amount, entity, slot); + } + + public static void damage(ItemStack stack, int amount, ServerPlayerEntity entity) { + stack.damage(amount, entity.getEntityWorld(), entity, (item) -> entity.sendEquipmentBreakStatus(item, EquipmentSlot.MAINHAND)); + } + + public static void damage(ItemStack stack, int amount, Player entity) { + Optional player = entity.getServerPlayer(); + if (player.isEmpty()) return; + + damage(stack, amount, player.get()); + } + + public static ItemStack empty() { + return ItemStack.EMPTY; + } + + public static ItemStack create(Item item) { + if (item == null) return empty(); + return new ItemStack(item); + } + + public static ItemStack create(Item item, int count) { + if (item == null) return empty(); + return new ItemStack(item, count); + } + + public static ItemStack create(ItemConvertible item) { + if (item == null) return empty(); + return new ItemStack(item); + } + + public static ItemStack create(ItemConvertible item, int count) { + if (item == null) return empty(); + return new ItemStack(item, count); + } + + public static boolean isEmpty(ItemStack stack) { + if (stack == null) return true; + return stack.isEmpty(); + } + + public static boolean isEnchantable(ItemStack stack) { + return stack.isEnchantable(); + } + + public static boolean isDamageable(ItemStack stack) { + return stack.isDamageable(); + } + + public static boolean isBreak(ItemStack stack) { + if (isDamageable(stack)) + return getDamage(stack) >= getMaxDamage(stack); + + return false; + } + + public static ItemWrapper getItemWrapper(ItemStack stack) { + return ItemWrapper.of(stack.getItem()); + } + + public static int getMaxCount(ItemStack stack) { + return stack.getMaxCount(); + } + + public static Item getItem(ItemStack stack) { + return stack.getItem(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java new file mode 100644 index 000000000..6d67532f7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java @@ -0,0 +1,275 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.item.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.v1.ItemUtilV1; +import net.pitan76.mcpitanlib.api.util.v2.ItemUtilV2; + +import java.util.List; + +@Deprecated +public class ItemUtil { + + /** + * Get item from Identifier. + * @param id Identifier of the item. + * @return Item of the Identifier. + */ + public static Item item(Identifier id) { + return ItemUtilV1.item(id); + } + + /** + * Check if two items are equal. + * @param item Item to compare. + * @param item2 Item to compare. + * @return If two items are equal. + */ + public static boolean isEqual(Item item, Item item2) { + return ItemUtilV1.isEqual(item, item2); + } + + /** + * Check if the item is of the given item. + * @param stack ItemStack to check. + * @param item Item to check. + * @return If the item is of the given item. + */ + public static boolean isOf(ItemStack stack, Item item) { + return ItemUtilV1.isOf(stack, item); + } + + /** + * Check if the item is in the tag. (MCPitanLib TagKey) + * @param stack ItemStack to check. + * @param tagKey TagKey of the tag. + * @return If the item is in the tag. + */ + public static boolean isIn(ItemStack stack, TagKey tagKey) { + return ItemUtilV1.isIn(stack, tagKey); + } + + /** + * Check if the item is in the tag. (MCPitanLib TagKey) + * @param item Item to check. + * @param tagKey TagKey of the tag. + * @return If the item is in the tag. + */ + public static boolean isIn(Item item, TagKey tagKey) { + return ItemUtilV1.isIn(item, tagKey); + } + + /** + * Check if the item is existed. + * @param identifier Identifier of the item. + * @return If the item is existed. + */ + public static boolean isExist(Identifier identifier) { + return ItemUtilV1.isExist(identifier); + } + + /** + * Get Identifier from Item. + * @param item Item to get Identifier. + * @return Identifier of the Item. + */ + public static Identifier toID(Item item) { + return ItemUtilV1.toID(item); + } + + /** + * Get item from Identifier. + * @param identifier Identifier of the item. + * @return Item of the Identifier. + */ + public static Item fromId(Identifier identifier) { + return ItemUtilV1.fromId(identifier); + } + + /** + * Get CompatIdentifier from Item. + * @param item Item to get CompatIdentifier. + * @return CompatIdentifier of the Item. + */ + public static CompatIdentifier toCompatID(Item item) { + return CompatIdentifier.fromMinecraft(toID(item)); + } + + /** + * Get item from CompatIdentifier. + * @param identifier CompatIdentifier of the item. + * @return Item of the CompatIdentifier. + */ + public static Item fromId(CompatIdentifier identifier) { + return fromId(identifier.toMinecraft()); + } + + /** + * Check if the item is existed. + * @param identifier CompatIdentifier of the item. + * @return If the item is existed. + */ + public static boolean isExist(CompatIdentifier identifier) { + return isExist(identifier.toMinecraft()); + } + + /** + * Create BlockItem from Block and Item.Settings. + * @param block Block to create BlockItem. + * @param settings Item.Settings to create BlockItem. + * @return BlockItem created from Block and Item.Settings. + */ + @Deprecated + public static BlockItem ofBlock(Block block, Item.Settings settings) { + return ItemUtilV1.ofBlock(block, settings); + } + + /** + * Create BlockItem from Block and CompatibleItemSettings. + * @param block Block to create BlockItem. + * @param settings CompatibleItemSettings to create BlockItem. + * @return BlockItem created from Block and CompatibleItemSettings. + */ + public static BlockItem ofBlock(Block block, CompatibleItemSettings settings) { + return ItemUtilV1.ofBlock(block, settings); + } + + /** + * Create Item from Item.Settings. + * @param settings Item.Settings to create Item. + * @return Item created from Item.Settings. + */ + @Deprecated + public static Item of(Item.Settings settings) { + return ItemUtilV1.of(settings); + } + + /** + * Create Item from CompatibleItemSettings. + * @param settings CompatibleItemSettings to create Item. + * @return Item created from CompatibleItemSettings. + */ + public static Item of(CompatibleItemSettings settings) { + return ItemUtilV1.of(settings); + } + + /** + * Get all items. + * @return List of all items. + */ + public static List getAllItems() { + return ItemUtilV1.getAllItems(); + } + + /** + * Get raw id of the item. + * @param item Item to get raw id. + * @return Raw id of the item. + */ + public static int getRawId(Item item) { + return ItemUtilV1.getRawId(item); + } + + /** + * Get item from index. + * @param index Index of the item. + * @return Item of the index. + */ + public static Item fromIndex(int index) { + return ItemUtilV1.fromIndex(index); + } + + /** + * Get all items in the tag. (MCPitanLib TagKey) + * @param tagKey TagKey of the tag. + * @return List of items in the tag. + */ + public static List getItems(TagKey tagKey) { + return ItemUtilV2.getItems(tagKey); + } + + /** + * Get given the list of items in the tag. (MCPitanLib TagKey) + * @param tagKey TagKey of the tag. + * @param items List of items to search. + * @return List of items in the tag. + */ + public static List getItems(TagKey tagKey, List items) { + return ItemUtilV2.getItems(tagKey, items); + } + + /** + * Get all items in the tag. + * @param identifier Identifier of the tag. + * @return List of items in the tag. + */ + public static List getItems(Identifier identifier) { + return ItemUtilV2.getItems(identifier); + } + + /** + * Get given the list of items in the tag. + * @param identifier Identifier of the tag. + * @param items List of items to search. + * @return List of items in the tag. + */ + public static List getItems(Identifier identifier, List items) { + return ItemUtilV2.getItems(identifier, items); + } + + public static List getItems(CompatIdentifier identifier) { + return getItems(identifier.toMinecraft()); + } + + public static List getItems(CompatIdentifier identifier, List items) { + return getItems(identifier.toMinecraft(), items); + } + + /** + * Get all items in the tag. + * @param id String of the tag. + * @return List of items in the tag. + */ + public static List getItems(String id) { + return ItemUtilV2.getItems(id); + } + + /** + * Get given the list of items in the tag. + * @param id String of the tag. + * @param items List of items to search. + * @return List of items in the tag. + */ + public static List getItems(String id, List items) { + return ItemUtilV2.getItems(id, items); + } + + /** + * Check if the item is in the tag. + * @param item Item to check. + * @param identifier Identifier of the tag. + * @return If the item is in the tag. + */ + public static boolean isItemInTag(Item item, Identifier identifier) { + return ItemUtilV2.isItemInTag(item, identifier); + } + + public static boolean isItemInTag(Item item, CompatIdentifier identifier) { + return isItemInTag(item, identifier.toMinecraft()); + } + + /** + * Check if the item is in the tag. + * @param item Item to check. + * @param id String of the tag. + * @return If the item is in the tag. + */ + public static boolean isItemInTag(Item item, String id) { + return ItemUtilV2.isItemInTag(item, id); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java b/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java new file mode 100644 index 000000000..00967c3cb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java @@ -0,0 +1,190 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; + +public class Logger { + public String name = ""; + + public boolean usingPrefix = true; + + private final org.apache.logging.log4j.Logger logger; + + public Logger(String name) { + this.name = name; + this.logger = LoggerUtil.getLogger(name); + } + + public Logger() { + this.logger = LoggerUtil.getLogger(); + } + + public Logger(Class clazz) { + this.logger = LoggerUtil.getLogger(clazz); + } + + public Logger(String name, boolean usePrefix) { + this(name); + usePrefix(usePrefix); + } + + public org.apache.logging.log4j.Logger getLogger() { + return logger; + } + + public void info(String message) { + LoggerUtil.info(logger, message); + } + + public void warn(String message) { + LoggerUtil.warn(logger, message); + } + + public void error(String message) { + LoggerUtil.error(logger, message); + } + + public void debug(String message) { + LoggerUtil.debug(logger, message); + } + + public void infoIfDev(String message) { + if (!PlatformUtil.isDevelopmentEnvironment()) return; + LoggerUtil.debug(logger, message); + } + + public void trace(String message) { + LoggerUtil.trace(logger, message); + } + + // ---- + + public void error(Exception e) { + error(e.getMessage()); + } + + public void initializeMessage() { + info(prefix() + "Initializing..."); + } + + public void initializedMessage() { + info(prefix() + "Initialized"); + } + + public String prefix() { + if (name.isEmpty() || !isUsingPrefix()) + return ""; + + return "[" + name + "] "; + } + + public void usePrefix(boolean use) { + usingPrefix = use; + } + + public boolean isUsingPrefix() { + return usingPrefix; + } + + /** + * Log message + * @param message log message + * @param isDebug if true, log as debug + */ + public void log(String message, boolean isDebug) { + if (isDebug) { + debug(message); + return; + } + info(message); + } + + public void log_onClientTick(int tick, String message, boolean isDebug) { + if (!PlatformUtil.isClient()) return; + long time = ClientUtil.getRenderTime(); + if (time % tick != 0) return; + + log(message, isDebug); + } + + public void log_onWorldTick(int tick, String message, World world, boolean isDebug) { + long time = WorldUtil.getTime(world); + if (time % tick != 0) return; + + log(message, isDebug); + } + + public void log_onSystemTick(int tick, String message, boolean isDebug) { + long millis = System.currentTimeMillis(); + long time = millis / 1000 * 60; + + if (time % tick != 0) return; + + log(message, isDebug); + } + + public void log_onClientTick(int tick, String message) { + log_onClientTick(tick, message, false); + } + + public void log_onWorldTick(int tick, String message, World world) { + log_onWorldTick(tick, message, world, false); + } + + public void log_onSystemTick(int tick, String message) { + log_onSystemTick(tick, message, false); + } + + /** + * Log message every second on ClientTick + * @param message log message + * @param isDebug if true, log as debug + */ + public void log_onClientTick(String message, boolean isDebug) { + log_onClientTick(60, message, isDebug); + } + + /** + * Log message every second on WorldTick + * @param message log message + * @param world world + * @param isDebug if true, log as debug + */ + public void log_onWorldTick(String message, World world, boolean isDebug) { + log_onWorldTick(60, message, world, isDebug); + } + + /** + * Log message every second on SystemTick + * @param message log message + * @param isDebug if true, log as debug + */ + public void log_onSystemTick(String message, boolean isDebug) { + log_onSystemTick(60, message, isDebug); + } + + /** + * Log message every second on ClientTick + * @param message log message + */ + public void log_onClientTick(String message) { + log_onClientTick(message, false); + } + + /** + * Log message every second on WorldTick + * @param message log message + * @param world world + */ + public void log_onWorldTick(String message, World world) { + log_onWorldTick(message, world, false); + } + + /** + * Log message every second on SystemTick + * @param message log message + */ + public void log_onSystemTick(String message) { + log_onSystemTick(message, false); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java new file mode 100644 index 000000000..666a367b5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.util; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LoggerUtil { + public static Logger getLogger(String name) { + return LogManager.getLogger(name); + } + + public static Logger getLogger(Class clazz) { + return LogManager.getLogger(clazz); + } + + public static Logger getLogger() { + return LogManager.getLogger(); + } + + public static void info(Logger logger, String message) { + logger.info(message); + } + + public static void warn(Logger logger, String message) { + logger.warn(message); + } + + public static void error(Logger logger, String message) { + logger.error(message); + } + + public static void debug(Logger logger, String message) { + logger.debug(message); + } + + public static void trace(Logger logger, String message) { + logger.trace(message); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java new file mode 100644 index 000000000..7ec6e5315 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.SharedConstants; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; + +public class MCVersionUtil { + + public static int getProtocolVersion() { + return SharedConstants.getProtocolVersion(); + } + + public static String getGameVersion() { + return ClientUtil.getClient().getGameVersion(); + } + + public static boolean isSupportedComponent() { + return SharedConstants.getProtocolVersion() >= 766; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java new file mode 100644 index 000000000..2cb21eb12 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java @@ -0,0 +1,33 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.util.math.RotationAxis; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import org.joml.Quaternionf; + +public class MathUtil { + + public static CompatRandom createRandom(long seed) { + return CompatRandom.of(seed); + } + + public static CompatRandom createRandom() { + return CompatRandom.of(); + } + + @Deprecated + public static Quaternionf getRotationDegrees(RotationAxisType type, float deg) { + return type.axis.rotationDegrees(deg); + } + + public static class RotationAxisType { + + public static RotationAxisType POSITIVE_X = new RotationAxisType(RotationAxis.POSITIVE_X); + public static RotationAxisType POSITIVE_Y = new RotationAxisType(RotationAxis.POSITIVE_Y); + public static RotationAxisType POSITIVE_Z = new RotationAxisType(RotationAxis.POSITIVE_Z); + + protected final RotationAxis axis; + protected RotationAxisType(RotationAxis axis) { + this.axis = axis; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java new file mode 100644 index 000000000..0a95c4ffe --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java @@ -0,0 +1,560 @@ +package net.pitan76.mcpitanlib.api.util; + +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.DataResult; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.math.PosUtil; +import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; +import net.pitan76.mcpitanlib.api.util.math.Vec3iUtil; + +import java.util.Optional; +import java.util.Set; +import java.util.UUID; + +public class NbtUtil { + + /** + * 新しいNbtCompoundを作成する。 + * @return NbtCompound + */ + public static NbtCompound create() { + return new NbtCompound(); + } + + /** + * 値を設定する。 + * @param nbt NbtCompound + * @param key キー + * @param value 値 + */ + public static void put(NbtCompound nbt, String key, NbtCompound value) { + nbt.put(key, value); + } + + /** + * 値を設定する。 + * @param nbt NbtCompound + * @param key キー + * @param value 値 + */ + public static void put(NbtCompound nbt, String key, NbtElement value) { + nbt.put(key, value); + } + + /** + * 値を取得する。 + * @param nbt NbtCompound + * @param key キー + * @return 値 + */ + public static NbtCompound get(NbtCompound nbt, String key) { + return nbt.getCompoundOrEmpty(key); + } + + /** + * 値を削除する。 + * @param nbt NbtCompound + * @param key キー + */ + public static void remove(NbtCompound nbt, String key) { + nbt.remove(key); + } + + /** + * 値が存在するかどうかを取得する。 + * @param nbt NbtCompound + * @param key キー + * @return 値が存在するかどうか + */ + public static boolean has(NbtCompound nbt, String key) { + return nbt.contains(key); + } + + /** + * 指定した型の値を取得する + * @param nbt NbtCompound + * @param key キー + * @param clazz クラス + * @param 値 + */ + public static T get(NbtCompound nbt, String key, Class clazz) { + if (clazz == Integer.class) { + return (T) Integer.valueOf(nbt.getInt(key, 0)); + } + if (clazz == String.class) { + return (T) nbt.getString(key).orElse(""); + } + if (clazz == Boolean.class) { + return (T) Boolean.valueOf(nbt.getBoolean(key, false)); + } + if (clazz == Float.class) { + return (T) Float.valueOf(nbt.getFloat(key, 0f)); + } + if (clazz == Double.class) { + return (T) Double.valueOf(nbt.getDouble(key, 0d)); + } + if (clazz == Long.class) { + return (T) Long.valueOf(nbt.getLong(key, 0l)); + } + if (clazz == NbtCompound.class) { + return (T) nbt.getCompoundOrEmpty(key); + } + if (clazz == NbtList.class) { + return (T) nbt.get(key); + } + if (clazz == Byte.class) { + return (T) Byte.valueOf(nbt.getByte(key, (byte) 0)); + } + if (clazz == Short.class) { + return (T) Short.valueOf(nbt.getShort(key, (short) 0)); + } + if (clazz == UUID.class) { + return (T) UUID.fromString(nbt.getString(key).orElse("")); + } + return null; + } + + /** + * 値を設定する。 + * @param nbt NbtCompound + * @param key キー + * @param value 値 + */ + public static void set(NbtCompound nbt, String key, T value) { + if (value instanceof Integer) { + nbt.putInt(key, (Integer) value); + return; + } + if (value instanceof String) { + nbt.putString(key, (String) value); + return; + } + if (value instanceof Boolean) { + nbt.putBoolean(key, (Boolean) value); + return; + } + if (value instanceof Float) { + nbt.putFloat(key, (Float) value); + return; + } + if (value instanceof Double) { + nbt.putDouble(key, (Double) value); + return; + } + if (value instanceof Long) { + nbt.putLong(key, (Long) value); + return; + } + if (value instanceof NbtCompound) { + nbt.put(key, (NbtCompound) value); + return; + } + if (value instanceof NbtList) { + nbt.put(key, (NbtList) value); + return; + } + if (value instanceof Byte) { + nbt.putByte(key, (Byte) value); + return; + } + if (value instanceof Short) { + nbt.putShort(key, (Short) value); + return; + } + if (value instanceof UUID) { + nbt.putString(key, value.toString()); + return; + } + } + + /** + * キーの一覧を取得する。 + * @param nbt NbtCompound + * @return キーの一覧 + */ + public static Set getKeys(NbtCompound nbt) { + return nbt.getKeys(); + } + + /** + * NbtListを取得する。 + * @return NbtList + */ + public static NbtList getList(NbtCompound nbt, String key) { + return (NbtList) nbt.get(key); + } + + /** + * NbtListを取得する。 + * @return NbtList + */ + public static NbtList getList(NbtCompound nbt, String key, int type) { + return nbt.getListOrEmpty(key); + } + + /** + * NbtCompoundのリストを取得する。 + * @return NbtList + */ + public static NbtList getNbtCompoundList(NbtCompound nbt, String key) { + return nbt.getListOrEmpty(key); + } + + /** + * NbtCompoundをコピーする。 + * @return NbtCompound + */ + public static NbtCompound copy(NbtCompound nbt) { + return nbt.copy(); + } + + // Helper methods + + public static void putInt(NbtCompound nbt, String key, int value) { + set(nbt, key, value); + } + + public static int getInt(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, Integer.class); + return 0; + } + + public static void putString(NbtCompound nbt, String key, String value) { + set(nbt, key, value); + } + + public static String getString(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, String.class); + return ""; + } + + public static void putBoolean(NbtCompound nbt, String key, boolean value) { + set(nbt, key, value); + } + + public static boolean getBoolean(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, Boolean.class); + return false; + } + + public static void putFloat(NbtCompound nbt, String key, float value) { + set(nbt, key, value); + } + + public static float getFloat(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, Float.class); + return 0; + } + + public static void putDouble(NbtCompound nbt, String key, double value) { + set(nbt, key, value); + } + + public static double getDouble(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, Double.class); + return 0; + } + + public static void putLong(NbtCompound nbt, String key, long value) { + set(nbt, key, value); + } + + public static long getLong(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, Long.class); + return 0; + } + + public static void putByte(NbtCompound nbt, String key, byte value) { + set(nbt, key, value); + } + + public static byte getByte(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, Byte.class); + return 0; + } + + public static void putShort(NbtCompound nbt, String key, short value) { + set(nbt, key, value); + } + + public static short getShort(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, Short.class); + return 0; + } + + public static void putUuid(NbtCompound nbt, String key, UUID value) { + set(nbt, key, value); + } + + public static UUID getUuid(NbtCompound nbt, String key) { + if (has(nbt, key)) + return get(nbt, key, UUID.class); + return null; + } + + /** + * BlockPosを設定する。 + * key: { + * "x": pos.getX(), + * "y": pos.getY(), + * "z": pos.getZ() + * } + * + * @param nbt NbtCompound + * @param key キー + * @param pos BlockPos + */ + public static void setBlockPos(NbtCompound nbt, String key, BlockPos pos) { + NbtCompound posNbt = create(); + putInt(posNbt, "x", pos.getX()); + putInt(posNbt, "y", pos.getY()); + putInt(posNbt, "z", pos.getZ()); + put(nbt, key, posNbt); + } + + /** + * BlockPosを取得する。 + * + * @param nbt NbtCompound + * @param key キー + * @return BlockPos + */ + public static BlockPos getBlockPos(NbtCompound nbt, String key) { + NbtCompound posNbt = get(nbt, key); + return PosUtil.flooredBlockPos(getInt(posNbt, "x"), getInt(posNbt, "y"), getInt(posNbt, "z")); + } + + public static void putVec3i(NbtCompound nbt, String key, Vec3i vec3i) { + NbtCompound vec3iNbt = create(); + putInt(vec3iNbt, "x", vec3i.getX()); + putInt(vec3iNbt, "y", vec3i.getY()); + putInt(vec3iNbt, "z", vec3i.getZ()); + put(nbt, key, vec3iNbt); + } + + public static Vec3i getVec3i(NbtCompound nbt, String key) { + NbtCompound vec3iNbt = get(nbt, key); + return Vec3iUtil.create(getInt(vec3iNbt, "x"), getInt(vec3iNbt, "y"), getInt(vec3iNbt, "z")); + } + + public static void putVec3d(NbtCompound nbt, String key, Vec3d vec3d) { + NbtCompound vec3dNbt = create(); + putDouble(vec3dNbt, "x", vec3d.getX()); + putDouble(vec3dNbt, "y", vec3d.getY()); + putDouble(vec3dNbt, "z", vec3d.getZ()); + put(nbt, key, vec3dNbt); + } + + public static Vec3d getVec3d(NbtCompound nbt, String key) { + NbtCompound vec3dNbt = get(nbt, key); + return Vec3dUtil.create(getDouble(vec3dNbt, "x"), getDouble(vec3dNbt, "y"), getDouble(vec3dNbt, "z")); + } + + public static void putItemStack(NbtCompound nbt, String key, ItemStack stack, CompatRegistryLookup registryLookup) { + DataResult dataResult = ItemStack.CODEC.encodeStart(NbtOps.INSTANCE, stack); + put(nbt, key, dataResult.getOrThrow()); + } + + public static Optional getItemStack(NbtCompound nbt, String key, CompatRegistryLookup registryLookup) { + NbtElement stackNbt = get(nbt, key); + DataResult> dataResult = ItemStack.CODEC.decode(NbtOps.INSTANCE, stackNbt); + if (dataResult.error().isPresent()) return Optional.empty(); + + Pair pair = dataResult.getOrThrow(); + return Optional.ofNullable(pair.getFirst()); + } + + public static void putSimpleItemStack(NbtCompound nbt, String key, ItemStack stack) { + NbtCompound stackNbt = create(); + putString(stackNbt, "id", ItemUtil.toID(stack.getItem()).toString()); + putByte(stackNbt, "Count", (byte) ItemStackUtil.getCount(stack)); + + NbtCompound tagNbt = create(); + NbtCompound componentsNbt = create(); + put(componentsNbt, "minecraft:custom_data", CustomDataUtil.getOrCreateNbt(stack)); + put(tagNbt, "components", componentsNbt); + put(stackNbt, "tag", tagNbt); + put(nbt, key, stackNbt); + } + + public static Optional getSimpleItemStack(NbtCompound nbt, String key) { + if (!has(nbt, key)) return Optional.empty(); + NbtCompound stackNbt = get(nbt, key); + + if (!has(stackNbt, "id") || !has(stackNbt, "Count")) return Optional.empty(); + Item item = ItemUtil.fromId(CompatIdentifier.of(getString(stackNbt, "id"))); + int count = getByte(stackNbt, "Count"); + + ItemStack stack = ItemStackUtil.create(item, count); + + if (has(stackNbt, "tag")) { + NbtCompound tagNbt = get(stackNbt, "tag"); + if (has(tagNbt, "components")) { + NbtCompound componentsNbt = get(tagNbt, "components"); + if (has(componentsNbt, "minecraft:custom_data")) { + CustomDataUtil.setNbt(stack, get(componentsNbt, "minecraft:custom_data")); + } + } + } + + return Optional.of(stack); + } + + public static NbtList createNbtList() { + return new NbtList(); + } + + public static int getIntOrDefault(NbtCompound nbt, String key, int defaultValue) { + if (has(nbt, key)) + return getInt(nbt, key); + return defaultValue; + } + + public static String getStringOrDefault(NbtCompound nbt, String key, String defaultValue) { + if (has(nbt, key)) + return getString(nbt, key); + return defaultValue; + } + + public static boolean getBooleanOrDefault(NbtCompound nbt, String key, boolean defaultValue) { + if (has(nbt, key)) + return getBoolean(nbt, key); + return defaultValue; + } + + public static float getFloatOrDefault(NbtCompound nbt, String key, float defaultValue) { + if (has(nbt, key)) + return getFloat(nbt, key); + return defaultValue; + } + + public static double getDoubleOrDefault(NbtCompound nbt, String key, double defaultValue) { + if (has(nbt, key)) + return getDouble(nbt, key); + return defaultValue; + } + + public static long getLongOrDefault(NbtCompound nbt, String key, long defaultValue) { + if (has(nbt, key)) + return getLong(nbt, key); + return defaultValue; + } + + public static byte getByteOrDefault(NbtCompound nbt, String key, byte defaultValue) { + if (has(nbt, key)) + return getByte(nbt, key); + return defaultValue; + } + + public static short getShortOrDefault(NbtCompound nbt, String key, short defaultValue) { + if (has(nbt, key)) + return getShort(nbt, key); + return defaultValue; + } + + public static UUID getUuidOrDefault(NbtCompound nbt, String key, UUID defaultValue) { + if (has(nbt, key)) + return getUuid(nbt, key); + return defaultValue; + } + + public static NbtElement getElement(NbtCompound nbt, String key) { + return nbt.get(key); + } + + public static void putElement(NbtCompound nbt, String key, NbtElement element) { + nbt.put(key, element); + } + + public static void setBlockPosDirect(NbtCompound nbt, BlockPos pos) { + putInt(nbt, "x", pos.getX()); + putInt(nbt, "y", pos.getY()); + putInt(nbt, "z", pos.getZ()); + } + + public static BlockPos getBlockPosDirect(NbtCompound nbt) { + return PosUtil.flooredBlockPos(getInt(nbt, "x"), getInt(nbt, "y"), getInt(nbt, "z")); + } + + public static void setVec3iDirect(NbtCompound nbt, Vec3i vec3i) { + putInt(nbt, "x", vec3i.getX()); + putInt(nbt, "y", vec3i.getY()); + putInt(nbt, "z", vec3i.getZ()); + } + + public static Vec3i getVec3iDirect(NbtCompound nbt) { + return Vec3iUtil.create(getInt(nbt, "x"), getInt(nbt, "y"), getInt(nbt, "z")); + } + + public static void setVec3dDirect(NbtCompound nbt, Vec3d vec3d) { + putDouble(nbt, "x", vec3d.getX()); + putDouble(nbt, "y", vec3d.getY()); + putDouble(nbt, "z", vec3d.getZ()); + } + + public static Vec3d getVec3dDirect(NbtCompound nbt) { + return Vec3dUtil.create(getDouble(nbt, "x"), getDouble(nbt, "y"), getDouble(nbt, "z")); + } + + public static void setVec3iDirect(NbtCompound nbt, int x, int y, int z) { + putInt(nbt, "x", x); + putInt(nbt, "y", y); + putInt(nbt, "z", z); + } + + public static void setVec3dDirect(NbtCompound nbt, double x, double y, double z) { + putDouble(nbt, "x", x); + putDouble(nbt, "y", y); + putDouble(nbt, "z", z); + } + + public static String asString(NbtElement nbt) { + return nbt.asString().orElse(""); + } + + public static NbtString createString(String string) { + return NbtString.of(string); + } + + public static NbtInt createInt(int value) { + return NbtInt.of(value); + } + + public static NbtFloat createFloat(float value) { + return NbtFloat.of(value); + } + + public static NbtDouble createDouble(double value) { + return NbtDouble.of(value); + } + + public static NbtLong createLong(long value) { + return NbtLong.of(value); + } + + public static NbtByte createByte(byte value) { + return NbtByte.of(value); + } + + public static NbtShort createShort(short value) { + return NbtShort.of(value); + } + + public static void copyFrom(NbtCompound source, NbtCompound target) { + target.copyFrom(source); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java new file mode 100644 index 000000000..bcfa9d246 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java @@ -0,0 +1,13 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.particle.ParticleEffect; +import net.minecraft.particle.ParticleType; +import net.pitan76.mcpitanlib.api.util.particle.effect.ItemStackParticleEffectUtil; + +public class ParticleEffectUtil { + public static ItemStackParticleEffectUtil itemStack = new ItemStackParticleEffectUtil(); + + public static ParticleType getType(ParticleEffect effect) { + return effect.getType(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java new file mode 100644 index 000000000..9ba2c4abf --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.api.util; + +import com.mojang.serialization.Codec; +import net.minecraft.datafixer.DataFixTypes; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.PersistentState; +import net.minecraft.world.PersistentStateManager; +import net.minecraft.world.PersistentStateType; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.world.CompatiblePersistentState; + +import java.util.function.Function; +import java.util.function.Supplier; + +public class PersistentStateUtil { + public static T getOrCreate(PersistentStateManager manager, String id, Supplier supplier, Function function) { + Codec codec = NbtCompound.CODEC.xmap( + // NBT -> PersistentState + (nbt) -> { + T state = supplier.get(); + + if (state instanceof CompatiblePersistentState) + ((CompatiblePersistentState) state).readNbt(new ReadNbtArgs(nbt)); + + return state; + }, + // PersistentState -> NBT + (state) -> { + if (state instanceof CompatiblePersistentState) + return ((CompatiblePersistentState) state).writeNbt(new WriteNbtArgs(new NbtCompound())); + + return NbtUtil.create(); + } + ); + + PersistentStateType type = new PersistentStateType<>(id, supplier, codec, DataFixTypes.LEVEL); + return manager.getOrCreate(type); + } + + public static PersistentStateManager getManagerFromServer(MinecraftServer server) { + return server.getWorld(World.OVERWORLD).getPersistentStateManager(); + } + + public static PersistentStateManager getManagerFromWorld(ServerWorld world) { + return world.getPersistentStateManager(); + } + + public static void markDirty(PersistentState state) { + state.markDirty(); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java new file mode 100644 index 000000000..228e4eedd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.world.gen.YOffset; +import net.minecraft.world.gen.feature.ConfiguredFeature; +import net.minecraft.world.gen.feature.PlacedFeature; +import net.minecraft.world.gen.placementmodifier.CountPlacementModifier; +import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier; +import net.minecraft.world.gen.placementmodifier.PlacementModifier; +import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier; + +import java.util.List; + +public class PlacedFutureUtil { + public static PlacedFeature create(ConfiguredFeature configuredFeature, List placementModifiers) { + return new PlacedFeature(RegistryEntry.of(configuredFeature), placementModifiers); + } + + public static List createPlacementModifiers(CountPlacementModifier countPlacementModifier, SquarePlacementModifier squarePlacementModifier, HeightRangePlacementModifier heightRangePlacementModifier) { + return List.of(countPlacementModifier, squarePlacementModifier, heightRangePlacementModifier); + } + + public static List createPlacementModifiers(int chunkCount, int top, int bottom) { + return createPlacementModifiers( +CountPlacementModifier.of(chunkCount), + SquarePlacementModifier.of(), + HeightRangePlacementModifier.uniform(YOffset.fixed(bottom), YOffset.fixed(top)) + ); + } + + public static List createPlacementModifiers(int chunkCount, int top) { + return createPlacementModifiers( + CountPlacementModifier.of(chunkCount), + SquarePlacementModifier.of(), + HeightRangePlacementModifier.uniform(YOffset.getBottom(), YOffset.fixed(top)) + ); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java new file mode 100644 index 000000000..ebfc9c287 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java @@ -0,0 +1,76 @@ +package net.pitan76.mcpitanlib.api.util; + +import dev.architectury.injectables.annotations.ExpectPlatform; +import dev.architectury.platform.Platform; +import dev.architectury.utils.Env; +import net.fabricmc.api.EnvType; + +import java.io.File; +import java.nio.file.Path; +import java.util.Collection; + +public class PlatformUtil { + public static boolean isDevelopmentEnvironment() { + return Platform.isDevelopmentEnvironment(); + } + + public static boolean isFabric() { + return Platform.isFabric(); + } + + public static boolean isForge() { + return Platform.isMinecraftForge(); + } + + public static boolean isNeoForge() { + return Platform.isNeoForge(); + } + + public static boolean isClient() { + return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT; + } + + public static boolean isServer() { + return FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER; + } + + public static Path getConfigFolder() { + return FabricLoader.getInstance().getConfigDir(); + } + + public static boolean isModLoaded(String id) { + return FabricLoader.getInstance().isModLoaded(id); + } + + public static Path getGameFolder() { + return Platform.getGameFolder(); + } + + public static Path getModsFolder() { + return Platform.getModsFolder(); + } + + public static File getConfigFolderAsFile() { + return getConfigFolder().toFile(); + } + + public static File getGameFolderAsFile() { + return getGameFolder().toFile(); + } + + public static File getModsFolderAsFile() { + return getModsFolder().toFile(); + } + + public static Collection getModIds() { + return Platform.getModIds(); + } + + public static EnvType getEnv() { + return Platform.getEnv(); + } + + public static String getGameVersion() { + return Platform.getMinecraftVersion(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java new file mode 100644 index 000000000..ae2e7ecc5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java @@ -0,0 +1,130 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.PlayerManager; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class PlayerManagerUtil { + + /** + * Get player by UUID + * @param server MinecraftServer + * @param uuid UUID + * @return Player + */ + public static Player getPlayerByUUID(MinecraftServer server, UUID uuid) { + return PlayerUtil.getPlayerByUUID(server, uuid); + } + + /** + * Get player by name + * @param server MinecraftServer + * @param name String + * @return Player + */ + public static Player getPlayerByName(MinecraftServer server, String name) { + return PlayerUtil.getPlayerByName(server, name); + } + + /** + * Get players by IP + * @param server MinecraftServer + * @param ip String + * @return List + */ + public static List getPlayersByIP(MinecraftServer server, String ip) { + return PlayerUtil.getPlayersByIP(server, ip); + } + + /** + * Get players + * @param server MinecraftServer + * @return List + */ + public static List getPlayers(MinecraftServer server) { + return PlayerUtil.getPlayers(server); + } + + /** + * Get players + * @param world World + * @return List + */ + public static List getPlayers(World world) { + List players = new ArrayList<>(); + for (PlayerEntity p : world.getPlayers()) { + players.add(new Player(p)); + } + return players; + } + + /** + * Get player by UUID + * @param world World + * @param uuid UUID + * @return Player + */ + public static Player getPlayerByUUID(World world, UUID uuid) { + return PlayerUtil.getPlayerByUUID(world, uuid); + } + + /** + * Get player by name + * @param world World + * @param name String + * @return Player + */ + public static Player getPlayerByName(World world, String name) { + return PlayerUtil.getPlayerByName(world, name); + } + + public static PlayerManager getPlayerManager(MinecraftServer server) { + return ServerUtil.getPlayerManager(server); + } + + public static PlayerManager getPlayerManager(World world) { + return getPlayerManager(world.getServer()); + } + + public static boolean hasPlayerByUUID(PlayerManager playerManager, UUID uuid) { + return playerManager.getPlayer(uuid) != null; + } + + public static boolean hasPlayerByName(PlayerManager playerManager, String name) { + return playerManager.getPlayer(name) != null; + } + + public static boolean hasPlayerByIP(PlayerManager playerManager, String ip) { + return !playerManager.getPlayersByIp(ip).isEmpty(); + } + + public static boolean hasPlayerByUUID(MinecraftServer server, UUID uuid) { + return hasPlayerByUUID(getPlayerManager(server), uuid); + } + + public static boolean hasPlayerByName(MinecraftServer server, String name) { + return hasPlayerByName(getPlayerManager(server), name); + } + + public static boolean hasPlayerByIP(MinecraftServer server, String ip) { + return hasPlayerByIP(getPlayerManager(server), ip); + } + + public static boolean hasPlayerByUUID(World world, UUID uuid) { + return hasPlayerByUUID(getPlayerManager(world), uuid); + } + + public static boolean hasPlayerByName(World world, String name) { + return hasPlayerByName(getPlayerManager(world), name); + } + + public static boolean hasPlayerByIP(World world, String ip) { + return hasPlayerByIP(getPlayerManager(world), ip); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java new file mode 100644 index 000000000..90f67e846 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java @@ -0,0 +1,98 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class PlayerUtil { + + public static Player getPlayerByUUID(MinecraftServer server, UUID uuid) { + return new Player(server.getPlayerManager().getPlayer(uuid)); + } + + public static Player getPlayerByName(MinecraftServer server, String name) { + return new Player(server.getPlayerManager().getPlayer(name)); + } + + public static List getPlayersByIP(MinecraftServer server, String ip) { + List players = new ArrayList<>(); + for (PlayerEntity p: server.getPlayerManager().getPlayersByIp(ip)) { + players.add(new Player(p)); + } + return players; + } + + public static List getPlayers(MinecraftServer server) { + List players = new ArrayList<>(); + for (PlayerEntity p : server.getPlayerManager().getPlayerList()) { + players.add(new Player(p)); + } + return players; + } + + public static Player getPlayerByUUID(World world, UUID uuid) { + return getPlayerByUUID(world.getServer(), uuid); + } + + public static Player getPlayerByName(World world, String name) { + return getPlayerByName(world.getServer(), name); + } + + public static boolean isExistByUUID(MinecraftServer server, UUID uuid) { + return server.getPlayerManager().getPlayer(uuid) != null; + } + + public static boolean isExistByUUID(World world, UUID uuid) { + return isExistByUUID(world.getServer(), uuid); + } + + public static boolean isExistByName(MinecraftServer server, String name) { + return server.getPlayerManager().getPlayer(name) != null; + } + + public static boolean isExistByName(World world, String name) { + return isExistByName(world.getServer(), name); + } + + public static boolean isExistByIP(MinecraftServer server, String ip) { + return !server.getPlayerManager().getPlayersByIp(ip).isEmpty(); + } + + public static boolean isExistByIP(World world, String ip) { + return isExistByIP(world.getServer(), ip); + } + + public static void sendMessage(Player player, String message) { + player.sendMessage(TextUtil.literal(message)); + } + + public static float getYaw(Player player) { + return player.getYaw(); + } + + public static float getPitch(Player player) { + return player.getPitch(); + } + + public static BlockPos getBlockPos(Player player) { + return player.getBlockPos(); + } + + public static World getWorld(Player player) { + return player.getWorld(); + } + + public static boolean isClient(Player player) { + return player.isClient(); + } + + public static void teleport(Player player, double x, double y, double z) { + player.teleport(x, y, z); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java new file mode 100644 index 000000000..a97c8dc53 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java @@ -0,0 +1,161 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.BlockState; +import net.minecraft.block.enums.BlockHalf; +import net.minecraft.block.enums.StairShape; +import net.minecraft.state.property.*; +import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.math.Direction; +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; +import net.pitan76.mcpitanlib.api.state.property.CompatProperties; +import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; + +public class PropertyUtil { + public static BooleanProperty createBooleanProperty(String name) { + return BooleanProperty.of(name); + } + + public static DirectionProperty createDirectionProperty(String name) { + return DirectionProperty.of(name); + } + + public static IntProperty createIntProperty(String name, int min, int max) { + return IntProperty.of(name, min, max); + } + + public static & StringIdentifiable> EnumProperty createEnumProperty(String name, Class type) { + return EnumProperty.of(name, type); + } + + public static BlockState with(BlockState state, BooleanProperty property, boolean value) { + return state.with(property, value); + } + + public static BlockState with(BlockState state, IntProperty property, int value) { + return state.with(property, value); + } + + public static BlockState with(BlockState state, DirectionProperty property, Direction value) { + return property.with(state, value); + } + + public static boolean get(BlockState state, BooleanProperty property) { + return state.get(property); + } + + public static int get(BlockState state, IntProperty property) { + return state.get(property); + } + + public static Direction get(BlockState state, DirectionProperty property) { + return property.get(state); + } + + public static net.pitan76.mcpitanlib.midohra.util.math.Direction getAsMidohra(BlockState state, DirectionProperty property) { + return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(property.get(state)); + } + + public static Direction getFacing(BlockState state) { + return facing().get(state); + } + + public static Direction getHorizontalFacing(BlockState state) { + return horizontalFacing().get(state); + } + + public static int getPower(BlockState state) { + return state.get(power()); + } + + public static boolean isPowered(BlockState state) { + return state.get(powered()); + } + + public static void append(AppendPropertiesArgs args, Property... properties) { + args.addProperty(properties); + } + + public static void appendFacing(AppendPropertiesArgs args) { + facing().apply(args); + } + + public static void appendHorizontalFacing(AppendPropertiesArgs args) { + horizontalFacing().apply(args); + } + + public static void appendPower(AppendPropertiesArgs args) { + args.addProperty(power()); + } + + public static void appendPowered(AppendPropertiesArgs args) { + args.addProperty(powered()); + } + + public static IntProperty power() { + return Properties.POWER; + } + + public static BooleanProperty powered() { + return Properties.POWERED; + } + + public static DirectionProperty facing() { + return CompatProperties.FACING; + } + + public static DirectionProperty horizontalFacing() { + return CompatProperties.HORIZONTAL_FACING; + } + + public static EnumProperty axis() { + return Properties.AXIS; + } + + public static EnumProperty blockHalf() { + return Properties.BLOCK_HALF; + } + + public static EnumProperty stairShape() { + return Properties.STAIR_SHAPE; + } + + public static BooleanProperty lit() { + return Properties.LIT; + } + + public static BooleanProperty waterlogged() { + return Properties.WATERLOGGED; + } + + public static BooleanProperty attached() { + return Properties.ATTACHED; + } + + public static BooleanProperty hanging() { + return Properties.HANGING; + } + + public static BooleanProperty bottom() { + return Properties.BOTTOM; + } + + public static BooleanProperty conditional() { + return Properties.CONDITIONAL; + } + + public static BooleanProperty inWall() { + return Properties.IN_WALL; + } + + public static BooleanProperty open() { + return Properties.OPEN; + } + + public static BooleanProperty occupied() { + return Properties.OCCUPIED; + } + + public static boolean contains(BlockState state, Property property) { + return state.contains(property); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java new file mode 100644 index 000000000..8bff34563 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java @@ -0,0 +1,223 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.*; +import net.minecraft.recipe.book.CraftingRecipeCategory; +import net.minecraft.recipe.input.CraftingRecipeInput; +import net.minecraft.recipe.input.RecipeInput; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.resources.Identifier; +import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.recipe.CompatRecipeType; +import net.pitan76.mcpitanlib.api.recipe.MatchGetter; +import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; +import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; +import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeNonEntry; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +public class RecipeUtil { + public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + return new ShapelessRecipe(group, CraftingRecipeCategory.valueOf(category.name()), output, input); + } + + public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, ItemStack output, DefaultedList input) { + return createShapelessRecipe(id, group, CompatibilityCraftingRecipeCategory.MISC, output, input); + } + + @Deprecated + public static ItemStack craft_2(Recipe recipe, C inventory, World world) { + return recipe.craft(inventory, world.getRegistryManager()); + } + + @Deprecated + public static ItemStack getOutput_2(Recipe recipe, World world) { + return craft_2(recipe, (C) CraftingRecipeInput.EMPTY, world); + } + + public static ItemStack craft(Recipe recipe, Inventory inventory, World world) { + if (inventory instanceof RecipeInput) { + Recipe inputRecipe = (Recipe) recipe; + return inputRecipe.craft((RecipeInput) inventory, world.getRegistryManager()); + } + return ItemStack.EMPTY; + } + + public static ItemStack getOutput(Recipe recipe, World world) { + return getOutput(recipe, RegistryLookupUtil.getRegistryLookup(world)); + } + + public static List> getAllRecipes(World world) { + RecipeManager iRecipeManager = getRecipeManager(world); + if (!(iRecipeManager instanceof ServerRecipeManager)) + return new ArrayList<>(); + + ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + + Collection> recipes = recipeManager.values(); + List> outRecipes = new ArrayList<>(); + for (Object recipeEntryObj : recipes) { + if (recipeEntryObj instanceof RecipeEntry) { + RecipeEntry recipeEntry = (RecipeEntry) recipeEntryObj; + if (recipeEntry.value() instanceof Recipe) { + outRecipes.add(recipeEntry.value()); + } + } + } + return outRecipes; + } + + public static List> getAllCompatRecipeEntry(World world) { + List> recipes = getAllRecipes(world); + List> outRecipes = new ArrayList<>(); + for (Recipe recipe : recipes) { + outRecipes.add(new CompatRecipeNonEntry<>(recipe)); + } + return outRecipes; + } + + public static RecipeType getType(Recipe recipe) { + return recipe.getType(); + } + + public static Identifier getId(Recipe recipe) { + return IdentifierUtil.id(recipe.getClass().hashCode() + ""); + } + + public static > CompatRecipeEntry getFirstMatch(RecipeManager iRecipeManager, CompatRecipeType type, CompatRecipeInput input, World world) { + if (!(iRecipeManager instanceof ServerRecipeManager)) + return new CompatRecipeEntry<>(null); + + ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + + Optional> recipe = recipeManager.getFirstMatch(type.getType(), input.getInput(), world); + return recipe.map(CompatRecipeEntry::new).orElseGet(() -> new CompatRecipeEntry<>(null)); + } + + public static > CompatRecipeEntry getFirstMatch(RecipeManager iRecipeManager, CompatRecipeType type, CompatRecipeInput input, World world, CompatIdentifier identifier) { + if (!(iRecipeManager instanceof ServerRecipeManager)) + return new CompatRecipeEntry<>(null); + + ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + + Optional> recipe = recipeManager.getFirstMatch(type.getType(), input.getInput(), world, RegistryKey.of(RegistryKeys.RECIPE, identifier.toMinecraft())); + return recipe.map(CompatRecipeEntry::new).orElseGet(() -> new CompatRecipeEntry<>(null)); + } + + public static > CompatRecipeEntry getFirstMatch(World world, CompatRecipeType type, CompatRecipeInput input) { + return getFirstMatch(getRecipeManager(world), type, input, world); + } + + public static > CompatRecipeEntry getFirstMatch(World world, CompatRecipeType type, CompatRecipeInput input, CompatIdentifier identifier) { + return getFirstMatch(getRecipeManager(world), type, input, world, identifier); + } + + public static RecipeManager getRecipeManager(World world) { + return world.getRecipeManager(); + } + + public Optional> get(World world, CompatIdentifier id) { + return get(getRecipeManager(world), id); + } + + public Optional> get(RecipeManager iRecipeManager, CompatIdentifier id) { + if (!(iRecipeManager instanceof ServerRecipeManager)) + return Optional.empty(); + ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + + return recipeManager.get(RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft())); + } + + public static > MatchGetter createCachedMatchGetter(RecipeType type) { + return (input, world) -> { + Optional> optional = ServerRecipeManager.createCachedMatchGetter(type).getFirstMatch(input.getInput(), (ServerWorld) world); + return optional.map(CompatRecipeEntry::new); + }; + } + + public static > MatchGetter createCachedMatchGetter(CompatRecipeType type) { + return createCachedMatchGetter(type.getType()); + } + + public static DefaultedList getInputs(Recipe recipe) { + List ingredients = recipe.getIngredientPlacement().getIngredients(); + + DefaultedList outIngredients = DefaultedList.ofSize(ingredients.size()); + + for (int i = 0; i < ingredients.size(); i++) { + outIngredients.set(i, ingredients.get(i)); + } + + return outIngredients; + } + + public static DefaultedList getInputs(CompatRecipeEntry recipeEntry) { + return getInputs(recipeEntry.getRecipe()); + } + + public static ItemStackList getInputsAsStack(Recipe recipe) { + DefaultedList ingredients = getInputs(recipe); + ItemStackList stacks = ItemStackList.ofSize(ingredients.size(), ItemStackUtil.empty()); + for (Ingredient ingredient : ingredients) { + stacks.addAll(IngredientUtil.getMatchingStacksAsList(ingredient)); + } + return stacks; + } + + public static ItemStackList getInputsAsStack(CompatRecipeEntry recipeEntry) { + return getInputsAsStack(recipeEntry.getRecipe()); + } + + public static ItemStack getOutput(Recipe recipe, CompatRegistryLookup registryLookup) { + if (recipe instanceof ShapelessRecipe) { + ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe; + return shapelessRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + } + + if (recipe instanceof ShapedRecipe) { + ShapedRecipe shapedRecipe = (ShapedRecipe) recipe; + return shapedRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + } + + if (recipe instanceof CraftingRecipe) { + CraftingRecipe craftingRecipe = (CraftingRecipe) recipe; + return craftingRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + } + + if (recipe instanceof SpecialCraftingRecipe) { + SpecialCraftingRecipe specialCraftingRecipe = (SpecialCraftingRecipe) recipe; + return specialCraftingRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + } + + return recipe.craft(null, registryLookup.getRegistryLookup()); + } + + public static ItemStack getOutput(CompatRecipeEntry recipeEntry, CompatRegistryLookup registryLookup) { + return getOutput(recipeEntry.getRecipe(), registryLookup); + } + + public static CompatRecipeType getType(CompatRecipeEntry recipeEntry) { + return CompatRecipeType.of(recipeEntry.getRecipe().getType()); + } + + public static > ItemStackList getRemainder(CompatRecipeEntry recipeEntry, CompatRecipeInput input) { + return ItemStackList.of(); + //return ItemStackList.of(recipeEntry.getRecipe().getRemainder(input.getInput())); + } + + public enum CompatibilityCraftingRecipeCategory { + BUILDING, + REDSTONE, + EQUIPMENT, + MISC; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java new file mode 100644 index 000000000..b507e75ee --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.CompatEntity; +import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; +import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; + +public class RegistryLookupUtil { + public static CompatRegistryLookup getRegistryLookup(ItemAppendTooltipEvent e) { + return new CompatRegistryLookup(e.context.getRegistryLookup()); + } + + public static CompatRegistryLookup getRegistryLookup(CompatEntity entity) { + return new CompatRegistryLookup(entity.getRegistryManager()); + } + + public static CompatRegistryLookup getRegistryLookup(Entity entity) { + return new CompatRegistryLookup(entity.getRegistryManager()); + } + + public static CompatRegistryLookup getRegistryLookup(CompatBlockEntity entity) { + return new CompatRegistryLookup(entity.getWorld().getRegistryManager()); + } + + public static CompatRegistryLookup getRegistryLookup(BlockEntity entity) { + return new CompatRegistryLookup(entity.getWorld().getRegistryManager()); + } + + public static CompatRegistryLookup getRegistryLookup(NbtRWArgs args) { + return args.getRegistryLookup(); + } + + public static CompatRegistryLookup getRegistryLookup(World world) { + return new CompatRegistryLookup(world.getRegistryManager()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java new file mode 100644 index 000000000..95d896201 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.resource.Resource; +import net.minecraft.resource.ResourceManager; +import net.minecraft.resources.Identifier; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +public class ResourceUtil { + public static Resource getResource(ResourceManager resourceManager, Identifier identifier) { + return resourceManager.getResource(identifier).get(); + } + + public static InputStream getInputStream(Resource resource) throws IOException { + return resource.getInputStream(); + } + + public static Map findResources(ResourceManager resourceManager, String startingPath, String endingPath) throws IOException { + return resourceManager.findResources(startingPath, s -> s.toString().endsWith(endingPath)); + } + + public static void close(Resource resource) throws IOException { + getInputStream(resource).close(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java new file mode 100644 index 000000000..7ce969235 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java @@ -0,0 +1,54 @@ +package net.pitan76.mcpitanlib.api.util; + +import dev.architectury.registry.menu.ExtendedMenuProvider; +import dev.architectury.registry.menu.MenuRegistry; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.registry.Registries; +import net.minecraft.screen.NamedScreenHandlerFactory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.screen.slot.Slot; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.collection.DefaultedList; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +public class ScreenHandlerUtil { + public static DefaultedList getSlots(ScreenHandler screenHandler) { + return screenHandler.slots; + } + + public static Slot getSlot(ScreenHandler screenHandler, int index) { + return screenHandler.getSlot(index); + } + + public static List> getAllScreenHandlerTypes() { + List> screenHandlerTypes = new ArrayList<>(); + for (ScreenHandlerType screenHandler : Registries.SCREEN_HANDLER) { + screenHandlerTypes.add(screenHandler); + } + return screenHandlerTypes; + } + + public static void openExtendedMenu(ServerPlayerEntity player, NamedScreenHandlerFactory provider, Consumer bufWriter) { + MenuRegistry.openExtendedMenu(player, provider, bufWriter); + } + + public static void openExtendedMenu(ServerPlayerEntity player, ExtendedMenuProvider provider) { + MenuRegistry.openExtendedMenu(player, provider); + } + + public static void openMenu(ServerPlayerEntity player, NamedScreenHandlerFactory provider) { + MenuRegistry.openMenu(player, provider); + } + + public static int getRawId(ScreenHandlerType type) { + return Registries.SCREEN_HANDLER.getRawId(type); + } + + public static ScreenHandlerType fromIndex(int index) { + return Registries.SCREEN_HANDLER.get(index); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java new file mode 100644 index 000000000..6718b610d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java @@ -0,0 +1,64 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.PlayerManager; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class ServerUtil { + public static MinecraftServer getServer(World world) { + return world.getServer(); + } + + public static String getIP(MinecraftServer server) { + return server.getServerIp(); + } + + public static int getPort(MinecraftServer server) { + return server.getServerPort(); + } + + public static String getMotd(MinecraftServer server) { + return server.getServerMotd(); + } + + public static String getServerModName(MinecraftServer server) { + return server.getServerModName(); + } + + public static int getMaxPlayerCount(MinecraftServer server) { + return server.getMaxPlayerCount(); + } + + public static int getCurrentPlayerCount(MinecraftServer server) { + return server.getCurrentPlayerCount(); + } + + public static boolean isOnlineMode(MinecraftServer server) { + return server.isOnlineMode(); + } + + public static boolean isServerRunning(MinecraftServer server) { + return server.isRunning(); + } + + public static boolean isServerDedicated(MinecraftServer server) { + return server.isDedicated(); + } + + public static boolean isSingleplayer(MinecraftServer server) { + return server.isSingleplayer(); + } + + public static PlayerManager getPlayerManager(MinecraftServer server) { + return server.getPlayerManager(); + } + + public static MinecraftServer getServer(Player player) { + return getServer(player.getWorld()); + } + + public static void execute(MinecraftServer server, Runnable runnable) { + server.execute(runnable); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java new file mode 100644 index 000000000..9176cee25 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.inventory.SimpleInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; + +public class SimpleInventoryUtil { + public static DefaultedList getHeldStacks(SimpleInventory inventory) { + return inventory.getHeldStacks(); + } + + public static SimpleInventory create(int size) { + return InventoryUtil.createSimpleInventory(size); + } + + public static ItemStack getStack(SimpleInventory inventory, int slot) { + return inventory.getStack(slot); + } + + public static void setStack(SimpleInventory inventory, int slot, ItemStack stack) { + inventory.setStack(slot, stack); + } + + public static void clear(SimpleInventory inventory) { + inventory.clear(); + } + + public static int size(SimpleInventory inventory) { + return inventory.size(); + } + + public static boolean isEmpty(SimpleInventory inventory) { + return inventory.isEmpty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java new file mode 100644 index 000000000..018aad006 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java @@ -0,0 +1,44 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.slot.Slot; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class SlotUtil { + public static void setStack(Slot slot, ItemStack stack) { + slot.setStack(stack); + } + + public static ItemStack getStack(Slot slot) { + return slot.getStack(); + } + + public static void takeStack(Slot slot, int amount) { + slot.takeStack(amount); + } + + public static boolean hasStack(Slot slot) { + return slot.hasStack(); + } + + public static void markDirty(Slot slot) { + slot.markDirty(); + } + + public static boolean canInsert(Slot slot, ItemStack stack) { + return slot.canInsert(stack); + } + + public static boolean canTakeItems(Slot slot) { + return slot.canTakeItems(null); + } + + public static void onTakeItem(Slot slot, Player player, ItemStack stack) { + slot.onTakeItem(player.getEntity(), stack); + } + + public static Inventory getInventory(Slot slot) { + return slot.inventory; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java new file mode 100644 index 000000000..2087e6994 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.registry.Registries; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class SoundEventUtil { + public static Identifier getId(SoundEvent soundEvent) { + return soundEvent.id(); + } + + public static SoundEvent getSoundEvent(Identifier id) { + return SoundEvent.of(id); + } + + public static CompatIdentifier getCompatId(SoundEvent soundEvent) { + return CompatIdentifier.fromMinecraft(getId(soundEvent)); + } + + public static SoundEvent getSoundEvent(CompatIdentifier id) { + return getSoundEvent(id.toMinecraft()); + } + + public static List getAllSoundEvents() { + return Registries.SOUND_EVENT.stream().collect(Collectors.toList()); + } + + public static List getAllSoundEventIds() { + return new ArrayList<>(Registries.SOUND_EVENT.getIds()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java new file mode 100644 index 000000000..7519d7e99 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java @@ -0,0 +1,107 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.pitan76.mcpitanlib.api.event.result.EventResult; + +import java.util.Optional; + +public class StackActionResult extends CompatActionResult { + private final ItemStack stack; + private final CompatActionResult compatActionResult; + + public StackActionResult(ActionResult actionResult, EventResult eventResult, ItemStack stack) { + this(new CompatActionResult(actionResult, eventResult), stack); + } + + public StackActionResult(CompatActionResult actionResult, ItemStack stack) { + super(null, null); + compatActionResult = actionResult; + this.stack = stack; + } + + @Override + public ActionResult toActionResult() { + return compatActionResult.toActionResult(); + } + + @Override + public EventResult toEventResult() { + return compatActionResult.toEventResult(); + } + + @Deprecated + @Override + public Optional getNewHandStack() { + if (hasNewStack()) + return compatActionResult.getNewHandStack(); + + return Optional.empty(); + } + + public boolean hasNewStack() { + return compatActionResult.getNewHandStack().isPresent(); + } + + public boolean hasStack() { + return getStack() != null; + } + + public CompatActionResult asCompatActionResult() { + return compatActionResult; + } + + public static StackActionResult create(CompatActionResult compatActionResult, ItemStack stack) { + if (compatActionResult.getNewHandStack().isPresent()) + return new StackActionResult(compatActionResult, compatActionResult.getNewHandStack().get()); + + return new StackActionResult(compatActionResult, stack); + } + + public static StackActionResult create(CompatActionResult compatActionResult) { + return new StackActionResult(compatActionResult, null); + } + + public static StackActionResult create(ActionResult actionResult, EventResult eventResult, ItemStack stack) { + return new StackActionResult(actionResult, eventResult, stack); + } + + public static StackActionResult create(ActionResult actionResult, ItemStack stack) { + return new StackActionResult(actionResult, null, stack); + } + + public static StackActionResult success(ItemStack stack) { + CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.SUCCESS.withNewHandStack(stack)); + return create(compatActionResult, stack); + } + + public static StackActionResult successServer(ItemStack stack) { + CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.SUCCESS_SERVER.withNewHandStack(stack)); + return create(compatActionResult, stack); + } + + public static StackActionResult consume(ItemStack stack) { + CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.CONSUME.withNewHandStack(stack)); + return create(compatActionResult, stack); + } + + public static StackActionResult pass(ItemStack stack) { + return create(CompatActionResult.PASS, stack); + } + + public static StackActionResult pass() { + return create(CompatActionResult.PASS); + } + + public static StackActionResult fail(ItemStack stack) { + return create(CompatActionResult.FAIL, stack); + } + + public static StackActionResult fail() { + return create(CompatActionResult.FAIL); + } + + public ItemStack getStack() { + return stack; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java new file mode 100644 index 000000000..a51ef0e36 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.util; + +import com.google.common.collect.ImmutableList; +import net.minecraft.state.State; +import net.minecraft.state.StateManager; + +public class StateManagerUtil { + public static > S getDefaultState(StateManager manager) { + return manager.getDefaultState(); + } + + public > ImmutableList getStates(StateManager manager) { + return manager.getStates(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java new file mode 100644 index 000000000..e484d1bd1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; + +public class StatusEffectUtil { + public static CompatStatusEffect getStatusEffect(Identifier identifier) { + RegistryKey registryKey = RegistryKey.of(RegistryKeys.STATUS_EFFECT, identifier); + return new CompatStatusEffect(registryKey); + } + + public static CompatStatusEffect getStatusEffect(CompatIdentifier identifier) { + return getStatusEffect(identifier.toMinecraft()); + } + + public static Identifier getId(CompatStatusEffect statusEffect) { + return statusEffect.getId(); + } + + public static CompatIdentifier getCompatId(CompatStatusEffect statusEffect) { + return CompatIdentifier.fromMinecraft(statusEffect.getId()); + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java new file mode 100644 index 000000000..6959d1fca --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java @@ -0,0 +1,61 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.text.ClickEvent; +import net.minecraft.text.HoverEvent; +import net.minecraft.text.Style; +import net.minecraft.text.StyleSpriteSource; +import net.minecraft.util.Formatting; + +public class StyleUtil { + public static Style emptyStyle() { + return Style.EMPTY; + } + + public static Style withColor(Style style, int color) { + return style.withColor(color); + } + + public static Style withBold(Style style, boolean bold) { + return style.withBold(bold); + } + + public static Style withItalic(Style style, boolean italic) { + return style.withItalic(italic); + } + + public static Style withUnderline(Style style, boolean underline) { + return style.withUnderline(underline); + } + + public static Style withStrikethrough(Style style, boolean strikethrough) { + return style.withStrikethrough(strikethrough); + } + + public static Style withObfuscated(Style style, boolean obfuscated) { + return style.withObfuscated(obfuscated); + } + + public static Style withInsertion(Style style, String insertion) { + return style.withInsertion(insertion); + } + + public static Style withClickEvent(Style style, ClickEvent clickEvent) { + return style.withClickEvent(clickEvent); + } + + public static Style withHoverEvent(Style style, HoverEvent hoverEvent) { + return style.withHoverEvent(hoverEvent); + } + + public static Style withFont(Style style, CompatIdentifier font) { + return style.withFont(new StyleSpriteSource.Font(font.toMinecraft())); + } + + public static Style withFormatting(Style style, Formatting formatting) { + return style.withFormatting(formatting); + } + + public static Style withExclusiveFormatting(Style style, Formatting formatting) { + return style.withExclusiveFormatting(formatting); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java new file mode 100644 index 000000000..388da58de --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java @@ -0,0 +1,72 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.text.MutableText; +import net.minecraft.text.Style; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.text.TextConverter; + +public class TextUtil { + public static MutableText literal(String string) { + return Text.literal(string); + } + + public static MutableText translatable(String key) { + return Text.translatable(key); + } + + public static MutableText translatable(String key, Object... args) { + return Text.translatable(key, args); + } + + public static MutableText empty() { + return literal(""); + } + + public static MutableText keybind(String string) { + return Text.keybind(string); + } + + public static String txt2str(Text text) { + return text.getString(); + } + + public static MutableText setStyle(MutableText text, Style style) { + return text.setStyle(style); + } + + public static Style getStyle(MutableText text) { + return text.getStyle(); + } + + public static MutableText withColor(MutableText text, int color) { + return setStyle(text, StyleUtil.withColor(text.getStyle(), color)); + } + + public static MutableText withBold(MutableText text, boolean bold) { + return setStyle(text, StyleUtil.withBold(text.getStyle(), bold)); + } + + public static MutableText append(MutableText text, Text sibling) { + return text.append(sibling); + } + + public static MutableText append(MutableText text, String string) { + return text.append(string); + } + + public static MutableText of(String string) { + return literal(string); + } + + public static MutableText convert(String text) { + return TextConverter.convert(text, false); + } + + public static MutableText convertWithTranslatable(String text) { + return TextConverter.convert(text, true); + } + + public static boolean contains(Text text, Text text1) { + return text.contains(text1); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java new file mode 100644 index 000000000..eaf08acdb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java @@ -0,0 +1,18 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.world.ServerWorld; +import net.pitan76.mcpitanlib.api.timer.MinecraftServerTimerAccess; +import net.pitan76.mcpitanlib.api.timer.ServerWorldTimerAccess; + +import java.util.function.Supplier; + +public class TimerUtil { + public static void addTimer(ServerWorld world, long ticksUntilSomething, Supplier supplier) { + ((ServerWorldTimerAccess) world).mcpitanlib$addTimer(ticksUntilSomething, supplier); + } + + public static void addTimer(MinecraftServer server, long ticksUntilSomething, Supplier supplier) { + ((MinecraftServerTimerAccess) server).mcpitanlib$addTimer(ticksUntilSomething, supplier); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java new file mode 100644 index 000000000..87571de96 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.recipe.Ingredient; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; + +public class ToolMaterialUtil { + // ミスでstatic化し忘れていたが、互換性のため保持しておく + public CompatibleToolMaterial create(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) { + return create2(miningLevel, durability, miningSpeed, attackDamage, enchantability, repairIngredient); + } + + /** + * Create CompatibleToolMaterial + * @param miningLevel Mining Level + * @param durability Durability + * @param miningSpeed Mining Speed + * @param attackDamage Attack Damage + * @param enchantability Enchantability + * @param repairIngredient Repair Ingredient + * @return CompatibleToolMaterial + */ + public static CompatibleToolMaterial create2(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability, Ingredient repairIngredient) { + return new CompatibleToolMaterial() { + @Override + public int getCompatMiningLevel() { + return miningLevel; + } + + @Override + public int getCompatDurability() { + return durability; + } + + @Override + public float getCompatMiningSpeedMultiplier() { + return miningSpeed; + } + + @Override + public Ingredient getCompatRepairIngredient() { + return repairIngredient; + } + + @Override + public float getCompatAttackDamage() { + return attackDamage; + } + + @Override + public int getCompatEnchantability() { + return enchantability; + } + }; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java new file mode 100644 index 000000000..f68dd0bfb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java @@ -0,0 +1,43 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.util.math.Box; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; + +public class VoxelShapeUtil { + public static VoxelShape union(VoxelShape shape,VoxelShape... shapes) { + return VoxelShapes.union(shape, shapes); + } + + public static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) { + return VoxelShapes.cuboid(x1, y1, z1, x2, y2, z2); + } + + public static VoxelShape cuboid(double x, double y, double z, double size) { + return VoxelShapes.cuboid(x, y, z, x + size, y + size, z + size); + } + + public static VoxelShape cuboid(double size) { + return VoxelShapes.cuboid(0, 0, 0, size, size, size); + } + + public static VoxelShape centeredCuboid(double x, double y, double z, double size) { + return VoxelShapes.cuboid(x - size / 2, y - size / 2, z - size / 2, x + size / 2, y + size / 2, z + size / 2); + } + + public static VoxelShape empty() { + return VoxelShapes.empty(); + } + + public static VoxelShape fullCube() { + return VoxelShapes.fullCube(); + } + + public static VoxelShape blockCuboid(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { + return VoxelShapes.cuboid(minX / 16.0, minY / 16.0, minZ / 16.0, maxX / 16.0, maxY / 16.0, maxZ / 16.0); + } + + public static Box getBoundingBox(VoxelShape shape) { + return shape.getBoundingBox(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java new file mode 100644 index 000000000..183a6e34f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java @@ -0,0 +1,37 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.world.World; + +public class WorldRandomUtil { + public static int nextInt(World world) { + return world.getRandom().nextInt(); + } + + public static int nextInt(World world, int bound) { + return world.getRandom().nextInt(bound); + } + + public static long nextLong(World world) { + return world.getRandom().nextLong(); + } + + public static double nextDouble(World world) { + return world.getRandom().nextDouble(); + } + + public static double nextGaussian(World world) { + return world.getRandom().nextGaussian(); + } + + public static float nextFloat(World world) { + return world.getRandom().nextFloat(); + } + + public static int nextBetween(World world, int min, int max) { + return world.getRandom().nextBetween(min, max); + } + + public static int nextBetweenExclusive(World world, int min, int max) { + return world.getRandom().nextBetweenExclusive(min, max); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java new file mode 100644 index 000000000..c23143fee --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java @@ -0,0 +1,482 @@ +package net.pitan76.mcpitanlib.api.util; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.ShapeContext; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.*; +import net.minecraft.entity.mob.Monster; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.item.ItemStack; +import net.minecraft.particle.ParticleEffect; +import net.minecraft.predicate.entity.EntityPredicates; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.util.math.BoxUtil; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import net.pitan76.mcpitanlib.api.util.particle.CompatParticleType; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; +import org.jetbrains.annotations.Nullable; + +import java.util.*; +import java.util.function.Predicate; + +public class WorldUtil { + public static boolean hasSkyLight(World world) { + return world.getDimension().hasSkyLight(); + } + + public static boolean isThundering(World world) { + return world.isThundering(); + } + + public static boolean isRaining(World world) { + return world.isRaining(); + } + + public static boolean isNight(World world) { + return world.isNight(); + } + + public static boolean isDay(World world) { + return world.isDay(); + } + + public static boolean isSkyVisible(World world, BlockPos pos) { + return world.isSkyVisible(pos); + } + + public static boolean isClient(World world) { + return world.isClient(); + } + + public static void scheduleBlockTick(World world, BlockPos pos, Block block, int delay) { + world.scheduleBlockTick(pos, block, delay); + } + + public static void scheduleFluidTick(World world, BlockPos pos, Fluid fluid, int delay) { + world.scheduleFluidTick(pos, fluid, delay); + } + + public static boolean isServer(World world) { + return !isClient(world); + } + + public static void spawnStack(World world, BlockPos pos, ItemStack stack) { + spawnEntity(world, new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), stack)); + } + + public static void spawnExperienceOrb(World world, Vec3d pos, int amount) { + if (world instanceof ServerWorld) + ExperienceOrbEntity.spawn((ServerWorld) world, pos, amount); + } + + public static void spawnExperienceOrb(World world, BlockPos pos, int amount) { + spawnExperienceOrb(world, pos.toCenterPos(), amount); + } + + public static void spawnEntity(World world, Entity entity) { + world.spawnEntity(entity); + } + + public static void playSound(World world, @Nullable Player player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { + PlayerEntity entity = player == null ? null : player.getEntity(); + world.playSound(entity, pos, sound, category, volume, pitch); + } + + public static void playSound(World world, @Nullable Player player, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { + playSound(world, player, pos, sound.get(), category.get(), volume, pitch); + } + + public static void playSound(World world, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { + playSound(world, null, pos, sound.get(), category.get(), volume, pitch); + } + + public static void playSound(World world, double x, double y, double z, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, boolean useDistance) { + world.playSoundClient(x, y, z, sound.get(), category.get(), volume, pitch, useDistance); + } + + public static void sendEntityStatus(World world, Entity entity, byte status) { + world.sendEntityStatus(entity, status); + } + + public static BlockPos getSpawnPos(World world) { + return world.getSpawnPoint().getPos(); + } + + public static Optional getServer(World world) { + if (isClient(world)) return Optional.empty(); + return Optional.ofNullable(world.getServer()); + } + + public static ServerWorld getWorld(World world, Identifier worldId) { + Optional server = getServer(world); + return server.map(minecraftServer -> getWorld(minecraftServer, worldId)).orElse(null); + + } + + public static Optional getWorld(World world, CompatIdentifier worldId) { + return Optional.ofNullable(getWorld(world, worldId.toMinecraft())); + } + + public static ServerWorld getOverworld(MinecraftServer server) { + return server.getWorld(World.OVERWORLD); + } + + public static ServerWorld getNether(MinecraftServer server) { + return server.getWorld(World.NETHER); + } + + public static ServerWorld getEnd(MinecraftServer server) { + return server.getWorld(World.END); + } + + public static ServerWorld getWorld(MinecraftServer server, Identifier worldId) { + return server.getWorld(RegistryKey.of(RegistryKeys.WORLD, worldId)); + } + + public static ServerWorld getWorld(MinecraftServer server, CompatIdentifier worldId) { + return getWorld(server, worldId.toMinecraft()); + } + + public static Identifier getWorldId(World world) { + return world.getRegistryKey().getValue(); + } + + public static CompatIdentifier getCompatWorldId(World world) { + return CompatIdentifier.fromMinecraft(getWorldId(world)); + } + + public static boolean equals(World world, World world2) { + return Objects.equals(getWorldId(world), getWorldId(world2)); + } + + @Deprecated + public static void addTicket(ServerWorld world, net.minecraft.server.world.ChunkTicketType type, ChunkPos pos, int radius, T argument) { + world.getChunkManager().addTicket(type, pos, radius); + } + + @Deprecated + public static void removeTicket(ServerWorld world, net.minecraft.server.world.ChunkTicketType type, ChunkPos pos, int radius, T argument) { + world.getChunkManager().removeTicket(type, pos, radius); + } + + public static void addTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { + addTicket(world, type.getRaw(), pos, radius, argument); + } + + public static void removeTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { + removeTicket(world, type.getRaw(), pos, radius, argument); + } + + public static void addTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius) { + world.getChunkManager().addTicket(type.getRaw(), pos, radius); + } + + public static void removeTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius) { + world.getChunkManager().removeTicket(type.getRaw(), pos, radius); + } + + public static boolean isReceivingRedstonePower(World world, BlockPos pos) { + return world.isReceivingRedstonePower(pos); + } + + public static int getBottomY(World world) { + return world.getBottomY(); + } + + public static int getTopY(World world) { + return world.getTopYInclusive(); + } + + public static int getDimensionHeight(World world) { + return world.getDimension().height(); + } + + public static BlockEntity getBlockEntity(World world, BlockPos pos) { + return world.getBlockEntity(pos); + } + + public static boolean hasBlockEntity(World world, BlockPos pos) { + return getBlockEntity(world, pos) != null; + } + + public static BlockState getBlockState(World world, BlockPos pos) { + return world.getBlockState(pos); + } + + public static FluidState getFluidState(World world, BlockPos pos) { + return world.getFluidState(pos); + } + + public static boolean hasFluidState(World world, BlockPos pos) { + return ! getFluidState(world, pos).isEmpty(); + } + + public static boolean isAir(World world, BlockPos pos) { + return getBlockState(world, pos).isAir(); + } + + public static boolean setBlockState(World world, BlockPos pos, BlockState state, int flags) { + return world.setBlockState(pos, state, flags); + } + + public static boolean setBlockState(World world, BlockPos pos, BlockState state) { + return setBlockState(world, pos, state, 3); + } + + public static boolean setBlockState(World world, BlockPos pos, Block block, int flags) { + return setBlockState(world, pos, block.getDefaultState(), flags); + } + + public static boolean setBlockState(World world, BlockPos pos, Block block) { + return setBlockState(world, pos, block, 3); + } + + public static boolean breakBlock(World world, BlockPos pos, boolean drop) { + return world.breakBlock(pos, drop); + } + + public static boolean breakBlock(World world, BlockPos pos) { + return breakBlock(world, pos, true); + } + + public static boolean breakBlock(World world, BlockPos pos, boolean drop, @Nullable Player player) { + if (player == null) + return world.breakBlock(pos, drop, null); + + return world.breakBlock(pos, drop, player.getPlayerEntity()); + } + + public static boolean breakBlock(World world, BlockPos pos, @Nullable Player player) { + return breakBlock(world, pos, true, player); + } + + public static void removeBlockEntity(World world, BlockPos pos) { + world.removeBlockEntity(pos); + } + + public static boolean removeBlock(World world, BlockPos pos, boolean move) { + return world.removeBlock(pos, move); + } + + public static void addParticle(World world, ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + world.addParticleClient(parameters, x, y, z, velocityX, velocityY, velocityZ); + } + + public static boolean canSetBlock(World world, BlockPos pos) { + return world.canPlace(Blocks.STONE.getDefaultState(), pos, ShapeContext.absent()); + } + + public static void updateComparators(World world, BlockPos pos, Block block) { + world.updateComparators(pos, block); + } + + public static List getPlayers(World world) { + List players = new ArrayList<>(); + for (PlayerEntity player : world.getPlayers()) { + players.add(new Player(player)); + } + + return players; + } + + public static Player getPlayer(World world, UUID uuid) { + return new Player(world.getPlayerByUuid(uuid)); + } + + public static CompatRandom getRandom(World world) { + return new CompatRandom(world.getRandom()); + } + + public static long getTime(World world) { + return world.getTime(); + } + + public static List getEntitiesByType(World world, EntityType filter, Box box, Predicate predicate) { + return world.getEntitiesByType(filter, box, predicate); + } + + public static List getEntitiesByClass(World world, Class entityClass, Box box, Predicate predicate) { + return world.getEntitiesByClass(entityClass, box, predicate); + } + + public static void spawnParticles(World world, ParticleEffect parameters, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { + if (!isServer(world)) return; + + ((ServerWorld) world).spawnParticles(parameters, x, y, z, count, velocityX, velocityY, velocityZ, speed); + } + + public static void updateListeners(World world, BlockPos pos, BlockState oldState, BlockState newState, int flags) { + world.updateListeners(pos, oldState, newState, flags); + } + + public static net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState(World world, BlockPos pos) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState(world, pos)); + } + + public static boolean setBlockState(World world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { + return setBlockState(world, pos, state.toMinecraft(), flags); + } + + public static boolean setBlockState(World world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return setBlockState(world, pos, state, 3); + } + + public static boolean setBlockState(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { + return setBlockState(world, pos.toMinecraft(), state.toMinecraft(), flags); + } + + public static boolean setBlockState(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { + return setBlockState(world, pos, state, 3); + } + + public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop) { + return breakBlock(world, pos.toMinecraft(), drop); + } + + public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return breakBlock(world, pos, true); + } + + public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop, @Nullable Player player) { + return breakBlock(world, pos.toMinecraft(), drop, player); + } + + public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, @Nullable Player player) { + return breakBlock(world, pos, true, player); + } + + public static void removeBlockEntity(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + removeBlockEntity(world, pos.toMinecraft()); + } + + public static boolean removeBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean move) { + return removeBlock(world, pos.toMinecraft(), move); + } + + public static void playSound(net.pitan76.mcpitanlib.midohra.world.World world, @Nullable Player player, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { + playSound(world.getRaw(), player, pos.toMinecraft(), sound, category, volume, pitch); + } + + public static void dropStackOnBlock(World world, BlockPos pos, ItemStack stack) { + Block.dropStack(world, pos, stack); + } + + public static float getSkyAngle(World world, float tickDelta) { + long timeOfDay = world.getTimeOfDay(); + float f = ((float)(timeOfDay % 24000L) + tickDelta) / 24000.0F - 0.25F; + if (f < 0.0F) { + f += 1.0F; + } + if (f > 1.0F) { + f -= 1.0F; + } + return f; + } + + public static Block getBlock(World world, BlockPos pos) { + return getBlockState(world, pos).getBlock(); + } + + public static BlockWrapper getBlockWrapper(World world, BlockPos pos) { + return BlockWrapper.of(getBlock(world, pos)); + } + + public static List getEntitiesByType(World world, EntityType filter, Box box) { + return getEntitiesByType(world, filter, box, EntityPredicates.VALID_ENTITY); + } + + public static List getEntitiesByType(World world, EntityTypeWrapper filter, Box box, Predicate predicate) { + return getEntitiesByType(world, (EntityType) filter.get(), box, predicate); + } + + public static List getEntitiesByType(World world, EntityTypeWrapper filter, Box box) { + return getEntitiesByType(world, filter.get(), box); + } + + public static CompatIdentifier getOverworldId() { + return CompatIdentifier.fromMinecraft(World.OVERWORLD.getValue()); + } + + public static CompatIdentifier getNetherId() { + return CompatIdentifier.fromMinecraft(World.NETHER.getValue()); + } + + public static CompatIdentifier getEndId() { + return CompatIdentifier.fromMinecraft(World.END.getValue()); + } + + public static long getTimeOfDay(World world) { + return world.getTimeOfDay(); + } + + public static List getEntitiesByClass(World world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + return getEntitiesByClass(world, entityClass, box, EntityPredicates.VALID_ENTITY); + } + + public static List getEntitiesByClass(World world, Class entityClass, Box box) { + return getEntitiesByClass(world, entityClass, box, EntityPredicates.VALID_ENTITY); + } + + public static List getEntitiesByClass(World world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + return getEntitiesByClass(world, entityClass, box.toMinecraft(), predicate); + } + + public static List getEntitiesByClass(World world, Class entityClass, Vector3d center, double radius, Predicate predicate) { + Box box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); + return getEntitiesByClass(world, entityClass, box, predicate); + } + + public static List getEntitiesByClass(World world, Class entityClass, Vector3d center, double radius) { + return getEntitiesByClass(world, entityClass, center, radius, EntityPredicates.VALID_ENTITY); + } + + public static List getMonsters(World world, Box box) { + return world.getEntitiesByClass(LivingEntity.class, box, entity -> entity instanceof Monster); + } + + public static List getMonsters(World world, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + return getMonsters(world, box.toMinecraft()); + } + + public static List getMonsters(World world, Vector3d center, double radius) { + Box box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); + return getMonsters(world, box); + } + + public static List getEntitiesByType(World world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + return getEntitiesByType(world, filter, box.toMinecraft()); + } + + public static List getEntitiesByType(World world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + return getEntitiesByType(world, filter, box.toMinecraft(), predicate); + } + + /** + * ParticleType is a ParticleEffect only. + */ + public static void addParticle(World world, CompatParticleType parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + if (parameters.getRaw() instanceof ParticleEffect) + addParticle(world, (ParticleEffect) parameters.getRaw(), x, y, z, velocityX, velocityY, velocityZ); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java new file mode 100644 index 000000000..4c42a10e8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java @@ -0,0 +1,33 @@ +package net.pitan76.mcpitanlib.api.util.block; + +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; + +public class BlockHitResultUtil { + + public static BlockHitResult create(Vec3d pos, Direction direction, BlockPos blockPos, boolean insideBlock) { + return new BlockHitResult(pos, direction, blockPos, insideBlock); + } + + public static BlockHitResult create(Vec3d pos, Direction direction, BlockPos blockPos) { + return new BlockHitResult(pos, direction, blockPos, false); + } + + public static Vec3d getPos(BlockHitResult blockHitResult) { + return blockHitResult.getPos(); + } + + public static Direction getSide(BlockHitResult blockHitResult) { + return blockHitResult.getSide(); + } + + public static BlockPos getBlockPos(BlockHitResult blockHitResult) { + return blockHitResult.getBlockPos(); + } + + public static boolean isInsideBlock(BlockHitResult blockHitResult) { + return blockHitResult.isInsideBlock(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java new file mode 100644 index 000000000..4f1eae397 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java @@ -0,0 +1,235 @@ +package net.pitan76.mcpitanlib.api.util.block; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.v2.BlockUtilV2; + +import java.util.ArrayList; +import java.util.List; + +@SuppressWarnings("deprecation") +public class BlockUtil { + /** + * Check if two blocks are equal. + * @param block Block to compare. + * @param block2 Block to compare. + * @return If two blocks are equal. + */ + public static boolean isEqual(Block block, Block block2) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.isEqual(block, block2); + } + + /** + * Get block from CompatIdentifier. + * @param id CompatIdentifier of the block. + * @return Block of the CompatIdentifier. + */ + public static Block fromId(CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.fromId(id); + } + + public static Block fromId(String id) { + return fromId(CompatIdentifier.of(id)); + } + + public static Block fromId(String namespace, String path) { + return fromId(CompatIdentifier.of(namespace, path)); + } + + /** + * Get CompatIdentifier from Block. + * @param block Block to get CompatIdentifier. + * @return CompatIdentifier of the Block. + */ + public static CompatIdentifier toId(Block block) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.toCompatID(block); + } + + public static String toIdAsString(Block block) { + return toId(block).toString(); + } + + /** + * Check if the block exist. + * @param id CompatIdentifier of the block. + * @return If the block exist. + */ + public static boolean isExist(CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.isExist(id); + } + + public static boolean isExist(String id) { + return isExist(CompatIdentifier.of(id)); + } + + public static boolean isExist(String namespace, String path) { + return isExist(CompatIdentifier.of(namespace, path)); + } + + public static boolean isMinecraftBlock(Block block) { + return CompatIdentifier.isMinecraftNamespace(toId(block)); + } + + /** + * Create a new Block + * @param settings Block settings + * @return The new Block + */ + public static Block create(CompatibleBlockSettings settings) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.of(settings); + } + + /** + * Get all blocks. + * @return List of all blocks. + */ + public static List getBlocks() { + return net.pitan76.mcpitanlib.api.util.BlockUtil.getAllBlocks(); + } + + /** + * Get blocks from tag key. + * @param tagKey Tag key of the blocks. + * @return Blocks of the tag key. + */ + public static List getInTag(TagKey tagKey) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.getBlocks(tagKey); + } + + /** + * Get blocks from tag key. + * @param id CompatIdentifier of the tag key. + * @return Blocks of the tag key. + */ + public static List getInTag(CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.getBlocks(id.toMinecraft()); + } + + public static List getInTag(String id) { + return getInTag(CompatIdentifier.of(id)); + } + + public static List getInTag(String namespace, String path) { + return getInTag(CompatIdentifier.of(namespace, path)); + } + + /** + * Check if the block is in the tag. + * @param block Block to check. + * @param tagKey Tag key of the tag. + * @return If the block is in the tag. + */ + public static boolean isInTag(Block block, TagKey tagKey) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.isIn(block, tagKey); + } + + /** + * Check if the block is in the tag. + * @param block Block to check. + * @param id CompatIdentifier of the tag. + * @return If the block is in the tag. + */ + public static boolean isInTag(Block block, CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.isBlockInTag(block, id.toMinecraft()); + } + + public static boolean isInTag(Block block, String id) { + return isInTag(block, CompatIdentifier.of(id)); + } + + public static boolean isInTag(Block block, String namespace, String path) { + return isInTag(block, CompatIdentifier.of(namespace, path)); + } + + /** + * Get raw id of the block. + * @param block Block to get raw id. + * @return Raw id of the block. + */ + public static int getRawId(Block block) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.getRawId(block); + } + + /** + * Get block from raw id. + * @param rawId Raw id of the block. + * @return Block of the raw id. + */ + public static Block fromRawId(int rawId) { + return net.pitan76.mcpitanlib.api.util.BlockUtil.fromIndex(rawId); + } + + /** + * Get blocks in the namespace. + * @param namespace Namespace of the blocks. + * @return List of blocks in the namespace. + */ + public static List getBlocksInNamespace(String namespace) { + List blocks = new ArrayList<>(); + + for (Block block : getBlocks()) { + if (toId(block).getNamespace().equals(namespace)) { + blocks.add(block); + } + } + + return blocks; + } + + /** + * Get number of all blocks. + * @return Number of all blocks. + */ + public static int getNumberOfBlocks() { + return getBlocks().size(); + } + + /** + * Get item from block. + * @param block Block + * @return Item + */ + public static Item toItem(Block block) { + return block.asItem(); + } + + /** + * Get name of the block. + * @param block Block + * @return Name of the block. + */ + public static String getNameAsString(Block block) { + return block.getName().getString(); + } + + /** + * Get name of the block. + * @param block Block + * @return Name of the block. + */ + public static TextComponent getName(Block block) { + return new TextComponent(block.getName()); + } + + /** + * Get translation key of the block. + * @param block Block + * @return Translation key of the block. + */ + public static String getTranslationKey(Block block) { + return block.getTranslationKey(); + } + + public static Block fromItem(Item item) { + return BlockUtilV2.fromItem(item); + } + + public static Block fromItem(ItemStack stack) { + return BlockUtilV2.fromItem(stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java new file mode 100644 index 000000000..20199a63e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java @@ -0,0 +1,44 @@ +package net.pitan76.mcpitanlib.api.util.block.entity; + +import net.minecraft.block.entity.AbstractFurnaceBlockEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.AbstractCookingRecipe; +import net.minecraft.recipe.input.SingleStackRecipeInput; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.recipe.MatchGetter; +import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.recipe.input.SingleStackRecipeInputUtil; + +public class FurnaceUtil { + public static int getDefaultCookTime() { + return AbstractFurnaceBlockEntity.DEFAULT_COOK_TIME; + } + + public static boolean canUseAsFuel(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, World world) { + return canUseAsFuel(stack.toMinecraft(), world); + } + + public static boolean canUseAsFuel(ItemStack stack, World world) { + return world.getFuelRegistry().isFuel(stack); + } + + public static void tick(World world, BlockPos pos, AbstractFurnaceBlockEntity blockEntity) { + AbstractFurnaceBlockEntity.tick((ServerWorld) world, pos, WorldUtil.getBlockState(world, pos), blockEntity); + } + + public static int getCookTime(World world, AbstractFurnaceBlockEntity furnace, MatchGetter matchGetter) { + return getCookTime(world, furnace.getStack(0), matchGetter); + } + + public static int getCookTime(World world, ItemStack stack, MatchGetter matchGetter) { + CompatRecipeInput input = (CompatRecipeInput) SingleStackRecipeInputUtil.create(stack); + + matchGetter.getFirstMatch(input, world); + + return matchGetter.getFirstMatch(input, world).map( + (recipe) -> (recipe.getRecipe()).getCookingTime()).orElse(200); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java new file mode 100644 index 000000000..66a89f319 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; + +public class BlockEntityRendererUtil { + public static BlockEntityRendererFactory.Context convert(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { + return new BlockEntityRendererFactory.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getItemRenderer(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer(), ctx.getSpriteHolder(), ctx.getPlayerSkinRenderCache()); + } + + public static CompatRegistryClient.BlockEntityRendererFactory.Context convert(BlockEntityRendererFactory.Context ctx) { + return new CompatRegistryClient.BlockEntityRendererFactory.Context(ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java new file mode 100644 index 000000000..9b807f0ea --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java @@ -0,0 +1,117 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import com.mojang.authlib.GameProfile; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.Mouse; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.WorldRenderer; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.texture.TextureManager; +import net.minecraft.client.util.Window; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.resource.ResourceManager; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.profiler.Profiler; +import net.pitan76.mcpitanlib.api.client.option.GameOptionsWrapper; +import net.pitan76.mcpitanlib.api.entity.Player; + +import java.io.File; +import java.util.Optional; + +public class ClientUtil { + public static void setScreen(Screen screen) { + getClient().setScreen(screen); + } + + public static Screen getScreen() { + return getClient().currentScreen; + } + + public static Player getPlayer() { + return new Player(getClientPlayer()); + } + + public static ClientPlayerEntity getClientPlayer() { + return getClient().player; + } + + public static MinecraftClient getClient() { + return MinecraftClient.getInstance(); + } + + public static TextRenderer getTextRenderer() { + return getClient().textRenderer; + } + + public static ItemRenderer getItemRenderer() { + return getClient().getItemRenderer(); + } + + public static ResourceManager getResourceManager() { + return getClient().getResourceManager(); + } + + public static TextureManager getTextureManager() { + return getClient().getTextureManager(); + } + + public static ClientWorld getWorld() { + return getClient().world; + } + + public static GameRenderer getGameRenderer() { + return getClient().gameRenderer; + } + + public static Optional getTime() { + if (getClient().world == null) return Optional.empty(); + return Optional.of(getClient().world.getTime()); + } + + public static long getRenderTime() { + return getClient().getRenderTime(); + } + + public static HitResult getTarget() { + return getClient().crosshairTarget; + } + + public static WorldRenderer getWorldRenderer() { + return getClient().worldRenderer; + } + + public static File getRunDirectory() { + return getClient().runDirectory; + } + + public static Profiler getProfiler() { + return null; + } + + public static GameProfile getGameProfile() { + return getClient().getGameProfile(); + } + + public static Window getWindow() { + return getClient().getWindow(); + } + + public static Mouse getMouse() { + return getClient().mouse; + } + + public static boolean isInSingleplayer() { + return getClient().isInSingleplayer(); + } + + public static boolean isPaused() { + return getClient().isPaused(); + } + + public static GameOptionsWrapper getOptions() { + return new GameOptionsWrapper(getClient().options); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java new file mode 100644 index 000000000..89ce635d4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import net.minecraft.client.resource.language.I18n; +import net.minecraft.client.resource.language.LanguageManager; +import net.pitan76.mcpitanlib.midohra.resource.ResourceManager; + +public class LanguageUtil { + public static boolean hasTranslation(String key) { + return I18n.hasTranslation(key); + } + + public static String translate(String key) { + return I18n.translate(key); + } + + public static String translate(String key, Object... args) { + return I18n.translate(key, args); + } + + public static String translateWithFallback(String key, String fallback) { + return I18n.hasTranslation(key) ? I18n.translate(key) : fallback; + } + + public static String translateWithFallback(String key, String fallback, Object... args) { + return I18n.hasTranslation(key) ? I18n.translate(key, args) : fallback; + } + + public static LanguageManager getLanguageManager() { + return ClientUtil.getClient().getLanguageManager(); + } + + public static String getLanguage() { + return getLanguageManager().getLanguage(); + } + + public static void setLanguage(String language) { + getLanguageManager().setLanguage(language); + } + + public static void reload(net.minecraft.resource.ResourceManager resourceManager) { + getLanguageManager().reload(resourceManager); + } + + public static void reload(ResourceManager resourceManager) { + reload(resourceManager.getRaw()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java new file mode 100644 index 000000000..52a5d0a56 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import net.minecraft.client.util.math.MatrixStack; +import net.pitan76.mcpitanlib.api.util.MathUtil; + +import static net.pitan76.mcpitanlib.api.util.MathUtil.getRotationDegrees; + +public class MatrixStackUtil { + public static void multiply(MatrixStack matrixStack, MathUtil.RotationAxisType type, float deg) { + matrixStack.multiply(getRotationDegrees(type, deg)); + } + + public static void push(MatrixStack matrices) { + matrices.push(); + } + + public static void pop(MatrixStack matrices) { + matrices.pop(); + } + + public static void translate(MatrixStack matrices, double x, double y, double z) { + matrices.translate(x, y, z); + } + + public static void scale(MatrixStack matrices, float x, float y, float z) { + matrices.scale(x, y, z); + } + + public static MatrixStack.Entry peek(MatrixStack matrices) { + return matrices.peek(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java new file mode 100644 index 000000000..898acde1d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import net.minecraft.client.Mouse; + +public class MouseUtil { + + public static Mouse getMouse() { + return ClientUtil.getMouse(); + } + + public static double getMouseX() { + return getMouse().getX(); + } + + public static double getMouseY() { + return getMouse().getY(); + } + + public static boolean isCursorLocked() { + return getMouse().isCursorLocked(); + } + + public static void lockCursor() { + getMouse().lockCursor(); + } + + public static void unlockCursor() { + getMouse().unlockCursor(); + } + + public static void tick() { + getMouse().tick(); + } + + public static boolean wasLeftButtonClicked() { + return getMouse().wasLeftButtonClicked(); + } + + public static boolean wasRightButtonClicked() { + return getMouse().wasRightButtonClicked(); + } + + public static boolean wasMiddleButtonClicked() { + return getMouse().wasMiddleButtonClicked(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java new file mode 100644 index 000000000..7f4609c54 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.resources.Identifier; + +public class RenderUtil { + public static void setShaderToPositionTexProgram() { + // -1.21.4 + } + + public static void setShaderColor(float red, float green, float blue, float alpha) { + //RenderSystem.setShaderColor(red, green, blue, alpha); + } + + public static void setShaderTexture(int texture, Identifier id) { + // -1.21.4 + } + + public static void enableDepthTest() { + // -1.21.4 + } + + public static void enableTexture() { + // ~1.19.2 + } + + public static void disableTexture() { + // ~1.19.2 + } + + public static class RendererUtil extends ScreenUtil.RendererUtil {} +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java new file mode 100644 index 000000000..9f359afa0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java @@ -0,0 +1,224 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gl.RenderPipelines; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.screen.ScreenTexts; +import net.minecraft.text.OrderedText; +import net.minecraft.text.Text; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; +import net.pitan76.mcpitanlib.api.client.gui.widget.RedrawableTexturedButtonWidget; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +@Environment(EnvType.CLIENT) +public class ScreenUtil { + public static void setBackground(Identifier GUI, float f, float g, float h, float i) { + RenderUtil.setShaderToPositionTexProgram(); + RenderUtil.setShaderColor(f, g, h, i); + RenderUtil.setShaderTexture(0, GUI); + + // GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + // MinecraftClient.getInstance().getTextureManager().bindTexture(GUI); + } + + public static void setBackground(Identifier GUI) { + setBackground(GUI, 1.0F, 1.0F, 1.0F, 1.0F); + } + + // ~1.19.2 + public static void setRepeatEvents(boolean isRepeatEvents) { + } + + // ~1.19.4 + public static void setPassEvents(Screen screen, boolean isPassEvents) { + } + + public static ButtonWidget createButtonWidget(int x, int y, int width, int height, Text message, ButtonWidget.PressAction onPress) { + return createButtonWidget(x, y, width, height, message, onPress, null); + } + + public static ButtonWidget createButtonWidget(int x, int y, int width, int height, Text message, ButtonWidget.PressAction onPress, @Nullable ButtonWidget.NarrationSupplier tooltipSupplier) { + ButtonWidget.Builder builder = ButtonWidget.builder(message, onPress).dimensions(x, y, width , height); + if (tooltipSupplier != null) + builder.narrationSupplier(tooltipSupplier); + + return builder.build(); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { + return createTexturedButtonWidget(x, y, width, height, u, v, height, texture, pressAction); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { + return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, Texts.empty()); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + return new CompatibleTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { + return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, height, texture, pressAction); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { + return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, Texts.empty()); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + return new RedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + return createTexturedButtonWidget(x, y, width, height, u, v, height, texture.toMinecraft(), pressAction); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); + } + + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, message); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, texture.toMinecraft(), pressAction); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); + } + + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, message); + } + + + + public static class Texts { + public static Text empty() { + return ScreenTexts.EMPTY; + } + } + + public static class TextFieldUtil extends net.pitan76.mcpitanlib.api.util.client.widget.TextFieldUtil { + // Nothing + } + + public static class ClickableWidgetUtil extends net.pitan76.mcpitanlib.api.util.client.widget.ClickableWidgetUtil { + // Nothing + } + + public static class RendererUtil { + public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, Text text, int x, int y, int color) { + drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); + return -1; + } + + public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, String text, int x, int y, int color) { + drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); + return -1; + } + + public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, OrderedText text, int x, int y, int color) { + drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); + return -1; + } + + public static void drawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + drawObjectDM.getContext().drawTexture(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, textureWidth, textureHeight); + } + + public static void drawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, float u, float v, int width, int height) { + drawObjectDM.getContext().drawTexture(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, 256, 256); + } + + public static TextRenderer getTextRenderer() { + return MinecraftClient.getInstance().textRenderer; + } + + public static void drawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + drawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height, textureWidth, textureHeight); + } + + public static void drawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, float u, float v, int width, int height) { + drawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); + } + + public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y, int color) { + return drawText(renderer, drawObjectDM, text.getText(), x, y, color); + } + + public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, Text text, int x, int y) { + return drawText(renderer, drawObjectDM, text, x, y, -12566464); + } + + public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { + return drawText(renderer, drawObjectDM, text, x, y, -12566464); + } + + public static void drawTooltip(DrawObjectDM drawObjectDM, TextRenderer textRenderer, Text text, int x, int y) { + drawObjectDM.getContext().drawTooltip(textRenderer, text, x, y); + } + + public static void drawTooltip(DrawObjectDM drawObjectDM, TextRenderer textRenderer, List texts, int x, int y) { + drawObjectDM.getContext().drawTooltip(textRenderer, texts, x, y); + } + + public static void drawBorder(DrawObjectDM drawObjectDM, int x, int y, int width, int height, int color) { + // TODO: drawBorderを一時的に廃止 + //drawObjectDM.getContext().drawBorder(x, y, width, height, color); + } + + public static void drawTooltip(DrawObjectDM drawObjectDM, Text text, int x, int y) { + drawObjectDM.getContext().drawTooltip(getTextRenderer(), text, x, y); + } + + public static void drawTooltip(DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { + drawTooltip(drawObjectDM, text.getText(), x, y); + } + + public static void drawTooltip(DrawObjectDM drawObjectDM, List texts, int x, int y) { + drawObjectDM.getContext().drawTooltip(getTextRenderer(), texts, x, y); + } + } + + public static int getWidth(Text text) { + return RendererUtil.getTextRenderer().getWidth(text); + } + + // RGBからARGBに変換する (1.21.6からは透明になるため) + private static int fixColor(int color) { + if ((color >>> 24) == 0) { + return 0xFF000000 | color; + } else { + return color; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java new file mode 100644 index 000000000..a57e74910 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.api.util.client; + +import net.minecraft.client.util.Window; + +public class WindowUtil { + + public static Window getWindow() { + return ClientUtil.getWindow(); + } + + public static int getWindowScaledWidth() { + return getWindow().getScaledWidth(); + } + + public static int getWindowScaledHeight() { + return getWindow().getScaledHeight(); + } + + public static int getWindowWidth() { + return getWindow().getWidth(); + } + + public static int getWindowHeight() { + return getWindow().getHeight(); + } + + public static int getWindowX() { + return getWindow().getX(); + } + + public static int getWindowY() { + return getWindow().getY(); + } + + public static void setTitle(String title) { + getWindow().setTitle(title); + } + + public static void close() { + getWindow().close(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java new file mode 100644 index 000000000..d6567bf1f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.api.util.client.render; + +import net.minecraft.item.ItemDisplayContext; +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class CompatItemDisplayContext implements CompatStringIdentifiable { + private final ItemDisplayContext context; + + public static final CompatItemDisplayContext NONE = of(ItemDisplayContext.NONE); + public static final CompatItemDisplayContext THIRD_PERSON_LEFT_HAND = of(ItemDisplayContext.THIRD_PERSON_LEFT_HAND); + public static final CompatItemDisplayContext THIRD_PERSON_RIGHT_HAND = of(ItemDisplayContext.THIRD_PERSON_RIGHT_HAND); + public static final CompatItemDisplayContext FIRST_PERSON_LEFT_HAND = of(ItemDisplayContext.FIRST_PERSON_LEFT_HAND); + public static final CompatItemDisplayContext FIRST_PERSON_RIGHT_HAND = of(ItemDisplayContext.FIRST_PERSON_RIGHT_HAND); + public static final CompatItemDisplayContext HEAD = of(ItemDisplayContext.HEAD); + public static final CompatItemDisplayContext GUI = of(ItemDisplayContext.GUI); + public static final CompatItemDisplayContext GROUND = of(ItemDisplayContext.GROUND); + public static final CompatItemDisplayContext FIXED = of(ItemDisplayContext.FIXED); + public static final CompatItemDisplayContext ON_SHELF = of(ItemDisplayContext.ON_SHELF); + + public CompatItemDisplayContext(ItemDisplayContext context) { + this.context = context; + } + + public static CompatItemDisplayContext of(ItemDisplayContext context) { + return new CompatItemDisplayContext(context); + } + + public ItemDisplayContext getContext() { + return context; + } + + public String getName() { + return context.name(); + } + + @Override + public String asString_compat() { + return getName(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java new file mode 100644 index 000000000..3a7e8b59f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.api.util.client.render; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.item.ItemModelManager; +import net.minecraft.client.render.item.ItemRenderState; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; + +/** + * Cross-version utility for rendering items in block entity renderers. + */ +public class CompatItemRenderUtil { + /** + * Renders an ItemStack in FIXED transform mode. + */ + public static void renderItemFixed(ItemStack stack, BlockEntityRenderEvent e, World world) { + renderItem(stack, CompatItemDisplayContext.FIXED, e, world); + } + + /** + * Renders an ItemStack + */ + public static void renderItem(ItemStack stack, CompatItemDisplayContext displayContext, BlockEntityRenderEvent e, World world) { + ItemModelManager manager = e.ctx != null ? e.ctx.getItemModelManager() : MinecraftClient.getInstance().getItemModelManager(); + + ItemRenderState state = new ItemRenderState(); + manager.clearAndUpdate(state, stack, displayContext.getContext(), world, null, 0); + + int light = e.getLight(); + if (light == 0) light = 0xF000F0; // full-bright fallback if not populated by MCPitanLib + int overlay = e.getOverlay(); + + state.render(e.matrices, e.getQueue(), light, overlay, 0); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java new file mode 100644 index 000000000..6121672b7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java @@ -0,0 +1,203 @@ +package net.pitan76.mcpitanlib.api.util.client.render; + +import net.minecraft.client.render.OverlayTexture; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.util.math.MatrixStack; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; +import org.joml.Matrix3f; +import org.joml.Matrix4f; + +public class VertexConsumerUtil { + public static VertexConsumer vertex(VertexConsumer vertexConsumer, float x, float y, float z) { + return vertexConsumer.vertex(x, y, z); + } + + public static VertexConsumer vertex(VertexConsumer vertexConsumer, MatrixStack stack, float x, float y, float z) { + return vertexConsumer.vertex(stack.peek(), x, y, z); + } + + public static VertexConsumer normal(VertexConsumer vertexConsumer, float x, float y, float z) { + return vertexConsumer.normal(x, y, z); + } + + public static VertexConsumer color(VertexConsumer vertexConsumer, float red, float green, float blue, float alpha) { + return vertexConsumer.color(red, green, blue, alpha); + } + + public static VertexConsumer color(VertexConsumer vertexConsumer, int red, int green, int blue, int alpha) { + return vertexConsumer.color(red, green, blue, alpha); + } + + public static VertexConsumer colorARGB(VertexConsumer vertexConsumer, int argb) { + return vertexConsumer.color(argb); + } + + public static VertexConsumer colorRGB(VertexConsumer vertexConsumer, int rgb) { + return colorARGB(vertexConsumer, (0xFF << 24) | (rgb & 0xFFFFFF)); + } + + public static VertexConsumer light(VertexConsumer vertexConsumer, int light) { + return vertexConsumer.light(light); + } + + public static VertexConsumer overlay(VertexConsumer vertexConsumer, int overlay) { + return vertexConsumer.overlay(overlay); + } + + public static VertexConsumer overlayDefaultUV(VertexConsumer vertexConsumer) { + return vertexConsumer.overlay(OverlayTexture.DEFAULT_UV); + } + + public static DrawObjectMV vertex(DrawObjectMV drawObject, float x, float y, float z) { + vertex(drawObject.getBuffer(), drawObject.getStack(), x, y, z); + return drawObject; + } + + public static DrawObjectMV normal(DrawObjectMV drawObject, float x, float y, float z) { + normal(drawObject.getBuffer(), x, y, z); + return drawObject; + } + + public static DrawObjectMV color(DrawObjectMV drawObject, float red, float green, float blue, float alpha) { + color(drawObject.getBuffer(), red, green, blue, alpha); + return drawObject; + } + + public static DrawObjectMV color(DrawObjectMV drawObject, int red, int green, int blue, int alpha) { + color(drawObject.getBuffer(), red, green, blue, alpha); + return drawObject; + } + + public static DrawObjectMV colorARGB(DrawObjectMV drawObject, int argb) { + colorARGB(drawObject.getBuffer(), argb); + return drawObject; + } + + public static DrawObjectMV colorRGB(DrawObjectMV drawObject, int rgb) { + colorRGB(drawObject.getBuffer(), rgb); + return drawObject; + } + + public static DrawObjectMV light(DrawObjectMV drawObject, int light) { + light(drawObject.getBuffer(), light); + return drawObject; + } + + public static DrawObjectMV overlay(DrawObjectMV drawObject, int overlay) { + overlay(drawObject.getBuffer(), overlay); + return drawObject; + } + + public static DrawObjectMV overlayDefaultUV(DrawObjectMV drawObject) { + overlayDefaultUV(drawObject.getBuffer()); + return drawObject; + } + + public static VertexConsumer texture(VertexConsumer vertexConsumer, float u, float v) { + return vertexConsumer.texture(u, v); + } + + public static VertexConsumer vertex(VertexConsumer vertexConsumer, Matrix4f matrix4f, float x, float y, float z) { + return vertexConsumer.vertex(matrix4f, x, y, z); + } + + public static VertexConsumer normal(VertexConsumer vertexConsumer, MatrixStack stack, float x, float y, float z) { + return vertexConsumer.normal(stack.peek(), x, y, z); + } + + public static VertexConsumer next(VertexConsumer vertexConsumer) { + return vertexConsumer; + } + + public static void renderQuad(VertexConsumer vertexConsumer, MatrixStack stack, Matrix4f matrix4f, Matrix3f matrix3f, + float x1, float y1, float z1, float x2, float y2, float z2, + float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + + float[][] vertexes = new float[4][3]; + + if (Math.abs(normalY) > 0.5f) { + if (normalY > 0) { + vertexes = new float[][]{ + {x1, y1, z1}, + {x1, y1, z2}, + {x2, y1, z2}, + {x2, y1, z1} + }; + + } else { + vertexes = new float[][]{ + {x1, y1, z1}, + {x2, y1, z1}, + {x2, y1, z2}, + {x1, y1, z2} + }; + } + } else if (Math.abs(normalZ) > 0.5f) { + if (normalZ > 0) { + vertexes = new float[][]{ + {x1, y1, z1}, + {x2, y1, z1}, + {x2, y2, z1}, + {x1, y2, z1} + }; + } else { + vertexes = new float[][]{ + {x1, y1, z1}, + {x1, y2, z1}, + {x2, y2, z1}, + {x2, y1, z1} + }; + } + } else if (Math.abs(normalX) > 0.5f) { + if (normalX > 0) { + vertexes = new float[][]{ + {x1, y1, z1}, + {x1, y2, z1}, + {x1, y2, z2}, + {x1, y1, z2} + }; + } else { + vertexes = new float[][]{ + {x1, y1, z1}, + {x1, y1, z2}, + {x1, y2, z2}, + {x1, y2, z1} + }; + } + } + + for (float[] vertex : vertexes) { + if (vertex.length != 3) continue; + + vertex(vertexConsumer, matrix4f, vertex[0], vertex[1], vertex[2]); + color(vertexConsumer, r, g, b, alpha); + texture(vertexConsumer, u, v); + light(vertexConsumer, light); + normal(vertexConsumer, stack, normalX, normalY, normalZ); + next(vertexConsumer); + } + } + + public static void renderQuad(DrawObjectMV drawObject, Matrix4f matrix4f, Matrix3f matrix3f, + float x1, float y1, float z1, float x2, float y2, float z2, + float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + renderQuad(drawObject.getBuffer(), drawObject.getStack(), matrix4f, matrix3f, + x1, y1, z1, x2, y2, z2, + normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); + + } + + public static void renderQuad(DrawObjectMV drawObject, + float x1, float y1, float z1, float x2, float y2, float z2, + float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + + Matrix4f matrix4f = drawObject.getMatrix4f(); + Matrix3f matrix3f = drawObject.getMatrix3f(); + + renderQuad(drawObject.getBuffer(), drawObject.getStack(), matrix4f, matrix3f, + x1, y1, z1, x2, y2, z2, + normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); + + } +} + diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java new file mode 100644 index 000000000..8744b12e6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java @@ -0,0 +1,114 @@ +package net.pitan76.mcpitanlib.api.util.client.render; + +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexRendering; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.Box; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; +import org.joml.Matrix3f; +import org.joml.Matrix4f; + +import java.util.Optional; + +public class VertexRenderingUtil { + public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + MatrixStack.Entry entry = matrices.peek(); + + drawLine(buffer, entry, minX, minY, minZ, maxX, minY, minZ, red, green, blue, alpha); + drawLine(buffer, entry, minX, minY, maxZ, maxX, minY, maxZ, red, green, blue, alpha); + drawLine(buffer, entry, minX, maxY, minZ, maxX, maxY, minZ, red, green, blue, alpha); + drawLine(buffer, entry, minX, maxY, maxZ, maxX, maxY, maxZ, red, green, blue, alpha); + + drawLine(buffer, entry, minX, minY, minZ, minX, maxY, minZ, red, green, blue, alpha); + drawLine(buffer, entry, maxX, minY, minZ, maxX, maxY, minZ, red, green, blue, alpha); + drawLine(buffer, entry, minX, minY, maxZ, minX, maxY, maxZ, red, green, blue, alpha); + drawLine(buffer, entry, maxX, minY, maxZ, maxX, maxY, maxZ, red, green, blue, alpha); + + drawLine(buffer, entry, minX, minY, minZ, minX, minY, maxZ, red, green, blue, alpha); + drawLine(buffer, entry, maxX, minY, minZ, maxX, minY, maxZ, red, green, blue, alpha); + drawLine(buffer, entry, minX, maxY, minZ, minX, maxY, maxZ, red, green, blue, alpha); + drawLine(buffer, entry, maxX, maxY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); + } + + public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha, float xAxisRed, float yAxisGreen, float zAxisBlue) { + MatrixStack.Entry entry = matrices.peek(); + + drawLine(buffer, entry, minX, minY, minZ, maxX, minY, minZ, xAxisRed, green, blue, alpha); + drawLine(buffer, entry, minX, minY, maxZ, maxX, minY, maxZ, xAxisRed, green, blue, alpha); + drawLine(buffer, entry, minX, maxY, minZ, maxX, maxY, minZ, xAxisRed, green, blue, alpha); + drawLine(buffer, entry, minX, maxY, maxZ, maxX, maxY, maxZ, xAxisRed, green, blue, alpha); + + drawLine(buffer, entry, minX, minY, minZ, minX, maxY, minZ, red, yAxisGreen, blue, alpha); + drawLine(buffer, entry, maxX, minY, minZ, maxX, maxY, minZ, red, yAxisGreen, blue, alpha); + drawLine(buffer, entry, minX, minY, maxZ, minX, maxY, maxZ, red, yAxisGreen, blue, alpha); + drawLine(buffer, entry, maxX, minY, maxZ, maxX, maxY, maxZ, red, yAxisGreen, blue, alpha); + + drawLine(buffer, entry, minX, minY, minZ, minX, minY, maxZ, red, green, zAxisBlue, alpha); + drawLine(buffer, entry, maxX, minY, minZ, maxX, minY, maxZ, red, green, zAxisBlue, alpha); + drawLine(buffer, entry, minX, maxY, minZ, minX, maxY, maxZ, red, green, zAxisBlue, alpha); + drawLine(buffer, entry, maxX, maxY, minZ, maxX, maxY, maxZ, red, green, zAxisBlue, alpha); + } + + public static void drawFilledBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + MatrixStack.Entry entry = matrices.peek(); + Matrix4f positionMatrix = entry.getPositionMatrix(); + + drawQuad(buffer, positionMatrix, minX, minY, minZ, maxX, minY, minZ, maxX, minY, maxZ, minX, minY, maxZ, red, green, blue, alpha); + drawQuad(buffer, positionMatrix, minX, maxY, minZ, minX, maxY, maxZ, maxX, maxY, maxZ, maxX, maxY, minZ, red, green, blue, alpha); + drawQuad(buffer, positionMatrix, minX, minY, minZ, minX, maxY, minZ, maxX, maxY, minZ, maxX, minY, minZ, red, green, blue, alpha); + drawQuad(buffer, positionMatrix, minX, minY, maxZ, maxX, minY, maxZ, maxX, maxY, maxZ, minX, maxY, maxZ, red, green, blue, alpha); + drawQuad(buffer, positionMatrix, minX, minY, minZ, minX, minY, maxZ, minX, maxY, maxZ, minX, maxY, minZ, red, green, blue, alpha); + drawQuad(buffer, positionMatrix, maxX, minY, minZ, maxX, maxY, minZ, maxX, maxY, maxZ, maxX, minY, maxZ, red, green, blue, alpha); + } + + public static void drawBox(DrawObjectMV drawObject, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + drawBox(drawObject.getStack(), drawObject.getBuffer(), minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); + } + + public static void drawBox(DrawObjectMV drawObject, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha, float xAxisRed, float yAxisGreen, float zAxisBlue) { + drawBox(drawObject.getStack(), drawObject.getBuffer(), minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha, xAxisRed, yAxisGreen, zAxisBlue); + } + + public static void drawFilledBox(DrawObjectMV drawObject, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + drawFilledBox(drawObject.getStack(), drawObject.getBuffer(), minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); + } + + public static void renderQuad(VertexConsumer vertexConsumer, MatrixStack stack, Matrix4f matrix4f, Matrix3f matrix3f, float x1, float y1, float z1, float x2, float y2, float z2, float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + VertexConsumerUtil.renderQuad(vertexConsumer, stack, matrix4f, matrix3f, x1, y1, z1, x2, y2, z2, normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); + } + + public static void renderQuad(DrawObjectMV drawObject, float x1, float y1, float z1, float x2, float y2, float z2, float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + renderQuad(drawObject.getBuffer(), drawObject.getStack(), drawObject.getMatrix4f(), drawObject.getMatrix3f(), x1, y1, z1, x2, y2, z2, normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); + } + + // TODO: all version impl + private static void drawQuad(VertexConsumer buffer, Matrix4f matrix, double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, float red, float green, float blue, float alpha) { + VertexConsumerUtil.vertex(buffer, matrix, (float)x1, (float)y1, (float)z1).color(red, green, blue, alpha); + VertexConsumerUtil.vertex(buffer, matrix, (float)x2, (float)y2, (float)z2).color(red, green, blue, alpha); + VertexConsumerUtil.vertex(buffer, matrix, (float)x3, (float)y3, (float)z3).color(red, green, blue, alpha); + VertexConsumerUtil.vertex(buffer, matrix, (float)x4, (float)y4, (float)z4).color(red, green, blue, alpha); + } + + // TODO: all version impl + private static void drawLine(VertexConsumer consumer, MatrixStack.Entry entry, double x1, double y1, double z1, double x2, double y2, double z2, float red, float green, float blue, float alpha) { + float dx = (float)(x2 - x1); + float dy = (float)(y2 - y1); + float dz = (float)(z2 - z1); + float len = (float)Math.sqrt(dx * dx + dy * dy + dz * dz); + float nx = len == 0.0f ? 0.0f : dx / len; + float ny = len == 0.0f ? 1.0f : dy / len; + float nz = len == 0.0f ? 0.0f : dz / len; + + VertexConsumerUtil.vertex(consumer, entry.getPositionMatrix(), (float)x1, (float)y1, (float)z1); + VertexConsumerUtil.color(consumer, red, green, blue, alpha); + VertexConsumerUtil.normal(consumer, nx, ny, nz); + consumer.lineWidth(2.0f); // + VertexConsumerUtil.next(consumer); + + VertexConsumerUtil.vertex(consumer, entry.getPositionMatrix(), (float)x2, (float)y2, (float)z2); + VertexConsumerUtil.color(consumer, red, green, blue, alpha); + VertexConsumerUtil.normal(consumer, nx, ny, nz); + consumer.lineWidth(2.0f); // + VertexConsumerUtil.next(consumer); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java new file mode 100644 index 000000000..8160f8ba9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.util.client.render; + +import net.minecraft.client.render.WorldRenderer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public class WorldRendererUtil { + public static int getLightmapCoordinates(World world, BlockPos pos) { + return WorldRenderer.getLightmapCoordinates(world, pos); + } + + public static int getLightmapCoordinates(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return getLightmapCoordinates(world.getRaw(), pos.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java new file mode 100644 index 000000000..cc3313a48 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java @@ -0,0 +1,9 @@ +package net.pitan76.mcpitanlib.api.util.client.v2; + +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class RenderUtil extends net.pitan76.mcpitanlib.api.util.client.RenderUtil { + public static void setShaderTexture(int texture, CompatIdentifier id) { + setShaderTexture(texture, id.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java new file mode 100644 index 000000000..ac619fbdd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.api.util.client.v2; + +import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.screen.Screen; + +public class ScreenUtil extends net.pitan76.mcpitanlib.api.util.client.ScreenUtil { + + public static void setFocus(Screen screen, boolean focus) { + screen.setFocused(focus); + } + + public static void setFocus(Screen screen, Element element) { + screen.setFocused(element); + } + + public static boolean isFocused(Screen screen) { + return screen.isFocused(); + } + + public static void setDragging(Screen screen, boolean dragging) { + screen.setDragging(dragging); + } + + public static boolean isDragging(Screen screen) { + return screen.isDragging(); + } + + public static int getWidth(Screen screen) { + return screen.width; + } + + public static int getHeight(Screen screen) { + return screen.height; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java new file mode 100644 index 000000000..7182eb723 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.util.client.widget; + +import net.minecraft.client.gui.widget.ClickableWidget; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; + +public class ClickableWidgetUtil { + public static void render(ClickableWidget widget, RenderArgs args) { + widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java new file mode 100644 index 000000000..78f8ec4af --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java @@ -0,0 +1,79 @@ +package net.pitan76.mcpitanlib.api.util.client.widget; + +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.widget.TextFieldWidget; +import net.minecraft.client.input.CharInput; +import net.minecraft.client.input.KeyInput; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +public class TextFieldUtil { + public static void setFocused(TextFieldWidget widget, boolean focused) { + widget.setFocused(focused); + } + + public static void render(TextFieldWidget widget, RenderArgs args) { + widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + } + + public static void setEditable(TextFieldWidget widget, boolean editable) { + widget.setEditable(editable); + } + + public static void setMaxLength(TextFieldWidget widget, int maxLength) { + widget.setMaxLength(maxLength); + } + + public static void setSuggestion(TextFieldWidget widget, String suggestion) { + widget.setSuggestion(suggestion); + } + + public static void setText(TextFieldWidget widget, String text) { + widget.setText(text); + } + + public static String getText(TextFieldWidget widget) { + return widget.getText(); + } + + public static void setDrawsBackground(TextFieldWidget widget, boolean drawsBackground) { + widget.setDrawsBackground(drawsBackground); + } + + public static void setFocusUnlocked(TextFieldWidget widget, boolean focusUnlocked) { + widget.setFocusUnlocked(focusUnlocked); + } + + public static boolean isFocused(TextFieldWidget widget) { + return widget.isFocused(); + } + + public static boolean keyPressed(TextFieldWidget widget, int keyCode, int scanCode, int modifiers) { + return widget.keyPressed(new KeyInput(keyCode, scanCode, modifiers)); + } + + public static boolean keyReleased(TextFieldWidget widget, int keyCode, int scanCode, int modifiers) { + return widget.keyReleased(new KeyInput(keyCode, scanCode, modifiers)); + } + + public static boolean charTyped(TextFieldWidget widget, char chr, int modifiers) { + return widget.charTyped(new CharInput(chr, modifiers)); + } + + public static TextFieldWidget create(TextRenderer renderer, int x, int y, int width, int height, Text text) { + return new TextFieldWidget(renderer, x, y, width, height, text); + } + + public static TextFieldWidget create(TextRenderer renderer, int width, int height, Text text) { + return new TextFieldWidget(renderer, width, height, text); + } + + public static TextFieldWidget create(TextRenderer renderer, int x, int y, int width, int height) { + return new TextFieldWidget(renderer, x, y, width, height, TextUtil.empty()); + } + + public static TextFieldWidget create(TextRenderer renderer, int width, int height) { + return new TextFieldWidget(renderer, width, height, TextUtil.empty()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java new file mode 100644 index 000000000..432caf05f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java @@ -0,0 +1,100 @@ +package net.pitan76.mcpitanlib.api.util.collection; + +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.util.inventory.ClippedInventory; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import org.jetbrains.annotations.NotNull; + +public class ClippedItemStackList extends ItemStackList { + + public final ItemStackList list; + public final int start; + public final int end; + + public ClippedItemStackList(ItemStackList list, int start, int end) { + super(null, null); + this.list = list; + if (start < 0 || end > list.size() || start >= end) { + throw new IllegalArgumentException("Invalid start or end indices for clipping item stack list."); + } + this.start = start; + this.end = end; + } + + public static ClippedItemStackList of(ItemStackList list, int start, int end) { + return new ClippedItemStackList(list, start, end); + } + + public static ClippedItemStackList of(ItemStackList list) { + return of(list, 0, list.size()); + } + + public static ClippedItemStackList of(ItemStackList list, int start) { + return of(list, start, list.size()); + } + + @Override + public int size() { + return end - start; + } + + @Override + public Inventory toInventory() { + return ClippedInventory.of(list.toInventory(), start, end); + } + + @Override + public DefaultedList defaultedList() { + DefaultedList clippedList = DefaultedList.ofSize(size(), ItemStackUtil.empty()); + for (int i = 0; i < size(); i++) + clippedList.set(i, get(i)); + + return clippedList; + } + + @Override + public @NotNull ItemStack get(int index) { + return list.get(start + index); + } + + @Override + public ItemStack set(int index, ItemStack element) { + return list.set(start + index, element); + } + + @Override + public ItemStack remove(int index) { + return list.remove(start + index); + } + + @Override + public boolean contains(Object o) { + for (int i = start; i < end; i++) { + if (list.get(i).equals(o)) { + return true; + } + } + return false; + } + + @Override + public boolean isEmpty() { + for (int i = start; i < end; i++) { + if (!list.get(i).isEmpty()) { + return false; + } + } + return true; + } + + @Override + public void clear() { + for (int i = start; i < end; i++) { + list.set(i, ItemStackUtil.empty()); + } + } + + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java new file mode 100644 index 000000000..5db1133ae --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.util.collection; + +import net.minecraft.util.collection.DefaultedList; + +public class DefaultedListUtil { + + public static DefaultedList of() { + return DefaultedList.of(); + } + + public static DefaultedList ofSize(int size, E defaultElement) { + return DefaultedList.ofSize(size, defaultElement); + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java new file mode 100644 index 000000000..3bf041152 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java @@ -0,0 +1,214 @@ +package net.pitan76.mcpitanlib.api.util.collection; + +import com.google.common.collect.Lists; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import org.apache.commons.lang3.Validate; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ItemStackList extends DefaultedList { + + public ItemStackList(List delegate, @Nullable ItemStack initialElement) { + super(delegate, initialElement); + } + + public static ItemStackList of() { + return new ItemStackList(Lists.newArrayList(), ItemStackUtil.empty()); + } + + public static ItemStackList ofSize(int size) { + return ofSize(size, ItemStackUtil.empty()); + } + + public static ItemStackList ofSize(int size, ItemStack defaultStack) { + Validate.notNull(defaultStack); + ItemStack[] objects = new ItemStack[size]; + Arrays.fill(objects, defaultStack); + return new ItemStackList(Arrays.asList(objects), defaultStack); + } + + public static ItemStackList copyOf(ItemStack defaultStack, ItemStack... stacks) { + return new ItemStackList(Arrays.asList(stacks), defaultStack); + } + + public static Inventory toInventory(DefaultedList list) { + return IInventory.of(list); + } + + public static DefaultedList toDefaultedList(Inventory inventory) { + DefaultedList list = DefaultedList.ofSize(inventory.size(), ItemStackUtil.empty()); + for (int i = 0; i < inventory.size(); i++) { + list.set(i, inventory.getStack(i)); + } + + return list; + } + + public static ItemStackList fromInventory(Inventory inventory) { + return new ItemStackList(toDefaultedList(inventory), ItemStackUtil.empty()); + } + + public Inventory toInventory() { + return toInventory(this); + } + + public DefaultedList defaultedList() { + return this; + } + + public static ItemStackList of(DefaultedList defaultedList) { + ItemStackList stacks = ItemStackList.ofSize(defaultedList.size()); + for (int i = 0; i < defaultedList.size(); i++) { + stacks.set(i , defaultedList.get(i)); + } + + return stacks; + } + + public static ItemStackList of(ItemStack stack) { + return ItemStackList.ofSize(1, stack); + } + + // Midohra + public List toMidohra() { + List stacks = new ArrayList<>(); + for (ItemStack stack : this) { + stacks.add(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack)); + } + + return stacks; + } + + public @NotNull net.pitan76.mcpitanlib.midohra.item.ItemStack getAsMidohra(int index) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(get(index)); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getFirstAsMidohra() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getFirst()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getLastAsMidohra() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getLast()); + } + + public boolean add(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return add(stack.toMinecraft()); + } + + public boolean addAll(List stacks) { + boolean changed = false; + for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { + changed |= add(stack); + } + + return changed; + } + + public boolean addAll(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { + return addAll(Arrays.asList(stacks)); + } + + public boolean remove(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return remove(stack.toMinecraft()); + } + + public boolean removeAll(List stacks) { + boolean changed = false; + for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { + changed |= remove(stack); + } + + return changed; + } + + public boolean removeAll(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { + return removeAll(Arrays.asList(stacks)); + } + + public boolean contains(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return contains(stack.toMinecraft()); + } + + public boolean containsAll(List stacks) { + for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { + if (!contains(stack)) { + return false; + } + } + + return true; + } + + public boolean containsAll(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { + return containsAll(Arrays.asList(stacks)); + } + + public boolean containsAny(List stacks) { + for (net.pitan76.mcpitanlib.midohra.item.ItemStack stack : stacks) { + if (contains(stack)) { + return true; + } + } + + return false; + } + + public boolean containsAny(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { + return containsAny(Arrays.asList(stacks)); + } + + public boolean equals(List stacks) { + if (size() != stacks.size()) { + return false; + } + + for (int i = 0; i < size(); i++) { + if (!get(i).equals(stacks.get(i).toMinecraft())) { + return false; + } + } + + return true; + } + + public boolean equals(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { + return equals(Arrays.asList(stacks)); + } + + public static ItemStackList of(List stacks) { + ItemStackList list = ItemStackList.ofSize(stacks.size()); + for (int i = 0; i < stacks.size(); i++) { + list.set(i, stacks.get(i).toMinecraft()); + } + + return list; + } + + public static ItemStackList of(net.pitan76.mcpitanlib.midohra.item.ItemStack... stacks) { + return ItemStackList.of(Arrays.asList(stacks)); + } + + public static ItemStackList of(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return of(stack, 1); + } + + public static ItemStackList of(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, int size) { + return ItemStackList.ofSize(size, stack.toMinecraft()); + } + + public static ItemStackList of2(List stacks) { + ItemStackList list = ItemStackList.ofSize(stacks.size()); + for (int i = 0; i < stacks.size(); i++) + list.set(i, stacks.get(i)); + + return list; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java new file mode 100644 index 000000000..bb113ce46 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.api.util.color; + +import net.minecraft.block.MapColor; + +public class CompatBrightness { + private final MapColor.Brightness brightness; + + public static final CompatBrightness LOW = of(MapColor.Brightness.LOW); + public static final CompatBrightness NORMAL = of(MapColor.Brightness.NORMAL); + public static final CompatBrightness HIGH = of(MapColor.Brightness.HIGH); + public static final CompatBrightness LOWEST = of(MapColor.Brightness.LOWEST); + + public CompatBrightness(MapColor.Brightness brightness) { + this.brightness = brightness; + } + + public static CompatBrightness of(MapColor.Brightness brightness) { + return new CompatBrightness(brightness); + } + + public MapColor.Brightness get() { + return brightness; + } + + public String getName() { + return get().name(); + } + + public int getId() { + return get().id; + } + + public int getBrightness() { + return get().brightness; + } + + + + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java new file mode 100644 index 000000000..e6e397126 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.api.util.color; + +import net.minecraft.util.DyeColor; +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class CompatDyeColor implements CompatStringIdentifiable { + private final DyeColor color; + + public static final CompatDyeColor WHITE = of(DyeColor.WHITE); + public static final CompatDyeColor ORANGE = of(DyeColor.ORANGE); + public static final CompatDyeColor MAGENTA = of(DyeColor.MAGENTA); + public static final CompatDyeColor LIGHT_BLUE = of(DyeColor.LIGHT_BLUE); + public static final CompatDyeColor YELLOW = of(DyeColor.YELLOW); + public static final CompatDyeColor LIME = of(DyeColor.LIME); + public static final CompatDyeColor PINK = of(DyeColor.PINK); + public static final CompatDyeColor GRAY = of(DyeColor.GRAY); + public static final CompatDyeColor LIGHT_GRAY = of(DyeColor.LIGHT_GRAY); + public static final CompatDyeColor CYAN = of(DyeColor.CYAN); + public static final CompatDyeColor PURPLE = of(DyeColor.PURPLE); + public static final CompatDyeColor BLUE = of(DyeColor.BLUE); + public static final CompatDyeColor BROWN = of(DyeColor.BROWN); + public static final CompatDyeColor GREEN = of(DyeColor.GREEN); + public static final CompatDyeColor RED = of(DyeColor.RED); + public static final CompatDyeColor BLACK = of(DyeColor.BLACK); + + public CompatDyeColor(DyeColor color) { + this.color = color; + } + + public static CompatDyeColor of(DyeColor color) { + return new CompatDyeColor(color); + } + + public DyeColor getColor() { + return color; + } + + public String getName() { + return color.name(); + } + + @Override + public String asString_compat() { + return getName(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java new file mode 100644 index 000000000..08c7084cc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java @@ -0,0 +1,94 @@ +package net.pitan76.mcpitanlib.api.util.color; + +import net.minecraft.block.MapColor; + +public class CompatMapColor { + private final MapColor color; + + public static final CompatMapColor CLEAR = of(MapColor.CLEAR); + public static final CompatMapColor PALE_GREEN = of(MapColor.PALE_GREEN); + public static final CompatMapColor PALE_YELLOW = of(MapColor.PALE_YELLOW); + public static final CompatMapColor WHITE_GRAY = of(MapColor.WHITE_GRAY); + public static final CompatMapColor BRIGHT_RED = of(MapColor.BRIGHT_RED); + public static final CompatMapColor PALE_PURPLE = of(MapColor.PALE_PURPLE); + public static final CompatMapColor IRON_GRAY = of(MapColor.IRON_GRAY); + public static final CompatMapColor DARK_GREEN = of(MapColor.DARK_GREEN); + public static final CompatMapColor WHITE = of(MapColor.WHITE); + public static final CompatMapColor LIGHT_BLUE_GRAY = of(MapColor.LIGHT_BLUE_GRAY); + public static final CompatMapColor DIRT_BROWN = of(MapColor.DIRT_BROWN); + public static final CompatMapColor STONE_GRAY = of(MapColor.STONE_GRAY); + public static final CompatMapColor WATER_BLUE = of(MapColor.WATER_BLUE); + public static final CompatMapColor OAK_TAN = of(MapColor.OAK_TAN); + public static final CompatMapColor OFF_WHITE = of(MapColor.OFF_WHITE); + public static final CompatMapColor ORANGE = of(MapColor.ORANGE); + public static final CompatMapColor MAGENTA = of(MapColor.MAGENTA); + public static final CompatMapColor LIGHT_BLUE = of(MapColor.LIGHT_BLUE); + public static final CompatMapColor YELLOW = of(MapColor.YELLOW); + public static final CompatMapColor LIME = of(MapColor.LIME); + public static final CompatMapColor PINK = of(MapColor.PINK); + public static final CompatMapColor GRAY = of(MapColor.GRAY); + public static final CompatMapColor LIGHT_GRAY = of(MapColor.LIGHT_GRAY); + public static final CompatMapColor CYAN = of(MapColor.CYAN); + public static final CompatMapColor PURPLE = of(MapColor.PURPLE); + public static final CompatMapColor BLUE = of(MapColor.BLUE); + public static final CompatMapColor BROWN = of(MapColor.BROWN); + public static final CompatMapColor GREEN = of(MapColor.GREEN); + public static final CompatMapColor RED = of(MapColor.RED); + public static final CompatMapColor BLACK = of(MapColor.BLACK); + public static final CompatMapColor GOLD = of(MapColor.GOLD); + public static final CompatMapColor DIAMOND_BLUE = of(MapColor.DIAMOND_BLUE); + public static final CompatMapColor LAPIS_BLUE = of(MapColor.LAPIS_BLUE); + public static final CompatMapColor EMERALD_GREEN = of(MapColor.EMERALD_GREEN); + public static final CompatMapColor SPRUCE_BROWN = of(MapColor.SPRUCE_BROWN); + public static final CompatMapColor DARK_RED = of(MapColor.DARK_RED); + public static final CompatMapColor TERRACOTTA_WHITE = of(MapColor.TERRACOTTA_WHITE); + public static final CompatMapColor TERRACOTTA_ORANGE = of(MapColor.TERRACOTTA_ORANGE); + public static final CompatMapColor TERRACOTTA_MAGENTA = of(MapColor.TERRACOTTA_MAGENTA); + public static final CompatMapColor TERRACOTTA_LIGHT_BLUE = of(MapColor.TERRACOTTA_LIGHT_BLUE); + public static final CompatMapColor TERRACOTTA_YELLOW = of(MapColor.TERRACOTTA_YELLOW); + public static final CompatMapColor TERRACOTTA_LIME = of(MapColor.TERRACOTTA_LIME); + public static final CompatMapColor TERRACOTTA_PINK = of(MapColor.TERRACOTTA_PINK); + public static final CompatMapColor TERRACOTTA_GRAY = of(MapColor.TERRACOTTA_GRAY); + public static final CompatMapColor TERRACOTTA_LIGHT_GRAY = of(MapColor.TERRACOTTA_LIGHT_GRAY); + public static final CompatMapColor TERRACOTTA_CYAN = of(MapColor.TERRACOTTA_CYAN); + public static final CompatMapColor TERRACOTTA_PURPLE = of(MapColor.TERRACOTTA_PURPLE); + public static final CompatMapColor TERRACOTTA_BLUE = of(MapColor.TERRACOTTA_BLUE); + public static final CompatMapColor TERRACOTTA_BROWN = of(MapColor.TERRACOTTA_BROWN); + public static final CompatMapColor TERRACOTTA_GREEN = of(MapColor.TERRACOTTA_GREEN); + public static final CompatMapColor TERRACOTTA_RED = of(MapColor.TERRACOTTA_RED); + public static final CompatMapColor TERRACOTTA_BLACK = of(MapColor.TERRACOTTA_BLACK); + public static final CompatMapColor DULL_RED = of(MapColor.DULL_RED); + public static final CompatMapColor DULL_PINK = of(MapColor.DULL_PINK); + public static final CompatMapColor DARK_CRIMSON = of(MapColor.DARK_CRIMSON); + public static final CompatMapColor TEAL = of(MapColor.TEAL); + public static final CompatMapColor DARK_AQUA = of(MapColor.DARK_AQUA); + public static final CompatMapColor DARK_DULL_PINK = of(MapColor.DARK_DULL_PINK); + public static final CompatMapColor BRIGHT_TEAL = of(MapColor.BRIGHT_TEAL); + public static final CompatMapColor DEEPSLATE_GRAY = of(MapColor.DEEPSLATE_GRAY); + public static final CompatMapColor RAW_IRON_PINK = of(MapColor.RAW_IRON_PINK); + public static final CompatMapColor LICHEN_GREEN = of(MapColor.LICHEN_GREEN); + + public CompatMapColor(MapColor color) { + this.color = color; + } + + public static CompatMapColor of(MapColor color) { + return new CompatMapColor(color); + } + + public MapColor getColor() { + return color; + } + + public int getId() { + return color.id; + } + + public int getRgb() { + return color.color; + } + + public int getRenderColor(CompatBrightness brightness) { + return color.getRenderColor(brightness.get()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java new file mode 100644 index 000000000..2fb569972 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.api.util.debug; + +import net.minecraft.inventory.Inventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.util.ItemUtil; +import net.pitan76.mcpitanlib.api.util.PlatformUtil; + +public class OutputUtil { + + public static boolean dev = PlatformUtil.isDevelopmentEnvironment(); + + public static void print(Item item) { + if (!dev) return; + System.out.println(getString(item)); + } + + public static void print(ItemStack stack) { + if (!dev) return; + System.out.println(getString(stack)); + } + + public static void print(Inventory inventory) { + if (!dev) return; + System.out.println(getString(inventory)); + } + + public static String getString(Item item) { + StringBuilder sb = new StringBuilder(); + sb.append("Item: {").append("\n"); + + sb.append(" Name: ").append(item.getTranslationKey()).append("\n"); + sb.append(" Id: ").append(ItemUtil.toCompatID(item)).append("\n"); + sb.append("}\n"); + + return sb.toString(); + } + + public static String getString(ItemStack stack) { + Item item = stack.getItem(); + + StringBuilder sb = new StringBuilder(); + sb.append("ItemStack: {").append("\n"); + + sb.append(getString(item)); + sb.append(" Count: ").append(stack.getCount()).append("\n"); + sb.append("}\n"); + + return sb.toString(); + } + + public static String getString(Inventory inventory) { + StringBuilder sb = new StringBuilder(); + sb.append("Inventory: {").append("\n"); + + for (int i = 0; i < inventory.size(); i++) { + ItemStack stack = inventory.getStack(i); + if (stack.isEmpty()) continue; + + sb.append(" Slot ").append(i).append(": {").append("\n"); + sb.append(getString(stack)); + sb.append(" }\n"); + } + + sb.append("}\n"); + + return sb.toString(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java new file mode 100644 index 000000000..e12d3910f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.projectile.ArrowEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import org.jetbrains.annotations.Nullable; + +public class ArrowEntityUtil { + public static ArrowEntity create(World world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { + return new ArrowEntity(world, x, y, z, stack, shotFrom); + } + + public static ArrowEntity create(World world, double x, double y, double z, ItemStack stack) { + return create(world, x, y, z, stack, null); + } + + public static ArrowEntity create(World world, double x, double y, double z) { + return create(world, x, y, z, ItemStackUtil.getDefaultStack(Items.ARROW)); + } + + public static void setVelocity(ArrowEntity arrow, double x, double y, double z, float velocity, float divergence) { + arrow.setVelocity(x, y, z, velocity, divergence); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java new file mode 100644 index 000000000..dec1f836b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.EquipmentSlot; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; + +public class EquipmentSlotUtil { + public static boolean isArmor(EquipmentSlot slot) { + return slot == EquipmentSlot.HEAD || slot == EquipmentSlot.CHEST || slot == EquipmentSlot.LEGS || slot == EquipmentSlot.FEET; + } + + public static boolean isMainHand(EquipmentSlot slot) { + return slot == EquipmentSlot.MAINHAND; + } + + public static boolean isOffHand(EquipmentSlot slot) { + return slot == EquipmentSlot.OFFHAND; + } + + public static boolean isWeapon(EquipmentSlot slot) { + return slot == EquipmentSlot.MAINHAND || slot == EquipmentSlot.OFFHAND; + } + + public static int getEntitySlotId(EquipmentSlot slot) { + if (slot == null) + return 0; + + return slot.getEntitySlotId(); + } + + public static EquipmentSlot fromEntitySlotId(int id) { + for (EquipmentSlot slot : EquipmentSlot.values()) { + if (slot.getEntitySlotId() == id) { + return slot; + } + } + return EquipmentSlot.MAINHAND; + } + + public static ArmorEquipmentType getArmorEquipmentType(EquipmentSlot slot) { + switch (slot) { + case HEAD: + return ArmorEquipmentType.HEAD; + case CHEST: + return ArmorEquipmentType.CHEST; + case LEGS: + return ArmorEquipmentType.LEGS; + case FEET: + return ArmorEquipmentType.FEET; + case BODY: + return ArmorEquipmentType.BODY; + default: + return null; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java new file mode 100644 index 000000000..5686c1bee --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java @@ -0,0 +1,118 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.EntityType; +import net.minecraft.entity.ItemEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3i; + +import java.util.List; + +public class ItemEntityUtil { + public static ItemEntity create(World world, double x, double y, double z, ItemStack stack) { + return new ItemEntity(world, x, y, z, stack); + } + + public static ItemEntity create(World world, BlockPos pos, ItemStack stack) { + return create(world, pos.getX(), pos.getY(), pos.getZ(), stack); + } + + public static ItemEntity create(World world, Vec3d pos, ItemStack stack) { + return create(world, pos.x, pos.y, pos.z, stack); + } + + public static ItemEntity create(World world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) { + ItemEntity itemEntity = create(world, x, y, z, stack); + setVelocity(itemEntity, velocityX, velocityY, velocityZ); + return itemEntity; + } + + public static void setVelocity(ItemEntity itemEntity, double velocityX, double velocityY, double velocityZ) { + itemEntity.setVelocity(velocityX, velocityY, velocityZ); + } + + public static void setVelocity(ItemEntity itemEntity, Vec3d vec3d) { + itemEntity.setVelocity(vec3d); + } + + public static void setPickupDelay(ItemEntity itemEntity, int pickupDelay) { + itemEntity.setPickupDelay(pickupDelay); + } + + public static void setToDefaultPickupDelay(ItemEntity itemEntity) { + itemEntity.setToDefaultPickupDelay(); + } + + public static ItemStack getStack(ItemEntity entity) { + return entity.getStack(); + } + + public static List getEntities(World world, Box box) { + return WorldUtil.getEntitiesByType(world, EntityType.ITEM, box); + } + + public static ItemEntity createWithSpawn(World world, ItemStack stack, double x, double y, double z) { + ItemEntity itemEntity = create(world, x, y, z, stack); + setToDefaultPickupDelay(itemEntity); + setVelocity(itemEntity, 0.0D, 0.0D, 0.0D); + WorldUtil.spawnEntity(world, itemEntity); + return itemEntity; + } + + public static ItemEntity createWithSpawn(World world, ItemStack stack, BlockPos pos) { + return createWithSpawn(world, stack, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3d pos) { + return createWithSpawn(world, stack, pos.x, pos.y, pos.z); + } + + public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3i pos) { + return createWithSpawn(world, stack, pos.toCenter()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, double x, double y, double z) { + return createWithSpawn(world.getRaw(), stack, x, y, z); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, BlockPos pos) { + return createWithSpawn(world, stack, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, Vector3i pos) { + return createWithSpawn(world, stack, pos.toCenter()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3d pos) { + return createWithSpawn(world.getRaw(), stack, pos.x, pos.y, pos.z); + } + + public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra.world.World world, ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return createWithSpawn(world, stack, pos.toCenterVector3d()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, double x, double y, double z) { + return createWithSpawn(world.getRaw(), stack.toMinecraft(), x, y, z); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return createWithSpawn(world.getRaw(), stack.toMinecraft(), pos.toRaw()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3d pos) { + return createWithSpawn(world.getRaw(), stack.toMinecraft(), pos.x, pos.y, pos.z); + } + + public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return createWithSpawn(world, stack, pos.toCenterVector3d()); + } + + public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3i pos) { + return createWithSpawn(world, stack, pos.toCenter()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java new file mode 100644 index 000000000..9e74fc58f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; +import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; +import net.pitan76.mcpitanlib.api.util.EntityUtil; + +import java.util.ArrayList; +import java.util.List; + +public class LivingEntityUtil extends EntityUtil { + public static void addStatusEffect(LivingEntity entity, CompatStatusEffectInstance effect) { + entity.addStatusEffect(effect.getInstance()); + } + + public static void removeStatusEffect(LivingEntity entity, CompatStatusEffectInstance effect) { + entity.removeStatusEffect(effect.getInstance().getEffectType()); + } + + public static void removeStatusEffect(LivingEntity entity, CompatStatusEffect effect, World world) { + entity.removeStatusEffect(effect.getEntry(world)); + } + + public static List getStatusEffects(LivingEntity entity) { + List compatEffects = new ArrayList<>(); + + for (StatusEffectInstance effect : entity.getStatusEffects()) { + compatEffects.add(new CompatStatusEffectInstance(effect)); + } + + return compatEffects; + } + + public static float getHealth(LivingEntity entity) { + return entity.getHealth(); + } + + public static void setHealth(LivingEntity entity, float health) { + entity.setHealth(health); + } + + public static float getMaxHealth(LivingEntity entity) { + return entity.getMaxHealth(); + } + + public static ItemStack getEquippedStack(LivingEntity entity, EquipmentSlot slot) { + return entity.getEquippedStack(slot); + } + + public static void setEquippedStack(LivingEntity entity, EquipmentSlot slot, ItemStack stack) { + entity.equipStack(slot, stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java new file mode 100644 index 000000000..806215177 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.projectile.ProjectileEntity; + +public class ProjectileEntityUtil { + public static void setVelocity(ProjectileEntity projectileEntity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { + projectileEntity.setVelocity(shooter, pitch, yaw, roll, speed, divergence); + } + + public static void setVelocity(ProjectileEntity projectileEntity, double x, double y, double z, float power, float uncertainty) { + projectileEntity.setVelocity(x, y, z, power, uncertainty); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java new file mode 100644 index 000000000..1f4a155dc --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java @@ -0,0 +1,102 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; + +import java.util.Collections; +import java.util.Optional; + +public class ServerPlayerUtil { + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + return serverPlayerEntity.teleport(serverWorld, x, y, z, Collections.emptySet(), yaw, pitch, resetCamera); + } + + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { + return teleport(serverPlayerEntity, serverWorld, x, y, z, yaw, pitch, true); + } + + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z) { + return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYaw(), serverPlayerEntity.getPitch()); + } + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + return teleport(serverPlayerEntity, serverWorld.getRaw(), x, y, z, yaw, pitch, resetCamera); + } + + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { + return teleport(serverPlayerEntity, serverWorld, x, y, z, yaw, pitch, false); + } + + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z) { + return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYaw(), serverPlayerEntity.getPitch()); + } + + public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + Optional optionalServerPlayer = player.getServerPlayer(); + if (!optionalServerPlayer.isPresent()) return false; + + return teleport(optionalServerPlayer.get(), serverWorld, x, y, z, yaw, pitch, resetCamera); + } + + public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { + return teleport(player, serverWorld, x, y, z, yaw, pitch, false); + } + + public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z) { + return teleport(player, serverWorld, x, y, z, player.getYaw(), player.getPitch()); + } + + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, double x, double y, double z, boolean particleEffects) { + return serverPlayerEntity.teleport(x, y, z, particleEffects); + } + + public static boolean teleport(ServerPlayerEntity serverPlayerEntity, double x, double y, double z) { + return teleport(serverPlayerEntity, x, y, z, false); + } + + public static boolean teleport(Player player, double x, double y, double z, boolean particleEffects) { + Optional optionalServerPlayer = player.getServerPlayer(); + if (!optionalServerPlayer.isPresent()) return false; + + return teleport(optionalServerPlayer.get(), x, y, z, particleEffects); + } + + public static boolean teleport(Player player, double x, double y, double z) { + return teleport(player, x, y, z, false); + } + + public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { + playSound(serverPlayerEntity, soundEvent, volume, pitch); + } + + public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent, float volume, float pitch) { + serverPlayerEntity.playSound(soundEvent.get(), volume, pitch); + } + + public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent) { + serverPlayerEntity.playSound(soundEvent.get()); + } + + public static void playSound(Player player, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { + Optional optionalServerPlayer = player.getServerPlayer(); + if (!optionalServerPlayer.isPresent()) return; + + playSound(optionalServerPlayer.get(), soundEvent, category, volume, pitch); + } + + public static void playSound(Player player, CompatSoundEvent soundEvent, float volume, float pitch) { + Optional optionalServerPlayer = player.getServerPlayer(); + if (!optionalServerPlayer.isPresent()) return; + + playSound(optionalServerPlayer.get(), soundEvent, volume, pitch); + } + + public static void playSound(Player player, CompatSoundEvent soundEvent) { + Optional optionalServerPlayer = player.getServerPlayer(); + if (!optionalServerPlayer.isPresent()) return; + + playSound(optionalServerPlayer.get(), soundEvent); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java new file mode 100644 index 000000000..38f484a37 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.projectile.SmallFireballEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; + +public class SmallFireballEntityUtil { + public static SmallFireballEntity create(World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + return new SmallFireballEntity(world, x, y, z, Vec3dUtil.create(velocityX, velocityY, velocityZ)); + } + + public static SmallFireballEntity create(World world, double x, double y, double z, Vec3d velocity) { + return new SmallFireballEntity(world, x, y, z, velocity); + } + + public static void setVelocity(SmallFireballEntity entity, double x, double y, double z, float velocity, float divergence) { + entity.setVelocity(x, y, z, velocity, divergence); + } + + public static void setItem(SmallFireballEntity entity, ItemStack stack) { + entity.setItem(stack); + } + + public static ItemStack getItem(SmallFireballEntity entity) { + return entity.getStack(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java new file mode 100644 index 000000000..9d5fd3085 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.projectile.thrown.SnowballEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +public class SnowballEntityUtil { + public static SnowballEntity create(World world, double x, double y, double z) { + return new SnowballEntity(world, x, y, z, ItemStackUtil.empty()); + } + + public static SnowballEntity create(World world, double x, double y, double z, ItemStack stack) { + return new SnowballEntity(world, x, y, z, stack); + } + + public static void setVelocity(SnowballEntity entity, double x, double y, double z, float velocity, float divergence) { + entity.setVelocity(x, y, z, velocity, divergence); + } + + public static void setItem(SnowballEntity entity, ItemStack stack) { + entity.setItem(stack); + } + + public static ItemStack getItem(SnowballEntity entity) { + return entity.getStack(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java new file mode 100644 index 000000000..2f83e9548 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.projectile.SpectralArrowEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import org.jetbrains.annotations.Nullable; + +public class SpectralArrowEntityUtil { + public static SpectralArrowEntity create(World world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { + return new SpectralArrowEntity(world, x, y, z, stack, shotFrom); + } + + public static SpectralArrowEntity create(World world, double x, double y, double z, ItemStack stack) { + return create(world, x, y, z, stack, null); + } + + public static SpectralArrowEntity create(World world, double x, double y, double z) { + return create(world, x, y, z, ItemStackUtil.getDefaultStack(Items.ARROW)); + } + + public static void setVelocity(SpectralArrowEntity arrow, double x, double y, double z, float velocity, float divergence) { + arrow.setVelocity(x, y, z, velocity, divergence); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java new file mode 100644 index 000000000..73dfb6cc4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.api.util.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.projectile.thrown.ThrownItemEntity; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.entity.CompatThrownItemEntity; + +public class ThrownItemEntityUtil { + public static ItemStack getItem(ThrownItemEntity entity) { + return entity.getStack(); + } + + public static void setItem(ThrownItemEntity entity, ItemStack stack) { + entity.setItem(stack); + } + + public static ItemStack getStack(ThrownItemEntity entity) { + return entity.getStack(); + } + + public static void setVelocity(ThrownItemEntity entity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { + ProjectileEntityUtil.setVelocity(entity, shooter, pitch, yaw, roll, speed, divergence); + } + + public static void setVelocity(CompatThrownItemEntity entity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { + ProjectileEntityUtil.setVelocity(entity, shooter, pitch, yaw, roll, speed, divergence); + } + + public static void setVelocity(ThrownItemEntity entity, double x, double y, double z, float power, float uncertainty) { + ProjectileEntityUtil.setVelocity(entity, x, y, z, power, uncertainty); + } + + public static void setVelocity(CompatThrownItemEntity entity, double x, double y, double z, float power, float uncertainty) { + ProjectileEntityUtil.setVelocity(entity, x, y, z, power, uncertainty); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java b/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java new file mode 100644 index 000000000..f721d32a5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.util.event; + +import net.minecraft.block.Block; +import net.pitan76.mcpitanlib.api.event.block.BlockBreakEvent; +import net.pitan76.mcpitanlib.api.event.block.BlockPlacedEvent; +import net.pitan76.mcpitanlib.api.event.block.ItemScattererUtil; +import net.pitan76.mcpitanlib.api.event.block.StateReplacedEvent; + +public class BlockEventGenerator { + public static void onPlaced(Block block, BlockPlacedEvent e) { + block.onPlaced(e.world, e.pos, e.state, e.placer, e.stack); + } + + public static void onBreak(Block block, BlockBreakEvent e) { + block.onBreak(e.world, e.pos, e.state, e.getPlayerEntity()); + } + + public static void onStateReplaced(Block block, StateReplacedEvent e) { + ItemScattererUtil.onStateReplaced(e); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java b/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java new file mode 100644 index 000000000..8983bd5d4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java @@ -0,0 +1,11 @@ +package net.pitan76.mcpitanlib.api.util.event; + +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; + +public class ItemEventGenerator { + public static CompatActionResult onRightClick(Item item, ItemUseEvent e) { + return CompatActionResult.create(item.use(e.world, e.user.getPlayerEntity(), e.hand)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java new file mode 100644 index 000000000..49bcbc196 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java @@ -0,0 +1,91 @@ +package net.pitan76.mcpitanlib.api.util.inventory; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +public class ClippedInventory implements Inventory, ICompatInventory { + + private final Inventory inventory; + private final int start; + private final int end; + + public static ClippedInventory of(Inventory inventory, int start, int end) { + if (start < 0 || end > inventory.size() || start >= end) { + throw new IllegalArgumentException("Invalid start or end indices for clipping inventory."); + } + return new ClippedInventory(inventory, start, end); + } + + public static ClippedInventory of(Inventory inventory) { + return of(inventory, 0, inventory.size()); + } + + public static ClippedInventory of(Inventory inventory, int start) { + return of(inventory, start, inventory.size()); + } + + public ClippedInventory(Inventory inventory, int start, int end) { + this.inventory = inventory; + this.start = start; + this.end = end; + } + + @Override + public int size() { + return end - start; + } + + @Override + public boolean isEmpty() { + for (int i = start; i < end; i++) { + if (!inventory.getStack(i).isEmpty()) { + return false; + } + } + return true; + } + + @Override + public ItemStack getStack(int slot) { + return inventory.getStack(start + slot); + } + + @Override + public ItemStack removeStack(int slot, int amount) { + return inventory.removeStack(start + slot, amount); + } + + @Override + public ItemStack removeStack(int slot) { + return inventory.removeStack(start + slot); + } + + @Override + public void setStack(int slot, ItemStack stack) { + inventory.setStack(start + slot, stack); + } + + @Override + public void markDirty() { + inventory.markDirty(); + } + + @Override + public boolean canPlayerUse(PlayerEntity player) { + return inventory.canPlayerUse(player); + } + + @Override + public void clear() { + for (int i = start; i < end; i++) { + inventory.setStack(i, ItemStackUtil.empty()); + } + } + + @Override + public int getMaxCountPerStack() { + return inventory.getMaxCountPerStack(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java new file mode 100644 index 000000000..6fc2623d0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java @@ -0,0 +1,229 @@ +package net.pitan76.mcpitanlib.api.util.inventory; + +import net.minecraft.entity.ContainerUser; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.inventory.SimpleInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.entity.CompatContainerUser; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.NbtUtil; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; +import net.pitan76.mcpitanlib.api.util.inventory.args.CanInsertArgs; +import net.pitan76.mcpitanlib.midohra.nbt.NbtList; + +import java.util.List; + +public class CompatInventory extends SimpleInventory { + public CompatInventory(int size) { + super(size); + } + + @Override + public void setStack(int slot, ItemStack stack) { + super.setStack(slot, stack); + } + + /** + * super method of setStack(slot, stack) + */ + public final void superSetStack(int slot, ItemStack stack) { + super.setStack(slot, stack); + } + + /** + * super method of removeStack(slot, amount) + */ + public final ItemStack superRemoveStack(int slot, int amount) { + return super.removeStack(slot, amount); + } + + @Override + public ItemStack removeStack(int slot, int amount) { + return callRemoveStack(slot, amount); + } + + public ItemStack callRemoveStack(int slot, int amount) { + return super.removeStack(slot, amount); + } + + @Override + public ItemStack removeStack(int slot) { + return super.removeStack(slot); + } + + @Override + public ItemStack removeItem(Item item, int count) { + return super.removeItem(item, count); + } + + @Deprecated + @Override + public void onOpen(ContainerUser user) { + if (user instanceof PlayerEntity) { + onOpen(new Player((PlayerEntity) user)); + return; + } + + this.onOpen(new CompatContainerUser(user)); + + } + + @Deprecated + @Override + public void onClose(ContainerUser user) { + if (user instanceof PlayerEntity) { + onClose(new Player((PlayerEntity) user)); + return; + } + + this.onClose(new CompatContainerUser(user)); + } + + // @Deprecated +// public net.minecraft.nbt.NbtList toNbtList(RegistryWrapper.WrapperLookup registries) { +// return toNbtList(new CompatRegistryLookup(registries)).toMinecraft(); +// } +// +// @Deprecated +// public void readNbtList(net.minecraft.nbt.NbtList list, RegistryWrapper.WrapperLookup registries) { +// readNbtList(NbtList.of(list), new CompatRegistryLookup(registries)); +// } + + @Deprecated + @Override + public boolean canPlayerUse(PlayerEntity player) { + return canPlayerUse(new Player(player)); + } + + @Deprecated + @Override + public boolean canInsert(ItemStack stack) { + return canInsert(new CanInsertArgs(stack)); + } + + public void onOpen(Player player) { + onOpen(new CompatContainerUser(player.getEntity())); + } + + public void onClose(Player player) { + onClose(new CompatContainerUser(player.getEntity())); + } + + public void onOpen(CompatContainerUser user) { + super.onOpen(user.getRaw()); + } + + public void onClose(CompatContainerUser user) { + super.onClose(user.getRaw()); + } + + public NbtList toNbtList(CompatRegistryLookup registries) { +// WriteView.ListAppender listAppender = new ListApp +// toDataList(); +// +// super.toDataList(); +// +// return NbtList.of(super.toNbtList(registries.getRegistryLookup())); + return NbtList.of(NbtUtil.createNbtList()); + } + + public void readNbtList(NbtList list, CompatRegistryLookup registries) { +// super.readNbtList(list.toMinecraft(), registries.getRegistryLookup()); + } + + public boolean canPlayerUse(Player player) { + return true; + } + + public boolean canInsert(CanInsertArgs args) { + return super.canInsert(args.getMcStack()); + } + + @Deprecated + @Override + public List clearToList() { + return callClearToList(); + } + + public List callClearToList() { + return super.clearToList(); + } + + @Deprecated + @Override + public DefaultedList getHeldStacks() { + return callGetHeldStacks(); + } + + public DefaultedList callGetHeldStacks() { + return super.getHeldStacks(); + } + + public ItemStackList callGetHeldStacksAsItemStackList() { + return ItemStackList.of(callGetHeldStacks()); + } + + @Deprecated + @Override + public ItemStack getStack(int slot) { + return callGetStack(slot); + } + + public ItemStack callGetStack(int slot) { + return super.getStack(slot); + } + + @Deprecated + @Override + public int size() { + return getSize(); + } + + public int getSize() { + return super.size(); + } + + @Deprecated + @Override + public boolean isEmpty() { + return callIsEmpty(); + } + + public boolean callIsEmpty() { + return super.isEmpty(); + } + + @Deprecated + @Override + public boolean canTransferTo(Inventory hopperInventory, int slot, ItemStack stack) { + return callCanTransferTo(hopperInventory, slot, stack); + } + + public boolean callCanTransferTo(Inventory hopperInventory, int slot, ItemStack stack) { + return super.canTransferTo(hopperInventory, slot, stack); + } + + @Deprecated + @Override + public ItemStack addStack(ItemStack stack) { + return callAddStack(stack); + } + + public ItemStack callAddStack(ItemStack stack) { + return super.addStack(stack); + } + + @Deprecated + @Override + public int getMaxCountPerStack() { + return callGetMaxCountPerStack(); + } + + public int callGetMaxCountPerStack() { + return super.getMaxCountPerStack(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java new file mode 100644 index 000000000..9f9ab0730 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.api.util.inventory; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class CompatPlayerInventory { + public PlayerInventory inv; + + public CompatPlayerInventory(PlayerInventory inv) { + this.inv = inv; + } + + public Player getPlayer() { + return PlayerInventoryUtil.getPlayer(inv); + } + + public int getSelectedSlot() { + return PlayerInventoryUtil.getSelectedSlot(inv); + } + + public void setSelectedSlot(int slot) { + PlayerInventoryUtil.setSelectedSlot(inv, slot); + } + + public void dropAllItems() { + PlayerInventoryUtil.dropAllItems(inv); + } + + public void offerOrDrop(ItemStack stack) { + inv.offerOrDrop(stack); + } + + public void offerOrDrop(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + offerOrDrop(stack.toMinecraft()); + } + + public PlayerInventory getRaw() { + return inv; + } +} + diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java new file mode 100644 index 000000000..b4be9a037 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.api.util.inventory; + +import net.minecraft.screen.ScreenHandler; + +public class ContainerInventory extends CompatInventory { + + public final T screenHandler; + + public ContainerInventory(T screenHandler, int size) { + super(size); + this.screenHandler = screenHandler; + } + + public T getScreenHandler() { + return screenHandler; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java new file mode 100644 index 000000000..b33afd6be --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.api.util.inventory; + +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.entity.Player; + +public interface ICompatInventory extends Inventory { + default void callSetStack(int slot, ItemStack stack) { + setStack(slot, stack); + } + + default ItemStack callGetStack(int slot) { + return getStack(slot); + } + + default int callSize() { + return size(); + } + + default boolean callIsEmpty() { + return isEmpty(); + } + + default ItemStack callRemoveStack(int slot, int amount) { + return removeStack(slot, amount); + } + + default ItemStack callRemoveStack(int slot) { + return removeStack(slot); + } + + default void callClear() { + clear(); + } + + default void callMarkDirty() { + markDirty(); + } + + default boolean callCanPlayerUse(net.minecraft.entity.player.PlayerEntity player) { + return canPlayerUse(player); + } + + default boolean canPlayerUse(Player player) { + return canPlayerUse(player.getEntity()); + } + + + default void callSetStack(int slot, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + setStack(slot, stack.toMinecraft()); + } + + default net.pitan76.mcpitanlib.midohra.item.ItemStack callGetStackAsMidohra(int slot) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(slot)); + } + + default int callGetMaxCountPerStack() { + return getMaxCountPerStack(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java new file mode 100644 index 000000000..e3a4b61df --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.api.util.inventory; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class PlayerInventoryUtil { + public static Player getPlayer(PlayerInventory playerInventory) { + return new Player(playerInventory.player); + } + + public static int getSelectedSlot(PlayerInventory playerInventory) { + return playerInventory.getSelectedSlot(); + } + + public static void setSelectedSlot(PlayerInventory playerInventory, int slot) { + playerInventory.setSelectedSlot(slot); + } + + public static void dropAllItems(PlayerInventory inv) { + inv.dropAll(); + } + + public static DefaultedList getMain(PlayerInventory inv) { + return inv.getMainStacks(); + } + + public static DefaultedList getArmor(PlayerInventory inv) { + DefaultedList stacks = DefaultedList.ofSize(4, ItemStack.EMPTY); + stacks.set(0, inv.getStack(36)); + stacks.set(1, inv.getStack(37)); + stacks.set(2, inv.getStack(38)); + stacks.set(3, inv.getStack(39)); + return stacks; + } + + public static DefaultedList getOffHand(PlayerInventory inv) { + DefaultedList stacks = DefaultedList.ofSize(1, ItemStack.EMPTY); + stacks.set(0, inv.getStack(PlayerInventory.OFF_HAND_SLOT)); + return stacks; + } + + public static ItemStack getMainHandStack(PlayerInventory inv) { + return inv.player.getMainHandStack(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java new file mode 100644 index 000000000..aeb15f5e9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java @@ -0,0 +1,23 @@ +package net.pitan76.mcpitanlib.api.util.inventory.args; + +import net.pitan76.mcpitanlib.midohra.item.ItemStack; + +public class CanInsertArgs { + public ItemStack stack; + + public CanInsertArgs(ItemStack stack) { + this.stack = stack; + } + + public CanInsertArgs(net.minecraft.item.ItemStack stack) { + this(ItemStack.of(stack)); + } + + public ItemStack getStack() { + return stack; + } + + public net.minecraft.item.ItemStack getMcStack() { + return stack.toMinecraft(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java new file mode 100644 index 000000000..4024ce047 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.util.item; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.core.registry.FuelRegistry; + +public class FuelUtil { + + public static int getTime(World world, ItemStack stack) { + return FuelRegistry.get(world, stack); + } + + public static boolean isFuel(World world, ItemStack stack) { + return FuelRegistry.isFuel(world, stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java new file mode 100644 index 000000000..ffd8f7617 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.api.util.item; + +import net.minecraft.item.ItemGroup; +import net.minecraft.registry.Registries; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class ItemGroupUtil { + public static Identifier toID(ItemGroup itemGroup) { + return Registries.ITEM_GROUP.getId(itemGroup); + } + + public static ItemGroup fromId(Identifier identifier) { + return Registries.ITEM_GROUP.get(identifier); + } + + public static boolean isExist(Identifier identifier) { + return Registries.ITEM_GROUP.containsId(identifier); + } + + public static CompatIdentifier toCompatID(ItemGroup itemGroup) { + return CompatIdentifier.fromMinecraft(toID(itemGroup)); + } + + public static ItemGroup fromId(CompatIdentifier identifier) { + return fromId(identifier.toMinecraft()); + } + + public static boolean isExist(CompatIdentifier identifier) { + return isExist(identifier.toMinecraft()); + } + + public static int getRawId(ItemGroup itemGroup) { + return Registries.ITEM_GROUP.getRawId(itemGroup); + } + + public static ItemGroup fromIndex(int index) { + return Registries.ITEM_GROUP.get(index); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java new file mode 100644 index 000000000..2d8c17de6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java @@ -0,0 +1,263 @@ +package net.pitan76.mcpitanlib.api.util.item; + +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +import java.util.ArrayList; +import java.util.List; + +@SuppressWarnings("deprecation") +public class ItemUtil { + + /** + * Check if the item is equal. + * @param item Item to compare. + * @param item2 Item to compare. + * @return If the item is equal. + */ + public static boolean isEqual(Item item, Item item2) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.isEqual(item, item2); + } + + /** + * Get item from CompatIdentifier. + * @param id CompatIdentifier of the item. + * @return Item of the CompatIdentifier. + */ + public static Item fromId(CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.fromId(id); + } + + public static Item fromId(String id) { + return fromId(CompatIdentifier.of(id)); + } + + public static Item fromId(String namespace, String path) { + return fromId(CompatIdentifier.of(namespace, path)); + } + + /** + * Get CompatIdentifier from Item. + * @param item Item to get CompatIdentifier. + * @return CompatIdentifier of the Item. + */ + public static CompatIdentifier toId(Item item) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.toCompatID(item); + } + + public static String toIdAsString(Item item) { + return toId(item).toString(); + } + + /** + * Check if the item exist. + * @param id CompatIdentifier of the item. + * @return If the item exist. + */ + public static boolean isExist(CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.isExist(id); + } + + public static boolean isExist(String id) { + return isExist(CompatIdentifier.of(id)); + } + + public static boolean isExist(String namespace, String path) { + return isExist(CompatIdentifier.of(namespace, path)); + } + + public static boolean isMinecraftItem(Item item) { + return CompatIdentifier.isMinecraftNamespace(toId(item)); + } + + /** + * Create a new BlockItem. + * @param block Block to create BlockItem. + * @param settings CompatItemSettings of the BlockItem. + * @return The new BlockItem. + */ + public static BlockItem create(Block block, CompatibleItemSettings settings) { + if (!settings.changedTranslationKey) + settings.useBlockPrefixedTranslationKey(); + + return net.pitan76.mcpitanlib.api.util.ItemUtil.ofBlock(block, settings); + } + + /** + * Create a new Item. + * @param settings CompatItemSettings of the Item. + * @return The new Item. + */ + public static Item create(CompatibleItemSettings settings) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.of(settings); + } + + /** + * Get all items. + * @return List of all items. + */ + public static List getItems() { + return net.pitan76.mcpitanlib.api.util.ItemUtil.getAllItems(); + } + + /** + * Get items in the tag. + * @param tagKey TagKey of the items. + * @return List of items in the tag. + */ + public static List getInTag(TagKey tagKey) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.getItems(tagKey); + } + + /** + * Get items in the tag. + * @param id CompatIdentifier of the tag. + * @return List of items in the tag. + */ + public static List getInTag(CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.getItems(id); + } + + public static List getInTag(String id) { + return getInTag(CompatIdentifier.of(id)); + } + + public static List getInTag(String namespace, String path) { + return getInTag(CompatIdentifier.of(namespace, path)); + } + + /** + * Check if the item is in the tag. + * @param item Item to check. + * @param tagKey TagKey of the tag. + * @return If the item is in the tag. + */ + public static boolean isInTag(Item item, TagKey tagKey) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.isIn(item, tagKey); + } + + /** + * Check if the item is in the tag. + * @param item Item to check. + * @param id CompatIdentifier of the tag. + * @return If the item is in the tag. + */ + public static boolean isInTag(Item item, CompatIdentifier id) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.isItemInTag(item, id); + } + + public static boolean isInTag(Item item, String id) { + return isInTag(item, CompatIdentifier.of(id)); + } + + public static boolean isInTag(Item item, String namespace, String path) { + return isInTag(item, CompatIdentifier.of(namespace, path)); + } + + /** + * Get raw id of the item. + * @param item Item to get raw id. + * @return Raw id of the item. + */ + public static int toRawId(Item item) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.getRawId(item); + } + + /** + * Get item from raw id. + * @param rawId Raw id of the item. + * @return Item from raw id. + */ + public static Item fromRawId(int rawId) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.fromIndex(rawId); + } + + /** + * Get items by namespace. + * @param namespace Namespace of the items. + * @return List of items by namespace. + */ + public static List getItemsByNamespace(String namespace) { + List items = new ArrayList<>(); + + for (Item item : getItems()) { + if (toId(item).getNamespace().equals(namespace)) + items.add(item); + } + + return items; + } + + /** + * Get number of all items. + * @return Number of all items. + */ + public static int getNumberOfItems() { + return getItems().size(); + } + + /** + * Get item from stack. + * @param stack ItemStack to get item. + * @return Item of the stack. + */ + public static Item of(ItemStack stack) { + return stack.getItem(); + } + + /** + * Check if the item is of the item. + * @param stack ItemStack to check. + * @param item Item to check. + * @return If the item is of the item. + */ + public static boolean isOf(ItemStack stack, Item item) { + return net.pitan76.mcpitanlib.api.util.ItemUtil.isOf(stack, item); + } + + /** + * Get name of the item. + * @param item Item + * @return Name of the item. + */ + public static String getNameAsString(Item item) { + return item.getName().getString(); + } + + /** + * Get name of the item. + * @param item Item + * @return Name of the item. + */ + public static TextComponent getName(Item item) { + return new TextComponent(item.getName()); + } + + /** + * Get translation key of the item. + * @param item Item + * @return Translation key of the item. + */ + public static String getTranslationKey(Item item) { + return item.getTranslationKey(); + } + + public static boolean hasRecipeRemainder(Item item) { + return !ItemStackUtil.isEmpty(getRecipeRemainderStack(item)); + } + + public static Item getRecipeRemainder(Item item) { + return getRecipeRemainderStack(item).getItem(); + } + + public static ItemStack getRecipeRemainderStack(Item item) { + return item.getRecipeRemainder(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java new file mode 100644 index 000000000..6f19c06bd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.util.math; + +import net.minecraft.util.BlockRotation; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; + +public class BlockRotations { + public static BlockRotation NONE = BlockRotation.NONE; + public static BlockRotation CLOCKWISE_90 = BlockRotation.CLOCKWISE_90; + public static BlockRotation CLOCKWISE_180 = BlockRotation.CLOCKWISE_180; + public static BlockRotation COUNTERCLOCKWISE_90 = BlockRotation.COUNTERCLOCKWISE_90; + + public static BlockRotation rotate(BlockRotation rotation, BlockRotation rotation2) { + return rotation.rotate(rotation2); + } + + public static BlockRotation random(CompatRandom random) { + return BlockRotation.random(random.getMcRandom()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java new file mode 100644 index 000000000..8bf031508 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java @@ -0,0 +1,54 @@ +package net.pitan76.mcpitanlib.api.util.math; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; + +public class BoxUtil { + public static Box createBox(double x1, double y1, double z1, double x2, double y2, double z2) { + return new Box(x1, y1, z1, x2, y2, z2); + } + + public static Box createBox(double x, double y, double z, double size) { + return new Box(x, y, z, x + size, y + size, z + size); + } + + public static Box createBox(double size) { + return new Box(0, 0, 0, size, size, size); + } + + public static Box createBox(double x1, double y1, double z1, double x2, double y2, double z2, double size) { + return new Box(x1, y1, z1, x2 + size, y2 + size, z2 + size); + } + + public static Box createBox(BlockPos pos) { + return new Box(pos); + } + + public static Box createBox(BlockPos pos1, BlockPos pos2) { + return new Box(pos1.toCenterPos(), pos2.toCenterPos()); + } + + public static Box createBox(BlockPos pos, int size) { + return createBox(pos, pos.add(size, size, size)); + } + + public static Box createBox(BlockPos pos, int sizeX, int sizeY, int sizeZ) { + return createBox(pos, pos.add(sizeX, sizeY, sizeZ)); + } + + public static Box createBoxCenter(BlockPos pos, int size) { + return createBox(pos.add(-size, -size, -size), pos.add(size, size, size)); + } + + public static Box expand(Box box, double x, double y, double z) { + return new Box(box.minX - x, box.minY - y, box.minZ - z, box.maxX + x, box.maxY + y, box.maxZ + z); + } + + public static Box expand(Box box, double size) { + return expand(box, size, size, size); + } + + public static Box union(Box box1, Box box2) { + return box1.union(box2); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java new file mode 100644 index 000000000..08ac22244 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.util.math; + +import net.minecraft.util.math.Direction; + +public class DirectionUtil { + + public static Direction north() { + return Direction.NORTH; + } + + public static Direction south() { + return Direction.SOUTH; + } + + public static Direction east() { + return Direction.EAST; + } + + public static Direction west() { + return Direction.WEST; + } + + public static Direction up() { + return Direction.UP; + } + + public static Direction down() { + return Direction.DOWN; + } + + public static Direction getOpposite(Direction direction) { + return direction.getOpposite(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java new file mode 100644 index 000000000..9af8468c3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.api.util.math; + +public class PointUtil { + public static boolean isInRegion(int x, int y, int width, int height, int pointX, int pointY) { + return pointX >= x && pointX < x + width && pointY >= y && pointY < y + height; + } + + public static boolean isInRegion(int x, int y, int width, int height, double pointX, double pointY) { + return pointX >= x && pointX < x + width && pointY >= y && pointY < y + height; + } + + public static boolean isInRegion2(int x1, int y1, int x2, int y2, int pointX, int pointY) { + return pointX >= x1 && pointX < x2 && pointY >= y1 && pointY < y2; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java new file mode 100644 index 000000000..3a3468921 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java @@ -0,0 +1,116 @@ +package net.pitan76.mcpitanlib.api.util.math; + +import net.minecraft.util.math.*; + +public class PosUtil { + public static BlockPos flooredBlockPos(double x, double y, double z) { + return BlockPos.ofFloored(x, y, z); + } + + public static BlockPos flooredBlockPos(Position pos) { + return BlockPos.ofFloored(pos); + } + + public static BlockPos flooredBlockPos(Vec3d pos) { + return BlockPos.ofFloored(pos); + } + + public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos midohraBlockPos(int x, int y, int z) { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(x, y, z); + } + + public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos flooredMidohraBlockPos(double x, double y, double z) { + int x1 = (int) Math.floor(x); + int y1 = (int) Math.floor(y); + int z1 = (int) Math.floor(z); + return midohraBlockPos(x1, y1, z1); + } + + public static double getSquaredDistance(BlockPos pos1, BlockPos pos2) { + return pos1.getSquaredDistance(pos2); + } + + public static double getSquaredDistance(BlockPos pos1, double x, double y, double z) { + return pos1.getSquaredDistance(x, y, z); + } + + public static Iterable iterate(BlockPos start, BlockPos end) { + return BlockPos.iterate(start, end); + } + + public static BlockPos[] getNeighborPoses(BlockPos pos) { + return new BlockPos[]{pos.north(), pos.south(), pos.east(), pos.west(), pos.up(), pos.down()}; + } + + public static BlockPos up(BlockPos pos) { + return pos.up(); + } + + public static BlockPos down(BlockPos pos) { + return pos.down(); + } + + public static BlockPos north(BlockPos pos) { + return pos.north(); + } + + public static BlockPos south(BlockPos pos) { + return pos.south(); + } + + public static BlockPos east(BlockPos pos) { + return pos.east(); + } + + public static BlockPos west(BlockPos pos) { + return pos.west(); + } + + public static BlockPos add(BlockPos pos, int x, int y, int z) { + return pos.add(x, y, z); + } + + public static BlockPos sub(BlockPos pos, int x, int y, int z) { + return pos.subtract(new Vec3i(x, y, z)); + } + + public static BlockPos mul(BlockPos pos, int n) { + return pos.multiply(n); + } + + public static int x(BlockPos pos) { + return pos.getX(); + } + + public static int y(BlockPos pos) { + return pos.getY(); + } + + public static int z(BlockPos pos) { + return pos.getZ(); + } + + public static BlockPos offset(BlockPos pos, Direction direction) { + return pos.offset(direction); + } + + public static BlockPos offset(BlockPos pos, Direction direction, int n) { + return pos.offset(direction, n); + } + + public static BlockPos offset(BlockPos pos, net.pitan76.mcpitanlib.midohra.util.math.Direction direction) { + return pos.offset(direction.toMinecraft()); + } + + public static BlockPos offset(BlockPos pos, net.pitan76.mcpitanlib.midohra.util.math.Direction direction, int n) { + return pos.offset(direction.toMinecraft(), n); + } + + public static BlockPos toImmutable(BlockPos pos) { + return pos.toImmutable(); + } + + public static long asLong(BlockPos pos) { + return pos.asLong(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java new file mode 100644 index 000000000..f239b0a40 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.api.util.math; + +import net.minecraft.util.math.Vec3d; + +public class Vec3dUtil { + public static Vec3d create(double x, double y, double z) { + return new Vec3d(x, y, z); + } + + public static Vec3d add(Vec3d a, Vec3d b) { + return a.add(b); + } + + public static Vec3d subtract(Vec3d a, Vec3d b) { + return a.subtract(b); + } + + public static Vec3d multiply(Vec3d a, double b) { + return a.multiply(b); + } + + public static Vec3d divide(Vec3d a, double b) { + return a.multiply(1.0D / b); + } + + public static double dot(Vec3d a, Vec3d b) { + return a.dotProduct(b); + } + + public static Vec3d cross(Vec3d a, Vec3d b) { + return a.crossProduct(b); + } + + public static Vec3d normalize(Vec3d a) { + return a.normalize(); + } + + public static Vec3d rotateX(Vec3d a, float angle) { + return a.rotateX(angle); + } + + public static Vec3d rotateY(Vec3d a, float angle) { + return a.rotateY(angle); + } + + public static Vec3d rotateZ(Vec3d a, float angle) { + return a.rotateZ(angle); + } + + public static Vec3d add(Vec3d a, double x, double y, double z) { + return a.add(x, y, z); + } + + public static Vec3d subtract(Vec3d a, double x, double y, double z) { + return a.subtract(x, y, z); + } + + public static Vec3d multiply(Vec3d a, double x, double y, double z) { + return a.multiply(x, y, z); + } + + public static double distanceTo(Vec3d a, Vec3d b) { + return a.distanceTo(b); + } + + public static Vec3d ofCenter(double x, double y, double z) { + return new Vec3d(x + 0.5, y + 0.5, z + 0.5); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java new file mode 100644 index 000000000..4def019b0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java @@ -0,0 +1,33 @@ +package net.pitan76.mcpitanlib.api.util.math; + +import net.minecraft.util.math.Vec3i; + +public class Vec3iUtil { + public static Vec3i create(int x, int y, int z) { + return new Vec3i(x, y, z); + } + + public static Vec3i add(Vec3i a, Vec3i b) { + return a.add(b); + } + + public static Vec3i subtract(Vec3i a, Vec3i b) { + return a.subtract(b); + } + + public static Vec3i multiply(Vec3i a, int b) { + return a.multiply(b); + } + + public static Vec3i cross(Vec3i a, Vec3i b) { + return a.crossProduct(b); + } + + public static Vec3i add(Vec3i a, int x, int y, int z) { + return a.add(x, y, z); + } + + public static Vec3i subtract(Vec3i a, int x, int y, int z) { + return a.add(-x, -y, -z); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java new file mode 100644 index 000000000..93cd723d5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java @@ -0,0 +1,140 @@ +package net.pitan76.mcpitanlib.api.util.math.random; + +public class CompatRandom { + private java.util.Random javaRandom; + private net.minecraft.util.math.random.Random mcRandom; + + public CompatRandom(java.util.Random javaRandom) { + this.javaRandom = javaRandom; + } + + public CompatRandom(net.minecraft.util.math.random.Random mcRandom) { + this.mcRandom = mcRandom; + } + + @Deprecated + public CompatRandom() { + this.mcRandom = net.minecraft.util.math.random.Random.create(); + } + + @Deprecated + public CompatRandom(long seed) { + this.mcRandom = net.minecraft.util.math.random.Random.create(seed); + } + + public static CompatRandom of(long seed) { + return new CompatRandom(seed); + } + + public static CompatRandom of() { + return new CompatRandom(); + } + + public void setSeed(long seed) { + if (javaRandom != null) { + javaRandom.setSeed(seed); + } else { + mcRandom.setSeed(seed); + } + } + + public void skip(int count) { + if (javaRandom != null) { + for (int i = 0; i < count; i++) { + javaRandom.nextInt(); + } + } else { + mcRandom.skip(count); + } + } + + public void split() { + if (javaRandom != null) { + javaRandom.nextInt(); + } else { + mcRandom.split(); + } + } + + public int nextInt() { + if (javaRandom != null) { + return javaRandom.nextInt(); + } else { + return mcRandom.nextInt(); + } + } + + public int nextInt(int bound) { + if (javaRandom != null) { + return javaRandom.nextInt(bound); + } else { + return mcRandom.nextInt(bound); + } + } + + public long nextLong() { + if (javaRandom != null) { + return javaRandom.nextLong(); + } else { + return mcRandom.nextLong(); + } + } + + public double nextDouble() { + if (javaRandom != null) { + return javaRandom.nextDouble(); + } else { + return mcRandom.nextDouble(); + } + } + + public double nextGaussian() { + if (javaRandom != null) { + return javaRandom.nextGaussian(); + } else { + return mcRandom.nextGaussian(); + } + } + + public float nextFloat() { + if (javaRandom != null) { + return javaRandom.nextFloat(); + } else { + return mcRandom.nextFloat(); + } + } + + public int nextBetween(int min, int max) { + if (javaRandom != null) { + return min + javaRandom.nextInt(max - min); + } else { + return min + mcRandom.nextInt(max - min); + } + } + + public int nextBetweenExclusive(int min, int max) { + if (javaRandom != null) { + return min + javaRandom.nextInt(max - min - 1); + } else { + return min + mcRandom.nextInt(max - min - 1); + } + } + + public boolean nextBoolean() { + if (javaRandom != null) { + return javaRandom.nextBoolean(); + } else { + return mcRandom.nextBoolean(); + } + } + + @Deprecated + public java.util.Random getJavaRandom() { + return javaRandom; + } + + @Deprecated + public net.minecraft.util.math.random.Random getMcRandom() { + return mcRandom; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java new file mode 100644 index 000000000..56646127c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.util.nbt; + +import net.minecraft.inventory.Inventories; +import net.minecraft.item.ItemStack; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; + +public class InvRWUtil { + public static void putInv(WriteNbtArgs args, DefaultedList stacks) { + Inventories.writeData(args.view, stacks); + } + + public static void getInv(ReadNbtArgs args, DefaultedList stacks) { + Inventories.readData(args.view, stacks); + } + + public static void putInv(WriteNbtArgs args, ItemStackList stacks) { + putInv(args, (DefaultedList) stacks); + } + + public static void getInv(ReadNbtArgs args, ItemStackList stacks) { + getInv(args, (DefaultedList) stacks); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java new file mode 100644 index 000000000..a8f2c17e7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java @@ -0,0 +1,88 @@ +package net.pitan76.mcpitanlib.api.util.nbt; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtList; +import net.pitan76.mcpitanlib.api.util.NbtUtil; + +import java.util.Optional; +import java.util.stream.Stream; + +public class NbtListUtil { + public static NbtList create() { + return NbtUtil.createNbtList(); + } + + public static NbtList copy(NbtList list) { + return list.copy(); + } + + public static Stream stream(NbtList list) { + return list.stream(); + } + + public static Optional getStringOptional(NbtList list, int index) { + return list.getString(index); + } + + public static NbtElement get(NbtList list, int index) { + return list.get(index); + } + + public static NbtElement getOrDefault(NbtList list, int index, NbtElement defaultValue) { + NbtElement nbt = get(list, index); + return nbt == null ? defaultValue : nbt; + } + + public static void set(NbtList list, int index, NbtElement value) { + list.set(index, value); + } + + public static void add(NbtList list, NbtElement value) { + list.add(value); + } + + public static void set(NbtList list, int index, String value) { + set(list, index, NbtUtil.createString(value)); + } + + public static boolean has(NbtList list, NbtElement value) { + return list.contains(value); + } + + public static int size(NbtList list) { + return list.size(); + } + + public static void remove(NbtList list, int index) { + list.remove(index); + } + + public static void clear(NbtList list) { + list.clear(); + } + + public static boolean isEmpty(NbtList list) { + return list.isEmpty(); + } + + public static String getString(NbtList list, int index) { + return getStringOptional(list, index).orElse(""); + } + + public static void setString(NbtList list, int index, String value) { + list.set(index, NbtUtil.createString(value)); + } + + public static void addString(NbtList list, String value) { + list.add(NbtUtil.createString(value)); + } + + public static NbtList getList(NbtList list, int index) { + return list.getList(index).orElse(create()); + } + + public static NbtCompound getCompound(NbtList list, int index) { + return list.getCompound(index).orElse(NbtUtil.create()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java new file mode 100644 index 000000000..17c119629 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java @@ -0,0 +1,141 @@ +package net.pitan76.mcpitanlib.api.util.nbt; + +import net.minecraft.nbt.NbtCompound; +import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.util.NbtUtil; + +public class NbtRWUtil { + + public static void putBoolean(WriteNbtArgs args, String key, boolean value) { + args.view.putBoolean(key, value); + } + + public static boolean getBoolean(ReadNbtArgs args, String key) { + return args.view.getBoolean(key, false); + } + + public static void putByte(WriteNbtArgs args, String key, byte value) { + args.view.putByte(key, value); + } + + public static byte getByte(ReadNbtArgs args, String key) { + return args.view.getByte(key, (byte) 0); + } + + public static void putInt(WriteNbtArgs args, String key, int value) { + args.view.putInt(key, value); + } + + public static int getInt(ReadNbtArgs args, String key) { + return args.view.getInt(key, 0); + } + + public static void putLong(WriteNbtArgs args, String key, long value) { + args.view.putLong(key, value); + } + + public static long getLong(ReadNbtArgs args, String key) { + return args.view.getLong(key, 0L); + } + + public static void putShort(WriteNbtArgs args, String key, short value) { + args.view.putShort(key, value); + } + + public static short getShort(ReadNbtArgs args, String key) { + return (short) args.view.getShort(key, (short) 0); + } + + public static void putFloat(WriteNbtArgs args, String key, float value) { + args.view.putFloat(key, value); + } + + public static float getFloat(ReadNbtArgs args, String key) { + return args.view.getFloat(key, 0.0f); + } + + public static void putDouble(WriteNbtArgs args, String key, double value) { + args.view.putDouble(key, value); + } + + public static double getDouble(ReadNbtArgs args, String key) { + return args.view.getDouble(key, 0.0); + } + + public static void putString(WriteNbtArgs args, String key, String value) { + args.view.putString(key, value); + } + + public static String getString(ReadNbtArgs args, String key) { + return args.view.getString(key, ""); + } + + public static void putIntArray(WriteNbtArgs args, String key, int[] value) { + args.view.putIntArray(key, value); + } + + public static int[] getIntArray(ReadNbtArgs args, String key) { + return args.view.getOptionalIntArray(key).orElse(new int[0]); + } + + public static boolean getBooleanOrDefault(ReadNbtArgs args, String key, boolean defaultValue) { + return args.view.getBoolean(key, defaultValue); + } + + public static byte getByteOrDefault(ReadNbtArgs args, String key, byte defaultValue) { + return args.view.getByte(key, defaultValue); + } + + public static int getIntOrDefault(ReadNbtArgs args, String key, int defaultValue) { + return args.view.getInt(key, defaultValue); + } + + public static long getLongOrDefault(ReadNbtArgs args, String key, long defaultValue) { + return args.view.getLong(key, defaultValue); + } + + public static short getShortOrDefault(ReadNbtArgs args, String key, short defaultValue) { + return (short) args.view.getShort(key, defaultValue); + } + + public static float getFloatOrDefault(ReadNbtArgs args, String key, float defaultValue) { + return args.view.getFloat(key, defaultValue); + } + + public static double getDoubleOrDefault(ReadNbtArgs args, String key, double defaultValue) { + return args.view.getDouble(key, defaultValue); + } + + public static String getStringOrDefault(ReadNbtArgs args, String key, String defaultValue) { + return args.view.getString(key, defaultValue); + } + + public static int[] getIntArrayOrDefault(ReadNbtArgs args, String key, int[] defaultValue) { + return args.view.getOptionalIntArray(key).orElse(defaultValue); + } + + public static boolean isEmpty(NbtRWArgs args) { + if (args instanceof WriteNbtArgs) + return ((WriteNbtArgs) args).view.isEmpty(); + else + return true; + } + + public static void put(WriteNbtArgs args, String key, NbtRWArgs other) { + putCompound(args, key, other.nbt); + } + + public static NbtRWArgs get(ReadNbtArgs args, String key) { + return new NbtRWArgs(getCompound(args, key)); + } + + public static void putCompound(WriteNbtArgs args, String key, NbtCompound other) { + args.view.put(key, NbtCompound.CODEC, other); + } + + public static NbtCompound getCompound(ReadNbtArgs args, String key) { + return args.view.read(key, NbtCompound.CODEC).orElse(NbtUtil.create()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java new file mode 100644 index 000000000..702a6e97b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java @@ -0,0 +1,126 @@ +package net.pitan76.mcpitanlib.api.util.nbt.v2; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.storage.NbtWriteView; +import net.minecraft.storage.ReadView; +import net.minecraft.util.ErrorReporter; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; +import net.pitan76.mcpitanlib.api.util.math.PosUtil; +import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; +import net.pitan76.mcpitanlib.api.util.math.Vec3iUtil; +import net.pitan76.mcpitanlib.api.util.nbt.InvRWUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; + +import java.util.Optional; + +public class NbtRWUtil extends net.pitan76.mcpitanlib.api.util.nbt.NbtRWUtil { + public static void putInv(WriteNbtArgs args, ItemStackList stacks) { + InvRWUtil.putInv(args, stacks); + } + + public static void getInv(ReadNbtArgs args, ItemStackList stacks) { + InvRWUtil.getInv(args, stacks); + } + + public static WriteNbtArgs create(CompatRegistryLookup registryLookup) { + NbtWriteView view = _view(registryLookup); + return new WriteNbtArgs(view.getNbt(), view, registryLookup); + } + + public static WriteNbtArgs create() { + return create(null); + } + + public static void put(WriteNbtArgs parent, WriteNbtArgs child, String key) { + if (child.view instanceof NbtWriteView childView) + parent.view.put(key, NbtCompound.CODEC, childView.getNbt()); + } + + public static WriteNbtArgs putWithCreate(WriteNbtArgs parent, String key) { + NbtWriteView subView = _view(parent.registryLookup); + parent.view.put(key, NbtCompound.CODEC, subView.getNbt()); + return new WriteNbtArgs(subView.getNbt(), subView, parent.registryLookup); + } + + public static ReadNbtArgs get(ReadNbtArgs parent, String key) { + ReadView view = parent.view.getReadView(key); + return new ReadNbtArgs(null, view, parent.registryLookup); + } + + public static ReadNbtArgs getOrDefault(ReadNbtArgs parent, String key, ReadNbtArgs defaultValue) { + Optional view = parent.view.getOptionalReadView(key); + return view.map(readView -> new ReadNbtArgs(null, readView, parent.registryLookup)).orElse(defaultValue); + } + + public static void putPos3i(WriteNbtArgs args, String key, int x, int y, int z) { + WriteNbtArgs args2 = putWithCreate(args, key); + putInt(args2, "x", x); + putInt(args2, "y", y); + putInt(args2, "z", z); + } + + public static void putPos3d(WriteNbtArgs args, String key, double x, double y, double z) { + WriteNbtArgs args2 = putWithCreate(args, key); + putDouble(args2, "x", x); + putDouble(args2, "y", y); + putDouble(args2, "z", z); + } + + public static Vec3i getPos3i(ReadNbtArgs args, String key) { + ReadNbtArgs args2 = get(args, key); + int x = getInt(args2, "x"); + int y = getInt(args2, "y"); + int z = getInt(args2, "z"); + return Vec3iUtil.create(x, y, z); + } + + public static Vec3d getPos3d(ReadNbtArgs args, String key) { + ReadNbtArgs args2 = get(args, key); + double x = getDouble(args2, "x"); + double y = getDouble(args2, "y"); + double z = getDouble(args2, "z"); + return Vec3dUtil.create(x, y, z); + } + + public static void putBlockPos(WriteNbtArgs args, String key, BlockPos pos) { + putPos3i(args, key, pos.getX(), pos.getY(), pos.getZ()); + } + + public static BlockPos getBlockPos(ReadNbtArgs args, String key) { + ReadNbtArgs args2 = get(args, key); + int x = getInt(args2, "x"); + int y = getInt(args2, "y"); + int z = getInt(args2, "z"); + return BlockPos.of(x, y, z); + } + + public static void putBlockPos(WriteNbtArgs args, String key, net.minecraft.util.math.BlockPos pos) { + putPos3i(args, key, PosUtil.x(pos), PosUtil.y(pos), PosUtil.z(pos)); + } + + public static net.minecraft.util.math.BlockPos getBlockPosV(ReadNbtArgs args, String key) { + ReadNbtArgs args2 = get(args, key); + int x = getInt(args2, "x"); + int y = getInt(args2, "y"); + int z = getInt(args2, "z"); + return PosUtil.flooredBlockPos(x, y, z); + } + + private static NbtWriteView _view(CompatRegistryLookup registryLookup) { + return NbtWriteView.create(ErrorReporter.EMPTY, registryLookup.getRegistryLookup()); + } + + public static void putItemStack(WriteNbtArgs args, String key, ItemStack stack) { + args.view.put(key, ItemStack.CODEC, stack); + } + + public static Optional getItemStack(ReadNbtArgs args, String key) { + return args.view.read(key, ItemStack.CODEC); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java new file mode 100644 index 000000000..8393a6178 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.util.particle; + +import net.minecraft.particle.ParticleType; +import net.minecraft.registry.Registries; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatParticleType { + private final ParticleType particleType; + + public CompatParticleType(ParticleType particleType) { + this.particleType = particleType; + } + + public static CompatParticleType of(ParticleType particleType) { + return new CompatParticleType(particleType); + } + + public ParticleType getRaw() { + return particleType; + } + + public boolean shouldAlwaysSpawn() { + return particleType.shouldAlwaysSpawn(); + } + + public Identifier getId() { + return Registries.PARTICLE_TYPE.getId(particleType); + } + + public CompatIdentifier getCompatId() { + return CompatIdentifier.fromMinecraft(getId()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java new file mode 100644 index 000000000..5562d9bda --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java @@ -0,0 +1,121 @@ +package net.pitan76.mcpitanlib.api.util.particle; + +import net.minecraft.particle.*; + +public class CompatParticleTypes { + public static final CompatParticleType ANGRY_VILLAGER = new CompatParticleType(ParticleTypes.ANGRY_VILLAGER); + public static final CompatParticleType BLOCK = new CompatParticleType(ParticleTypes.BLOCK); + public static final CompatParticleType BLOCK_MARKER = new CompatParticleType(ParticleTypes.BLOCK_MARKER); + public static final CompatParticleType BUBBLE = new CompatParticleType(ParticleTypes.BUBBLE); + public static final CompatParticleType CLOUD = new CompatParticleType(ParticleTypes.CLOUD); + public static final CompatParticleType COPPER_FIRE_FLAME = new CompatParticleType(ParticleTypes.COPPER_FIRE_FLAME); + public static final CompatParticleType CRIT = new CompatParticleType(ParticleTypes.CRIT); + public static final CompatParticleType DAMAGE_INDICATOR = new CompatParticleType(ParticleTypes.DAMAGE_INDICATOR); + public static final CompatParticleType DRAGON_BREATH = new CompatParticleType(ParticleTypes.DRAGON_BREATH); + public static final CompatParticleType DRIPPING_LAVA = new CompatParticleType(ParticleTypes.DRIPPING_LAVA); + public static final CompatParticleType FALLING_LAVA = new CompatParticleType(ParticleTypes.FALLING_LAVA); + public static final CompatParticleType LANDING_LAVA = new CompatParticleType(ParticleTypes.LANDING_LAVA); + public static final CompatParticleType DRIPPING_WATER = new CompatParticleType(ParticleTypes.DRIPPING_WATER); + public static final CompatParticleType FALLING_WATER = new CompatParticleType(ParticleTypes.FALLING_WATER); + public static final CompatParticleType DUST = new CompatParticleType(ParticleTypes.DUST); + public static final CompatParticleType DUST_COLOR_TRANSITION = new CompatParticleType(ParticleTypes.DUST_COLOR_TRANSITION); + public static final CompatParticleType EFFECT = new CompatParticleType(ParticleTypes.EFFECT); + public static final CompatParticleType ELDER_GUARDIAN = new CompatParticleType(ParticleTypes.ELDER_GUARDIAN); + public static final CompatParticleType ENCHANTED_HIT = new CompatParticleType(ParticleTypes.ENCHANTED_HIT); + public static final CompatParticleType ENCHANT = new CompatParticleType(ParticleTypes.ENCHANT); + public static final CompatParticleType END_ROD = new CompatParticleType(ParticleTypes.END_ROD); + public static final CompatParticleType ENTITY_EFFECT = new CompatParticleType(ParticleTypes.ENTITY_EFFECT); + public static final CompatParticleType EXPLOSION_EMITTER = new CompatParticleType(ParticleTypes.EXPLOSION_EMITTER); + public static final CompatParticleType EXPLOSION = new CompatParticleType(ParticleTypes.EXPLOSION); + public static final CompatParticleType GUST = new CompatParticleType(ParticleTypes.GUST); + public static final CompatParticleType SMALL_GUST = new CompatParticleType(ParticleTypes.SMALL_GUST); + public static final CompatParticleType GUST_EMITTER_LARGE = new CompatParticleType(ParticleTypes.GUST_EMITTER_LARGE); + public static final CompatParticleType GUST_EMITTER_SMALL = new CompatParticleType(ParticleTypes.GUST_EMITTER_SMALL); + public static final CompatParticleType SONIC_BOOM = new CompatParticleType(ParticleTypes.SONIC_BOOM); + public static final CompatParticleType FALLING_DUST = new CompatParticleType(ParticleTypes.FALLING_DUST); + public static final CompatParticleType FIREWORK = new CompatParticleType(ParticleTypes.FIREWORK); + public static final CompatParticleType FISHING = new CompatParticleType(ParticleTypes.FISHING); + public static final CompatParticleType FLAME = new CompatParticleType(ParticleTypes.FLAME); + public static final CompatParticleType INFESTED = new CompatParticleType(ParticleTypes.INFESTED); + public static final CompatParticleType CHERRY_LEAVES = new CompatParticleType(ParticleTypes.CHERRY_LEAVES); + public static final CompatParticleType PALE_OAK_LEAVES = new CompatParticleType(ParticleTypes.PALE_OAK_LEAVES); + public static final CompatParticleType TINTED_LEAVES = new CompatParticleType(ParticleTypes.TINTED_LEAVES); + public static final CompatParticleType SCULK_SOUL = new CompatParticleType(ParticleTypes.SCULK_SOUL); + public static final CompatParticleType SCULK_CHARGE = new CompatParticleType(ParticleTypes.SCULK_CHARGE); + public static final CompatParticleType SCULK_CHARGE_POP = new CompatParticleType(ParticleTypes.SCULK_CHARGE_POP); + public static final CompatParticleType SOUL_FIRE_FLAME = new CompatParticleType(ParticleTypes.SOUL_FIRE_FLAME); + public static final CompatParticleType SOUL = new CompatParticleType(ParticleTypes.SOUL); + public static final CompatParticleType FLASH = new CompatParticleType(ParticleTypes.FLASH); + public static final CompatParticleType HAPPY_VILLAGER = new CompatParticleType(ParticleTypes.HAPPY_VILLAGER); + public static final CompatParticleType COMPOSTER = new CompatParticleType(ParticleTypes.COMPOSTER); + public static final CompatParticleType HEART = new CompatParticleType(ParticleTypes.HEART); + public static final CompatParticleType INSTANT_EFFECT = new CompatParticleType(ParticleTypes.INSTANT_EFFECT); + public static final CompatParticleType ITEM = new CompatParticleType(ParticleTypes.ITEM); + public static final CompatParticleType VIBRATION = new CompatParticleType(ParticleTypes.VIBRATION); + public static final CompatParticleType TRAIL = new CompatParticleType(ParticleTypes.TRAIL); + public static final CompatParticleType ITEM_SLIME = new CompatParticleType(ParticleTypes.ITEM_SLIME); + public static final CompatParticleType ITEM_COBWEB = new CompatParticleType(ParticleTypes.ITEM_COBWEB); + public static final CompatParticleType ITEM_SNOWBALL = new CompatParticleType(ParticleTypes.ITEM_SNOWBALL); + public static final CompatParticleType LARGE_SMOKE = new CompatParticleType(ParticleTypes.LARGE_SMOKE); + public static final CompatParticleType LAVA = new CompatParticleType(ParticleTypes.LAVA); + public static final CompatParticleType MYCELIUM = new CompatParticleType(ParticleTypes.MYCELIUM); + public static final CompatParticleType NOTE = new CompatParticleType(ParticleTypes.NOTE); + public static final CompatParticleType POOF = new CompatParticleType(ParticleTypes.POOF); + public static final CompatParticleType PORTAL = new CompatParticleType(ParticleTypes.PORTAL); + public static final CompatParticleType RAIN = new CompatParticleType(ParticleTypes.RAIN); + public static final CompatParticleType SMOKE = new CompatParticleType(ParticleTypes.SMOKE); + public static final CompatParticleType WHITE_SMOKE = new CompatParticleType(ParticleTypes.WHITE_SMOKE); + public static final CompatParticleType SNEEZE = new CompatParticleType(ParticleTypes.SNEEZE); + public static final CompatParticleType SPIT = new CompatParticleType(ParticleTypes.SPIT); + public static final CompatParticleType SQUID_INK = new CompatParticleType(ParticleTypes.SQUID_INK); + public static final CompatParticleType SWEEP_ATTACK = new CompatParticleType(ParticleTypes.SWEEP_ATTACK); + public static final CompatParticleType TOTEM_OF_UNDYING = new CompatParticleType(ParticleTypes.TOTEM_OF_UNDYING); + public static final CompatParticleType UNDERWATER = new CompatParticleType(ParticleTypes.UNDERWATER); + public static final CompatParticleType SPLASH = new CompatParticleType(ParticleTypes.SPLASH); + public static final CompatParticleType WITCH = new CompatParticleType(ParticleTypes.WITCH); + public static final CompatParticleType BUBBLE_POP = new CompatParticleType(ParticleTypes.BUBBLE_POP); + public static final CompatParticleType CURRENT_DOWN = new CompatParticleType(ParticleTypes.CURRENT_DOWN); + public static final CompatParticleType BUBBLE_COLUMN_UP = new CompatParticleType(ParticleTypes.BUBBLE_COLUMN_UP); + public static final CompatParticleType NAUTILUS = new CompatParticleType(ParticleTypes.NAUTILUS); + public static final CompatParticleType DOLPHIN = new CompatParticleType(ParticleTypes.DOLPHIN); + public static final CompatParticleType CAMPFIRE_COSY_SMOKE = new CompatParticleType(ParticleTypes.CAMPFIRE_COSY_SMOKE); + public static final CompatParticleType CAMPFIRE_SIGNAL_SMOKE = new CompatParticleType(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE); + public static final CompatParticleType DRIPPING_HONEY = new CompatParticleType(ParticleTypes.DRIPPING_HONEY); + public static final CompatParticleType FALLING_HONEY = new CompatParticleType(ParticleTypes.FALLING_HONEY); + public static final CompatParticleType LANDING_HONEY = new CompatParticleType(ParticleTypes.LANDING_HONEY); + public static final CompatParticleType FALLING_NECTAR = new CompatParticleType(ParticleTypes.FALLING_NECTAR); + public static final CompatParticleType FALLING_SPORE_BLOSSOM = new CompatParticleType(ParticleTypes.FALLING_SPORE_BLOSSOM); + public static final CompatParticleType ASH = new CompatParticleType(ParticleTypes.ASH); + public static final CompatParticleType CRIMSON_SPORE = new CompatParticleType(ParticleTypes.CRIMSON_SPORE); + public static final CompatParticleType WARPED_SPORE = new CompatParticleType(ParticleTypes.WARPED_SPORE); + public static final CompatParticleType SPORE_BLOSSOM_AIR = new CompatParticleType(ParticleTypes.SPORE_BLOSSOM_AIR); + public static final CompatParticleType DRIPPING_OBSIDIAN_TEAR = new CompatParticleType(ParticleTypes.DRIPPING_OBSIDIAN_TEAR); + public static final CompatParticleType FALLING_OBSIDIAN_TEAR = new CompatParticleType(ParticleTypes.FALLING_OBSIDIAN_TEAR); + public static final CompatParticleType LANDING_OBSIDIAN_TEAR = new CompatParticleType(ParticleTypes.LANDING_OBSIDIAN_TEAR); + public static final CompatParticleType REVERSE_PORTAL = new CompatParticleType(ParticleTypes.REVERSE_PORTAL); + public static final CompatParticleType WHITE_ASH = new CompatParticleType(ParticleTypes.WHITE_ASH); + public static final CompatParticleType SMALL_FLAME = new CompatParticleType(ParticleTypes.SMALL_FLAME); + public static final CompatParticleType SNOWFLAKE = new CompatParticleType(ParticleTypes.SNOWFLAKE); + public static final CompatParticleType DRIPPING_DRIPSTONE_LAVA = new CompatParticleType(ParticleTypes.DRIPPING_DRIPSTONE_LAVA); + public static final CompatParticleType FALLING_DRIPSTONE_LAVA = new CompatParticleType(ParticleTypes.FALLING_DRIPSTONE_LAVA); + public static final CompatParticleType DRIPPING_DRIPSTONE_WATER = new CompatParticleType(ParticleTypes.DRIPPING_DRIPSTONE_WATER); + public static final CompatParticleType FALLING_DRIPSTONE_WATER = new CompatParticleType(ParticleTypes.FALLING_DRIPSTONE_WATER); + public static final CompatParticleType GLOW_SQUID_INK = new CompatParticleType(ParticleTypes.GLOW_SQUID_INK); + public static final CompatParticleType GLOW = new CompatParticleType(ParticleTypes.GLOW); + public static final CompatParticleType WAX_ON = new CompatParticleType(ParticleTypes.WAX_ON); + public static final CompatParticleType WAX_OFF = new CompatParticleType(ParticleTypes.WAX_OFF); + public static final CompatParticleType ELECTRIC_SPARK = new CompatParticleType(ParticleTypes.ELECTRIC_SPARK); + public static final CompatParticleType SCRAPE = new CompatParticleType(ParticleTypes.SCRAPE); + public static final CompatParticleType SHRIEK = new CompatParticleType(ParticleTypes.SHRIEK); + public static final CompatParticleType EGG_CRACK = new CompatParticleType(ParticleTypes.EGG_CRACK); + public static final CompatParticleType DUST_PLUME = new CompatParticleType(ParticleTypes.DUST_PLUME); + public static final CompatParticleType TRIAL_SPAWNER_DETECTION = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTION); + public static final CompatParticleType TRIAL_SPAWNER_DETECTION_OMINOUS = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTION_OMINOUS); + public static final CompatParticleType VAULT_CONNECTION = new CompatParticleType(ParticleTypes.VAULT_CONNECTION); + public static final CompatParticleType DUST_PILLAR = new CompatParticleType(ParticleTypes.DUST_PILLAR); + public static final CompatParticleType OMINOUS_SPAWNING = new CompatParticleType(ParticleTypes.OMINOUS_SPAWNING); + public static final CompatParticleType RAID_OMEN = new CompatParticleType(ParticleTypes.RAID_OMEN); + public static final CompatParticleType TRIAL_OMEN = new CompatParticleType(ParticleTypes.TRIAL_OMEN); + public static final CompatParticleType BLOCK_CRUMBLE = new CompatParticleType(ParticleTypes.BLOCK_CRUMBLE); + public static final CompatParticleType FIREFLY = new CompatParticleType(ParticleTypes.FIREFLY); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java new file mode 100644 index 000000000..9eab41f4d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.api.util.particle.effect; + +import net.minecraft.item.ItemStack; +import net.minecraft.particle.ItemStackParticleEffect; +import net.minecraft.particle.ParticleType; +import net.minecraft.particle.ParticleTypes; + +// Use: ParticleEffectUtil +public class ItemStackParticleEffectUtil { + + public ItemStackParticleEffectUtil() { + // Empty constructor + } + + public ItemStackParticleEffect create(ParticleType type, ItemStack stack) { + return new ItemStackParticleEffect(type, stack); + } + + public ItemStackParticleEffect createTypedItem(ItemStack stack) { + return new ItemStackParticleEffect(ParticleTypes.ITEM, stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java new file mode 100644 index 000000000..2c6844f07 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java @@ -0,0 +1,43 @@ +package net.pitan76.mcpitanlib.api.util.recipe; + +import it.unimi.dsi.fastutil.ints.IntList; +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.Recipe; +import net.minecraft.recipe.RecipeMatcher; +import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.util.ItemUtil; + +public class RecipeMatcherUtil { + public static ItemStack getStackFromId(int itemId) { + return ItemStackUtil.create(ItemUtil.fromIndex(itemId)); + } + + public static int getItemId(ItemStack stack) { + return ItemUtil.getRawId(stack.getItem()); + } + + public static boolean match(RecipeMatcher matcher, CompatibleRecipeEntry entry, IntList output) { + return match(matcher, entry.getRecipe(), output); + } + + public static boolean match(RecipeMatcher matcher, CompatibleRecipeEntry entry, IntList output, int multiplier) { + return match(matcher, entry.getRecipe(), output, multiplier); + } + + @Deprecated + public static boolean match(RecipeMatcher matcher, Recipe recipe, IntList output) { + return false; + //return matcher.match(recipe, output); + } + + @Deprecated + public static boolean match(RecipeMatcher matcher, Recipe recipe, IntList output, int multiplier) { + return false; + //return matcher.match(recipe, output, multiplier); + } + + public static void clear(RecipeMatcher matcher) { + matcher.clear(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java new file mode 100644 index 000000000..dc6430e2b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java @@ -0,0 +1,101 @@ +package net.pitan76.mcpitanlib.api.util.recipe; + +import net.minecraft.recipe.Recipe; +import net.minecraft.recipe.RecipeType; +import net.minecraft.recipe.ServerRecipeManager; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; +import net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry; +import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class RecipeUtil { + public static Collection> getMCRecipes(World world) { + Collection> recipes = new ArrayList<>(); + + for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { + recipes.add(entry.value()); + } + + return recipes; + } + + public static Collection> getMCRecipeEntries(World world) { + if (world.getRecipeManager() instanceof ServerRecipeManager) { + return ((ServerRecipeManager) world.getRecipeManager()).values(); + } + + // Client is not supported... TODO: Implement client support for 1.21.3~ + return new ArrayList<>(); + } + + public static Collection getRecipes(World world) { + List recipes = new ArrayList<>(); + + for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { + recipes.add(new CompatRecipe(entry)); + } + + return recipes; + } + + public static Collection getRecipesByType(World world, RecipeType type) { + List recipes = new ArrayList<>(); + + for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { + if (entry.value().getType() == type) { + recipes.add(new CompatRecipe(entry)); + } + } + + return recipes; + } + + // MidohraAPI + public static Collection getRecipes(net.pitan76.mcpitanlib.midohra.world.World world) { + return getRecipes(world.getRaw()); + } + + public static Collection getRecipesByType(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.recipe.RecipeType type) { + return getRecipesByType(world.getRaw(), type.getRaw()); + } + + public static Collection getRecipeEntries(net.pitan76.mcpitanlib.midohra.world.World world) { + List entries = new ArrayList<>(); + + for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world.getRaw())) { + entries.add(RecipeEntry.of(entry.value(), CompatIdentifier.fromMinecraft(entry.id().getValue()))); + } + + return entries; + } + + public static Collection getCraftingRecipes(net.pitan76.mcpitanlib.midohra.world.World world) { + List recipes = new ArrayList<>(); + + for (CompatRecipe recipe : getRecipesByType(world, net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING)) { + if (recipe.getRecipe() instanceof net.minecraft.recipe.CraftingRecipe) { + recipes.add(CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) recipe.getRecipe())); + } + } + + return recipes; + } + + public static Collection getCraftingRecipeEntries(net.pitan76.mcpitanlib.midohra.world.World world) { + List entries = new ArrayList<>(); + + for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world.getRaw())) { + if (entry.value() instanceof net.minecraft.recipe.CraftingRecipe) { + entries.add(CraftingRecipeEntry.of((net.minecraft.recipe.CraftingRecipe) entry.value(), CompatIdentifier.fromMinecraft(entry.id().getValue()))); + } + } + + return entries; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java new file mode 100644 index 000000000..694e4c3b1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java @@ -0,0 +1,97 @@ +package net.pitan76.mcpitanlib.api.util.recipe.input; + +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.RecipeFinder; +import net.minecraft.recipe.input.CraftingRecipeInput; +import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +import java.util.List; +import java.util.Optional; + +public class CraftingRecipeInputUtil { + public static Optional get(CompatRecipeInput input) { + if (input.getInput() instanceof CraftingRecipeInput) { + return Optional.of((CraftingRecipeInput) input.getInput()); + } + return Optional.empty(); + } + + public static CompatRecipeInput create(CraftingRecipeInput input) { + return new CompatRecipeInput<>(input); + } + + public static CompatRecipeInput create(int width, int height, List stacks) { + return new CompatRecipeInput<>(CraftingRecipeInput.create(width, height, stacks)); + } + + public static ItemStack getStack(CraftingRecipeInput input, int x, int y) { + return input.getStackInSlot(x, y); + } + + public static ItemStack getStack(CompatRecipeInput input, int x, int y) { + Optional recipeInput = get(input); + if (!recipeInput.isPresent()) return ItemStackUtil.empty(); + + return getStack(recipeInput.get(), x, y); + } + + public static net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack(CompatRecipeInput input, int x, int y) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(input, x, y)); + } + + public static RecipeFinder getRecipeMatcher(CraftingRecipeInput input) { + return input.getRecipeMatcher(); + } + + public static RecipeFinder getRecipeMatcher(CompatRecipeInput input) { + Optional recipeInput = get(input); + if (!recipeInput.isPresent()) return null; + + return getRecipeMatcher(recipeInput.get()); + } + + public static List getStacks(CraftingRecipeInput input) { + return input.getStacks(); + } + + public static List getStacks(CompatRecipeInput input) { + Optional recipeInput = get(input); + if (!recipeInput.isPresent()) return null; + + return getStacks(recipeInput.get()); + } + + public static int getWidth(CraftingRecipeInput input) { + return input.getWidth(); + } + + public static int getWidth(CompatRecipeInput input) { + Optional recipeInput = get(input); + if (!recipeInput.isPresent()) return -1; + + return getWidth(recipeInput.get()); + } + + public static int getHeight(CraftingRecipeInput input) { + return input.getHeight(); + } + + public static int getHeight(CompatRecipeInput input) { + Optional recipeInput = get(input); + if (!recipeInput.isPresent()) return -1; + + return getHeight(recipeInput.get()); + } + + public static int getStackCount(CraftingRecipeInput input) { + return input.getStackCount(); + } + + public static int getStackCount(CompatRecipeInput input) { + Optional recipeInput = get(input); + if (!recipeInput.isPresent()) return -1; + + return getStackCount(recipeInput.get()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java new file mode 100644 index 000000000..daf08816f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.api.util.recipe.input; + +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.input.SingleStackRecipeInput; +import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; + +import java.util.Optional; + +public class SingleStackRecipeInputUtil { + public static Optional get(CompatRecipeInput input) { + if (input.getInput() instanceof SingleStackRecipeInput) { + return Optional.of((SingleStackRecipeInput) input.getInput()); + } + return Optional.empty(); + } + + public static CompatRecipeInput create(SingleStackRecipeInput input) { + return new CompatRecipeInput<>(input); + } + + public static CompatRecipeInput create(ItemStack stack) { + return new CompatRecipeInput<>(new SingleStackRecipeInput(stack)); + } + + public static ItemStack getStack(CompatRecipeInput input) { + Optional recipeInput = get(input); + if (!recipeInput.isPresent()) return ItemStackUtil.empty(); + + return recipeInput.get().getStackInSlot(0); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java new file mode 100644 index 000000000..fbc99fb76 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.api.util.screen; + +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.inventory.Inventory; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.Slot; +import org.jetbrains.annotations.Nullable; + +import java.util.Set; + +public class ScreenHandlerUtil { + public static int calcComparatorOutput(@Nullable Inventory inventory) { + return ScreenHandler.calculateComparatorOutput(inventory); + } + + public static int calcComparatorOutput(@Nullable BlockEntity blockEntity) { + return ScreenHandler.calculateComparatorOutput(blockEntity); + } + + public static int calculateStackSize(Set slots, int mode, ItemStack stack) { + return ScreenHandler.calculateStackSize(slots, mode, stack); + } + + public static boolean canInsertItemIntoSlot(@Nullable Slot slot, ItemStack stack, boolean allowOverflow) { + return ScreenHandler.canInsertItemIntoSlot(slot, stack, allowOverflow); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java new file mode 100644 index 000000000..b60360435 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java @@ -0,0 +1,73 @@ +package net.pitan76.mcpitanlib.api.util.v1; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.registry.Registries; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.tag.MineableToolTags; + +import java.util.ArrayList; +import java.util.List; + +public class BlockUtilV1 { + public static Block block(Identifier id) { + return Registries.BLOCK.get(id); + } + + /** + * ~1.16? + * @param settings + * @param toolTags + * @param level + * @return + */ + public static AbstractBlock.Settings breakByTool(AbstractBlock.Settings settings, MineableToolTags toolTags, int level) { + return settings; + } + + public static AbstractBlock.Settings dropsNothing(AbstractBlock.Settings settings) { + return settings.dropsNothing(); + } + + public static AbstractBlock.Settings requiresTool(AbstractBlock.Settings settings) { + return settings.requiresTool(); + } + + public static boolean isExist(Identifier identifier) { + return Registries.BLOCK.containsId(identifier); + } + + public static Identifier toID(Block block) { + return Registries.BLOCK.getId(block); + } + + public static Block fromId(Identifier identifier) { + return Registries.BLOCK.get(identifier); + } + + public static List getAllBlocks() { + List blocks = new ArrayList<>(); + for (Block block : Registries.BLOCK) { + blocks.add(block); + } + return blocks; + } + + @Deprecated + public static Block of(AbstractBlock.Settings settings) { + return new Block(settings); + } + + public static Block of(CompatibleBlockSettings settings) { + return of(settings.build()); + } + + public static int getRawId(Block block) { + return Registries.BLOCK.getRawId(block); + } + + public static Block fromIndex(int index) { + return Registries.BLOCK.get(index); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java new file mode 100644 index 000000000..282a1f9fa --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java @@ -0,0 +1,92 @@ +package net.pitan76.mcpitanlib.api.util.v1; + +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.registry.Registries; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.block.BlockItemByExtendBlock1215; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; +import net.pitan76.mcpitanlib.api.item.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.tag.TagKey; + +import java.util.ArrayList; +import java.util.List; + +public class ItemUtilV1 { + public static Item item(Identifier id) { + return Registries.ITEM.get(id); + } + + public static boolean isEqual(Item item, Item item2) { + return item == item2; + } + + public static boolean isOf(ItemStack stack, Item item) { + return stack.isOf(item); + } + + public static boolean isIn(ItemStack stack, TagKey tagKey) { + return isIn(stack.getItem(), tagKey); + } + + public static boolean isIn(Item item, TagKey tagKey) { + if (item.getRegistryEntry().isIn(tagKey.getTagKey())) return true; + return tagKey.isOf(item); + } + + public static boolean isExist(Identifier identifier) { + return Registries.ITEM.containsId(identifier); + } + public static Identifier toID(Item item) { + return Registries.ITEM.getId(item); + } + + public static Item fromId(Identifier identifier) { + return Registries.ITEM.get(identifier); + } + + @Deprecated + public static BlockItem ofBlock(Block block, Item.Settings settings) { + if (block instanceof ExtendBlock) { + return new BlockItemByExtendBlock1215((ExtendBlock) block, settings); + } + + if (block instanceof ExtendBlockProvider) { + return new BlockItemByExtendBlock1215((ExtendBlockProvider) block, settings); + } + + return new BlockItem(block, settings); + } + + public static BlockItem ofBlock(Block block, CompatibleItemSettings settings) { + return ofBlock(block, settings.build()); + } + + @Deprecated + public static Item of(Item.Settings settings) { + return new Item(settings); + } + + public static Item of(CompatibleItemSettings settings) { + return of(settings.build()); + } + + public static List getAllItems() { + List items = new ArrayList<>(); + for (Item item : Registries.ITEM) { + items.add(item); + } + return items; + } + + public static int getRawId(Item item) { + return Registries.ITEM.getRawId(item); + } + + public static Item fromIndex(int index) { + return Registries.ITEM.get(index); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java new file mode 100644 index 000000000..fcb1dd469 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java @@ -0,0 +1,125 @@ +package net.pitan76.mcpitanlib.api.util.v2; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.BlockUtil; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; + +import java.util.ArrayList; +import java.util.List; + +public class BlockUtilV2 { + /** + * Check if the block is in the tag. (MCPitanLib TagKey) + * @param block Block to check. + * @param tagKey TagKey of the tag. + * @return If the block is in the tag. + */ + public static boolean isIn(Block block, TagKey tagKey) { + if (block.getRegistryEntry().isIn(tagKey.getTagKey())) return true; + return tagKey.isOf(block); + } + + /** + * Check if two blocks are equal. + * @param block Block to compare. + * @param block2 Block to compare. + * @return If two blocks are equal. + */ + public static boolean isEqual(Block block, Block block2) { + return block == block2; + } + + /** + * Get all blocks in the tag. + * @param tagKey TagKey of the tag. + * @return List of blocks in the tag. + */ + public static List getBlocks(TagKey tagKey) { + return getBlocks(tagKey, BlockUtil.getAllBlocks()); + } + /** + * Get given the list of blocks in the tag. + * @param tagKey TagKey of the tag. + * @param blocks List of blocks to search. + * @return List of blocks in the tag. + */ + public static List getBlocks(TagKey tagKey, List blocks) { + List result = new ArrayList<>(); + for (Block block : blocks) { + if (!BlockUtil.isIn(block, tagKey)) continue; + result.add(block); + } + return result; + } + + /** + * Get all blocks in the tag. + * @param identifier Identifier of the tag. + * @return List of blocks in the tag. + */ + public static List getBlocks(Identifier identifier) { + return getBlocks((TagKey) TagKey.create(TagKey.Type.BLOCK, identifier)); + } + + /** + * Get given the list of blocks in the tag. + * @param identifier Identifier of the tag. + * @param blocks List of blocks to search. + * @return List of blocks in the tag. + */ + public static List getBlocks(Identifier identifier, List blocks) { + return getBlocks((TagKey) TagKey.create(TagKey.Type.BLOCK, identifier), blocks); + } + + /** + * Get all blocks in the tag. + * @param id String of the tag. + * @return List of blocks in the tag. + */ + public static List getBlocks(String id) { + return getBlocks(IdentifierUtil.id(id)); + } + + /** + * Get given the list of blocks in the tag. + * @param id String of the tag. + * @param blocks List of blocks to search. + * @return List of blocks in the tag. + */ + + public static List getBlocks(String id, List blocks) { + return getBlocks(IdentifierUtil.id(id), blocks); + } + + /** + * Check if the block is in the tag. + * @param block Block to check. + * @param identifier Identifier of the tag. + * @return If the block is in the tag. + */ + public static boolean isBlockInTag(Block block, Identifier identifier) { + return BlockUtil.isIn(block, (TagKey) TagKey.create(TagKey.Type.BLOCK, identifier)); + } + + /** + * Check if the block is in the tag. + * @param block Block to check. + * @param id String of the tag. + * @return If the block is in the tag. + */ + public static boolean isBlockInTag(Block block, String id) { + return isBlockInTag(block, IdentifierUtil.id(id)); + } + + public static Block fromItem(Item item) { + return Block.getBlockFromItem(item); + } + + public static Block fromItem(ItemStack stack) { + return fromItem(stack.getItem()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java new file mode 100644 index 000000000..c24eb0df9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.api.util.v2; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +public class CustomNameUtil { + + public static void setCustomName(ItemStack stack, Text name) { + stack.set(DataComponentTypes.CUSTOM_NAME, name); + } + + public static void setCustomName(ItemStack stack, String name) { + setCustomNameFromString(stack, name); + } + + public static void setCustomNameFromString(ItemStack stack, String name) { + setCustomName(stack, TextUtil.literal(name)); + } + + public static void setCustomNameFromTranslatable(ItemStack stack, String key) { + setCustomName(stack, TextUtil.translatable(key)); + } + + public static void setCustomName(ItemStack stack, TextComponent name) { + setCustomName(stack, name.getText()); + } + + public static Text getCustomName(ItemStack stack) { + return stack.get(DataComponentTypes.CUSTOM_NAME); + } + + public static String getCustomNameAsString(ItemStack stack) { + return getCustomName(stack).getString(); + } + + public static TextComponent getCustomNameAsTextComponent(ItemStack stack) { + return new TextComponent(getCustomName(stack)); + } + + public static boolean hasCustomName(ItemStack stack) { + return stack.contains(DataComponentTypes.CUSTOM_NAME); + } + + public static void removeCustomName(ItemStack stack) { + stack.remove(DataComponentTypes.CUSTOM_NAME); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java new file mode 100644 index 000000000..d3252452d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java @@ -0,0 +1,94 @@ +package net.pitan76.mcpitanlib.api.util.v2; + +import net.minecraft.item.Item; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.ItemUtil; + +import java.util.ArrayList; +import java.util.List; + +public class ItemUtilV2 { + /** + * Get all items in the tag. + * @param tagKey TagKey of the tag. + * @return List of items in the tag. + */ + public static List getItems(TagKey tagKey) { + return getItems(tagKey, ItemUtil.getAllItems()); + } + + /** + * Get given the list of items in the tag. + * @param tagKey TagKey of the tag. + * @param items List of items to search. + * @return List of items in the tag. + */ + public static List getItems(TagKey tagKey, List items) { + List result = new ArrayList<>(); + for (Item item : items) { + if (!ItemUtil.isIn(item, tagKey)) continue; + result.add(item); + } + return result; + } + + /** + * Get all items in the tag. + * @param identifier Identifier of the tag. + * @return List of items in the tag. + */ + public static List getItems(Identifier identifier) { + return getItems((TagKey) TagKey.create(TagKey.Type.ITEM, identifier)); + } + + /** + * Get given the list of items in the tag. + * @param identifier Identifier of the tag. + * @param items List of items to search. + * @return List of items in the tag. + */ + public static List getItems(Identifier identifier, List items) { + return getItems((TagKey) TagKey.create(TagKey.Type.ITEM, identifier), items); + } + + /** + * Get all items in the tag. + * @param id String of the tag. + * @return List of items in the tag. + */ + public static List getItems(String id) { + return getItems(IdentifierUtil.id(id)); + } + + /** + * Get given the list of items in the tag. + * @param id String of the tag. + * @param items List of items to search. + * @return List of items in the tag. + */ + public static List getItems(String id, List items) { + return getItems(IdentifierUtil.id(id), items); + } + + /** + * Check if the item is in the tag. + * @param item Item to check. + * @param identifier Identifier of the tag. + * @return True if the item is in the tag. + */ + public static boolean isItemInTag(Item item, Identifier identifier) { + return ItemUtil.isIn(item, (TagKey) TagKey.create(TagKey.Type.ITEM, identifier)); + } + + /** + * Check if the item is in the tag. + * @param item Item to check. + * @param id String of the tag. + * @return True if the item is in the tag. + */ + public static boolean isItemInTag(Item item, String id) { + return isItemInTag(item, IdentifierUtil.id(id)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java new file mode 100644 index 000000000..436192e5d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.util.world; + +import net.minecraft.server.world.ServerChunkManager; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; + +public class ChunkManagerUtil { + + public static void markForUpdate(ServerChunkManager manager, BlockPos pos) { + markForUpdate(manager, pos.toRaw()); + } + + public static void markForUpdate(ServerChunkManager manager, net.minecraft.util.math.BlockPos pos) { + manager.markForUpdate(pos); + } + + public static void markForUpdate(ServerWorld world, net.minecraft.util.math.BlockPos pos) { + markForUpdate(ServerWorldUtil.getChunkManager(world), pos); + } + + public static void markForUpdate(World world, net.minecraft.util.math.BlockPos pos) { + if (!(world instanceof ServerWorld)) return; + markForUpdate((ServerWorld) world, pos); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java new file mode 100644 index 000000000..6e1b2166b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java @@ -0,0 +1,44 @@ +package net.pitan76.mcpitanlib.api.util.world; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.particle.ParticleEffect; +import net.minecraft.server.world.ServerChunkManager; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class ServerWorldUtil { + public static void spawnParticles(ServerWorld world, ParticleEffect particle, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { + world.spawnParticles(particle, x, y, z, count, velocityX, velocityY, velocityZ, speed); + } + + public static void spawnParticles(ServerWorld world, Player player, ParticleEffect particle, boolean force, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { + if (player.isServer()) { + world.spawnParticles(player.getServerPlayer().get(), particle, force, false, x, y, z, count, velocityX, velocityY, velocityZ, speed); + } + } + + public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity) { + return Block.getDroppedStacks(state, world, pos, blockEntity); + } + + public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntityWrapper blockEntity) { + return getDroppedStacksOnBlock(state, world, pos, blockEntity.get()); + } + + public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack stack) { + return Block.getDroppedStacks(state, world, pos, blockEntity, entity, stack); + } + + public static ServerChunkManager getChunkManager(ServerWorld world) { + return world.getChunkManager(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java new file mode 100644 index 000000000..22ad43e5f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java @@ -0,0 +1,53 @@ +package net.pitan76.mcpitanlib.api.util.world; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityTicker; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; + +public class TickerUtil { + public static void tick(T blockEntity, World world, BlockPos pos, BlockState state) { + if (isTicker(blockEntity)) + ((BlockEntityTicker) blockEntity).tick(world, pos, state, blockEntity); + } + + public static void tick(T blockEntity, World world, BlockPos pos) { + tick(blockEntity, world, pos, WorldUtil.getBlockState(world, pos)); + } + + public static void tick(T blockEntity) { + tick(blockEntity, blockEntity.getWorld(), blockEntity.getPos()); + } + + public static void tick(T entity) { + entity.tick(); + } + + public static boolean isTicker(BlockEntity blockEntity) { + return blockEntity instanceof BlockEntityTicker; + } + + public static void tick(T blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { + tick(blockEntity, world.toMinecraft(), pos.toMinecraft(), state.toMinecraft()); + } + + public static void tick(T blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + tick(blockEntity, world.toMinecraft(), pos.toMinecraft()); + } + + public static void tick(BlockEntityWrapper blockEntity) { + tick(blockEntity.get()); + } + + public static void tick(BlockEntityWrapper blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { + tick(blockEntity.get(), world.toMinecraft(), pos.toMinecraft(), state.toMinecraft()); + } + + public static void tick(BlockEntityWrapper blockEntity, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + tick(blockEntity.get(), world.toMinecraft(), pos.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java new file mode 100644 index 000000000..6bf8142a5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java @@ -0,0 +1,52 @@ +package net.pitan76.mcpitanlib.api.util.world; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.Entity; +import net.minecraft.fluid.Fluid; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.WorldAccess; + +public class WorldAccessUtil extends WorldViewUtil { + + public static void scheduleBlockTick(WorldAccess world, BlockPos pos, Block block, int delay) { + world.scheduleBlockTick(pos, block, delay); + } + + public static void scheduleFluidTick(WorldAccess world, BlockPos pos, Fluid fluid, int delay) { + world.scheduleFluidTick(pos, fluid, delay); + } + + public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state, int flags) { + return world.setBlockState(pos, state, flags); + } + + public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { + return world.setBlockState(pos, state, flags, maxUpdateDepth); + } + + public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state) { + return setBlockState(world, pos, state, 3); + } + + public static BlockState getBlockState(WorldAccess world, BlockPos pos) { + return world.getBlockState(pos); + } + + public static boolean breakBlock(WorldAccess world, BlockPos pos, boolean drop) { + return world.breakBlock(pos, drop); + } + + public static boolean breakBlock(WorldAccess world, BlockPos pos, boolean drop, Entity entity) { + return world.breakBlock(pos, drop, entity); + } + + public static boolean removeBlock(WorldAccess world, BlockPos pos, boolean move) { + return world.removeBlock(pos, move); + } + + public static MinecraftServer getServer(WorldAccess world) { + return world.getServer(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java new file mode 100644 index 000000000..72dec4165 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java @@ -0,0 +1,104 @@ +package net.pitan76.mcpitanlib.api.util.world; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.FluidState; +import net.minecraft.registry.tag.FluidTags; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.world.WorldAccess; +import net.minecraft.world.WorldView; +import net.minecraft.world.dimension.DimensionType; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; + +import java.util.List; +import java.util.Optional; +import java.util.function.Predicate; + +public class WorldViewUtil { + + public static boolean isClient(WorldView world) { + return world.isClient(); + } + + public static BlockState getBlockState(WorldView world, BlockPos pos) { + return world.getBlockState(pos); + } + + public static Block getBlock(WorldView world, BlockPos pos) { + return getBlockState(world, pos).getBlock(); + } + + public static BlockEntity getBlockEntity(WorldView world, BlockPos pos) { + return world.getBlockEntity(pos); + } + + public static Optional getBlockEntity(WorldView world, BlockPos pos, BlockEntityType type) { + return world.getBlockEntity(pos, type); + } + + public static FluidState getFluidState(WorldView world, BlockPos pos) { + return getBlockState(world, pos).getFluidState(); + } + + public static Fluid getFluid(WorldView world, BlockPos pos) { + return getFluidState(world, pos).getFluid(); + } + + public static int getBottomY(WorldView world) { + return world.getBottomY(); + } + + public static int getTopY(WorldView world) { + return world.getTopYInclusive(); + } + + public static boolean isChunkLoaded(WorldView world, BlockPos pos) { + return world.isChunkLoaded(pos); + } + + public static boolean isRegionLoaded(WorldView world, BlockPos min, BlockPos max) { + return world.isRegionLoaded(min, max); + } + + public static DimensionType getDimensionType(WorldView world) { + return world.getDimension(); + } + + public static boolean isAirBlock(WorldView world, BlockPos pos) { + return getBlockState(world, pos).isAir(); + } + + public static boolean isOpaqueBlock(WorldView world, BlockPos pos) { + return getBlockState(world, pos).isOpaque(); + } + + public static boolean isWater(WorldView world, BlockPos pos) { + return getFluidState(world, pos).isIn(FluidTags.WATER); + } + + public static List getEntitiesByClass(WorldAccess world, Class entityClass, Box box, Predicate predicate) { + return world.getEntitiesByClass(entityClass, box, predicate); + } + + public static List getEntitiesByClass(WorldAccess world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + return getEntitiesByClass(world, entityClass, box.toMinecraft(), predicate); + } + + public static List getEntitiesByType(WorldAccess world, EntityType entityType, Box box, Predicate predicate) { + return world.getEntitiesByType(entityType, box, predicate); + } + + public static List getEntitiesByType(WorldAccess world, EntityType entityType, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + return getEntitiesByType(world, entityType, box.toMinecraft(), predicate); + } + + public static List getEntitiesByType(WorldAccess world, EntityTypeWrapper entityType, Box box, Predicate predicate) { + return getEntitiesByType(world, entityType.get(), box, predicate); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java b/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java new file mode 100644 index 000000000..9f8bdd766 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.api.world; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.world.PersistentState; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; + +public abstract class CompatiblePersistentState extends PersistentState { + // 1.16 + public CompatiblePersistentState(String key) { + super(); + } + + public CompatiblePersistentState() { + super(); + } + + // 1.16 + @Deprecated + public void readNbt(NbtCompound tag) { + readNbt(new ReadNbtArgs(tag)); + } + + public abstract void readNbt(ReadNbtArgs args); + + public abstract NbtCompound writeNbt(WriteNbtArgs args); + + @Deprecated + @Override + public void markDirty() { + callMarkDirty(); + } + + public void callMarkDirty() { + super.markDirty(); + } + + @Deprecated + @Override + public void setDirty(boolean dirty) { + callSetDirty(dirty); + } + + public void callSetDirty(boolean dirty) { + super.setDirty(dirty); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java b/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java new file mode 100644 index 000000000..865a2694f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.world; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.util.WorldUtil; + +public class ExtendWorld { + public World world; + public ExtendWorld(World world) { + this.world = world; + } + + public boolean isDay() { + return WorldUtil.isDay(world); + } + + public boolean isThundering() { + return WorldUtil.isThundering(world); + } + + public boolean isSkyVisible(BlockPos pos) { + return WorldUtil.isSkyVisible(world, pos); + } + + public boolean isRaining() { + return WorldUtil.isRaining(world); + } + + public boolean hasSkyLight() { + return WorldUtil.hasSkyLight(world); + } + + public boolean isNight() { + return WorldUtil.isNight(world); + } + + public boolean isClient() { + return WorldUtil.isClient(world); + } + + public boolean isServer() { + return WorldUtil.isServer(world); + } + + public World getMinecraftWorld() { + return world; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java b/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java new file mode 100644 index 000000000..0386ac276 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java @@ -0,0 +1,4 @@ +package net.pitan76.mcpitanlib.core; + +public class Dummy { +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java b/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java new file mode 100644 index 000000000..c93a48bcd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java @@ -0,0 +1,73 @@ +package net.pitan76.mcpitanlib.core.command; + +import net.minecraft.server.command.ServerCommandSource; + +public class CommandResult { + private boolean isSuccess = false; + private String message = ""; + private int result = 0; + private ErrorType errorType = ErrorType.NONE; + private ServerCommandSource source; + + public CommandResult() { + + } + + public CommandResult(boolean isSuccess, String message) { + this.isSuccess = isSuccess; + this.message = message; + } + + public void setResult(int result) { + this.result = result; + } + + public void setMessage(String message) { + this.message = message; + } + + public void setSuccess(boolean success) { + isSuccess = success; + } + + public boolean isSuccess() { + return isSuccess; + } + + public String getMessage() { + return message; + } + + public int getResult() { + return result; + } + + public void setErrorType(ErrorType errorType) { + this.errorType = errorType; + } + + public ErrorType getErrorType() { + return errorType; + } + + public void setSource(ServerCommandSource source) { + this.source = source; + } + + public ServerCommandSource getSource() { + return source; + } + + public boolean hasError() { + return errorType != ErrorType.NONE; + } + + public enum ErrorType { + NONE, + COMMAND_SYNTAX_ERROR, + COMMAND_NOT_FOUND, + COMMAND_PERMISSION_ERROR, + COMMAND_UNKNOWN_ERROR, + RUNTIME_ERROR + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java b/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java new file mode 100644 index 000000000..d6d85643f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java @@ -0,0 +1,43 @@ +package net.pitan76.mcpitanlib.core.datafixer; + +public class Pair { + private A a; + private B b; + + public Pair(A a, B b) { + this.a = a; + this.b = b; + } + + public A getA() { + return a; + } + + public B getB() { + return b; + } + + public void setA(A a) { + this.a = a; + } + + public void setB(B b) { + this.b = b; + } + + public static Pair of(A a, B b) { + return new Pair<>(a, b); + } + + public static Pair of() { + return new Pair<>(null, null); + } + + public static Pair ofA(A a) { + return new Pair<>(a, null); + } + + public static Pair ofB(B b) { + return new Pair<>(null, b); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java b/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java new file mode 100644 index 000000000..ccf22d47d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java @@ -0,0 +1,198 @@ +package net.pitan76.mcpitanlib.core.mc1216; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.storage.NbtReadView; +import net.minecraft.storage.NbtWriteView; +import net.minecraft.storage.ReadView; +import net.minecraft.storage.WriteView; +import net.minecraft.util.ErrorReporter; +import net.pitan76.mcpitanlib.api.nbt.NbtTypeBytes; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.NbtUtil; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class NbtDataConverter { + public static void nbt2writeData(NbtCompound nbt, WriteView view) { + if (nbt == null || view == null) return; + + List keys = new ArrayList<>(nbt.getKeys()); + for (String key : keys) { + NbtElement value = nbt.get(key); + if (value == null) continue; + + byte type = value.getType(); + view.putByte("__nbttype_" + key + "__", type); + + switch (type) { + case NbtTypeBytes.BYTE: + Optional optional = value.asByte(); + if (optional.isEmpty()) continue; + view.putByte(key, optional.get()); + break; + case NbtTypeBytes.SHORT: + Optional optionalShort = value.asShort(); + if (optionalShort.isEmpty()) continue; + view.putShort(key, optionalShort.get()); + break; + case NbtTypeBytes.INT: + Optional optionalInt = value.asInt(); + if (optionalInt.isEmpty()) continue; + view.putInt(key, optionalInt.get()); + break; + case NbtTypeBytes.LONG: + Optional optionalLong = value.asLong(); + if (optionalLong.isEmpty()) continue; + view.putLong(key, optionalLong.get()); + break; + case NbtTypeBytes.FLOAT: + Optional optionalFloat = value.asFloat(); + if (optionalFloat.isEmpty()) continue; + view.putFloat(key, optionalFloat.get()); + break; + case NbtTypeBytes.DOUBLE: + Optional optionalDouble = value.asDouble(); + if (optionalDouble.isEmpty()) continue; + view.putDouble(key, optionalDouble.get()); + break; + case NbtTypeBytes.STRING: + Optional optionalString = value.asString(); + if (optionalString.isEmpty()) continue; + view.putString(key, optionalString.get()); + break; + case NbtTypeBytes.BYTE_ARRAY: + Optional optionalByteArray = value.asByteArray(); + if (optionalByteArray.isEmpty()) continue; + byte[] byteArray = optionalByteArray.get(); + int[] intArray = new int[byteArray.length]; + for (int i = 0; i < byteArray.length; i++) + intArray[i] = byteArray[i]; + view.putIntArray(key, intArray); + break; + case NbtTypeBytes.INT_ARRAY: + Optional optionalIntArray = value.asIntArray(); + if (optionalIntArray.isEmpty()) continue; + view.putIntArray(key, optionalIntArray.get()); + break; + case NbtTypeBytes.LONG_ARRAY: + Optional optionalLongArray = value.asLongArray(); + if (optionalLongArray.isEmpty()) continue; + long[] longArray = optionalLongArray.get(); + int[] longIntArray = new int[longArray.length]; + for (int i = 0; i < longArray.length; i++) + longIntArray[i] = (int) (longArray[i] & 0xFFFFFFFFL); + view.putIntArray(key, longIntArray); + break; + case NbtTypeBytes.COMPOUND: + Optional optionalCompound = value.asCompound(); + if (optionalCompound.isEmpty()) continue; + NbtCompound nbt2 = optionalCompound.get(); + + //System.out.println("NbtDataConverter nbt(" + key + "): " + nbt2); + + view.put(key, NbtCompound.CODEC, nbt2); + break; + } + } + + view.putString("__all_keys__", String.join(",", keys)); + } + + public static void data2nbt(ReadView view, NbtCompound nbt) { + if (view == null || nbt == null) return; + + // ReadViewだとgetKeys()がないので__all_keys__からキーを取得する + String keysStr = view.getString("__all_keys__", ""); + if (keysStr.isEmpty()) return; + String[] keys = keysStr.split(","); + for (String key : keys) { + if (key == null || key.isEmpty()) continue; + + byte type = view.getByte("__nbttype_" + key + "__", (byte) -1); + if (type == -1) continue; + + switch (type) { + case NbtTypeBytes.BYTE: + nbt.putByte(key, view.getByte(key, (byte) 0)); + break; + case NbtTypeBytes.SHORT: + nbt.putShort(key, (short) view.getShort(key, (short) 0)); + break; + case NbtTypeBytes.INT: + nbt.putInt(key, view.getInt(key, 0)); + break; + case NbtTypeBytes.LONG: + nbt.putLong(key, view.getLong(key, 0)); + break; + case NbtTypeBytes.FLOAT: + nbt.putFloat(key, view.getFloat(key, 0)); + break; + case NbtTypeBytes.DOUBLE: + nbt.putDouble(key, view.getDouble(key, 0)); + break; + case NbtTypeBytes.STRING: + nbt.putString(key, view.getString(key, "")); + break; + case NbtTypeBytes.BYTE_ARRAY: + int[] intArray = view.getOptionalIntArray(key).get(); + byte[] byteArray = new byte[intArray.length]; + for (int i = 0; i < intArray.length; i++) + byteArray[i] = (byte) intArray[i]; + nbt.putByteArray(key, byteArray); + break; + case NbtTypeBytes.INT_ARRAY: + nbt.putIntArray(key, view.getOptionalIntArray(key).get()); + break; + case NbtTypeBytes.LONG_ARRAY: + int[] longIntArray = view.getOptionalIntArray(key).get(); + long[] longArray = new long[longIntArray.length]; + for (int i = 0; i < longIntArray.length; i++) + longArray[i] = longIntArray[i] & 0xFFFFFFFFL; + nbt.putLongArray(key, longArray); + break; + case NbtTypeBytes.COMPOUND: + NbtCompound nbt2 = view.read(key, NbtCompound.CODEC).get(); + nbt.put(key, nbt2); + break; + default: + nbt.putString(key, "Unsupported NBT type: " + type); + break; + } + } + } + + public static void data2nbt(WriteView view, NbtCompound nbt) { + if (view == null || nbt == null) return; + + if (view instanceof NbtWriteView) { + //System.out.println("data2nbt(): " + ((NbtWriteView) view).getNbt()); + NbtUtil.copyFrom(((NbtWriteView) view).getNbt(), nbt); + } + } + + public static WriteView nbt2writeData(NbtCompound nbt, CompatRegistryLookup registryLookup) { + WriteView view = NbtWriteView.create(ErrorReporter.EMPTY); + nbt2writeData(nbt, view); + return view; + } + + public static ReadView nbt2readData(NbtCompound nbt, CompatRegistryLookup registryLookup) { + if (nbt == null) nbt = NbtUtil.create(); + return NbtReadView.create(ErrorReporter.EMPTY, registryLookup.getRegistryLookup(), nbt); + } + + public static NbtCompound data2nbt(ReadView view) { + NbtCompound nbt = new NbtCompound(); + data2nbt(view, nbt); + return nbt; + } + + public static NbtCompound data2nbt(WriteView view) { + NbtCompound nbt = new NbtCompound(); + data2nbt(view, nbt); + return nbt; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java b/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java new file mode 100644 index 000000000..da8cfdbe5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java @@ -0,0 +1,67 @@ +package net.pitan76.mcpitanlib.core.network; + +import io.netty.buffer.ByteBufUtil; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.codec.PacketCodec; +import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.network.packet.CustomPayload; +import net.minecraft.resources.Identifier; + +import java.util.HashMap; +import java.util.Map; + +public class BufPayload implements CustomPayload { + + public final Id ID; + + public BufPayload(byte[] data, Id id) { + this.data = data; + this.ID = id; + + createCodec(id); + } + + public BufPayload(PacketByteBuf buf, Id id) { + this(ByteBufUtil.getBytes(buf), id); + } + + public BufPayload(PacketByteBuf buf, Identifier id) { + this(ByteBufUtil.getBytes(buf), id(id)); + } + + public byte[] data; + + public byte[] getData() { + return data; + } + + private static final Map, PacketCodec> CODEC_CACHE = new HashMap<>(); + + public static PacketCodec getCodec(Id id) { + if (CODEC_CACHE.containsKey(id)) return CODEC_CACHE.get(id); + + return createCodec(id); + } + + private static PacketCodec createCodec(Id id) { + PacketCodec codec = PacketCodecs.BYTE_ARRAY.xmap((data) -> new BufPayload(data, id), BufPayload::getData).cast(); + CODEC_CACHE.put(id, codec); + return codec; + } + + @Override + public Id getId() { + return ID; + } + + public static Id id(Identifier id) { + if (CODEC_CACHE.isEmpty()) return new Id<>(id); + + for (Id key : CODEC_CACHE.keySet()) { + if (key.id().equals(id)) + return key; + } + + return new Id<>(id); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java b/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java new file mode 100644 index 000000000..00902072b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.core.player; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.entity.Player; + +public class ItemCooldown { + public final Player player; + + public ItemCooldown(Player player) { + this.player = player; + } + + public boolean isCoolingDown(Item item) { + for (ItemStack stack : player.getMain()) { + if (stack.getItem() == item) { + return player.getItemCooldownManager().isCoolingDown(stack); + } + } + + return false; + } + + public void set(Item item, int duration) { + for (ItemStack stack : player.getMain()) { + if (stack.getItem() == item) { + player.getItemCooldownManager().set(stack, duration); + } + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java new file mode 100644 index 000000000..c3a3fade1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.core.registry; + +import net.minecraft.item.ItemConvertible; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class FuelRegistry { + private FuelRegistry() { + + } + + public static void register(int time, ItemConvertible... item) { + dev.architectury.registry.fuel.FuelRegistry.register(time, item); + } + + @Deprecated + public static int get(ItemStack stack) { + return 0; + } + + public static int get(World world, ItemStack stack) { + return world.getFuelRegistry().getFuelTicks(stack); + } + + public static boolean isFuel(World world, ItemStack stack) { + return world.getFuelRegistry().isFuel(stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java new file mode 100644 index 000000000..8d7214af0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java @@ -0,0 +1,95 @@ +package net.pitan76.mcpitanlib.core.registry; + +import com.google.common.base.Suppliers; +import dev.architectury.registry.registries.Registrar; +import dev.architectury.registry.registries.RegistrarManager; +import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.fluid.Fluid; +import net.minecraft.item.Item; +import net.minecraft.particle.ParticleType; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.sound.SoundEvent; +import net.minecraft.resources.Identifier; + +import java.util.function.Supplier; + +@Deprecated +public class MCPLRegistry { + + public Supplier REGISTRIES; + + public Registrar ITEMS; + public Registrar BLOCKS; + public Registrar> SCREEN_HANDLER_TYPE; + public Registrar> BLOCK_ENTITY_TYPE; + public Registrar> ENTITY_TYPE; + public Registrar SOUND_EVENT; + public Registrar FLUID; + public Registrar> PARTICLE_TYPE; + public Registrar STATUS_EFFECT; + + public MCPLRegistry(String MOD_ID) { + REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(MOD_ID)); + + ITEMS = REGISTRIES.get().get(RegistryKeys.ITEM); + BLOCKS = REGISTRIES.get().get(RegistryKeys.BLOCK); + SCREEN_HANDLER_TYPE = REGISTRIES.get().get(RegistryKeys.SCREEN_HANDLER); + BLOCK_ENTITY_TYPE = REGISTRIES.get().get(RegistryKeys.BLOCK_ENTITY_TYPE); + ENTITY_TYPE = REGISTRIES.get().get(RegistryKeys.ENTITY_TYPE); + SOUND_EVENT = REGISTRIES.get().get(RegistryKeys.SOUND_EVENT); + FLUID = REGISTRIES.get().get(RegistryKeys.FLUID); + PARTICLE_TYPE = REGISTRIES.get().get(RegistryKeys.PARTICLE_TYPE); + STATUS_EFFECT = REGISTRIES.get().get(RegistryKeys.STATUS_EFFECT); + } + + public RegistrySupplier registryItem(Identifier id, Supplier supplier) { + return ITEMS.register(id, supplier); + } + + public RegistrySupplier registryBlock(Identifier id, Supplier supplier) { + return BLOCKS.register(id, supplier); + } + + public RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { + return SCREEN_HANDLER_TYPE.register(id, supplier); + } + + public RegistrySupplier> registryBlockEntityType(Identifier id, Supplier> supplier) { + return BLOCK_ENTITY_TYPE.register(id, supplier); + } + + public RegistrySupplier> registryEntityType(Identifier id, Supplier> supplier) { + return ENTITY_TYPE.register(id, supplier); + } + + public RegistrySupplier registrySoundEvent(Identifier id, Supplier supplier) { + return SOUND_EVENT.register(id, supplier); + } + + public RegistrySupplier registryFluid(Identifier id, Supplier supplier) { + return FLUID.register(id, supplier); + } + + public RegistrySupplier> registryParticleType(Identifier id, Supplier> supplier) { + return PARTICLE_TYPE.register(id, supplier); + } + + public RegistrySupplier registryEnchantment(Identifier id, Supplier supplier) { + return null; + //return ENCHANTMENT.register(id, supplier); + } + + public RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { + return STATUS_EFFECT.register(id, supplier); + } + + public void allRegister1_16() { + + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java new file mode 100644 index 000000000..c40c48718 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java @@ -0,0 +1,43 @@ +package net.pitan76.mcpitanlib.core.registry; + +import dev.architectury.registry.registries.DeferredRegister; +import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.item.ItemGroup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +@Deprecated +public class MCPLRegistry1_20 { + @Deprecated + public static final Map> REGISTRY_SUPPLIER_ITEM_GROUP_CACHE = new HashMap<>(); + + private final MCPLRegistry mcplr; + + protected DeferredRegister ITEM_GROUP; + + public MCPLRegistry1_20(MCPLRegistry mcplr, String MOD_ID) { + this.mcplr = mcplr; + ITEM_GROUP = DeferredRegister.create(MOD_ID, RegistryKeys.ITEM_GROUP); + } + + public void register() { + ITEM_GROUP.register(); + } + + public RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { + RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); + REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); + return itemGroup; + } + + public RegistrySupplier registryItemGroup(Identifier id, CreativeTabBuilder builder) { + RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); + REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); + return itemGroup; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java new file mode 100644 index 000000000..e642dc485 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.core.registry; + +import dev.architectury.registry.registries.DeferredRegister; +import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.component.ComponentType; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; + +import java.util.function.Supplier; + +@Deprecated +public class MCPLRegistry1_21 { + + public final DeferredRegister> DATA_COMPONENT_TYPE; + public final DeferredRegister TICKET_TYPE; + + private final MCPLRegistry mcplr; + + public MCPLRegistry1_21(MCPLRegistry mcplr, String MOD_ID) { + this.mcplr = mcplr; + DATA_COMPONENT_TYPE = DeferredRegister.create(MOD_ID, RegistryKeys.DATA_COMPONENT_TYPE); + TICKET_TYPE = DeferredRegister.create(MOD_ID, RegistryKeys.TICKET_TYPE); + } + + public void register() { + DATA_COMPONENT_TYPE.register(); + TICKET_TYPE.register(); + } + + public RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { + return DATA_COMPONENT_TYPE.register(id, supplier); + } + + public Supplier> registryChunkTicketType(Identifier id, Supplier> supplier) { + RegistrySupplier ticketType = TICKET_TYPE.register(id, () -> supplier.get().getRaw()); + return () -> ChunkTicketType.of(ticketType.get()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java b/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java new file mode 100644 index 000000000..a5a70af11 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java @@ -0,0 +1,76 @@ +package net.pitan76.mcpitanlib.core.serialization; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.pitan76.mcpitanlib.api.block.CompatStairsBlock; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.core.serialization.codecs.CompatBlockMapCodecUtil; + +import java.util.function.BiFunction; +import java.util.function.Function; + +public class CompatMapCodec { + @Deprecated + public MapCodec codec; + + @Deprecated + public CompatMapCodec(MapCodec codec) { + this.codec = codec; + } + + @Deprecated + public static CompatMapCodec of(MapCodec codec) { + return new CompatMapCodec<>(codec); + } + + public CompatMapCodec() { + + } + + public static CompatMapCodec of() { + return new CompatMapCodec<>(); + } + + @Deprecated + public MapCodec getCodec() { + return codec; + } + + public static RecordCodecBuilder createSettingsCodec() { + return AbstractBlock.Settings.CODEC.fieldOf("properties").forGetter(AbstractBlock::getSettings); + } + + public static CompatMapCodec createCodec(Function blockFromSettings) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group(createSettingsCodec()).apply(instance, blockFromSettings))); + } + + @Deprecated + public static RecordCodecBuilder createCompatSettingsCodec() { + return net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(ExtendBlock::getCompatSettings); + } + + @Deprecated + public static CompatMapCodec createCodecOfExtendBlock(Function blockFromSettings) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group(createCompatSettingsCodec()).apply(instance, blockFromSettings))); + } + + public static RecordCodecBuilder createCompatSettingsV2Codec() { + return CompatBlockMapCodecUtil.createSettingsCodec(); + } + + public static CompatMapCodec createCodecOfCompatBlock(Function blockFromSettings) { + return CompatBlockMapCodecUtil.createCodec(blockFromSettings); + } + + public static CompatMapCodec createCodecOfCompatStairsBlock(BiFunction createFunction) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( + BlockState.CODEC.fieldOf("base_state").forGetter(CompatStairsBlock::getBaseBlockState), + net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatStairsBlock::getCompatSettings) + ).apply(instance, createFunction))); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java b/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java new file mode 100644 index 000000000..12d5880b6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.core.serialization.codecs; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.pitan76.mcpitanlib.api.block.CompatChestBlock; +import net.pitan76.mcpitanlib.api.block.CompatPillarBlock; +import net.pitan76.mcpitanlib.api.block.CompatSlabBlock; +import net.pitan76.mcpitanlib.api.block.CompatStairsBlock; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; + +import java.util.function.BiFunction; +import java.util.function.Function; + +public class CompatBlockMapCodecUtil { + + @Deprecated + protected static CompatMapCodec of(MapCodec codec) { + return new CompatMapCodec<>(codec); + } + + public static RecordCodecBuilder createSettingsCodec() { + return CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatBlock::getCompatSettings); + } + + public static CompatMapCodec createCodec(Function blockFromSettings) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group(createSettingsCodec()).apply(instance, blockFromSettings))); + } + + public static CompatMapCodec createCodecOfStairsBlock(BiFunction createFunction) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( + BlockState.CODEC.fieldOf("base_state").forGetter(CompatStairsBlock::getBaseBlockState), + CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatStairsBlock::getCompatSettings) + ).apply(instance, createFunction))); + } + + public static CompatMapCodec createCodecOfSlabBlock(Function createFunction) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( + CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatSlabBlock::getCompatSettings) + ).apply(instance, createFunction))); + } + + public static CompatMapCodec createCodecOfPillarBlock(Function createFunction) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( + CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatPillarBlock::getCompatSettings) + ).apply(instance, createFunction))); + } + + public static CompatMapCodec createCodecOfChestBlock(Function createFunction) { + return of(RecordCodecBuilder.mapCodec((instance) -> instance.group( + CompatibleBlockSettings.CODEC.fieldOf("properties").forGetter(CompatChestBlock::getCompatSettings) + ).apply(instance, createFunction))); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java b/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java new file mode 100644 index 000000000..55e1cffd3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.debug; + +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; + +import static net.pitan76.mcpitanlib.MCPitanLib.*; + +/** + * A tool for debugging. + * Example of condition: item instance DebugTool + */ +public class DebugTool extends CompatItem { + + public static CompatibleItemSettings defaultSettings = CompatibleItemSettings.of(compatId("debug_tool")); + + public DebugTool() { + super(defaultSettings); + } + + public static void debug(String message) { + System.out.println(message); + } + + public static void register() { + registry.registerItem(id("debug_tool"), DebugTool::new); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java new file mode 100644 index 000000000..c928bb1f1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.guilib; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; +import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; +import net.pitan76.mcpitanlib.guilib.api.screen.SimpleContainerGuiScreen; + +import java.util.function.Supplier; + +public class GuiRegistry { + public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder.Factory factory) { + return register(registry, id, new SimpleScreenHandlerTypeBuilder<>(factory)); + } + + public static Supplier> register(CompatRegistryV2 registry, CompatIdentifier id, ScreenHandlerType type) { + return registry.registerScreenHandlerTypeSavingGenerics(id, () -> type); + } + + @Environment(EnvType.CLIENT) + public static > void register(String id, ScreenHandlerType type, CompatRegistryClient.ScreenFactory factory) { + CompatRegistryClient.registerScreen(id, type, factory); + } + + @Environment(EnvType.CLIENT) + public static void registerSimpleContainerGui(String id, ScreenHandlerType type) { + CompatRegistryClient.registerScreen(id, type, SimpleContainerGuiScreen::new); + } + + public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { + return registry.registerScreenHandlerType(id, builder); + } + + public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { + return registry.registerScreenHandlerType(id, builder); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java new file mode 100644 index 000000000..fad6d9331 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java @@ -0,0 +1,9 @@ +package net.pitan76.mcpitanlib.guilib; + +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class GuiTextures { + public static CompatIdentifier GUI_PARTS = CompatIdentifier.of("mplguilib", "textures/container/gui_parts.png"); + public static CompatIdentifier BASE_FURNACE_BACKGROUND = CompatIdentifier.of("mplguilib", "textures/container/base_furnace.png"); + public static CompatIdentifier BASE_BACKGROUND = CompatIdentifier.of("mplguilib", "textures/container/base.png"); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java b/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java new file mode 100644 index 000000000..4d9bc3bad --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java @@ -0,0 +1,23 @@ +package net.pitan76.mcpitanlib.guilib; + +import net.pitan76.mcpitanlib.api.network.v2.ClientNetworking; +import net.pitan76.mcpitanlib.guilib.api.container.ExtendedBlockEntityContainerGui; + +import static net.pitan76.mcpitanlib.guilib.api.NetworkDefines.SYNC_GUI_WITH_TILE; + +public class MGLClientNetworks { + + public static boolean isInitialized = false; + + public static void init() { + if (isInitialized) return; + isInitialized = true; + + ClientNetworking.registerReceiver(SYNC_GUI_WITH_TILE, (e) -> { + if (e.player.getCurrentScreenHandler() instanceof ExtendedBlockEntityContainerGui) { + ExtendedBlockEntityContainerGui gui = (ExtendedBlockEntityContainerGui) e.player.getCurrentScreenHandler(); + gui.receiveSync(e.buf); + } + }); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java b/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java new file mode 100644 index 000000000..f3122c706 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.guilib; + +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.PlatformUtil; + +public class MPLGuiLib { + public static final String MOD_ID = "mplguilib"; + public static final String MOD_NAME = "MPL GuiLib"; + + public static void init() { + if (PlatformUtil.isClient()) + MGLClientNetworks.init(); + } + + // ---- + /** + * @param path The path of the id + * @return The id + */ + public static CompatIdentifier _id(String path) { + return CompatIdentifier.of(MOD_ID, path); + } + + public String getId() { + return MOD_ID; + } + + public String getName() { + return MOD_NAME; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java new file mode 100644 index 000000000..2e002e555 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.guilib.api; + +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.guilib.GuiTextures; + +public interface IScreenInfo { + default int getScreenBackgroundWidth() { + return getScreenWidth(); + } + + default int getScreenBackgroundHeight() { + return getScreenHeight(); + } + + int getScreenWidth(); + + int getScreenHeight(); + + default int getScreenX() { + return -1; + } + + default int getScreenY() { + return -1; + } + + default int getScreenTitleX() { + return -1; + } + + default int getScreenTitleY() { + return -1; + } + + default CompatIdentifier getTexture() { + return GuiTextures.BASE_BACKGROUND; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java new file mode 100644 index 000000000..8ff931938 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.guilib.api; + +public interface ISimpleScreenInfo extends IScreenInfo { + + @Override + default int getScreenWidth() { + return 176; + } + + @Override + default int getScreenHeight() { + return 166; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java new file mode 100644 index 000000000..c0631c9ec --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java @@ -0,0 +1,8 @@ +package net.pitan76.mcpitanlib.guilib.api; + +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.guilib.MPLGuiLib; + +public class NetworkDefines { + public static CompatIdentifier SYNC_GUI_WITH_TILE = MPLGuiLib._id("sync_gui_with_tile"); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java new file mode 100644 index 000000000..f6e88a29e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.guilib.api.block.entity; + +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; +import net.pitan76.mcpitanlib.api.gui.inventory.sided.ChestStyleSidedInventory; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.api.util.InventoryUtil; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; + +public abstract class BlockEntityWithContainer extends CompatBlockEntity implements IInventory, ChestStyleSidedInventory { + + private final ItemStackList inventory = ItemStackList.ofSize(getDefaultInvSize(), ItemStackUtil.empty()); + + public BlockEntityWithContainer(BlockEntityType type, TileCreateEvent e) { + super(type, e); + } + + public abstract int getDefaultInvSize(); + + @Override + public void writeNbt(WriteNbtArgs args) { + super.writeNbt(args); + InventoryUtil.writeNbt(args, inventory); + } + + @Override + public void readNbt(ReadNbtArgs args) { + super.readNbt(args); + InventoryUtil.readNbt(args, inventory); + } + + @Override + public ItemStackList getItems() { + return inventory; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java new file mode 100644 index 000000000..dfa884739 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java @@ -0,0 +1,59 @@ +package net.pitan76.mcpitanlib.guilib.api.block.entity; + +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.event.container.factory.ExtraDataArgs; +import net.pitan76.mcpitanlib.api.event.tile.TileTickEvent; +import net.pitan76.mcpitanlib.api.gui.v2.ExtendedScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.api.network.v2.ServerNetworking; +import net.pitan76.mcpitanlib.api.tile.ExtendBlockEntityTicker; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.guilib.api.container.ExtendedBlockEntityContainerGui; + +import java.util.List; +import java.util.Objects; + +import static net.pitan76.mcpitanlib.guilib.api.NetworkDefines.SYNC_GUI_WITH_TILE; + +public abstract class ExtendedBlockEntityWithContainer extends BlockEntityWithContainer implements ExtendedScreenHandlerFactory, ExtendBlockEntityTicker { + + public ExtendedBlockEntityWithContainer(BlockEntityType type, TileCreateEvent e) { + super(type, e); + } + + @Override + public void tick(TileTickEvent e) { + if (isClient()) return; + + List players = WorldUtil.getPlayers(Objects.requireNonNull(getWorld())); + for (Player player : players) { + if (player.hasNetworkHandler() && player.getCurrentScreenHandler() instanceof ExtendedBlockEntityContainerGui && ((ExtendedBlockEntityContainerGui) player.getCurrentScreenHandler()).blockEntity == this ) { + PacketByteBuf buf = PacketByteUtil.create(); + sync(player, buf); + ServerNetworking.send(player, SYNC_GUI_WITH_TILE, buf); + } + } + } + + @Override + public Text getDisplayName(DisplayNameArgs args) { + if (getCachedState() == null) + return TextUtil.of("unknown"); + + return getCachedState().getBlock().getName(); + } + + @Override + public void writeExtraData(ExtraDataArgs args) { + PacketByteUtil.writeBlockPos(args.buf, getPos()); + sync(args.getCompatPlayer(), args.buf); + } + + public abstract void sync(Player player, PacketByteBuf buf); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java new file mode 100644 index 000000000..54445322c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java @@ -0,0 +1,11 @@ +package net.pitan76.mcpitanlib.guilib.api.container; + +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; + +public abstract class BlockEntityContainerGui extends ContainerGui implements ISimpleScreenInfo { + protected BlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + super(type, e); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java new file mode 100644 index 000000000..04dcc52b3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java @@ -0,0 +1,66 @@ +package net.pitan76.mcpitanlib.guilib.api.container; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.Inventory; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.screen.slot.Slot; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.guilib.api.IScreenInfo; + +import java.util.ArrayList; +import java.util.List; + +public abstract class ContainerGui extends SimpleScreenHandler implements IScreenInfo { + + private final List INVENTORIES = new ArrayList<>(); + + protected ContainerGui(ScreenHandlerType type, int syncId) { + super(type, syncId); + } + + protected ContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + super(type, e); + } + + @Override + public boolean canUse(Player player) { + return true; + } + + @Override + protected Slot addSlot(Slot slot) { + if (slot.inventory instanceof Inventory && !INVENTORIES.contains(slot.inventory)) + INVENTORIES.add(slot.inventory); + + return super.addSlot(slot); + } + + public int playerMainInventoryX = 8; + public int playerMainInventoryY = 84; + + public int playerHotbarX = 8; + public int playerHotbarY = 142; + + @Override + protected List addPlayerMainInventorySlots(PlayerInventory inventory, int x, int y) { + playerMainInventoryX = x; + playerMainInventoryY = y; + + return super.addPlayerMainInventorySlots(inventory, x, y); + } + + @Override + protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int y) { + playerHotbarX = x; + playerHotbarY = y; + + return super.addPlayerHotbarSlots(inventory, x, y); + } + + @Override + public void close(Player player) { + INVENTORIES.forEach((inv -> inv.onClose(player.getEntity()))); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java new file mode 100644 index 000000000..496c046c6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.guilib.api.container; + +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.network.PacketByteBuf; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; + +public abstract class ExtendedBlockEntityContainerGui extends BlockEntityContainerGui implements ISimpleScreenInfo { + + public T blockEntity; + + public ExtendedBlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e, PacketByteBuf buf) { + this(type, e); + + if (buf == null) return; + + Player player = e.getPlayer(); + World world = player.getWorld(); + BlockPos pos = buf.readBlockPos(); + + BlockEntity blockEntity = WorldUtil.getBlockEntity(world, pos); + if (blockEntity instanceof CompatBlockEntity) + this.blockEntity = (T) blockEntity; + + receiveSync(buf); + } + + protected ExtendedBlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + super(type, e); + } + + public abstract void receiveSync(PacketByteBuf buf); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java new file mode 100644 index 000000000..46e5fb903 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.guilib.api.container; + +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; + +public abstract class SimpleContainerGui extends ContainerGui implements ISimpleScreenInfo { + + protected SimpleContainerGui(ScreenHandlerType type, int syncId) { + super(type, syncId); + } + + protected SimpleContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + super(type, e); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java new file mode 100644 index 000000000..facc1262a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java @@ -0,0 +1,72 @@ +package net.pitan76.mcpitanlib.guilib.api.render; + +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.client.RenderUtil.RendererUtil; +import net.pitan76.mcpitanlib.guilib.GuiTextures; + +public class PartsRenderer { + public static void drawBottom2TopProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { + RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); + + if (percentage > 0) { + int progress = (int) ((double) percentage / 100 * height); + RendererUtil.drawTexture(drawObjectDM, texture, x, y + height - progress, u2, v2 + height - progress, width, progress); + } + } + + public static void drawBottom2TopProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { + int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; + drawBottom2TopProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); + } + + public static void drawTop2BottomProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { + RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); + + if (percentage > 0) { + int progress = (int) ((double) percentage / 100 * height); + RendererUtil.drawTexture(drawObjectDM, texture, x, y, u2, v2, width, progress); + } + } + + public static void drawTop2BottomProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { + int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; + drawTop2BottomProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); + } + + public static void drawLeft2RightProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { + RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); + + if (percentage > 0) { + int progress = (int) ((double) percentage / 100 * width); + RendererUtil.drawTexture(drawObjectDM, texture, x, y, u2, v2, progress, height); + } + } + + public static void drawLeft2RightProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { + int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; + drawLeft2RightProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); + } + + public static void drawRight2LeftProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u, int v, int u2, int v2, int width, int height, int percentage, CompatIdentifier texture) { + RendererUtil.drawTexture(drawObjectDM, texture, x, y, u, v, width, height); + + if (percentage > 0) { + int progress = (int) ((double) percentage / 100 * width); + RendererUtil.drawTexture(drawObjectDM, texture, x + width - progress, y, u2 + width - progress, v2, progress, height); + } + } + + public static void drawRight2LeftProgressBar(DrawObjectDM drawObjectDM, int x, int y, int u1, int v1, int u2, int v2, int width, int height, double value, double maxValue, CompatIdentifier texture) { + int percentage = (maxValue != 0) ? (int) (value / maxValue * 100) : 0; + drawRight2LeftProgressBar(drawObjectDM, x, y, u1, v1, u2, v2, width, height, percentage, texture); + } + + public static void drawBurningBar(DrawObjectDM drawObjectDM, int x, int y, int burnTime, int maxBurnTime) { + drawBottom2TopProgressBar(drawObjectDM, x, y, 0, 168, 0, 184, 16, 14, burnTime, maxBurnTime, GuiTextures.BASE_FURNACE_BACKGROUND); + } + + public static void drawHorizontalArrowBar(DrawObjectDM drawObjectDM, int x, int y, double value, double maxValue) { + drawLeft2RightProgressBar(drawObjectDM, x, y, 0, 168, 16, 184, 24, 16, value, maxValue, GuiTextures.BASE_FURNACE_BACKGROUND); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java new file mode 100644 index 000000000..0c23c9e94 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.guilib.api.render; + +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.Slot; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; +import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; +import net.pitan76.mcpitanlib.guilib.GuiTextures; + +public class SlotRenderer { + + public static void drawSlot(DrawObjectDM drawObjectDM, Slot slot, int x, int y) { + RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x + slot.x - 1, y + slot.y - 1, 0, 0, 18, 18); + } + + public static void drawSlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { + ScreenHandlerUtil.getSlots(handler).forEach((slot) -> drawSlot(drawObjectDM, slot, x, y)); + } + + public static void drawPlayerMainInventorySlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { + RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x, y, 0, 32, 162, 54); + } + + public static void drawPlayerHotbarSlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { + RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x, y, 0, 90, 162, 18); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java new file mode 100644 index 000000000..70b6158eb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java @@ -0,0 +1,86 @@ +package net.pitan76.mcpitanlib.guilib.api.screen; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; +import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; +import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawForegroundArgs; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; +import net.pitan76.mcpitanlib.guilib.GuiTextures; +import net.pitan76.mcpitanlib.guilib.api.container.ContainerGui; +import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; + +public class ContainerGuiScreen extends CompatInventoryScreen { + public ContainerGuiScreen(T handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + setBackgroundWidth(handler.getScreenBackgroundWidth()); + setBackgroundHeight(handler.getScreenBackgroundHeight()); + + if (handler.getScreenX() != -1) + setX(handler.getScreenX()); + if (handler.getScreenY() != -1) + setY(handler.getScreenY()); + + if (handler.getScreenTitleX() != -1) + setTitleX(handler.getScreenTitleX()); + if (handler.getScreenTitleY() != -1) + setTitleY(handler.getScreenTitleY()); + } + + @Override + public void initOverride() { + super.initOverride(); + } + + @Override + public void drawBackgroundOverride(DrawBackgroundArgs args) { + super.drawBackgroundOverride(args); + + if (handler.hasMainInventory && !containPlayerInventoryInBackground()) + drawPlayerMainInventorySlots(args.drawObjectDM); + + if (handler.hasHotbar && !containPlayerInventoryInBackground()) + drawPlayerHotbarSlots(args.drawObjectDM); + + drawSlots(args.drawObjectDM); + } + + @Override + protected void drawForegroundOverride(DrawForegroundArgs args) { + if (!handler.hasMainInventory && !containPlayerInventoryInBackground()) { + drawText(args.drawObjectDM, title, titleX, titleY); + return; + } + + super.drawForegroundOverride(args); + } + + @Override + public CompatIdentifier getCompatTexture() { + return handler.getTexture(); + } + + public void drawPlayerMainInventorySlots(DrawObjectDM drawObjectDM) { + SlotRenderer.drawPlayerMainInventorySlots(drawObjectDM, handler, x + handler.playerMainInventoryX - 1, y + handler.playerMainInventoryY - 1); + } + + public void drawPlayerHotbarSlots(DrawObjectDM drawObjectDM) { + SlotRenderer.drawPlayerHotbarSlots(drawObjectDM, handler, x + handler.playerHotbarX - 1, y + handler.playerHotbarY - 1); + } + + public boolean containPlayerInventoryInBackground() { + return getCompatTexture() == GuiTextures.BASE_FURNACE_BACKGROUND; + } + + @Override + public void drawSlots(DrawObjectDM drawObjectDM) { + ScreenHandlerUtil.getSlots(handler).forEach((slot) -> { + if (slot.inventory instanceof PlayerInventory || containPlayerInventoryInBackground()) + return; + + SlotRenderer.drawSlot(drawObjectDM, slot, x, y); + }); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java new file mode 100644 index 000000000..3ac5ebed4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.guilib.api.screen; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; + +public class SimpleContainerGuiScreen extends ContainerGuiScreen { + public SimpleContainerGuiScreen(SimpleContainerGui handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + } + + @Override + public void initOverride() { + super.initOverride(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java new file mode 100644 index 000000000..f1ce318d4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.guilib.test; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.guilib.api.container.ContainerGui; + +public class TestContainer extends ContainerGui { + public TestContainer(ScreenHandlerType type, int syncId) { + super(type, syncId); + } + + public TestContainer(int i, PlayerInventory inventory) { + this(null, i); + } + + @Override + public int getScreenBackgroundWidth() { + return 176; + } + + @Override + public int getScreenBackgroundHeight() { + return 166; + } + + @Override + public int getScreenWidth() { + return 176; + } + + @Override + public int getScreenHeight() { + return 166; + } + + @Override + public int getScreenX() { + return 0; + } + + @Override + public int getScreenY() { + return 0; + } + + @Override + public int getScreenTitleX() { + return 0; + } + + @Override + public int getScreenTitleY() { + return 0; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java b/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java new file mode 100644 index 000000000..ba5f4535e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java @@ -0,0 +1,160 @@ +package net.pitan76.mcpitanlib.midohra; + +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; +import net.pitan76.mcpitanlib.midohra.nbt.NbtElement; +import net.pitan76.mcpitanlib.midohra.nbt.NbtList; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Direction; +import net.pitan76.mcpitanlib.midohra.world.*; + +import java.util.function.Supplier; + +public class Midohra { + + public static ItemWrapper of(Item item) { + return ItemWrapper.of(item); + } + + public static ItemGroupWrapper of(ItemGroup itemGroup) { + return ItemGroupWrapper.of(itemGroup); + } + public static BlockWrapper of(Block block) { + return BlockWrapper.of(block); + } + + public static SupplierBlockWrapper of(Supplier block) { + return SupplierBlockWrapper.of(block); + } + + public static SupplierBlockWrapper of(RegistryResult block) { + return SupplierBlockWrapper.of(block); + } + + public static BlockEntityWrapper of(BlockEntity blockEntity) { + return BlockEntityWrapper.of(blockEntity); + } + + public static FluidWrapper of(net.minecraft.fluid.Fluid fluid) { + return FluidWrapper.of(fluid); + } + + public static BlockState of(net.minecraft.block.BlockState state) { + return BlockState.of(state); + } + + public static NbtElement of(net.minecraft.nbt.NbtElement nbt) { + return NbtElement.of(nbt); + } + + public static NbtCompound of(net.minecraft.nbt.NbtCompound nbt) { + return NbtCompound.of(nbt); + } + + public static NbtList of(net.minecraft.nbt.NbtList nbt) { + return NbtList.of(nbt); + } + + public static BlockPos of(net.minecraft.util.math.BlockPos pos) { + return BlockPos.of(pos); + } + + public static Direction of(net.minecraft.util.math.Direction direction) { + return Direction.of(direction); + } + + public static World of(net.minecraft.world.World world) { + return World.of(world); + } + + public static WorldView of(net.minecraft.world.WorldView world) { + return WorldView.of(world); + } + + public static WorldAccess of(net.minecraft.world.WorldAccess world) { + return WorldAccess.of(world); + } + + public static BlockView of(net.minecraft.world.BlockView world) { + return BlockView.of(world); + } + + public static IWorldView asWV(net.minecraft.world.WorldView world) { + return of(world); + } + + public static IWorldView asWV(net.minecraft.world.BlockView world) { + return of(world); + } + + public static Item raw(ItemWrapper item) { + return item.get(); + } + + public static ItemGroup raw(ItemGroupWrapper itemGroup) { + return itemGroup.get(); + } + + public static Block raw(BlockWrapper block) { + return block.get(); + } + + public static BlockEntity raw(BlockEntityWrapper blockEntity) { + return blockEntity.get(); + } + + public static net.minecraft.fluid.Fluid raw(FluidWrapper fluid) { + return fluid.get(); + } + + public static net.minecraft.block.BlockState raw(BlockState state) { + return state.toMinecraft(); + } + + public static net.minecraft.nbt.NbtElement raw(NbtElement nbt) { + return nbt.toMinecraft(); + } + + public static net.minecraft.nbt.NbtCompound raw(NbtCompound nbt) { + return nbt.toMinecraft(); + } + + public static net.minecraft.nbt.NbtList raw(NbtList nbt) { + return nbt.toMinecraft(); + } + + public static net.minecraft.util.math.BlockPos raw(BlockPos pos) { + return pos.toMinecraft(); + } + + public static net.minecraft.util.math.Direction raw(Direction direction) { + return direction.toMinecraft(); + } + + public static net.minecraft.world.World raw(World world) { + return world.toMinecraft(); + } + + public static net.minecraft.world.WorldView raw(WorldView world) { + return world.toMinecraft(); + } + + public static net.minecraft.world.WorldAccess raw(WorldAccess world) { + return world.toMinecraft(); + } + + public static net.minecraft.world.BlockView raw(BlockView world) { + return world.toMinecraft(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java b/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java new file mode 100644 index 000000000..d27730312 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java @@ -0,0 +1,13 @@ +package net.pitan76.mcpitanlib.midohra; + +/** + * MidohraAPI + * Experimental API of MCPitanLib + * + * @author Pitan + * @version 0.0.1 + * @since 2024.09.28 + */ +public class MidohraAPI { + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java new file mode 100644 index 000000000..20af1535a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java @@ -0,0 +1,159 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.minecraft.state.property.Property; +import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; +import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; +import net.pitan76.mcpitanlib.api.state.property.IProperty; +import net.pitan76.mcpitanlib.api.util.BlockStateUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class BlockState { + private final net.minecraft.block.BlockState state; + + private BlockWrapper blockWrapper; + + protected BlockState(net.minecraft.block.BlockState state) { + this.state = state; + } + + public static BlockState of(net.minecraft.block.BlockState state) { + return new BlockState(state); + } + + public static BlockState of(net.minecraft.block.Block block) { + if (block == null) + return of((net.minecraft.block.BlockState) null); + + return of(BlockStateUtil.getDefaultState(block)); + } + + public boolean isExist() { + return !isEmpty(); + } + + public boolean isEmpty() { + return toMinecraft() == null; + } + + public boolean isAir() { + return isEmpty() || BlockStateUtil.isAir(toMinecraft()); + } + + public CompatBlockSoundGroup getSoundGroup() { + return BlockStateUtil.getCompatSoundGroup(toMinecraft()); + } + + public BlockWrapper getBlock() { + if (blockWrapper == null) + blockWrapper = BlockWrapper.of(BlockStateUtil.getBlock(toMinecraft())); + + return blockWrapper; + } + + public String getName() { + return getBlock().getName(); + } + + public net.minecraft.block.BlockState toMinecraft() { + return state; + } + + public , V extends T> BlockState with(Property property, V value) { + return of(toMinecraft().with(property, value)); + } + + public , V extends T> BlockState with(IProperty property, V value) { + return with(property.getProperty(), value); + } + + public BlockState with(DirectionProperty property, net.pitan76.mcpitanlib.midohra.util.math.Direction value) { + return of(property.with(toMinecraft(), value.toMinecraft())); + } + + public > BlockState cycle(Property property) { + return of(toMinecraft().cycle(property)); + } + + public > BlockState cycle(IProperty property) { + return cycle(property.getProperty()); + } + + public BlockState cycle(DirectionProperty property) { + return of(property.cycle(toMinecraft())); + } + + public > T get(Property property) { + return toMinecraft().get(property); + } + + public > T get(IProperty property) { + return get(property.getProperty()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.Direction get(DirectionProperty property) { + return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(get(property.getProperty())); + } + + public > boolean contains(Property property) { + return toMinecraft().contains(property); + } + + public > boolean contains(IProperty property) { + return contains(property.getProperty()); + } + + public boolean contains(DirectionProperty property) { + return contains(property.getProperty()); + } + + @Override + public int hashCode() { + return toMinecraft().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + BlockState state = (BlockState) obj; + return toMinecraft().equals(state.toMinecraft()); + } + + public boolean isOpaque() { + return BlockStateUtil.isOpaque(toMinecraft()); + } + + public boolean hasRandomTicks() { + return BlockStateUtil.hasRandomTicks(toMinecraft()); + } + + public boolean canPlaceAt(BlockPos pos, World world) { + return BlockStateUtil.canPlaceAt(this, pos, world); + } + + public int getLuminance() { + return BlockStateUtil.getLuminance(this); + } + + public int getOpacity() { + return BlockStateUtil.getOpacity(this); + } + + public int getComparatorOutput(World world, BlockPos pos) { + return BlockStateUtil.getComparatorOutput(this, world, pos); + } + + public float getHardness(World world, BlockPos pos) { + return BlockStateUtil.getHardness(this.toMinecraft(), world.getRaw(), pos.toRaw()); + } + + public boolean randomTick(ServerWorld world, BlockPos pos) { + if (!hasRandomTicks()) + return false; + + BlockStateUtil.randomTick(this.toMinecraft(), world.getRaw(), pos.toRaw()); + return true; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java new file mode 100644 index 000000000..d54771d9e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -0,0 +1,136 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.block.BlockUtil; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlock; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; + +public class BlockWrapper { + private final net.minecraft.block.Block block; + + protected BlockWrapper() { + this.block = null; + } + + protected BlockWrapper(net.minecraft.block.Block block) { + this.block = block; + } + + public static BlockWrapper of(net.minecraft.block.Block block) { + return new BlockWrapper(block); + } + + public static BlockWrapper of() { + return new BlockWrapper(); + } + + public static BlockWrapper of(CompatIdentifier id) { + if (BlockUtil.isExist(id)) + return of(BlockUtil.fromId(id)); + + return of(); + } + + public static BlockWrapper of(CompatIdentifier id, CompatIdentifier... ids) { + if (of(id).isPresent()) return of(id); + + for (CompatIdentifier id1 : ids) { + if (of(id1).isPresent()) + return of(id1); + } + + return of(); + } + + public boolean isPresent() { + return !isEmpty(); + } + + public boolean isEmpty() { + return get() == null; + } + + @Nullable + public net.minecraft.block.Block get() { + return block; + } + + public net.minecraft.block.Block gerOrDefault(net.minecraft.block.Block defaultItem) { + return isEmpty() ? defaultItem : get(); + } + + public CompatIdentifier getId() { + if (isEmpty()) + return CompatIdentifier.empty(); + + return BlockUtil.toId(get()); + } + + public String getName() { + if (isEmpty()) return ""; + return BlockUtil.getNameAsString(get()); + } + + public String getTranslationKey() { + if (isEmpty()) return ""; + return BlockUtil.getTranslationKey(get()); + } + + public ItemWrapper asItem() { + if (isEmpty()) + return ItemWrapper.of(); + + return ItemWrapper.of(BlockUtil.toItem(get())); + } + + public BlockState getDefaultState() { + return BlockState.of(get()); + } + + public boolean rawEquals(BlockWrapper block) { + return get() == block.get(); + } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + BlockWrapper other = (BlockWrapper) obj; + return rawEquals(other); + } + + public static BlockWrapper of(String id) { + return of(CompatIdentifier.of(id)); + } + + public static BlockWrapper of(String namespace, String path) { + return of(CompatIdentifier.of(namespace, path)); + } + + public static BlockWrapper of(CompatBlock block) { + return of((net.minecraft.block.Block) block); + } + + public Optional toCompatBlock() { + if (get() instanceof CompatBlock) { + return Optional.of((CompatBlock) get()); + } + return Optional.empty(); + } + + public Optional toBuiltBlock() { + if (get() instanceof BuiltBlock) { + return Optional.of((BuiltBlock) get()); + } + return Optional.empty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java new file mode 100644 index 000000000..4841d1b52 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java @@ -0,0 +1,771 @@ +package net.pitan76.mcpitanlib.midohra.block; + +public class Blocks { + public static BlockWrapper AIR = of(net.minecraft.block.Blocks.AIR); + public static BlockWrapper STONE = of(net.minecraft.block.Blocks.STONE); + public static BlockWrapper GRANITE = of(net.minecraft.block.Blocks.GRANITE); + public static BlockWrapper POLISHED_GRANITE = of(net.minecraft.block.Blocks.POLISHED_GRANITE); + public static BlockWrapper DIORITE = of(net.minecraft.block.Blocks.DIORITE); + public static BlockWrapper POLISHED_DIORITE = of(net.minecraft.block.Blocks.POLISHED_DIORITE); + public static BlockWrapper ANDESITE = of(net.minecraft.block.Blocks.ANDESITE); + public static BlockWrapper POLISHED_ANDESITE = of(net.minecraft.block.Blocks.POLISHED_ANDESITE); + public static BlockWrapper GRASS_BLOCK = of(net.minecraft.block.Blocks.GRASS_BLOCK); + public static BlockWrapper DIRT = of(net.minecraft.block.Blocks.DIRT); + public static BlockWrapper COARSE_DIRT = of(net.minecraft.block.Blocks.COARSE_DIRT); + public static BlockWrapper PODZOL = of(net.minecraft.block.Blocks.PODZOL); + public static BlockWrapper COBBLESTONE = of(net.minecraft.block.Blocks.COBBLESTONE); + public static BlockWrapper OAK_PLANKS = of(net.minecraft.block.Blocks.OAK_PLANKS); + public static BlockWrapper SPRUCE_PLANKS = of(net.minecraft.block.Blocks.SPRUCE_PLANKS); + public static BlockWrapper BIRCH_PLANKS = of(net.minecraft.block.Blocks.BIRCH_PLANKS); + public static BlockWrapper JUNGLE_PLANKS = of(net.minecraft.block.Blocks.JUNGLE_PLANKS); + public static BlockWrapper ACACIA_PLANKS = of(net.minecraft.block.Blocks.ACACIA_PLANKS); + public static BlockWrapper DARK_OAK_PLANKS = of(net.minecraft.block.Blocks.DARK_OAK_PLANKS); + public static BlockWrapper OAK_SAPLING = of(net.minecraft.block.Blocks.OAK_SAPLING); + public static BlockWrapper SPRUCE_SAPLING = of(net.minecraft.block.Blocks.SPRUCE_SAPLING); + public static BlockWrapper BIRCH_SAPLING = of(net.minecraft.block.Blocks.BIRCH_SAPLING); + public static BlockWrapper JUNGLE_SAPLING = of(net.minecraft.block.Blocks.JUNGLE_SAPLING); + public static BlockWrapper ACACIA_SAPLING = of(net.minecraft.block.Blocks.ACACIA_SAPLING); + public static BlockWrapper DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.DARK_OAK_SAPLING); + public static BlockWrapper BEDROCK = of(net.minecraft.block.Blocks.BEDROCK); + public static BlockWrapper WATER = of(net.minecraft.block.Blocks.WATER); + public static BlockWrapper LAVA = of(net.minecraft.block.Blocks.LAVA); + public static BlockWrapper SAND = of(net.minecraft.block.Blocks.SAND); + public static BlockWrapper RED_SAND = of(net.minecraft.block.Blocks.RED_SAND); + public static BlockWrapper GRAVEL = of(net.minecraft.block.Blocks.GRAVEL); + public static BlockWrapper GOLD_ORE = of(net.minecraft.block.Blocks.GOLD_ORE); + public static BlockWrapper IRON_ORE = of(net.minecraft.block.Blocks.IRON_ORE); + public static BlockWrapper COAL_ORE = of(net.minecraft.block.Blocks.COAL_ORE); + public static BlockWrapper NETHER_GOLD_ORE = of(net.minecraft.block.Blocks.NETHER_GOLD_ORE); + public static BlockWrapper OAK_LOG = of(net.minecraft.block.Blocks.OAK_LOG); + public static BlockWrapper SPRUCE_LOG = of(net.minecraft.block.Blocks.SPRUCE_LOG); + public static BlockWrapper BIRCH_LOG = of(net.minecraft.block.Blocks.BIRCH_LOG); + public static BlockWrapper JUNGLE_LOG = of(net.minecraft.block.Blocks.JUNGLE_LOG); + public static BlockWrapper ACACIA_LOG = of(net.minecraft.block.Blocks.ACACIA_LOG); + public static BlockWrapper DARK_OAK_LOG = of(net.minecraft.block.Blocks.DARK_OAK_LOG); + public static BlockWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_LOG); + public static BlockWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_LOG); + public static BlockWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_LOG); + public static BlockWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_LOG); + public static BlockWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_LOG); + public static BlockWrapper STRIPPED_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_OAK_LOG); + public static BlockWrapper OAK_WOOD = of(net.minecraft.block.Blocks.OAK_WOOD); + public static BlockWrapper SPRUCE_WOOD = of(net.minecraft.block.Blocks.SPRUCE_WOOD); + public static BlockWrapper BIRCH_WOOD = of(net.minecraft.block.Blocks.BIRCH_WOOD); + public static BlockWrapper JUNGLE_WOOD = of(net.minecraft.block.Blocks.JUNGLE_WOOD); + public static BlockWrapper ACACIA_WOOD = of(net.minecraft.block.Blocks.ACACIA_WOOD); + public static BlockWrapper DARK_OAK_WOOD = of(net.minecraft.block.Blocks.DARK_OAK_WOOD); + public static BlockWrapper STRIPPED_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_OAK_WOOD); + public static BlockWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_WOOD); + public static BlockWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_WOOD); + public static BlockWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_WOOD); + public static BlockWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_WOOD); + public static BlockWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_WOOD); + public static BlockWrapper OAK_LEAVES = of(net.minecraft.block.Blocks.OAK_LEAVES); + public static BlockWrapper SPRUCE_LEAVES = of(net.minecraft.block.Blocks.SPRUCE_LEAVES); + public static BlockWrapper BIRCH_LEAVES = of(net.minecraft.block.Blocks.BIRCH_LEAVES); + public static BlockWrapper JUNGLE_LEAVES = of(net.minecraft.block.Blocks.JUNGLE_LEAVES); + public static BlockWrapper ACACIA_LEAVES = of(net.minecraft.block.Blocks.ACACIA_LEAVES); + public static BlockWrapper DARK_OAK_LEAVES = of(net.minecraft.block.Blocks.DARK_OAK_LEAVES); + public static BlockWrapper SPONGE = of(net.minecraft.block.Blocks.SPONGE); + public static BlockWrapper WET_SPONGE = of(net.minecraft.block.Blocks.WET_SPONGE); + public static BlockWrapper GLASS = of(net.minecraft.block.Blocks.GLASS); + public static BlockWrapper LAPIS_ORE = of(net.minecraft.block.Blocks.LAPIS_ORE); + public static BlockWrapper LAPIS_BLOCK = of(net.minecraft.block.Blocks.LAPIS_BLOCK); + public static BlockWrapper DISPENSER = of(net.minecraft.block.Blocks.DISPENSER); + public static BlockWrapper SANDSTONE = of(net.minecraft.block.Blocks.SANDSTONE); + public static BlockWrapper CHISELED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_SANDSTONE); + public static BlockWrapper CUT_SANDSTONE = of(net.minecraft.block.Blocks.CUT_SANDSTONE); + public static BlockWrapper NOTE_BLOCK = of(net.minecraft.block.Blocks.NOTE_BLOCK); + public static BlockWrapper WHITE_BED = of(net.minecraft.block.Blocks.WHITE_BED); + public static BlockWrapper ORANGE_BED = of(net.minecraft.block.Blocks.ORANGE_BED); + public static BlockWrapper MAGENTA_BED = of(net.minecraft.block.Blocks.MAGENTA_BED); + public static BlockWrapper LIGHT_BLUE_BED = of(net.minecraft.block.Blocks.LIGHT_BLUE_BED); + public static BlockWrapper YELLOW_BED = of(net.minecraft.block.Blocks.YELLOW_BED); + public static BlockWrapper LIME_BED = of(net.minecraft.block.Blocks.LIME_BED); + public static BlockWrapper PINK_BED = of(net.minecraft.block.Blocks.PINK_BED); + public static BlockWrapper GRAY_BED = of(net.minecraft.block.Blocks.GRAY_BED); + public static BlockWrapper LIGHT_GRAY_BED = of(net.minecraft.block.Blocks.LIGHT_GRAY_BED); + public static BlockWrapper CYAN_BED = of(net.minecraft.block.Blocks.CYAN_BED); + public static BlockWrapper PURPLE_BED = of(net.minecraft.block.Blocks.PURPLE_BED); + public static BlockWrapper BLUE_BED = of(net.minecraft.block.Blocks.BLUE_BED); + public static BlockWrapper BROWN_BED = of(net.minecraft.block.Blocks.BROWN_BED); + public static BlockWrapper GREEN_BED = of(net.minecraft.block.Blocks.GREEN_BED); + public static BlockWrapper RED_BED = of(net.minecraft.block.Blocks.RED_BED); + public static BlockWrapper BLACK_BED = of(net.minecraft.block.Blocks.BLACK_BED); + public static BlockWrapper POWERED_RAIL = of(net.minecraft.block.Blocks.POWERED_RAIL); + public static BlockWrapper DETECTOR_RAIL = of(net.minecraft.block.Blocks.DETECTOR_RAIL); + public static BlockWrapper STICKY_PISTON = of(net.minecraft.block.Blocks.STICKY_PISTON); + public static BlockWrapper COBWEB = of(net.minecraft.block.Blocks.COBWEB); + public static BlockWrapper GRASS = of(net.minecraft.block.Blocks.SHORT_GRASS); + public static BlockWrapper FERN = of(net.minecraft.block.Blocks.FERN); + public static BlockWrapper DEAD_BUSH = of(net.minecraft.block.Blocks.DEAD_BUSH); + public static BlockWrapper SEAGRASS = of(net.minecraft.block.Blocks.SEAGRASS); + public static BlockWrapper TALL_SEAGRASS = of(net.minecraft.block.Blocks.TALL_SEAGRASS); + public static BlockWrapper PISTON = of(net.minecraft.block.Blocks.PISTON); + public static BlockWrapper PISTON_HEAD = of(net.minecraft.block.Blocks.PISTON_HEAD); + public static BlockWrapper WHITE_WOOL = of(net.minecraft.block.Blocks.WHITE_WOOL); + public static BlockWrapper ORANGE_WOOL = of(net.minecraft.block.Blocks.ORANGE_WOOL); + public static BlockWrapper MAGENTA_WOOL = of(net.minecraft.block.Blocks.MAGENTA_WOOL); + public static BlockWrapper LIGHT_BLUE_WOOL = of(net.minecraft.block.Blocks.LIGHT_BLUE_WOOL); + public static BlockWrapper YELLOW_WOOL = of(net.minecraft.block.Blocks.YELLOW_WOOL); + public static BlockWrapper LIME_WOOL = of(net.minecraft.block.Blocks.LIME_WOOL); + public static BlockWrapper PINK_WOOL = of(net.minecraft.block.Blocks.PINK_WOOL); + public static BlockWrapper GRAY_WOOL = of(net.minecraft.block.Blocks.GRAY_WOOL); + public static BlockWrapper LIGHT_GRAY_WOOL = of(net.minecraft.block.Blocks.LIGHT_GRAY_WOOL); + public static BlockWrapper CYAN_WOOL = of(net.minecraft.block.Blocks.CYAN_WOOL); + public static BlockWrapper PURPLE_WOOL = of(net.minecraft.block.Blocks.PURPLE_WOOL); + public static BlockWrapper BLUE_WOOL = of(net.minecraft.block.Blocks.BLUE_WOOL); + public static BlockWrapper BROWN_WOOL = of(net.minecraft.block.Blocks.BROWN_WOOL); + public static BlockWrapper GREEN_WOOL = of(net.minecraft.block.Blocks.GREEN_WOOL); + public static BlockWrapper RED_WOOL = of(net.minecraft.block.Blocks.RED_WOOL); + public static BlockWrapper BLACK_WOOL = of(net.minecraft.block.Blocks.BLACK_WOOL); + public static BlockWrapper MOVING_PISTON = of(net.minecraft.block.Blocks.MOVING_PISTON); + public static BlockWrapper DANDELION = of(net.minecraft.block.Blocks.DANDELION); + public static BlockWrapper POPPY = of(net.minecraft.block.Blocks.POPPY); + public static BlockWrapper BLUE_ORCHID = of(net.minecraft.block.Blocks.BLUE_ORCHID); + public static BlockWrapper ALLIUM = of(net.minecraft.block.Blocks.ALLIUM); + public static BlockWrapper AZURE_BLUET = of(net.minecraft.block.Blocks.AZURE_BLUET); + public static BlockWrapper RED_TULIP = of(net.minecraft.block.Blocks.RED_TULIP); + public static BlockWrapper ORANGE_TULIP = of(net.minecraft.block.Blocks.ORANGE_TULIP); + public static BlockWrapper WHITE_TULIP = of(net.minecraft.block.Blocks.WHITE_TULIP); + public static BlockWrapper PINK_TULIP = of(net.minecraft.block.Blocks.PINK_TULIP); + public static BlockWrapper OXEYE_DAISY = of(net.minecraft.block.Blocks.OXEYE_DAISY); + public static BlockWrapper CORNFLOWER = of(net.minecraft.block.Blocks.CORNFLOWER); + public static BlockWrapper WITHER_ROSE = of(net.minecraft.block.Blocks.WITHER_ROSE); + public static BlockWrapper LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.LILY_OF_THE_VALLEY); + public static BlockWrapper BROWN_MUSHROOM = of(net.minecraft.block.Blocks.BROWN_MUSHROOM); + public static BlockWrapper RED_MUSHROOM = of(net.minecraft.block.Blocks.RED_MUSHROOM); + public static BlockWrapper GOLD_BLOCK = of(net.minecraft.block.Blocks.GOLD_BLOCK); + public static BlockWrapper IRON_BLOCK = of(net.minecraft.block.Blocks.IRON_BLOCK); + public static BlockWrapper BRICKS = of(net.minecraft.block.Blocks.BRICKS); + public static BlockWrapper TNT = of(net.minecraft.block.Blocks.TNT); + public static BlockWrapper BOOKSHELF = of(net.minecraft.block.Blocks.BOOKSHELF); + public static BlockWrapper MOSSY_COBBLESTONE = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE); + public static BlockWrapper OBSIDIAN = of(net.minecraft.block.Blocks.OBSIDIAN); + public static BlockWrapper TORCH = of(net.minecraft.block.Blocks.TORCH); + public static BlockWrapper WALL_TORCH = of(net.minecraft.block.Blocks.WALL_TORCH); + public static BlockWrapper FIRE = of(net.minecraft.block.Blocks.FIRE); + public static BlockWrapper SOUL_FIRE = of(net.minecraft.block.Blocks.SOUL_FIRE); + public static BlockWrapper SPAWNER = of(net.minecraft.block.Blocks.SPAWNER); + public static BlockWrapper OAK_STAIRS = of(net.minecraft.block.Blocks.OAK_STAIRS); + public static BlockWrapper CHEST = of(net.minecraft.block.Blocks.CHEST); + public static BlockWrapper REDSTONE_WIRE = of(net.minecraft.block.Blocks.REDSTONE_WIRE); + public static BlockWrapper DIAMOND_ORE = of(net.minecraft.block.Blocks.DIAMOND_ORE); + public static BlockWrapper DIAMOND_BLOCK = of(net.minecraft.block.Blocks.DIAMOND_BLOCK); + public static BlockWrapper CRAFTING_TABLE = of(net.minecraft.block.Blocks.CRAFTING_TABLE); + public static BlockWrapper WHEAT = of(net.minecraft.block.Blocks.WHEAT); + public static BlockWrapper FARMLAND = of(net.minecraft.block.Blocks.FARMLAND); + public static BlockWrapper FURNACE = of(net.minecraft.block.Blocks.FURNACE); + public static BlockWrapper OAK_SIGN = of(net.minecraft.block.Blocks.OAK_SIGN); + public static BlockWrapper SPRUCE_SIGN = of(net.minecraft.block.Blocks.SPRUCE_SIGN); + public static BlockWrapper BIRCH_SIGN = of(net.minecraft.block.Blocks.BIRCH_SIGN); + public static BlockWrapper ACACIA_SIGN = of(net.minecraft.block.Blocks.ACACIA_SIGN); + public static BlockWrapper JUNGLE_SIGN = of(net.minecraft.block.Blocks.JUNGLE_SIGN); + public static BlockWrapper DARK_OAK_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_SIGN); + public static BlockWrapper OAK_DOOR = of(net.minecraft.block.Blocks.OAK_DOOR); + public static BlockWrapper LADDER = of(net.minecraft.block.Blocks.LADDER); + public static BlockWrapper RAIL = of(net.minecraft.block.Blocks.RAIL); + public static BlockWrapper COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.COBBLESTONE_STAIRS); + public static BlockWrapper OAK_WALL_SIGN = of(net.minecraft.block.Blocks.OAK_WALL_SIGN); + public static BlockWrapper SPRUCE_WALL_SIGN = of(net.minecraft.block.Blocks.SPRUCE_WALL_SIGN); + public static BlockWrapper BIRCH_WALL_SIGN = of(net.minecraft.block.Blocks.BIRCH_WALL_SIGN); + public static BlockWrapper ACACIA_WALL_SIGN = of(net.minecraft.block.Blocks.ACACIA_WALL_SIGN); + public static BlockWrapper JUNGLE_WALL_SIGN = of(net.minecraft.block.Blocks.JUNGLE_WALL_SIGN); + public static BlockWrapper DARK_OAK_WALL_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_WALL_SIGN); + public static BlockWrapper LEVER = of(net.minecraft.block.Blocks.LEVER); + public static BlockWrapper STONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.STONE_PRESSURE_PLATE); + public static BlockWrapper IRON_DOOR = of(net.minecraft.block.Blocks.IRON_DOOR); + public static BlockWrapper OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.OAK_PRESSURE_PLATE); + public static BlockWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.SPRUCE_PRESSURE_PLATE); + public static BlockWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.block.Blocks.BIRCH_PRESSURE_PLATE); + public static BlockWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.JUNGLE_PRESSURE_PLATE); + public static BlockWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.block.Blocks.ACACIA_PRESSURE_PLATE); + public static BlockWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.DARK_OAK_PRESSURE_PLATE); + public static BlockWrapper REDSTONE_ORE = of(net.minecraft.block.Blocks.REDSTONE_ORE); + public static BlockWrapper REDSTONE_TORCH = of(net.minecraft.block.Blocks.REDSTONE_TORCH); + public static BlockWrapper REDSTONE_WALL_TORCH = of(net.minecraft.block.Blocks.REDSTONE_WALL_TORCH); + public static BlockWrapper STONE_BUTTON = of(net.minecraft.block.Blocks.STONE_BUTTON); + public static BlockWrapper SNOW = of(net.minecraft.block.Blocks.SNOW); + public static BlockWrapper ICE = of(net.minecraft.block.Blocks.ICE); + public static BlockWrapper SNOW_BLOCK = of(net.minecraft.block.Blocks.SNOW_BLOCK); + public static BlockWrapper CACTUS = of(net.minecraft.block.Blocks.CACTUS); + public static BlockWrapper CLAY = of(net.minecraft.block.Blocks.CLAY); + public static BlockWrapper SUGAR_CANE = of(net.minecraft.block.Blocks.SUGAR_CANE); + public static BlockWrapper JUKEBOX = of(net.minecraft.block.Blocks.JUKEBOX); + public static BlockWrapper OAK_FENCE = of(net.minecraft.block.Blocks.OAK_FENCE); + public static BlockWrapper PUMPKIN = of(net.minecraft.block.Blocks.PUMPKIN); + public static BlockWrapper NETHERRACK = of(net.minecraft.block.Blocks.NETHERRACK); + public static BlockWrapper SOUL_SAND = of(net.minecraft.block.Blocks.SOUL_SAND); + public static BlockWrapper SOUL_SOIL = of(net.minecraft.block.Blocks.SOUL_SOIL); + public static BlockWrapper BASALT = of(net.minecraft.block.Blocks.BASALT); + public static BlockWrapper POLISHED_BASALT = of(net.minecraft.block.Blocks.POLISHED_BASALT); + public static BlockWrapper SOUL_TORCH = of(net.minecraft.block.Blocks.SOUL_TORCH); + public static BlockWrapper SOUL_WALL_TORCH = of(net.minecraft.block.Blocks.SOUL_WALL_TORCH); + public static BlockWrapper GLOWSTONE = of(net.minecraft.block.Blocks.GLOWSTONE); + public static BlockWrapper NETHER_PORTAL = of(net.minecraft.block.Blocks.NETHER_PORTAL); + public static BlockWrapper CARVED_PUMPKIN = of(net.minecraft.block.Blocks.CARVED_PUMPKIN); + public static BlockWrapper JACK_O_LANTERN = of(net.minecraft.block.Blocks.JACK_O_LANTERN); + public static BlockWrapper CAKE = of(net.minecraft.block.Blocks.CAKE); + public static BlockWrapper REPEATER = of(net.minecraft.block.Blocks.REPEATER); + public static BlockWrapper WHITE_STAINED_GLASS = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS); + public static BlockWrapper ORANGE_STAINED_GLASS = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS); + public static BlockWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS); + public static BlockWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS); + public static BlockWrapper YELLOW_STAINED_GLASS = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS); + public static BlockWrapper LIME_STAINED_GLASS = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS); + public static BlockWrapper PINK_STAINED_GLASS = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS); + public static BlockWrapper GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS); + public static BlockWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS); + public static BlockWrapper CYAN_STAINED_GLASS = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS); + public static BlockWrapper PURPLE_STAINED_GLASS = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS); + public static BlockWrapper BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS); + public static BlockWrapper BROWN_STAINED_GLASS = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS); + public static BlockWrapper GREEN_STAINED_GLASS = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS); + public static BlockWrapper RED_STAINED_GLASS = of(net.minecraft.block.Blocks.RED_STAINED_GLASS); + public static BlockWrapper BLACK_STAINED_GLASS = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS); + public static BlockWrapper OAK_TRAPDOOR = of(net.minecraft.block.Blocks.OAK_TRAPDOOR); + public static BlockWrapper SPRUCE_TRAPDOOR = of(net.minecraft.block.Blocks.SPRUCE_TRAPDOOR); + public static BlockWrapper BIRCH_TRAPDOOR = of(net.minecraft.block.Blocks.BIRCH_TRAPDOOR); + public static BlockWrapper JUNGLE_TRAPDOOR = of(net.minecraft.block.Blocks.JUNGLE_TRAPDOOR); + public static BlockWrapper ACACIA_TRAPDOOR = of(net.minecraft.block.Blocks.ACACIA_TRAPDOOR); + public static BlockWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.block.Blocks.DARK_OAK_TRAPDOOR); + public static BlockWrapper STONE_BRICKS = of(net.minecraft.block.Blocks.STONE_BRICKS); + public static BlockWrapper MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICKS); + public static BlockWrapper CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_STONE_BRICKS); + public static BlockWrapper CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.CHISELED_STONE_BRICKS); + public static BlockWrapper INFESTED_STONE = of(net.minecraft.block.Blocks.INFESTED_STONE); + public static BlockWrapper INFESTED_COBBLESTONE = of(net.minecraft.block.Blocks.INFESTED_COBBLESTONE); + public static BlockWrapper INFESTED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_STONE_BRICKS); + public static BlockWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_MOSSY_STONE_BRICKS); + public static BlockWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CRACKED_STONE_BRICKS); + public static BlockWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CHISELED_STONE_BRICKS); + public static BlockWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.BROWN_MUSHROOM_BLOCK); + public static BlockWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.RED_MUSHROOM_BLOCK); + public static BlockWrapper MUSHROOM_STEM = of(net.minecraft.block.Blocks.MUSHROOM_STEM); + public static BlockWrapper IRON_BARS = of(net.minecraft.block.Blocks.IRON_BARS); + public static BlockWrapper CHAIN = of(net.minecraft.block.Blocks.IRON_CHAIN); + public static BlockWrapper GLASS_PANE = of(net.minecraft.block.Blocks.GLASS_PANE); + public static BlockWrapper MELON = of(net.minecraft.block.Blocks.MELON); + public static BlockWrapper ATTACHED_PUMPKIN_STEM = of(net.minecraft.block.Blocks.ATTACHED_PUMPKIN_STEM); + public static BlockWrapper ATTACHED_MELON_STEM = of(net.minecraft.block.Blocks.ATTACHED_MELON_STEM); + public static BlockWrapper PUMPKIN_STEM = of(net.minecraft.block.Blocks.PUMPKIN_STEM); + public static BlockWrapper MELON_STEM = of(net.minecraft.block.Blocks.MELON_STEM); + public static BlockWrapper VINE = of(net.minecraft.block.Blocks.VINE); + public static BlockWrapper OAK_FENCE_GATE = of(net.minecraft.block.Blocks.OAK_FENCE_GATE); + public static BlockWrapper BRICK_STAIRS = of(net.minecraft.block.Blocks.BRICK_STAIRS); + public static BlockWrapper STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.STONE_BRICK_STAIRS); + public static BlockWrapper MYCELIUM = of(net.minecraft.block.Blocks.MYCELIUM); + public static BlockWrapper LILY_PAD = of(net.minecraft.block.Blocks.LILY_PAD); + public static BlockWrapper NETHER_BRICKS = of(net.minecraft.block.Blocks.NETHER_BRICKS); + public static BlockWrapper NETHER_BRICK_FENCE = of(net.minecraft.block.Blocks.NETHER_BRICK_FENCE); + public static BlockWrapper NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.NETHER_BRICK_STAIRS); + public static BlockWrapper NETHER_WART = of(net.minecraft.block.Blocks.NETHER_WART); + public static BlockWrapper ENCHANTING_TABLE = of(net.minecraft.block.Blocks.ENCHANTING_TABLE); + public static BlockWrapper BREWING_STAND = of(net.minecraft.block.Blocks.BREWING_STAND); + public static BlockWrapper CAULDRON = of(net.minecraft.block.Blocks.CAULDRON); + public static BlockWrapper END_PORTAL = of(net.minecraft.block.Blocks.END_PORTAL); + public static BlockWrapper END_PORTAL_FRAME = of(net.minecraft.block.Blocks.END_PORTAL_FRAME); + public static BlockWrapper END_STONE = of(net.minecraft.block.Blocks.END_STONE); + public static BlockWrapper DRAGON_EGG = of(net.minecraft.block.Blocks.DRAGON_EGG); + public static BlockWrapper REDSTONE_LAMP = of(net.minecraft.block.Blocks.REDSTONE_LAMP); + public static BlockWrapper COCOA = of(net.minecraft.block.Blocks.COCOA); + public static BlockWrapper SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SANDSTONE_STAIRS); + public static BlockWrapper EMERALD_ORE = of(net.minecraft.block.Blocks.EMERALD_ORE); + public static BlockWrapper ENDER_CHEST = of(net.minecraft.block.Blocks.ENDER_CHEST); + public static BlockWrapper TRIPWIRE_HOOK = of(net.minecraft.block.Blocks.TRIPWIRE_HOOK); + public static BlockWrapper TRIPWIRE = of(net.minecraft.block.Blocks.TRIPWIRE); + public static BlockWrapper EMERALD_BLOCK = of(net.minecraft.block.Blocks.EMERALD_BLOCK); + public static BlockWrapper SPRUCE_STAIRS = of(net.minecraft.block.Blocks.SPRUCE_STAIRS); + public static BlockWrapper BIRCH_STAIRS = of(net.minecraft.block.Blocks.BIRCH_STAIRS); + public static BlockWrapper JUNGLE_STAIRS = of(net.minecraft.block.Blocks.JUNGLE_STAIRS); + public static BlockWrapper COMMAND_BLOCK = of(net.minecraft.block.Blocks.COMMAND_BLOCK); + public static BlockWrapper BEACON = of(net.minecraft.block.Blocks.BEACON); + public static BlockWrapper COBBLESTONE_WALL = of(net.minecraft.block.Blocks.COBBLESTONE_WALL); + public static BlockWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_WALL); + public static BlockWrapper FLOWER_POT = of(net.minecraft.block.Blocks.FLOWER_POT); + public static BlockWrapper POTTED_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_OAK_SAPLING); + public static BlockWrapper POTTED_SPRUCE_SAPLING = of(net.minecraft.block.Blocks.POTTED_SPRUCE_SAPLING); + public static BlockWrapper POTTED_BIRCH_SAPLING = of(net.minecraft.block.Blocks.POTTED_BIRCH_SAPLING); + public static BlockWrapper POTTED_JUNGLE_SAPLING = of(net.minecraft.block.Blocks.POTTED_JUNGLE_SAPLING); + public static BlockWrapper POTTED_ACACIA_SAPLING = of(net.minecraft.block.Blocks.POTTED_ACACIA_SAPLING); + public static BlockWrapper POTTED_DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_DARK_OAK_SAPLING); + public static BlockWrapper POTTED_FERN = of(net.minecraft.block.Blocks.POTTED_FERN); + public static BlockWrapper POTTED_DANDELION = of(net.minecraft.block.Blocks.POTTED_DANDELION); + public static BlockWrapper POTTED_POPPY = of(net.minecraft.block.Blocks.POTTED_POPPY); + public static BlockWrapper POTTED_BLUE_ORCHID = of(net.minecraft.block.Blocks.POTTED_BLUE_ORCHID); + public static BlockWrapper POTTED_ALLIUM = of(net.minecraft.block.Blocks.POTTED_ALLIUM); + public static BlockWrapper POTTED_AZURE_BLUET = of(net.minecraft.block.Blocks.POTTED_AZURE_BLUET); + public static BlockWrapper POTTED_RED_TULIP = of(net.minecraft.block.Blocks.POTTED_RED_TULIP); + public static BlockWrapper POTTED_ORANGE_TULIP = of(net.minecraft.block.Blocks.POTTED_ORANGE_TULIP); + public static BlockWrapper POTTED_WHITE_TULIP = of(net.minecraft.block.Blocks.POTTED_WHITE_TULIP); + public static BlockWrapper POTTED_PINK_TULIP = of(net.minecraft.block.Blocks.POTTED_PINK_TULIP); + public static BlockWrapper POTTED_OXEYE_DAISY = of(net.minecraft.block.Blocks.POTTED_OXEYE_DAISY); + public static BlockWrapper POTTED_CORNFLOWER = of(net.minecraft.block.Blocks.POTTED_CORNFLOWER); + public static BlockWrapper POTTED_LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.POTTED_LILY_OF_THE_VALLEY); + public static BlockWrapper POTTED_WITHER_ROSE = of(net.minecraft.block.Blocks.POTTED_WITHER_ROSE); + public static BlockWrapper POTTED_RED_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_RED_MUSHROOM); + public static BlockWrapper POTTED_BROWN_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_BROWN_MUSHROOM); + public static BlockWrapper POTTED_DEAD_BUSH = of(net.minecraft.block.Blocks.POTTED_DEAD_BUSH); + public static BlockWrapper POTTED_CACTUS = of(net.minecraft.block.Blocks.POTTED_CACTUS); + public static BlockWrapper CARROTS = of(net.minecraft.block.Blocks.CARROTS); + public static BlockWrapper POTATOES = of(net.minecraft.block.Blocks.POTATOES); + public static BlockWrapper OAK_BUTTON = of(net.minecraft.block.Blocks.OAK_BUTTON); + public static BlockWrapper SPRUCE_BUTTON = of(net.minecraft.block.Blocks.SPRUCE_BUTTON); + public static BlockWrapper BIRCH_BUTTON = of(net.minecraft.block.Blocks.BIRCH_BUTTON); + public static BlockWrapper JUNGLE_BUTTON = of(net.minecraft.block.Blocks.JUNGLE_BUTTON); + public static BlockWrapper ACACIA_BUTTON = of(net.minecraft.block.Blocks.ACACIA_BUTTON); + public static BlockWrapper DARK_OAK_BUTTON = of(net.minecraft.block.Blocks.DARK_OAK_BUTTON); + public static BlockWrapper SKELETON_SKULL = of(net.minecraft.block.Blocks.SKELETON_SKULL); + public static BlockWrapper SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.SKELETON_WALL_SKULL); + public static BlockWrapper WITHER_SKELETON_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_SKULL); + public static BlockWrapper WITHER_SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_WALL_SKULL); + public static BlockWrapper ZOMBIE_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_HEAD); + public static BlockWrapper ZOMBIE_WALL_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_WALL_HEAD); + public static BlockWrapper PLAYER_HEAD = of(net.minecraft.block.Blocks.PLAYER_HEAD); + public static BlockWrapper PLAYER_WALL_HEAD = of(net.minecraft.block.Blocks.PLAYER_WALL_HEAD); + public static BlockWrapper CREEPER_HEAD = of(net.minecraft.block.Blocks.CREEPER_HEAD); + public static BlockWrapper CREEPER_WALL_HEAD = of(net.minecraft.block.Blocks.CREEPER_WALL_HEAD); + public static BlockWrapper DRAGON_HEAD = of(net.minecraft.block.Blocks.DRAGON_HEAD); + public static BlockWrapper DRAGON_WALL_HEAD = of(net.minecraft.block.Blocks.DRAGON_WALL_HEAD); + public static BlockWrapper ANVIL = of(net.minecraft.block.Blocks.ANVIL); + public static BlockWrapper CHIPPED_ANVIL = of(net.minecraft.block.Blocks.CHIPPED_ANVIL); + public static BlockWrapper DAMAGED_ANVIL = of(net.minecraft.block.Blocks.DAMAGED_ANVIL); + public static BlockWrapper TRAPPED_CHEST = of(net.minecraft.block.Blocks.TRAPPED_CHEST); + public static BlockWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE); + public static BlockWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE); + public static BlockWrapper COMPARATOR = of(net.minecraft.block.Blocks.COMPARATOR); + public static BlockWrapper DAYLIGHT_DETECTOR = of(net.minecraft.block.Blocks.DAYLIGHT_DETECTOR); + public static BlockWrapper REDSTONE_BLOCK = of(net.minecraft.block.Blocks.REDSTONE_BLOCK); + public static BlockWrapper NETHER_QUARTZ_ORE = of(net.minecraft.block.Blocks.NETHER_QUARTZ_ORE); + public static BlockWrapper HOPPER = of(net.minecraft.block.Blocks.HOPPER); + public static BlockWrapper QUARTZ_BLOCK = of(net.minecraft.block.Blocks.QUARTZ_BLOCK); + public static BlockWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.block.Blocks.CHISELED_QUARTZ_BLOCK); + public static BlockWrapper QUARTZ_PILLAR = of(net.minecraft.block.Blocks.QUARTZ_PILLAR); + public static BlockWrapper QUARTZ_STAIRS = of(net.minecraft.block.Blocks.QUARTZ_STAIRS); + public static BlockWrapper ACTIVATOR_RAIL = of(net.minecraft.block.Blocks.ACTIVATOR_RAIL); + public static BlockWrapper DROPPER = of(net.minecraft.block.Blocks.DROPPER); + public static BlockWrapper WHITE_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_TERRACOTTA); + public static BlockWrapper ORANGE_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_TERRACOTTA); + public static BlockWrapper MAGENTA_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_TERRACOTTA); + public static BlockWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_TERRACOTTA); + public static BlockWrapper YELLOW_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_TERRACOTTA); + public static BlockWrapper LIME_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_TERRACOTTA); + public static BlockWrapper PINK_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_TERRACOTTA); + public static BlockWrapper GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_TERRACOTTA); + public static BlockWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_TERRACOTTA); + public static BlockWrapper CYAN_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_TERRACOTTA); + public static BlockWrapper PURPLE_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_TERRACOTTA); + public static BlockWrapper BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_TERRACOTTA); + public static BlockWrapper BROWN_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_TERRACOTTA); + public static BlockWrapper GREEN_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_TERRACOTTA); + public static BlockWrapper RED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_TERRACOTTA); + public static BlockWrapper BLACK_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_TERRACOTTA); + public static BlockWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS_PANE); + public static BlockWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS_PANE); + public static BlockWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS_PANE); + public static BlockWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS_PANE); + public static BlockWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS_PANE); + public static BlockWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS_PANE); + public static BlockWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS_PANE); + public static BlockWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS_PANE); + public static BlockWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS_PANE); + public static BlockWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS_PANE); + public static BlockWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS_PANE); + public static BlockWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS_PANE); + public static BlockWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS_PANE); + public static BlockWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS_PANE); + public static BlockWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.RED_STAINED_GLASS_PANE); + public static BlockWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS_PANE); + public static BlockWrapper ACACIA_STAIRS = of(net.minecraft.block.Blocks.ACACIA_STAIRS); + public static BlockWrapper DARK_OAK_STAIRS = of(net.minecraft.block.Blocks.DARK_OAK_STAIRS); + public static BlockWrapper SLIME_BLOCK = of(net.minecraft.block.Blocks.SLIME_BLOCK); + public static BlockWrapper BARRIER = of(net.minecraft.block.Blocks.BARRIER); + public static BlockWrapper IRON_TRAPDOOR = of(net.minecraft.block.Blocks.IRON_TRAPDOOR); + public static BlockWrapper PRISMARINE = of(net.minecraft.block.Blocks.PRISMARINE); + public static BlockWrapper PRISMARINE_BRICKS = of(net.minecraft.block.Blocks.PRISMARINE_BRICKS); + public static BlockWrapper DARK_PRISMARINE = of(net.minecraft.block.Blocks.DARK_PRISMARINE); + public static BlockWrapper PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_STAIRS); + public static BlockWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_STAIRS); + public static BlockWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.DARK_PRISMARINE_STAIRS); + public static BlockWrapper PRISMARINE_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_SLAB); + public static BlockWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_SLAB); + public static BlockWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.block.Blocks.DARK_PRISMARINE_SLAB); + public static BlockWrapper SEA_LANTERN = of(net.minecraft.block.Blocks.SEA_LANTERN); + public static BlockWrapper HAY_BLOCK = of(net.minecraft.block.Blocks.HAY_BLOCK); + public static BlockWrapper WHITE_CARPET = of(net.minecraft.block.Blocks.WHITE_CARPET); + public static BlockWrapper ORANGE_CARPET = of(net.minecraft.block.Blocks.ORANGE_CARPET); + public static BlockWrapper MAGENTA_CARPET = of(net.minecraft.block.Blocks.MAGENTA_CARPET); + public static BlockWrapper LIGHT_BLUE_CARPET = of(net.minecraft.block.Blocks.LIGHT_BLUE_CARPET); + public static BlockWrapper YELLOW_CARPET = of(net.minecraft.block.Blocks.YELLOW_CARPET); + public static BlockWrapper LIME_CARPET = of(net.minecraft.block.Blocks.LIME_CARPET); + public static BlockWrapper PINK_CARPET = of(net.minecraft.block.Blocks.PINK_CARPET); + public static BlockWrapper GRAY_CARPET = of(net.minecraft.block.Blocks.GRAY_CARPET); + public static BlockWrapper LIGHT_GRAY_CARPET = of(net.minecraft.block.Blocks.LIGHT_GRAY_CARPET); + public static BlockWrapper CYAN_CARPET = of(net.minecraft.block.Blocks.CYAN_CARPET); + public static BlockWrapper PURPLE_CARPET = of(net.minecraft.block.Blocks.PURPLE_CARPET); + public static BlockWrapper BLUE_CARPET = of(net.minecraft.block.Blocks.BLUE_CARPET); + public static BlockWrapper BROWN_CARPET = of(net.minecraft.block.Blocks.BROWN_CARPET); + public static BlockWrapper GREEN_CARPET = of(net.minecraft.block.Blocks.GREEN_CARPET); + public static BlockWrapper RED_CARPET = of(net.minecraft.block.Blocks.RED_CARPET); + public static BlockWrapper BLACK_CARPET = of(net.minecraft.block.Blocks.BLACK_CARPET); + public static BlockWrapper TERRACOTTA = of(net.minecraft.block.Blocks.TERRACOTTA); + public static BlockWrapper COAL_BLOCK = of(net.minecraft.block.Blocks.COAL_BLOCK); + public static BlockWrapper PACKED_ICE = of(net.minecraft.block.Blocks.PACKED_ICE); + public static BlockWrapper SUNFLOWER = of(net.minecraft.block.Blocks.SUNFLOWER); + public static BlockWrapper LILAC = of(net.minecraft.block.Blocks.LILAC); + public static BlockWrapper ROSE_BUSH = of(net.minecraft.block.Blocks.ROSE_BUSH); + public static BlockWrapper PEONY = of(net.minecraft.block.Blocks.PEONY); + public static BlockWrapper TALL_GRASS = of(net.minecraft.block.Blocks.TALL_GRASS); + public static BlockWrapper LARGE_FERN = of(net.minecraft.block.Blocks.LARGE_FERN); + public static BlockWrapper WHITE_BANNER = of(net.minecraft.block.Blocks.WHITE_BANNER); + public static BlockWrapper ORANGE_BANNER = of(net.minecraft.block.Blocks.ORANGE_BANNER); + public static BlockWrapper MAGENTA_BANNER = of(net.minecraft.block.Blocks.MAGENTA_BANNER); + public static BlockWrapper LIGHT_BLUE_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_BANNER); + public static BlockWrapper YELLOW_BANNER = of(net.minecraft.block.Blocks.YELLOW_BANNER); + public static BlockWrapper LIME_BANNER = of(net.minecraft.block.Blocks.LIME_BANNER); + public static BlockWrapper PINK_BANNER = of(net.minecraft.block.Blocks.PINK_BANNER); + public static BlockWrapper GRAY_BANNER = of(net.minecraft.block.Blocks.GRAY_BANNER); + public static BlockWrapper LIGHT_GRAY_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_BANNER); + public static BlockWrapper CYAN_BANNER = of(net.minecraft.block.Blocks.CYAN_BANNER); + public static BlockWrapper PURPLE_BANNER = of(net.minecraft.block.Blocks.PURPLE_BANNER); + public static BlockWrapper BLUE_BANNER = of(net.minecraft.block.Blocks.BLUE_BANNER); + public static BlockWrapper BROWN_BANNER = of(net.minecraft.block.Blocks.BROWN_BANNER); + public static BlockWrapper GREEN_BANNER = of(net.minecraft.block.Blocks.GREEN_BANNER); + public static BlockWrapper RED_BANNER = of(net.minecraft.block.Blocks.RED_BANNER); + public static BlockWrapper BLACK_BANNER = of(net.minecraft.block.Blocks.BLACK_BANNER); + public static BlockWrapper WHITE_WALL_BANNER = of(net.minecraft.block.Blocks.WHITE_WALL_BANNER); + public static BlockWrapper ORANGE_WALL_BANNER = of(net.minecraft.block.Blocks.ORANGE_WALL_BANNER); + public static BlockWrapper MAGENTA_WALL_BANNER = of(net.minecraft.block.Blocks.MAGENTA_WALL_BANNER); + public static BlockWrapper LIGHT_BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_WALL_BANNER); + public static BlockWrapper YELLOW_WALL_BANNER = of(net.minecraft.block.Blocks.YELLOW_WALL_BANNER); + public static BlockWrapper LIME_WALL_BANNER = of(net.minecraft.block.Blocks.LIME_WALL_BANNER); + public static BlockWrapper PINK_WALL_BANNER = of(net.minecraft.block.Blocks.PINK_WALL_BANNER); + public static BlockWrapper GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.GRAY_WALL_BANNER); + public static BlockWrapper LIGHT_GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_WALL_BANNER); + public static BlockWrapper CYAN_WALL_BANNER = of(net.minecraft.block.Blocks.CYAN_WALL_BANNER); + public static BlockWrapper PURPLE_WALL_BANNER = of(net.minecraft.block.Blocks.PURPLE_WALL_BANNER); + public static BlockWrapper BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.BLUE_WALL_BANNER); + public static BlockWrapper BROWN_WALL_BANNER = of(net.minecraft.block.Blocks.BROWN_WALL_BANNER); + public static BlockWrapper GREEN_WALL_BANNER = of(net.minecraft.block.Blocks.GREEN_WALL_BANNER); + public static BlockWrapper RED_WALL_BANNER = of(net.minecraft.block.Blocks.RED_WALL_BANNER); + public static BlockWrapper BLACK_WALL_BANNER = of(net.minecraft.block.Blocks.BLACK_WALL_BANNER); + public static BlockWrapper RED_SANDSTONE = of(net.minecraft.block.Blocks.RED_SANDSTONE); + public static BlockWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_RED_SANDSTONE); + public static BlockWrapper CUT_RED_SANDSTONE = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE); + public static BlockWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.RED_SANDSTONE_STAIRS); + public static BlockWrapper OAK_SLAB = of(net.minecraft.block.Blocks.OAK_SLAB); + public static BlockWrapper SPRUCE_SLAB = of(net.minecraft.block.Blocks.SPRUCE_SLAB); + public static BlockWrapper BIRCH_SLAB = of(net.minecraft.block.Blocks.BIRCH_SLAB); + public static BlockWrapper JUNGLE_SLAB = of(net.minecraft.block.Blocks.JUNGLE_SLAB); + public static BlockWrapper ACACIA_SLAB = of(net.minecraft.block.Blocks.ACACIA_SLAB); + public static BlockWrapper DARK_OAK_SLAB = of(net.minecraft.block.Blocks.DARK_OAK_SLAB); + public static BlockWrapper STONE_SLAB = of(net.minecraft.block.Blocks.STONE_SLAB); + public static BlockWrapper SMOOTH_STONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_STONE_SLAB); + public static BlockWrapper SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SANDSTONE_SLAB); + public static BlockWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_SANDSTONE_SLAB); + public static BlockWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.block.Blocks.PETRIFIED_OAK_SLAB); + public static BlockWrapper COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.COBBLESTONE_SLAB); + public static BlockWrapper BRICK_SLAB = of(net.minecraft.block.Blocks.BRICK_SLAB); + public static BlockWrapper STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.STONE_BRICK_SLAB); + public static BlockWrapper NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.NETHER_BRICK_SLAB); + public static BlockWrapper QUARTZ_SLAB = of(net.minecraft.block.Blocks.QUARTZ_SLAB); + public static BlockWrapper RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.RED_SANDSTONE_SLAB); + public static BlockWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE_SLAB); + public static BlockWrapper PURPUR_SLAB = of(net.minecraft.block.Blocks.PURPUR_SLAB); + public static BlockWrapper SMOOTH_STONE = of(net.minecraft.block.Blocks.SMOOTH_STONE); + public static BlockWrapper SMOOTH_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE); + public static BlockWrapper SMOOTH_QUARTZ = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ); + public static BlockWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE); + public static BlockWrapper SPRUCE_FENCE_GATE = of(net.minecraft.block.Blocks.SPRUCE_FENCE_GATE); + public static BlockWrapper BIRCH_FENCE_GATE = of(net.minecraft.block.Blocks.BIRCH_FENCE_GATE); + public static BlockWrapper JUNGLE_FENCE_GATE = of(net.minecraft.block.Blocks.JUNGLE_FENCE_GATE); + public static BlockWrapper ACACIA_FENCE_GATE = of(net.minecraft.block.Blocks.ACACIA_FENCE_GATE); + public static BlockWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE_GATE); + public static BlockWrapper SPRUCE_FENCE = of(net.minecraft.block.Blocks.SPRUCE_FENCE); + public static BlockWrapper BIRCH_FENCE = of(net.minecraft.block.Blocks.BIRCH_FENCE); + public static BlockWrapper JUNGLE_FENCE = of(net.minecraft.block.Blocks.JUNGLE_FENCE); + public static BlockWrapper ACACIA_FENCE = of(net.minecraft.block.Blocks.ACACIA_FENCE); + public static BlockWrapper DARK_OAK_FENCE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE); + public static BlockWrapper SPRUCE_DOOR = of(net.minecraft.block.Blocks.SPRUCE_DOOR); + public static BlockWrapper BIRCH_DOOR = of(net.minecraft.block.Blocks.BIRCH_DOOR); + public static BlockWrapper JUNGLE_DOOR = of(net.minecraft.block.Blocks.JUNGLE_DOOR); + public static BlockWrapper ACACIA_DOOR = of(net.minecraft.block.Blocks.ACACIA_DOOR); + public static BlockWrapper DARK_OAK_DOOR = of(net.minecraft.block.Blocks.DARK_OAK_DOOR); + public static BlockWrapper END_ROD = of(net.minecraft.block.Blocks.END_ROD); + public static BlockWrapper CHORUS_PLANT = of(net.minecraft.block.Blocks.CHORUS_PLANT); + public static BlockWrapper CHORUS_FLOWER = of(net.minecraft.block.Blocks.CHORUS_FLOWER); + public static BlockWrapper PURPUR_BLOCK = of(net.minecraft.block.Blocks.PURPUR_BLOCK); + public static BlockWrapper PURPUR_PILLAR = of(net.minecraft.block.Blocks.PURPUR_PILLAR); + public static BlockWrapper PURPUR_STAIRS = of(net.minecraft.block.Blocks.PURPUR_STAIRS); + public static BlockWrapper END_STONE_BRICKS = of(net.minecraft.block.Blocks.END_STONE_BRICKS); + public static BlockWrapper BEETROOTS = of(net.minecraft.block.Blocks.BEETROOTS); + public static BlockWrapper GRASS_PATH = of(net.minecraft.block.Blocks.DIRT_PATH); + public static BlockWrapper END_GATEWAY = of(net.minecraft.block.Blocks.END_GATEWAY); + public static BlockWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.block.Blocks.REPEATING_COMMAND_BLOCK); + public static BlockWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.block.Blocks.CHAIN_COMMAND_BLOCK); + public static BlockWrapper FROSTED_ICE = of(net.minecraft.block.Blocks.FROSTED_ICE); + public static BlockWrapper MAGMA_BLOCK = of(net.minecraft.block.Blocks.MAGMA_BLOCK); + public static BlockWrapper NETHER_WART_BLOCK = of(net.minecraft.block.Blocks.NETHER_WART_BLOCK); + public static BlockWrapper RED_NETHER_BRICKS = of(net.minecraft.block.Blocks.RED_NETHER_BRICKS); + public static BlockWrapper BONE_BLOCK = of(net.minecraft.block.Blocks.BONE_BLOCK); + public static BlockWrapper STRUCTURE_VOID = of(net.minecraft.block.Blocks.STRUCTURE_VOID); + public static BlockWrapper OBSERVER = of(net.minecraft.block.Blocks.OBSERVER); + public static BlockWrapper SHULKER_BOX = of(net.minecraft.block.Blocks.SHULKER_BOX); + public static BlockWrapper WHITE_SHULKER_BOX = of(net.minecraft.block.Blocks.WHITE_SHULKER_BOX); + public static BlockWrapper ORANGE_SHULKER_BOX = of(net.minecraft.block.Blocks.ORANGE_SHULKER_BOX); + public static BlockWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.block.Blocks.MAGENTA_SHULKER_BOX); + public static BlockWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_BLUE_SHULKER_BOX); + public static BlockWrapper YELLOW_SHULKER_BOX = of(net.minecraft.block.Blocks.YELLOW_SHULKER_BOX); + public static BlockWrapper LIME_SHULKER_BOX = of(net.minecraft.block.Blocks.LIME_SHULKER_BOX); + public static BlockWrapper PINK_SHULKER_BOX = of(net.minecraft.block.Blocks.PINK_SHULKER_BOX); + public static BlockWrapper GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.GRAY_SHULKER_BOX); + public static BlockWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_GRAY_SHULKER_BOX); + public static BlockWrapper CYAN_SHULKER_BOX = of(net.minecraft.block.Blocks.CYAN_SHULKER_BOX); + public static BlockWrapper PURPLE_SHULKER_BOX = of(net.minecraft.block.Blocks.PURPLE_SHULKER_BOX); + public static BlockWrapper BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.BLUE_SHULKER_BOX); + public static BlockWrapper BROWN_SHULKER_BOX = of(net.minecraft.block.Blocks.BROWN_SHULKER_BOX); + public static BlockWrapper GREEN_SHULKER_BOX = of(net.minecraft.block.Blocks.GREEN_SHULKER_BOX); + public static BlockWrapper RED_SHULKER_BOX = of(net.minecraft.block.Blocks.RED_SHULKER_BOX); + public static BlockWrapper BLACK_SHULKER_BOX = of(net.minecraft.block.Blocks.BLACK_SHULKER_BOX); + public static BlockWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_GLAZED_TERRACOTTA); + public static BlockWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_GLAZED_TERRACOTTA); + public static BlockWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_GLAZED_TERRACOTTA); + public static BlockWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA); + public static BlockWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_GLAZED_TERRACOTTA); + public static BlockWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_GLAZED_TERRACOTTA); + public static BlockWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_GLAZED_TERRACOTTA); + public static BlockWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_GLAZED_TERRACOTTA); + public static BlockWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA); + public static BlockWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_GLAZED_TERRACOTTA); + public static BlockWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_GLAZED_TERRACOTTA); + public static BlockWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_GLAZED_TERRACOTTA); + public static BlockWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_GLAZED_TERRACOTTA); + public static BlockWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_GLAZED_TERRACOTTA); + public static BlockWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_GLAZED_TERRACOTTA); + public static BlockWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_GLAZED_TERRACOTTA); + public static BlockWrapper WHITE_CONCRETE = of(net.minecraft.block.Blocks.WHITE_CONCRETE); + public static BlockWrapper ORANGE_CONCRETE = of(net.minecraft.block.Blocks.ORANGE_CONCRETE); + public static BlockWrapper MAGENTA_CONCRETE = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE); + public static BlockWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE); + public static BlockWrapper YELLOW_CONCRETE = of(net.minecraft.block.Blocks.YELLOW_CONCRETE); + public static BlockWrapper LIME_CONCRETE = of(net.minecraft.block.Blocks.LIME_CONCRETE); + public static BlockWrapper PINK_CONCRETE = of(net.minecraft.block.Blocks.PINK_CONCRETE); + public static BlockWrapper GRAY_CONCRETE = of(net.minecraft.block.Blocks.GRAY_CONCRETE); + public static BlockWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE); + public static BlockWrapper CYAN_CONCRETE = of(net.minecraft.block.Blocks.CYAN_CONCRETE); + public static BlockWrapper PURPLE_CONCRETE = of(net.minecraft.block.Blocks.PURPLE_CONCRETE); + public static BlockWrapper BLUE_CONCRETE = of(net.minecraft.block.Blocks.BLUE_CONCRETE); + public static BlockWrapper BROWN_CONCRETE = of(net.minecraft.block.Blocks.BROWN_CONCRETE); + public static BlockWrapper GREEN_CONCRETE = of(net.minecraft.block.Blocks.GREEN_CONCRETE); + public static BlockWrapper RED_CONCRETE = of(net.minecraft.block.Blocks.RED_CONCRETE); + public static BlockWrapper BLACK_CONCRETE = of(net.minecraft.block.Blocks.BLACK_CONCRETE); + public static BlockWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.WHITE_CONCRETE_POWDER); + public static BlockWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.ORANGE_CONCRETE_POWDER); + public static BlockWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE_POWDER); + public static BlockWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE_POWDER); + public static BlockWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.block.Blocks.YELLOW_CONCRETE_POWDER); + public static BlockWrapper LIME_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIME_CONCRETE_POWDER); + public static BlockWrapper PINK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PINK_CONCRETE_POWDER); + public static BlockWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GRAY_CONCRETE_POWDER); + public static BlockWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE_POWDER); + public static BlockWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.CYAN_CONCRETE_POWDER); + public static BlockWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PURPLE_CONCRETE_POWDER); + public static BlockWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLUE_CONCRETE_POWDER); + public static BlockWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BROWN_CONCRETE_POWDER); + public static BlockWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GREEN_CONCRETE_POWDER); + public static BlockWrapper RED_CONCRETE_POWDER = of(net.minecraft.block.Blocks.RED_CONCRETE_POWDER); + public static BlockWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLACK_CONCRETE_POWDER); + public static BlockWrapper KELP = of(net.minecraft.block.Blocks.KELP); + public static BlockWrapper KELP_PLANT = of(net.minecraft.block.Blocks.KELP_PLANT); + public static BlockWrapper DRIED_KELP_BLOCK = of(net.minecraft.block.Blocks.DRIED_KELP_BLOCK); + public static BlockWrapper TURTLE_EGG = of(net.minecraft.block.Blocks.TURTLE_EGG); + public static BlockWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_BLOCK); + public static BlockWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_BLOCK); + public static BlockWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_BLOCK); + public static BlockWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_BLOCK); + public static BlockWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_BLOCK); + public static BlockWrapper TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.TUBE_CORAL_BLOCK); + public static BlockWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.BRAIN_CORAL_BLOCK); + public static BlockWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.BUBBLE_CORAL_BLOCK); + public static BlockWrapper FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.FIRE_CORAL_BLOCK); + public static BlockWrapper HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.HORN_CORAL_BLOCK); + public static BlockWrapper DEAD_TUBE_CORAL = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL); + public static BlockWrapper DEAD_BRAIN_CORAL = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL); + public static BlockWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL); + public static BlockWrapper DEAD_FIRE_CORAL = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL); + public static BlockWrapper DEAD_HORN_CORAL = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL); + public static BlockWrapper TUBE_CORAL = of(net.minecraft.block.Blocks.TUBE_CORAL); + public static BlockWrapper BRAIN_CORAL = of(net.minecraft.block.Blocks.BRAIN_CORAL); + public static BlockWrapper BUBBLE_CORAL = of(net.minecraft.block.Blocks.BUBBLE_CORAL); + public static BlockWrapper FIRE_CORAL = of(net.minecraft.block.Blocks.FIRE_CORAL); + public static BlockWrapper HORN_CORAL = of(net.minecraft.block.Blocks.HORN_CORAL); + public static BlockWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_FAN); + public static BlockWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_FAN); + public static BlockWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_FAN); + public static BlockWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_FAN); + public static BlockWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_FAN); + public static BlockWrapper TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_FAN); + public static BlockWrapper BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_FAN); + public static BlockWrapper BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_FAN); + public static BlockWrapper FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_FAN); + public static BlockWrapper HORN_CORAL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_FAN); + public static BlockWrapper DEAD_TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_WALL_FAN); + public static BlockWrapper DEAD_BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_WALL_FAN); + public static BlockWrapper TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_WALL_FAN); + public static BlockWrapper BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_WALL_FAN); + public static BlockWrapper BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_WALL_FAN); + public static BlockWrapper FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_WALL_FAN); + public static BlockWrapper HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_WALL_FAN); + public static BlockWrapper SEA_PICKLE = of(net.minecraft.block.Blocks.SEA_PICKLE); + public static BlockWrapper BLUE_ICE = of(net.minecraft.block.Blocks.BLUE_ICE); + public static BlockWrapper CONDUIT = of(net.minecraft.block.Blocks.CONDUIT); + public static BlockWrapper BAMBOO_SAPLING = of(net.minecraft.block.Blocks.BAMBOO_SAPLING); + public static BlockWrapper BAMBOO = of(net.minecraft.block.Blocks.BAMBOO); + public static BlockWrapper POTTED_BAMBOO = of(net.minecraft.block.Blocks.POTTED_BAMBOO); + public static BlockWrapper VOID_AIR = of(net.minecraft.block.Blocks.VOID_AIR); + public static BlockWrapper CAVE_AIR = of(net.minecraft.block.Blocks.CAVE_AIR); + public static BlockWrapper BUBBLE_COLUMN = of(net.minecraft.block.Blocks.BUBBLE_COLUMN); + public static BlockWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_GRANITE_STAIRS); + public static BlockWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_STAIRS); + public static BlockWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_STAIRS); + public static BlockWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_DIORITE_STAIRS); + public static BlockWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_STAIRS); + public static BlockWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.END_STONE_BRICK_STAIRS); + public static BlockWrapper STONE_STAIRS = of(net.minecraft.block.Blocks.STONE_STAIRS); + public static BlockWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_STAIRS); + public static BlockWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_STAIRS); + public static BlockWrapper GRANITE_STAIRS = of(net.minecraft.block.Blocks.GRANITE_STAIRS); + public static BlockWrapper ANDESITE_STAIRS = of(net.minecraft.block.Blocks.ANDESITE_STAIRS); + public static BlockWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_STAIRS); + public static BlockWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_STAIRS); + public static BlockWrapper DIORITE_STAIRS = of(net.minecraft.block.Blocks.DIORITE_STAIRS); + public static BlockWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_GRANITE_SLAB); + public static BlockWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_SLAB); + public static BlockWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_SLAB); + public static BlockWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_DIORITE_SLAB); + public static BlockWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_SLAB); + public static BlockWrapper END_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.END_STONE_BRICK_SLAB); + public static BlockWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_SLAB); + public static BlockWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_SLAB); + public static BlockWrapper GRANITE_SLAB = of(net.minecraft.block.Blocks.GRANITE_SLAB); + public static BlockWrapper ANDESITE_SLAB = of(net.minecraft.block.Blocks.ANDESITE_SLAB); + public static BlockWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_SLAB); + public static BlockWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_SLAB); + public static BlockWrapper DIORITE_SLAB = of(net.minecraft.block.Blocks.DIORITE_SLAB); + public static BlockWrapper BRICK_WALL = of(net.minecraft.block.Blocks.BRICK_WALL); + public static BlockWrapper PRISMARINE_WALL = of(net.minecraft.block.Blocks.PRISMARINE_WALL); + public static BlockWrapper RED_SANDSTONE_WALL = of(net.minecraft.block.Blocks.RED_SANDSTONE_WALL); + public static BlockWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_WALL); + public static BlockWrapper GRANITE_WALL = of(net.minecraft.block.Blocks.GRANITE_WALL); + public static BlockWrapper STONE_BRICK_WALL = of(net.minecraft.block.Blocks.STONE_BRICK_WALL); + public static BlockWrapper NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.NETHER_BRICK_WALL); + public static BlockWrapper ANDESITE_WALL = of(net.minecraft.block.Blocks.ANDESITE_WALL); + public static BlockWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_WALL); + public static BlockWrapper SANDSTONE_WALL = of(net.minecraft.block.Blocks.SANDSTONE_WALL); + public static BlockWrapper END_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.END_STONE_BRICK_WALL); + public static BlockWrapper DIORITE_WALL = of(net.minecraft.block.Blocks.DIORITE_WALL); + public static BlockWrapper SCAFFOLDING = of(net.minecraft.block.Blocks.SCAFFOLDING); + public static BlockWrapper LOOM = of(net.minecraft.block.Blocks.LOOM); + public static BlockWrapper BARREL = of(net.minecraft.block.Blocks.BARREL); + public static BlockWrapper SMOKER = of(net.minecraft.block.Blocks.SMOKER); + public static BlockWrapper BLAST_FURNACE = of(net.minecraft.block.Blocks.BLAST_FURNACE); + public static BlockWrapper CARTOGRAPHY_TABLE = of(net.minecraft.block.Blocks.CARTOGRAPHY_TABLE); + public static BlockWrapper FLETCHING_TABLE = of(net.minecraft.block.Blocks.FLETCHING_TABLE); + public static BlockWrapper GRINDSTONE = of(net.minecraft.block.Blocks.GRINDSTONE); + public static BlockWrapper LECTERN = of(net.minecraft.block.Blocks.LECTERN); + public static BlockWrapper SMITHING_TABLE = of(net.minecraft.block.Blocks.SMITHING_TABLE); + public static BlockWrapper STONECUTTER = of(net.minecraft.block.Blocks.STONECUTTER); + public static BlockWrapper BELL = of(net.minecraft.block.Blocks.BELL); + public static BlockWrapper LANTERN = of(net.minecraft.block.Blocks.LANTERN); + public static BlockWrapper SOUL_LANTERN = of(net.minecraft.block.Blocks.SOUL_LANTERN); + public static BlockWrapper CAMPFIRE = of(net.minecraft.block.Blocks.CAMPFIRE); + public static BlockWrapper SOUL_CAMPFIRE = of(net.minecraft.block.Blocks.SOUL_CAMPFIRE); + public static BlockWrapper SWEET_BERRY_BUSH = of(net.minecraft.block.Blocks.SWEET_BERRY_BUSH); + public static BlockWrapper WARPED_STEM = of(net.minecraft.block.Blocks.WARPED_STEM); + public static BlockWrapper STRIPPED_WARPED_STEM = of(net.minecraft.block.Blocks.STRIPPED_WARPED_STEM); + public static BlockWrapper WARPED_HYPHAE = of(net.minecraft.block.Blocks.WARPED_HYPHAE); + public static BlockWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_WARPED_HYPHAE); + public static BlockWrapper WARPED_NYLIUM = of(net.minecraft.block.Blocks.WARPED_NYLIUM); + public static BlockWrapper WARPED_FUNGUS = of(net.minecraft.block.Blocks.WARPED_FUNGUS); + public static BlockWrapper WARPED_WART_BLOCK = of(net.minecraft.block.Blocks.WARPED_WART_BLOCK); + public static BlockWrapper WARPED_ROOTS = of(net.minecraft.block.Blocks.WARPED_ROOTS); + public static BlockWrapper NETHER_SPROUTS = of(net.minecraft.block.Blocks.NETHER_SPROUTS); + public static BlockWrapper CRIMSON_STEM = of(net.minecraft.block.Blocks.CRIMSON_STEM); + public static BlockWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_STEM); + public static BlockWrapper CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.CRIMSON_HYPHAE); + public static BlockWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_HYPHAE); + public static BlockWrapper CRIMSON_NYLIUM = of(net.minecraft.block.Blocks.CRIMSON_NYLIUM); + public static BlockWrapper CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.CRIMSON_FUNGUS); + public static BlockWrapper SHROOMLIGHT = of(net.minecraft.block.Blocks.SHROOMLIGHT); + public static BlockWrapper WEEPING_VINES = of(net.minecraft.block.Blocks.WEEPING_VINES); + public static BlockWrapper WEEPING_VINES_PLANT = of(net.minecraft.block.Blocks.WEEPING_VINES_PLANT); + public static BlockWrapper TWISTING_VINES = of(net.minecraft.block.Blocks.TWISTING_VINES); + public static BlockWrapper TWISTING_VINES_PLANT = of(net.minecraft.block.Blocks.TWISTING_VINES_PLANT); + public static BlockWrapper CRIMSON_ROOTS = of(net.minecraft.block.Blocks.CRIMSON_ROOTS); + public static BlockWrapper CRIMSON_PLANKS = of(net.minecraft.block.Blocks.CRIMSON_PLANKS); + public static BlockWrapper WARPED_PLANKS = of(net.minecraft.block.Blocks.WARPED_PLANKS); + public static BlockWrapper CRIMSON_SLAB = of(net.minecraft.block.Blocks.CRIMSON_SLAB); + public static BlockWrapper WARPED_SLAB = of(net.minecraft.block.Blocks.WARPED_SLAB); + public static BlockWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.block.Blocks.CRIMSON_PRESSURE_PLATE); + public static BlockWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.WARPED_PRESSURE_PLATE); + public static BlockWrapper CRIMSON_FENCE = of(net.minecraft.block.Blocks.CRIMSON_FENCE); + public static BlockWrapper WARPED_FENCE = of(net.minecraft.block.Blocks.WARPED_FENCE); + public static BlockWrapper CRIMSON_TRAPDOOR = of(net.minecraft.block.Blocks.CRIMSON_TRAPDOOR); + public static BlockWrapper WARPED_TRAPDOOR = of(net.minecraft.block.Blocks.WARPED_TRAPDOOR); + public static BlockWrapper CRIMSON_FENCE_GATE = of(net.minecraft.block.Blocks.CRIMSON_FENCE_GATE); + public static BlockWrapper WARPED_FENCE_GATE = of(net.minecraft.block.Blocks.WARPED_FENCE_GATE); + public static BlockWrapper CRIMSON_STAIRS = of(net.minecraft.block.Blocks.CRIMSON_STAIRS); + public static BlockWrapper WARPED_STAIRS = of(net.minecraft.block.Blocks.WARPED_STAIRS); + public static BlockWrapper CRIMSON_BUTTON = of(net.minecraft.block.Blocks.CRIMSON_BUTTON); + public static BlockWrapper WARPED_BUTTON = of(net.minecraft.block.Blocks.WARPED_BUTTON); + public static BlockWrapper CRIMSON_DOOR = of(net.minecraft.block.Blocks.CRIMSON_DOOR); + public static BlockWrapper WARPED_DOOR = of(net.minecraft.block.Blocks.WARPED_DOOR); + public static BlockWrapper CRIMSON_SIGN = of(net.minecraft.block.Blocks.CRIMSON_SIGN); + public static BlockWrapper WARPED_SIGN = of(net.minecraft.block.Blocks.WARPED_SIGN); + public static BlockWrapper CRIMSON_WALL_SIGN = of(net.minecraft.block.Blocks.CRIMSON_WALL_SIGN); + public static BlockWrapper WARPED_WALL_SIGN = of(net.minecraft.block.Blocks.WARPED_WALL_SIGN); + public static BlockWrapper STRUCTURE_BLOCK = of(net.minecraft.block.Blocks.STRUCTURE_BLOCK); + public static BlockWrapper JIGSAW = of(net.minecraft.block.Blocks.JIGSAW); + public static BlockWrapper COMPOSTER = of(net.minecraft.block.Blocks.COMPOSTER); + public static BlockWrapper TARGET = of(net.minecraft.block.Blocks.TARGET); + public static BlockWrapper BEE_NEST = of(net.minecraft.block.Blocks.BEE_NEST); + public static BlockWrapper BEEHIVE = of(net.minecraft.block.Blocks.BEEHIVE); + public static BlockWrapper HONEY_BLOCK = of(net.minecraft.block.Blocks.HONEY_BLOCK); + public static BlockWrapper HONEYCOMB_BLOCK = of(net.minecraft.block.Blocks.HONEYCOMB_BLOCK); + public static BlockWrapper NETHERITE_BLOCK = of(net.minecraft.block.Blocks.NETHERITE_BLOCK); + public static BlockWrapper ANCIENT_DEBRIS = of(net.minecraft.block.Blocks.ANCIENT_DEBRIS); + public static BlockWrapper CRYING_OBSIDIAN = of(net.minecraft.block.Blocks.CRYING_OBSIDIAN); + public static BlockWrapper RESPAWN_ANCHOR = of(net.minecraft.block.Blocks.RESPAWN_ANCHOR); + public static BlockWrapper POTTED_CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_FUNGUS); + public static BlockWrapper POTTED_WARPED_FUNGUS = of(net.minecraft.block.Blocks.POTTED_WARPED_FUNGUS); + public static BlockWrapper POTTED_CRIMSON_ROOTS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_ROOTS); + public static BlockWrapper POTTED_WARPED_ROOTS = of(net.minecraft.block.Blocks.POTTED_WARPED_ROOTS); + public static BlockWrapper LODESTONE = of(net.minecraft.block.Blocks.LODESTONE); + public static BlockWrapper BLACKSTONE = of(net.minecraft.block.Blocks.BLACKSTONE); + public static BlockWrapper BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.BLACKSTONE_STAIRS); + public static BlockWrapper BLACKSTONE_WALL = of(net.minecraft.block.Blocks.BLACKSTONE_WALL); + public static BlockWrapper BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.BLACKSTONE_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICKS); + public static BlockWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_POLISHED_BLACKSTONE_BRICKS); + public static BlockWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.CHISELED_POLISHED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_WALL); + public static BlockWrapper GILDED_BLACKSTONE = of(net.minecraft.block.Blocks.GILDED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_STAIRS); + public static BlockWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_PRESSURE_PLATE); + public static BlockWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BUTTON); + public static BlockWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_WALL); + public static BlockWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CHISELED_NETHER_BRICKS); + public static BlockWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CRACKED_NETHER_BRICKS); + public static BlockWrapper QUARTZ_BRICKS = of(net.minecraft.block.Blocks.QUARTZ_BRICKS); + + public static BlockWrapper of(net.minecraft.block.Block block) { + return BlockWrapper.of(block); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java new file mode 100644 index 000000000..ba604f61b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.minecraft.block.Block; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; + +import java.util.function.Supplier; + +public class SupplierBlockWrapper extends BlockWrapper { + private final Supplier supplier; + + protected SupplierBlockWrapper(Supplier supplier) { + this.supplier = supplier; + } + + public static SupplierBlockWrapper of(Supplier supplier) { + return new SupplierBlockWrapper(supplier); + } + + public static SupplierBlockWrapper of(RegistryResult result) { + return new SupplierBlockWrapper(result::get); + } + + @Override + public Block get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java new file mode 100644 index 000000000..0a066a984 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java @@ -0,0 +1,58 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.BlockView; + +public class BlockEntityTypeWrapper { + private final net.minecraft.block.entity.BlockEntityType type; + + public static final BlockEntityTypeWrapper EMPTY = new BlockEntityTypeWrapper(); + + protected BlockEntityTypeWrapper() { + this.type = null; + } + + protected BlockEntityTypeWrapper(net.minecraft.block.entity.BlockEntityType blockEntity) { + this.type = blockEntity; + } + + public static BlockEntityTypeWrapper of(net.minecraft.block.entity.BlockEntityType blockEntity) { + return new BlockEntityTypeWrapper(blockEntity); + } + + public static BlockEntityTypeWrapper of() { + return EMPTY; + } + + public net.minecraft.block.entity.BlockEntityType get() { + return type; + } + + public boolean isEmpty() { + return get() == null; + } + + public boolean isPresent() { + return get() != null; + } + + public boolean supports(BlockState state) { + return isPresent() && get().supports(state.toMinecraft()); + } + + public BlockEntityWrapper getBlockEntity(BlockView world, BlockPos pos) { + if (isEmpty()) + return BlockEntityWrapper.EMPTY; + + return SupplierBlockEntityWrapper.of(get().get(world.getRaw(), pos.toMinecraft())); + } + + public BlockEntityWrapper createBlockEntity(TileCreateEvent e) { + if (isEmpty()) + return BlockEntityWrapper.EMPTY; + + return SupplierBlockEntityWrapper.of(get().instantiate(e.getBlockPos(), e.getBlockState())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java new file mode 100644 index 000000000..7b3ac02d8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java @@ -0,0 +1,133 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; +import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockEntity; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.World; + +import java.util.Optional; + +public class BlockEntityWrapper { + private final net.minecraft.block.entity.BlockEntity blockEntity; + + public static final BlockEntityWrapper EMPTY = new BlockEntityWrapper(null); + + protected BlockEntityWrapper() { + this.blockEntity = null; + } + + protected BlockEntityWrapper(net.minecraft.block.entity.BlockEntity blockEntity) { + this.blockEntity = blockEntity; + } + + public static BlockEntityWrapper of(net.minecraft.block.entity.BlockEntity blockEntity) { + return new BlockEntityWrapper(blockEntity); + } + + public static BlockEntityWrapper of() { + return EMPTY; + } + + public net.minecraft.block.entity.BlockEntity get() { + return blockEntity; + } + + public BlockPos getPos() { + return BlockPos.of(get().getPos()); + } + + public boolean isPresent() { + return !isEmpty(); + } + + public boolean isEmpty() { + return this == EMPTY || get() == null; + } + + public boolean isRemoved() { + return get().isRemoved(); + } + + public void markDirty() { + BlockEntityUtil.markDirty(get()); + } + + public World getWorld() { + return World.of(BlockEntityUtil.getWorld(get())); + } + + public BlockWrapper getBlock() { + return BlockWrapper.of(BlockEntityUtil.getBlock(get())); + } + + + public BlockState getBlockState() { + return BlockState.of(BlockEntityUtil.getBlockState(get())); + } + + public BlockState getCachedState() { + return BlockState.of(BlockEntityUtil.getCachedState(get())); + } + + public NbtCompound createNbt() { + return NbtCompound.of(BlockEntityUtil.getBlockEntityNbt(get())); + } + + public void markRemoved() { + BlockEntityUtil.markRemoved(get()); + } + + public void writeNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + BlockEntityUtil.writeNbt(get(), nbt.toMinecraft(), registryLookup); + } + + public void readNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + BlockEntityUtil.readNbt(get(), nbt.toMinecraft(), registryLookup); + } + + public void writeNbt(NbtCompound nbt) { + writeNbt(nbt, RegistryLookupUtil.getRegistryLookup(get())); + } + + public void readNbt(NbtCompound nbt) { + readNbt(nbt, RegistryLookupUtil.getRegistryLookup(get())); + } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + BlockEntityWrapper blockEntity = (BlockEntityWrapper) obj; + return get() == blockEntity.get(); + } + + public static BlockEntityWrapper of(BlockPos pos, World world) { + net.minecraft.block.entity.BlockEntity blockEntity = BlockEntityUtil.getBlockEntity(world.toMinecraft(), pos.toMinecraft()); + return of(blockEntity); + } + + public Optional toCompatBlockEntity() { + if (get() instanceof CompatBlockEntity) { + return Optional.of((CompatBlockEntity) get()); + } + return Optional.empty(); + } + + public Optional toBuiltBlockEntity() { + if (get() instanceof BuiltBlockEntity) { + return Optional.of((BuiltBlockEntity) get()); + } + return Optional.empty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java new file mode 100644 index 000000000..c8f5b38cf --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.minecraft.block.entity.BlockEntityType; + +public class RewritableBlockEntityTypeWrapper extends BlockEntityTypeWrapper { + private BlockEntityType type; + + protected RewritableBlockEntityTypeWrapper(BlockEntityType type) { + this.type = type; + } + + protected RewritableBlockEntityTypeWrapper() { + + } + + public static RewritableBlockEntityTypeWrapper of(BlockEntityType type) { + return new RewritableBlockEntityTypeWrapper(type); + } + + public static RewritableBlockEntityTypeWrapper of() { + return new RewritableBlockEntityTypeWrapper(); + } + + public void set(BlockEntityType type) { + this.type = type; + } + + @Override + public BlockEntityType get() { + return type; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java new file mode 100644 index 000000000..c0ea96ed4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; + +import java.util.function.Supplier; + +public class SupplierBlockEntityTypeWrapper extends BlockEntityTypeWrapper { + private final Supplier> supplier; + + protected SupplierBlockEntityTypeWrapper(Supplier> supplier) { + this.supplier = supplier; + } + + public static SupplierBlockEntityTypeWrapper of(Supplier> supplier) { + return new SupplierBlockEntityTypeWrapper(supplier); + } + + public static SupplierBlockEntityTypeWrapper of(RegistryResult> result) { + return new SupplierBlockEntityTypeWrapper(result::get); + } + + @Override + public BlockEntityType get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java new file mode 100644 index 000000000..202a0d31a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.minecraft.block.entity.BlockEntity; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; + +import java.util.function.Supplier; + +public class SupplierBlockEntityWrapper extends BlockEntityWrapper { + private final Supplier supplier; + + protected SupplierBlockEntityWrapper(Supplier supplier) { + this.supplier = supplier; + } + + public static SupplierBlockEntityWrapper of(Supplier supplier) { + return new SupplierBlockEntityWrapper(supplier); + } + + public static SupplierBlockEntityWrapper of(RegistryResult result) { + return new SupplierBlockEntityWrapper(result::get); + } + + @Override + public BlockEntity get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java new file mode 100644 index 000000000..87e288635 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java @@ -0,0 +1,72 @@ +package net.pitan76.mcpitanlib.midohra.client.render; + +import net.minecraft.client.render.Camera; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; + +import java.util.Objects; + +public class CameraWrapper { + private final Camera camera; + + protected CameraWrapper(Camera camera) { + this.camera = camera; + } + + protected CameraWrapper() { + this.camera = null; + } + + public static CameraWrapper of(Camera camera) { + return new CameraWrapper(camera); + } + + public static CameraWrapper of() { + return new CameraWrapper(); + } + + public Camera get() { + return camera; + } + + public boolean isPresent() { + return !isEmpty(); + } + + public boolean isEmpty() { + return camera == null; + } + + public Vector3d getCameraPos() { + if (isEmpty()) return Vector3d.zero(); + return Vector3d.of(camera.getCameraPos()); + } + + public BlockPos getBlockPos() { + if (isEmpty()) return BlockPos.of(0, 0, 0); + return BlockPos.of(camera.getBlockPos()); + } + + public float getYaw() { + if (isEmpty()) return 0f; + return camera.getYaw(); + } + + public float getPitch() { + if (isEmpty()) return 0f; + return camera.getPitch(); + } + + @Override + public int hashCode() { + return camera != null ? camera.hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CameraWrapper other = (CameraWrapper) obj; + return Objects.equals(camera, other.camera); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java new file mode 100644 index 000000000..5fba94d39 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java @@ -0,0 +1,134 @@ +// TODO(Ravel): Failed to fully resolve file: null cannot be cast to non-null type com.intellij.psi.PsiJavaCodeReferenceElement +// TODO(Ravel): Failed to fully resolve file: null cannot be cast to non-null type com.intellij.psi.PsiJavaCodeReferenceElement +package net.pitan76.mcpitanlib.midohra.component; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.TypedEntityData; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.text.Text; +import net.minecraft.util.Rarity; +import net.minecraft.util.Unit; +import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; +import net.pitan76.mcpitanlib.api.util.*; +import net.pitan76.mcpitanlib.midohra.component.item.CustomNameComponentType; +import net.pitan76.mcpitanlib.midohra.component.item.ItemComponentType; +import net.pitan76.mcpitanlib.midohra.component.item.RarityComponentType; + +import java.util.List; + +public class ItemComponentTypes { + public static final ItemComponentType CUSTOM_DATA = new ItemComponentType<>(DataComponentTypes.CUSTOM_DATA) { + @Override + public void put(ItemStack stack, NbtCompound value) { + CustomDataUtil.setNbt(stack, value); + } + + @Override + public NbtCompound get(ItemStack stack) { + return CustomDataUtil.getNbt(stack); + } + }; + + public static final ItemComponentType MAX_STACK_SIZE = new ItemComponentType<>(DataComponentTypes.MAX_STACK_SIZE) { + @Override + public void put(ItemStack stack, Integer value) { + stack.set(DataComponentTypes.MAX_STACK_SIZE, value); + } + + @Override + public Integer get(ItemStack stack) { + return stack.getMaxCount(); + } + }; + + public static final ItemComponentType MAX_DAMAGE = new ItemComponentType<>(DataComponentTypes.MAX_DAMAGE) { + @Override + public void put(ItemStack stack, Integer value) { + stack.set(DataComponentTypes.MAX_DAMAGE, value); + } + + @Override + public Integer get(ItemStack stack) { + return stack.getMaxDamage(); + } + }; + + public static final ItemComponentType DAMAGE = new ItemComponentType<>(DataComponentTypes.DAMAGE) { + @Override + public void put(ItemStack stack, Integer value) { + stack.setDamage(value); + } + + @Override + public Integer get(ItemStack stack) { + return stack.getDamage(); + } + }; + + public static final ItemComponentType UNBREAKABLE = new ItemComponentType<>(DataComponentTypes.UNBREAKABLE) { + @Override + public void put(ItemStack stack, Boolean value) { + if (value) { + stack.set(DataComponentTypes.UNBREAKABLE, Unit.valueOf("")); + } else { + stack.remove(DataComponentTypes.UNBREAKABLE); + } + } + + @Override + public Boolean get(ItemStack stack) { + return has(stack); + } + }; + + public static final ItemComponentType RARITY = new RarityComponentType(); + + public static final CustomNameComponentType CUSTOM_NAME = new CustomNameComponentType(); + + public static final ItemComponentType BLOCK_ENTITY_DATA = new ItemComponentType<>(DataComponentTypes.BLOCK_ENTITY_DATA) { + @Override + public void put(ItemStack stack, NbtCompound value) { + BlockEntityDataUtil.setBlockEntityNbt(stack, value); + } + + @Override + public NbtCompound get(ItemStack stack) { + return BlockEntityDataUtil.getBlockEntityNbt(stack); + } + }; + + public static final ItemComponentType ENTITY_DATA = new ItemComponentType<>(DataComponentTypes.ENTITY_DATA) { + @Override + public void put(ItemStack stack, NbtCompound value) { + EntityType type = EntityTypeUtil.fromId(CompatIdentifier.of(NbtUtil.getString(value, "id"))); + stack.set(DataComponentTypes.ENTITY_DATA, TypedEntityData.create(type, value)); + } + + @Override + public NbtCompound get(ItemStack stack) { + if (!has(stack)) return NbtUtil.create(); + if (!stack.contains(DataComponentTypes.ENTITY_DATA)) return NbtUtil.create(); + + TypedEntityData> data = stack.get(DataComponentTypes.ENTITY_DATA); + NbtCompound nbt = data.copyNbtWithoutId(); + + String id = EntityTypeUtil.toID(data.getType()).toString(); + NbtUtil.putString(nbt, "id", id); + return nbt; + } + }; + + public static final ItemComponentType> LORE = new ItemComponentType<>(DataComponentTypes.LORE) { + @Override + public void put(ItemStack stack, List value) { + LoreUtil.setLore(stack, value); + } + + @Override + public List get(ItemStack stack) { + return LoreUtil.getLore(stack); + } + }; +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java new file mode 100644 index 000000000..b4fd2b700 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.midohra.component.item; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; + +public class CustomNameComponentType extends ItemComponentType { + + public CustomNameComponentType() { + super(DataComponentTypes.CUSTOM_NAME); + } + + @Override + public void put(ItemStack stack, Text value) { + stack.set(DataComponentTypes.CUSTOM_NAME, value); + } + + @Override + public Text get(ItemStack stack) { + if (!has(stack)) return Text.empty(); + return stack.get(DataComponentTypes.CUSTOM_NAME); + } + + public String getAsString(ItemStack stack) { + return get(stack).getString(); + } + + public void put(ItemStack stack, String name) { + put(stack, Text.literal(name)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java new file mode 100644 index 000000000..e45e00eef --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.midohra.component.item; + +import net.minecraft.component.ComponentType; +import net.minecraft.item.ItemStack; + +public abstract class ItemComponentType { + + private final ComponentType type; + + protected ItemComponentType(ComponentType type) { + this.type = type; + } + + public abstract void put(ItemStack stack, T value); + + public abstract T get(ItemStack stack); + + public boolean has(ItemStack stack) { + return stack.contains(type); + } + + public void putOrDefault(ItemStack stack, T value, T defaultValue) { + if (value.equals(defaultValue)) return; + put(stack, value); + } + + public T getOrDefault(ItemStack stack, T defaultValue) { + if (!has(stack)) return defaultValue; + return get(stack); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java new file mode 100644 index 000000000..2fb1ef26e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.midohra.component.item; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Rarity; +import net.pitan76.mcpitanlib.api.util.CompatRarity; + +public class RarityComponentType extends ItemComponentType { + + public RarityComponentType() { + super(DataComponentTypes.RARITY); + } + + @Override + public void put(ItemStack stack, Rarity value) { + stack.set(DataComponentTypes.RARITY, value); + } + + @Override + public Rarity get(ItemStack stack) { + return stack.getRarity(); + } + + public void put(ItemStack stack, CompatRarity rarity) { + put(stack, rarity.get()); + } + + public CompatRarity getCompatRarity(ItemStack stack) { + return CompatRarity.of(get(stack)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java new file mode 100644 index 000000000..587531855 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java @@ -0,0 +1,308 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder; + +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.CommonModInitializer; +import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; +import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; +import net.pitan76.mcpitanlib.api.block.v2.BlockSettingsBuilder; +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; +import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; +import net.pitan76.mcpitanlib.api.event.block.DroppedStacksArgs; +import net.pitan76.mcpitanlib.api.event.block.StateReplacedEvent; +import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.color.CompatDyeColor; +import net.pitan76.mcpitanlib.api.util.color.CompatMapColor; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; +import net.pitan76.mcpitanlib.core.datafixer.Pair; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlock; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.item.SupplierItemWrapper; +import net.pitan76.mcpitanlib.midohra.util.shape.VoxelShape; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.*; + +public class BlockBuilder { + + public BlockSettingsBuilder settingsBuilder; + public Function onRightClick; + public Consumer onStateReplaced; + public Consumer onAppendTooltip; + public Consumer onAppendProperties; + public BlockState defaultState; + public BiConsumer onInit; + public Function onOutlineShape; + public Function onCollisionShape; + public Function onRenderType; + public Function onPlacementState; + public Function onStateForNeighborUpdate; + public Function> onDroppedStacks; + + public BlockBuilder(BlockSettingsBuilder settingsBuilder) { + this.settingsBuilder = settingsBuilder; + } + + public BlockBuilder(CompatIdentifier id) { + this(new BlockSettingsBuilder(id)); + } + + public static BlockBuilder of(CompatIdentifier id) { + return new BlockBuilder(id); + } + + public static BlockBuilder of(BlockSettingsBuilder settingsBuilder) { + return new BlockBuilder(settingsBuilder); + } + + public SupplierBlockWrapper build(CompatRegistryV2 registry) { + if (settingsBuilder.id == null) + throw new IllegalStateException("Block id is not set. hint: use build(CompatRegistryV2, CompatIdentifier)"); + + Supplier result = registry.registerExtendBlock(settingsBuilder.id, () -> new BuiltBlock(this)); + + return SupplierBlockWrapper.of(result::get); + } + + public SupplierBlockWrapper build(CompatRegistryV2 registry, CompatIdentifier id) { + Supplier result = registry.registerExtendBlock(id, () -> new BuiltBlock(this, id)); + + return SupplierBlockWrapper.of(result::get); + } + + public SupplierBlockWrapper build(CommonModInitializer initializer) { + return build(initializer.registry); + } + + public SupplierBlockWrapper build(CommonModInitializer initializer, CompatIdentifier id) { + return build(initializer.registry, id); + } + + public Pair buildWithItem(CompatRegistryV2 registry, CompatibleItemSettings settings) { + SupplierBlockWrapper block = build(registry); + + RegistryResult result = registry.registerItem(settingsBuilder.id, () -> ItemUtil.create(block.get(), settings)); + + return Pair.of(block, SupplierItemWrapper.of(result::get)); + } + + public Pair buildWithItem(CompatRegistryV2 registry, CompatIdentifier id, CompatibleItemSettings settings) { + SupplierBlockWrapper block = build(registry, id); + + RegistryResult result = registry.registerItem(id, () -> ItemUtil.create(block.get(), settings.setId(id))); + + return Pair.of(block, SupplierItemWrapper.of(result::get)); + } + + public Pair buildWithItem(CommonModInitializer initializer, CompatibleItemSettings settings) { + return buildWithItem(initializer.registry, settings); + } + + public Pair buildWithItem(CommonModInitializer initializer, CompatIdentifier id, CompatibleItemSettings settings) { + return buildWithItem(initializer.registry, id, settings); + } + + public BlockBuilder material(CompatibleMaterial material) { + settingsBuilder.material(material); + return this; + } + + public BlockBuilder sounds(CompatBlockSoundGroup sounds) { + settingsBuilder.sounds(sounds); + return this; + } + + public BlockBuilder strength(float hardness, float resistance) { + settingsBuilder.strength(hardness, resistance); + return this; + } + + public BlockBuilder strength(float hardness) { + settingsBuilder.hardness(hardness); + return this; + } + + public BlockBuilder resistance(float resistance) { + settingsBuilder.resistance(resistance); + return this; + } + + public BlockBuilder mapColor(CompatMapColor color) { + settingsBuilder.mapColor(color); + return this; + } + + public BlockBuilder mapColor(CompatDyeColor color) { + settingsBuilder.dyeColor(color); + return this; + } + + public BlockBuilder luminance(ToIntFunction luminance) { + settingsBuilder.luminance(luminance); + return this; + } + + public BlockBuilder requiresTool() { + settingsBuilder.requiresTool(); + return this; + } + + public BlockBuilder dropsNothing() { + settingsBuilder.dropsNothing(); + return this; + } + + public BlockBuilder onRightClick(Function onRightClick) { + this.onRightClick = onRightClick; + return this; + } + + public BlockBuilder onStateReplaced(Consumer onStateReplaced) { + this.onStateReplaced = onStateReplaced; + return this; + } + + public BlockBuilder onAppendTooltip(Consumer onAppendTooltip) { + this.onAppendTooltip = onAppendTooltip; + return this; + } + + public BlockBuilder onAppendProperties(Consumer onAppendProperties) { + this.onAppendProperties = onAppendProperties; + return this; + } + + public BlockBuilder onOutlineShape(Function onOutlineShape) { + return onOutlineShapeRaw(e -> onOutlineShape.apply(e).raw()); + } + + public BlockBuilder onCollisionShape(Function onCollisionShape) { + return onCollisionShapeRaw(e -> onCollisionShape.apply(e).raw()); + } + + public BlockBuilder onOutlineShapeRaw(Function onOutlineShape) { + this.onOutlineShape = onOutlineShape; + return this; + } + + public BlockBuilder onCollisionShapeRaw(Function onCollisionShape) { + this.onCollisionShape = onCollisionShape; + return this; + } + + public BlockBuilder onRenderType(Function onRenderType) { + this.onRenderType = onRenderType; + return this; + } + + public BlockBuilder onPlacementState(Function onPlacementState) { + this.onPlacementState = onPlacementState; + return this; + } + + public BlockBuilder onStateForNeighborUpdate(Function onStateForNeighborUpdate) { + this.onStateForNeighborUpdate = onStateForNeighborUpdate; + return this; + } + + public BlockBuilder setOutlineShape(VoxelShape shape) { + return onOutlineShape(e -> shape); + } + + public BlockBuilder setCollisionShape(VoxelShape shape) { + return onCollisionShape(e -> shape); + } + + public BlockBuilder setOutlineShape(net.minecraft.util.shape.VoxelShape shape) { + return onOutlineShapeRaw(e -> shape); + } + + public BlockBuilder setCollisionShape(net.minecraft.util.shape.VoxelShape shape) { + return onCollisionShapeRaw(e -> shape); + } + + public BlockBuilder setRenderType(CompatBlockRenderType renderType) { + return onRenderType(e -> renderType); + } + + public BlockBuilder onInit(BiConsumer onInit) { + this.onInit = onInit; + return this; + } + + public BlockBuilder setDefaultState(BlockState defaultState) { + this.defaultState = defaultState; + return this; + } + + private final List tooltip = new ArrayList<>(); + + public BlockBuilder addTooltip(TextComponent text) { + if (tooltip.isEmpty()) { + onAppendTooltip = e -> e.getTooltip().add(text.getText()); + } else { + onAppendTooltip = e -> { + for (TextComponent t : tooltip) { + e.getTooltip().add(t.getText()); + } + e.getTooltip().add(text.getText()); + }; + } + + this.tooltip.add(text); + return this; + } + + public BlockBuilder onDroppedStacksRaw(Function> onDroppedStacks) { + this.onDroppedStacks = onDroppedStacks; + return this; + } + + public BlockBuilder onDroppedStacks(Function> onDroppedStacks) { + return onDroppedStacksRaw(e -> onDroppedStacks.apply(e).stream() + .map(ItemStack::toMinecraft) + .toList()); + } + + public BlockBuilder write(BlockBuilder copy) { + copy.onRightClick = onRightClick; + copy.onStateReplaced = onStateReplaced; + copy.onAppendTooltip = onAppendTooltip; + copy.onAppendProperties = onAppendProperties; + copy.defaultState = defaultState; + copy.onInit = onInit; + copy.onOutlineShape = onOutlineShape; + copy.onCollisionShape = onCollisionShape; + copy.onRenderType = onRenderType; + copy.onPlacementState = onPlacementState; + copy.onStateForNeighborUpdate = onStateForNeighborUpdate; + copy.onDroppedStacks = onDroppedStacks; + + return copy; + } + + public BlockBuilder copy(BlockSettingsBuilder settingsBuilder) { + return write(new BlockBuilder(settingsBuilder)); + } + + public BlockBuilder copy() { + return copy(this.settingsBuilder.copy()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java new file mode 100644 index 000000000..b85331534 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java @@ -0,0 +1,88 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder; + +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.RewritableBlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockEntity; + +import java.util.Arrays; +import java.util.function.BiConsumer; + +public class BlockEntityBuilder { + + public BiConsumer onWriteNbt; + public BiConsumer onReadNbt; + public BiConsumer onInit; + + public CompatIdentifier id; + + public BlockEntityBuilder(CompatIdentifier id) { + this.id = id; + } + + public static BlockEntityBuilder of(CompatIdentifier id) { + return new BlockEntityBuilder(id); + } + + public BlockEntityTypeWrapper build(CompatRegistryV2 registry, CompatIdentifier id, BlockWrapper... blocks) { + RewritableBlockEntityTypeWrapper type = RewritableBlockEntityTypeWrapper.of(); + BlockEntityBuilder builder = this; + + SupplierResult> result = registry.registerBlockEntityType(id, BlockEntityTypeBuilder.create( + e -> new BuiltBlockEntity(type, builder, e), + Arrays.stream(blocks).map(BlockWrapper::get).toArray(Block[]::new) + )); + + type.set(result.get()); + + return type; + } + + public BlockEntityTypeWrapper build(CompatRegistryV2 registry, BlockWrapper... blocks) { + if (id == null) + throw new IllegalStateException("BlockEntity id is not set. hint: use build(CompatRegistryV2, CompatIdentifier, BlockWrapper...)"); + + return build(registry, id, blocks); + } + + public BlockEntityBuilder onInit(BiConsumer onInit) { + this.onInit = onInit; + return this; + } + + public BlockEntityBuilder onWriteNbt(BiConsumer onWriteNbt) { + this.onWriteNbt = onWriteNbt; + return this; + } + + public BlockEntityBuilder onReadNbt(BiConsumer onReadNbt) { + this.onReadNbt = onReadNbt; + return this; + } + + public BlockEntityBuilder write(BlockEntityBuilder copy) { + copy.onInit = this.onInit; + copy.onWriteNbt = this.onWriteNbt; + copy.onReadNbt = this.onReadNbt; + + return copy; + } + + public BlockEntityBuilder copy(CompatIdentifier id) { + return write(new BlockEntityBuilder(id)); + } + + public BlockEntityBuilder copy() { + return copy(this.id); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java new file mode 100644 index 000000000..16ce75a16 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java @@ -0,0 +1,107 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder; + +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.CommonModInitializer; +import net.pitan76.mcpitanlib.api.block.ExtendBlock; +import net.pitan76.mcpitanlib.api.block.v2.BlockSettingsBuilder; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.util.BlockEntityTypeUtil; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockWithEntity; + +import java.util.function.Supplier; + +public class BlockWithBlockEntityBuilder extends BlockBuilder { + + public Supplier> blockEntityType; + + public BlockWithBlockEntityBuilder(BlockSettingsBuilder settingsBuilder) { + super(settingsBuilder); + } + + public BlockWithBlockEntityBuilder(CompatIdentifier id) { + super(id); + } + + public BlockWithBlockEntityBuilder(BlockSettingsBuilder settingsBuilder, Supplier> blockEntityType) { + super(settingsBuilder); + this.blockEntityType = blockEntityType; + } + + public BlockWithBlockEntityBuilder(CompatIdentifier id, Supplier> blockEntityType) { + super(id); + this.blockEntityType = blockEntityType; + } + + @Override + public SupplierBlockWrapper build(CompatRegistryV2 registry) { + if (settingsBuilder.id == null) + throw new IllegalStateException("Block id is not set. hint: use build(CompatRegistryV2, CompatIdentifier)"); + + Supplier result = registry.registerExtendBlock(settingsBuilder.id, () -> new BuiltBlockWithEntity(this)); + + return SupplierBlockWrapper.of(result::get); + } + + @Override + public SupplierBlockWrapper build(CompatRegistryV2 registry, CompatIdentifier id) { + Supplier result = registry.registerExtendBlock(id, () -> new BuiltBlockWithEntity(this, id)); + + return SupplierBlockWrapper.of(result::get); + } + + public SupplierBlockWrapper build(CommonModInitializer initializer) { + return build(initializer.registry); + } + + public SupplierBlockWrapper build(CommonModInitializer initializer, CompatIdentifier id) { + return build(initializer.registry, id); + } + + public static BlockWithBlockEntityBuilder of(CompatIdentifier id) { + return new BlockWithBlockEntityBuilder(id); + } + + public static BlockWithBlockEntityBuilder of(BlockSettingsBuilder settingsBuilder) { + return new BlockWithBlockEntityBuilder(settingsBuilder); + } + + public static BlockWithBlockEntityBuilder of(CompatIdentifier id, Supplier> blockEntityType) { + return new BlockWithBlockEntityBuilder(id, blockEntityType); + } + + public static BlockWithBlockEntityBuilder of(BlockSettingsBuilder settingsBuilder, Supplier> blockEntityType) { + return new BlockWithBlockEntityBuilder(settingsBuilder, blockEntityType); + } + + public BlockWithBlockEntityBuilder applyBlockEntity(Supplier> blockEntityType) { + this.blockEntityType = blockEntityType; + return this; + } + + public BlockWithBlockEntityBuilder applyBlockEntity(BlockEntityType blockEntityType) { + this.blockEntityType = () -> blockEntityType; + return this; + } + + public BlockWithBlockEntityBuilder applyBlockEntity(CompatIdentifier id) { + return applyBlockEntity(BlockEntityTypeUtil.fromId(id)); + } + + public BlockWithBlockEntityBuilder write(BlockWithBlockEntityBuilder copy) { + copy.settingsBuilder = this.settingsBuilder; + copy.blockEntityType = this.blockEntityType; + super.write(copy); + + return copy; + } + + public BlockWithBlockEntityBuilder copy(BlockSettingsBuilder settingsBuilder) { + return write(new BlockWithBlockEntityBuilder(settingsBuilder)); + } + + public BlockWithBlockEntityBuilder copy() { + return copy(this.settingsBuilder.copy()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java new file mode 100644 index 000000000..14c4b6a1b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java @@ -0,0 +1,198 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder; + +import net.pitan76.mcpitanlib.api.CommonModInitializer; +import net.pitan76.mcpitanlib.api.event.item.*; +import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.item.ExtendItem; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.CompatRarity; +import net.pitan76.mcpitanlib.api.util.StackActionResult; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltItem; +import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.item.SupplierItemWrapper; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; + +public class ItemBuilder { + + public ItemSettingsBuilder settingsBuilder; + public Function onRightClick; + public Function onRightClickOnBlock; + public Function onRightClickOnEntity; + public Consumer onAppendTooltip; + public Function onItemBarColor; + public Function onItemBarStep; + + public ItemBuilder(ItemSettingsBuilder settingsBuilder) { + this.settingsBuilder = settingsBuilder; + } + + public ItemBuilder(CompatIdentifier id) { + this(new ItemSettingsBuilder(id)); + } + + public static ItemBuilder of(CompatIdentifier id) { + return new ItemBuilder(id); + } + + public static ItemBuilder of(ItemSettingsBuilder settingsBuilder) { + return new ItemBuilder(settingsBuilder); + } + + public SupplierItemWrapper build(CompatRegistryV2 registry) { + if (settingsBuilder.id == null) + throw new IllegalStateException("Item id is not set. hint: use build(CompatRegistryV2, CompatIdentifier)"); + + Supplier result = registry.registerExtendItem(settingsBuilder.id, () -> new BuiltItem(this)); + + return SupplierItemWrapper.of(result::get); + } + + public SupplierItemWrapper build(CompatRegistryV2 registry, CompatIdentifier id) { + Supplier result = registry.registerExtendItem(settingsBuilder.id, () -> new BuiltItem(this, id)); + + return SupplierItemWrapper.of(result::get); + } + + public SupplierItemWrapper build(CommonModInitializer initializer) { + return build(initializer.registry); + } + + public SupplierItemWrapper build(CommonModInitializer initializer, CompatIdentifier id) { + return build(initializer.registry, id); + } + + public ItemBuilder maxCount(int maxCount) { + settingsBuilder.maxCount(maxCount); + return this; + } + + public ItemBuilder maxDamage(int maxDamage) { + settingsBuilder.maxDamage(maxDamage); + return this; + } + + public ItemBuilder maxDamageIfAbsent(int maxDamage) { + settingsBuilder.maxDamageIfAbsent(maxDamage); + return this; + } + + public ItemBuilder food(CompatFoodComponent foodComponent) { + settingsBuilder.foodComponent(foodComponent); + return this; + } + + public ItemBuilder recipeRemainder(ItemWrapper recipeRemainder) { + settingsBuilder.recipeRemainder(recipeRemainder); + return this; + } + + public ItemBuilder enchantability(int enchantability) { + settingsBuilder.enchantability(enchantability); + return this; + } + + public ItemBuilder repairable(CompatIdentifier repairIngredientTag) { + settingsBuilder.repairable(repairIngredientTag); + return this; + } + + public ItemBuilder repairable(RepairIngredientTag repairIngredientTag) { + settingsBuilder.repairable(repairIngredientTag); + return this; + } + + public ItemBuilder rarity(CompatRarity rarity) { + settingsBuilder.rarity(rarity); + return this; + } + + public ItemBuilder group(ItemGroupWrapper itemGroup) { + settingsBuilder.addGroup(itemGroup); + return this; + } + + public ItemBuilder group(CreativeTabBuilder itemGroup) { + settingsBuilder.addGroup(itemGroup); + return this; + } + + public ItemBuilder onRightClick(Function onRightClick) { + this.onRightClick = onRightClick; + return this; + } + + public ItemBuilder onRightClickOnBlock(Function onRightClickOnBlock) { + this.onRightClickOnBlock = onRightClickOnBlock; + return this; + } + + public ItemBuilder onRightClickOnEntity(Function onRightClickOnEntity) { + this.onRightClickOnEntity = onRightClickOnEntity; + return this; + } + + public ItemBuilder onAppendTooltip(Consumer onAppendTooltip) { + this.onAppendTooltip = onAppendTooltip; + return this; + } + + public ItemBuilder onItemBarColor(Function onItemBarColor) { + this.onItemBarColor = onItemBarColor; + return this; + } + + public ItemBuilder onItemBarStep(Function onItemBarStep) { + this.onItemBarStep = onItemBarStep; + return this; + } + + private final List tooltip = new ArrayList<>(); + + public ItemBuilder addTooltip(TextComponent text) { + if (tooltip.isEmpty()) { + onAppendTooltip = e -> e.getTooltip().add(text.getText()); + } else { + onAppendTooltip = e -> { + for (TextComponent t : tooltip) { + e.getTooltip().add(t.getText()); + } + e.getTooltip().add(text.getText()); + }; + } + + this.tooltip.add(text); + return this; + } + + public ItemBuilder write(ItemBuilder copy) { + copy.settingsBuilder = this.settingsBuilder; + copy.onRightClick = this.onRightClick; + copy.onRightClickOnBlock = this.onRightClickOnBlock; + copy.onRightClickOnEntity = this.onRightClickOnEntity; + copy.onAppendTooltip = this.onAppendTooltip; + copy.onItemBarColor = this.onItemBarColor; + copy.onItemBarStep = this.onItemBarStep; + + return copy; + } + + public ItemBuilder copy(ItemSettingsBuilder builder) { + return write(new ItemBuilder(builder)); + } + + public ItemBuilder copy() { + return copy(this.settingsBuilder.copy()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java new file mode 100644 index 000000000..c74686013 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java @@ -0,0 +1,146 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder.built; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.shape.VoxelShape; +import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; +import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; +import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; +import net.pitan76.mcpitanlib.api.event.block.DroppedStacksArgs; +import net.pitan76.mcpitanlib.api.event.block.StateReplacedEvent; +import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.easybuilder.BlockBuilder; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.function.Consumer; +import java.util.function.Function; + +public class BuiltBlock extends CompatBlock { + + protected Function onRightClick; + protected Consumer onStateReplaced; + protected Consumer onAppendTooltip; + protected Consumer onAppendProperties; + protected Function onOutlineShape; + protected Function onCollisionShape; + protected Function onRenderType; + protected Function onPlacementState; + protected Function onStateForNeighborUpdate; + protected Function> onDroppedStacks; + + public BuiltBlock(CompatibleBlockSettings settings) { + super(settings); + } + + public BuiltBlock(BlockBuilder builder) { + this(builder.settingsBuilder.build()); + init(builder); + } + + public BuiltBlock(BlockBuilder builder, CompatIdentifier id) { + this(builder.settingsBuilder.build(id)); + init(builder); + } + + protected void init(BlockBuilder builder) { + this.onRightClick = builder.onRightClick; + this.onStateReplaced = builder.onStateReplaced; + this.onAppendTooltip = builder.onAppendTooltip; + this.onAppendProperties = builder.onAppendProperties; + this.onOutlineShape = builder.onOutlineShape; + this.onCollisionShape = builder.onCollisionShape; + this.onRenderType = builder.onRenderType; + this.onPlacementState = builder.onPlacementState; + this.onStateForNeighborUpdate = builder.onStateForNeighborUpdate; + + if (builder.onInit != null) + builder.onInit.accept(this.getWrapper(), builder); + + if (builder.defaultState != null) + this.setDefaultState(builder.defaultState); + } + + @Override + public CompatActionResult onRightClick(BlockUseEvent e) { + if (onRightClick == null) + return e.pass(); + + return onRightClick.apply(e); + } + + @Override + public void onStateReplaced(StateReplacedEvent e) { + if (onStateReplaced != null) + onStateReplaced.accept(e); + } + + @Override + public void appendTooltip(ItemAppendTooltipEvent e) { + if (onAppendTooltip != null) + onAppendTooltip.accept(e); + } + + @Override + public void appendProperties(AppendPropertiesArgs args) { + if (onAppendProperties != null) + onAppendProperties.accept(args); + } + + @Override + public VoxelShape getOutlineShape(OutlineShapeEvent e) { + if (onOutlineShape != null) + return onOutlineShape.apply(e); + + return super.getOutlineShape(e); + } + + @Override + public VoxelShape getCollisionShape(CollisionShapeEvent e) { + if (onCollisionShape != null) + return onCollisionShape.apply(e); + + return super.getCollisionShape(e); + } + + @Override + public CompatBlockRenderType getRenderType(RenderTypeArgs args) { + if (onRenderType != null) + return onRenderType.apply(args); + + return super.getRenderType(args); + } + + @Override + public @Nullable BlockState getPlacementState(PlacementStateArgs args) { + if (onPlacementState != null) + return onPlacementState.apply(args); + + return super.getPlacementState(args); + } + + @Override + public BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { + if (onStateForNeighborUpdate != null) + return onStateForNeighborUpdate.apply(args); + + return super.getStateForNeighborUpdate(args); + } + + @Override + public List getDroppedStacks(DroppedStacksArgs args) { + if (onDroppedStacks != null) + return onDroppedStacks.apply(args); + + return super.getDroppedStacks(args); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java new file mode 100644 index 000000000..4143b69e7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java @@ -0,0 +1,65 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder.built; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.BlockEntityBuilder; + +import java.util.function.BiConsumer; + +public class BuiltBlockEntity extends CompatBlockEntity { + + public BiConsumer onWriteNbt; + public BiConsumer onReadNbt; + + public BuiltBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + public BuiltBlockEntity(BlockEntityType type, TileCreateEvent e) { + super(type, e); + } + + public BuiltBlockEntity(BlockEntityTypeWrapper type, TileCreateEvent e) { + super(type.get(), e); + } + + public BuiltBlockEntity(BlockEntityTypeWrapper type, BlockEntityBuilder builder, TileCreateEvent e) { + this(type, e); + init(builder); + } + + protected void init(BlockEntityBuilder builder) { + this.onWriteNbt = builder.onWriteNbt; + this.onReadNbt = builder.onReadNbt; + + if (builder.onInit != null) + builder.onInit.accept(_wrap(), builder); + } + + @Override + public void writeNbt(WriteNbtArgs args) { + super.writeNbt(args); + if (onWriteNbt != null) { + onWriteNbt.accept(_wrap(), args); + } + } + + @Override + public void readNbt(ReadNbtArgs args) { + super.readNbt(args); + if (onReadNbt != null) { + onReadNbt.accept(_wrap(), args); + } + } + + public BlockEntityWrapper _wrap() { + return BlockEntityWrapper.of(this); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java new file mode 100644 index 000000000..6297eb9c0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder.built; + +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.block.ExtendBlockEntityProvider; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.easybuilder.BlockWithBlockEntityBuilder; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Supplier; + +public class BuiltBlockWithEntity extends BuiltBlock implements ExtendBlockEntityProvider { + + public Supplier> blockEntityType; + + public BuiltBlockWithEntity(CompatibleBlockSettings settings) { + super(settings); + } + + public BuiltBlockWithEntity(BlockWithBlockEntityBuilder builder) { + super(builder); + + this.blockEntityType = builder.blockEntityType; + } + + public BuiltBlockWithEntity(BlockWithBlockEntityBuilder builder, CompatIdentifier id) { + super(builder, id); + + this.blockEntityType = builder.blockEntityType; + } + + @Override + public @Nullable BlockEntityType getBlockEntityType() { + if (blockEntityType == null) + return null; + + return (BlockEntityType) blockEntityType.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java new file mode 100644 index 000000000..bd7ff8330 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java @@ -0,0 +1,91 @@ +package net.pitan76.mcpitanlib.midohra.easybuilder.built; + +import net.pitan76.mcpitanlib.api.event.item.*; +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.StackActionResult; +import net.pitan76.mcpitanlib.midohra.easybuilder.ItemBuilder; + +import java.util.function.Consumer; +import java.util.function.Function; + +public class BuiltItem extends CompatItem { + + protected Function onRightClick; + protected Function onRightClickOnBlock; + protected Function onRightClickOnEntity; + protected Consumer onAppendTooltip; + protected Function onItemBarColor; + protected Function onItemBarStep; + + protected BuiltItem(CompatibleItemSettings settings) { + super(settings); + } + + public BuiltItem(ItemBuilder builder) { + this(builder.settingsBuilder.build()); + init(builder); + } + + public BuiltItem(ItemBuilder builder, CompatIdentifier id) { + this(builder.settingsBuilder.build(id)); + init(builder); + } + + protected void init(ItemBuilder builder) { + this.onRightClick = builder.onRightClick; + this.onRightClickOnBlock = builder.onRightClickOnBlock; + this.onRightClickOnEntity = builder.onRightClickOnEntity; + this.onAppendTooltip = builder.onAppendTooltip; + this.onItemBarColor = builder.onItemBarColor; + this.onItemBarStep = builder.onItemBarStep; + } + + @Override + public StackActionResult onRightClick(ItemUseEvent e) { + if (onRightClick == null) + return e.pass(); + + return onRightClick.apply(e); + } + + @Override + public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent e) { + if (onRightClickOnBlock == null) + return e.pass(); + + return onRightClickOnBlock.apply(e); + } + + @Override + public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent e) { + if (onRightClickOnEntity == null) + return e.pass(); + + return onRightClickOnEntity.apply(e); + } + + @Override + public void appendTooltip(ItemAppendTooltipEvent e) { + if (onAppendTooltip != null) + onAppendTooltip.accept(e); + } + + @Override + public int getItemBarColor(ItemBarColorArgs args) { + if (onItemBarColor != null) + return onItemBarColor.apply(args); + + return super.getItemBarColor(args); + } + + @Override + public int getItemBarStep(ItemBarStepArgs args) { + if (onItemBarStep != null) + return onItemBarStep.apply(args); + + return super.getItemBarStep(args); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java new file mode 100644 index 000000000..d8a931e3c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java @@ -0,0 +1,95 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.entity.Entity; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.EntityTypeUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import org.jspecify.annotations.Nullable; + +import java.util.function.Consumer; + +public class EntityTypeWrapper { + private final net.minecraft.entity.EntityType entityType; + + protected EntityTypeWrapper() { + this.entityType = null; + } + + protected EntityTypeWrapper(net.minecraft.entity.EntityType entityType) { + this.entityType = entityType; + } + + public static EntityTypeWrapper of(net.minecraft.entity.EntityType entityType) { + return new EntityTypeWrapper(entityType); + } + + public static EntityTypeWrapper of() { + return new EntityTypeWrapper(); + } + + public boolean isExist() { + return !isEmpty(); + } + + public boolean isEmpty() { + return entityType == null; + } + + public net.minecraft.entity.EntityType get() { + return entityType; + } + + public CompatIdentifier getId() { + if (isEmpty()) return CompatIdentifier.empty(); + return EntityTypeUtil.toCompatID(entityType); + } + + public TextComponent getName() { + if (isEmpty()) return TextComponent.of(""); + return new TextComponent(EntityTypeUtil.getName(entityType)); + } + + public String getTranslationKey() { + if (isEmpty()) return ""; + return EntityTypeUtil.getTranslationKey(entityType); + } + + public boolean rawEquals(EntityTypeWrapper other) { + return entityType == other.entityType; + } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + EntityTypeWrapper other = (EntityTypeWrapper) obj; + return rawEquals(other); + } + + public EntityWrapper createEntity(ServerWorld world, SpawnReason spawnReason) { + if (isEmpty()) return EntityWrapper.of(); + return EntityWrapper.of(get().create(world.getRaw(), spawnReason.getRaw())); + } + + public EntityWrapper createEntity(ServerWorld world) { + return createEntity(world, SpawnReason.NATURAL); + } + + public EntityWrapper createEntity(ServerWorld world, @Nullable Consumer afterConsumer, BlockPos pos, SpawnReason reason, boolean alignPosition, boolean invertY) { + if (isEmpty()) return EntityWrapper.of(); + + Consumer consumer = afterConsumer != null ? entity -> { + EntityWrapper wrapper = EntityWrapper.of((Entity) entity); + afterConsumer.accept(wrapper); + } : null; + + return EntityWrapper.of(get().create(world.getRaw(), consumer, pos.toMinecraft(), reason.getRaw(), alignPosition, invertY)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java new file mode 100644 index 000000000..a7c65bbfe --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java @@ -0,0 +1,75 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.entity.EntityType; + +public class EntityTypes { + public static final EntityTypeWrapper BOAT = EntityTypeWrapper.of(EntityType.OAK_BOAT); + public static final EntityTypeWrapper ACACIA_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ACACIA_BOAT); + public static final EntityTypeWrapper ACACIA_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ACACIA_CHEST_BOAT); + public static final EntityTypeWrapper BIRCH_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BIRCH_BOAT); + public static final EntityTypeWrapper BIRCH_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BIRCH_CHEST_BOAT); + public static final EntityTypeWrapper DARK_OAK_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DARK_OAK_BOAT); + public static final EntityTypeWrapper DARK_OAK_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DARK_OAK_CHEST_BOAT); + public static final EntityTypeWrapper JUNGLE_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.JUNGLE_BOAT); + public static final EntityTypeWrapper JUNGLE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.JUNGLE_CHEST_BOAT); + public static final EntityTypeWrapper SPRUCE_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SPRUCE_BOAT); + public static final EntityTypeWrapper SPRUCE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SPRUCE_CHEST_BOAT); + public static final EntityTypeWrapper FURNACE_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FURNACE_MINECART); + public static final EntityTypeWrapper HOPPER_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HOPPER_MINECART); + public static final EntityTypeWrapper MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MINECART); + public static final EntityTypeWrapper TNT_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.TNT_MINECART); + public static final EntityTypeWrapper CHEST_MINECART = EntityTypeWrapper.of(EntityType.CHEST_MINECART); + public static final EntityTypeWrapper HORSE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HORSE); + public static final EntityTypeWrapper LLAMA = EntityTypeWrapper.of(net.minecraft.entity.EntityType.LLAMA); + + public static final EntityTypeWrapper ITEM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ITEM); + public static final EntityTypeWrapper ITEM_DISPLAY = EntityTypeWrapper.of(EntityType.ITEM_DISPLAY); + public static final EntityTypeWrapper ITEM_FRAME = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ITEM_FRAME); + public static final EntityTypeWrapper GLOW_ITEM_FRAME = EntityTypeWrapper.of(EntityType.GLOW_ITEM_FRAME); + public static final EntityTypeWrapper EXPERIENCE_BOTTLE = EntityTypeWrapper.of(EntityType.EXPERIENCE_BOTTLE); + public static final EntityTypeWrapper EXPERIENCE_ORB = EntityTypeWrapper.of(EntityType.EXPERIENCE_ORB); + + public static final EntityTypeWrapper SNOWBALL = EntityTypeWrapper.of(EntityType.SNOWBALL); + public static final EntityTypeWrapper FIREBALL = EntityTypeWrapper.of(EntityType.FIREBALL); + public static final EntityTypeWrapper SMALL_FIREBALL = EntityTypeWrapper.of(EntityType.SMALL_FIREBALL); + public static final EntityTypeWrapper DRAGON_FIREBALL = EntityTypeWrapper.of(EntityType.DRAGON_FIREBALL); + public static final EntityTypeWrapper FIREWORK_ROCKET = EntityTypeWrapper.of(EntityType.FIREWORK_ROCKET); + + public static final EntityTypeWrapper ALLAY = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ALLAY); + public static final EntityTypeWrapper AXOLOTL = EntityTypeWrapper.of(net.minecraft.entity.EntityType.AXOLOTL); + public static final EntityTypeWrapper BAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BAT); + public static final EntityTypeWrapper BEE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BEE); + public static final EntityTypeWrapper BLAZE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BLAZE); + public static final EntityTypeWrapper CAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CAT); + public static final EntityTypeWrapper CHICKEN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CHICKEN); + public static final EntityTypeWrapper COD = EntityTypeWrapper.of(net.minecraft.entity.EntityType.COD); + public static final EntityTypeWrapper COW = EntityTypeWrapper.of(net.minecraft.entity.EntityType.COW); + public static final EntityTypeWrapper CREEPER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CREEPER); + public static final EntityTypeWrapper DOLPHIN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DOLPHIN); + public static final EntityTypeWrapper DONKEY = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DONKEY); + public static final EntityTypeWrapper DROWNED = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DROWNED); + public static final EntityTypeWrapper ELDER_GUARDIAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ELDER_GUARDIAN); + public static final EntityTypeWrapper ENDER_DRAGON = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDER_DRAGON); + public static final EntityTypeWrapper ENDERMAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDERMAN); + public static final EntityTypeWrapper ENDERMITE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDERMITE); + public static final EntityTypeWrapper EVOKER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.EVOKER); + public static final EntityTypeWrapper FOX = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FOX); + public static final EntityTypeWrapper FROG = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FROG); + public static final EntityTypeWrapper GHAST = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GHAST); + public static final EntityTypeWrapper GIANT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GIANT); + public static final EntityTypeWrapper GLOW_SQUID = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GLOW_SQUID); + public static final EntityTypeWrapper GOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GOAT); + public static final EntityTypeWrapper GUARDIAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GUARDIAN); + public static final EntityTypeWrapper HUSK = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HUSK); + public static final EntityTypeWrapper ILLUSIONER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ILLUSIONER); + public static final EntityTypeWrapper IRON_GOLEM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.IRON_GOLEM); + public static final EntityTypeWrapper LLAMA_SPIT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.LLAMA_SPIT); + public static final EntityTypeWrapper MAGMA_CUBE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MAGMA_CUBE); + public static final EntityTypeWrapper MARKER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MARKER); + public static final EntityTypeWrapper MOOSHROOM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MOOSHROOM); + public static final EntityTypeWrapper MULE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MULE); + public static final EntityTypeWrapper SKELETON = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SKELETON); + public static final EntityTypeWrapper VILLAGER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.VILLAGER); + public static final EntityTypeWrapper ZOMBIE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ZOMBIE); + public static final EntityTypeWrapper ZOMBIE_VILLAGER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ZOMBIE_VILLAGER); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java new file mode 100644 index 000000000..5a019773e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java @@ -0,0 +1,334 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.pitan76.mcpitanlib.api.entity.CompatEntity; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.EntityUtil; +import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import net.pitan76.mcpitanlib.midohra.world.World; + +import java.util.Optional; +import java.util.UUID; + +public class EntityWrapper { + private final net.minecraft.entity.Entity entity; + + public static final EntityWrapper EMPTY = new EntityWrapper(null); + + protected EntityWrapper() { + this.entity = null; + } + + protected EntityWrapper(net.minecraft.entity.Entity entity) { + this.entity = entity; + } + + public static EntityWrapper of(net.minecraft.entity.Entity entity) { + return new EntityWrapper(entity); + } + + public static EntityWrapper of() { + return EMPTY; + } + + public boolean isPresent() { + return !isEmpty(); + } + + public boolean isEmpty() { + return get() == null; + } + + public net.minecraft.entity.Entity get() { + return entity; + } + + public EntityTypeWrapper getType() { + return EntityTypeWrapper.of(get().getType()); + } + + public Vector3d getPos() { + return EntityUtil.getPosM(get()); + } + + public void setPos(double x, double y, double z) { + EntityUtil.setPos(get(), x, y, z); + } + + public void setPos(Vector3d pos) { + EntityUtil.setPos(get(), pos); + } + + public void setPos(BlockPos pos) { + EntityUtil.setPos(get(), pos); + } + + public void teleport(double x, double y, double z) { + EntityUtil.teleport(get(), x, y, z); + } + + public void teleport(Vector3d pos) { + EntityUtil.teleport(get(), pos); + } + + public void teleport(BlockPos pos) { + EntityUtil.teleport(get(), pos); + } + + public void teleport(ServerWorld world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + EntityUtil.teleport(get(), world.getRaw(), x, y, z, yaw, pitch, resetCamera); + } + + public void teleport(ServerWorld world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { + EntityUtil.teleport(get(), world.getRaw(), pos, yaw, pitch, resetCamera); + } + + public void teleport(ServerWorld world, BlockPos pos, float yaw, float pitch, boolean resetCamera) { + EntityUtil.teleport(get(), world.getRaw(), pos, yaw, pitch, resetCamera); + } + + public void teleport(ServerWorld world, double x, double y, double z) { + EntityUtil.teleport(get(), world.getRaw(), x, y, z); + } + + public void teleport(ServerWorld world, Vector3d pos) { + EntityUtil.teleport(get(), world.getRaw(), pos); + } + + public void teleport(ServerWorld world, BlockPos pos) { + EntityUtil.teleport(get(), world.getRaw(), pos); + } + + public BlockPos getBlockPos() { + return BlockPos.of(get().getBlockPos()); + } + + public World getWorld() { + return World.of(EntityUtil.getWorld(get())); + } + + public boolean isRemoved() { + return get().isRemoved(); + } + + public void discard() { + EntityUtil.discard(get()); + } + + public void kill() { + EntityUtil.kill(get()); + } + + public float getPitch() { + return EntityUtil.getPitch(get()); + } + + public float getYaw() { + return EntityUtil.getYaw(get()); + } + + public float getSpeed() { + return EntityUtil.getSpeed(get()); + } + + public TextComponent getCustomName() { + return new TextComponent(EntityUtil.getCustomName(get())); + } + + public TextComponent getName() { + return new TextComponent(EntityUtil.getName(get())); + } + + public String getNameAsString() { + return EntityUtil.getNameAsString(get()); + } + + public String getCustomNameAsString() { + return EntityUtil.getCustomNameAsString(get()); + } + + public UUID getUuid() { + return EntityUtil.getUuid(get()); + } + + public String getUuidString() { + return EntityUtil.getUuidString(get()); + } + + public boolean isSneaking() { + return EntityUtil.isSneaking(get()); + } + + public boolean isSprinting() { + return EntityUtil.isSprinting(get()); + } + + public boolean isSwimming() { + return EntityUtil.isSwimming(get()); + } + + public boolean isAlive() { + return EntityUtil.isAlive(get()); + } + + public boolean isOnGround() { + return EntityUtil.isOnGround(get()); + } + + public boolean isGlowing() { + return EntityUtil.isGlowing(get()); + } + + public boolean isInvisible() { + return EntityUtil.isInvisible(get()); + } + + public boolean isInvulnerable() { + return EntityUtil.isInvulnerable(get()); + } + + public boolean isSilent() { + return EntityUtil.isSilent(get()); + } + + public boolean isOnFire() { + return EntityUtil.isOnFire(get()); + } + + public boolean isRiding() { + return EntityUtil.isRiding(get()); + } + + public boolean isVelocityModified() { + return EntityUtil.isVelocityModified(get()); + } + + public boolean isCustomNameVisible() { + return EntityUtil.isCustomNameVisible(get()); + } + + public TextComponent getDisplayName() { + return new TextComponent(EntityUtil.getDisplayName(get())); + } + + public double getFallDistance() { + return EntityUtil.getFallDistance(get()); + } + + public boolean isLivingEntity() { + return get() instanceof LivingEntity; + } + + public boolean damageByMobAttack(float damageAmount, EntityWrapper source, EntityWrapper attacker) { + return EntityUtil.damageWithMobAttack(get(), damageAmount, source.get(), (LivingEntity) attacker.get()); + } + + public boolean damageByPlayerAttack(float damageAmount, EntityWrapper source, Player attacker) { + return EntityUtil.damageWithPlayerAttack(get(), damageAmount, source.get(), attacker); + } + + public boolean damageWithThrownProjectile(float damageAmount, EntityWrapper source, EntityWrapper projectile) { + return EntityUtil.damageWithThrownProjectile(get(), damageAmount, source.get(), projectile.get()); + } + + public boolean damageWithMobProjectile(float damageAmount, EntityWrapper projectile, EntityWrapper attacker) { + return EntityUtil.damageWithMobProjectile(get(), damageAmount, projectile.get(), (LivingEntity) attacker.get()); + } + + public boolean setVelocity(double x, double y, double z) { + EntityUtil.setVelocity(get(), x, y, z); + return true; + } + + public void setVelocity(Vector3d velocity) { + EntityUtil.setVelocity(get(), velocity); + } + + public void addVelocity(double x, double y, double z) { + EntityUtil.addVelocity(get(), x, y, z); + } + + public void addVelocity(Vector3d velocity) { + EntityUtil.addVelocity(get(), velocity); + } + + public Vector3d getVelocity() { + return Vector3d.of(EntityUtil.getVelocity(get())); + } + + public boolean setCustomName(TextComponent name) { + EntityUtil.setCustomName(get(), name.getText()); + return true; + } + + public boolean setInvulnerable(boolean invulnerable) { + EntityUtil.setInvulnerable(get(), invulnerable); + return true; + } + + public boolean setNoGravity(boolean noGravity) { + EntityUtil.setNoGravity(get(), noGravity); + return true; + } + + public boolean setGlowing(boolean glowing) { + EntityUtil.setGlowing(get(), glowing); + return true; + } + + public boolean setInvisible(boolean invisible) { + EntityUtil.setInvisible(get(), invisible); + return true; + } + + public boolean setSilent(boolean silent) { + EntityUtil.setSilent(get(), silent); + return true; + } + + public boolean setFire(int seconds) { + EntityUtil.setFire(get(), seconds); + return true; + } + + public boolean setCustomNameVisible(boolean visible) { + EntityUtil.setCustomNameVisible(get(), visible); + return true; + } + + public EntityWrapper getVehicle() { + return EntityWrapper.of(get().getVehicle()); + } + + public EntityWrapper getRootVehicle() { + return EntityWrapper.of(get().getRootVehicle()); + } + + public EntityWrapper getPassenger(int index) { + return EntityWrapper.of(get().getPassengerList().get(index)); + } + + public int getPassengerCount() { + return get().getPassengerList().size(); + } + + public Class getEntityClass() { + return get().getClass(); + } + + public Optional toCompatEntity() { + if (get() instanceof CompatEntity) { + return Optional.of((CompatEntity) get()); + } + return Optional.empty(); + } + + public void spawn(World world) { + world.spawnEntity(this); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java new file mode 100644 index 000000000..0336723b2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java @@ -0,0 +1,79 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class ItemEntityWrapper extends EntityWrapper { + public ItemEntityWrapper(net.minecraft.entity.ItemEntity entity) { + super(entity); + } + + public static ItemEntityWrapper of(net.minecraft.entity.ItemEntity entity) { + return new ItemEntityWrapper(entity); + } + + @Override + public net.minecraft.entity.ItemEntity get() { + return (net.minecraft.entity.ItemEntity) super.get(); + } + + public net.minecraft.item.ItemStack getStackRaw() { + return ItemEntityUtil.getStack(get()); + } + + public ItemStack getStack() { + return ItemStack.of(getStackRaw()); + } + + public void setStack(net.minecraft.item.ItemStack stack) { + get().setStack(stack); + } + + public void setStack(ItemStack stack) { + setStack(stack.toMinecraft()); + } + + public ItemWrapper getItem() { + return getStack().getItem(); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, double x, double y, double z) { + return of(ItemEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft())); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, Vector3d pos) { + return create(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + return of(ItemEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft(), velocityX, velocityY, velocityZ)); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, Vector3d pos, Vector3d velocity) { + return create(stack, world, pos.getX(), pos.getY(), pos.getZ(), velocity.getX(), velocity.getY(), velocity.getZ()); + } + + public static ItemEntityWrapper create(ItemStack stack, World world, BlockPos pos) { + return create(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, double x, double y, double z) { + return of(ItemEntityUtil.createWithSpawn(world.toMinecraft(), stack.toMinecraft(), x, y, z)); + } + + public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, Vector3d pos) { + return createWithSpawn(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, BlockPos pos) { + return createWithSpawn(stack, world, pos.getX(), pos.getY(), pos.getZ()); + } + + public void setToDefaultPickupDelay() { + ItemEntityUtil.setToDefaultPickupDelay(get()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java new file mode 100644 index 000000000..c5fe6a6d3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +public class SpawnReason { + private final net.minecraft.entity.SpawnReason raw; + + public static final SpawnReason NATURAL = of(net.minecraft.entity.SpawnReason.NATURAL); + public static final SpawnReason CHUNK_GENERATION = of(net.minecraft.entity.SpawnReason.CHUNK_GENERATION); + public static final SpawnReason SPAWNER = of(net.minecraft.entity.SpawnReason.SPAWNER); + public static final SpawnReason STRUCTURE = of(net.minecraft.entity.SpawnReason.STRUCTURE); + public static final SpawnReason BREEDING = of(net.minecraft.entity.SpawnReason.BREEDING); + public static final SpawnReason MOB_SUMMONED = of(net.minecraft.entity.SpawnReason.MOB_SUMMONED); + public static final SpawnReason JOCKEY = of(net.minecraft.entity.SpawnReason.JOCKEY); + public static final SpawnReason EVENT = of(net.minecraft.entity.SpawnReason.EVENT); + public static final SpawnReason CONVERSION = of(net.minecraft.entity.SpawnReason.CONVERSION); + public static final SpawnReason REINFORCEMENT = of(net.minecraft.entity.SpawnReason.REINFORCEMENT); + public static final SpawnReason TRIGGERED = of(net.minecraft.entity.SpawnReason.TRIGGERED); + public static final SpawnReason BUCKET = of(net.minecraft.entity.SpawnReason.BUCKET); + public static final SpawnReason SPAWN_ITEM_USE = of(net.minecraft.entity.SpawnReason.SPAWN_ITEM_USE); + public static final SpawnReason COMMAND = of(net.minecraft.entity.SpawnReason.COMMAND); + public static final SpawnReason DISPENSER = of(net.minecraft.entity.SpawnReason.DISPENSER); + public static final SpawnReason PATROL = of(net.minecraft.entity.SpawnReason.PATROL); + public static final SpawnReason TRIAL_SPAWNER = of(net.minecraft.entity.SpawnReason.TRIAL_SPAWNER); + public static final SpawnReason LOAD = of(net.minecraft.entity.SpawnReason.LOAD); + public static final SpawnReason DIMENSION_TRAVEL = of(net.minecraft.entity.SpawnReason.DIMENSION_TRAVEL); + + protected SpawnReason(net.minecraft.entity.SpawnReason raw) { + this.raw = raw; + } + + public static SpawnReason of(net.minecraft.entity.SpawnReason raw) { + return new SpawnReason(raw); + } + + public net.minecraft.entity.SpawnReason getRaw() { + return raw; + } + + @Override + public int hashCode() { + return raw.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + SpawnReason other = (SpawnReason) obj; + return raw == other.raw; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java new file mode 100644 index 000000000..720de5698 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java @@ -0,0 +1,100 @@ +package net.pitan76.mcpitanlib.midohra.fluid; + +import net.minecraft.fluid.FluidState; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.FluidStateUtil; +import net.pitan76.mcpitanlib.api.util.FluidUtil; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import org.jetbrains.annotations.Nullable; + +public class FluidWrapper { + private final net.minecraft.fluid.Fluid fluid; + + protected FluidWrapper() { + this.fluid = null; + } + + protected FluidWrapper(net.minecraft.fluid.Fluid fluid) { + this.fluid = fluid; + } + + public static FluidWrapper of(net.minecraft.fluid.Fluid fluid) { + return new FluidWrapper(fluid); + } + + public static FluidWrapper of() { + return new FluidWrapper(); + } + + public static FluidWrapper of(CompatIdentifier id) { + if (FluidUtil.isExist(id)) + return of(FluidUtil.fromId(id)); + + return of(); + } + + public static FluidWrapper of(CompatIdentifier id, CompatIdentifier... ids) { + if (of(id).isExist()) return of(id); + + for (CompatIdentifier id1 : ids) { + if (of(id1).isExist()) + return of(id1); + } + + return of(); + } + + public boolean isExist() { + return !isEmpty(); + } + + public boolean isEmpty() { + return get() == null; + } + + @Nullable + public net.minecraft.fluid.Fluid get() { + return fluid; + } + + public net.minecraft.fluid.Fluid gerOrDefault(net.minecraft.fluid.Fluid defaultFluid) { + return isEmpty() ? defaultFluid : get(); + } + + public CompatIdentifier getId() { + if (isEmpty()) + return CompatIdentifier.empty(); + + return FluidUtil.toCompatId(get()); + } + + public String getName() { + if (isEmpty()) return ""; + return get().toString(); + } + + public FluidState getDefaultState() { + return FluidStateUtil.getDefaultState(get()); + } + + public ItemWrapper getBucketItem() { + return ItemWrapper.of(FluidUtil.getBucketItem(get())); + } + + public boolean rawEquals(FluidWrapper fluid) { + return get() == fluid.get(); + } + + @Override + public int hashCode() { + return isEmpty() ? 0 : get().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + FluidWrapper other = (FluidWrapper) obj; + return rawEquals(other); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java new file mode 100644 index 000000000..15a200faa --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java @@ -0,0 +1,9 @@ +package net.pitan76.mcpitanlib.midohra.fluid; + +public class Fluids { + public static final FluidWrapper EMPTY = FluidWrapper.of(net.minecraft.fluid.Fluids.EMPTY); + public static final FluidWrapper WATER = FluidWrapper.of(net.minecraft.fluid.Fluids.WATER); + public static final FluidWrapper LAVA = FluidWrapper.of(net.minecraft.fluid.Fluids.LAVA); + public static final FluidWrapper FLOWING_WATER = FluidWrapper.of(net.minecraft.fluid.Fluids.FLOWING_WATER); + public static final FluidWrapper FLOWING_LAVA = FluidWrapper.of(net.minecraft.fluid.Fluids.FLOWING_LAVA); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java new file mode 100644 index 000000000..9601ef3d1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.midohra.holder; + +import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; +import net.pitan76.mcpitanlib.api.state.property.IProperty; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.util.math.Direction; + +public interface BlockStatePropertyHolder { + BlockState getBlockState(); + + default , V extends T> BlockState with(IProperty property, V value) { + return getBlockState().with(property, value); + } + + default boolean has(IProperty property) { + return getBlockState().contains(property); + } + + default > T get(IProperty property) { + return getBlockState().get(property); + } + + default > BlockState cycle(IProperty property) { + return getBlockState().cycle(property); + } + + // DirectionProperty + default BlockState with(DirectionProperty property, Direction value) { + return with(property, value.toMinecraft()); + } + + default Direction get(DirectionProperty property) { + return Direction.of(get((IProperty) property)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java new file mode 100644 index 000000000..2773aaa7a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.item.ItemGroupUtil; + +public class ItemGroupWrapper { + private final net.minecraft.item.ItemGroup itemGroup; + + protected ItemGroupWrapper() { + this.itemGroup = null; + } + + protected ItemGroupWrapper(net.minecraft.item.ItemGroup itemGroup) { + this.itemGroup = itemGroup; + } + + public static ItemGroupWrapper of(net.minecraft.item.ItemGroup itemGroup) { + return new ItemGroupWrapper(itemGroup); + } + + public static ItemGroupWrapper of(CompatIdentifier id) { + if (ItemGroupUtil.isExist(id)) + return of(ItemGroupUtil.fromId(id)); + + return of(); + } + + public static ItemGroupWrapper of() { + return new ItemGroupWrapper(); + } + + public boolean isPresent() { + return !isEmpty(); + } + + public boolean isEmpty() { + return itemGroup == null; + } + + public net.minecraft.item.ItemGroup get() { + return itemGroup; + } + + public CompatIdentifier getId() { + if (isEmpty()) return CompatIdentifier.empty(); + return ItemGroupUtil.toCompatID(itemGroup); + } + + public ItemStack getIcon() { + if (isEmpty()) return ItemStack.EMPTY; + return ItemStack.of(itemGroup.getIcon()); + } + + public boolean rawEquals(ItemGroupWrapper other) { + return itemGroup == other.itemGroup; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java new file mode 100644 index 000000000..7ceefce5a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.pitan76.mcpitanlib.api.item.DefaultItemGroups; + +public class ItemGroups { + public static final ItemGroupWrapper BUILDING_BLOCKS = of(DefaultItemGroups.BUILDING_BLOCKS); + public static final ItemGroupWrapper COLORED_BLOCKS = of(DefaultItemGroups.COLORED_BLOCKS); + public static final ItemGroupWrapper NATURAL = of(DefaultItemGroups.NATURAL); + public static final ItemGroupWrapper FUNCTIONAL = of(DefaultItemGroups.FUNCTIONAL); + public static final ItemGroupWrapper REDSTONE = of(DefaultItemGroups.REDSTONE); + public static final ItemGroupWrapper HOTBAR = of(DefaultItemGroups.HOTBAR); + public static final ItemGroupWrapper SEARCH = of(DefaultItemGroups.SEARCH); + public static final ItemGroupWrapper TOOLS = of(DefaultItemGroups.TOOLS); + public static final ItemGroupWrapper COMBAT = of(DefaultItemGroups.COMBAT); + public static final ItemGroupWrapper FOOD_AND_DRINK = of(DefaultItemGroups.FOOD_AND_DRINK); + public static final ItemGroupWrapper INGREDIENTS = of(DefaultItemGroups.INGREDIENTS); + public static final ItemGroupWrapper SPAWN_EGGS = of(DefaultItemGroups.SPAWN_EGGS); + public static final ItemGroupWrapper OPERATOR = of(DefaultItemGroups.OPERATOR); + public static final ItemGroupWrapper INVENTORY = of(DefaultItemGroups.INVENTORY); + + // - 1.19.2 Item Group + public static final ItemGroupWrapper BREWING = FOOD_AND_DRINK; + public static final ItemGroupWrapper TRANSPORTATION = FUNCTIONAL; + public static final ItemGroupWrapper DECORATIONS = NATURAL; + public static final ItemGroupWrapper MISC = INGREDIENTS; + + private static ItemGroupWrapper of(net.minecraft.item.ItemGroup itemGroup) { + return ItemGroupWrapper.of(itemGroup); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java new file mode 100644 index 000000000..4bf936e58 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java @@ -0,0 +1,222 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemConvertible; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.text.Text; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; +import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.*; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Map; + +public class ItemStack { + private final net.minecraft.item.ItemStack stack; + public static final ItemStack EMPTY = new ItemStack(ItemStackUtil.empty()); + + protected ItemStack(net.minecraft.item.ItemStack stack) { + this.stack = stack; + } + + public static ItemStack of(net.minecraft.item.ItemStack stack) { + if (stack == null || stack.isEmpty()) + return EMPTY; + + return new ItemStack(stack); + } + + public static ItemStack of(ItemConvertible item) { + return new Builder().item(item).build(); + } + + public static ItemStack of(ItemConvertible item, int count) { + return new Builder().item(item).count(count).build(); + } + + public static ItemStack empty() { + return EMPTY; + } + + public int getCount() { + return stack.getCount(); + } + + public void setCount(int count) { + stack.setCount(count); + } + + public NbtCompound getCustomNbt() { + return CustomDataUtil.getNbt(stack); + } + + public void setCustomNbt(NbtCompound nbt) { + CustomDataUtil.setNbt(stack, nbt); + } + + public void removeCustomNbt() { + CustomDataUtil.remove(stack); + } + + public boolean hasCustomNbt() { + return CustomDataUtil.hasNbt(stack); + } + + public boolean isEmpty() { + return stack.isEmpty(); + } + + public CompatIdentifier getItemId() { + return ItemUtil.toCompatID(stack.getItem()); + } + + public ItemStack copy() { + return new ItemStack(stack.copy()); + } + + public ItemStack copyWithCount(int count) { + return new ItemStack(stack.copyWithCount(count)); + } + + public Map getEnchantments(@Nullable World world) { + return EnchantmentUtil.getEnchantment(stack, world); + } + + public void setEnchantments(Map enchantments, @Nullable World world) { + EnchantmentUtil.setEnchantment(stack, enchantments, world); + } + + public int getMaxCount() { + return ItemStackUtil.getMaxCount(stack); + } + + public boolean hasLore() { + return LoreUtil.hasLore(stack); + } + + public List getLore() { + return LoreUtil.getLore(stack); + } + + public List getLoreAsStringList() { + return LoreUtil.getLoreAsStringList(stack); + } + + public void setLore(List lore) { + LoreUtil.setLore(stack, lore); + } + + public void setLoreString(List lore) { + LoreUtil.setLoreStringList(stack, lore); + } + + public void setLore(String lore) { + LoreUtil.setLore(stack, lore); + } + + @Deprecated + public net.minecraft.item.ItemStack toMinecraft() { + return stack; + } + + public ItemWrapper getItem() { + if (isEmpty()) + return ItemWrapper.of(); + + return ItemWrapper.of(getRawItem()); + } + + public Item getRawItem() { + return ItemStackUtil.getItem(stack); + } + + public static class Builder { + + protected CompatIdentifier id; + protected int count = 1; + protected NbtCompound nbt = NbtUtil.create(); + + public Builder() { + + } + + public Builder item(CompatIdentifier id) { + this.id = id; + return this; + } + + public Builder item(ItemConvertible item) { + this.id = ItemUtil.toCompatID(item.asItem()); + return this; + } + + public Builder count(int count) { + this.count = count; + return this; + } + + public Builder nbt(NbtCompound nbt) { + this.nbt = nbt; + return this; + } + + public ItemStack build() { + net.minecraft.item.ItemStack stack = new net.minecraft.item.ItemStack(ItemUtil.fromId(id), count); + CustomDataUtil.setNbt(stack, nbt); + + return new ItemStack(stack); + } + } + + @Override + public String toString() { + return stack.toString(); + } + + public void increment(int amount) { + ItemStackUtil.incrementCount(stack, amount); + } + + public void decrement(int amount) { + ItemStackUtil.decrementCount(stack, amount); + } + + public void increment() { + increment(1); + } + + public void decrement() { + decrement(1); + } + + public boolean is(ItemWrapper item) { + return getRawItem() == item.get(); + } + + public boolean is(CompatIdentifier id) { + return getItemId().equals(id); + } + + public boolean isBlockItem() { + return getItem().isBlock(); + } + + public net.pitan76.mcpitanlib.midohra.nbt.NbtCompound getCustomNbtM() { + return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(getCustomNbt()); + } + + public void setCustomNbt(net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { + setCustomNbt(nbt.toMinecraft()); + } + + public void setLoreM(List lore) { + LoreUtil.setLore(stack, lore.stream().map(TextComponent::getText).toList()); + } + + public List getLoreM() { + return getLore().stream().map(TextComponent::new).toList(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java new file mode 100644 index 000000000..1476e2b26 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java @@ -0,0 +1,161 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltItem; +import org.jetbrains.annotations.Nullable; + +import java.util.Optional; + +public class ItemWrapper { + private final net.minecraft.item.Item item; + + protected ItemWrapper() { + this.item = null; + } + + protected ItemWrapper(net.minecraft.item.Item item) { + this.item = item; + } + + public static ItemWrapper of(net.minecraft.item.Item item) { + return new ItemWrapper(item); + } + + public static ItemWrapper of() { + return new ItemWrapper(); + } + + public static ItemWrapper of(CompatIdentifier id) { + if (ItemUtil.isExist(id)) + return of(ItemUtil.fromId(id)); + + return of(); + } + + public static ItemWrapper of(CompatIdentifier id, CompatIdentifier... ids) { + if (of(id).isPresent()) return of(id); + + for (CompatIdentifier id1 : ids) { + if (of(id1).isPresent()) + return of(id1); + } + + return of(); + } + + public boolean isPresent() { + return !isEmpty(); + } + + public boolean isEmpty() { + return get() == null; + } + + public boolean isAir() { + return isEmpty() || get() == net.minecraft.item.Items.AIR; + } + + @Nullable + public net.minecraft.item.Item get() { + return item; + } + + public net.minecraft.item.Item gerOrDefault(net.minecraft.item.Item defaultItem) { + return isEmpty() ? defaultItem : get(); + } + + public CompatIdentifier getId() { + if (isEmpty()) + return CompatIdentifier.empty(); + + return ItemUtil.toId(get()); + } + + public String getName() { + if (isEmpty()) return ""; + return ItemUtil.getNameAsString(get()); + } + + public String getTranslationKey() { + if (isEmpty()) return ""; + return ItemUtil.getTranslationKey(get()); + } + + public ItemStack createStack(int count) { + if (isEmpty()) return ItemStack.EMPTY; + return ItemStack.of(ItemStackUtil.create(get(), count)); + } + + public ItemStack createStack() { + return createStack(1); + } + + public boolean isInTag(CompatIdentifier id) { + return ItemUtil.isInTag(get(), id); + } + + public boolean isBlock() { + return !isEmpty() && get() instanceof net.minecraft.item.BlockItem; + } + + public BlockWrapper asBlock() { + if (!isBlock()) + return BlockWrapper.of(); + + return BlockWrapper.of(((net.minecraft.item.BlockItem) get()).getBlock()); + } + + public boolean rawEquals(ItemWrapper item) { + return get() == item.get(); + } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + ItemWrapper item = (ItemWrapper) obj; + return rawEquals(item); + } + + public static ItemWrapper of(BlockWrapper block) { + if (block.isEmpty()) + return of(); + + return of(block.asItem().get()); + } + + public static ItemWrapper of(String id) { + return of(CompatIdentifier.of(id)); + } + + public static ItemWrapper of(String namespace, String path) { + return of(CompatIdentifier.of(namespace, path)); + } + + public static ItemWrapper of(CompatItem item) { + return of((net.minecraft.item.Item) item); + } + + public Optional toCompatItem() { + if (get() instanceof CompatItem) { + return Optional.of((CompatItem) get()); + } + return Optional.empty(); + } + + public Optional toBuiltItem() { + if (get() instanceof BuiltItem) { + return Optional.of((BuiltItem) get()); + } + return Optional.empty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java new file mode 100644 index 000000000..c79f22ff6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java @@ -0,0 +1,984 @@ +package net.pitan76.mcpitanlib.midohra.item; + +public class Items { + public static ItemWrapper AIR = of(net.minecraft.item.Items.AIR); + public static ItemWrapper STONE = of(net.minecraft.item.Items.STONE); + public static ItemWrapper GRANITE = of(net.minecraft.item.Items.GRANITE); + public static ItemWrapper POLISHED_GRANITE = of(net.minecraft.item.Items.POLISHED_GRANITE); + public static ItemWrapper DIORITE = of(net.minecraft.item.Items.DIORITE); + public static ItemWrapper POLISHED_DIORITE = of(net.minecraft.item.Items.POLISHED_DIORITE); + public static ItemWrapper ANDESITE = of(net.minecraft.item.Items.ANDESITE); + public static ItemWrapper POLISHED_ANDESITE = of(net.minecraft.item.Items.POLISHED_ANDESITE); + public static ItemWrapper GRASS_BLOCK = of(net.minecraft.item.Items.GRASS_BLOCK); + public static ItemWrapper DIRT = of(net.minecraft.item.Items.DIRT); + public static ItemWrapper COARSE_DIRT = of(net.minecraft.item.Items.COARSE_DIRT); + public static ItemWrapper PODZOL = of(net.minecraft.item.Items.PODZOL); + public static ItemWrapper CRIMSON_NYLIUM = of(net.minecraft.item.Items.CRIMSON_NYLIUM); + public static ItemWrapper WARPED_NYLIUM = of(net.minecraft.item.Items.WARPED_NYLIUM); + public static ItemWrapper COBBLESTONE = of(net.minecraft.item.Items.COBBLESTONE); + public static ItemWrapper OAK_PLANKS = of(net.minecraft.item.Items.OAK_PLANKS); + public static ItemWrapper SPRUCE_PLANKS = of(net.minecraft.item.Items.SPRUCE_PLANKS); + public static ItemWrapper BIRCH_PLANKS = of(net.minecraft.item.Items.BIRCH_PLANKS); + public static ItemWrapper JUNGLE_PLANKS = of(net.minecraft.item.Items.JUNGLE_PLANKS); + public static ItemWrapper ACACIA_PLANKS = of(net.minecraft.item.Items.ACACIA_PLANKS); + public static ItemWrapper DARK_OAK_PLANKS = of(net.minecraft.item.Items.DARK_OAK_PLANKS); + public static ItemWrapper CRIMSON_PLANKS = of(net.minecraft.item.Items.CRIMSON_PLANKS); + public static ItemWrapper WARPED_PLANKS = of(net.minecraft.item.Items.WARPED_PLANKS); + public static ItemWrapper OAK_SAPLING = of(net.minecraft.item.Items.OAK_SAPLING); + public static ItemWrapper SPRUCE_SAPLING = of(net.minecraft.item.Items.SPRUCE_SAPLING); + public static ItemWrapper BIRCH_SAPLING = of(net.minecraft.item.Items.BIRCH_SAPLING); + public static ItemWrapper JUNGLE_SAPLING = of(net.minecraft.item.Items.JUNGLE_SAPLING); + public static ItemWrapper ACACIA_SAPLING = of(net.minecraft.item.Items.ACACIA_SAPLING); + public static ItemWrapper DARK_OAK_SAPLING = of(net.minecraft.item.Items.DARK_OAK_SAPLING); + public static ItemWrapper BEDROCK = of(net.minecraft.item.Items.BEDROCK); + public static ItemWrapper SAND = of(net.minecraft.item.Items.SAND); + public static ItemWrapper RED_SAND = of(net.minecraft.item.Items.RED_SAND); + public static ItemWrapper GRAVEL = of(net.minecraft.item.Items.GRAVEL); + public static ItemWrapper GOLD_ORE = of(net.minecraft.item.Items.GOLD_ORE); + public static ItemWrapper IRON_ORE = of(net.minecraft.item.Items.IRON_ORE); + public static ItemWrapper COAL_ORE = of(net.minecraft.item.Items.COAL_ORE); + public static ItemWrapper NETHER_GOLD_ORE = of(net.minecraft.item.Items.NETHER_GOLD_ORE); + public static ItemWrapper OAK_LOG = of(net.minecraft.item.Items.OAK_LOG); + public static ItemWrapper SPRUCE_LOG = of(net.minecraft.item.Items.SPRUCE_LOG); + public static ItemWrapper BIRCH_LOG = of(net.minecraft.item.Items.BIRCH_LOG); + public static ItemWrapper JUNGLE_LOG = of(net.minecraft.item.Items.JUNGLE_LOG); + public static ItemWrapper ACACIA_LOG = of(net.minecraft.item.Items.ACACIA_LOG); + public static ItemWrapper DARK_OAK_LOG = of(net.minecraft.item.Items.DARK_OAK_LOG); + public static ItemWrapper CRIMSON_STEM = of(net.minecraft.item.Items.CRIMSON_STEM); + public static ItemWrapper WARPED_STEM = of(net.minecraft.item.Items.WARPED_STEM); + public static ItemWrapper STRIPPED_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_OAK_LOG); + public static ItemWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.item.Items.STRIPPED_SPRUCE_LOG); + public static ItemWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.item.Items.STRIPPED_BIRCH_LOG); + public static ItemWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.item.Items.STRIPPED_JUNGLE_LOG); + public static ItemWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.item.Items.STRIPPED_ACACIA_LOG); + public static ItemWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_LOG); + public static ItemWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.item.Items.STRIPPED_CRIMSON_STEM); + public static ItemWrapper STRIPPED_WARPED_STEM = of(net.minecraft.item.Items.STRIPPED_WARPED_STEM); + public static ItemWrapper STRIPPED_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_OAK_WOOD); + public static ItemWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.item.Items.STRIPPED_SPRUCE_WOOD); + public static ItemWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.item.Items.STRIPPED_BIRCH_WOOD); + public static ItemWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.item.Items.STRIPPED_JUNGLE_WOOD); + public static ItemWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.item.Items.STRIPPED_ACACIA_WOOD); + public static ItemWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_WOOD); + public static ItemWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.item.Items.STRIPPED_CRIMSON_HYPHAE); + public static ItemWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.item.Items.STRIPPED_WARPED_HYPHAE); + public static ItemWrapper OAK_WOOD = of(net.minecraft.item.Items.OAK_WOOD); + public static ItemWrapper SPRUCE_WOOD = of(net.minecraft.item.Items.SPRUCE_WOOD); + public static ItemWrapper BIRCH_WOOD = of(net.minecraft.item.Items.BIRCH_WOOD); + public static ItemWrapper JUNGLE_WOOD = of(net.minecraft.item.Items.JUNGLE_WOOD); + public static ItemWrapper ACACIA_WOOD = of(net.minecraft.item.Items.ACACIA_WOOD); + public static ItemWrapper DARK_OAK_WOOD = of(net.minecraft.item.Items.DARK_OAK_WOOD); + public static ItemWrapper CRIMSON_HYPHAE = of(net.minecraft.item.Items.CRIMSON_HYPHAE); + public static ItemWrapper WARPED_HYPHAE = of(net.minecraft.item.Items.WARPED_HYPHAE); + public static ItemWrapper OAK_LEAVES = of(net.minecraft.item.Items.OAK_LEAVES); + public static ItemWrapper SPRUCE_LEAVES = of(net.minecraft.item.Items.SPRUCE_LEAVES); + public static ItemWrapper BIRCH_LEAVES = of(net.minecraft.item.Items.BIRCH_LEAVES); + public static ItemWrapper JUNGLE_LEAVES = of(net.minecraft.item.Items.JUNGLE_LEAVES); + public static ItemWrapper ACACIA_LEAVES = of(net.minecraft.item.Items.ACACIA_LEAVES); + public static ItemWrapper DARK_OAK_LEAVES = of(net.minecraft.item.Items.DARK_OAK_LEAVES); + public static ItemWrapper SPONGE = of(net.minecraft.item.Items.SPONGE); + public static ItemWrapper WET_SPONGE = of(net.minecraft.item.Items.WET_SPONGE); + public static ItemWrapper GLASS = of(net.minecraft.item.Items.GLASS); + public static ItemWrapper LAPIS_ORE = of(net.minecraft.item.Items.LAPIS_ORE); + public static ItemWrapper LAPIS_BLOCK = of(net.minecraft.item.Items.LAPIS_BLOCK); + public static ItemWrapper DISPENSER = of(net.minecraft.item.Items.DISPENSER); + public static ItemWrapper SANDSTONE = of(net.minecraft.item.Items.SANDSTONE); + public static ItemWrapper CHISELED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_SANDSTONE); + public static ItemWrapper CUT_SANDSTONE = of(net.minecraft.item.Items.CUT_SANDSTONE); + public static ItemWrapper NOTE_BLOCK = of(net.minecraft.item.Items.NOTE_BLOCK); + public static ItemWrapper POWERED_RAIL = of(net.minecraft.item.Items.POWERED_RAIL); + public static ItemWrapper DETECTOR_RAIL = of(net.minecraft.item.Items.DETECTOR_RAIL); + public static ItemWrapper STICKY_PISTON = of(net.minecraft.item.Items.STICKY_PISTON); + public static ItemWrapper COBWEB = of(net.minecraft.item.Items.COBWEB); + public static ItemWrapper GRASS = of(net.minecraft.item.Items.SHORT_GRASS); + public static ItemWrapper FERN = of(net.minecraft.item.Items.FERN); + public static ItemWrapper DEAD_BUSH = of(net.minecraft.item.Items.DEAD_BUSH); + public static ItemWrapper SEAGRASS = of(net.minecraft.item.Items.SEAGRASS); + public static ItemWrapper SEA_PICKLE = of(net.minecraft.item.Items.SEA_PICKLE); + public static ItemWrapper PISTON = of(net.minecraft.item.Items.PISTON); + public static ItemWrapper WHITE_WOOL = of(net.minecraft.item.Items.WHITE_WOOL); + public static ItemWrapper ORANGE_WOOL = of(net.minecraft.item.Items.ORANGE_WOOL); + public static ItemWrapper MAGENTA_WOOL = of(net.minecraft.item.Items.MAGENTA_WOOL); + public static ItemWrapper LIGHT_BLUE_WOOL = of(net.minecraft.item.Items.LIGHT_BLUE_WOOL); + public static ItemWrapper YELLOW_WOOL = of(net.minecraft.item.Items.YELLOW_WOOL); + public static ItemWrapper LIME_WOOL = of(net.minecraft.item.Items.LIME_WOOL); + public static ItemWrapper PINK_WOOL = of(net.minecraft.item.Items.PINK_WOOL); + public static ItemWrapper GRAY_WOOL = of(net.minecraft.item.Items.GRAY_WOOL); + public static ItemWrapper LIGHT_GRAY_WOOL = of(net.minecraft.item.Items.LIGHT_GRAY_WOOL); + public static ItemWrapper CYAN_WOOL = of(net.minecraft.item.Items.CYAN_WOOL); + public static ItemWrapper PURPLE_WOOL = of(net.minecraft.item.Items.PURPLE_WOOL); + public static ItemWrapper BLUE_WOOL = of(net.minecraft.item.Items.BLUE_WOOL); + public static ItemWrapper BROWN_WOOL = of(net.minecraft.item.Items.BROWN_WOOL); + public static ItemWrapper GREEN_WOOL = of(net.minecraft.item.Items.GREEN_WOOL); + public static ItemWrapper RED_WOOL = of(net.minecraft.item.Items.RED_WOOL); + public static ItemWrapper BLACK_WOOL = of(net.minecraft.item.Items.BLACK_WOOL); + public static ItemWrapper DANDELION = of(net.minecraft.item.Items.DANDELION); + public static ItemWrapper POPPY = of(net.minecraft.item.Items.POPPY); + public static ItemWrapper BLUE_ORCHID = of(net.minecraft.item.Items.BLUE_ORCHID); + public static ItemWrapper ALLIUM = of(net.minecraft.item.Items.ALLIUM); + public static ItemWrapper AZURE_BLUET = of(net.minecraft.item.Items.AZURE_BLUET); + public static ItemWrapper RED_TULIP = of(net.minecraft.item.Items.RED_TULIP); + public static ItemWrapper ORANGE_TULIP = of(net.minecraft.item.Items.ORANGE_TULIP); + public static ItemWrapper WHITE_TULIP = of(net.minecraft.item.Items.WHITE_TULIP); + public static ItemWrapper PINK_TULIP = of(net.minecraft.item.Items.PINK_TULIP); + public static ItemWrapper OXEYE_DAISY = of(net.minecraft.item.Items.OXEYE_DAISY); + public static ItemWrapper CORNFLOWER = of(net.minecraft.item.Items.CORNFLOWER); + public static ItemWrapper LILY_OF_THE_VALLEY = of(net.minecraft.item.Items.LILY_OF_THE_VALLEY); + public static ItemWrapper WITHER_ROSE = of(net.minecraft.item.Items.WITHER_ROSE); + public static ItemWrapper BROWN_MUSHROOM = of(net.minecraft.item.Items.BROWN_MUSHROOM); + public static ItemWrapper RED_MUSHROOM = of(net.minecraft.item.Items.RED_MUSHROOM); + public static ItemWrapper CRIMSON_FUNGUS = of(net.minecraft.item.Items.CRIMSON_FUNGUS); + public static ItemWrapper WARPED_FUNGUS = of(net.minecraft.item.Items.WARPED_FUNGUS); + public static ItemWrapper CRIMSON_ROOTS = of(net.minecraft.item.Items.CRIMSON_ROOTS); + public static ItemWrapper WARPED_ROOTS = of(net.minecraft.item.Items.WARPED_ROOTS); + public static ItemWrapper NETHER_SPROUTS = of(net.minecraft.item.Items.NETHER_SPROUTS); + public static ItemWrapper WEEPING_VINES = of(net.minecraft.item.Items.WEEPING_VINES); + public static ItemWrapper TWISTING_VINES = of(net.minecraft.item.Items.TWISTING_VINES); + public static ItemWrapper SUGAR_CANE = of(net.minecraft.item.Items.SUGAR_CANE); + public static ItemWrapper KELP = of(net.minecraft.item.Items.KELP); + public static ItemWrapper BAMBOO = of(net.minecraft.item.Items.BAMBOO); + public static ItemWrapper GOLD_BLOCK = of(net.minecraft.item.Items.GOLD_BLOCK); + public static ItemWrapper IRON_BLOCK = of(net.minecraft.item.Items.IRON_BLOCK); + public static ItemWrapper OAK_SLAB = of(net.minecraft.item.Items.OAK_SLAB); + public static ItemWrapper SPRUCE_SLAB = of(net.minecraft.item.Items.SPRUCE_SLAB); + public static ItemWrapper BIRCH_SLAB = of(net.minecraft.item.Items.BIRCH_SLAB); + public static ItemWrapper JUNGLE_SLAB = of(net.minecraft.item.Items.JUNGLE_SLAB); + public static ItemWrapper ACACIA_SLAB = of(net.minecraft.item.Items.ACACIA_SLAB); + public static ItemWrapper DARK_OAK_SLAB = of(net.minecraft.item.Items.DARK_OAK_SLAB); + public static ItemWrapper CRIMSON_SLAB = of(net.minecraft.item.Items.CRIMSON_SLAB); + public static ItemWrapper WARPED_SLAB = of(net.minecraft.item.Items.WARPED_SLAB); + public static ItemWrapper STONE_SLAB = of(net.minecraft.item.Items.STONE_SLAB); + public static ItemWrapper SMOOTH_STONE_SLAB = of(net.minecraft.item.Items.SMOOTH_STONE_SLAB); + public static ItemWrapper SANDSTONE_SLAB = of(net.minecraft.item.Items.SANDSTONE_SLAB); + public static ItemWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_SANDSTONE_SLAB); + public static ItemWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.item.Items.PETRIFIED_OAK_SLAB); + public static ItemWrapper COBBLESTONE_SLAB = of(net.minecraft.item.Items.COBBLESTONE_SLAB); + public static ItemWrapper BRICK_SLAB = of(net.minecraft.item.Items.BRICK_SLAB); + public static ItemWrapper STONE_BRICK_SLAB = of(net.minecraft.item.Items.STONE_BRICK_SLAB); + public static ItemWrapper NETHER_BRICK_SLAB = of(net.minecraft.item.Items.NETHER_BRICK_SLAB); + public static ItemWrapper QUARTZ_SLAB = of(net.minecraft.item.Items.QUARTZ_SLAB); + public static ItemWrapper RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.RED_SANDSTONE_SLAB); + public static ItemWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_RED_SANDSTONE_SLAB); + public static ItemWrapper PURPUR_SLAB = of(net.minecraft.item.Items.PURPUR_SLAB); + public static ItemWrapper PRISMARINE_SLAB = of(net.minecraft.item.Items.PRISMARINE_SLAB); + public static ItemWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.item.Items.PRISMARINE_BRICK_SLAB); + public static ItemWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.item.Items.DARK_PRISMARINE_SLAB); + public static ItemWrapper SMOOTH_QUARTZ = of(net.minecraft.item.Items.SMOOTH_QUARTZ); + public static ItemWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE); + public static ItemWrapper SMOOTH_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_SANDSTONE); + public static ItemWrapper SMOOTH_STONE = of(net.minecraft.item.Items.SMOOTH_STONE); + public static ItemWrapper BRICKS = of(net.minecraft.item.Items.BRICKS); + public static ItemWrapper TNT = of(net.minecraft.item.Items.TNT); + public static ItemWrapper BOOKSHELF = of(net.minecraft.item.Items.BOOKSHELF); + public static ItemWrapper MOSSY_COBBLESTONE = of(net.minecraft.item.Items.MOSSY_COBBLESTONE); + public static ItemWrapper OBSIDIAN = of(net.minecraft.item.Items.OBSIDIAN); + public static ItemWrapper TORCH = of(net.minecraft.item.Items.TORCH); + public static ItemWrapper END_ROD = of(net.minecraft.item.Items.END_ROD); + public static ItemWrapper CHORUS_PLANT = of(net.minecraft.item.Items.CHORUS_PLANT); + public static ItemWrapper CHORUS_FLOWER = of(net.minecraft.item.Items.CHORUS_FLOWER); + public static ItemWrapper PURPUR_BLOCK = of(net.minecraft.item.Items.PURPUR_BLOCK); + public static ItemWrapper PURPUR_PILLAR = of(net.minecraft.item.Items.PURPUR_PILLAR); + public static ItemWrapper PURPUR_STAIRS = of(net.minecraft.item.Items.PURPUR_STAIRS); + public static ItemWrapper SPAWNER = of(net.minecraft.item.Items.SPAWNER); + public static ItemWrapper OAK_STAIRS = of(net.minecraft.item.Items.OAK_STAIRS); + public static ItemWrapper CHEST = of(net.minecraft.item.Items.CHEST); + public static ItemWrapper DIAMOND_ORE = of(net.minecraft.item.Items.DIAMOND_ORE); + public static ItemWrapper DIAMOND_BLOCK = of(net.minecraft.item.Items.DIAMOND_BLOCK); + public static ItemWrapper CRAFTING_TABLE = of(net.minecraft.item.Items.CRAFTING_TABLE); + public static ItemWrapper FARMLAND = of(net.minecraft.item.Items.FARMLAND); + public static ItemWrapper FURNACE = of(net.minecraft.item.Items.FURNACE); + public static ItemWrapper LADDER = of(net.minecraft.item.Items.LADDER); + public static ItemWrapper RAIL = of(net.minecraft.item.Items.RAIL); + public static ItemWrapper COBBLESTONE_STAIRS = of(net.minecraft.item.Items.COBBLESTONE_STAIRS); + public static ItemWrapper LEVER = of(net.minecraft.item.Items.LEVER); + public static ItemWrapper STONE_PRESSURE_PLATE = of(net.minecraft.item.Items.STONE_PRESSURE_PLATE); + public static ItemWrapper OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.OAK_PRESSURE_PLATE); + public static ItemWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.item.Items.SPRUCE_PRESSURE_PLATE); + public static ItemWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.item.Items.BIRCH_PRESSURE_PLATE); + public static ItemWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.item.Items.JUNGLE_PRESSURE_PLATE); + public static ItemWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.item.Items.ACACIA_PRESSURE_PLATE); + public static ItemWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.DARK_OAK_PRESSURE_PLATE); + public static ItemWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.item.Items.CRIMSON_PRESSURE_PLATE); + public static ItemWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.item.Items.WARPED_PRESSURE_PLATE); + public static ItemWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_PRESSURE_PLATE); + public static ItemWrapper REDSTONE_ORE = of(net.minecraft.item.Items.REDSTONE_ORE); + public static ItemWrapper REDSTONE_TORCH = of(net.minecraft.item.Items.REDSTONE_TORCH); + public static ItemWrapper SNOW = of(net.minecraft.item.Items.SNOW); + public static ItemWrapper ICE = of(net.minecraft.item.Items.ICE); + public static ItemWrapper SNOW_BLOCK = of(net.minecraft.item.Items.SNOW_BLOCK); + public static ItemWrapper CACTUS = of(net.minecraft.item.Items.CACTUS); + public static ItemWrapper CLAY = of(net.minecraft.item.Items.CLAY); + public static ItemWrapper JUKEBOX = of(net.minecraft.item.Items.JUKEBOX); + public static ItemWrapper OAK_FENCE = of(net.minecraft.item.Items.OAK_FENCE); + public static ItemWrapper SPRUCE_FENCE = of(net.minecraft.item.Items.SPRUCE_FENCE); + public static ItemWrapper BIRCH_FENCE = of(net.minecraft.item.Items.BIRCH_FENCE); + public static ItemWrapper JUNGLE_FENCE = of(net.minecraft.item.Items.JUNGLE_FENCE); + public static ItemWrapper ACACIA_FENCE = of(net.minecraft.item.Items.ACACIA_FENCE); + public static ItemWrapper DARK_OAK_FENCE = of(net.minecraft.item.Items.DARK_OAK_FENCE); + public static ItemWrapper CRIMSON_FENCE = of(net.minecraft.item.Items.CRIMSON_FENCE); + public static ItemWrapper WARPED_FENCE = of(net.minecraft.item.Items.WARPED_FENCE); + public static ItemWrapper PUMPKIN = of(net.minecraft.item.Items.PUMPKIN); + public static ItemWrapper CARVED_PUMPKIN = of(net.minecraft.item.Items.CARVED_PUMPKIN); + public static ItemWrapper NETHERRACK = of(net.minecraft.item.Items.NETHERRACK); + public static ItemWrapper SOUL_SAND = of(net.minecraft.item.Items.SOUL_SAND); + public static ItemWrapper SOUL_SOIL = of(net.minecraft.item.Items.SOUL_SOIL); + public static ItemWrapper BASALT = of(net.minecraft.item.Items.BASALT); + public static ItemWrapper POLISHED_BASALT = of(net.minecraft.item.Items.POLISHED_BASALT); + public static ItemWrapper SOUL_TORCH = of(net.minecraft.item.Items.SOUL_TORCH); + public static ItemWrapper GLOWSTONE = of(net.minecraft.item.Items.GLOWSTONE); + public static ItemWrapper JACK_O_LANTERN = of(net.minecraft.item.Items.JACK_O_LANTERN); + public static ItemWrapper OAK_TRAPDOOR = of(net.minecraft.item.Items.OAK_TRAPDOOR); + public static ItemWrapper SPRUCE_TRAPDOOR = of(net.minecraft.item.Items.SPRUCE_TRAPDOOR); + public static ItemWrapper BIRCH_TRAPDOOR = of(net.minecraft.item.Items.BIRCH_TRAPDOOR); + public static ItemWrapper JUNGLE_TRAPDOOR = of(net.minecraft.item.Items.JUNGLE_TRAPDOOR); + public static ItemWrapper ACACIA_TRAPDOOR = of(net.minecraft.item.Items.ACACIA_TRAPDOOR); + public static ItemWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.item.Items.DARK_OAK_TRAPDOOR); + public static ItemWrapper CRIMSON_TRAPDOOR = of(net.minecraft.item.Items.CRIMSON_TRAPDOOR); + public static ItemWrapper WARPED_TRAPDOOR = of(net.minecraft.item.Items.WARPED_TRAPDOOR); + public static ItemWrapper INFESTED_STONE = of(net.minecraft.item.Items.INFESTED_STONE); + public static ItemWrapper INFESTED_COBBLESTONE = of(net.minecraft.item.Items.INFESTED_COBBLESTONE); + public static ItemWrapper INFESTED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_STONE_BRICKS); + public static ItemWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_MOSSY_STONE_BRICKS); + public static ItemWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CRACKED_STONE_BRICKS); + public static ItemWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CHISELED_STONE_BRICKS); + public static ItemWrapper STONE_BRICKS = of(net.minecraft.item.Items.STONE_BRICKS); + public static ItemWrapper MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.MOSSY_STONE_BRICKS); + public static ItemWrapper CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.CRACKED_STONE_BRICKS); + public static ItemWrapper CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.CHISELED_STONE_BRICKS); + public static ItemWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.item.Items.BROWN_MUSHROOM_BLOCK); + public static ItemWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.item.Items.RED_MUSHROOM_BLOCK); + public static ItemWrapper MUSHROOM_STEM = of(net.minecraft.item.Items.MUSHROOM_STEM); + public static ItemWrapper IRON_BARS = of(net.minecraft.item.Items.IRON_BARS); + public static ItemWrapper CHAIN = of(net.minecraft.item.Items.IRON_CHAIN); + public static ItemWrapper GLASS_PANE = of(net.minecraft.item.Items.GLASS_PANE); + public static ItemWrapper MELON = of(net.minecraft.item.Items.MELON); + public static ItemWrapper VINE = of(net.minecraft.item.Items.VINE); + public static ItemWrapper OAK_FENCE_GATE = of(net.minecraft.item.Items.OAK_FENCE_GATE); + public static ItemWrapper SPRUCE_FENCE_GATE = of(net.minecraft.item.Items.SPRUCE_FENCE_GATE); + public static ItemWrapper BIRCH_FENCE_GATE = of(net.minecraft.item.Items.BIRCH_FENCE_GATE); + public static ItemWrapper JUNGLE_FENCE_GATE = of(net.minecraft.item.Items.JUNGLE_FENCE_GATE); + public static ItemWrapper ACACIA_FENCE_GATE = of(net.minecraft.item.Items.ACACIA_FENCE_GATE); + public static ItemWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.item.Items.DARK_OAK_FENCE_GATE); + public static ItemWrapper CRIMSON_FENCE_GATE = of(net.minecraft.item.Items.CRIMSON_FENCE_GATE); + public static ItemWrapper WARPED_FENCE_GATE = of(net.minecraft.item.Items.WARPED_FENCE_GATE); + public static ItemWrapper BRICK_STAIRS = of(net.minecraft.item.Items.BRICK_STAIRS); + public static ItemWrapper STONE_BRICK_STAIRS = of(net.minecraft.item.Items.STONE_BRICK_STAIRS); + public static ItemWrapper MYCELIUM = of(net.minecraft.item.Items.MYCELIUM); + public static ItemWrapper LILY_PAD = of(net.minecraft.item.Items.LILY_PAD); + public static ItemWrapper NETHER_BRICKS = of(net.minecraft.item.Items.NETHER_BRICKS); + public static ItemWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.item.Items.CRACKED_NETHER_BRICKS); + public static ItemWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.item.Items.CHISELED_NETHER_BRICKS); + public static ItemWrapper NETHER_BRICK_FENCE = of(net.minecraft.item.Items.NETHER_BRICK_FENCE); + public static ItemWrapper NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.NETHER_BRICK_STAIRS); + public static ItemWrapper ENCHANTING_TABLE = of(net.minecraft.item.Items.ENCHANTING_TABLE); + public static ItemWrapper END_PORTAL_FRAME = of(net.minecraft.item.Items.END_PORTAL_FRAME); + public static ItemWrapper END_STONE = of(net.minecraft.item.Items.END_STONE); + public static ItemWrapper END_STONE_BRICKS = of(net.minecraft.item.Items.END_STONE_BRICKS); + public static ItemWrapper DRAGON_EGG = of(net.minecraft.item.Items.DRAGON_EGG); + public static ItemWrapper REDSTONE_LAMP = of(net.minecraft.item.Items.REDSTONE_LAMP); + public static ItemWrapper SANDSTONE_STAIRS = of(net.minecraft.item.Items.SANDSTONE_STAIRS); + public static ItemWrapper EMERALD_ORE = of(net.minecraft.item.Items.EMERALD_ORE); + public static ItemWrapper ENDER_CHEST = of(net.minecraft.item.Items.ENDER_CHEST); + public static ItemWrapper TRIPWIRE_HOOK = of(net.minecraft.item.Items.TRIPWIRE_HOOK); + public static ItemWrapper EMERALD_BLOCK = of(net.minecraft.item.Items.EMERALD_BLOCK); + public static ItemWrapper SPRUCE_STAIRS = of(net.minecraft.item.Items.SPRUCE_STAIRS); + public static ItemWrapper BIRCH_STAIRS = of(net.minecraft.item.Items.BIRCH_STAIRS); + public static ItemWrapper JUNGLE_STAIRS = of(net.minecraft.item.Items.JUNGLE_STAIRS); + public static ItemWrapper CRIMSON_STAIRS = of(net.minecraft.item.Items.CRIMSON_STAIRS); + public static ItemWrapper WARPED_STAIRS = of(net.minecraft.item.Items.WARPED_STAIRS); + public static ItemWrapper COMMAND_BLOCK = of(net.minecraft.item.Items.COMMAND_BLOCK); + public static ItemWrapper BEACON = of(net.minecraft.item.Items.BEACON); + public static ItemWrapper COBBLESTONE_WALL = of(net.minecraft.item.Items.COBBLESTONE_WALL); + public static ItemWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_WALL); + public static ItemWrapper BRICK_WALL = of(net.minecraft.item.Items.BRICK_WALL); + public static ItemWrapper PRISMARINE_WALL = of(net.minecraft.item.Items.PRISMARINE_WALL); + public static ItemWrapper RED_SANDSTONE_WALL = of(net.minecraft.item.Items.RED_SANDSTONE_WALL); + public static ItemWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_WALL); + public static ItemWrapper GRANITE_WALL = of(net.minecraft.item.Items.GRANITE_WALL); + public static ItemWrapper STONE_BRICK_WALL = of(net.minecraft.item.Items.STONE_BRICK_WALL); + public static ItemWrapper NETHER_BRICK_WALL = of(net.minecraft.item.Items.NETHER_BRICK_WALL); + public static ItemWrapper ANDESITE_WALL = of(net.minecraft.item.Items.ANDESITE_WALL); + public static ItemWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.item.Items.RED_NETHER_BRICK_WALL); + public static ItemWrapper SANDSTONE_WALL = of(net.minecraft.item.Items.SANDSTONE_WALL); + public static ItemWrapper END_STONE_BRICK_WALL = of(net.minecraft.item.Items.END_STONE_BRICK_WALL); + public static ItemWrapper DIORITE_WALL = of(net.minecraft.item.Items.DIORITE_WALL); + public static ItemWrapper BLACKSTONE_WALL = of(net.minecraft.item.Items.BLACKSTONE_WALL); + public static ItemWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_WALL); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_WALL); + public static ItemWrapper STONE_BUTTON = of(net.minecraft.item.Items.STONE_BUTTON); + public static ItemWrapper OAK_BUTTON = of(net.minecraft.item.Items.OAK_BUTTON); + public static ItemWrapper SPRUCE_BUTTON = of(net.minecraft.item.Items.SPRUCE_BUTTON); + public static ItemWrapper BIRCH_BUTTON = of(net.minecraft.item.Items.BIRCH_BUTTON); + public static ItemWrapper JUNGLE_BUTTON = of(net.minecraft.item.Items.JUNGLE_BUTTON); + public static ItemWrapper ACACIA_BUTTON = of(net.minecraft.item.Items.ACACIA_BUTTON); + public static ItemWrapper DARK_OAK_BUTTON = of(net.minecraft.item.Items.DARK_OAK_BUTTON); + public static ItemWrapper CRIMSON_BUTTON = of(net.minecraft.item.Items.CRIMSON_BUTTON); + public static ItemWrapper WARPED_BUTTON = of(net.minecraft.item.Items.WARPED_BUTTON); + public static ItemWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BUTTON); + public static ItemWrapper ANVIL = of(net.minecraft.item.Items.ANVIL); + public static ItemWrapper CHIPPED_ANVIL = of(net.minecraft.item.Items.CHIPPED_ANVIL); + public static ItemWrapper DAMAGED_ANVIL = of(net.minecraft.item.Items.DAMAGED_ANVIL); + public static ItemWrapper TRAPPED_CHEST = of(net.minecraft.item.Items.TRAPPED_CHEST); + public static ItemWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.LIGHT_WEIGHTED_PRESSURE_PLATE); + public static ItemWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.HEAVY_WEIGHTED_PRESSURE_PLATE); + public static ItemWrapper DAYLIGHT_DETECTOR = of(net.minecraft.item.Items.DAYLIGHT_DETECTOR); + public static ItemWrapper REDSTONE_BLOCK = of(net.minecraft.item.Items.REDSTONE_BLOCK); + public static ItemWrapper NETHER_QUARTZ_ORE = of(net.minecraft.item.Items.NETHER_QUARTZ_ORE); + public static ItemWrapper HOPPER = of(net.minecraft.item.Items.HOPPER); + public static ItemWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.item.Items.CHISELED_QUARTZ_BLOCK); + public static ItemWrapper QUARTZ_BLOCK = of(net.minecraft.item.Items.QUARTZ_BLOCK); + public static ItemWrapper QUARTZ_BRICKS = of(net.minecraft.item.Items.QUARTZ_BRICKS); + public static ItemWrapper QUARTZ_PILLAR = of(net.minecraft.item.Items.QUARTZ_PILLAR); + public static ItemWrapper QUARTZ_STAIRS = of(net.minecraft.item.Items.QUARTZ_STAIRS); + public static ItemWrapper ACTIVATOR_RAIL = of(net.minecraft.item.Items.ACTIVATOR_RAIL); + public static ItemWrapper DROPPER = of(net.minecraft.item.Items.DROPPER); + public static ItemWrapper WHITE_TERRACOTTA = of(net.minecraft.item.Items.WHITE_TERRACOTTA); + public static ItemWrapper ORANGE_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_TERRACOTTA); + public static ItemWrapper MAGENTA_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_TERRACOTTA); + public static ItemWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_TERRACOTTA); + public static ItemWrapper YELLOW_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_TERRACOTTA); + public static ItemWrapper LIME_TERRACOTTA = of(net.minecraft.item.Items.LIME_TERRACOTTA); + public static ItemWrapper PINK_TERRACOTTA = of(net.minecraft.item.Items.PINK_TERRACOTTA); + public static ItemWrapper GRAY_TERRACOTTA = of(net.minecraft.item.Items.GRAY_TERRACOTTA); + public static ItemWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_TERRACOTTA); + public static ItemWrapper CYAN_TERRACOTTA = of(net.minecraft.item.Items.CYAN_TERRACOTTA); + public static ItemWrapper PURPLE_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_TERRACOTTA); + public static ItemWrapper BLUE_TERRACOTTA = of(net.minecraft.item.Items.BLUE_TERRACOTTA); + public static ItemWrapper BROWN_TERRACOTTA = of(net.minecraft.item.Items.BROWN_TERRACOTTA); + public static ItemWrapper GREEN_TERRACOTTA = of(net.minecraft.item.Items.GREEN_TERRACOTTA); + public static ItemWrapper RED_TERRACOTTA = of(net.minecraft.item.Items.RED_TERRACOTTA); + public static ItemWrapper BLACK_TERRACOTTA = of(net.minecraft.item.Items.BLACK_TERRACOTTA); + public static ItemWrapper BARRIER = of(net.minecraft.item.Items.BARRIER); + public static ItemWrapper IRON_TRAPDOOR = of(net.minecraft.item.Items.IRON_TRAPDOOR); + public static ItemWrapper HAY_BLOCK = of(net.minecraft.item.Items.HAY_BLOCK); + public static ItemWrapper WHITE_CARPET = of(net.minecraft.item.Items.WHITE_CARPET); + public static ItemWrapper ORANGE_CARPET = of(net.minecraft.item.Items.ORANGE_CARPET); + public static ItemWrapper MAGENTA_CARPET = of(net.minecraft.item.Items.MAGENTA_CARPET); + public static ItemWrapper LIGHT_BLUE_CARPET = of(net.minecraft.item.Items.LIGHT_BLUE_CARPET); + public static ItemWrapper YELLOW_CARPET = of(net.minecraft.item.Items.YELLOW_CARPET); + public static ItemWrapper LIME_CARPET = of(net.minecraft.item.Items.LIME_CARPET); + public static ItemWrapper PINK_CARPET = of(net.minecraft.item.Items.PINK_CARPET); + public static ItemWrapper GRAY_CARPET = of(net.minecraft.item.Items.GRAY_CARPET); + public static ItemWrapper LIGHT_GRAY_CARPET = of(net.minecraft.item.Items.LIGHT_GRAY_CARPET); + public static ItemWrapper CYAN_CARPET = of(net.minecraft.item.Items.CYAN_CARPET); + public static ItemWrapper PURPLE_CARPET = of(net.minecraft.item.Items.PURPLE_CARPET); + public static ItemWrapper BLUE_CARPET = of(net.minecraft.item.Items.BLUE_CARPET); + public static ItemWrapper BROWN_CARPET = of(net.minecraft.item.Items.BROWN_CARPET); + public static ItemWrapper GREEN_CARPET = of(net.minecraft.item.Items.GREEN_CARPET); + public static ItemWrapper RED_CARPET = of(net.minecraft.item.Items.RED_CARPET); + public static ItemWrapper BLACK_CARPET = of(net.minecraft.item.Items.BLACK_CARPET); + public static ItemWrapper TERRACOTTA = of(net.minecraft.item.Items.TERRACOTTA); + public static ItemWrapper COAL_BLOCK = of(net.minecraft.item.Items.COAL_BLOCK); + public static ItemWrapper PACKED_ICE = of(net.minecraft.item.Items.PACKED_ICE); + public static ItemWrapper ACACIA_STAIRS = of(net.minecraft.item.Items.ACACIA_STAIRS); + public static ItemWrapper DARK_OAK_STAIRS = of(net.minecraft.item.Items.DARK_OAK_STAIRS); + public static ItemWrapper SLIME_BLOCK = of(net.minecraft.item.Items.SLIME_BLOCK); + public static ItemWrapper GRASS_PATH = of(net.minecraft.item.Items.DIRT_PATH); + public static ItemWrapper SUNFLOWER = of(net.minecraft.item.Items.SUNFLOWER); + public static ItemWrapper LILAC = of(net.minecraft.item.Items.LILAC); + public static ItemWrapper ROSE_BUSH = of(net.minecraft.item.Items.ROSE_BUSH); + public static ItemWrapper PEONY = of(net.minecraft.item.Items.PEONY); + public static ItemWrapper TALL_GRASS = of(net.minecraft.item.Items.TALL_GRASS); + public static ItemWrapper LARGE_FERN = of(net.minecraft.item.Items.LARGE_FERN); + public static ItemWrapper WHITE_STAINED_GLASS = of(net.minecraft.item.Items.WHITE_STAINED_GLASS); + public static ItemWrapper ORANGE_STAINED_GLASS = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS); + public static ItemWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS); + public static ItemWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS); + public static ItemWrapper YELLOW_STAINED_GLASS = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS); + public static ItemWrapper LIME_STAINED_GLASS = of(net.minecraft.item.Items.LIME_STAINED_GLASS); + public static ItemWrapper PINK_STAINED_GLASS = of(net.minecraft.item.Items.PINK_STAINED_GLASS); + public static ItemWrapper GRAY_STAINED_GLASS = of(net.minecraft.item.Items.GRAY_STAINED_GLASS); + public static ItemWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS); + public static ItemWrapper CYAN_STAINED_GLASS = of(net.minecraft.item.Items.CYAN_STAINED_GLASS); + public static ItemWrapper PURPLE_STAINED_GLASS = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS); + public static ItemWrapper BLUE_STAINED_GLASS = of(net.minecraft.item.Items.BLUE_STAINED_GLASS); + public static ItemWrapper BROWN_STAINED_GLASS = of(net.minecraft.item.Items.BROWN_STAINED_GLASS); + public static ItemWrapper GREEN_STAINED_GLASS = of(net.minecraft.item.Items.GREEN_STAINED_GLASS); + public static ItemWrapper RED_STAINED_GLASS = of(net.minecraft.item.Items.RED_STAINED_GLASS); + public static ItemWrapper BLACK_STAINED_GLASS = of(net.minecraft.item.Items.BLACK_STAINED_GLASS); + public static ItemWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.WHITE_STAINED_GLASS_PANE); + public static ItemWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS_PANE); + public static ItemWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS_PANE); + public static ItemWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS_PANE); + public static ItemWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS_PANE); + public static ItemWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIME_STAINED_GLASS_PANE); + public static ItemWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PINK_STAINED_GLASS_PANE); + public static ItemWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GRAY_STAINED_GLASS_PANE); + public static ItemWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS_PANE); + public static ItemWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.CYAN_STAINED_GLASS_PANE); + public static ItemWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS_PANE); + public static ItemWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLUE_STAINED_GLASS_PANE); + public static ItemWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BROWN_STAINED_GLASS_PANE); + public static ItemWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GREEN_STAINED_GLASS_PANE); + public static ItemWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.item.Items.RED_STAINED_GLASS_PANE); + public static ItemWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLACK_STAINED_GLASS_PANE); + public static ItemWrapper PRISMARINE = of(net.minecraft.item.Items.PRISMARINE); + public static ItemWrapper PRISMARINE_BRICKS = of(net.minecraft.item.Items.PRISMARINE_BRICKS); + public static ItemWrapper DARK_PRISMARINE = of(net.minecraft.item.Items.DARK_PRISMARINE); + public static ItemWrapper PRISMARINE_STAIRS = of(net.minecraft.item.Items.PRISMARINE_STAIRS); + public static ItemWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.item.Items.PRISMARINE_BRICK_STAIRS); + public static ItemWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.item.Items.DARK_PRISMARINE_STAIRS); + public static ItemWrapper SEA_LANTERN = of(net.minecraft.item.Items.SEA_LANTERN); + public static ItemWrapper RED_SANDSTONE = of(net.minecraft.item.Items.RED_SANDSTONE); + public static ItemWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_RED_SANDSTONE); + public static ItemWrapper CUT_RED_SANDSTONE = of(net.minecraft.item.Items.CUT_RED_SANDSTONE); + public static ItemWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.RED_SANDSTONE_STAIRS); + public static ItemWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.item.Items.REPEATING_COMMAND_BLOCK); + public static ItemWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.item.Items.CHAIN_COMMAND_BLOCK); + public static ItemWrapper MAGMA_BLOCK = of(net.minecraft.item.Items.MAGMA_BLOCK); + public static ItemWrapper NETHER_WART_BLOCK = of(net.minecraft.item.Items.NETHER_WART_BLOCK); + public static ItemWrapper WARPED_WART_BLOCK = of(net.minecraft.item.Items.WARPED_WART_BLOCK); + public static ItemWrapper RED_NETHER_BRICKS = of(net.minecraft.item.Items.RED_NETHER_BRICKS); + public static ItemWrapper BONE_BLOCK = of(net.minecraft.item.Items.BONE_BLOCK); + public static ItemWrapper STRUCTURE_VOID = of(net.minecraft.item.Items.STRUCTURE_VOID); + public static ItemWrapper OBSERVER = of(net.minecraft.item.Items.OBSERVER); + public static ItemWrapper SHULKER_BOX = of(net.minecraft.item.Items.SHULKER_BOX); + public static ItemWrapper WHITE_SHULKER_BOX = of(net.minecraft.item.Items.WHITE_SHULKER_BOX); + public static ItemWrapper ORANGE_SHULKER_BOX = of(net.minecraft.item.Items.ORANGE_SHULKER_BOX); + public static ItemWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.item.Items.MAGENTA_SHULKER_BOX); + public static ItemWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_BLUE_SHULKER_BOX); + public static ItemWrapper YELLOW_SHULKER_BOX = of(net.minecraft.item.Items.YELLOW_SHULKER_BOX); + public static ItemWrapper LIME_SHULKER_BOX = of(net.minecraft.item.Items.LIME_SHULKER_BOX); + public static ItemWrapper PINK_SHULKER_BOX = of(net.minecraft.item.Items.PINK_SHULKER_BOX); + public static ItemWrapper GRAY_SHULKER_BOX = of(net.minecraft.item.Items.GRAY_SHULKER_BOX); + public static ItemWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_GRAY_SHULKER_BOX); + public static ItemWrapper CYAN_SHULKER_BOX = of(net.minecraft.item.Items.CYAN_SHULKER_BOX); + public static ItemWrapper PURPLE_SHULKER_BOX = of(net.minecraft.item.Items.PURPLE_SHULKER_BOX); + public static ItemWrapper BLUE_SHULKER_BOX = of(net.minecraft.item.Items.BLUE_SHULKER_BOX); + public static ItemWrapper BROWN_SHULKER_BOX = of(net.minecraft.item.Items.BROWN_SHULKER_BOX); + public static ItemWrapper GREEN_SHULKER_BOX = of(net.minecraft.item.Items.GREEN_SHULKER_BOX); + public static ItemWrapper RED_SHULKER_BOX = of(net.minecraft.item.Items.RED_SHULKER_BOX); + public static ItemWrapper BLACK_SHULKER_BOX = of(net.minecraft.item.Items.BLACK_SHULKER_BOX); + public static ItemWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.WHITE_GLAZED_TERRACOTTA); + public static ItemWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_GLAZED_TERRACOTTA); + public static ItemWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_GLAZED_TERRACOTTA); + public static ItemWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_GLAZED_TERRACOTTA); + public static ItemWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_GLAZED_TERRACOTTA); + public static ItemWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIME_GLAZED_TERRACOTTA); + public static ItemWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PINK_GLAZED_TERRACOTTA); + public static ItemWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GRAY_GLAZED_TERRACOTTA); + public static ItemWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_GLAZED_TERRACOTTA); + public static ItemWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.CYAN_GLAZED_TERRACOTTA); + public static ItemWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_GLAZED_TERRACOTTA); + public static ItemWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLUE_GLAZED_TERRACOTTA); + public static ItemWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BROWN_GLAZED_TERRACOTTA); + public static ItemWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GREEN_GLAZED_TERRACOTTA); + public static ItemWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.RED_GLAZED_TERRACOTTA); + public static ItemWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLACK_GLAZED_TERRACOTTA); + public static ItemWrapper WHITE_CONCRETE = of(net.minecraft.item.Items.WHITE_CONCRETE); + public static ItemWrapper ORANGE_CONCRETE = of(net.minecraft.item.Items.ORANGE_CONCRETE); + public static ItemWrapper MAGENTA_CONCRETE = of(net.minecraft.item.Items.MAGENTA_CONCRETE); + public static ItemWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE); + public static ItemWrapper YELLOW_CONCRETE = of(net.minecraft.item.Items.YELLOW_CONCRETE); + public static ItemWrapper LIME_CONCRETE = of(net.minecraft.item.Items.LIME_CONCRETE); + public static ItemWrapper PINK_CONCRETE = of(net.minecraft.item.Items.PINK_CONCRETE); + public static ItemWrapper GRAY_CONCRETE = of(net.minecraft.item.Items.GRAY_CONCRETE); + public static ItemWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE); + public static ItemWrapper CYAN_CONCRETE = of(net.minecraft.item.Items.CYAN_CONCRETE); + public static ItemWrapper PURPLE_CONCRETE = of(net.minecraft.item.Items.PURPLE_CONCRETE); + public static ItemWrapper BLUE_CONCRETE = of(net.minecraft.item.Items.BLUE_CONCRETE); + public static ItemWrapper BROWN_CONCRETE = of(net.minecraft.item.Items.BROWN_CONCRETE); + public static ItemWrapper GREEN_CONCRETE = of(net.minecraft.item.Items.GREEN_CONCRETE); + public static ItemWrapper RED_CONCRETE = of(net.minecraft.item.Items.RED_CONCRETE); + public static ItemWrapper BLACK_CONCRETE = of(net.minecraft.item.Items.BLACK_CONCRETE); + public static ItemWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.item.Items.WHITE_CONCRETE_POWDER); + public static ItemWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.item.Items.ORANGE_CONCRETE_POWDER); + public static ItemWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.item.Items.MAGENTA_CONCRETE_POWDER); + public static ItemWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE_POWDER); + public static ItemWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.item.Items.YELLOW_CONCRETE_POWDER); + public static ItemWrapper LIME_CONCRETE_POWDER = of(net.minecraft.item.Items.LIME_CONCRETE_POWDER); + public static ItemWrapper PINK_CONCRETE_POWDER = of(net.minecraft.item.Items.PINK_CONCRETE_POWDER); + public static ItemWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.GRAY_CONCRETE_POWDER); + public static ItemWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE_POWDER); + public static ItemWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.item.Items.CYAN_CONCRETE_POWDER); + public static ItemWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.item.Items.PURPLE_CONCRETE_POWDER); + public static ItemWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.BLUE_CONCRETE_POWDER); + public static ItemWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.item.Items.BROWN_CONCRETE_POWDER); + public static ItemWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.item.Items.GREEN_CONCRETE_POWDER); + public static ItemWrapper RED_CONCRETE_POWDER = of(net.minecraft.item.Items.RED_CONCRETE_POWDER); + public static ItemWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.item.Items.BLACK_CONCRETE_POWDER); + public static ItemWrapper TURTLE_EGG = of(net.minecraft.item.Items.TURTLE_EGG); + public static ItemWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_BLOCK); + public static ItemWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_BLOCK); + public static ItemWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_BLOCK); + public static ItemWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_BLOCK); + public static ItemWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_HORN_CORAL_BLOCK); + public static ItemWrapper TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.TUBE_CORAL_BLOCK); + public static ItemWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.BRAIN_CORAL_BLOCK); + public static ItemWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.BUBBLE_CORAL_BLOCK); + public static ItemWrapper FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.FIRE_CORAL_BLOCK); + public static ItemWrapper HORN_CORAL_BLOCK = of(net.minecraft.item.Items.HORN_CORAL_BLOCK); + public static ItemWrapper TUBE_CORAL = of(net.minecraft.item.Items.TUBE_CORAL); + public static ItemWrapper BRAIN_CORAL = of(net.minecraft.item.Items.BRAIN_CORAL); + public static ItemWrapper BUBBLE_CORAL = of(net.minecraft.item.Items.BUBBLE_CORAL); + public static ItemWrapper FIRE_CORAL = of(net.minecraft.item.Items.FIRE_CORAL); + public static ItemWrapper HORN_CORAL = of(net.minecraft.item.Items.HORN_CORAL); + public static ItemWrapper DEAD_BRAIN_CORAL = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL); + public static ItemWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL); + public static ItemWrapper DEAD_FIRE_CORAL = of(net.minecraft.item.Items.DEAD_FIRE_CORAL); + public static ItemWrapper DEAD_HORN_CORAL = of(net.minecraft.item.Items.DEAD_HORN_CORAL); + public static ItemWrapper DEAD_TUBE_CORAL = of(net.minecraft.item.Items.DEAD_TUBE_CORAL); + public static ItemWrapper TUBE_CORAL_FAN = of(net.minecraft.item.Items.TUBE_CORAL_FAN); + public static ItemWrapper BRAIN_CORAL_FAN = of(net.minecraft.item.Items.BRAIN_CORAL_FAN); + public static ItemWrapper BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.BUBBLE_CORAL_FAN); + public static ItemWrapper FIRE_CORAL_FAN = of(net.minecraft.item.Items.FIRE_CORAL_FAN); + public static ItemWrapper HORN_CORAL_FAN = of(net.minecraft.item.Items.HORN_CORAL_FAN); + public static ItemWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_FAN); + public static ItemWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_FAN); + public static ItemWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_FAN); + public static ItemWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_FAN); + public static ItemWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_HORN_CORAL_FAN); + public static ItemWrapper BLUE_ICE = of(net.minecraft.item.Items.BLUE_ICE); + public static ItemWrapper CONDUIT = of(net.minecraft.item.Items.CONDUIT); + public static ItemWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.item.Items.POLISHED_GRANITE_STAIRS); + public static ItemWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_STAIRS); + public static ItemWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_STAIRS); + public static ItemWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.item.Items.POLISHED_DIORITE_STAIRS); + public static ItemWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_STAIRS); + public static ItemWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.END_STONE_BRICK_STAIRS); + public static ItemWrapper STONE_STAIRS = of(net.minecraft.item.Items.STONE_STAIRS); + public static ItemWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_STAIRS); + public static ItemWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.item.Items.SMOOTH_QUARTZ_STAIRS); + public static ItemWrapper GRANITE_STAIRS = of(net.minecraft.item.Items.GRANITE_STAIRS); + public static ItemWrapper ANDESITE_STAIRS = of(net.minecraft.item.Items.ANDESITE_STAIRS); + public static ItemWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.RED_NETHER_BRICK_STAIRS); + public static ItemWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.item.Items.POLISHED_ANDESITE_STAIRS); + public static ItemWrapper DIORITE_STAIRS = of(net.minecraft.item.Items.DIORITE_STAIRS); + public static ItemWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.item.Items.POLISHED_GRANITE_SLAB); + public static ItemWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_SLAB); + public static ItemWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_SLAB); + public static ItemWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.item.Items.POLISHED_DIORITE_SLAB); + public static ItemWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_SLAB); + public static ItemWrapper END_STONE_BRICK_SLAB = of(net.minecraft.item.Items.END_STONE_BRICK_SLAB); + public static ItemWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_SLAB); + public static ItemWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.item.Items.SMOOTH_QUARTZ_SLAB); + public static ItemWrapper GRANITE_SLAB = of(net.minecraft.item.Items.GRANITE_SLAB); + public static ItemWrapper ANDESITE_SLAB = of(net.minecraft.item.Items.ANDESITE_SLAB); + public static ItemWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.item.Items.RED_NETHER_BRICK_SLAB); + public static ItemWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.item.Items.POLISHED_ANDESITE_SLAB); + public static ItemWrapper DIORITE_SLAB = of(net.minecraft.item.Items.DIORITE_SLAB); + public static ItemWrapper SCAFFOLDING = of(net.minecraft.item.Items.SCAFFOLDING); + public static ItemWrapper IRON_DOOR = of(net.minecraft.item.Items.IRON_DOOR); + public static ItemWrapper OAK_DOOR = of(net.minecraft.item.Items.OAK_DOOR); + public static ItemWrapper SPRUCE_DOOR = of(net.minecraft.item.Items.SPRUCE_DOOR); + public static ItemWrapper BIRCH_DOOR = of(net.minecraft.item.Items.BIRCH_DOOR); + public static ItemWrapper JUNGLE_DOOR = of(net.minecraft.item.Items.JUNGLE_DOOR); + public static ItemWrapper ACACIA_DOOR = of(net.minecraft.item.Items.ACACIA_DOOR); + public static ItemWrapper DARK_OAK_DOOR = of(net.minecraft.item.Items.DARK_OAK_DOOR); + public static ItemWrapper CRIMSON_DOOR = of(net.minecraft.item.Items.CRIMSON_DOOR); + public static ItemWrapper WARPED_DOOR = of(net.minecraft.item.Items.WARPED_DOOR); + public static ItemWrapper REPEATER = of(net.minecraft.item.Items.REPEATER); + public static ItemWrapper COMPARATOR = of(net.minecraft.item.Items.COMPARATOR); + public static ItemWrapper STRUCTURE_BLOCK = of(net.minecraft.item.Items.STRUCTURE_BLOCK); + public static ItemWrapper JIGSAW = of(net.minecraft.item.Items.JIGSAW); + public static ItemWrapper TURTLE_HELMET = of(net.minecraft.item.Items.TURTLE_HELMET); + public static ItemWrapper SCUTE = of(net.minecraft.item.Items.TURTLE_SCUTE); + public static ItemWrapper FLINT_AND_STEEL = of(net.minecraft.item.Items.FLINT_AND_STEEL); + public static ItemWrapper APPLE = of(net.minecraft.item.Items.APPLE); + public static ItemWrapper BOW = of(net.minecraft.item.Items.BOW); + public static ItemWrapper ARROW = of(net.minecraft.item.Items.ARROW); + public static ItemWrapper COAL = of(net.minecraft.item.Items.COAL); + public static ItemWrapper CHARCOAL = of(net.minecraft.item.Items.CHARCOAL); + public static ItemWrapper DIAMOND = of(net.minecraft.item.Items.DIAMOND); + public static ItemWrapper IRON_INGOT = of(net.minecraft.item.Items.IRON_INGOT); + public static ItemWrapper GOLD_INGOT = of(net.minecraft.item.Items.GOLD_INGOT); + public static ItemWrapper NETHERITE_INGOT = of(net.minecraft.item.Items.NETHERITE_INGOT); + public static ItemWrapper NETHERITE_SCRAP = of(net.minecraft.item.Items.NETHERITE_SCRAP); + public static ItemWrapper WOODEN_SWORD = of(net.minecraft.item.Items.WOODEN_SWORD); + public static ItemWrapper WOODEN_SHOVEL = of(net.minecraft.item.Items.WOODEN_SHOVEL); + public static ItemWrapper WOODEN_PICKAXE = of(net.minecraft.item.Items.WOODEN_PICKAXE); + public static ItemWrapper WOODEN_AXE = of(net.minecraft.item.Items.WOODEN_AXE); + public static ItemWrapper WOODEN_HOE = of(net.minecraft.item.Items.WOODEN_HOE); + public static ItemWrapper STONE_SWORD = of(net.minecraft.item.Items.STONE_SWORD); + public static ItemWrapper STONE_SHOVEL = of(net.minecraft.item.Items.STONE_SHOVEL); + public static ItemWrapper STONE_PICKAXE = of(net.minecraft.item.Items.STONE_PICKAXE); + public static ItemWrapper STONE_AXE = of(net.minecraft.item.Items.STONE_AXE); + public static ItemWrapper STONE_HOE = of(net.minecraft.item.Items.STONE_HOE); + public static ItemWrapper GOLDEN_SWORD = of(net.minecraft.item.Items.GOLDEN_SWORD); + public static ItemWrapper GOLDEN_SHOVEL = of(net.minecraft.item.Items.GOLDEN_SHOVEL); + public static ItemWrapper GOLDEN_PICKAXE = of(net.minecraft.item.Items.GOLDEN_PICKAXE); + public static ItemWrapper GOLDEN_AXE = of(net.minecraft.item.Items.GOLDEN_AXE); + public static ItemWrapper GOLDEN_HOE = of(net.minecraft.item.Items.GOLDEN_HOE); + public static ItemWrapper IRON_SWORD = of(net.minecraft.item.Items.IRON_SWORD); + public static ItemWrapper IRON_SHOVEL = of(net.minecraft.item.Items.IRON_SHOVEL); + public static ItemWrapper IRON_PICKAXE = of(net.minecraft.item.Items.IRON_PICKAXE); + public static ItemWrapper IRON_AXE = of(net.minecraft.item.Items.IRON_AXE); + public static ItemWrapper IRON_HOE = of(net.minecraft.item.Items.IRON_HOE); + public static ItemWrapper DIAMOND_SWORD = of(net.minecraft.item.Items.DIAMOND_SWORD); + public static ItemWrapper DIAMOND_SHOVEL = of(net.minecraft.item.Items.DIAMOND_SHOVEL); + public static ItemWrapper DIAMOND_PICKAXE = of(net.minecraft.item.Items.DIAMOND_PICKAXE); + public static ItemWrapper DIAMOND_AXE = of(net.minecraft.item.Items.DIAMOND_AXE); + public static ItemWrapper DIAMOND_HOE = of(net.minecraft.item.Items.DIAMOND_HOE); + public static ItemWrapper NETHERITE_SWORD = of(net.minecraft.item.Items.NETHERITE_SWORD); + public static ItemWrapper NETHERITE_SHOVEL = of(net.minecraft.item.Items.NETHERITE_SHOVEL); + public static ItemWrapper NETHERITE_PICKAXE = of(net.minecraft.item.Items.NETHERITE_PICKAXE); + public static ItemWrapper NETHERITE_AXE = of(net.minecraft.item.Items.NETHERITE_AXE); + public static ItemWrapper NETHERITE_HOE = of(net.minecraft.item.Items.NETHERITE_HOE); + public static ItemWrapper STICK = of(net.minecraft.item.Items.STICK); + public static ItemWrapper BOWL = of(net.minecraft.item.Items.BOWL); + public static ItemWrapper MUSHROOM_STEW = of(net.minecraft.item.Items.MUSHROOM_STEW); + public static ItemWrapper STRING = of(net.minecraft.item.Items.STRING); + public static ItemWrapper FEATHER = of(net.minecraft.item.Items.FEATHER); + public static ItemWrapper GUNPOWDER = of(net.minecraft.item.Items.GUNPOWDER); + public static ItemWrapper WHEAT_SEEDS = of(net.minecraft.item.Items.WHEAT_SEEDS); + public static ItemWrapper WHEAT = of(net.minecraft.item.Items.WHEAT); + public static ItemWrapper BREAD = of(net.minecraft.item.Items.BREAD); + public static ItemWrapper LEATHER_HELMET = of(net.minecraft.item.Items.LEATHER_HELMET); + public static ItemWrapper LEATHER_CHESTPLATE = of(net.minecraft.item.Items.LEATHER_CHESTPLATE); + public static ItemWrapper LEATHER_LEGGINGS = of(net.minecraft.item.Items.LEATHER_LEGGINGS); + public static ItemWrapper LEATHER_BOOTS = of(net.minecraft.item.Items.LEATHER_BOOTS); + public static ItemWrapper CHAINMAIL_HELMET = of(net.minecraft.item.Items.CHAINMAIL_HELMET); + public static ItemWrapper CHAINMAIL_CHESTPLATE = of(net.minecraft.item.Items.CHAINMAIL_CHESTPLATE); + public static ItemWrapper CHAINMAIL_LEGGINGS = of(net.minecraft.item.Items.CHAINMAIL_LEGGINGS); + public static ItemWrapper CHAINMAIL_BOOTS = of(net.minecraft.item.Items.CHAINMAIL_BOOTS); + public static ItemWrapper IRON_HELMET = of(net.minecraft.item.Items.IRON_HELMET); + public static ItemWrapper IRON_CHESTPLATE = of(net.minecraft.item.Items.IRON_CHESTPLATE); + public static ItemWrapper IRON_LEGGINGS = of(net.minecraft.item.Items.IRON_LEGGINGS); + public static ItemWrapper IRON_BOOTS = of(net.minecraft.item.Items.IRON_BOOTS); + public static ItemWrapper DIAMOND_HELMET = of(net.minecraft.item.Items.DIAMOND_HELMET); + public static ItemWrapper DIAMOND_CHESTPLATE = of(net.minecraft.item.Items.DIAMOND_CHESTPLATE); + public static ItemWrapper DIAMOND_LEGGINGS = of(net.minecraft.item.Items.DIAMOND_LEGGINGS); + public static ItemWrapper DIAMOND_BOOTS = of(net.minecraft.item.Items.DIAMOND_BOOTS); + public static ItemWrapper GOLDEN_HELMET = of(net.minecraft.item.Items.GOLDEN_HELMET); + public static ItemWrapper GOLDEN_CHESTPLATE = of(net.minecraft.item.Items.GOLDEN_CHESTPLATE); + public static ItemWrapper GOLDEN_LEGGINGS = of(net.minecraft.item.Items.GOLDEN_LEGGINGS); + public static ItemWrapper GOLDEN_BOOTS = of(net.minecraft.item.Items.GOLDEN_BOOTS); + public static ItemWrapper NETHERITE_HELMET = of(net.minecraft.item.Items.NETHERITE_HELMET); + public static ItemWrapper NETHERITE_CHESTPLATE = of(net.minecraft.item.Items.NETHERITE_CHESTPLATE); + public static ItemWrapper NETHERITE_LEGGINGS = of(net.minecraft.item.Items.NETHERITE_LEGGINGS); + public static ItemWrapper NETHERITE_BOOTS = of(net.minecraft.item.Items.NETHERITE_BOOTS); + public static ItemWrapper FLINT = of(net.minecraft.item.Items.FLINT); + public static ItemWrapper PORKCHOP = of(net.minecraft.item.Items.PORKCHOP); + public static ItemWrapper COOKED_PORKCHOP = of(net.minecraft.item.Items.COOKED_PORKCHOP); + public static ItemWrapper PAINTING = of(net.minecraft.item.Items.PAINTING); + public static ItemWrapper GOLDEN_APPLE = of(net.minecraft.item.Items.GOLDEN_APPLE); + public static ItemWrapper ENCHANTED_GOLDEN_APPLE = of(net.minecraft.item.Items.ENCHANTED_GOLDEN_APPLE); + public static ItemWrapper OAK_SIGN = of(net.minecraft.item.Items.OAK_SIGN); + public static ItemWrapper SPRUCE_SIGN = of(net.minecraft.item.Items.SPRUCE_SIGN); + public static ItemWrapper BIRCH_SIGN = of(net.minecraft.item.Items.BIRCH_SIGN); + public static ItemWrapper JUNGLE_SIGN = of(net.minecraft.item.Items.JUNGLE_SIGN); + public static ItemWrapper ACACIA_SIGN = of(net.minecraft.item.Items.ACACIA_SIGN); + public static ItemWrapper DARK_OAK_SIGN = of(net.minecraft.item.Items.DARK_OAK_SIGN); + public static ItemWrapper CRIMSON_SIGN = of(net.minecraft.item.Items.CRIMSON_SIGN); + public static ItemWrapper WARPED_SIGN = of(net.minecraft.item.Items.WARPED_SIGN); + public static ItemWrapper BUCKET = of(net.minecraft.item.Items.BUCKET); + public static ItemWrapper WATER_BUCKET = of(net.minecraft.item.Items.WATER_BUCKET); + public static ItemWrapper LAVA_BUCKET = of(net.minecraft.item.Items.LAVA_BUCKET); + public static ItemWrapper MINECART = of(net.minecraft.item.Items.MINECART); + public static ItemWrapper SADDLE = of(net.minecraft.item.Items.SADDLE); + public static ItemWrapper REDSTONE = of(net.minecraft.item.Items.REDSTONE); + public static ItemWrapper SNOWBALL = of(net.minecraft.item.Items.SNOWBALL); + public static ItemWrapper OAK_BOAT = of(net.minecraft.item.Items.OAK_BOAT); + public static ItemWrapper LEATHER = of(net.minecraft.item.Items.LEATHER); + public static ItemWrapper MILK_BUCKET = of(net.minecraft.item.Items.MILK_BUCKET); + public static ItemWrapper PUFFERFISH_BUCKET = of(net.minecraft.item.Items.PUFFERFISH_BUCKET); + public static ItemWrapper SALMON_BUCKET = of(net.minecraft.item.Items.SALMON_BUCKET); + public static ItemWrapper COD_BUCKET = of(net.minecraft.item.Items.COD_BUCKET); + public static ItemWrapper TROPICAL_FISH_BUCKET = of(net.minecraft.item.Items.TROPICAL_FISH_BUCKET); + public static ItemWrapper BRICK = of(net.minecraft.item.Items.BRICK); + public static ItemWrapper CLAY_BALL = of(net.minecraft.item.Items.CLAY_BALL); + public static ItemWrapper DRIED_KELP_BLOCK = of(net.minecraft.item.Items.DRIED_KELP_BLOCK); + public static ItemWrapper PAPER = of(net.minecraft.item.Items.PAPER); + public static ItemWrapper BOOK = of(net.minecraft.item.Items.BOOK); + public static ItemWrapper SLIME_BALL = of(net.minecraft.item.Items.SLIME_BALL); + public static ItemWrapper CHEST_MINECART = of(net.minecraft.item.Items.CHEST_MINECART); + public static ItemWrapper FURNACE_MINECART = of(net.minecraft.item.Items.FURNACE_MINECART); + public static ItemWrapper EGG = of(net.minecraft.item.Items.EGG); + public static ItemWrapper COMPASS = of(net.minecraft.item.Items.COMPASS); + public static ItemWrapper FISHING_ROD = of(net.minecraft.item.Items.FISHING_ROD); + public static ItemWrapper CLOCK = of(net.minecraft.item.Items.CLOCK); + public static ItemWrapper GLOWSTONE_DUST = of(net.minecraft.item.Items.GLOWSTONE_DUST); + public static ItemWrapper COD = of(net.minecraft.item.Items.COD); + public static ItemWrapper SALMON = of(net.minecraft.item.Items.SALMON); + public static ItemWrapper TROPICAL_FISH = of(net.minecraft.item.Items.TROPICAL_FISH); + public static ItemWrapper PUFFERFISH = of(net.minecraft.item.Items.PUFFERFISH); + public static ItemWrapper COOKED_COD = of(net.minecraft.item.Items.COOKED_COD); + public static ItemWrapper COOKED_SALMON = of(net.minecraft.item.Items.COOKED_SALMON); + public static ItemWrapper INK_SAC = of(net.minecraft.item.Items.INK_SAC); + public static ItemWrapper COCOA_BEANS = of(net.minecraft.item.Items.COCOA_BEANS); + public static ItemWrapper LAPIS_LAZULI = of(net.minecraft.item.Items.LAPIS_LAZULI); + public static ItemWrapper WHITE_DYE = of(net.minecraft.item.Items.WHITE_DYE); + public static ItemWrapper ORANGE_DYE = of(net.minecraft.item.Items.ORANGE_DYE); + public static ItemWrapper MAGENTA_DYE = of(net.minecraft.item.Items.MAGENTA_DYE); + public static ItemWrapper LIGHT_BLUE_DYE = of(net.minecraft.item.Items.LIGHT_BLUE_DYE); + public static ItemWrapper YELLOW_DYE = of(net.minecraft.item.Items.YELLOW_DYE); + public static ItemWrapper LIME_DYE = of(net.minecraft.item.Items.LIME_DYE); + public static ItemWrapper PINK_DYE = of(net.minecraft.item.Items.PINK_DYE); + public static ItemWrapper GRAY_DYE = of(net.minecraft.item.Items.GRAY_DYE); + public static ItemWrapper LIGHT_GRAY_DYE = of(net.minecraft.item.Items.LIGHT_GRAY_DYE); + public static ItemWrapper CYAN_DYE = of(net.minecraft.item.Items.CYAN_DYE); + public static ItemWrapper PURPLE_DYE = of(net.minecraft.item.Items.PURPLE_DYE); + public static ItemWrapper BLUE_DYE = of(net.minecraft.item.Items.BLUE_DYE); + public static ItemWrapper BROWN_DYE = of(net.minecraft.item.Items.BROWN_DYE); + public static ItemWrapper GREEN_DYE = of(net.minecraft.item.Items.GREEN_DYE); + public static ItemWrapper RED_DYE = of(net.minecraft.item.Items.RED_DYE); + public static ItemWrapper BLACK_DYE = of(net.minecraft.item.Items.BLACK_DYE); + public static ItemWrapper BONE_MEAL = of(net.minecraft.item.Items.BONE_MEAL); + public static ItemWrapper BONE = of(net.minecraft.item.Items.BONE); + public static ItemWrapper SUGAR = of(net.minecraft.item.Items.SUGAR); + public static ItemWrapper CAKE = of(net.minecraft.item.Items.CAKE); + public static ItemWrapper WHITE_BED = of(net.minecraft.item.Items.WHITE_BED); + public static ItemWrapper ORANGE_BED = of(net.minecraft.item.Items.ORANGE_BED); + public static ItemWrapper MAGENTA_BED = of(net.minecraft.item.Items.MAGENTA_BED); + public static ItemWrapper LIGHT_BLUE_BED = of(net.minecraft.item.Items.LIGHT_BLUE_BED); + public static ItemWrapper YELLOW_BED = of(net.minecraft.item.Items.YELLOW_BED); + public static ItemWrapper LIME_BED = of(net.minecraft.item.Items.LIME_BED); + public static ItemWrapper PINK_BED = of(net.minecraft.item.Items.PINK_BED); + public static ItemWrapper GRAY_BED = of(net.minecraft.item.Items.GRAY_BED); + public static ItemWrapper LIGHT_GRAY_BED = of(net.minecraft.item.Items.LIGHT_GRAY_BED); + public static ItemWrapper CYAN_BED = of(net.minecraft.item.Items.CYAN_BED); + public static ItemWrapper PURPLE_BED = of(net.minecraft.item.Items.PURPLE_BED); + public static ItemWrapper BLUE_BED = of(net.minecraft.item.Items.BLUE_BED); + public static ItemWrapper BROWN_BED = of(net.minecraft.item.Items.BROWN_BED); + public static ItemWrapper GREEN_BED = of(net.minecraft.item.Items.GREEN_BED); + public static ItemWrapper RED_BED = of(net.minecraft.item.Items.RED_BED); + public static ItemWrapper BLACK_BED = of(net.minecraft.item.Items.BLACK_BED); + public static ItemWrapper COOKIE = of(net.minecraft.item.Items.COOKIE); + public static ItemWrapper FILLED_MAP = of(net.minecraft.item.Items.FILLED_MAP); + public static ItemWrapper SHEARS = of(net.minecraft.item.Items.SHEARS); + public static ItemWrapper MELON_SLICE = of(net.minecraft.item.Items.MELON_SLICE); + public static ItemWrapper DRIED_KELP = of(net.minecraft.item.Items.DRIED_KELP); + public static ItemWrapper PUMPKIN_SEEDS = of(net.minecraft.item.Items.PUMPKIN_SEEDS); + public static ItemWrapper MELON_SEEDS = of(net.minecraft.item.Items.MELON_SEEDS); + public static ItemWrapper BEEF = of(net.minecraft.item.Items.BEEF); + public static ItemWrapper COOKED_BEEF = of(net.minecraft.item.Items.COOKED_BEEF); + public static ItemWrapper CHICKEN = of(net.minecraft.item.Items.CHICKEN); + public static ItemWrapper COOKED_CHICKEN = of(net.minecraft.item.Items.COOKED_CHICKEN); + public static ItemWrapper ROTTEN_FLESH = of(net.minecraft.item.Items.ROTTEN_FLESH); + public static ItemWrapper ENDER_PEARL = of(net.minecraft.item.Items.ENDER_PEARL); + public static ItemWrapper BLAZE_ROD = of(net.minecraft.item.Items.BLAZE_ROD); + public static ItemWrapper GHAST_TEAR = of(net.minecraft.item.Items.GHAST_TEAR); + public static ItemWrapper GOLD_NUGGET = of(net.minecraft.item.Items.GOLD_NUGGET); + public static ItemWrapper NETHER_WART = of(net.minecraft.item.Items.NETHER_WART); + public static ItemWrapper POTION = of(net.minecraft.item.Items.POTION); + public static ItemWrapper GLASS_BOTTLE = of(net.minecraft.item.Items.GLASS_BOTTLE); + public static ItemWrapper SPIDER_EYE = of(net.minecraft.item.Items.SPIDER_EYE); + public static ItemWrapper FERMENTED_SPIDER_EYE = of(net.minecraft.item.Items.FERMENTED_SPIDER_EYE); + public static ItemWrapper BLAZE_POWDER = of(net.minecraft.item.Items.BLAZE_POWDER); + public static ItemWrapper MAGMA_CREAM = of(net.minecraft.item.Items.MAGMA_CREAM); + public static ItemWrapper BREWING_STAND = of(net.minecraft.item.Items.BREWING_STAND); + public static ItemWrapper CAULDRON = of(net.minecraft.item.Items.CAULDRON); + public static ItemWrapper ENDER_EYE = of(net.minecraft.item.Items.ENDER_EYE); + public static ItemWrapper GLISTERING_MELON_SLICE = of(net.minecraft.item.Items.GLISTERING_MELON_SLICE); + public static ItemWrapper BAT_SPAWN_EGG = of(net.minecraft.item.Items.BAT_SPAWN_EGG); + public static ItemWrapper BEE_SPAWN_EGG = of(net.minecraft.item.Items.BEE_SPAWN_EGG); + public static ItemWrapper BLAZE_SPAWN_EGG = of(net.minecraft.item.Items.BLAZE_SPAWN_EGG); + public static ItemWrapper CAT_SPAWN_EGG = of(net.minecraft.item.Items.CAT_SPAWN_EGG); + public static ItemWrapper CAVE_SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.CAVE_SPIDER_SPAWN_EGG); + public static ItemWrapper CHICKEN_SPAWN_EGG = of(net.minecraft.item.Items.CHICKEN_SPAWN_EGG); + public static ItemWrapper COD_SPAWN_EGG = of(net.minecraft.item.Items.COD_SPAWN_EGG); + public static ItemWrapper COW_SPAWN_EGG = of(net.minecraft.item.Items.COW_SPAWN_EGG); + public static ItemWrapper CREEPER_SPAWN_EGG = of(net.minecraft.item.Items.CREEPER_SPAWN_EGG); + public static ItemWrapper DOLPHIN_SPAWN_EGG = of(net.minecraft.item.Items.DOLPHIN_SPAWN_EGG); + public static ItemWrapper DONKEY_SPAWN_EGG = of(net.minecraft.item.Items.DONKEY_SPAWN_EGG); + public static ItemWrapper DROWNED_SPAWN_EGG = of(net.minecraft.item.Items.DROWNED_SPAWN_EGG); + public static ItemWrapper ELDER_GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.ELDER_GUARDIAN_SPAWN_EGG); + public static ItemWrapper ENDERMAN_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMAN_SPAWN_EGG); + public static ItemWrapper ENDERMITE_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMITE_SPAWN_EGG); + public static ItemWrapper EVOKER_SPAWN_EGG = of(net.minecraft.item.Items.EVOKER_SPAWN_EGG); + public static ItemWrapper FOX_SPAWN_EGG = of(net.minecraft.item.Items.FOX_SPAWN_EGG); + public static ItemWrapper GHAST_SPAWN_EGG = of(net.minecraft.item.Items.GHAST_SPAWN_EGG); + public static ItemWrapper GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.GUARDIAN_SPAWN_EGG); + public static ItemWrapper HOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.HOGLIN_SPAWN_EGG); + public static ItemWrapper HORSE_SPAWN_EGG = of(net.minecraft.item.Items.HORSE_SPAWN_EGG); + public static ItemWrapper HUSK_SPAWN_EGG = of(net.minecraft.item.Items.HUSK_SPAWN_EGG); + public static ItemWrapper LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.LLAMA_SPAWN_EGG); + public static ItemWrapper MAGMA_CUBE_SPAWN_EGG = of(net.minecraft.item.Items.MAGMA_CUBE_SPAWN_EGG); + public static ItemWrapper MOOSHROOM_SPAWN_EGG = of(net.minecraft.item.Items.MOOSHROOM_SPAWN_EGG); + public static ItemWrapper MULE_SPAWN_EGG = of(net.minecraft.item.Items.MULE_SPAWN_EGG); + public static ItemWrapper OCELOT_SPAWN_EGG = of(net.minecraft.item.Items.OCELOT_SPAWN_EGG); + public static ItemWrapper PANDA_SPAWN_EGG = of(net.minecraft.item.Items.PANDA_SPAWN_EGG); + public static ItemWrapper PARROT_SPAWN_EGG = of(net.minecraft.item.Items.PARROT_SPAWN_EGG); + public static ItemWrapper PHANTOM_SPAWN_EGG = of(net.minecraft.item.Items.PHANTOM_SPAWN_EGG); + public static ItemWrapper PIG_SPAWN_EGG = of(net.minecraft.item.Items.PIG_SPAWN_EGG); + public static ItemWrapper PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_SPAWN_EGG); + public static ItemWrapper PIGLIN_BRUTE_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_BRUTE_SPAWN_EGG); + public static ItemWrapper PILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.PILLAGER_SPAWN_EGG); + public static ItemWrapper POLAR_BEAR_SPAWN_EGG = of(net.minecraft.item.Items.POLAR_BEAR_SPAWN_EGG); + public static ItemWrapper PUFFERFISH_SPAWN_EGG = of(net.minecraft.item.Items.PUFFERFISH_SPAWN_EGG); + public static ItemWrapper RABBIT_SPAWN_EGG = of(net.minecraft.item.Items.RABBIT_SPAWN_EGG); + public static ItemWrapper RAVAGER_SPAWN_EGG = of(net.minecraft.item.Items.RAVAGER_SPAWN_EGG); + public static ItemWrapper SALMON_SPAWN_EGG = of(net.minecraft.item.Items.SALMON_SPAWN_EGG); + public static ItemWrapper SHEEP_SPAWN_EGG = of(net.minecraft.item.Items.SHEEP_SPAWN_EGG); + public static ItemWrapper SHULKER_SPAWN_EGG = of(net.minecraft.item.Items.SHULKER_SPAWN_EGG); + public static ItemWrapper SILVERFISH_SPAWN_EGG = of(net.minecraft.item.Items.SILVERFISH_SPAWN_EGG); + public static ItemWrapper SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_SPAWN_EGG); + public static ItemWrapper SKELETON_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_HORSE_SPAWN_EGG); + public static ItemWrapper SLIME_SPAWN_EGG = of(net.minecraft.item.Items.SLIME_SPAWN_EGG); + public static ItemWrapper SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.SPIDER_SPAWN_EGG); + public static ItemWrapper SQUID_SPAWN_EGG = of(net.minecraft.item.Items.SQUID_SPAWN_EGG); + public static ItemWrapper STRAY_SPAWN_EGG = of(net.minecraft.item.Items.STRAY_SPAWN_EGG); + public static ItemWrapper STRIDER_SPAWN_EGG = of(net.minecraft.item.Items.STRIDER_SPAWN_EGG); + public static ItemWrapper TRADER_LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.TRADER_LLAMA_SPAWN_EGG); + public static ItemWrapper TROPICAL_FISH_SPAWN_EGG = of(net.minecraft.item.Items.TROPICAL_FISH_SPAWN_EGG); + public static ItemWrapper TURTLE_SPAWN_EGG = of(net.minecraft.item.Items.TURTLE_SPAWN_EGG); + public static ItemWrapper VEX_SPAWN_EGG = of(net.minecraft.item.Items.VEX_SPAWN_EGG); + public static ItemWrapper VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.VILLAGER_SPAWN_EGG); + public static ItemWrapper VINDICATOR_SPAWN_EGG = of(net.minecraft.item.Items.VINDICATOR_SPAWN_EGG); + public static ItemWrapper WANDERING_TRADER_SPAWN_EGG = of(net.minecraft.item.Items.WANDERING_TRADER_SPAWN_EGG); + public static ItemWrapper WITCH_SPAWN_EGG = of(net.minecraft.item.Items.WITCH_SPAWN_EGG); + public static ItemWrapper WITHER_SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.WITHER_SKELETON_SPAWN_EGG); + public static ItemWrapper WOLF_SPAWN_EGG = of(net.minecraft.item.Items.WOLF_SPAWN_EGG); + public static ItemWrapper ZOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOGLIN_SPAWN_EGG); + public static ItemWrapper ZOMBIE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_SPAWN_EGG); + public static ItemWrapper ZOMBIE_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_HORSE_SPAWN_EGG); + public static ItemWrapper ZOMBIE_VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_VILLAGER_SPAWN_EGG); + public static ItemWrapper ZOMBIFIED_PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIFIED_PIGLIN_SPAWN_EGG); + public static ItemWrapper EXPERIENCE_BOTTLE = of(net.minecraft.item.Items.EXPERIENCE_BOTTLE); + public static ItemWrapper FIRE_CHARGE = of(net.minecraft.item.Items.FIRE_CHARGE); + public static ItemWrapper WRITABLE_BOOK = of(net.minecraft.item.Items.WRITABLE_BOOK); + public static ItemWrapper WRITTEN_BOOK = of(net.minecraft.item.Items.WRITTEN_BOOK); + public static ItemWrapper EMERALD = of(net.minecraft.item.Items.EMERALD); + public static ItemWrapper ITEM_FRAME = of(net.minecraft.item.Items.ITEM_FRAME); + public static ItemWrapper FLOWER_POT = of(net.minecraft.item.Items.FLOWER_POT); + public static ItemWrapper CARROT = of(net.minecraft.item.Items.CARROT); + public static ItemWrapper POTATO = of(net.minecraft.item.Items.POTATO); + public static ItemWrapper BAKED_POTATO = of(net.minecraft.item.Items.BAKED_POTATO); + public static ItemWrapper POISONOUS_POTATO = of(net.minecraft.item.Items.POISONOUS_POTATO); + public static ItemWrapper MAP = of(net.minecraft.item.Items.MAP); + public static ItemWrapper GOLDEN_CARROT = of(net.minecraft.item.Items.GOLDEN_CARROT); + public static ItemWrapper SKELETON_SKULL = of(net.minecraft.item.Items.SKELETON_SKULL); + public static ItemWrapper WITHER_SKELETON_SKULL = of(net.minecraft.item.Items.WITHER_SKELETON_SKULL); + public static ItemWrapper PLAYER_HEAD = of(net.minecraft.item.Items.PLAYER_HEAD); + public static ItemWrapper ZOMBIE_HEAD = of(net.minecraft.item.Items.ZOMBIE_HEAD); + public static ItemWrapper CREEPER_HEAD = of(net.minecraft.item.Items.CREEPER_HEAD); + public static ItemWrapper DRAGON_HEAD = of(net.minecraft.item.Items.DRAGON_HEAD); + public static ItemWrapper CARROT_ON_A_STICK = of(net.minecraft.item.Items.CARROT_ON_A_STICK); + public static ItemWrapper WARPED_FUNGUS_ON_A_STICK = of(net.minecraft.item.Items.WARPED_FUNGUS_ON_A_STICK); + public static ItemWrapper NETHER_STAR = of(net.minecraft.item.Items.NETHER_STAR); + public static ItemWrapper PUMPKIN_PIE = of(net.minecraft.item.Items.PUMPKIN_PIE); + public static ItemWrapper FIREWORK_ROCKET = of(net.minecraft.item.Items.FIREWORK_ROCKET); + public static ItemWrapper FIREWORK_STAR = of(net.minecraft.item.Items.FIREWORK_STAR); + public static ItemWrapper ENCHANTED_BOOK = of(net.minecraft.item.Items.ENCHANTED_BOOK); + public static ItemWrapper NETHER_BRICK = of(net.minecraft.item.Items.NETHER_BRICK); + public static ItemWrapper QUARTZ = of(net.minecraft.item.Items.QUARTZ); + public static ItemWrapper TNT_MINECART = of(net.minecraft.item.Items.TNT_MINECART); + public static ItemWrapper HOPPER_MINECART = of(net.minecraft.item.Items.HOPPER_MINECART); + public static ItemWrapper PRISMARINE_SHARD = of(net.minecraft.item.Items.PRISMARINE_SHARD); + public static ItemWrapper PRISMARINE_CRYSTALS = of(net.minecraft.item.Items.PRISMARINE_CRYSTALS); + public static ItemWrapper RABBIT = of(net.minecraft.item.Items.RABBIT); + public static ItemWrapper COOKED_RABBIT = of(net.minecraft.item.Items.COOKED_RABBIT); + public static ItemWrapper RABBIT_STEW = of(net.minecraft.item.Items.RABBIT_STEW); + public static ItemWrapper RABBIT_FOOT = of(net.minecraft.item.Items.RABBIT_FOOT); + public static ItemWrapper RABBIT_HIDE = of(net.minecraft.item.Items.RABBIT_HIDE); + public static ItemWrapper ARMOR_STAND = of(net.minecraft.item.Items.ARMOR_STAND); + public static ItemWrapper IRON_HORSE_ARMOR = of(net.minecraft.item.Items.IRON_HORSE_ARMOR); + public static ItemWrapper GOLDEN_HORSE_ARMOR = of(net.minecraft.item.Items.GOLDEN_HORSE_ARMOR); + public static ItemWrapper DIAMOND_HORSE_ARMOR = of(net.minecraft.item.Items.DIAMOND_HORSE_ARMOR); + public static ItemWrapper LEATHER_HORSE_ARMOR = of(net.minecraft.item.Items.LEATHER_HORSE_ARMOR); + public static ItemWrapper LEAD = of(net.minecraft.item.Items.LEAD); + public static ItemWrapper NAME_TAG = of(net.minecraft.item.Items.NAME_TAG); + public static ItemWrapper COMMAND_BLOCK_MINECART = of(net.minecraft.item.Items.COMMAND_BLOCK_MINECART); + public static ItemWrapper MUTTON = of(net.minecraft.item.Items.MUTTON); + public static ItemWrapper COOKED_MUTTON = of(net.minecraft.item.Items.COOKED_MUTTON); + public static ItemWrapper WHITE_BANNER = of(net.minecraft.item.Items.WHITE_BANNER); + public static ItemWrapper ORANGE_BANNER = of(net.minecraft.item.Items.ORANGE_BANNER); + public static ItemWrapper MAGENTA_BANNER = of(net.minecraft.item.Items.MAGENTA_BANNER); + public static ItemWrapper LIGHT_BLUE_BANNER = of(net.minecraft.item.Items.LIGHT_BLUE_BANNER); + public static ItemWrapper YELLOW_BANNER = of(net.minecraft.item.Items.YELLOW_BANNER); + public static ItemWrapper LIME_BANNER = of(net.minecraft.item.Items.LIME_BANNER); + public static ItemWrapper PINK_BANNER = of(net.minecraft.item.Items.PINK_BANNER); + public static ItemWrapper GRAY_BANNER = of(net.minecraft.item.Items.GRAY_BANNER); + public static ItemWrapper LIGHT_GRAY_BANNER = of(net.minecraft.item.Items.LIGHT_GRAY_BANNER); + public static ItemWrapper CYAN_BANNER = of(net.minecraft.item.Items.CYAN_BANNER); + public static ItemWrapper PURPLE_BANNER = of(net.minecraft.item.Items.PURPLE_BANNER); + public static ItemWrapper BLUE_BANNER = of(net.minecraft.item.Items.BLUE_BANNER); + public static ItemWrapper BROWN_BANNER = of(net.minecraft.item.Items.BROWN_BANNER); + public static ItemWrapper GREEN_BANNER = of(net.minecraft.item.Items.GREEN_BANNER); + public static ItemWrapper RED_BANNER = of(net.minecraft.item.Items.RED_BANNER); + public static ItemWrapper BLACK_BANNER = of(net.minecraft.item.Items.BLACK_BANNER); + public static ItemWrapper END_CRYSTAL = of(net.minecraft.item.Items.END_CRYSTAL); + public static ItemWrapper CHORUS_FRUIT = of(net.minecraft.item.Items.CHORUS_FRUIT); + public static ItemWrapper POPPED_CHORUS_FRUIT = of(net.minecraft.item.Items.POPPED_CHORUS_FRUIT); + public static ItemWrapper BEETROOT = of(net.minecraft.item.Items.BEETROOT); + public static ItemWrapper BEETROOT_SEEDS = of(net.minecraft.item.Items.BEETROOT_SEEDS); + public static ItemWrapper BEETROOT_SOUP = of(net.minecraft.item.Items.BEETROOT_SOUP); + public static ItemWrapper DRAGON_BREATH = of(net.minecraft.item.Items.DRAGON_BREATH); + public static ItemWrapper SPLASH_POTION = of(net.minecraft.item.Items.SPLASH_POTION); + public static ItemWrapper SPECTRAL_ARROW = of(net.minecraft.item.Items.SPECTRAL_ARROW); + public static ItemWrapper TIPPED_ARROW = of(net.minecraft.item.Items.TIPPED_ARROW); + public static ItemWrapper LINGERING_POTION = of(net.minecraft.item.Items.LINGERING_POTION); + public static ItemWrapper SHIELD = of(net.minecraft.item.Items.SHIELD); + public static ItemWrapper ELYTRA = of(net.minecraft.item.Items.ELYTRA); + public static ItemWrapper SPRUCE_BOAT = of(net.minecraft.item.Items.SPRUCE_BOAT); + public static ItemWrapper BIRCH_BOAT = of(net.minecraft.item.Items.BIRCH_BOAT); + public static ItemWrapper JUNGLE_BOAT = of(net.minecraft.item.Items.JUNGLE_BOAT); + public static ItemWrapper ACACIA_BOAT = of(net.minecraft.item.Items.ACACIA_BOAT); + public static ItemWrapper DARK_OAK_BOAT = of(net.minecraft.item.Items.DARK_OAK_BOAT); + public static ItemWrapper TOTEM_OF_UNDYING = of(net.minecraft.item.Items.TOTEM_OF_UNDYING); + public static ItemWrapper SHULKER_SHELL = of(net.minecraft.item.Items.SHULKER_SHELL); + public static ItemWrapper IRON_NUGGET = of(net.minecraft.item.Items.IRON_NUGGET); + public static ItemWrapper KNOWLEDGE_BOOK = of(net.minecraft.item.Items.KNOWLEDGE_BOOK); + public static ItemWrapper DEBUG_STICK = of(net.minecraft.item.Items.DEBUG_STICK); + public static ItemWrapper MUSIC_DISC_13 = of(net.minecraft.item.Items.MUSIC_DISC_13); + public static ItemWrapper MUSIC_DISC_CAT = of(net.minecraft.item.Items.MUSIC_DISC_CAT); + public static ItemWrapper MUSIC_DISC_BLOCKS = of(net.minecraft.item.Items.MUSIC_DISC_BLOCKS); + public static ItemWrapper MUSIC_DISC_CHIRP = of(net.minecraft.item.Items.MUSIC_DISC_CHIRP); + public static ItemWrapper MUSIC_DISC_FAR = of(net.minecraft.item.Items.MUSIC_DISC_FAR); + public static ItemWrapper MUSIC_DISC_MALL = of(net.minecraft.item.Items.MUSIC_DISC_MALL); + public static ItemWrapper MUSIC_DISC_MELLOHI = of(net.minecraft.item.Items.MUSIC_DISC_MELLOHI); + public static ItemWrapper MUSIC_DISC_STAL = of(net.minecraft.item.Items.MUSIC_DISC_STAL); + public static ItemWrapper MUSIC_DISC_STRAD = of(net.minecraft.item.Items.MUSIC_DISC_STRAD); + public static ItemWrapper MUSIC_DISC_WARD = of(net.minecraft.item.Items.MUSIC_DISC_WARD); + public static ItemWrapper MUSIC_DISC_11 = of(net.minecraft.item.Items.MUSIC_DISC_11); + public static ItemWrapper MUSIC_DISC_WAIT = of(net.minecraft.item.Items.MUSIC_DISC_WAIT); + public static ItemWrapper MUSIC_DISC_PIGSTEP = of(net.minecraft.item.Items.MUSIC_DISC_PIGSTEP); + public static ItemWrapper TRIDENT = of(net.minecraft.item.Items.TRIDENT); + public static ItemWrapper PHANTOM_MEMBRANE = of(net.minecraft.item.Items.PHANTOM_MEMBRANE); + public static ItemWrapper NAUTILUS_SHELL = of(net.minecraft.item.Items.NAUTILUS_SHELL); + public static ItemWrapper HEART_OF_THE_SEA = of(net.minecraft.item.Items.HEART_OF_THE_SEA); + public static ItemWrapper CROSSBOW = of(net.minecraft.item.Items.CROSSBOW); + public static ItemWrapper SUSPICIOUS_STEW = of(net.minecraft.item.Items.SUSPICIOUS_STEW); + public static ItemWrapper LOOM = of(net.minecraft.item.Items.LOOM); + public static ItemWrapper FLOWER_BANNER_PATTERN = of(net.minecraft.item.Items.FLOWER_BANNER_PATTERN); + public static ItemWrapper CREEPER_BANNER_PATTERN = of(net.minecraft.item.Items.CREEPER_BANNER_PATTERN); + public static ItemWrapper SKULL_BANNER_PATTERN = of(net.minecraft.item.Items.SKULL_BANNER_PATTERN); + public static ItemWrapper MOJANG_BANNER_PATTERN = of(net.minecraft.item.Items.MOJANG_BANNER_PATTERN); + public static ItemWrapper GLOBE_BANNER_PATTERN = of(net.minecraft.item.Items.GLOBE_BANNER_PATTERN); + public static ItemWrapper PIGLIN_BANNER_PATTERN = of(net.minecraft.item.Items.PIGLIN_BANNER_PATTERN); + public static ItemWrapper COMPOSTER = of(net.minecraft.item.Items.COMPOSTER); + public static ItemWrapper BARREL = of(net.minecraft.item.Items.BARREL); + public static ItemWrapper SMOKER = of(net.minecraft.item.Items.SMOKER); + public static ItemWrapper BLAST_FURNACE = of(net.minecraft.item.Items.BLAST_FURNACE); + public static ItemWrapper CARTOGRAPHY_TABLE = of(net.minecraft.item.Items.CARTOGRAPHY_TABLE); + public static ItemWrapper FLETCHING_TABLE = of(net.minecraft.item.Items.FLETCHING_TABLE); + public static ItemWrapper GRINDSTONE = of(net.minecraft.item.Items.GRINDSTONE); + public static ItemWrapper LECTERN = of(net.minecraft.item.Items.LECTERN); + public static ItemWrapper SMITHING_TABLE = of(net.minecraft.item.Items.SMITHING_TABLE); + public static ItemWrapper STONECUTTER = of(net.minecraft.item.Items.STONECUTTER); + public static ItemWrapper BELL = of(net.minecraft.item.Items.BELL); + public static ItemWrapper LANTERN = of(net.minecraft.item.Items.LANTERN); + public static ItemWrapper SOUL_LANTERN = of(net.minecraft.item.Items.SOUL_LANTERN); + public static ItemWrapper SWEET_BERRIES = of(net.minecraft.item.Items.SWEET_BERRIES); + public static ItemWrapper CAMPFIRE = of(net.minecraft.item.Items.CAMPFIRE); + public static ItemWrapper SOUL_CAMPFIRE = of(net.minecraft.item.Items.SOUL_CAMPFIRE); + public static ItemWrapper SHROOMLIGHT = of(net.minecraft.item.Items.SHROOMLIGHT); + public static ItemWrapper HONEYCOMB = of(net.minecraft.item.Items.HONEYCOMB); + public static ItemWrapper BEE_NEST = of(net.minecraft.item.Items.BEE_NEST); + public static ItemWrapper BEEHIVE = of(net.minecraft.item.Items.BEEHIVE); + public static ItemWrapper HONEY_BOTTLE = of(net.minecraft.item.Items.HONEY_BOTTLE); + public static ItemWrapper HONEY_BLOCK = of(net.minecraft.item.Items.HONEY_BLOCK); + public static ItemWrapper HONEYCOMB_BLOCK = of(net.minecraft.item.Items.HONEYCOMB_BLOCK); + public static ItemWrapper LODESTONE = of(net.minecraft.item.Items.LODESTONE); + public static ItemWrapper NETHERITE_BLOCK = of(net.minecraft.item.Items.NETHERITE_BLOCK); + public static ItemWrapper ANCIENT_DEBRIS = of(net.minecraft.item.Items.ANCIENT_DEBRIS); + public static ItemWrapper TARGET = of(net.minecraft.item.Items.TARGET); + public static ItemWrapper CRYING_OBSIDIAN = of(net.minecraft.item.Items.CRYING_OBSIDIAN); + public static ItemWrapper BLACKSTONE = of(net.minecraft.item.Items.BLACKSTONE); + public static ItemWrapper BLACKSTONE_SLAB = of(net.minecraft.item.Items.BLACKSTONE_SLAB); + public static ItemWrapper BLACKSTONE_STAIRS = of(net.minecraft.item.Items.BLACKSTONE_STAIRS); + public static ItemWrapper GILDED_BLACKSTONE = of(net.minecraft.item.Items.GILDED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_SLAB); + public static ItemWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_STAIRS); + public static ItemWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.item.Items.CHISELED_POLISHED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICKS); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_SLAB); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_STAIRS); + public static ItemWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.CRACKED_POLISHED_BLACKSTONE_BRICKS); + public static ItemWrapper RESPAWN_ANCHOR = of(net.minecraft.item.Items.RESPAWN_ANCHOR); + + public static ItemWrapper of(net.minecraft.item.Item item) { + return ItemWrapper.of(item); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java new file mode 100644 index 000000000..c39629242 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.item.Item; + +import java.util.function.Supplier; + +public class SupplierItemWrapper extends ItemWrapper { + private final Supplier supplier; + + protected SupplierItemWrapper(Supplier supplier) { + this.supplier = supplier; + } + + public static SupplierItemWrapper of(Supplier supplier) { + return new SupplierItemWrapper(supplier); + } + + @Override + public Item get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java new file mode 100644 index 000000000..d92a636ac --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java @@ -0,0 +1,9 @@ +package net.pitan76.mcpitanlib.midohra.nbt; + +public interface ElementConvertible { + NbtElement toElement(); + + default net.minecraft.nbt.NbtElement toMinecraftNbtElement() { + return toElement().toMinecraft(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java new file mode 100644 index 000000000..38dff8af8 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java @@ -0,0 +1,155 @@ +package net.pitan76.mcpitanlib.midohra.nbt; + +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.NbtUtil; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; + +import java.util.Optional; +import java.util.UUID; + +@SuppressWarnings("deprecation") +public class NbtCompound implements ElementConvertible { + protected final net.minecraft.nbt.NbtCompound nbt; + + protected NbtCompound(net.minecraft.nbt.NbtCompound nbt) { + this.nbt = nbt; + } + + public static NbtCompound of(net.minecraft.nbt.NbtCompound nbt) { + return new NbtCompound(nbt); + } + + public static NbtCompound of() { + return new NbtCompound(NbtUtil.create()); + } + + public NbtCompound copy() { + return new NbtCompound(NbtUtil.copy(nbt)); + } + + public boolean has(String key) { + return NbtUtil.has(nbt, key); + } + + public void putByte(String key, byte value) { + NbtUtil.putByte(nbt, key, value); + } + + public byte getByte(String key) { + return NbtUtil.getByte(nbt, key); + } + + public void putShort(String key, short value) { + NbtUtil.putShort(nbt, key, value); + } + + public short getShort(String key) { + return NbtUtil.getShort(nbt, key); + } + + public void putInt(String key, int value) { + NbtUtil.putInt(nbt, key, value); + } + + public int getInt(String key) { + return NbtUtil.getInt(nbt, key); + } + + public void putLong(String key, long value) { + NbtUtil.putLong(nbt, key, value); + } + + public long getLong(String key) { + return NbtUtil.getLong(nbt, key); + } + + public void putFloat(String key, float value) { + NbtUtil.putFloat(nbt, key, value); + } + + public float getFloat(String key) { + return NbtUtil.getFloat(nbt, key); + } + + public void putDouble(String key, double value) { + NbtUtil.putDouble(nbt, key, value); + } + + public double getDouble(String key) { + return NbtUtil.getDouble(nbt, key); + } + + public void putString(String key, String value) { + NbtUtil.putString(nbt, key, value); + } + + public String getString(String key) { + return NbtUtil.getString(nbt, key); + } + + public void putBoolean(String key, boolean value) { + NbtUtil.putBoolean(nbt, key, value); + } + + public boolean getBoolean(String key) { + return NbtUtil.getBoolean(nbt, key); + } + + public void putUuid(String key, UUID value) { + NbtUtil.putUuid(nbt, key, value); + } + + public UUID getUuid(String key) { + return NbtUtil.getUuid(nbt, key); + } + + public void putItemStack(String key, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, CompatRegistryLookup registryLookup) { + NbtUtil.putItemStack(nbt, key, stack.toMinecraft(), registryLookup); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getItemStack(String key, CompatRegistryLookup registryLookup) { + return ItemStack.of(NbtUtil.getItemStack(nbt, key, registryLookup).get()); + } + + public void put(String key, NbtCompound compound) { + NbtUtil.put(nbt, key, compound.nbt); + } + + public void put(String key, net.minecraft.nbt.NbtCompound nbt) { + NbtUtil.put(this.nbt, key, nbt); + } + + public void put(String key, ElementConvertible element) { + NbtUtil.put(nbt, key, element.toMinecraftNbtElement()); + } + + public NbtCompound getCompound(String key) { + return new NbtCompound(NbtUtil.get(nbt, key)); + } + + public NbtElement get(String key) { + return NbtElement.of(NbtUtil.getElement(nbt, key)); + } + + public net.minecraft.nbt.NbtCompound toMinecraft() { + return nbt; + } + + @Override + public String toString() { + return nbt.toString(); + } + + @Override + public NbtElement toElement() { + return NbtElement.of(nbt); + } + + public void putSimpleItemStack(String key, ItemStack stack) { + NbtUtil.putSimpleItemStack(nbt, key, stack.toMinecraft()); + } + + public Optional getSimpleItemStack(String key) { + return NbtUtil.getSimpleItemStack(nbt, key).map(ItemStack::of); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java new file mode 100644 index 000000000..b6ba2c5a3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java @@ -0,0 +1,49 @@ +package net.pitan76.mcpitanlib.midohra.nbt; + +import net.minecraft.nbt.NbtType; + +public class NbtElement implements ElementConvertible { + protected final net.minecraft.nbt.NbtElement nbt; + + protected NbtElement(net.minecraft.nbt.NbtElement nbt) { + this.nbt = nbt; + } + + public static NbtElement of(net.minecraft.nbt.NbtElement nbt) { + return new NbtElement(nbt); + } + + public NbtElement copy() { + return new NbtElement(nbt.copy()); + } + + public byte getType() { + return nbt.getType(); + } + + public NbtType getNbtType() { + return nbt.getNbtType(); + } + + public int getSizeInBytes() { + return nbt.getSizeInBytes(); + } + + @Override + public String toString() { + return nbt.toString(); + } + + public net.minecraft.nbt.NbtElement toMinecraft() { + return nbt; + } + + @Override + public NbtElement toElement() { + return this; + } + + public String asString() { + return nbt.asString().orElse(""); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java new file mode 100644 index 000000000..00757eb4c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java @@ -0,0 +1,110 @@ +package net.pitan76.mcpitanlib.midohra.nbt; + +import java.util.AbstractList; +import java.util.Optional; + +@SuppressWarnings("deprecation") +public class NbtList extends AbstractList implements ElementConvertible { + protected final net.minecraft.nbt.NbtList nbtList; + + protected NbtList(net.minecraft.nbt.NbtList nbtList) { + this.nbtList = nbtList; + } + + public static NbtList of(net.minecraft.nbt.NbtList nbtList) { + return new NbtList(nbtList); + } + + public static Optional ofOptional(NbtElement nbtElement) { + if (nbtElement.toMinecraft() instanceof net.minecraft.nbt.NbtList) + return Optional.of(new NbtList((net.minecraft.nbt.NbtList) nbtElement.toMinecraft())); + + return Optional.empty(); + } + + public NbtList copy() { + return new NbtList(nbtList.copy()); + } + + @Override + public int size() { + return nbtList.size(); + } + + public byte getType() { + return nbtList.getType(); + } + + @Override + public NbtElement get(int index) { + return NbtElement.of(nbtList.get(index)); + } + + public boolean add(net.minecraft.nbt.NbtElement nbtElement) { + return nbtList.add(nbtElement); + } + + @Override + public boolean add(NbtElement nbtElement) { + return add(nbtElement.toMinecraft()); + } + + public void add(int index, net.minecraft.nbt.NbtElement nbtElement) { + nbtList.add(index, nbtElement); + } + + @Override + public void add(int index, NbtElement nbtElement) { + add(index, nbtElement.toMinecraft()); + } + + @Override + public NbtElement set(int index, NbtElement element) { + return NbtElement.of(nbtList.set(index, element.toMinecraft())); + } + + @Override + public NbtElement remove(int index) { + return NbtElement.of(nbtList.remove(index)); + } + + @Override + public boolean isEmpty() { + return nbtList.isEmpty(); + } + + @Override + public void clear() { + nbtList.clear(); + } + + public String asString() { + return nbtList.asString().orElse(""); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + + return o instanceof NbtList && nbtList.equals(((NbtList) o).nbtList); + } + + @Override + public int hashCode() { + return nbtList.hashCode(); + } + + @Override + public String toString() { + return nbtList.toString(); + } + + public net.minecraft.nbt.NbtList toMinecraft() { + return nbtList; + } + + @Override + public NbtElement toElement() { + return NbtElement.of(nbtList); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java new file mode 100644 index 000000000..c2c5566fe --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java @@ -0,0 +1,116 @@ +package net.pitan76.mcpitanlib.midohra.network; + +import net.minecraft.network.PacketByteBuf; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; + +public class CompatPacketByteBuf extends PacketByteBuf { + public CompatPacketByteBuf(PacketByteBuf buf) { + super(buf); + } + + public CompatPacketByteBuf() { + super(PacketByteUtil.create()); + } + + public static CompatPacketByteBuf create() { + return new CompatPacketByteBuf(); + } + + public static CompatPacketByteBuf of(PacketByteBuf buf) { + return new CompatPacketByteBuf(buf); + } + + public PacketByteBuf getRaw() { + return this; + } + + public CompatPacketByteBuf writeInt(int value) { + super.writeInt(value); + return this; + } + + public int readInt() { + return super.readInt(); + } + + public CompatPacketByteBuf writeLong(long value) { + super.writeLong(value); + return this; + } + + public long readLong() { + return super.readLong(); + } + + public CompatPacketByteBuf writeBoolean(boolean value) { + super.writeBoolean(value); + return this; + } + + public boolean readBoolean() { + return super.readBoolean(); + } + + public CompatPacketByteBuf writeFloat(float value) { + super.writeFloat(value); + return this; + } + + public float readFloat() { + return super.readFloat(); + } + + public CompatPacketByteBuf writeDouble(double value) { + super.writeDouble(value); + return this; + } + + public double readDouble() { + return super.readDouble(); + } + + public CompatPacketByteBuf writeShort(short value) { + super.writeShort(value); + return this; + } + + public short readShort() { + return super.readShort(); + } + + public CompatPacketByteBuf writeByteArray(byte[] array) { + super.writeByteArray(array); + return this; + } + + public byte[] readByteArray() { + return super.readByteArray(); + } + + public CompatPacketByteBuf writeString(String string) { + super.writeString(string); + return this; + } + + public String readString() { + return super.readString(); + } + + public CompatPacketByteBuf writeBlockPos(net.minecraft.util.math.BlockPos pos) { + super.writeBlockPos(pos); + return this; + } + + public net.minecraft.util.math.BlockPos readBlockPos() { + return super.readBlockPos(); + } + + public CompatPacketByteBuf writeBlockPos(BlockPos pos) { + return writeBlockPos(pos.toMinecraft()); + } + + public BlockPos readBlockPosMidohra() { + return BlockPos.of(readBlockPos()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java new file mode 100644 index 000000000..65546224f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java @@ -0,0 +1,74 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +import net.minecraft.recipe.book.CraftingRecipeCategory; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class CraftingRecipe extends Recipe { + private final net.minecraft.recipe.CraftingRecipe recipe; + + protected CraftingRecipe(net.minecraft.recipe.CraftingRecipe recipe) { + super(null); + this.recipe = recipe; + } + + public static CraftingRecipe of(net.minecraft.recipe.CraftingRecipe recipe) { + return new CraftingRecipe(recipe); + } + + public net.minecraft.recipe.CraftingRecipe getRaw() { + return recipe; + } + + public net.minecraft.recipe.CraftingRecipe toMinecraft() { + return getRaw(); + } + + public CraftingRecipeCategory getRawCategory() { + return getRaw().getCategory(); + } + + public boolean matches(CraftingRecipeInputOrInventory input, World world) { + return getRaw().matches(input.getRaw(), world.getRaw()); + } + + public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, World world) { + return getRaw().craft(input.getRaw(), world.getRaw().getRegistryManager()); + } + + public ItemStack craftMidohra(CraftingRecipeInputOrInventory input, World world) { + return ItemStack.of(craft(input, world)); + } + + public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, CompatRegistryLookup registryLookup) { + return getRaw().craft(input.getRaw(), registryLookup.getRegistryLookup()); + } + + public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, net.minecraft.world.World world) { + return getRaw().craft(input.getRaw(), world.getRegistryManager()); + } + + public DefaultedList getRecipeRemaindersDefaultedList(CraftingRecipeInputOrInventory input) { + return getRaw().getRecipeRemainders(input.getRaw()); + } + + public ItemStackList getRecipeRemainders(CraftingRecipeInputOrInventory input) { + return ItemStackList.of(getRecipeRemaindersDefaultedList(input)); + } + + public net.minecraft.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, net.minecraft.world.World world) { + return craft(input, world); + } + + public net.minecraft.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, World world) { + return getOutput(input, world.getRaw()); + } + + public ItemStack getOutputMidohra(CraftingRecipeInputOrInventory input, World world) { + return ItemStack.of(getOutput(input, world)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java new file mode 100644 index 000000000..9b72bb7f5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java @@ -0,0 +1,95 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +import net.minecraft.item.Item; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.IngredientUtil; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +import java.util.ArrayList; +import java.util.List; + +public class Ingredient { + private final net.minecraft.recipe.Ingredient ingredient; + + protected Ingredient(net.minecraft.recipe.Ingredient ingredient) { + this.ingredient = ingredient; + } + + public static Ingredient of(net.minecraft.recipe.Ingredient ingredient) { + return new Ingredient(ingredient); + } + + public static Ingredient ofItems(Item... items) { + return of(net.minecraft.recipe.Ingredient.ofItems(items)); + } + + public static Ingredient ofItem(Item items) { + return of(net.minecraft.recipe.Ingredient.ofItem(items)); + } + + public static Ingredient fromTagById(CompatIdentifier id) { + return of(IngredientUtil.fromTagByIdentifier(id)); + } + + public static Ingredient fromTagByString(String id) { + return of(IngredientUtil.fromTagByString(id)); + } + + public net.minecraft.recipe.Ingredient getRaw() { + return ingredient; + } + + public net.minecraft.recipe.Ingredient toMinecraft() { + return getRaw(); + } + + public boolean test(net.minecraft.item.ItemStack stack) { + return ingredient.test(stack); + } + + public boolean equals(Ingredient other) { + return ingredient.equals(other.getRaw()); + } + + public List getMatchingItems() { + return IngredientUtil.getItems(ingredient); + } + + public it.unimi.dsi.fastutil.ints.IntList getMatchingStacksIds() { + return IngredientUtil.getMatchingStacksIds(ingredient); + } + + public List getMatchingStacksAsList() { + return IngredientUtil.getMatchingStacksAsList(ingredient); + } + + public net.minecraft.item.ItemStack[] getMatchingStacks() { + return IngredientUtil.getMatchingStacks(ingredient); + } + + public List getMatchingItemWrappers() { + List wrappers = new ArrayList<>(); + + for (Item item : getMatchingItems()) { + wrappers.add(ItemWrapper.of(item)); + } + + return wrappers; + } + + public List getMatchingStacksAsMidohraList() { + List stacks = new ArrayList<>(); + + for (net.minecraft.item.ItemStack stack : getMatchingStacksAsList()) { + stacks.add(ItemStack.of(stack)); + } + + return stacks; + } + + public ItemStack[] getMatchingStacksAsMidohra() { + List stacks = getMatchingStacksAsMidohraList(); + return stacks.toArray(new ItemStack[0]); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java new file mode 100644 index 000000000..f840f157b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java @@ -0,0 +1,91 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +import net.minecraft.recipe.Ingredient; +import net.minecraft.recipe.RecipeSerializer; +import net.minecraft.recipe.input.RecipeInput; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.recipe.input.RecipeInputOrInventory; +import net.pitan76.mcpitanlib.midohra.recipe.input.TypedRecipeInputOrInventory; +import net.pitan76.mcpitanlib.midohra.world.World; + +import java.util.List; + +public class Recipe { + private final net.minecraft.recipe.Recipe recipe; + + protected Recipe(net.minecraft.recipe.Recipe recipe) { + this.recipe = recipe; + } + + public static Recipe of(net.minecraft.recipe.Recipe recipe) { + return new Recipe(recipe); + } + + public static CraftingRecipe of(net.minecraft.recipe.CraftingRecipe recipe) { + return new CraftingRecipe(recipe); + } + + public static ShapedRecipe of(net.minecraft.recipe.ShapedRecipe recipe) { + return new ShapedRecipe(recipe); + } + + public static ShapelessRecipe of(net.minecraft.recipe.ShapelessRecipe recipe) { + return new ShapelessRecipe(recipe); + } + + public net.minecraft.recipe.Recipe getRaw() { + return recipe; + } + + public net.minecraft.recipe.Recipe toMinecraft() { + return getRaw(); + } + + public RecipeSerializer getRawSerializer() { + return recipe.getSerializer(); + } + + public boolean matches(RecipeInputOrInventory input, World world) { + if (input instanceof TypedRecipeInputOrInventory) { + return matches((TypedRecipeInputOrInventory) input, world); + } + + return false; + } + + public net.minecraft.item.ItemStack craft(RecipeInputOrInventory input, World world) { + if (input instanceof TypedRecipeInputOrInventory) { + return craft((TypedRecipeInputOrInventory) input, world); + } + + return net.minecraft.item.ItemStack.EMPTY; + } + + public ItemStack craftMidohra(RecipeInputOrInventory input, World world) { + return ItemStack.of(craft(input, world)); + } + + public boolean matches(TypedRecipeInputOrInventory input, World world) { + return ((net.minecraft.recipe.Recipe)getRaw()).matches(input.getRecipeInput(), world.getRaw()); + } + + public net.minecraft.item.ItemStack craft(TypedRecipeInputOrInventory input, World world) { + return ((net.minecraft.recipe.Recipe)getRaw()).craft(input.getRecipeInput(), world.getRaw().getRegistryManager()); + } + + public ItemStack craftMidohra(TypedRecipeInputOrInventory input, World world) { + return ItemStack.of(craft(input, world)); + } + + public String getGroup() { + return getRaw().getGroup(); + } + + public RecipeType getType() { + return RecipeType.of(getRaw().getType()); + } + + public List getInputs() { + return getRaw().getIngredientPlacement().getIngredients(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java new file mode 100644 index 000000000..5b039fe10 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +public class RecipeManager { + private final net.minecraft.recipe.RecipeManager recipeManager; + + protected RecipeManager(net.minecraft.recipe.RecipeManager recipeManager) { + this.recipeManager = recipeManager; + } + + public static RecipeManager of(net.minecraft.recipe.RecipeManager recipeManager) { + return new RecipeManager(recipeManager); + } + + public net.minecraft.recipe.RecipeManager getRaw() { + return recipeManager; + } + + public net.minecraft.recipe.RecipeManager toMinecraft() { + return getRaw(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java new file mode 100644 index 000000000..d8348bab6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +import net.minecraft.registry.Registries; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class RecipeType { + private final net.minecraft.recipe.RecipeType recipeType; + + public static final RecipeType CRAFTING = new RecipeType(net.minecraft.recipe.RecipeType.CRAFTING); + public static final RecipeType SMELTING = new RecipeType(net.minecraft.recipe.RecipeType.SMELTING); + public static final RecipeType BLASTING = new RecipeType(net.minecraft.recipe.RecipeType.BLASTING); + public static final RecipeType SMOKING = new RecipeType(net.minecraft.recipe.RecipeType.SMOKING); + public static final RecipeType CAMPFIRE_COOKING = new RecipeType(net.minecraft.recipe.RecipeType.CAMPFIRE_COOKING); + public static final RecipeType STONECUTTING = new RecipeType(net.minecraft.recipe.RecipeType.STONECUTTING); + public static final RecipeType SMITHING = new RecipeType(net.minecraft.recipe.RecipeType.SMITHING); + + protected RecipeType(net.minecraft.recipe.RecipeType recipeType) { + this.recipeType = recipeType; + } + + public static RecipeType of(net.minecraft.recipe.RecipeType recipeType) { + if (recipeType == net.minecraft.recipe.RecipeType.CRAFTING) { + return CRAFTING; + } else if (recipeType == net.minecraft.recipe.RecipeType.SMELTING) { + return SMELTING; + } else if (recipeType == net.minecraft.recipe.RecipeType.BLASTING) { + return BLASTING; + } else if (recipeType == net.minecraft.recipe.RecipeType.SMOKING) { + return SMOKING; + } else if (recipeType == net.minecraft.recipe.RecipeType.CAMPFIRE_COOKING) { + return CAMPFIRE_COOKING; + } else if (recipeType == net.minecraft.recipe.RecipeType.STONECUTTING) { + return STONECUTTING; + } else if (recipeType == net.minecraft.recipe.RecipeType.SMITHING) { + return SMITHING; + } + + return new RecipeType(recipeType); + } + + public static RecipeType of(CompatIdentifier id) { + return of(Registries.RECIPE_TYPE.get(id.toMinecraft())); + } + + public net.minecraft.recipe.RecipeType getRaw() { + return recipeType; + } + + public net.minecraft.recipe.RecipeType toMinecraft() { + return getRaw(); + } + + public CompatIdentifier getId() { + return CompatIdentifier.fromMinecraft(Registries.RECIPE_TYPE.getId(recipeType)); + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java new file mode 100644 index 000000000..29ebedd43 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java @@ -0,0 +1,157 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +import net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry; +import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; +import net.pitan76.mcpitanlib.midohra.recipe.entry.ShapedRecipeEntry; +import net.pitan76.mcpitanlib.midohra.recipe.entry.ShapelessRecipeEntry; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class ServerRecipeManager extends RecipeManager { + private net.minecraft.recipe.ServerRecipeManager serverRecipeManager; + + protected ServerRecipeManager(net.minecraft.recipe.ServerRecipeManager serverRecipeManager) { + super(null); + this.serverRecipeManager = serverRecipeManager; + } + + public static ServerRecipeManager of(net.minecraft.recipe.ServerRecipeManager serverRecipeManager) { + return new ServerRecipeManager(serverRecipeManager); + } + + public static ServerRecipeManager of(net.minecraft.server.world.ServerWorld world) { + return of(world.getRecipeManager()); + } + + public static ServerRecipeManager of(ServerWorld world) { + return of(world.getRaw()); + } + + @Override + public net.minecraft.recipe.ServerRecipeManager getRaw() { + return serverRecipeManager; + } + + @Override + public net.minecraft.recipe.ServerRecipeManager toMinecraft() { + return getRaw(); + } + + @Deprecated + public Collection> getRawRecipes() { + return serverRecipeManager.values(); + } + + public Collection getRecipeEntries() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + recipes.add(RecipeEntry.of(recipe)); + } + + return recipes; + } + + public Collection getCraftingRecipeEntries() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.CraftingRecipe) { + recipes.add(CraftingRecipeEntry.of(recipe)); + } + } + + return recipes; + } + + public Collection getShapelessRecipeEntries() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { + recipes.add(ShapelessRecipeEntry.of(recipe)); + } + } + + return recipes; + } + + public Collection getShapedRecipeEntries() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { + recipes.add(ShapedRecipeEntry.of(recipe)); + } + } + + return recipes; + } + + public Collection getNormalRecipeEntries() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { + recipes.add(ShapelessRecipeEntry.of(recipe)); + } else if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { + recipes.add(ShapedRecipeEntry.of(recipe)); + } + } + + return recipes; + } + + public Collection getRecipes() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + recipes.add(Recipe.of(recipe.value())); + } + + return recipes; + } + + public Collection getCraftingRecipes() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.CraftingRecipe) { + recipes.add(CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) recipe.value())); + } + } + + return recipes; + } + + public Collection getShapelessRecipes() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { + recipes.add(ShapelessRecipe.of((net.minecraft.recipe.ShapelessRecipe) recipe.value())); + } + } + + return recipes; + } + + public Collection getShapedRecipes() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { + recipes.add(ShapedRecipe.of((net.minecraft.recipe.ShapedRecipe) recipe.value())); + } + } + + return recipes; + } + + public Collection getNormalRecipes() { + List recipes = new ArrayList<>(); + for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { + recipes.add(ShapelessRecipe.of((net.minecraft.recipe.ShapelessRecipe) recipe.value())); + } else if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { + recipes.add(ShapedRecipe.of((net.minecraft.recipe.ShapedRecipe) recipe.value())); + } + } + + return recipes; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java new file mode 100644 index 000000000..3d75164fe --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; + +public class ShapedRecipe extends CraftingRecipe { + private final net.minecraft.recipe.ShapedRecipe recipe; + + protected ShapedRecipe(net.minecraft.recipe.ShapedRecipe recipe) { + super(null); + this.recipe = recipe; + } + + public static ShapedRecipe of(net.minecraft.recipe.ShapedRecipe recipe) { + return new ShapedRecipe(recipe); + } + + public net.minecraft.recipe.ShapedRecipe getRaw() { + return recipe; + } + + public net.minecraft.recipe.ShapedRecipe toMinecraft() { + return getRaw(); + } + + public boolean matches(CraftingRecipeInputOrInventory input) { + return getRaw().matches(input.getRaw(), null); + } + + @Deprecated + public net.minecraft.item.ItemStack craft() { + return getRaw().craft(null, null); + } + + public net.minecraft.item.ItemStack craft(CompatRegistryLookup registryLookup) { + return getRaw().craft(null, registryLookup.getRegistryLookup()); + } + + public net.minecraft.item.ItemStack craft(World world) { + return getRaw().craft(null, world.getRegistryManager()); + } + + public net.minecraft.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { + return craft(world.getRaw()); + } + + public ItemStack craftMidohra() { + return ItemStack.of(craft()); + } + + public int getWidth() { + return getRaw().getWidth(); + } + + public int getHeight() { + return getRaw().getHeight(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java new file mode 100644 index 000000000..26d28b05b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java @@ -0,0 +1,52 @@ +package net.pitan76.mcpitanlib.midohra.recipe; + +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; + +public class ShapelessRecipe extends CraftingRecipe { + private final net.minecraft.recipe.ShapelessRecipe recipe; + + protected ShapelessRecipe(net.minecraft.recipe.ShapelessRecipe recipe) { + super(null); + this.recipe = recipe; + } + + public static ShapelessRecipe of(net.minecraft.recipe.ShapelessRecipe recipe) { + return new ShapelessRecipe(recipe); + } + + public net.minecraft.recipe.ShapelessRecipe getRaw() { + return recipe; + } + + public net.minecraft.recipe.ShapelessRecipe toMinecraft() { + return getRaw(); + } + + public boolean matches(CraftingRecipeInputOrInventory input) { + return getRaw().matches(input.getRaw(), null); + } + + @Deprecated + public net.minecraft.item.ItemStack craft() { + return getRaw().craft(null, null); + } + + public net.minecraft.item.ItemStack craft(CompatRegistryLookup registryLookup) { + return getRaw().craft(null, registryLookup.getRegistryLookup()); + } + + public net.minecraft.item.ItemStack craft(World world) { + return getRaw().craft(null, world.getRegistryManager()); + } + + public net.minecraft.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { + return craft(world.getRaw()); + } + + public ItemStack craftMidohra() { + return ItemStack.of(craft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java new file mode 100644 index 000000000..6dff1c145 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.midohra.recipe.entry; + +import net.minecraft.recipe.Recipe; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; + +public class CraftingRecipeEntry extends RecipeEntry { + private final net.minecraft.recipe.RecipeEntry recipeEntry; + + protected CraftingRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + super(null); + this.recipeEntry = recipeEntry; + } + + public static CraftingRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { + return new CraftingRecipeEntry(recipeEntry); + } + + public static CraftingRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { + return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); + } + + public static CraftingRecipeEntry of(net.minecraft.recipe.CraftingRecipe recipe, CompatIdentifier id) { + RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); + net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + + return of(recipeEntry); + } + + public static CraftingRecipeEntry of(CraftingRecipe recipe, CompatIdentifier id) { + return of(recipe.toMinecraft(), id); + } + + @Override + public net.minecraft.recipe.RecipeEntry getRaw() { + return recipeEntry; + } + + @Override + public net.minecraft.recipe.RecipeEntry toMinecraft() { + return getRaw(); + } + + @Override + public CraftingRecipe getRecipe() { + return CraftingRecipe.of(getRawRecipe()); + } + + @Override + public net.minecraft.recipe.CraftingRecipe getRawRecipe() { + return getRaw().value(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java new file mode 100644 index 000000000..9e7814374 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java @@ -0,0 +1,87 @@ +package net.pitan76.mcpitanlib.midohra.recipe.entry; + +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; +import net.pitan76.mcpitanlib.midohra.recipe.Recipe; +import net.pitan76.mcpitanlib.midohra.recipe.RecipeType; + +public class RecipeEntry { + private final net.minecraft.recipe.RecipeEntry recipeEntry; + + protected RecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + this.recipeEntry = recipeEntry; + } + + public static RecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { + return new RecipeEntry(recipeEntry); + } + + public static RecipeEntry of(net.minecraft.recipe.Recipe recipe, CompatIdentifier id) { + RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); + net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + return of(recipeEntry); + } + + public static RecipeEntry of(Recipe recipe, CompatIdentifier id) { + return of(recipe.toMinecraft(), id); + } + + public static CraftingRecipeEntry of(net.minecraft.recipe.CraftingRecipe recipe, CompatIdentifier id) { + return CraftingRecipeEntry.of(recipe, id); + } + + public static CraftingRecipeEntry of(CraftingRecipe recipe, CompatIdentifier id) { + return CraftingRecipeEntry.of(recipe, id); + } + + public static ShapedRecipeEntry of(net.minecraft.recipe.ShapedRecipe recipe, CompatIdentifier id) { + return ShapedRecipeEntry.of(recipe, id); + } + + public static ShapedRecipeEntry of(net.pitan76.mcpitanlib.midohra.recipe.ShapedRecipe recipe, CompatIdentifier id) { + return ShapedRecipeEntry.of(recipe, id); + } + + public static ShapelessRecipeEntry of(net.minecraft.recipe.ShapelessRecipe recipe, CompatIdentifier id) { + return ShapelessRecipeEntry.of(recipe, id); + } + + public static ShapelessRecipeEntry of(net.pitan76.mcpitanlib.midohra.recipe.ShapelessRecipe recipe, CompatIdentifier id) { + return ShapelessRecipeEntry.of(recipe, id); + } + + public net.minecraft.recipe.RecipeEntry getRaw() { + return recipeEntry; + } + + public net.minecraft.recipe.RecipeEntry toMinecraft() { + return getRaw(); + } + + public CompatIdentifier getId() { + return CompatIdentifier.fromMinecraft(getRaw().id().getValue()); + } + + public CompatRecipeEntry toCompatRecipeEntry() { + return new CompatRecipeEntry(getRaw()); + } + + public net.minecraft.recipe.Recipe getRawRecipe() { + return getRaw().value(); + } + + public Recipe getRecipe() { + return Recipe.of(getRaw().value()); + } + + public RecipeType getRecipeType() { + return RecipeType.of(getRawRecipeType()); + } + + public net.minecraft.recipe.RecipeType getRawRecipeType() { + return getRaw().value().getType(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java new file mode 100644 index 000000000..569564a95 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.midohra.recipe.entry; + +import net.minecraft.recipe.Recipe; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.recipe.ShapedRecipe; + +public class ShapedRecipeEntry extends RecipeEntry { + private final net.minecraft.recipe.RecipeEntry recipeEntry; + + protected ShapedRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + super(null); + this.recipeEntry = recipeEntry; + } + + public static ShapedRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { + return new ShapedRecipeEntry(recipeEntry); + } + + public static ShapedRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { + return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); + } + + public static ShapedRecipeEntry of(net.minecraft.recipe.ShapedRecipe recipe, CompatIdentifier id) { + RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); + net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + + return of(recipeEntry); + } + + public static ShapedRecipeEntry of(ShapedRecipe recipe, CompatIdentifier id) { + return of(recipe.toMinecraft(), id); + } + + @Override + public net.minecraft.recipe.RecipeEntry getRaw() { + return recipeEntry; + } + + @Override + public net.minecraft.recipe.RecipeEntry toMinecraft() { + return getRaw(); + } + + @Override + public ShapedRecipe getRecipe() { + return ShapedRecipe.of(getRawRecipe()); + } + + @Override + public net.minecraft.recipe.ShapedRecipe getRawRecipe() { + return getRaw().value(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java new file mode 100644 index 000000000..2026084bd --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.midohra.recipe.entry; + +import net.minecraft.recipe.Recipe; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.recipe.ShapelessRecipe; + +public class ShapelessRecipeEntry extends RecipeEntry { + private final net.minecraft.recipe.RecipeEntry recipeEntry; + + protected ShapelessRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + super(null); + this.recipeEntry = recipeEntry; + } + + public static ShapelessRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { + return new ShapelessRecipeEntry(recipeEntry); + } + + public static ShapelessRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { + return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); + } + + public static ShapelessRecipeEntry of(net.minecraft.recipe.ShapelessRecipe recipe, CompatIdentifier id) { + RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); + net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + + return of(recipeEntry); + } + + public static ShapelessRecipeEntry of(ShapelessRecipe recipe, CompatIdentifier id) { + return of(recipe.toMinecraft(), id); + } + + @Override + public net.minecraft.recipe.RecipeEntry getRaw() { + return recipeEntry; + } + + @Override + public net.minecraft.recipe.RecipeEntry toMinecraft() { + return getRaw(); + } + + @Override + public ShapelessRecipe getRecipe() { + return ShapelessRecipe.of(getRawRecipe()); + } + + @Override + public net.minecraft.recipe.ShapelessRecipe getRawRecipe() { + return getRaw().value(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java new file mode 100644 index 000000000..2b65cfda1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java @@ -0,0 +1,67 @@ +package net.pitan76.mcpitanlib.midohra.recipe.input; + +import net.minecraft.inventory.CraftingInventory; +import net.minecraft.inventory.Inventory; +import net.minecraft.recipe.input.CraftingRecipeInput; +import org.jetbrains.annotations.Nullable; + +public class CraftingRecipeInputOrInventory extends RecipeInputOrInventory { + private final CraftingRecipeInput recipeInput; + private CraftingInventory inventory = null; + + public static CraftingRecipeInputOrInventory EMPTY = new CraftingRecipeInputOrInventory(CraftingRecipeInput.EMPTY); + + protected CraftingRecipeInputOrInventory(CraftingRecipeInput recipeInput) { + super(null); + this.recipeInput = recipeInput; + } + + protected CraftingRecipeInputOrInventory(CraftingInventory inventory) { + super(null); + this.recipeInput = inventory.createRecipeInput(); + this.inventory = inventory; + } + + public static CraftingRecipeInputOrInventory of(CraftingRecipeInput recipeInput) { + return new CraftingRecipeInputOrInventory(recipeInput); + } + + public static CraftingRecipeInputOrInventory of(Inventory inventory) { + if (inventory instanceof CraftingRecipeInput) { + return of((CraftingRecipeInput) inventory); + } + + return EMPTY; + } + + public static CraftingRecipeInputOrInventory of(CraftingInventory inventory) { + return new CraftingRecipeInputOrInventory(inventory); + } + + @Nullable + @Override + public CraftingRecipeInput getRaw() { + return recipeInput; + } + + @Nullable + @Override + public CraftingRecipeInput toMinecraft() { + return getRaw(); + } + + @Nullable + @Override + public CraftingRecipeInput getRecipeInput() { + return getRaw(); + } + + @Nullable + @Override + public Inventory getInventory() { + if (inventory != null) + return inventory; + + return super.getInventory(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java new file mode 100644 index 000000000..71ff3d195 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java @@ -0,0 +1,80 @@ +package net.pitan76.mcpitanlib.midohra.recipe.input; + +import net.minecraft.inventory.Inventory; +import net.minecraft.recipe.input.RecipeInput; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +public class RecipeInputOrInventory { + private final RecipeInput recipeInput; + + public static RecipeInputOrInventory NONE = new RecipeInputOrInventory(null); + + protected RecipeInputOrInventory(RecipeInput recipeInput) { + this.recipeInput = recipeInput; + } + + public static RecipeInputOrInventory of(RecipeInput recipeInput) { + return new RecipeInputOrInventory(recipeInput); + } + + public static RecipeInputOrInventory of(Inventory inventory) { + if (inventory instanceof RecipeInput) { + return of((RecipeInput) inventory); + } + + return NONE; + } + + @Nullable + public RecipeInput getRaw() { + return recipeInput; + } + + @Nullable + public RecipeInput toMinecraft() { + return getRaw(); + } + + @Nullable + public RecipeInput getRecipeInput() { + return getRaw(); + } + + @Nullable + public Inventory getInventory() { + if (getRaw() instanceof Inventory) { + return (Inventory) getRaw(); + } + + return null; + } + + public boolean isNone() { + return getRaw() == null; + } + + public int size() { + if (isNone()) return 0; + + return getRaw().size(); + } + + public boolean isEmpty() { + if (isNone()) return true; + + return getRaw().isEmpty(); + } + + public net.minecraft.item.ItemStack getStack(int slot) { + if (isNone()) return net.minecraft.item.ItemStack.EMPTY; + + return getRaw().getStackInSlot(slot); + } + + public ItemStack getMidohraStack(int slot) { + if (isNone()) return ItemStack.EMPTY; + + return ItemStack.of(getStack(slot)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java new file mode 100644 index 000000000..66f46d30d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java @@ -0,0 +1,56 @@ +package net.pitan76.mcpitanlib.midohra.recipe.input; + +import net.minecraft.inventory.Inventory; +import net.minecraft.recipe.input.RecipeInput; +import org.jetbrains.annotations.Nullable; + +public class TypedRecipeInputOrInventory extends RecipeInputOrInventory { + private final T recipeInput; + + public static TypedRecipeInputOrInventory NONE = new TypedRecipeInputOrInventory<>(null); + + protected TypedRecipeInputOrInventory(T recipeInput) { + super(null); + this.recipeInput = recipeInput; + } + + public static TypedRecipeInputOrInventory _of(T recipeInput) { + return new TypedRecipeInputOrInventory<>(recipeInput); + } + + public static TypedRecipeInputOrInventory of(Inventory inventory) { + if (inventory instanceof RecipeInput) { + return _of((RecipeInput) inventory); + } + + return NONE; + } + + @Nullable + @Override + public T getRaw() { + return recipeInput; + } + + @Nullable + @Override + public T getRecipeInput() { + return getRaw(); + } + + @Nullable + @Override + public T toMinecraft() { + return getRaw(); + } + + @Nullable + @Override + public Inventory getInventory() { + if (getRaw() instanceof Inventory) { + return (Inventory) getRaw(); + } + + return null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java new file mode 100644 index 000000000..ecfae63c7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java @@ -0,0 +1,74 @@ +package net.pitan76.mcpitanlib.midohra.resource; + +import net.pitan76.mcpitanlib.api.util.LoggerUtil; +import net.pitan76.mcpitanlib.api.util.ResourceUtil; +import org.apache.commons.io.IOUtils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +public class Resource { + private final net.minecraft.resource.Resource resource; + + protected Resource(net.minecraft.resource.Resource resource) { + this.resource = resource; + } + + public static Resource of(net.minecraft.resource.Resource resource) { + return new Resource(resource); + } + + public net.minecraft.resource.Resource getRaw() { + return resource; + } + + public net.minecraft.resource.Resource toMinecraft() { + return getRaw(); + } + + public BufferedReader getReader() throws IOException { + return resource.getReader(); + } + + public String getPackId() { + return resource.getPackId(); + } + + public InputStream getInputStream() { + try { + return ResourceUtil.getInputStream(resource); + } catch (IOException e) { + LoggerUtil.error(LoggerUtil.getLogger(), "Failed to read resource: " + e.getMessage()); + return null; + } + } + + public void close() { + try { + ResourceUtil.close(resource); + } catch (IOException e) { + LoggerUtil.error(LoggerUtil.getLogger(), "Failed to close resource: " + e.getMessage()); + } + } + + public String getContent() throws IOException { + String content = IOUtils.toString(getInputStream(), StandardCharsets.UTF_8); + close(); + return content; + } + + public String getContent(String encoding) throws IOException { + String content = IOUtils.toString(getInputStream(), encoding); + close(); + return content; + } + + public String getContent(Charset encoding) throws IOException { + String content = IOUtils.toString(getInputStream(), encoding); + close(); + return content; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java new file mode 100644 index 000000000..efc080618 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java @@ -0,0 +1,84 @@ +package net.pitan76.mcpitanlib.midohra.resource; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; +import net.minecraft.resources.Identifier; +import net.minecraft.world.WorldAccess; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.LoggerUtil; +import net.pitan76.mcpitanlib.api.util.ResourceUtil; +import net.pitan76.mcpitanlib.midohra.server.MCServer; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +public class ResourceManager { + private final net.minecraft.resource.ResourceManager resourceManager; + + protected ResourceManager(net.minecraft.resource.ResourceManager resourceManager) { + this.resourceManager = resourceManager; + } + + public static ResourceManager of(net.minecraft.resource.ResourceManager resourceManager) { + return new ResourceManager(resourceManager); + } + + public static ResourceManager of(net.minecraft.server.MinecraftServer server) { + return of(MCServer.of(server)); + } + + public static ResourceManager of(MCServer server) { + return of(server.getRaw()); + } + + @Environment(EnvType.CLIENT) + public static ResourceManager of(MinecraftClient client) { + return of(client.getResourceManager()); + } + + public static ResourceManager of(WorldAccess worldAccess) { + return of(worldAccess.getServer()); + } + + public static ResourceManager of(net.pitan76.mcpitanlib.midohra.world.WorldAccess worldAccess) { + return of(worldAccess.getServer()); + } + + public net.minecraft.resource.ResourceManager getRaw() { + return resourceManager; + } + + public net.minecraft.resource.ResourceManager toMinecraft() { + return getRaw(); + } + + public Map findResources(String startPath, String endPath) { + Map map = new HashMap<>(); + try { + Map rawMap = ResourceUtil.findResources(resourceManager, startPath, endPath); + for (Map.Entry entry : rawMap.entrySet()) { + map.put(CompatIdentifier.fromMinecraft(entry.getKey()), Resource.of(entry.getValue())); + } + } catch (IOException e) { + LoggerUtil.error(LoggerUtil.getLogger(), "Failed to read " + startPath + ": " + e.getMessage()); + return null; + } + + return map; + } + + public Resource getResource(CompatIdentifier id) { + Optional resource = resourceManager.getResource(id.toMinecraft()); + return resource.map(Resource::of).orElse(null); + } + + public List getAllResources(CompatIdentifier id) { + return resourceManager.getAllResources(id.toMinecraft()) + .stream().map(Resource::of).toList(); + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java b/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java new file mode 100644 index 000000000..997dafb98 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java @@ -0,0 +1,96 @@ +package net.pitan76.mcpitanlib.midohra.server; + +import net.minecraft.server.MinecraftServer; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.ServerUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.resource.ResourceManager; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; + +public class MCServer { + private final MinecraftServer server; + + protected MCServer(MinecraftServer server) { + this.server = server; + } + + public static MCServer of(MinecraftServer server) { + return new MCServer(server); + } + + public MinecraftServer getRaw() { + return server; + } + + public MinecraftServer toMinecraft() { + return getRaw(); + } + + public String getIP() { + return ServerUtil.getIP(server); + } + + public int getPort() { + return ServerUtil.getPort(server); + } + + public String getMotd() { + return ServerUtil.getMotd(server); + } + + public String getServerModName() { + return ServerUtil.getServerModName(server); + } + + public int getMaxPlayerCount() { + return ServerUtil.getMaxPlayerCount(server); + } + + public int getCurrentPlayerCount() { + return ServerUtil.getCurrentPlayerCount(server); + } + + public boolean isOnlineMode() { + return ServerUtil.isOnlineMode(server); + } + + public boolean isServerRunning() { + return ServerUtil.isServerRunning(server); + } + + public boolean isServerDedicated() { + return ServerUtil.isServerDedicated(server); + } + + public boolean isSingleplayer() { + return ServerUtil.isSingleplayer(server); + } + + public PlayerManager getPlayerManager() { + return PlayerManager.of(ServerUtil.getPlayerManager(server)); + } + + public ServerWorld getWorld(CompatIdentifier id) { + return ServerWorld.of(WorldUtil.getWorld(server, id)); + } + + public ServerWorld getOverworld() { + return ServerWorld.of(WorldUtil.getOverworld(server)); + } + + public ServerWorld getNether() { + return ServerWorld.of(WorldUtil.getNether(server)); + } + + public ServerWorld getEnd() { + return ServerWorld.of(WorldUtil.getEnd(server)); + } + + public ResourceManager getResourceManager() { + return ResourceManager.of(server.getResourceManager()); + } + + public void execute(Runnable runnable) { + ServerUtil.execute(getRaw(), runnable); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java new file mode 100644 index 000000000..36efcb21a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java @@ -0,0 +1,152 @@ +package net.pitan76.mcpitanlib.midohra.server; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.BannedIpList; +import net.minecraft.server.BannedPlayerList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.Whitelist; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import net.pitan76.mcpitanlib.midohra.world.World; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class PlayerManager { + private final net.minecraft.server.PlayerManager playerManager; + + protected PlayerManager(net.minecraft.server.PlayerManager playerManager) { + this.playerManager = playerManager; + } + + public static PlayerManager of(net.minecraft.server.PlayerManager playerManager) { + return new PlayerManager(playerManager); + } + + public static PlayerManager of(MinecraftServer server) { + return of(server.getPlayerManager()); + } + + public static PlayerManager of(MCServer server) { + return of(server.getRaw()); + } + + public static PlayerManager of(ServerWorld world) { + return of(world.getServer()); + } + + public static PlayerManager of(World world) { + return of(world.getServer()); + } + + public net.minecraft.server.PlayerManager getRaw() { + return playerManager; + } + + public net.minecraft.server.PlayerManager toMinecraft() { + return getRaw(); + } + + public void broadcast(TextComponent message, boolean overlay) { + getRaw().broadcast(message.getText(), overlay); + } + + public void broadcast(TextComponent message) { + broadcast(message, false); + } + + public void broadcast(String message, boolean overlay) { + getRaw().broadcast(TextUtil.literal(message), overlay); + } + + public void broadcast(String message) { + broadcast(message, false); + } + + public void removePlayer(Player player) { + getRaw().remove(player.getServerPlayer().get()); + } + + public Player getPlayerByUUID(UUID uuid) { + return new Player(getRaw().getPlayer(uuid)); + } + + public Player getPlayerByName(String name) { + return new Player(getRaw().getPlayer(name)); + } + + public List getPlayersByIP(String ip) { + List players = new ArrayList<>(); + for (net.minecraft.entity.player.PlayerEntity p: getRaw().getPlayersByIp(ip)) { + players.add(new Player(p)); + } + return players; + } + + public List getPlayers() { + List players = new ArrayList<>(); + for (PlayerEntity p : getRaw().getPlayerList()) { + players.add(new Player(p)); + } + return players; + } + + public boolean isExistByUUID(UUID uuid) { + return getRaw().getPlayer(uuid) != null; + } + + public boolean isExistByName(String name) { + return getRaw().getPlayer(name) != null; + } + + public boolean isExistByIP(String ip) { + return !getRaw().getPlayersByIp(ip).isEmpty(); + } + + public boolean hasPlayerByUUID(UUID uuid) { + return getRaw().getPlayer(uuid) != null; + } + + public boolean hasPlayerByName(String name) { + return getRaw().getPlayer(name) != null; + } + + public boolean hasPlayerByIP(String ip) { + return !getRaw().getPlayersByIp(ip).isEmpty(); + } + + public int getCurrentPlayerCount() { + return getRaw().getCurrentPlayerCount(); + } + + public int getMaxPlayerCount() { + return getRaw().getMaxPlayerCount(); + } + + public boolean isWhitelistEnabled() { + return getRaw().isWhitelistEnabled(); + } + + public void setWhitelistEnabled(boolean enabled) { + getRaw().getServer().setUseAllowlist(enabled); + } + + public Whitelist getWhitelist() { + return getRaw().getWhitelist(); + } + + public void reloadWhitelist() { + getRaw().reloadWhitelist(); + } + + public BannedIpList getBannedIpList() { + return getRaw().getIpBanList(); + } + + public BannedPlayerList getBannedPlayerList() { + return getRaw().getUserBanList(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java new file mode 100644 index 000000000..2492fca64 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java @@ -0,0 +1,59 @@ +package net.pitan76.mcpitanlib.midohra.util.hit; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; + +public class BlockHitResult extends HitResult { + public BlockHitResult(net.minecraft.util.hit.BlockHitResult raw) { + super(raw); + } + + public static BlockHitResult of(net.minecraft.util.hit.BlockHitResult raw) { + return new BlockHitResult(raw); + } + + @Deprecated + public net.minecraft.util.hit.BlockHitResult getRaw() { + return (net.minecraft.util.hit.BlockHitResult) super.getRaw(); + } + + public net.minecraft.util.hit.BlockHitResult withSide(Direction side) { + return getRaw().withSide(side); + } + + public net.minecraft.util.hit.BlockHitResult withBlockPos(BlockPos blockPos) { + return getRaw().withBlockPos(blockPos); + } + + public net.minecraft.util.hit.BlockHitResult againstWorldBorder() { + return getRaw().againstWorldBorder(); + } + + public BlockPos getBlockPos() { + return getRaw().getBlockPos(); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getBlockPosM() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getBlockPos()); + } + + public Direction getSide() { + return getRaw().getSide(); + } + + public net.pitan76.mcpitanlib.midohra.util.math.Direction getSideM() { + return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(getSide()); + } + + public boolean isInsideBlock() { + return getRaw().isInsideBlock(); + } + + public boolean isAgainstWorldBorder() { + return getRaw().isAgainstWorldBorder(); + } + + public HitResultType getType() { + return HitResultType.from(getRaw().getType()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java new file mode 100644 index 000000000..97e521de9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java @@ -0,0 +1,106 @@ +package net.pitan76.mcpitanlib.midohra.util.hit; + +import net.minecraft.entity.Entity; +import net.minecraft.util.math.Vec3d; + +import java.util.Optional; + +public class HitResult { + protected final net.minecraft.util.hit.HitResult raw; + + public HitResult(net.minecraft.util.hit.HitResult raw) { + this.raw = raw; + } + + public static HitResult of(net.minecraft.util.hit.HitResult raw) { + return new HitResult(raw); + } + + @Deprecated + public net.minecraft.util.hit.HitResult getRaw() { + return raw; + } + + @Deprecated + public net.minecraft.util.hit.HitResult.Type getRawType() { + return getRaw().getType(); + } + + public Vec3d getPos() { + return getRaw().getPos(); + } + + public double getX() { + return pos().x; + } + + public double getY() { + return pos().y; + } + + public double getZ() { + return pos().z; + } + + public HitResultType getType() { + return HitResultType.of(this); + } + + public double squaredDistanceTo(Vec3d point) { + Vec3d hitPos = getPos(); + double dx = hitPos.x - point.x; + double dy = hitPos.y - point.y; + double dz = hitPos.z - point.z; + return dx * dx + dy * dy + dz * dz; + } + + public double squaredDistanceTo(Entity entity) { + return getRaw().squaredDistanceTo(entity); + } + + public Vec3d pos() { + return getPos(); + } + + public double x() { + return getX(); + } + + public double y() { + return getY(); + } + + public double z() { + return getZ(); + } + + public Optional asBlockHitResult() { + if (this instanceof BlockHitResult) { + return Optional.of((BlockHitResult) this); + } + + if (raw instanceof net.minecraft.util.hit.BlockHitResult) { + return Optional.of(BlockHitResult.of((net.minecraft.util.hit.BlockHitResult) raw)); + } + + return Optional.empty(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + HitResult other = (HitResult) obj; + return getRaw().equals(other.getRaw()); + } + + @Override + public int hashCode() { + return getRaw().hashCode(); + } + + @Override + public String toString() { + return getRaw().toString(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java new file mode 100644 index 000000000..6002f2195 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.midohra.util.hit; + +import net.minecraft.util.hit.HitResult; + +public enum HitResultType { + MISS(HitResult.Type.MISS), + BLOCK(HitResult.Type.BLOCK), + ENTITY(HitResult.Type.ENTITY); + + private final HitResult.Type raw; + + HitResultType(HitResult.Type raw) { + this.raw = raw; + } + + @Deprecated + public HitResult.Type getRaw() { + return raw; + } + + public static HitResultType from(HitResult.Type raw) { + switch (raw) { + case MISS: + return MISS; + case BLOCK: + return BLOCK; + case ENTITY: + return ENTITY; + } + throw new IllegalArgumentException("Unknown HitResult.Type: " + raw); + } + + public static HitResultType of(net.pitan76.mcpitanlib.midohra.util.hit.HitResult result) { + return from(result.getRawType()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java new file mode 100644 index 000000000..657c37939 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java @@ -0,0 +1,138 @@ +package net.pitan76.mcpitanlib.midohra.util.math; + +import net.minecraft.util.math.Vec3i; + +import java.util.Iterator; + +public class BlockPos { + private final net.minecraft.util.math.BlockPos blockPos; + + protected BlockPos(net.minecraft.util.math.BlockPos blockPos) { + this.blockPos = blockPos; + } + + public static BlockPos of(net.minecraft.util.math.BlockPos blockPos) { + return new BlockPos(blockPos); + } + + public static BlockPos of(int x, int y, int z) { + return new BlockPos(new net.minecraft.util.math.BlockPos(x, y, z)); + } + + public int getX() { + return blockPos.getX(); + } + + public int getY() { + return blockPos.getY(); + } + + public int getZ() { + return blockPos.getZ(); + } + + public net.minecraft.util.math.BlockPos toMinecraft() { + return blockPos; + } + + public net.minecraft.util.math.BlockPos toRaw() { + return toMinecraft(); + } + + public BlockPos add(int x, int y, int z) { + return new BlockPos(blockPos.add(x, y, z)); + } + + public BlockPos add(BlockPos pos) { + return new BlockPos(blockPos.add(pos.blockPos)); + } + + public BlockPos subtract(int x, int y, int z) { + return new BlockPos(blockPos.subtract(new Vec3i(x, y, z))); + } + + public BlockPos subtract(BlockPos pos) { + return new BlockPos(blockPos.subtract(pos.blockPos)); + } + + public BlockPos up() { + return new BlockPos(blockPos.up()); + } + + public BlockPos down() { + return new BlockPos(blockPos.down()); + } + + public BlockPos north() { + return new BlockPos(blockPos.north()); + } + + public BlockPos south() { + return new BlockPos(blockPos.south()); + } + + public BlockPos east() { + return new BlockPos(blockPos.east()); + } + + public BlockPos west() { + return new BlockPos(blockPos.west()); + } + + public BlockPos offset(Direction direction, int amount) { + return new BlockPos(blockPos.offset(direction.toMinecraft(), amount)); + } + + public BlockPos offset(Direction direction) { + return new BlockPos(blockPos.offset(direction.toMinecraft())); + } + + public ChunkPos toChunkPos() { + return ChunkPos.of(this); + } + + @Override + public int hashCode() { + return blockPos.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + BlockPos pos = (BlockPos) obj; + return blockPos.equals(pos.blockPos); + } + + public static Iterable iterate(BlockPos start, BlockPos end) { + return () -> new Iterator<>() { + private final Iterator rawIterator = net.minecraft.util.math.BlockPos.iterate(start.toRaw(), end.toRaw()).iterator(); + + @Override + public boolean hasNext() { + return rawIterator.hasNext(); + } + + @Override + public BlockPos next() { + return new BlockPos(rawIterator.next()); + } + }; + } + + public long asLong() { + return blockPos.asLong(); + } + + public Vector3i toVector3i() { + return new Vector3i(getX(), getY(), getZ()); + } + + public Vector3d toVector3d() { + return new Vector3d(getX(), getY(), getZ()); + } + + public Vector3d toCenterVector3d() { + return new Vector3d(getX() + 0.5, getY() + 0.5, getZ() + 0.5); + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java new file mode 100644 index 000000000..68e46a035 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java @@ -0,0 +1,144 @@ +package net.pitan76.mcpitanlib.midohra.util.math; + +import net.minecraft.util.math.Vec3d; +import net.pitan76.mcpitanlib.api.util.math.BoxUtil; + +public class Box { + protected final net.minecraft.util.math.Box box; + + @Deprecated + public Box(net.minecraft.util.math.Box box) { + this.box = box; + } + + @Deprecated + public net.minecraft.util.math.Box toMinecraft() { + return box; + } + + public Box(double x1, double y1, double z1, double x2, double y2, double z2) { + this(BoxUtil.createBox(x1, y1, z1, x2, y2, z2)); + } + + public Box(double x, double y, double z, double size) { + this(x, y, z, x + size, y + size, z + size); + } + + public Box(double size) { + this(0, 0, 0, size, size, size); + } + + public Box(BlockPos pos) { + this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + } + + public Box(net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos pos) { + this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + } + + public Box(BlockPos pos1, BlockPos pos2) { + this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); + } + + public Box(net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos pos1, net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos pos2) { + this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); + } + + public Box(Vector3i pos) { + this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + } + + public Box(Vector3i pos1, Vector3i pos2) { + this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); + } + + public Box(Vector3d pos) { + this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + } + + public Box(Vector3d pos1, Vector3d pos2) { + this(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); + } + + public Box expand(double x, double y, double z) { + return new Box(BoxUtil.expand(box, x, y, z)); + } + + public Box expand(double size) { + return expand(size, size, size); + } + + public Box union(Box other) { + return new Box(BoxUtil.union(box, other.box)); + } + + public double getMinX() { + return box.minX; + } + + public double getMinY() { + return box.minY; + } + + public double getMinZ() { + return box.minZ; + } + + public double getMaxX() { + return box.maxX; + } + + public double getMaxY() { + return box.maxY; + } + + public double getMaxZ() { + return box.maxZ; + } + + public Vector3d getCenter() { + Vec3d center = box.getCenter(); + return new Vector3d(center.x, center.y, center.z); + } + + public double getLengthX() { + return box.getLengthX(); + } + + public double getLengthY() { + return box.getLengthY(); + } + + public double getLengthZ() { + return box.getLengthZ(); + } + + @Override + public int hashCode() { + return box.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + Box other = (Box) obj; + return box.equals(other.box); + } + + public BlockPos getMinPos() { + return BlockPos.of((int) box.minX, (int) box.minY, (int) box.minZ); + } + + public BlockPos getMaxPos() { + return BlockPos.of((int) box.maxX, (int) box.maxY, (int) box.maxZ); + } + + public Vector3i getMinVector() { + return new Vector3i((int) box.minX, (int) box.minY, (int) box.minZ); + } + + public Vector3i getMaxVector() { + return new Vector3i((int) box.maxX, (int) box.maxY, (int) box.maxZ); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java new file mode 100644 index 000000000..da5a979e7 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java @@ -0,0 +1,154 @@ +package net.pitan76.mcpitanlib.midohra.util.math; + +import java.util.stream.Stream; + +public class ChunkPos { + private final net.minecraft.util.math.ChunkPos pos; + + protected ChunkPos(net.minecraft.util.math.ChunkPos pos) { + this.pos = pos; + } + + public static ChunkPos of(net.minecraft.util.math.ChunkPos pos) { + return new ChunkPos(pos); + } + + public static ChunkPos of(int x, int z) { + return of(new net.minecraft.util.math.ChunkPos(x, z)); + } + + public static ChunkPos of(BlockPos pos) { + return of(new net.minecraft.util.math.ChunkPos(pos.toMinecraft())); + } + + public static ChunkPos of(long pos) { + return of(new net.minecraft.util.math.ChunkPos(pos)); + } + + public static ChunkPos fromRegion(int x, int z) { + return of(net.minecraft.util.math.ChunkPos.fromRegion(x, z)); + } + + public static ChunkPos fromRegionCenter(int x, int z) { + return of(net.minecraft.util.math.ChunkPos.fromRegionCenter(x, z)); + } + + public net.minecraft.util.math.ChunkPos getRaw() { + return pos; + } + + public net.minecraft.util.math.ChunkPos toMinecraft() { + return getRaw(); + } + + public int getX() { + return getRaw().x; + } + + public int getZ() { + return getRaw().z; + } + + public int getOffsetX(int offsetX) { + return getRaw().getOffsetX(offsetX); + } + + public int getOffsetZ(int offsetZ) { + return getRaw().getOffsetZ(offsetZ); + } + + public int getStartX() { + return getRaw().getStartX(); + } + + public int getStartZ() { + return getRaw().getStartZ(); + } + + public int getEndX() { + return getRaw().getEndX(); + } + + public int getEndZ() { + return getRaw().getEndZ(); + } + + public int getCenterX() { + return getRaw().getCenterX(); + } + + public int getCenterZ() { + return getRaw().getCenterZ(); + } + + public int getRegionX() { + return getRaw().getRegionX(); + } + + public int getRegionZ() { + return getRaw().getRegionZ(); + } + + public int getRegionRelativeX() { + return getRaw().getRegionRelativeX(); + } + + public int getRegionRelativeZ() { + return getRaw().getRegionRelativeZ(); + } + + public BlockPos getStartPos() { + return BlockPos.of(getRaw().getStartPos()); + } + + public BlockPos getCenterAtY(int y) { + return BlockPos.of(getRaw().getCenterAtY(y)); + } + + public BlockPos getBlockPos(int offsetX, int y, int offsetZ) { + return BlockPos.of(getRaw().getBlockPos(offsetX, y, offsetZ)); + } + + public long toLong() { + return getRaw().toLong(); + } + + @Override + public String toString() { + return getRaw().toString(); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof ChunkPos && getRaw().equals(((ChunkPos) obj).getRaw()); + } + + @Override + public int hashCode() { + return getRaw().hashCode(); + } + + public int getChebyshevDistance(ChunkPos pos) { + return getRaw().getChebyshevDistance(pos.getRaw()); + } + + public int getChebyshevDistance(int x, int z) { + return getRaw().getChebyshevDistance(x, z); + } + + public int getSquaredDistance(ChunkPos pos) { + return getRaw().getSquaredDistance(pos.getRaw()); + } + + public int getSquaredDistance(long pos) { + return getRaw().getSquaredDistance(pos); + } + + public static Stream stream(ChunkPos center, int radius) { + return net.minecraft.util.math.ChunkPos.stream(center.getRaw(), radius).map(ChunkPos::of); + } + + public static Stream stream(final ChunkPos pos1, final ChunkPos pos2) { + return net.minecraft.util.math.ChunkPos.stream(pos1.getRaw(), pos2.getRaw()).map(ChunkPos::of); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java new file mode 100644 index 000000000..eebc3da6f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java @@ -0,0 +1,133 @@ +package net.pitan76.mcpitanlib.midohra.util.math; + +public class Direction { + + public static final Direction UP = new Direction(net.minecraft.util.math.Direction.UP); + public static final Direction DOWN = new Direction(net.minecraft.util.math.Direction.DOWN); + public static final Direction NORTH = new Direction(net.minecraft.util.math.Direction.NORTH); + public static final Direction SOUTH = new Direction(net.minecraft.util.math.Direction.SOUTH); + public static final Direction EAST = new Direction(net.minecraft.util.math.Direction.EAST); + public static final Direction WEST = new Direction(net.minecraft.util.math.Direction.WEST); + + private final net.minecraft.util.math.Direction direction; + + protected Direction(net.minecraft.util.math.Direction direction) { + this.direction = direction; + } + + public static Direction of(net.minecraft.util.math.Direction direction) { + switch (direction) { + case UP: + return UP; + case DOWN: + return DOWN; + case NORTH: + return NORTH; + case SOUTH: + return SOUTH; + case EAST: + return EAST; + case WEST: + return WEST; + default: + return new Direction(direction); + } + } + + public Direction getOpposite() { + switch (getRaw()) { + case UP: + return DOWN; + case DOWN: + return UP; + case NORTH: + return SOUTH; + case SOUTH: + return NORTH; + case EAST: + return WEST; + case WEST: + return EAST; + default: + return null; + } + } + + public net.minecraft.util.math.Direction getRaw() { + return direction; + } + + public net.minecraft.util.math.Direction toMinecraft() { + return getRaw(); + } + + public boolean isHorizontal() { + return getRaw().getAxis().isHorizontal(); + } + + public boolean isVertical() { + return getRaw().getAxis().isVertical(); + } + + public boolean isPositive() { + return getRaw().getDirection() == net.minecraft.util.math.Direction.AxisDirection.POSITIVE; + } + + public boolean isNegative() { + return getRaw().getDirection() == net.minecraft.util.math.Direction.AxisDirection.NEGATIVE; + } + + public int getOffsetX() { + return getRaw().getOffsetX(); + } + + public int getOffsetY() { + return getRaw().getOffsetY(); + } + + public int getOffsetZ() { + return getRaw().getOffsetZ(); + } + + public Direction rotateYClockwise() { + return of(getRaw().rotateYClockwise()); + } + + public Direction rotateYCounterclockwise() { + return of(getRaw().rotateYCounterclockwise()); + } + + @Override + public String toString() { + return getRaw().toString(); + } + + public String getName() { + return getRaw().name(); + } + + public static Direction[] values() { + return new Direction[]{UP, DOWN, NORTH, SOUTH, EAST, WEST}; + } + + public Direction[] horizontal() { + return new Direction[]{NORTH, SOUTH, EAST, WEST}; + } + + public Direction[] vertical() { + return new Direction[]{UP, DOWN}; + } + + @Override + public int hashCode() { + return getRaw().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + Direction dir = (Direction) obj; + return getRaw() == dir.getRaw(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java new file mode 100644 index 000000000..368d4a2a1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java @@ -0,0 +1,223 @@ +package net.pitan76.mcpitanlib.midohra.util.math; + +import net.minecraft.util.math.Position; +import net.minecraft.util.math.Vec3d; + +public class Vector3d { + public final double x; + public final double y; + public final double z; + + public Vector3d(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + public static Vector3d of(double x, double y, double z) { + return new Vector3d(x, y, z); + } + + public static Vector3d of(Vector3i vec) { + return new Vector3d(vec.x, vec.y, vec.z); + } + + public static Vector3d of(Vector3f vec) { + return new Vector3d(vec.x, vec.y, vec.z); + } + + public static Vector3d of(org.joml.Vector3d vec) { + return new Vector3d(vec.x, vec.y, vec.z); + } + + public static Vector3d of(Vec3d vec) { + return new Vector3d(vec.x, vec.y, vec.z); + } + + public static Vector3d of(Position vec) { + return new Vector3d(vec.getX(), vec.getY(), vec.getZ()); + } + + public Vector3i toInt() { + return new Vector3i((int) x, (int) y, (int) z); + } + + public Vector3f toFloat() { + return new Vector3f((float) x, (float) y, (float) z); + } + + public org.joml.Vector3d toJoml() { + return new org.joml.Vector3d(x, y, z); + } + + public Vector3d add(Vector3d other) { + return new Vector3d(this.x + other.x, this.y + other.y, this.z + other.z); + } + + public Vector3d sub(Vector3d other) { + return new Vector3d(this.x - other.x, this.y - other.y, this.z - other.z); + } + + public Vector3d mul(double scalar) { + return new Vector3d(this.x * scalar, this.y * scalar, this.z * scalar); + } + + public Vector3d div(double scalar) { + return new Vector3d(this.x / scalar, this.y / scalar, this.z / scalar); + } + + public double dot(Vector3d other) { + return this.x * other.x + this.y * other.y + this.z * other.z; + } + + public Vector3d cross(Vector3d other) { + return new Vector3d( + this.y * other.z - this.z * other.y, + this.z * other.x - this.x * other.z, + this.x * other.y - this.y * other.x + ); + } + + public double length() { + return Math.sqrt(x * x + y * y + z * z); + } + + public Vector3d normalize() { + double len = length(); + if (len == 0) return new Vector3d(0, 0, 0); + return div(len); + } + + public Vector3d add(double x, double y, double z) { + return new Vector3d(this.x + x, this.y + y, this.z + z); + } + + public Vector3d sub(double x, double y, double z) { + return new Vector3d(this.x - x, this.y - y, this.z - z); + } + + public Vector3d lerp(Vector3d to, double delta) { + return this.mul(1 - delta).add(to.mul(delta)); + } + + public Vector3d rotateX(double angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + double cos = Math.cos(angleRadians); + double sin = Math.sin(angleRadians); + double newY = y * cos - z * sin; + double newZ = y * sin + z * cos; + return new Vector3d(x, newY, newZ); + } + + public Vector3d rotateY(double angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + double cos = Math.cos(angleRadians); + double sin = Math.sin(angleRadians); + double newX = x * cos - z * sin; + double newZ = x * sin + z * cos; + return new Vector3d(newX, y, newZ); + } + + public Vector3d rotateZ(double angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + double cos = Math.cos(angleRadians); + double sin = Math.sin(angleRadians); + double newX = x * cos - y * sin; + double newY = x * sin + y * cos; + return new Vector3d(newX, newY, z); + } + + public Vector3d negate() { + return new Vector3d(-x, -y, -z); + } + + public Vector3d abs() { + return new Vector3d(Math.abs(x), Math.abs(y), Math.abs(z)); + } + + public Vector3d distanceTo(Vector3d other) { + return this.sub(other); + } + + public double getX() { + return x; + } + + public double getY() { + return y; + } + + public double getZ() { + return z; + } + + public static Vector3d zero() { + return new Vector3d(0, 0, 0); + } + + public static Vector3d distance(Vector3d a, Vector3d b) { + return a.sub(b); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + Vector3d vec = (Vector3d) obj; + return x == vec.x && y == vec.y && z == vec.z; + } + + @Override + public String toString() { + return "(" + x + ", " + y + ", " + z + ")"; + } + + @Override + public int hashCode() { + int h; + h = Double.hashCode(x); + h = 31 * h + Double.hashCode(y); + h = 31 * h + Double.hashCode(z); + return h; + } + + public Vector3d ofCenter() { + return new Vector3d(x + 0.5, y + 0.5, z + 0.5); + } + + public Vec3d toMinecraft() { + return new Vec3d(x, y, z); + } + + public Vector3d mul(Vector3d other) { + return new Vector3d(this.x * other.x, this.y * other.y, this.z * other.z); + } + + public Vector3d mul(double x, double y, double z) { + return new Vector3d(this.x * x, this.y * y, this.z * z); + } + + public Vector3d div(Vector3d other) { + return new Vector3d(this.x / other.x, this.y / other.y, this.z / other.z); + } + + public Vector3d div(double x, double y, double z) { + return new Vector3d(this.x / x, this.y / y, this.z / z); + } + + public Vector3d mod(Vector3d other) { + return new Vector3d(this.x % other.x, this.y % other.y, this.z % other.z); + } + + public Vector3d mod(double x, double y, double z) { + return new Vector3d(this.x % x, this.y % y, this.z % z); + } + + public Vector3d floor() { + return new Vector3d(Math.floor(x), Math.floor(y), Math.floor(z)); + } + + public long asLong() { + return ((long) x & 0xFFFFFFFFL) << 32 | ((long) y & 0xFFFFFFFFL) << 16 | ((long) z & 0xFFFFFFFFL); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java new file mode 100644 index 000000000..aa4b530c5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java @@ -0,0 +1,212 @@ +package net.pitan76.mcpitanlib.midohra.util.math; + +public class Vector3f { + public final float x; + public final float y; + public final float z; + + public Vector3f(float x, float y, float z) { + this.x = x; + this.y = y; + this.z = z; + } + + public static Vector3f of(float x, float y, float z) { + return new Vector3f(x, y, z); + } + + public static Vector3f of(Vector3i vec) { + return new Vector3f(vec.x, vec.y, vec.z); + } + + public static Vector3f of(Vector3d vec) { + return new Vector3f((float) vec.x, (float) vec.y, (float) vec.z); + } + + public static Vector3f of(org.joml.Vector3f vec) { + return new Vector3f(vec.x, vec.y, vec.z); + } + + public Vector3i toInt() { + return new Vector3i((int) x, (int) y, (int) z); + } + + public Vector3d toDouble() { + return new Vector3d((double) x, (double) y, (double) z); + } + + public org.joml.Vector3f toJoml() { + return new org.joml.Vector3f(x, y, z); + } + + public Vector3f add(Vector3f other) { + return new Vector3f(this.x + other.x, this.y + other.y, this.z + other.z); + } + + public Vector3f sub(Vector3f other) { + return new Vector3f(this.x - other.x, this.y - other.y, this.z - other.z); + } + + public Vector3f mul(float scalar) { + return new Vector3f(this.x * scalar, this.y * scalar, this.z * scalar); + } + + public Vector3f div(float scalar) { + return new Vector3f(this.x / scalar, this.y / scalar, this.z / scalar); + } + + public float dot(Vector3f other) { + return this.x * other.x + this.y * other.y + this.z * other.z; + } + + public Vector3f cross(Vector3f other) { + return new Vector3f( + this.y * other.z - this.z * other.y, + this.z * other.x - this.x * other.z, + this.x * other.y - this.y * other.x + ); + } + + public float length() { + return (float) Math.sqrt(x * x + y * y + z * z); + } + + public Vector3f normalize() { + float len = length(); + if (len == 0) return new Vector3f(0, 0, 0); + return div(len); + } + + public Vector3f add(float x, float y, float z) { + return new Vector3f(this.x + x, this.y + y, this.z + z); + } + + public Vector3f sub(float x, float y, float z) { + return new Vector3f(this.x - x, this.y - y, this.z - z); + } + + public Vector3f lerp(Vector3f to, float delta) { + return this.mul(1 - delta).add(to.mul(delta)); + } + + public Vector3f rotateX(float angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + float cos = (float) Math.cos(angleRadians); + float sin = (float) Math.sin(angleRadians); + float newY = y * cos - z * sin; + float newZ = y * sin + z * cos; + return new Vector3f(x, newY, newZ); + } + + public Vector3f rotateY(float angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + float cos = (float) Math.cos(angleRadians); + float sin = (float) Math.sin(angleRadians); + float newX = z * sin + x * cos; + float newZ = z * cos - x * sin; + return new Vector3f(newX, y, newZ); + } + + public Vector3f rotateZ(float angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + float cos = (float) Math.cos(angleRadians); + float sin = (float) Math.sin(angleRadians); + float newX = x * cos - y * sin; + float newY = x * sin + y * cos; + return new Vector3f(newX, newY, z); + } + + public Vector3f negate() { + return new Vector3f(-x, -y, -z); + } + + public Vector3f abs() { + return new Vector3f(Math.abs(x), Math.abs(y), Math.abs(z)); + } + + public Vector3f distanceTo(Vector3f other) { + return this.sub(other); + } + + public float getX() { + return x; + } + + public float getY() { + return y; + } + + public float getZ() { + return z; + } + + public static Vector3f zero() { + return new Vector3f(0, 0, 0); + } + + public static Vector3f distance(Vector3f a, Vector3f b) { + return a.sub(b); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + Vector3f vec = (Vector3f) obj; + return x == vec.x && y == vec.y && z == vec.z; + } + + @Override + public String toString() { + return "(" + x + ", " + y + ", " + z + ")"; + } + + @Override + public int hashCode() { + int h; + h = Float.hashCode(x); + h = 31 * h + Float.hashCode(y); + h = 31 * h + Float.hashCode(z); + return h; + } + + public Vector3f ofCenter() { + return this.add(0.5f, 0.5f, 0.5f); + } + + public org.joml.Vector3f toMinecraft() { + return new org.joml.Vector3f(x, y, z); + } + + public Vector3f mul(Vector3f other) { + return new Vector3f(this.x * other.x, this.y * other.y, this.z * other.z); + } + + public Vector3f mul(float x, float y, float z) { + return new Vector3f(this.x * x, this.y * y, this.z * z); + } + + public Vector3f div(Vector3f other) { + return new Vector3f(this.x / other.x, this.y / other.y, this.z / other.z); + } + + public Vector3f div(float x, float y, float z) { + return new Vector3f(this.x / x, this.y / y, this.z / z); + } + + public Vector3f mod(Vector3f other) { + return new Vector3f(this.x % other.x, this.y % other.y, this.z % other.z); + } + + public Vector3f mod(float x, float y, float z) { + return new Vector3f(this.x % x, this.y % y, this.z % z); + } + + public Vector3f floor() { + return new Vector3f((float) Math.floor(x), (float) Math.floor(y), (float) Math.floor(z)); + } + + public long asLong() { + return ((long) x & 0xFFFFFFFFL) << 32 | ((long) y & 0xFFFFFFFFL) << 16 | ((long) z & 0xFFFFFFFFL); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java new file mode 100644 index 000000000..c38d48cf0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java @@ -0,0 +1,231 @@ +package net.pitan76.mcpitanlib.midohra.util.math; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; + +public class Vector3i { + public final int x; + public final int y; + public final int z; + + public Vector3i(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + public static Vector3i of(int x, int y, int z) { + return new Vector3i(x, y, z); + } + + public static Vector3i of(Vector3d vec) { + return new Vector3i((int) vec.x, (int) vec.y, (int) vec.z); + } + + public static Vector3i of(Vector3f vec) { + return new Vector3i((int) vec.x, (int) vec.y, (int) vec.z); + } + + public static Vector3i of(org.joml.Vector3i vec) { + return new Vector3i(vec.x, vec.y, vec.z); + } + + public static Vector3i of(Vec3i vec) { + return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); + } + + public static Vector3i of(BlockPos vec) { + return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); + } + + public static Vector3i of(net.pitan76.mcpitanlib.midohra.util.math.BlockPos vec) { + return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); + } + + public static Vector3i of(net.pitan76.mcpitanlib.midohra.util.math.v0.BlockPos vec) { + return new Vector3i(vec.getX(), vec.getY(), vec.getZ()); + } + + public Vector3d toDouble() { + return new Vector3d(x, y, z); + } + + public Vector3f toFloat() { + return new Vector3f((float) x, (float) y, (float) z); + } + + public org.joml.Vector3i toJoml() { + return new org.joml.Vector3i(x, y, z); + } + + public Vector3i add(Vector3i other) { + return new Vector3i(this.x + other.x, this.y + other.y, this.z + other.z); + } + + public Vector3i sub(Vector3i other) { + return new Vector3i(this.x - other.x, this.y - other.y, this.z - other.z); + } + + public Vector3i mul(int scalar) { + return new Vector3i(this.x * scalar, this.y * scalar, this.z * scalar); + } + + public Vector3i div(int scalar) { + return new Vector3i(this.x / scalar, this.y / scalar, this.z / scalar); + } + + public int dot(Vector3i other) { + return this.x * other.x + this.y * other.y + this.z * other.z; + } + + public Vector3i cross(Vector3i other) { + return new Vector3i( + this.y * other.z - this.z * other.y, + this.z * other.x - this.x * other.z, + this.x * other.y - this.y * other.x + ); + } + + public int length() { + return (int) Math.sqrt(x * x + y * y + z * z); + } + + public Vector3i normalize() { + int len = length(); + if (len == 0) return new Vector3i(0, 0, 0); + return div(len); + } + + public Vector3i add(int x, int y, int z) { + return new Vector3i(this.x + x, this.y + y, this.z + z); + } + + public Vector3i sub(int x, int y, int z) { + return new Vector3i(this.x - x, this.y - y, this.z - z); + } + + public Vector3i lerp(Vector3i to, int delta) { + return this.mul(1 - delta).add(to.mul(delta)); + } + + public Vector3i rotateX(double angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + int cos = (int) Math.cos(angleRadians); + int sin = (int) Math.sin(angleRadians); + int newY = this.y * cos - this.z * sin; + int newZ = this.y * sin + this.z * cos; + return new Vector3i(this.x, newY, newZ); + } + + public Vector3i rotateY(double angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + int cos = (int) Math.cos(angleRadians); + int sin = (int) Math.sin(angleRadians); + int newX = this.z * sin + this.x * cos; + int newZ = this.z * cos - this.x * sin; + return new Vector3i(newX, this.y, newZ); + } + + public Vector3i rotateZ(double angleDegrees) { + double angleRadians = Math.toRadians(angleDegrees); + int cos = (int) Math.cos(angleRadians); + int sin = (int) Math.sin(angleRadians); + int newX = this.x * cos - this.y * sin; + int newY = this.x * sin + this.y * cos; + return new Vector3i(newX, newY, this.z); + } + + public Vector3i negate() { + return new Vector3i(-this.x, -this.y, -this.z); + } + + public Vector3i abs() { + return new Vector3i(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z)); + } + + public Vector3i distanceTo(Vector3i other) { + return this.sub(other); + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + public int getZ() { + return z; + } + + public static Vector3i zero() { + return new Vector3i(0, 0, 0); + } + + public static Vector3i distance(Vector3i a, Vector3i b) { + return a.sub(b); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + Vector3i vec = (Vector3i) obj; + return x == vec.x && y == vec.y && z == vec.z; + } + + @Override + public String toString() { + return "(" + x + ", " + y + ", " + z + ")"; + } + + @Override + public int hashCode() { + int h; + h = Integer.hashCode(x); + h = 31 * h + Integer.hashCode(y); + h = 31 * h + Integer.hashCode(z); + return h; + } + + public Vec3i toMinecraft() { + return new Vec3i(x, y, z); + } + + public Vector3i mul(Vector3i other) { + return new Vector3i(this.x * other.x, this.y * other.y, this.z * other.z); + } + + public Vector3i mul(int x, int y, int z) { + return new Vector3i(this.x * x, this.y * y, this.z * z); + } + + public Vector3i div(Vector3i other) { + return new Vector3i(this.x / other.x, this.y / other.y, this.z / other.z); + } + + public Vector3i div(int x, int y, int z) { + return new Vector3i(this.x / x, this.y / y, this.z / z); + } + + public Vector3i mod(Vector3i other) { + return new Vector3i(this.x % other.x, this.y % other.y, this.z % other.z); + } + + public Vector3i mod(int x, int y, int z) { + return new Vector3i(this.x % x, this.y % y, this.z % z); + } + + public long asLong() { + return ((long) x & 0xFFFFFFFFL) << 32 | ((long) y & 0xFFFFFFFFL) << 16 | ((long) z & 0xFFFFFFFFL); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos toPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(x, y, z); + } + + public Vector3d toCenter() { + return new Vector3d(x + 0.5, y + 0.5, z + 0.5); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java new file mode 100644 index 000000000..fb0f6d0c3 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java @@ -0,0 +1,90 @@ +package net.pitan76.mcpitanlib.midohra.util.math.v0; + +import net.minecraft.util.math.Vec3i; +import net.pitan76.mcpitanlib.midohra.util.math.Direction; + +public class BlockPos extends net.minecraft.util.math.BlockPos { + private final net.minecraft.util.math.BlockPos blockPos; + + protected BlockPos(net.minecraft.util.math.BlockPos blockPos) { + super(blockPos.getX(), blockPos.getY(), blockPos.getZ()); + this.blockPos = blockPos; + } + + public static BlockPos of(net.minecraft.util.math.BlockPos blockPos) { + return new BlockPos(blockPos); + } + + public static BlockPos of(int x, int y, int z) { + return new BlockPos(new net.minecraft.util.math.BlockPos(x, y, z)); + } + + public int getX() { + return blockPos.getX(); + } + + public int getY() { + return blockPos.getY(); + } + + public int getZ() { + return blockPos.getZ(); + } + + public net.minecraft.util.math.BlockPos toMinecraft() { + return blockPos; + } + + public BlockPos add(int x, int y, int z) { + return new BlockPos(blockPos.add(x, y, z)); + } + + public BlockPos add(BlockPos pos) { + return new BlockPos(blockPos.add(pos.blockPos)); + } + + public BlockPos subtract(int x, int y, int z) { + return new BlockPos(blockPos.subtract(new Vec3i(x, y, z))); + } + + public BlockPos subtract(BlockPos pos) { + return new BlockPos(blockPos.subtract(pos.blockPos)); + } + + public BlockPos up() { + return new BlockPos(blockPos.up()); + } + + public BlockPos down() { + return new BlockPos(blockPos.down()); + } + + public BlockPos north() { + return new BlockPos(blockPos.north()); + } + + public BlockPos south() { + return new BlockPos(blockPos.south()); + } + + public BlockPos east() { + return new BlockPos(blockPos.east()); + } + + public BlockPos west() { + return new BlockPos(blockPos.west()); + } + + public BlockPos offset(Direction direction, int amount) { + return new BlockPos(blockPos.offset(direction.toMinecraft(), amount)); + } + + public BlockPos offset(Direction direction) { + return new BlockPos(blockPos.offset(direction.toMinecraft())); + } + + @Override + public BlockPos add(Vec3i vec3i) { + return new BlockPos(blockPos.add(vec3i)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java new file mode 100644 index 000000000..a0e536955 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java @@ -0,0 +1,76 @@ +package net.pitan76.mcpitanlib.midohra.util.shape; + +import net.pitan76.mcpitanlib.midohra.util.math.Direction; + +public class VoxelShape { + private final net.minecraft.util.shape.VoxelShape voxelShape; + + public static final VoxelShape EMPTY = of(net.minecraft.util.shape.VoxelShapes.empty()); + public static final VoxelShape FULL_CUBE = of(net.minecraft.util.shape.VoxelShapes.fullCube()); + + public VoxelShape(net.minecraft.util.shape.VoxelShape voxelShape) { + this.voxelShape = voxelShape; + } + + public static VoxelShape of(net.minecraft.util.shape.VoxelShape shape) { + return new VoxelShape(shape); + } + + @Deprecated + public net.minecraft.util.shape.VoxelShape raw() { + return voxelShape; + } + + public boolean isEmpty() { + return raw().isEmpty(); + } + + public VoxelShape union(VoxelShape other) { + return of(net.minecraft.util.shape.VoxelShapes.union(this.raw(), other.raw())); + } + + public VoxelShape asCuboid() { + return of(raw().asCuboid()); + } + + public VoxelShape offset(double x, double y, double z) { + return of(raw().offset(x, y, z)); + } + + public VoxelShape getFace(Direction direction) { + return of(raw().getFace(direction.toMinecraft())); + } + + public VoxelShape simplify() { + return of(raw().simplify()); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof VoxelShape)) return false; + VoxelShape other = (VoxelShape) obj; + return this.raw().equals(other.raw()); + } + + @Override + public int hashCode() { + return raw().hashCode(); + } + + public static VoxelShape empty() { + return EMPTY; + } + + public static VoxelShape fullCube() { + return FULL_CUBE; + } + + public static VoxelShape union(VoxelShape... shapes) { + net.minecraft.util.shape.VoxelShape result = net.minecraft.util.shape.VoxelShapes.empty(); + for (VoxelShape shape : shapes) { + result = net.minecraft.util.shape.VoxelShapes.union(result, shape.raw()); + } + return of(result); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java new file mode 100644 index 000000000..60a94b216 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.fluid.FluidState; +import net.minecraft.util.math.BlockPos; + +public class BlockView implements IWorldView { + private net.minecraft.world.BlockView blockView; + + public BlockView(net.minecraft.world.BlockView blockView) { + this.blockView = blockView; + } + + public static BlockView of(net.minecraft.world.BlockView blockView) { + return new BlockView(blockView); + } + + public net.minecraft.world.BlockView getRaw() { + return blockView; + } + + public net.minecraft.world.BlockView toMinecraft() { + return getRaw(); + } + + @Override + public BlockEntity getBlockEntity(BlockPos pos) { + return getRaw().getBlockEntity(pos); + } + + @Override + public BlockState getBlockState(BlockPos pos) { + return getRaw().getBlockState(pos); + } + + @Override + public FluidState getFluidState(BlockPos pos) { + return getRaw().getFluidState(pos); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java new file mode 100644 index 000000000..95d95ab78 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.fluid.FluidState; +import net.minecraft.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; + +public interface IWorldView { + BlockEntity getBlockEntity(BlockPos pos); + + BlockState getBlockState(BlockPos pos); + + FluidState getFluidState(BlockPos pos); + + default BlockEntityWrapper getBlockEntity(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return BlockEntityWrapper.of(getBlockEntity(pos.toMinecraft())); + } + + default net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState(pos.toMinecraft())); + } + + default FluidWrapper getFluid(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return FluidWrapper.of(getFluidState(pos.toMinecraft()).getFluid()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java new file mode 100644 index 000000000..4d8bc2f0e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Direction; + +public interface RedstoneView { + + net.minecraft.world.RedstoneView getRedstoneView(); + + default boolean isReceivingRedstonePower(BlockPos pos) { + return getRedstoneView().isReceivingRedstonePower(pos.toMinecraft()); + } + + default int getEmittedRedstonePower(BlockPos pos, Direction direction) { + return getRedstoneView().getEmittedRedstonePower(pos.toMinecraft(), direction.toMinecraft()); + } + + default int getEmittedRedstonePower(BlockPos pos, Direction direction, boolean onlyFromGate) { + return getRedstoneView().getEmittedRedstonePower(pos.toMinecraft(), direction.toMinecraft(), onlyFromGate); + } + + default boolean isEmittingRedstonePower(BlockPos pos, Direction direction) { + return getRedstoneView().isEmittingRedstonePower(pos.toMinecraft(), direction.toMinecraft()); + } + + default int getStrongRedstonePower(BlockPos pos, Direction direction) { + return getRedstoneView().getStrongRedstonePower(pos.toMinecraft(), direction.toMinecraft()); + } + + default int getReceivedStrongRedstonePower(BlockPos pos) { + return getRedstoneView().getReceivedStrongRedstonePower(pos.toMinecraft()); + } + + static RedstoneView of(net.minecraft.world.RedstoneView redstoneView) { + return () -> redstoneView; + } + + static RedstoneView of(net.minecraft.world.WorldView world) { + return WorldView.of(world); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java new file mode 100644 index 000000000..9ee497435 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java @@ -0,0 +1,63 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.server.MinecraftServer; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.midohra.recipe.ServerRecipeManager; +import net.pitan76.mcpitanlib.midohra.server.MCServer; +import net.pitan76.mcpitanlib.midohra.server.PlayerManager; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.chunk.ServerChunkManager; + +public class ServerWorld extends World { + private final net.minecraft.server.world.ServerWorld world; + + protected ServerWorld(net.minecraft.server.world.ServerWorld world) { + super(null); + this.world = world; + } + + public static ServerWorld of(net.minecraft.server.world.ServerWorld world) { + return new ServerWorld(world); + } + + @Override + public net.minecraft.server.world.ServerWorld getRaw() { + return world; + } + + @Override + public net.minecraft.server.world.ServerWorld toMinecraft() { + return getRaw(); + } + + public void playSound(Player player, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, long seed) { + getRaw().playSound(player.getEntity(), pos.getX(), pos.getY(), pos.getZ(), sound.getEntry(), category.get(), volume, pitch, seed); + } + + public void playSoundFromEntity(Player player, Player target, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, long seed) { + getRaw().playSoundFromEntity(player.getEntity(), target.getEntity(), sound.getEntry(), category.get(), volume, pitch, seed); + } + + public MinecraftServer getServer() { + return getRaw().getServer(); + } + + public MCServer getMCServer() { + return MCServer.of(getServer()); + } + + public PlayerManager getPlayerManager() { + return PlayerManager.of(this); + } + + public ServerChunkManager getChunkManager() { + return ServerChunkManager.of(this); + } + + @Override + public ServerRecipeManager getRecipeManager() { + return ServerRecipeManager.of(this); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java new file mode 100644 index 000000000..ff3bf1da9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java @@ -0,0 +1,167 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.FluidState; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.recipe.RecipeManager; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; + +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +public class World extends WorldAccess { + + private final net.minecraft.world.World world; + + protected World(net.minecraft.world.World world) { + super(null); + this.world = world; + } + + public static World of(net.minecraft.world.World world) { + return new World(world); + } + + @Override + public net.minecraft.world.World getRaw() { + return world; + } + + public net.minecraft.world.World toMinecraft() { + return getRaw(); + } + + public void addBlockEntity(BlockEntityWrapper blockEntity) { + addBlockEntity(blockEntity.get()); + } + + public void addBlockEntity(BlockEntity blockEntity) { + getRaw().addBlockEntity(blockEntity); + } + + public void removeBlockEntity(BlockPos pos) { + getRaw().removeBlockEntity(pos.toMinecraft()); + } + + public long getTime() { + return WorldUtil.getTime(getRaw()); + } + + public long getTopY() { + return WorldUtil.getTopY(getRaw()); + } + + public long getBottomY() { + return WorldUtil.getBottomY(getRaw()); + } + + public long getDimensionHeight() { + return WorldUtil.getDimensionHeight(getRaw()); + } + + public CompatIdentifier getId() { + return WorldUtil.getCompatWorldId(getRaw()); + } + + public FluidState getRawFluidState(BlockPos pos) { + return WorldUtil.getFluidState(getRaw(), pos.toMinecraft()); + } + + public Player getPlayerByUUID(UUID uuid) { + return WorldUtil.getPlayer(getRaw(), uuid); + } + + public List getPlayers() { + return WorldUtil.getPlayers(getRaw()); + } + + public BlockPos getSpawnPos() { + return BlockPos.of(WorldUtil.getSpawnPos(getRaw())); + } + + public Optional getWorld(CompatIdentifier id) { + Optional optional = WorldUtil.getWorld(getRaw(), id); + return optional.map(World::of); + } + + public Optional getServerWorld(CompatIdentifier id) { + Optional optional = WorldUtil.getWorld(getRaw(), id); + return optional.map(ServerWorld::of); + } + + public void spawnEntity(Entity entity) { + WorldUtil.spawnEntity(getRaw(), entity); + } + + public void spawnStack(net.minecraft.item.ItemStack stack, BlockPos pos) { + WorldUtil.spawnStack(getRaw(), pos.toMinecraft(), stack); + } + + public RecipeManager getRecipeManager() { + return RecipeManager.of(getRaw().getRecipeManager()); + } + + @Deprecated + @Override + public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category) { + getRaw().playSound(playerEntity, pos, sound, category); + } + + @Deprecated + @Override + public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { + getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); + } + + @Override + public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { + WorldUtil.playSound(getRaw(), player, pos.toMinecraft(), soundEvent, category, volume, pitch); + } + + @Override + public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { + playSound(null, pos, soundEvent, category, 1f, 1f); + } + + @Override + public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { + playSound(player, pos, soundEvent, category, 1f, 1f); + } + + @Override + public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { + playSound(null, pos, soundEvent, category, volume, pitch); + } + + public Optional toServerWorld() { + if (getRaw() instanceof net.minecraft.server.world.ServerWorld) { + return Optional.of(ServerWorld.of((net.minecraft.server.world.ServerWorld) getRaw())); + } + return Optional.empty(); + } + + public CompatRegistryLookup getRegistryLookup() { + return RegistryLookupUtil.getRegistryLookup(getRaw()); + } + + public boolean isAir(BlockPos pos) { + return WorldUtil.isAir(getRaw(), pos.toMinecraft()); + } + + public Block getBlock(BlockPos pos) { + return WorldUtil.getBlock(getRaw(), pos.toMinecraft()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java new file mode 100644 index 000000000..5635acba5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -0,0 +1,191 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.predicate.entity.EntityPredicates; +import net.minecraft.server.MinecraftServer; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; +import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import net.pitan76.mcpitanlib.api.util.world.WorldAccessUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.server.MCServer; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Box; + +import java.util.List; +import java.util.Optional; +import java.util.function.Predicate; + +public class WorldAccess extends WorldView { + private final net.minecraft.world.WorldAccess world; + + protected WorldAccess(net.minecraft.world.WorldAccess world) { + super(null); + this.world = world; + } + + public static WorldAccess of(net.minecraft.world.WorldAccess world) { + return new WorldAccess(world); + } + + @Override + protected net.minecraft.world.WorldAccess getRaw() { + return world; + } + + public net.minecraft.world.WorldAccess toMinecraft() { + return getRaw(); + } + + public boolean isClient() { + return WorldAccessUtil.isClient(getRaw()); + } + + public boolean isServer() { + return !isClient(); + } + + public CompatRandom getRandom() { + return new CompatRandom(getRaw().getRandom()); + } + + public MinecraftServer getServer() { + return WorldAccessUtil.getServer(getRaw()); + } + + public BlockEntityWrapper getBlockEntity(BlockPos pos) { + return BlockEntityWrapper.of(WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft())); + } + + public Optional getRawBlockEntity(BlockPos pos, BlockEntityType type) { + return WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); + } + + public BlockEntityWrapper getBlockEntity(BlockPos pos, BlockEntityType type) { + Optional blockEntity = WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); + return blockEntity.map(BlockEntityWrapper::of).orElse(BlockEntityWrapper.of()); + } + + public boolean removeBlock(BlockPos pos, boolean move) { + return WorldAccessUtil.removeBlock(getRaw(), pos.toMinecraft(), move); + } + + public boolean breakBlock(BlockPos pos, boolean drop) { + return WorldAccessUtil.breakBlock(getRaw(), pos.toMinecraft(), drop); + } + + public boolean breakBlock(BlockPos pos, boolean drop, Entity entity) { + return WorldAccessUtil.breakBlock(getRaw(), pos.toMinecraft(), drop, entity); + } + + public BlockState getBlockState(BlockPos pos) { + return BlockState.of(WorldAccessUtil.getBlockState(getRaw(), pos.toMinecraft())); + } + + public boolean setBlockState(BlockPos pos, BlockState state, int flags) { + return WorldAccessUtil.setBlockState(getRaw(), pos.toMinecraft(), state.toMinecraft(), flags); + } + + public boolean setBlockState(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { + return WorldAccessUtil.setBlockState(getRaw(), pos.toMinecraft(), state.toMinecraft(), flags, maxUpdateDepth); + } + + public boolean setBlockState(BlockPos pos, BlockState state) { + return WorldAccessUtil.setBlockState(getRaw(), pos.toMinecraft(), state.toMinecraft()); + } + + @Deprecated + public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { + getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); + } + + @Deprecated + public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category) { + getRaw().playSound(playerEntity, pos, sound, category); + } + + public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { + playSound(player.getEntity(), pos.toMinecraft(), soundEvent.get(), category.get(), volume, pitch); + } + + public void playSound(Player player, BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { + playSound(player.getEntity(), pos.toMinecraft(), soundEvent.get(), category.get()); + } + + public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { + playSound(null, pos.toMinecraft(), soundEvent.get(), category.get(), volume, pitch); + } + + public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCategory category) { + playSound(null, pos.toMinecraft(), soundEvent.get(), category.get()); + } + + public MCServer getMCServer() { + return MCServer.of(getServer()); + } + + public boolean isChunkLoaded(BlockPos pos) { + return WorldAccessUtil.isChunkLoaded(getRaw(), pos.toMinecraft()); + } + + public List getEntitiesByClass(Class entityClass, Box box, Predicate predicate) { + return WorldAccessUtil.getEntitiesByClass(getRaw(), entityClass, box, predicate); + } + + public List getEntitiesByType(EntityType entityType, Box box, Predicate predicate) { + return WorldAccessUtil.getEntitiesByType(getRaw(), entityType, box, predicate); + } + + public List getEntitiesByType(EntityTypeWrapper entityType, Box box, Predicate predicate) { + return WorldAccessUtil.getEntitiesByType(getRaw(), entityType.get(), box, predicate); + } + + public List getEntitiesByClass(Class entityClass, Box box) { + return getEntitiesByClass(entityClass, box, EntityPredicates.VALID_ENTITY); + } + + public List getEntitiesByType(EntityType entityType, Box box) { + return getEntitiesByType(entityType, box, EntityPredicates.VALID_ENTITY); + } + + public boolean breakBlock(BlockPos pos, boolean drop, Player player) { + return breakBlock(pos, drop, player.getEntity()); + } + + public List getEntitiesByTypeM(EntityTypeWrapper entityType, Box box, Predicate predicate) { + return getEntitiesByType(entityType.get(), box, (e) -> predicate.test(EntityWrapper.of(e))) + .stream().map(EntityWrapper::of).toList(); + } + + public List getEntitiesByTypeM(EntityTypeWrapper entityType, Box box) { + return getEntitiesByType(entityType.get(), box).stream().map(EntityWrapper::of).toList(); + } + + public List getEntitiesByClassM(Class entityClass, Box box, Predicate predicate) { + return getEntitiesByClass((Class) entityClass, box, (e) -> predicate.test(EntityWrapper.of(e))) + .stream().map(EntityWrapper::of).toList(); + } + + public List getEntitiesByClassM(Class entityClass, Box box) { + return getEntitiesByClass((Class) entityClass, box).stream().map(EntityWrapper::of).toList(); + } + + public void spawnEntity(Entity entity) { + getRaw().spawnEntity(entity); + } + + public void spawnEntity(EntityWrapper entity) { + spawnEntity(entity.get()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java new file mode 100644 index 000000000..6e73462d4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java @@ -0,0 +1,85 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.fluid.FluidState; +import net.pitan76.mcpitanlib.api.util.world.WorldAccessUtil; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; + +import java.util.Optional; + +public class WorldView implements IWorldView, RedstoneView { + private final net.minecraft.world.WorldView world; + + protected WorldView(net.minecraft.world.WorldView world) { + this.world = world; + } + + public static WorldView of(net.minecraft.world.WorldView world) { + return new WorldView(world); + } + + protected net.minecraft.world.WorldView getRaw() { + return world; + } + + public net.minecraft.world.WorldView toMinecraft() { + return getRaw(); + } + + public boolean isClient() { + return WorldAccessUtil.isClient(getRaw()); + } + + public boolean isServer() { + return !isClient(); + } + + public BlockEntityWrapper getBlockEntity(BlockPos pos) { + return BlockEntityWrapper.of(WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft())); + } + + public Optional getRawBlockEntity(BlockPos pos, BlockEntityType type) { + return WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); + } + + public BlockEntityWrapper getBlockEntity(BlockPos pos, BlockEntityType type) { + Optional blockEntity = WorldAccessUtil.getBlockEntity(getRaw(), pos.toMinecraft(), type); + return blockEntity.map(BlockEntityWrapper::of).orElse(BlockEntityWrapper.of()); + } + + @Override + public BlockEntity getBlockEntity(net.minecraft.util.math.BlockPos pos) { + return getRaw().getBlockEntity(pos); + } + + @Override + public net.minecraft.block.BlockState getBlockState(net.minecraft.util.math.BlockPos pos) { + return getRaw().getBlockState(pos); + } + + @Override + public FluidState getFluidState(net.minecraft.util.math.BlockPos pos) { + return getRaw().getFluidState(pos); + } + + @Override + @Deprecated + public net.minecraft.world.RedstoneView getRedstoneView() { + return getRaw(); + } + + @Override + public int hashCode() { + return getRaw() != null ? getRaw().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + WorldView other = (WorldView) obj; + return getRaw() != null ? getRaw().equals(other.getRaw()) : other.getRaw() == null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java new file mode 100644 index 000000000..7f3084f67 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.midohra.world.chunk; + +import net.pitan76.mcpitanlib.midohra.world.BlockView; +import net.pitan76.mcpitanlib.midohra.world.IWorldView; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class ChunkManager { + private final net.minecraft.world.chunk.ChunkManager chunkManager; + + protected ChunkManager(net.minecraft.world.chunk.ChunkManager chunkManager) { + this.chunkManager = chunkManager; + } + + public static ChunkManager of(net.minecraft.world.chunk.ChunkManager chunkManager) { + return new ChunkManager(chunkManager); + } + + public static ChunkManager of(net.minecraft.world.World world) { + return of(world.getChunkManager()); + } + + public static ChunkManager of(World world) { + return of(world.getRaw()); + } + + public net.minecraft.world.chunk.ChunkManager getRaw() { + return chunkManager; + } + + public net.minecraft.world.chunk.ChunkManager toMinecraft() { + return getRaw(); + } + + public IWorldView getWorld() { + return BlockView.of(getRaw().getWorld()); + } + + public boolean isChunkLoaded(int x, int z) { + return getRaw().isChunkLoaded(x, z); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java new file mode 100644 index 000000000..e1faf1d6f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java @@ -0,0 +1,87 @@ +package net.pitan76.mcpitanlib.midohra.world.chunk; + +import net.minecraft.util.Unit; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkPos; + +import java.util.Comparator; + +public class ChunkTicketType { + + public static final ChunkTicketType START = of(net.minecraft.server.world.ChunkTicketType.PLAYER_SPAWN); + public static final ChunkTicketType DRAGON = of(net.minecraft.server.world.ChunkTicketType.DRAGON); + public static final ChunkTicketType PLAYER = of(net.minecraft.server.world.ChunkTicketType.PLAYER_SIMULATION); + public static final ChunkTicketType FORCED = of(net.minecraft.server.world.ChunkTicketType.FORCED); + public static final ChunkTicketType PORTAL = of(net.minecraft.server.world.ChunkTicketType.PORTAL); + public static final ChunkTicketType ENDER_PEARL = of(net.minecraft.server.world.ChunkTicketType.ENDER_PEARL); + public static final ChunkTicketType POST_TELEPORT = of(net.minecraft.server.world.ChunkTicketType.PORTAL); + public static final ChunkTicketType UNKNOWN = of(net.minecraft.server.world.ChunkTicketType.UNKNOWN); + + private final net.minecraft.server.world.ChunkTicketType ticketType; + + protected ChunkTicketType(net.minecraft.server.world.ChunkTicketType ticketType) { + this.ticketType = ticketType; + } + + public static ChunkTicketType of(net.minecraft.server.world.ChunkTicketType ticketType) { + return new ChunkTicketType<>(ticketType); + } + + public net.minecraft.server.world.ChunkTicketType getRaw() { + return ticketType; + } + + public net.minecraft.server.world.ChunkTicketType toMinecraft() { + return getRaw(); + } + + public static ChunkTicketType create(String name, Comparator argumentComparator) { + return (ChunkTicketType) create(name); + } + + public static ChunkTicketType create(String name, Comparator argumentComparator, int expiryTicks) { + return (ChunkTicketType) create(name, expiryTicks); + } + + public Comparator getArgumentComparator() { + return null; + } + + public long getExpiryTicks() { + return getRaw().expiryTicks(); + } + + @Override + public String toString() { + return getRaw().toString(); + } + + public ChunkTicketType(String name, long expiryTicks) { + this(new net.minecraft.server.world.ChunkTicketType(expiryTicks, 6)); + } + + public ChunkTicketType(String name) { + this(name, 0); + } + + public static ChunkTicketType create(String name, long expiryTicks) { + return new ChunkTicketType<>(name, expiryTicks); + } + + public static ChunkTicketType create(String name) { + return new ChunkTicketType<>(name); + } + + @Override + public int hashCode() { + return ticketType.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof ChunkTicketType)) return false; + ChunkTicketType that = (ChunkTicketType) obj; + return ticketType.equals(that.ticketType); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java new file mode 100644 index 000000000..40264d352 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java @@ -0,0 +1,51 @@ +package net.pitan76.mcpitanlib.midohra.world.chunk; + +import net.pitan76.mcpitanlib.api.util.world.ChunkManagerUtil; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.ChunkPos; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class ServerChunkManager extends ChunkManager { + private final net.minecraft.server.world.ServerChunkManager chunkManager; + + protected ServerChunkManager(net.minecraft.server.world.ServerChunkManager chunkManager) { + super(null); + this.chunkManager = chunkManager; + } + + public static ServerChunkManager of(net.minecraft.server.world.ServerChunkManager chunkManager) { + return new ServerChunkManager(chunkManager); + } + + public static ServerChunkManager of(ServerWorld world) { + return of(world.getRaw().getChunkManager()); + } + + @Override + public net.minecraft.server.world.ServerChunkManager getRaw() { + return chunkManager; + } + + @Override + public net.minecraft.server.world.ServerChunkManager toMinecraft() { + return getRaw(); + } + + @Override + public World getWorld() { + return World.of(getRaw().getWorld()); + } + + public void addTicket(ChunkTicketType ticketType, ChunkPos pos, int radius, T argument) { + getRaw().addTicket(ticketType.getRaw(), pos.getRaw(), radius); + } + + public void removeTicket(ChunkTicketType ticketType, ChunkPos pos, int radius, T argument) { + getRaw().removeTicket(ticketType.getRaw(), pos.getRaw(), radius); + } + + public void markForUpdate(BlockPos pos) { + ChunkManagerUtil.markForUpdate(getRaw(), pos); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java new file mode 100644 index 000000000..2c5daf8fb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.midohra.world.tick; + +import net.minecraft.block.Block; +import net.minecraft.fluid.Fluid; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; + +public class ScheduledTickView { + private final net.minecraft.world.tick.ScheduledTickView scheduledTickView; + + public ScheduledTickView(net.minecraft.world.tick.ScheduledTickView scheduledTickView) { + this.scheduledTickView = scheduledTickView; + } + + public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.tick.ScheduledTickView scheduledTickView) { + return new net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView(scheduledTickView); + } + + public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.World world) { + return new net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView(world); + } + + public net.minecraft.world.tick.ScheduledTickView toMinecraft() { + return get(); + } + + protected net.minecraft.world.tick.ScheduledTickView get() { + return scheduledTickView; + } + + public void scheduleBlockTick(BlockPos blockPos, BlockWrapper blockWrapper, int delay) { + scheduleBlockTick(blockPos.toMinecraft(), blockWrapper.get(), delay); + } + + public void scheduleBlockTick(net.minecraft.util.math.BlockPos blockPos, Block block, int delay) { + get().scheduleBlockTick(blockPos, block, delay); + } + + public void scheduleFluidTick(BlockPos blockPos, FluidWrapper fluidWrapper, int delay) { + scheduleFluidTick(blockPos.toMinecraft(), fluidWrapper.get(), delay); + } + + public void scheduleFluidTick(net.minecraft.util.math.BlockPos blockPos, Fluid block, int delay) { + get().scheduleFluidTick(blockPos, block, delay); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java new file mode 100644 index 000000000..be3e7a36f --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java @@ -0,0 +1,104 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.BlockRotation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import net.minecraft.world.WorldView; +import net.minecraft.world.tick.ScheduledTickView; +import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; +import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; +import net.pitan76.mcpitanlib.api.block.args.RotateArgs; +import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +// TODO(Ravel): can not resolve target class AbstractBlock +@Mixin(AbstractBlock.class) +public class AbstractBlock4CompatProviderMixin { + // TODO(Ravel): no target class + @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getStateForNeighborUpdate", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random)), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toMinecraft()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getRenderType(BlockState state, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + CompatBlockRenderType returnValue = provider.getRenderType(new RenderTypeArgs(state), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toMinecraft()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "rotate", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_rotate(BlockState state, BlockRotation rotation, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.rotate(new RotateArgs(state, rotation), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toMinecraft()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "isSideInvisible", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_isSideInvisible(BlockState state, BlockState stateFrom, Direction direction, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + Boolean returnValue = provider.isSideInvisible(new SideInvisibleArgs(state, stateFrom, direction), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java new file mode 100644 index 000000000..683e7526e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java @@ -0,0 +1,149 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.entity.ai.pathing.NavigationType; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.context.LootWorldContext; +import net.minecraft.screen.NamedScreenHandlerFactory; +import net.minecraft.screen.SimpleNamedScreenHandlerFactory; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.ActionResult; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.BlockView; +import net.minecraft.world.World; +import net.minecraft.world.WorldView; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; +import net.pitan76.mcpitanlib.api.event.block.*; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; + +// TODO(Ravel): can not resolve target class AbstractBlock +@Mixin(AbstractBlock.class) +public class AbstractBlockMixin { + // TODO(Ravel): no target class + @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "scheduledTick", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + provider.scheduledTick(new BlockScheduledTickEvent(state, world, pos, random), options); + if (options.cancel) + ci.cancel(); + } + } + + // TODO(Ravel): no target class + @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + CompatActionResult returnValue = provider.onRightClick(new BlockUseEvent(state, world, pos, player, player.getActiveHand(), hit), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toActionResult()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "createScreenHandlerFactory", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_createScreenHandlerFactory(BlockState state, World world, BlockPos pos, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + NamedScreenHandlerFactory returnValue = new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> + provider.createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player), options), provider.getScreenTitle()); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "onStateReplaced", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved, CallbackInfo ci) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + provider.onStateReplaced(new StateReplacedEvent(state, world, pos, world.getBlockState(pos), moved), options); + if (options.cancel) + ci.cancel(); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getDroppedStacks", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getDroppedStacks(BlockState state, LootWorldContext.Builder builder, CallbackInfoReturnable> cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + List returnValue = provider.getDroppedStacks(new DroppedStacksArgs(state, builder), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "canPathfindThrough", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_canPathfindThrough(BlockState state, NavigationType type, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + Boolean returnValue = provider.canPathfindThrough(new CanPathfindThroughArgs(state, type), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getPickStack", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData, CallbackInfoReturnable cir) { + // ExtendBlockProviderを実装している場合 (1.21.5からAbstractBlockに移転) + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + + PickStackEvent event = new PickStackEvent(world, pos, state); + event.setIncludeData(includeData); + + ItemStack returnValue = provider.getPickStack(event, options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java new file mode 100644 index 000000000..27f5f53a6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.ItemPlacementContext; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; +import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +// TODO(Ravel): can not resolve target class Block +@Mixin(Block.class) +public class Block4CompatProviderMixin { + + // TODO(Ravel): no target class + @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { + // ExtendBlockProviderを実装している場合 + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.getPlacementState(new PlacementStateArgs(ctx), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toMinecraft()); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java new file mode 100644 index 000000000..4f2aecdcb --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +// TODO(Ravel): can not resolve target class Block +@Mixin(Block.class) +public interface BlockInvoker { + // TODO(Ravel): Could not determine a single target + @Invoker("setDefaultState") + void setDefaultState_invoke(BlockState state); +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java new file mode 100644 index 000000000..a94f6a5cf --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java @@ -0,0 +1,105 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.item.ItemStack; +import net.minecraft.state.StateManager; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; +import net.pitan76.mcpitanlib.api.event.block.*; +import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; +import net.pitan76.mcpitanlib.api.event.v1.listener.BlockBreakTask; +import net.pitan76.mcpitanlib.api.event.v1.listener.BlockPlacedTask; +import net.pitan76.mcpitanlib.api.event.v2.BlockEventRegistry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +// TODO(Ravel): can not resolve target class Block +@Mixin(Block.class) +public class BlockMixin { + + // TODO(Ravel): no target class + @Inject(method = "onPlaced", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack, CallbackInfo ci) { + // イベントを呼び出す + if (!BlockEventRegistry.ON_PLACED.isEmpty()) { + int maxPriority = BlockEventRegistry.ON_PLACED.getMaxPriority(); + for (int p = maxPriority; p >= 0; p--) { + for (BlockPlacedTask listener : BlockEventRegistry.ON_PLACED.getListenersAsList(p)) { + listener.onPlaced(new BlockPlacedEvent(world, pos, state, placer, stack)); + } + } + } + + // ExtendBlockProviderを実装している場合 + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + provider.onPlaced(new BlockPlacedEvent(world, pos, state, placer, stack), options); + if (options.cancel) + ci.cancel(); + } + } + + // TODO(Ravel): no target class + @Inject(method = "onBreak", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable cir) { + // イベントを呼び出す + if (!BlockEventRegistry.ON_BREAK.isEmpty()) { + BlockState newState = state; + int maxPriority = BlockEventRegistry.ON_BREAK.getMaxPriority(); + for (int p = maxPriority; p >= 0; p--) { + for (BlockBreakTask listener : BlockEventRegistry.ON_BREAK.getListenersAsList(p)) { + newState = listener.onBreak(new BlockBreakEvent(world, pos, newState, player)).state; + } + } + if (newState != state) { + cir.setReturnValue(newState); + state = newState; + } + } + + // ExtendBlockProviderを実装している場合 + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + BlockBreakResult returnValue = provider.onBreak(new BlockBreakEvent(world, pos, state, player), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.getState()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "appendProperties", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$appendProperties(StateManager.Builder builder, CallbackInfo ci) { + // ExtendBlockProviderを実装している場合 + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + provider.appendProperties(new AppendPropertiesArgs(builder), options); + if (options.cancel) + ci.cancel(); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { + // ExtendBlockProviderを実装している場合 + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + BlockState returnValue = provider.getPlacementState(new PlacementStateArgs(ctx), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java new file mode 100644 index 000000000..623c5fe85 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.item.ItemStack; +import net.minecraft.recipe.CraftingRecipe; +import net.minecraft.recipe.input.CraftingRecipeInput; +import net.minecraft.util.collection.DefaultedList; +import net.pitan76.mcpitanlib.api.item.FixedRecipeRemainderItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +// TODO(Ravel): can not resolve target class CraftingRecipe +@Mixin(CraftingRecipe.class) +public interface CraftingRecipeMixin { + // TODO(Ravel): no target class + @Inject(method = "collectRecipeRemainders", at = @At("RETURN")) + private static void mcpitanlib$collectRecipeRemainders(CraftingRecipeInput input, CallbackInfoReturnable> cir) { + DefaultedList defaultedList = cir.getReturnValue(); + + int i = 0; + for (ItemStack stack : defaultedList) { + if (stack.getItem() instanceof FixedRecipeRemainderItem) { + FixedRecipeRemainderItem remainder = (FixedRecipeRemainderItem) stack.getItem(); + defaultedList.set(i, remainder.getFixedRecipeRemainder(stack.copy())); + } + i++; + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java new file mode 100644 index 000000000..abc597de2 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java @@ -0,0 +1,271 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.block.BlockState; +import net.minecraft.component.type.TooltipDisplayComponent; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.item.consume.UseAction; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.pitan76.mcpitanlib.api.event.item.*; +import net.pitan76.mcpitanlib.api.event.v2.ItemEventRegistry; +import net.pitan76.mcpitanlib.api.event.v2.listener.InventoryTickTask; +import net.pitan76.mcpitanlib.api.item.ExtendItemProvider; +import net.pitan76.mcpitanlib.api.item.ExtendItemProvider.Options; +import net.pitan76.mcpitanlib.api.item.FixedRecipeRemainderItem; +import net.pitan76.mcpitanlib.api.item.args.UseActionArgs; +import net.pitan76.mcpitanlib.api.item.consume.CompatUseAction; +import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.function.Consumer; + +// TODO(Ravel): can not resolve target class Item +@Mixin(Item.class) +public class ItemMixin { + // TODO(Ravel): no target class + @Inject(method = "use", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$use(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + CompatActionResult returnValue = provider.onRightClick(new ItemUseEvent(world, user, hand), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toActionResult()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$useOnBlock(ItemUsageContext context, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; + Options options = new Options(); + CompatActionResult returnValue = provider.onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit()), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toActionResult()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "useOnEntity", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + CompatActionResult returnValue = provider.onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toActionResult()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "finishUsing", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$finishUsing(ItemStack stack, World world, LivingEntity user, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + ItemStack returnValue = provider.onFinishUsing(new ItemFinishUsingEvent(stack, world, user), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + /* + @Inject(method = "hasRecipeRemainder", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$hasRecipeRemainder(CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + boolean returnValue = provider.hasRecipeRemainder(options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + */ + + // TODO(Ravel): no target class + @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$appendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type, CallbackInfo ci) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + provider.appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type), options); + if (options.cancel) + ci.cancel(); + } + } + + // TODO(Ravel): no target class + @Inject(method = "postHit", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$postHit(ItemStack stack, LivingEntity target, LivingEntity attacker, CallbackInfo ci) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + provider.postHit(new PostHitEvent(stack, target, attacker), options); + if (options.cancel) + ci.cancel(); + } + } + + // TODO(Ravel): no target class + @Inject(method = "postMine", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + boolean returnValue = provider.postMine(new PostMineEvent(stack, world, state, pos, miner), options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "onCraft", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onCraft(ItemStack stack, World world, CallbackInfo ci) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + provider.onCraft(new CraftEvent(stack, world), options); + if (options.cancel) + ci.cancel(); + } + } + + /* + @Inject(method = "isEnchantable", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$isEnchantable(ItemStack stack, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + boolean returnValue = provider.isEnchantable(new EnchantableArgs(stack), options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + */ + + /* + @Inject(method = "getEnchantability", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getEnchantability(CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + int returnValue = provider.getEnchantability(new EnchantabilityArgs(), options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + */ + + // TODO(Ravel): no target class + @Inject(method = "getItemBarColor", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getItemBarColor(ItemStack stack, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + int returnValue = provider.getItemBarColor(new ItemBarColorArgs(stack), options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "isItemBarVisible", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$isItemBarVisible(ItemStack stack, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + boolean returnValue = provider.isItemBarVisible(new ItemBarVisibleArgs(stack), options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getItemBarStep", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getItemBarStep(ItemStack stack, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + int returnValue = provider.getItemBarStep(new ItemBarStepArgs(stack), options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getBonusAttackDamage", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getBonusAttackDamage(Entity target, float baseAttackDamage, DamageSource damageSource, CallbackInfoReturnable cir) { + if (this instanceof ExtendItemProvider) { + ExtendItemProvider provider = (ExtendItemProvider) this; + Options options = new Options(); + float returnValue = provider.getBonusAttackDamage(new BonusAttackDamageArgs(target, baseAttackDamage, damageSource), options); + if (options.cancel) + cir.setReturnValue(returnValue); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getUseAction", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getUseAction(ItemStack stack, CallbackInfoReturnable cir) { + if (this instanceof CompatItemProvider) { + CompatItemProvider provider = (CompatItemProvider) this; + Options options = new Options(); + CompatUseAction returnValue = provider.getUseAction(new UseActionArgs(stack), options); + if (options.cancel) + cir.setReturnValue(returnValue.get()); + } + } + + // TODO(Ravel): no target class + @Inject(method = "inventoryTick", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inventoryTick(ItemStack stack, ServerWorld world, Entity entity, EquipmentSlot slot, CallbackInfo ci) { + // イベントを呼び出す + if (!ItemEventRegistry.INVENTORY_TICK.isEmpty()) { + int maxPriority = ItemEventRegistry.INVENTORY_TICK.getMaxPriority(); + for (int p = maxPriority; p >= 0; p--) { + for (InventoryTickTask listener : ItemEventRegistry.INVENTORY_TICK.getListenersAsList(p)) { + listener.inventoryTick(new InventoryTickEvent(stack, world, entity, slot)); + } + } + } + + // CompatItemProviderを実装している場合 + if (this instanceof CompatItemProvider) { + CompatItemProvider provider = (CompatItemProvider) this; + Options options = new Options(); + provider.inventoryTick(new InventoryTickEvent(stack, world, entity, slot), options); + if (options.cancel) + ci.cancel(); + } + } + + // TODO(Ravel): no target class + @Inject(method = "getRecipeRemainder", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getRecipeRemainder(CallbackInfoReturnable cir) { + if (this instanceof FixedRecipeRemainderItem) { + ItemStack returnValue = ((FixedRecipeRemainderItem) this) + .getFixedRecipeRemainder(ItemStackUtil.create((Item) (Object) this)); + cir.setReturnValue(returnValue); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java new file mode 100644 index 000000000..1240b432c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.mixin; + +import com.mojang.serialization.Dynamic; +import net.minecraft.datafixer.fix.ItemStackComponentizationFix; +import net.pitan76.mcpitanlib.api.datafixer.ItemStackFixer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +// TODO(Ravel): can not resolve target class ItemStackComponentizationFix +@Mixin(ItemStackComponentizationFix.class) +public class ItemStackComponentizationFixMixin { + // TODO(Ravel): no target class + @Inject(method = "fixStack", at = @At("TAIL")) + private static void mcpitanlib$fixStack(ItemStackComponentizationFix.StackData data, Dynamic dynamic, CallbackInfo ci) { + if (!ItemStackFixer.getNbt2componentMapIfItemEqualMap().isEmpty()) { + ItemStackFixer.getNbt2componentMapIfItemEqualMap().forEach((itemId, map) -> { + for (String nbtKey : map.keySet()) { + if (data.itemEquals(itemId)) { + data.moveToComponent(nbtKey, map.get(nbtKey)); + } + } + }); + } + + if (!ItemStackFixer.getNbt2componentMapIfitemMatchesMap().isEmpty()) { + ItemStackFixer.getNbt2componentMapIfitemMatchesMap().forEach((itemIds, map) -> { + for (String nbtKey : map.keySet()) { + if (data.itemMatches(itemIds)) { + data.moveToComponent(nbtKey, map.get(nbtKey)); + } + } + }); + } + + if (!ItemStackFixer.getNbt2componentMap().isEmpty()) { + ItemStackFixer.getNbt2componentMap().forEach(data::moveToComponent); + } + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java new file mode 100644 index 000000000..246e445a0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.pitan76.mcpitanlib.api.event.v0.event.ItemStackActionEvent; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.function.Consumer; + +// TODO(Ravel): can not resolve target class ItemStack +@Mixin(ItemStack.class) +public abstract class ItemStackMixin { + + // TODO(Ravel): no target class + @Inject(method = "damage(ILnet/minecraft/server/world/ServerWorld;Lnet/minecraft/server/network/ServerPlayerEntity;Ljava/util/function/Consumer;)V", at = @At("HEAD"), cancellable = true) + public void mcpitanlib$damage(int amount, ServerWorld world, ServerPlayerEntity player, Consumer breakCallback, CallbackInfo ci) { + ItemStackActionEvent.returnValue = null; + ItemStackActionEvent.call((ItemStack) (Object) this); + if (ItemStackActionEvent.returnValue != null) + ci.cancel(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java new file mode 100644 index 000000000..808caaf45 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.item.ItemUsageContext; +import net.minecraft.util.hit.BlockHitResult; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +// TODO(Ravel): can not resolve target class ItemUsageContext +@Mixin(ItemUsageContext.class) +public interface ItemUsageContextMixin { + // TODO(Ravel): Could not determine a single target + @Accessor + public BlockHitResult getHit(); +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java b/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java new file mode 100644 index 000000000..f4c81ebb0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.server.MinecraftServer; +import net.pitan76.mcpitanlib.api.timer.MinecraftServerTimerAccess; +import net.pitan76.mcpitanlib.api.timer.TimerItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; + +@Mixin(MinecraftServer.class) +public class MinecraftServerTimer implements MinecraftServerTimerAccess { + @Unique + private final List mcpitanlib$timerItems = new ArrayList<>(); + + @Inject(method = "tick", at = @At("TAIL")) + private void mcpitanlib$onTick(CallbackInfo ci) { + if (mcpitanlib$timerItems.isEmpty()) return; + List items = new ArrayList<>(mcpitanlib$timerItems); + + for (TimerItem item : items) { + if (--item.ticksUntilSomething == 0L) { + if (item.executeSupplier.get()) + mcpitanlib$timerItems.remove(item); + } + } + } + + @Override + public void mcpitanlib$addTimer(long ticksUntilSomething, Supplier executeSupplier) { + mcpitanlib$timerItems.add(new TimerItem(ticksUntilSomething, executeSupplier)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java new file mode 100644 index 000000000..6ae6c68da --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.mixin; + +import com.llamalad7.mixinextras.sugar.Local; +import net.minecraft.recipe.*; +import net.minecraft.resource.ResourceManager; +import net.minecraft.resources.Identifier; +import net.minecraft.util.profiler.Profiler; +import net.pitan76.mcpitanlib.api.event.v0.event.RecipeManagerEvent; +import net.pitan76.mcpitanlib.api.event.v1.RecipeManagerRegistry; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.SortedMap; + +// TODO(Ravel): can not resolve target class ServerRecipeManager +// TODO(Ravel): can not resolve target class ServerRecipeManager +@Mixin(ServerRecipeManager.class) +public class RecipeManagerMixin { + + // TODO(Ravel): no target class +// TODO(Ravel): no target class + @Inject(method = "prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Lnet/minecraft/recipe/PreparedRecipes;", + at = @At(value = "TAIL")) + private void mcpitanlib$invokeApply(ResourceManager resourceManager, Profiler profiler, CallbackInfoReturnable cir, @Local SortedMap> sortedMap) { + if (RecipeManagerRegistry.managers.isEmpty()) return; + RecipeManagerRegistry.managers.forEach((manager) -> manager.apply(new RecipeManagerEvent(sortedMap, resourceManager, profiler))); + } + +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java new file mode 100644 index 000000000..e0c34206d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java @@ -0,0 +1,40 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.server.world.ServerWorld; +import net.pitan76.mcpitanlib.api.timer.ServerWorldTimerAccess; +import net.pitan76.mcpitanlib.api.timer.TimerItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; + +// TODO(Ravel): can not resolve target class ServerWorld +@Mixin(ServerWorld.class) +public class ServerWorldTimer implements ServerWorldTimerAccess { + @Unique + private final List mcpitanlib$timerItems = new ArrayList<>(); + + // TODO(Ravel): no target class + @Inject(method = "tick", at = @At("TAIL")) + private void onTick(CallbackInfo ci) { + if (mcpitanlib$timerItems.isEmpty()) return; + List items = new ArrayList<>(mcpitanlib$timerItems); + + for (TimerItem item : items) { + if (--item.ticksUntilSomething == 0L) { + if (item.executeSupplier.get()) + mcpitanlib$timerItems.remove(item); + } + } + } + + @Override + public void mcpitanlib$addTimer(long ticksUntilSomething, Supplier executeSupplier) { + mcpitanlib$timerItems.add(new TimerItem(ticksUntilSomething, executeSupplier)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java new file mode 100644 index 000000000..27f73185b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java @@ -0,0 +1,106 @@ +package net.pitan76.mcpitanlib.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.mojang.blaze3d.buffers.GpuBufferSlice; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.*; +import net.minecraft.client.render.state.WorldBorderRenderState; +import net.minecraft.client.render.state.WorldRenderState; +import net.minecraft.client.util.ObjectAllocator; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.border.WorldBorder; +import net.pitan76.mcpitanlib.api.client.event.WorldRenderRegistry; +import net.pitan76.mcpitanlib.api.client.event.listener.*; +import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; +import org.joml.Vector4f; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +// TODO(Ravel): can not resolve target class WorldRenderer +// TODO(Ravel): can not resolve target class WorldRenderer +@Mixin(WorldRenderer.class) +public abstract class WorldRendererMixin { + // TODO(Ravel): Could not determine a single target +// TODO(Ravel): Could not determine a single target + @Shadow private int ticks; + + // TODO(Ravel): Could not determine a single target +// TODO(Ravel): Could not determine a single target + @Shadow public abstract boolean isTerrainRenderComplete(); + + // TODO(Ravel): Could not determine a single target +// TODO(Ravel): Could not determine a single target + @Shadow @Nullable public abstract Frustum getCapturedFrustum(); + + // TODO(Ravel): Could not determine a single target +// TODO(Ravel): Could not determine a single target + @Shadow @Final private MinecraftClient client; + // TODO(Ravel): Could not determine a single target +// TODO(Ravel): Could not determine a single target + @Shadow @Final private WorldRenderState worldRenderState; + // TODO(Ravel): Could not determine a single target +// TODO(Ravel): Could not determine a single target + @Shadow @Nullable private ClientWorld world; + @Unique + private final WorldRenderContextImpl mcpitanlib$contextCache = new WorldRenderContextImpl(); + + // TODO(Ravel): no target class +// TODO(Ravel): no target class + @Inject(method = "renderTargetBlockOutline", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onRenderTargetBlockOutline(VertexConsumerProvider.Immediate immediate, MatrixStack matrices, boolean renderBlockOutline, WorldRenderState renderStates, CallbackInfo ci) { + if (WorldRenderRegistry.isEmptyBlockOutlineListeners) return; + + mcpitanlib$contextCache.worldRenderer = (WorldRenderer)(Object) this; + mcpitanlib$contextCache.advancedTranslucency = isTerrainRenderComplete(); + mcpitanlib$contextCache.consumers = immediate; + mcpitanlib$contextCache.matrixStack = matrices; + mcpitanlib$contextCache.tickDelta = ticks; + + BeforeBlockOutlineEvent event = new BeforeBlockOutlineEvent(mcpitanlib$contextCache, MinecraftClient.getInstance().crosshairTarget); + + for (BeforeBlockOutlineListener listener : WorldRenderRegistry.beforeBlockOutlineListeners) { + if (!listener.beforeBlockOutline(event)) { + ci.cancel(); + return; + } + } + } + + // TODO(Ravel): no target class +// TODO(Ravel): no target class + @Inject(method = "render", at = @At("HEAD")) + private void beforeRender(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci) { + mcpitanlib$contextCache.prepare(client.gameRenderer, (WorldRenderer) (Object) this, worldRenderState, world, tickCounter, renderBlockOutline, camera, positionMatrix, matrix4f, projectionMatrix); + } + + // TODO(Ravel): no target class +// TODO(Ravel): no target class + @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupFrustum(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/client/render/Frustum;")) + private Frustum onSetupFrustum(Frustum frustum) { + mcpitanlib$contextCache.frustum = frustum; + return frustum; + } + + + // TODO(Ravel): no target class +// TODO(Ravel): no target class + @WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldBorderRendering;updateRenderState(Lnet/minecraft/world/border/WorldBorder;FLnet/minecraft/util/math/Vec3d;DLnet/minecraft/client/render/state/WorldBorderRenderState;)V")) + private void mcpitanlib$onWorldBorderExtraction(WorldBorderRendering instance, WorldBorder worldBorder, float tickDelta, Vec3d vec3d, double d, WorldBorderRenderState worldBorderRenderState, Operation original) { + original.call(instance, worldBorder, tickDelta, vec3d, d, worldBorderRenderState); + if (WorldRenderRegistry.isEmptyWorldRenderAfterLevelListeners) return; + + for (WorldRenderContextListener listener : WorldRenderRegistry.worldRenderAfterLevelListeners) { + listener.render(mcpitanlib$contextCache); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java new file mode 100644 index 000000000..568fa9c5d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.test; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.command.CommandSettings; +import net.pitan76.mcpitanlib.api.command.LiteralCommand; +import net.pitan76.mcpitanlib.api.command.argument.IntegerCommand; +import net.pitan76.mcpitanlib.api.event.IntegerCommandEvent; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +public class ExampleCommand extends LiteralCommand { + + @Override + public void init(CommandSettings settings) { + addArgumentCommand("item", new LiteralCommand() { + @Override + public void init(CommandSettings settings) { + addArgumentCommand(new IntegerCommand() { + @Override + public void execute(IntegerCommandEvent event) { + try { + event.getPlayer().offerOrDrop(new ItemStack(ExampleMod.EXAMPLE_ITEM.getOrNull(), event.getValue())); + } catch (CommandSyntaxException ignored) { + + } + } + + @Override + public String getArgumentName() { + return "count"; + } + }); + } + + @Override + public void execute(ServerCommandEvent event) { + try { + event.getPlayer().offerOrDrop(new ItemStack(ExampleMod.EXAMPLE_ITEM.getOrNull())); + } catch (CommandSyntaxException ignored) { + + } + } + }); + } + + @Override + public void execute(ServerCommandEvent event) { + System.out.println(event.getInput()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java new file mode 100644 index 000000000..ab182e28c --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.test; + +import net.minecraft.inventory.Inventory; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.util.InventoryUtil; +import net.pitan76.mcpitanlib.api.util.debug.OutputUtil; +import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; + +public class ExampleContainerGui extends SimpleContainerGui { + + public static Inventory EXAMPLE_INVENTORY = InventoryUtil.createSimpleInventory(1); + + public ExampleContainerGui(CreateMenuEvent e) { + super(ExampleMod.EXAMPLE_CONTAINER_GUI.get(), e); + addPlayerMainInventorySlots(e.playerInventory, 8, 84); + addPlayerHotbarSlots(e.playerInventory, 8, 142); + + addNormalSlot(EXAMPLE_INVENTORY, 0, 24, 24); + } + + @Override + public void close(Player player) { + OutputUtil.print(EXAMPLE_INVENTORY); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java new file mode 100644 index 000000000..3e6d42413 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.test; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; +import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class ExampleContainerGuiScreen extends CompatInventoryScreen { + + public static CompatIdentifier GUI = CompatIdentifier.of("textures/gui/container/blast_furnace.png"); + + public ExampleContainerGuiScreen(ExampleScreenHandler handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + } + + @Override + public CompatIdentifier getCompatTexture() { + return GUI; + } + + @Override + public void initOverride() { + super.initOverride(); + System.out.println("hogehogehoge1111"); + this.addDrawableCTBW(new CompatibleTexturedButtonWidget(0, 0, 30, 30, 0, 0, GUI, (buttonWidget) -> { + System.out.println("hogehoge"); + })); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java new file mode 100644 index 000000000..7a52d1587 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.test; + +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; + +public class ExampleGuiBlock extends CompatBlock implements SimpleScreenHandlerFactory { + + public ExampleGuiBlock(CompatibleBlockSettings settings) { + super(settings); + } + + @Override + public CompatActionResult onRightClick(BlockUseEvent e) { + if (e.isClient()) + e.player.openGuiScreen(this); + + return e.success(); + } + + @Override + public Text getDisplayName(DisplayNameArgs args) { + return getName(); + } + + @Override + public ScreenHandler createMenu(CreateMenuEvent e) { + return new ExampleScreenHandler(e); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java new file mode 100644 index 000000000..7f3571e0a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java @@ -0,0 +1,37 @@ +package net.pitan76.mcpitanlib.test; + +import net.minecraft.screen.ScreenHandler; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.util.StackActionResult; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +public class ExampleGuiItem extends CompatItem implements SimpleScreenHandlerFactory { + + public ExampleGuiItem(CompatibleItemSettings settings) { + super(settings); + } + + @Override + public StackActionResult onRightClick(ItemUseEvent e) { + if (!e.isClient()) + e.user.openGuiScreen(this); + + return e.success(); + } + + @Override + public Text getDisplayName(DisplayNameArgs args) { + return TextUtil.literal("Example Title"); + } + + @Override + public ScreenHandler createMenu(CreateMenuEvent e) { + return new ExampleScreenHandler(e); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java new file mode 100644 index 000000000..0f33c0938 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java @@ -0,0 +1,88 @@ +package net.pitan76.mcpitanlib.test; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.screen.ScreenHandlerType; +import net.pitan76.mcpitanlib.api.CommonModInitializer; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.command.CommandRegistry; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.simple.item.SimpleGuiItem; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; +import net.pitan76.mcpitanlib.guilib.GuiRegistry; +import net.pitan76.mcpitanlib.midohra.item.ItemGroups; + +public class ExampleMod extends CommonModInitializer { + public static final String MOD_ID = "examplemod"; + public static final String MOD_NAME = "ExampleMod"; + + public static ExampleMod INSTANCE; + public static CompatRegistryV2 registry; + + public static SupplierResult> EXAMPLE_SCREENHANDLER; + public static SupplierResult> EXAMPLE_CONTAINER_GUI; + + public static RegistryResult EXAMPLE_ITEM; + public static RegistryResult EXAMPLE_BLOCK; + public static RegistryResult EXAMPLE_BLOCK_ITEM; + public static RegistryResult EXAMPLE_GUI_ITEM; + public static RegistryResult EXAMPLE_CONTAINER_GUI_ITEM; + public static RegistryResult EXAMPLE_GUI_BLOCK; + public static RegistryResult EXAMPLE_GUI_BLOCK_ITEM; + + public static CompatIdentifier EXAMPLE_ITEM_ID = _id("example_item"); + public static CompatIdentifier EXAMPLE_BLOCK_ID = _id("example_block"); + public static CompatIdentifier EXAMPLE_GUI_ITEM_ID = _id("example_gui_item"); + public static CompatIdentifier EXAMPLE_GUI_BLOCK_ID = _id("example_gui_block"); + public static CompatIdentifier EXAMPLE_CONTAINER_GUI_ITEM_ID = _id("example_container_gui_item"); + + + public void init() { + INSTANCE = this; + registry = super.registry; + + // en: Register all items, blocks and others. , ja: 全てのアイテム、ブロック、その他を登録します。 + EXAMPLE_SCREENHANDLER = registry.registerScreenHandlerType(compatId("example_gui"), new SimpleScreenHandlerTypeBuilder<>(ExampleScreenHandler::new)); + EXAMPLE_CONTAINER_GUI = GuiRegistry.register(registry, compatId("example_container_gui"), new SimpleScreenHandlerTypeBuilder<>(ExampleContainerGui::new)); + + EXAMPLE_ITEM = registry.registerItem(EXAMPLE_ITEM_ID, () -> new CompatItem(CompatibleItemSettings.of(EXAMPLE_ITEM_ID).addGroup(ItemGroups.INGREDIENTS))); + EXAMPLE_BLOCK = registry.registerBlock(EXAMPLE_BLOCK_ID, () -> new CompatBlock(CompatibleBlockSettings.of(EXAMPLE_BLOCK_ID, CompatibleMaterial.STONE))); + EXAMPLE_BLOCK_ITEM = registry.registerItem(EXAMPLE_BLOCK_ID, () -> ItemUtil.create(EXAMPLE_BLOCK.supplier.get(), CompatibleItemSettings.of(EXAMPLE_BLOCK_ID).addGroup(ItemGroups.INGREDIENTS))); + + EXAMPLE_GUI_ITEM = registry.registerItem(EXAMPLE_GUI_ITEM_ID, () -> new ExampleGuiItem(CompatibleItemSettings.of(EXAMPLE_GUI_ITEM_ID).addGroup(ItemGroups.INGREDIENTS))); + + EXAMPLE_GUI_BLOCK = registry.registerBlock(EXAMPLE_GUI_BLOCK_ID, () -> new ExampleGuiBlock(CompatibleBlockSettings.of(EXAMPLE_GUI_BLOCK_ID, CompatibleMaterial.STONE))); + EXAMPLE_GUI_BLOCK_ITEM = registry.registerItem(EXAMPLE_GUI_BLOCK_ID, () -> ItemUtil.create(EXAMPLE_GUI_BLOCK.supplier.get(), CompatibleItemSettings.of(EXAMPLE_GUI_BLOCK_ID).addGroup(ItemGroups.INGREDIENTS))); + + EXAMPLE_CONTAINER_GUI_ITEM = registry.registerItem(EXAMPLE_CONTAINER_GUI_ITEM_ID, + () -> new SimpleGuiItem(CompatibleItemSettings.of(EXAMPLE_CONTAINER_GUI_ITEM_ID) + .addGroup(ItemGroups.INGREDIENTS), + ExampleContainerGui::new) + ); + + // en: Register the command , ja: コマンドを登録します + CommandRegistry.register("mpla", new ExampleCommand()); + } + + public static CompatIdentifier _id(String id) { + return CompatIdentifier.of(MOD_ID, id); + } + + @Override + public String getId() { + return MOD_ID; + } + + @Override + public String getName() { + return MOD_NAME; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java new file mode 100644 index 000000000..aa3b041be --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java @@ -0,0 +1,12 @@ +package net.pitan76.mcpitanlib.test; + +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.guilib.GuiRegistry; + +public class ExampleModClient { + public static void init() { + CompatRegistryClient.registerScreen(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_SCREENHANDLER.get(), ExampleScreen::new); + + GuiRegistry.registerSimpleContainerGui(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_CONTAINER_GUI.get()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java new file mode 100644 index 000000000..17bd18c72 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.test; + +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.text.Text; +import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; +import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class ExampleScreen extends CompatInventoryScreen { + + public static CompatIdentifier GUI = CompatIdentifier.of("textures/gui/container/blast_furnace.png"); + + public ExampleScreen(ExampleScreenHandler handler, PlayerInventory inventory, Text title) { + super(handler, inventory, title); + } + + @Override + public CompatIdentifier getCompatTexture() { + return GUI; + } + + @Override + public void initOverride() { + super.initOverride(); + System.out.println("hogehogehoge1111"); + this.addDrawableCTBW(new CompatibleTexturedButtonWidget(0, 0, 30, 30, 0, 0, GUI, (buttonWidget) -> { + System.out.println("hogehoge"); + })); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java new file mode 100644 index 000000000..ff99d6ae9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java @@ -0,0 +1,24 @@ +package net.pitan76.mcpitanlib.test; + +import net.minecraft.item.ItemStack; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; + +public class ExampleScreenHandler extends SimpleScreenHandler { + + public ExampleScreenHandler(CreateMenuEvent e) { + super(ExampleMod.EXAMPLE_SCREENHANDLER.get(), e); + + } + + @Override + public ItemStack quickMoveOverride(Player player, int slot) { + return null; + } + + @Override + public boolean canUse(Player player) { + return true; + } +} diff --git a/src/main/resources/assets/mplguilib/textures/container/base.png b/src/main/resources/assets/mplguilib/textures/container/base.png new file mode 100644 index 0000000000000000000000000000000000000000..e5fca7df1dcdcaf7beb026735c99d427a7987853 GIT binary patch literal 802 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$6%U;1OBOz`%C|gc+x5^GP!> zFkSI#jVhAMCfcojr4A z-+N=d#{Zvw{6752`Sj!0@eSpw3<7GSXt;&Iom1O#!}~vk)tx;Pl|A=(VMR>G&m9cc zKL6ZPBJiWH_I`TWwX4NPBj_rAkj9gqc{u6{1- HoD!M<`Rb86 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/mplguilib/textures/container/base_furnace.png b/src/main/resources/assets/mplguilib/textures/container/base_furnace.png new file mode 100644 index 0000000000000000000000000000000000000000..20a8bd98b0ce4d77ab5f07d0e246e8145127f82f GIT binary patch literal 1637 zcmds1dr;C@6u$hFQZ}&0bu3fawq4sEDm@G<3tyYsini4+vruTa%pR*?Nk)pIV=rGj z%aE>*Y_{2KXh4lsQ$%Q3A;!r-OJxbAp%O&t;e$|w#hq#PZ}-nVGk4BC_sspych7g{ zT;HD%gGTwF008K?*ysZQAe>tSa9iSZq^x^sPUlXIO+F6*=Ff$N;B3UK24IPITy(^t zoZ1O3A3z7<=@c0;z;{itww)4iX#J)- z)}dbHmUh+wLq*_^Jr6pCzf9)c+VJ5LEC#rC6ejV5)g~(Nb3bcffL_n*%AwLg?{DLiD&n@ z?{mWV+}R90au>Af)M{CK$6BRI^*s#xVX;X>J6aI1aBh+}uibx{V~`??)cPQUBs_}j?=OPc$y&^&I$FMeG^%wM%``` zi^VEDbnzub*~(|S$X8$Trd|vn0Lf8?^d*&d(qXqV8@Xq+1TvgWr_)W1dDS9}veWvL zL?94w>=N$NV{pG7abI(z-eoyrsPq!RU@%=Z*9LcInD8w(z=h0>hr!k_f%Yf^P2s>1 z{n4O9;8YN9p&f7H9YpIQ#ba;Wa|avoihba(HY!@zny3vTaCqQ$9{v{e;9~$ zTV+$06?;jD-cY4qX0^gYYfRGS^|ge=5t)Vo9$~5Sd3Puq+tD@^Bq3Ip7b-kzngvFO zruWs=Cu&0lRAXyO-sOCd?W1&Vc65}Sk@w;CXh?I`kVZ4v6H6(Yg<)Z4*MQ#Rtv7~b z$+0{cls$D=W@dc+JdUJ@xo4)*k2v!|z7Ngs4XP#%eht*LYMyIsm@ipZQg05vwTTbi zt8G6jg1hT@LKkJ3{X}wp>Iif0w7px=;ILje ziQBwuSXNhHI^rHaH!Fx^&W>Ac(8yOP!n3x@#L>js7Y+jXT4YVCn5k8m!XMPB+Z{Uj z#Sm^!o3+<8rEaj^5#?J zu+H^#aSW-L^Y-puKj};nwg<+7;sS-tIig)L4b7TCxhh;%mzVL!s`zi_z17C1GVAIy zp=}DXtU)WbefS}Dqib(t#`^=&HyY0R|M+;r_=%0bXn*@>-$irE_s!gB-{rU5xXbcu z)n1L$n<~zozh?N)S+25%+rCdT{CH64)y>D=mhC=jV=pggD8Z9dT>Lrk@rUB5P6_i9 zHoyMXO-cRvX8!#0KkYV;ez+~Z`03YvjjlkSR)-^xXMNQCZ5wv?Yei(7X)S~9hAYqd zJ65dHO4@1MCojdr<}1&{8=3iw;Z~Z3j9yL8;>C+^+`QTO`0?Y_0ypm5*;8s(_o8&} z8I~d=<{6uMp5+@GH`cH?c;C5NGktSY`?u&Xg&#f_aefe9u{$%C?@1!t1*Y$&AA+}E zKk1{u&UitIe{SjY$}ltL69-ityltQI{JE31H=pP1{B}u)?mOkmAKc$x_x=1_i6QF2 zO5g1()UN*d$u>vgexAlQVaBuLJPQ&- zLwm!%e}D8lf4}{X_h0Ht&&ZgWnO&;?uef_^+>y;YICqahX4O_(o z#f@j{o&R@zb5r;2%`L0~Ogk&ME^N5^cW=k!4hvnSM-Q@o|2k8 zxBsYnY_#CrveIM&e&dF=-sNA#3;#V|AAb8-`v2~eXA<6g`up|n=A|_@H^9NU#dGrf zJ^SnSnDe#9KdSkC_G;c^_a<@Ug&REP+to&$vM^cw(VJnu^Nx;=j(@j}+5*q!*jLt9 ze9d~iKkv@=Nk58be?2{2|NFJyKR!O*ob_pwi5x>}q}b;_K@+FHtNHD`W`2$I{Rh@_ z)*Ll2owmQ~jrq;8eSg&+{mtpMnjQN2`6HnPiPz_U+r8s!-2VT^udM#~`|@=`;2n{V=Z8<&h z$F8n}4-}+ zzu4N-68W9UcRfD`msri+`Tz3ws=YsceSLk0eX-v?tJFv{xeiIuxqj(aUVnY2b?N>0 z$9H#^FYL2AzxJ{A)3YB$7=(lwCd^=HIKsl9qQ;8C`;E=?GRqDi>2M-cL z*h{a>biZ6XVXA23l}uMzZ6?#hT@J6dEb0?&ob^zSIFpbpiM$=w7O0*+ciC?RZEdEN zm%FUOShCs>X4~R(5t2Cwe{9~imS?fwIV<1qj$y8$q5nQ+#%#a6Rl$Qfh6(1g8>gP1 zpZ{F%(y`FAtCf+Z8Ev7BSAl+6&18O9l^h?mhk|_oEFK3NP+0t*kzpgF%dxj#c7xpJ M>FVdQ&MBb@07kxbtN;K2 literal 0 HcmV?d00001 From fe4855afd03038ec4061538e348216e22bd0071d Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 10:20:39 +0900 Subject: [PATCH 009/151] use mojmap --- build.gradle | 17 +- .../api/block/BlockItemByExtendBlock1215.java | 20 +- .../api/block/CompatBlockRenderType.java | 16 +- .../mcpitanlib/api/block/CompatBlocks.java | 4 +- .../api/block/CompatChestBlock.java | 19 +- .../api/block/CompatPillarBlock.java | 33 +- .../mcpitanlib/api/block/CompatSlabBlock.java | 37 +- .../api/block/CompatStairsBlock.java | 59 +- .../api/block/CompatWaterloggable.java | 10 +- .../api/block/CompatibleBlockSettings.java | 98 +- .../api/block/CompatibleMaterial.java | 112 +- .../mcpitanlib/api/block/ExtendBlock.java | 145 +- .../api/block/ExtendBlockEntityProvider.java | 28 +- .../api/block/ExtendBlockProvider.java | 14 +- .../api/block/args/RenderTypeArgs.java | 2 +- .../mcpitanlib/api/block/args/RotateArgs.java | 12 +- .../api/block/args/SideInvisibleArgs.java | 4 +- .../api/block/args/v2/CanPlaceAtArgs.java | 18 +- .../block/args/v2/CollisionShapeEvent.java | 6 +- .../args/v2/GetComparatorOutputArgs.java | 18 +- .../args/v2/HasComparatorOutputArgs.java | 2 +- .../api/block/args/v2/OutlineShapeEvent.java | 16 +- .../api/block/args/v2/PlacementStateArgs.java | 66 +- .../args/v2/StateForNeighborUpdateArgs.java | 26 +- .../api/block/v2/BlockSettingsBuilder.java | 6 +- .../mcpitanlib/api/block/v2/CompatBlock.java | 62 +- .../api/block/v2/CompatBlockProvider.java | 8 +- .../api/block/v2/CompatStairsBlock.java | 30 +- .../api/block/v2/CompatibleBlockSettings.java | 48 +- .../api/client/CompatInventoryScreen.java | 8 +- .../api/client/SimpleHandledScreen.java | 126 +- .../api/client/SimpleInventoryScreen.java | 8 +- .../api/client/SimpleOptionsScreen.java | 14 +- .../mcpitanlib/api/client/SimpleScreen.java | 72 +- .../color/CompatBlockColorProvider.java | 12 +- .../listener/BeforeBlockOutlineEvent.java | 34 +- .../event/listener/ItemTooltipContext.java | 22 +- .../event/listener/ItemTooltipListener.java | 10 +- .../event/listener/WorldRenderContext.java | 50 +- .../listener/WorldRenderContextImpl.java | 59 +- .../gui/screen/CompatInventoryScreen.java | 12 +- .../api/client/gui/screen/ScreenTexts.java | 24 +- .../gui/screen/SimpleHandledScreen.java | 140 +- .../gui/screen/SimpleInventoryScreen.java | 10 +- .../gui/widget/CompatTextFieldWidget.java | 50 +- .../CompatibleTexturedButtonWidget.java | 36 +- .../RedrawableTexturedButtonWidget.java | 7 +- .../client/gui/widget/SimpleListWidget.java | 43 +- .../client/gui/widget/SimpleSliderWidget.java | 18 +- .../api/client/option/CompatKeyBinding.java | 34 +- .../api/client/option/GameOptionsWrapper.java | 10 +- .../client/registry/ArchRegistryClient.java | 140 +- .../registry/EntityRendererRegistry.java | 8 +- .../client/registry/KeybindingRegistry.java | 16 +- .../registry/v2/KeybindingRegistry.java | 10 +- .../api/client/render/CompatRenderLayer.java | 40 +- .../api/client/render/DrawObjectDM.java | 32 +- .../api/client/render/DrawObjectMV.java | 18 +- .../render/EntityModelLayerContext.java | 8 +- .../entity/CompatBlockEntityRenderer.java | 26 +- .../entity/event/BlockEntityRenderEvent.java | 70 +- ...ompatBlockEntityRendererConstructArgs.java | 6 +- .../entity/v2/CompatBlockEntityRenderer.java | 8 +- .../api/command/CommandRegistry.java | 20 +- .../api/command/CommandSettings.java | 18 +- .../api/command/argument/BlockCommand.java | 8 +- .../api/command/argument/EntitiesCommand.java | 8 +- .../api/command/argument/EntityCommand.java | 8 +- .../api/command/argument/ItemCommand.java | 8 +- .../api/command/argument/PlayerCommand.java | 8 +- .../api/command/argument/PlayersCommand.java | 8 +- .../api/enchantment/CompatEnchantment.java | 40 +- .../api/entity/CompatContainerUser.java | 12 +- .../mcpitanlib/api/entity/CompatEntity.java | 80 +- .../api/entity/CompatThrownItemEntity.java | 86 +- .../api/entity/EntityTypeBuilder.java | 28 +- .../mcpitanlib/api/entity/ExtendEntity.java | 62 +- .../api/entity/ExtendEntityType.java | 32 +- .../pitan76/mcpitanlib/api/entity/Player.java | 264 +- .../attribute/AttrModifierOperation.java | 24 +- .../AttributeModifiersComponentBuilder.java | 6 +- .../CompatAttributeModifierSlot.java | 52 +- .../CompatAttributeModifiersComponent.java | 10 +- .../attribute/CompatEntityAttribute.java | 16 +- .../CompatEntityAttributeInstance.java | 18 +- .../CompatEntityAttributeModifier.java | 12 +- .../attribute/CompatEntityAttributes.java | 38 +- .../api/entity/effect/CompatStatusEffect.java | 30 +- .../effect/CompatStatusEffectInstance.java | 24 +- .../api/event/BlockCommandEvent.java | 6 +- .../api/event/EntitiesCommandEvent.java | 6 +- .../api/event/EntityCommandEvent.java | 6 +- .../api/event/ItemCommandEvent.java | 6 +- .../api/event/PlayerCommandEvent.java | 6 +- .../api/event/PlayersCommandEvent.java | 6 +- .../api/event/ServerCommandEvent.java | 40 +- .../api/event/block/AppendPropertiesArgs.java | 14 +- .../api/event/block/BlockBreakEvent.java | 20 +- .../api/event/block/BlockBreakStartEvent.java | 16 +- .../api/event/block/BlockPlacedEvent.java | 20 +- .../event/block/BlockScheduledTickEvent.java | 16 +- .../api/event/block/BlockUseEvent.java | 30 +- .../event/block/CanPathfindThroughArgs.java | 18 +- .../api/event/block/CollisionShapeEvent.java | 10 +- .../api/event/block/DroppedStacksArgs.java | 16 +- .../api/event/block/EntityCollisionEvent.java | 50 +- .../api/event/block/FluidStateArgs.java | 2 +- .../api/event/block/ItemScattererUtil.java | 42 +- .../api/event/block/NeighborUpdateEvent.java | 24 +- .../api/event/block/OutlineShapeEvent.java | 26 +- .../api/event/block/PickStackEvent.java | 28 +- .../api/event/block/PlacementStateArgs.java | 64 +- .../event/block/ScreenHandlerCreateEvent.java | 22 +- .../api/event/block/ShapesForStatesArgs.java | 4 +- .../block/StateForNeighborUpdateArgs.java | 26 +- .../api/event/block/StateReplacedEvent.java | 22 +- .../api/event/block/TileCreateEvent.java | 14 +- .../event/block/result/BlockBreakResult.java | 2 +- .../container/factory/ExtraDataArgs.java | 18 +- .../api/event/entity/CollisionEvent.java | 8 +- .../api/event/entity/EntityHitEvent.java | 6 +- .../api/event/entity/InitDataTrackerArgs.java | 24 +- .../api/event/item/BonusAttackDamageArgs.java | 4 +- .../api/event/item/CanMineArgs.java | 26 +- .../api/event/item/CanRepairArgs.java | 2 +- .../mcpitanlib/api/event/item/CraftEvent.java | 18 +- .../api/event/item/EnchantableArgs.java | 2 +- .../api/event/item/InventoryTickEvent.java | 26 +- .../event/item/ItemAppendTooltipEvent.java | 38 +- .../api/event/item/ItemBarColorArgs.java | 2 +- .../api/event/item/ItemBarStepArgs.java | 2 +- .../api/event/item/ItemBarVisibleArgs.java | 2 +- .../api/event/item/ItemFinishUsingEvent.java | 16 +- .../api/event/item/ItemUseEvent.java | 24 +- .../api/event/item/ItemUseOnBlockEvent.java | 52 +- .../api/event/item/ItemUseOnEntityEvent.java | 18 +- .../api/event/item/PostHitEvent.java | 8 +- .../api/event/item/PostMineEvent.java | 40 +- .../mcpitanlib/api/event/nbt/NbtRWArgs.java | 16 +- .../mcpitanlib/api/event/nbt/ReadNbtArgs.java | 20 +- .../api/event/nbt/WriteNbtArgs.java | 18 +- .../api/event/result/EventResult.java | 4 +- .../api/event/result/TypedEventResult.java | 12 +- .../api/event/tile/TileTickEvent.java | 18 +- .../event/v0/AttackEntityEventRegistry.java | 14 +- .../api/event/v0/ClientTickEventRegistry.java | 8 +- .../api/event/v0/EventRegistry.java | 16 +- .../event/v0/InteractionEventRegistry.java | 24 +- .../api/event/v0/LivingHurtEventRegistry.java | 4 +- .../api/event/v0/event/ClickBlockEvent.java | 26 +- .../event/v0/event/ItemStackActionEvent.java | 2 +- .../api/event/v0/event/LivingHurtEvent.java | 32 +- .../event/v0/event/RecipeManagerEvent.java | 12 +- .../event/v1/AttackEntityEventRegistry.java | 12 +- .../api/event/v1/LivingHurtEventRegistry.java | 4 +- .../api/event/v1/event/AttackEntityEvent.java | 26 +- .../mcpitanlib/api/gen/OreRegistry.java | 14 +- .../ExtendedNamedScreenHandlerFactory.java | 26 +- .../api/gui/ExtendedScreenHandler.java | 8 +- .../api/gui/ExtendedScreenHandlerFactory.java | 10 +- .../gui/ExtendedScreenHandlerTypeBuilder.java | 22 +- .../api/gui/SimpleScreenHandler.java | 72 +- .../gui/SimpleScreenHandlerTypeBuilder.java | 22 +- .../api/gui/args/CreateMenuEvent.java | 20 +- .../api/gui/args/SlotClickEvent.java | 18 +- .../api/gui/inventory/IInventory.java | 48 +- .../inventory/sided/CompatSidedInventory.java | 14 +- .../sided/VanillaStyleSidedInventory.java | 2 +- .../sided/args/AvailableSlotsArgs.java | 4 +- .../inventory/sided/args/CanExtractArgs.java | 4 +- .../inventory/sided/args/CanInsertArgs.java | 4 +- .../api/gui/slot/CompatSlotActionType.java | 42 +- .../api/gui/slot/CompatibleSlot.java | 52 +- .../gui/v2/ExtendedScreenHandlerFactory.java | 10 +- .../gui/v2/SimpleScreenHandlerFactory.java | 20 +- .../mcpitanlib/api/helper/SimpleRegister.java | 8 +- .../api/item/ArmorEquipmentType.java | 22 +- .../api/item/CompatFoodComponent.java | 24 +- .../mcpitanlib/api/item/CompatItems.java | 4 +- .../api/item/CompatibleArmorItem.java | 4 +- .../api/item/CompatibleArmorMaterial.java | 36 +- .../api/item/CompatibleItemSettings.java | 36 +- .../api/item/CreativeTabBuilder.java | 26 +- .../api/item/CreativeTabManager.java | 32 +- .../api/item/DefaultItemGroups.java | 42 +- .../mcpitanlib/api/item/ExtendBlockItem.java | 56 +- .../mcpitanlib/api/item/ExtendItem.java | 98 +- .../api/item/ExtendItemProvider.java | 4 +- .../mcpitanlib/api/item/ExtendSettings.java | 12 +- .../api/item/FixedRecipeRemainderItem.java | 2 +- .../mcpitanlib/api/item/args/RarityArgs.java | 2 +- .../api/item/args/StoppedUsingArgs.java | 26 +- .../api/item/args/UseActionArgs.java | 2 +- .../api/item/consume/CompatUseAction.java | 36 +- .../item/equipment/CompatEquipmentAsset.java | 16 +- .../equipment/CompatEquippableComponent.java | 10 +- .../equipment/EquippableComponentBuilder.java | 24 +- .../mcpitanlib/api/item/stack/LoreUtil.java | 24 +- .../api/item/tool/CompatibleAxeItem.java | 30 +- .../api/item/tool/CompatibleHoeItem.java | 30 +- .../item/tool/CompatibleMiningToolItem.java | 43 +- .../api/item/tool/CompatiblePickaxeItem.java | 30 +- .../api/item/tool/CompatibleShearsItem.java | 31 +- .../api/item/tool/CompatibleShovelItem.java | 30 +- .../api/item/tool/CompatibleSwordItem.java | 30 +- .../api/item/tool/CompatibleToolItem.java | 29 +- .../api/item/tool/CompatibleToolMaterial.java | 16 +- .../api/item/v2/CompatArmorMaterial.java | 2 +- .../mcpitanlib/api/item/v2/CompatItem.java | 26 +- .../api/item/v2/CompatItemProvider.java | 2 +- .../api/item/v2/CompatibleItemSettings.java | 36 +- .../api/item/v2/ExtendBlockItem.java | 34 +- .../api/item/v3/CompatArmorMaterial.java | 4 +- .../api/item/v3/CompatToolMaterial.java | 4 +- .../item/v3/VanillaCompatToolMaterial.java | 6 +- .../pitan76/mcpitanlib/api/nbt/NbtTag.java | 40 +- .../mcpitanlib/api/nbt/NbtTypeBytes.java | 30 +- .../api/network/ClientNetworking.java | 30 +- .../api/network/PacketByteUtil.java | 146 +- .../api/network/ServerNetworking.java | 28 +- .../api/network/v2/ClientNetworking.java | 4 +- .../api/network/v2/ServerNetworking.java | 32 +- .../network/v2/args/ClientReceiveEvent.java | 24 +- .../network/v2/args/ServerReceiveEvent.java | 18 +- .../api/recipe/CompatRecipeType.java | 17 +- .../api/recipe/CompatibleRecipeEntry.java | 19 +- .../mcpitanlib/api/recipe/MatchGetter.java | 8 +- .../api/recipe/input/CompatRecipeInput.java | 6 +- .../api/recipe/v2/CompatRecipeEntry.java | 18 +- .../api/recipe/v2/CompatRecipeNonEntry.java | 2 +- .../api/recipe/v3/CompatRecipe.java | 18 +- .../api/registry/CompatRegistry.java | 48 +- .../api/registry/CompatRegistryLookup.java | 22 +- .../mcpitanlib/api/registry/FuelRegistry.java | 12 +- .../api/registry/WorldGenRegistry.java | 30 +- .../api/registry/v2/CompatRegistryV2.java | 46 +- .../api/simple/block/SimpleGuiBlock.java | 7 +- .../api/simple/item/SimpleGuiItem.java | 14 +- .../api/sound/CompatBlockSoundGroup.java | 244 +- .../api/sound/CompatSoundCategory.java | 30 +- .../api/sound/CompatSoundEvent.java | 18 +- .../api/sound/CompatSoundEvents.java | 3112 ++++++++--------- .../sound/RegistryResultCompatSoundEvent.java | 2 +- .../api/state/property/BooleanProperty.java | 10 +- .../api/state/property/CompatProperties.java | 174 +- .../api/state/property/DirectionProperty.java | 8 +- .../api/state/property/EnumProperty.java | 20 +- .../api/state/property/IProperty.java | 10 +- .../api/state/property/IntProperty.java | 10 +- .../api/state/property/UnknownProperty.java | 8 +- .../pitan76/mcpitanlib/api/tag/TagKey.java | 36 +- .../api/tag/item/RepairIngredientTag.java | 18 +- .../mcpitanlib/api/tag/v2/CompatTagKey.java | 12 +- .../api/tag/v2/CompatTagKeyType.java | 40 +- .../api/tag/v2/typed/BlockTagKey.java | 6 +- .../api/tag/v2/typed/EntityTagKey.java | 6 +- .../api/tag/v2/typed/FluidTagKey.java | 6 +- .../api/tag/v2/typed/ItemTagKey.java | 10 +- .../mcpitanlib/api/text/CompatFormatting.java | 64 +- .../mcpitanlib/api/text/CompatStyle.java | 4 +- .../mcpitanlib/api/text/CompatTextColor.java | 42 +- .../mcpitanlib/api/text/TextComponent.java | 26 +- .../mcpitanlib/api/text/TextConverter.java | 34 +- .../api/tile/CompatBlockEntity.java | 90 +- .../api/tile/CompatChestBlockEntity.java | 58 +- .../api/tile/ExtendBlockEntity.java | 12 +- .../api/tile/ExtendBlockEntityTicker.java | 12 +- .../api/tile/RenderDataBlockEntity.java | 9 +- .../api/tile/v2/BlockEntityTypeBuilder.java | 6 +- .../api/transfer/fluid/v1/IFluidStorage.java | 10 +- .../api/transfer/fluid/v1/IFluidVariant.java | 4 +- .../api/util/ArmorMaterialUtil.java | 4 +- .../api/util/BlockEntityDataUtil.java | 30 +- .../api/util/BlockEntityTypeUtil.java | 14 +- .../mcpitanlib/api/util/BlockEntityUtil.java | 78 +- .../mcpitanlib/api/util/BlockStateUtil.java | 104 +- .../mcpitanlib/api/util/BlockUtil.java | 16 +- .../mcpitanlib/api/util/BlockViewUtil.java | 16 +- .../api/util/CommandManagerUtil.java | 34 +- .../mcpitanlib/api/util/CommandUtil.java | 18 +- .../api/util/CompatActionResult.java | 54 +- .../mcpitanlib/api/util/CompatRarity.java | 8 +- .../api/util/CompatStringIdentifiable.java | 8 +- .../api/util/CompatibleRecipeEntryUtil.java | 14 +- .../mcpitanlib/api/util/CustomDataUtil.java | 42 +- .../mcpitanlib/api/util/DamageSourceUtil.java | 16 +- .../mcpitanlib/api/util/EnchantmentUtil.java | 40 +- .../mcpitanlib/api/util/EntityTypeUtil.java | 22 +- .../mcpitanlib/api/util/EntityUtil.java | 140 +- .../api/util/EquipMaterialUtil.java | 8 +- .../api/util/FeatureConfigUtil.java | 40 +- .../mcpitanlib/api/util/FluidStateUtil.java | 16 +- .../mcpitanlib/api/util/FluidUtil.java | 50 +- .../pitan76/mcpitanlib/api/util/HandUtil.java | 28 +- .../mcpitanlib/api/util/IdentifierUtil.java | 4 +- .../mcpitanlib/api/util/IngredientUtil.java | 38 +- .../mcpitanlib/api/util/InteractUtil.java | 34 +- .../mcpitanlib/api/util/InventoryUtil.java | 130 +- .../mcpitanlib/api/util/ItemStackUtil.java | 56 +- .../pitan76/mcpitanlib/api/util/ItemUtil.java | 12 +- .../pitan76/mcpitanlib/api/util/Logger.java | 10 +- .../mcpitanlib/api/util/MCVersionUtil.java | 2 +- .../pitan76/mcpitanlib/api/util/MathUtil.java | 12 +- .../pitan76/mcpitanlib/api/util/NbtUtil.java | 254 +- .../api/util/ParticleEffectUtil.java | 6 +- .../api/util/PersistentStateUtil.java | 36 +- .../mcpitanlib/api/util/PlacedFutureUtil.java | 32 +- .../api/util/PlayerManagerUtil.java | 34 +- .../mcpitanlib/api/util/PlayerUtil.java | 32 +- .../mcpitanlib/api/util/PropertyUtil.java | 77 +- .../api/util/RegistryLookupUtil.java | 20 +- .../mcpitanlib/api/util/ResourceUtil.java | 8 +- .../api/util/ScreenHandlerUtil.java | 40 +- .../mcpitanlib/api/util/ServerUtil.java | 24 +- .../api/util/SimpleInventoryUtil.java | 30 +- .../pitan76/mcpitanlib/api/util/SlotUtil.java | 26 +- .../mcpitanlib/api/util/SoundEventUtil.java | 12 +- .../api/util/StackActionResult.java | 18 +- .../mcpitanlib/api/util/StateManagerUtil.java | 12 +- .../mcpitanlib/api/util/StatusEffectUtil.java | 8 +- .../mcpitanlib/api/util/StyleUtil.java | 22 +- .../pitan76/mcpitanlib/api/util/TextUtil.java | 46 +- .../mcpitanlib/api/util/TimerUtil.java | 4 +- .../mcpitanlib/api/util/ToolMaterialUtil.java | 2 +- .../mcpitanlib/api/util/VoxelShapeUtil.java | 28 +- .../mcpitanlib/api/util/WorldRandomUtil.java | 22 +- .../mcpitanlib/api/util/WorldUtil.java | 361 +- .../api/util/block/BlockHitResultUtil.java | 20 +- .../mcpitanlib/api/util/block/BlockUtil.java | 8 +- .../api/util/block/entity/FurnaceUtil.java | 36 +- .../util/client/BlockEntityRendererUtil.java | 12 +- .../api/util/client/ClientUtil.java | 66 +- .../api/util/client/LanguageUtil.java | 22 +- .../api/util/client/MatrixStackUtil.java | 22 +- .../mcpitanlib/api/util/client/MouseUtil.java | 22 +- .../api/util/client/ScreenUtil.java | 106 +- .../api/util/client/WindowUtil.java | 10 +- .../render/CompatItemDisplayContext.java | 2 +- .../client/render/CompatItemRenderUtil.java | 22 +- .../client/render/VertexConsumerUtil.java | 40 +- .../client/render/VertexRenderingUtil.java | 42 +- .../util/client/render/WorldRendererUtil.java | 10 +- .../api/util/client/v2/ScreenUtil.java | 6 +- .../client/widget/ClickableWidgetUtil.java | 4 +- .../api/util/client/widget/TextFieldUtil.java | 66 +- .../util/collection/ClippedItemStackList.java | 12 +- .../util/collection/DefaultedListUtil.java | 10 +- .../api/util/collection/ItemStackList.java | 26 +- .../api/util/color/CompatBrightness.java | 4 +- .../api/util/color/CompatDyeColor.java | 2 +- .../api/util/color/CompatMapColor.java | 98 +- .../mcpitanlib/api/util/debug/OutputUtil.java | 16 +- .../api/util/entity/ArrowEntityUtil.java | 20 +- .../api/util/entity/ItemEntityUtil.java | 44 +- .../api/util/entity/LivingEntityUtil.java | 24 +- .../api/util/entity/ProjectileEntityUtil.java | 12 +- .../api/util/entity/ServerPlayerUtil.java | 46 +- .../util/entity/SmallFireballEntityUtil.java | 26 +- .../api/util/entity/SnowballEntityUtil.java | 24 +- .../util/entity/SpectralArrowEntityUtil.java | 20 +- .../api/util/entity/ThrownItemEntityUtil.java | 20 +- .../api/util/event/BlockEventGenerator.java | 6 +- .../api/util/event/ItemEventGenerator.java | 2 +- .../api/util/inventory/ClippedInventory.java | 60 +- .../api/util/inventory/CompatInventory.java | 90 +- .../util/inventory/CompatPlayerInventory.java | 12 +- .../util/inventory/ContainerInventory.java | 4 +- .../api/util/inventory/ICompatInventory.java | 32 +- .../util/inventory/PlayerInventoryUtil.java | 40 +- .../util/inventory/args/CanInsertArgs.java | 4 +- .../mcpitanlib/api/util/item/FuelUtil.java | 8 +- .../api/util/item/ItemGroupUtil.java | 26 +- .../mcpitanlib/api/util/item/ItemUtil.java | 12 +- .../api/util/math/BlockRotations.java | 18 +- .../mcpitanlib/api/util/math/BoxUtil.java | 50 +- .../api/util/math/DirectionUtil.java | 2 +- .../mcpitanlib/api/util/math/PosUtil.java | 37 +- .../mcpitanlib/api/util/math/Vec3dUtil.java | 52 +- .../mcpitanlib/api/util/math/Vec3iUtil.java | 10 +- .../api/util/math/random/CompatRandom.java | 14 +- .../mcpitanlib/api/util/nbt/InvRWUtil.java | 18 +- .../mcpitanlib/api/util/nbt/NbtListUtil.java | 46 +- .../mcpitanlib/api/util/nbt/NbtRWUtil.java | 46 +- .../mcpitanlib/api/util/nbt/v2/NbtRWUtil.java | 44 +- .../api/util/particle/CompatParticleType.java | 8 +- .../util/particle/CompatParticleTypes.java | 5 +- .../effect/ItemStackParticleEffectUtil.java | 16 +- .../api/util/recipe/RecipeMatcherUtil.java | 16 +- .../api/util/recipe/RecipeUtil.java | 40 +- .../recipe/input/CraftingRecipeInputUtil.java | 54 +- .../input/SingleStackRecipeInputUtil.java | 18 +- .../api/util/screen/ScreenHandlerUtil.java | 20 +- .../mcpitanlib/api/util/v1/BlockUtilV1.java | 32 +- .../mcpitanlib/api/util/v1/ItemUtilV1.java | 32 +- .../mcpitanlib/api/util/v2/BlockUtilV2.java | 10 +- .../api/util/v2/CustomNameUtil.java | 18 +- .../mcpitanlib/api/util/v2/ItemUtilV2.java | 2 +- .../api/util/world/ChunkManagerUtil.java | 20 +- .../api/util/world/ServerWorldUtil.java | 40 +- .../mcpitanlib/api/util/world/TickerUtil.java | 18 +- .../api/util/world/WorldAccessUtil.java | 44 +- .../api/util/world/WorldViewUtil.java | 90 +- .../api/world/CompatiblePersistentState.java | 14 +- .../mcpitanlib/api/world/ExtendWorld.java | 10 +- .../core/command/CommandResult.java | 8 +- .../core/mc1216/NbtDataConverter.java | 78 +- .../mcpitanlib/core/network/BufPayload.java | 37 +- .../mcpitanlib/core/player/ItemCooldown.java | 8 +- .../core/registry/FuelRegistry.java | 16 +- .../core/registry/MCPLRegistry.java | 48 +- .../core/registry/MCPLRegistry1_20.java | 18 +- .../core/registry/MCPLRegistry1_21.java | 16 +- .../core/serialization/CompatMapCodec.java | 12 +- .../codecs/CompatBlockMapCodecUtil.java | 4 +- .../mcpitanlib/guilib/GuiRegistry.java | 26 +- .../entity/BlockEntityWithContainer.java | 2 +- .../ExtendedBlockEntityWithContainer.java | 20 +- .../container/BlockEntityContainerGui.java | 4 +- .../guilib/api/container/ContainerGui.java | 24 +- .../ExtendedBlockEntityContainerGui.java | 18 +- .../api/container/SimpleContainerGui.java | 6 +- .../guilib/api/render/SlotRenderer.java | 10 +- .../guilib/api/screen/ContainerGuiScreen.java | 10 +- .../api/screen/SimpleContainerGuiScreen.java | 6 +- .../mcpitanlib/guilib/test/TestContainer.java | 8 +- .../pitan76/mcpitanlib/midohra/Midohra.java | 60 +- .../mcpitanlib/midohra/block/BlockState.java | 20 +- .../midohra/block/BlockWrapper.java | 12 +- .../mcpitanlib/midohra/block/Blocks.java | 1528 ++++---- .../midohra/block/SupplierBlockWrapper.java | 2 +- .../block/entity/BlockEntityTypeWrapper.java | 14 +- .../block/entity/BlockEntityWrapper.java | 12 +- .../RewritableBlockEntityTypeWrapper.java | 2 +- .../SupplierBlockEntityTypeWrapper.java | 2 +- .../entity/SupplierBlockEntityWrapper.java | 2 +- .../midohra/client/render/CameraWrapper.java | 10 +- .../item/CustomNameComponentType.java | 22 +- .../component/item/ItemComponentType.java | 10 +- .../component/item/RarityComponentType.java | 10 +- .../midohra/easybuilder/BlockBuilder.java | 18 +- .../easybuilder/BlockEntityBuilder.java | 6 +- .../BlockWithBlockEntityBuilder.java | 2 +- .../midohra/easybuilder/built/BuiltBlock.java | 4 +- .../easybuilder/built/BuiltBlockEntity.java | 6 +- .../built/BuiltBlockWithEntity.java | 4 +- .../midohra/entity/EntityTypeWrapper.java | 10 +- .../midohra/entity/EntityTypes.java | 112 +- .../midohra/entity/EntityWrapper.java | 18 +- .../midohra/entity/ItemEntityWrapper.java | 14 +- .../midohra/entity/SpawnReason.java | 46 +- .../midohra/fluid/FluidWrapper.java | 12 +- .../mcpitanlib/midohra/fluid/Fluids.java | 10 +- .../holder/BlockStatePropertyHolder.java | 2 +- .../midohra/item/ItemGroupWrapper.java | 10 +- .../mcpitanlib/midohra/item/ItemGroups.java | 2 +- .../mcpitanlib/midohra/item/ItemStack.java | 42 +- .../mcpitanlib/midohra/item/ItemWrapper.java | 18 +- .../mcpitanlib/midohra/item/Items.java | 1954 +++++------ .../midohra/item/SupplierItemWrapper.java | 2 +- .../midohra/nbt/ElementConvertible.java | 2 +- .../mcpitanlib/midohra/nbt/NbtCompound.java | 10 +- .../mcpitanlib/midohra/nbt/NbtElement.java | 18 +- .../mcpitanlib/midohra/nbt/NbtList.java | 18 +- .../midohra/network/CompatPacketByteBuf.java | 22 +- .../midohra/recipe/CraftingRecipe.java | 38 +- .../mcpitanlib/midohra/recipe/Ingredient.java | 24 +- .../mcpitanlib/midohra/recipe/Recipe.java | 36 +- .../midohra/recipe/RecipeManager.java | 10 +- .../mcpitanlib/midohra/recipe/RecipeType.java | 44 +- .../midohra/recipe/ServerRecipeManager.java | 68 +- .../midohra/recipe/ShapedRecipe.java | 26 +- .../midohra/recipe/ShapelessRecipe.java | 26 +- .../recipe/entry/CraftingRecipeEntry.java | 28 +- .../midohra/recipe/entry/RecipeEntry.java | 32 +- .../recipe/entry/ShapedRecipeEntry.java | 28 +- .../recipe/entry/ShapelessRecipeEntry.java | 28 +- .../input/CraftingRecipeInputOrInventory.java | 36 +- .../recipe/input/RecipeInputOrInventory.java | 18 +- .../input/TypedRecipeInputOrInventory.java | 12 +- .../mcpitanlib/midohra/resource/Resource.java | 14 +- .../midohra/resource/ResourceManager.java | 26 +- .../midohra/server/PlayerManager.java | 60 +- .../midohra/util/hit/BlockHitResult.java | 30 +- .../midohra/util/hit/HitResult.java | 30 +- .../midohra/util/hit/HitResultType.java | 2 +- .../midohra/util/math/BlockPos.java | 28 +- .../mcpitanlib/midohra/util/math/Box.java | 16 +- .../midohra/util/math/ChunkPos.java | 58 +- .../midohra/util/math/Direction.java | 36 +- .../midohra/util/math/Vector3d.java | 12 +- .../midohra/util/math/Vector3i.java | 4 +- .../midohra/util/math/v0/BlockPos.java | 36 +- .../midohra/util/shape/VoxelShape.java | 26 +- .../mcpitanlib/midohra/world/BlockView.java | 18 +- .../mcpitanlib/midohra/world/IWorldView.java | 10 +- .../midohra/world/RedstoneView.java | 18 +- .../mcpitanlib/midohra/world/ServerWorld.java | 14 +- .../mcpitanlib/midohra/world/World.java | 42 +- .../mcpitanlib/midohra/world/WorldAccess.java | 36 +- .../mcpitanlib/midohra/world/WorldView.java | 24 +- .../midohra/world/chunk/ChunkManager.java | 18 +- .../midohra/world/chunk/ChunkTicketType.java | 34 +- .../world/chunk/ServerChunkManager.java | 18 +- .../midohra/world/tick/ScheduledTickView.java | 24 +- .../mixin/Block4CompatProviderMixin.java | 12 +- .../BlockBehaviour4CompatProviderMixin.java | 97 + .../mcpitanlib/mixin/BlockBehaviourMixin.java | 139 + .../mcpitanlib/mixin/BlockInvoker.java | 8 +- .../pitan76/mcpitanlib/mixin/BlockMixin.java | 39 +- .../mcpitanlib/mixin/CraftingRecipeMixin.java | 16 +- .../pitan76/mcpitanlib/mixin/ItemMixin.java | 101 +- .../ItemStackComponentizationFixMixin.java | 18 +- .../mcpitanlib/mixin/ItemStackMixin.java | 14 +- .../mcpitanlib/mixin/LevelRendererMixin.java | 90 + .../mixin/MinecraftServerTimer.java | 2 +- .../mcpitanlib/mixin/RecipeManagerMixin.java | 17 +- .../mcpitanlib/mixin/ServerLevelTimer.java | 38 + .../mcpitanlib/mixin/UseOnContextMixin.java | 12 + .../mcpitanlib/test/ExampleCommand.java | 2 +- .../mcpitanlib/test/ExampleContainerGui.java | 4 +- .../test/ExampleContainerGuiScreen.java | 6 +- .../mcpitanlib/test/ExampleGuiBlock.java | 8 +- .../mcpitanlib/test/ExampleGuiItem.java | 8 +- .../pitan76/mcpitanlib/test/ExampleMod.java | 10 +- .../mcpitanlib/test/ExampleModClient.java | 4 +- .../mcpitanlib/test/ExampleScreen.java | 6 +- .../mcpitanlib/test/ExampleScreenHandler.java | 2 +- 527 files changed, 10628 insertions(+), 10186 deletions(-) create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java diff --git a/build.gradle b/build.gradle index 7cf5edc2c..02bbdc3d6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' id 'maven-publish' + id 'com.github.johnrengelman.shadow' version '8.1.1' } def loadProperties(filename) { @@ -33,7 +34,8 @@ dependencies { implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" -// include 'org.yaml:snakeyaml:2.0' + implementation 'org.yaml:snakeyaml:2.0' + include 'org.yaml:snakeyaml:2.0' // api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { // exclude(group: "net.fabricmc.fabric-api") @@ -63,6 +65,19 @@ processResources { } } +shadowJar { + relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" + archiveClassifier.set("") +} + +tasks.build { + dependsOn shadowJar +} + +tasks.jar { + enabled = false +} + def targetJavaVersion = 25 tasks.withType(JavaCompile).configureEach { // ensure that the encoding is set to UTF-8, no matter what the system default is diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java b/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java index 62b2c94d6..c7f9eb875 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java @@ -1,11 +1,13 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.Block; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; +import net.minecraft.world.item.Item.Properties; +import net.minecraft.world.item.Item.TooltipContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; import java.util.function.Consumer; @@ -15,18 +17,18 @@ public class BlockItemByExtendBlock1215 extends BlockItem { private ExtendBlock block; private ExtendBlockProvider provider; - public BlockItemByExtendBlock1215(ExtendBlock block, Settings settings) { + public BlockItemByExtendBlock1215(ExtendBlock block, Properties settings) { super(block, settings); this.block = block; } - public BlockItemByExtendBlock1215(ExtendBlockProvider provider, Settings settings) { + public BlockItemByExtendBlock1215(ExtendBlockProvider provider, Properties settings) { super((Block) provider, settings); this.provider = provider; } @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + public void appendHoverText(ItemStack stack, TooltipContext context, TooltipDisplay displayComponent, Consumer textConsumer, TooltipFlag type) { if (block != null) block.appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java index 982396018..a81c34c8a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java @@ -1,25 +1,25 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.BlockRenderType; +import net.minecraft.world.level.block.RenderShape; public class CompatBlockRenderType { - public static final CompatBlockRenderType MODEL = of(BlockRenderType.MODEL); - public static final CompatBlockRenderType ENTITYBLOCK_ANIMATED = of(BlockRenderType.MODEL); - public static final CompatBlockRenderType INVISIBLE = of(BlockRenderType.INVISIBLE); + public static final CompatBlockRenderType MODEL = of(RenderShape.MODEL); + public static final CompatBlockRenderType ENTITYBLOCK_ANIMATED = of(RenderShape.MODEL); + public static final CompatBlockRenderType INVISIBLE = of(RenderShape.INVISIBLE); @Deprecated - public final BlockRenderType renderType; + public final RenderShape renderType; - public CompatBlockRenderType(BlockRenderType renderType) { + public CompatBlockRenderType(RenderShape renderType) { this.renderType = renderType; } - public static CompatBlockRenderType of(BlockRenderType renderType) { + public static CompatBlockRenderType of(RenderShape renderType) { return new CompatBlockRenderType(renderType); } - public BlockRenderType toMinecraft() { + public RenderShape toMinecraft() { return renderType; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java index e855ccf32..43e05da4b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; public class CompatBlocks { public static final Block AIR = Blocks.AIR; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java index 66fe3f21b..cb72d173f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java @@ -1,11 +1,12 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockBehaviour.Properties; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.core.BlockPos; import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; @@ -14,7 +15,7 @@ import java.util.function.Supplier; public class CompatChestBlock extends ChestBlock implements CompatBlockProvider { - public CompatChestBlock(Settings settings, Supplier> supplier) { + public CompatChestBlock(Properties settings, Supplier> supplier) { super(supplier, CompatSoundEvents.BLOCK_CHEST_OPEN.get(), CompatSoundEvents.BLOCK_CHEST_CLOSE.get(), settings); } @@ -29,7 +30,7 @@ public CompatChestBlock(CompatibleBlockSettings settings, Supplier AXIS = CompatProperties.of(PillarBlock.AXIS); + public static final EnumProperty AXIS = CompatProperties.of(RotatedPillarBlock.AXIS); public CompatibleBlockSettings settings; @@ -26,7 +27,7 @@ public CompatibleBlockSettings getCompatSettings() { return settings; } - public CompatPillarBlock(Settings settings) { + public CompatPillarBlock(Properties settings) { super(settings); } @@ -36,22 +37,22 @@ public CompatPillarBlock(CompatibleBlockSettings settings) { } public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); + super.createBlockStateDefinition(args.builder); } public BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); + return super.getStateForPlacement(args.ctx); } @Deprecated @Override - public void appendProperties(StateManager.Builder builder) { + public void createBlockStateDefinition(StateDefinition.Builder builder) { appendProperties(new AppendPropertiesArgs(builder)); } @Deprecated @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { + public BlockState getStateForPlacement(BlockPlaceContext ctx) { return getPlacementState(new PlacementStateArgs(ctx)); } @@ -70,11 +71,11 @@ public BlockState getPlacementState(PlacementStateArgs args, Options options) { @Deprecated @Override - public MapCodec getCodec() { + public MapCodec codec() { return getCompatCodec().getCodec(); } - public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); + public CompatMapCodec getCompatCodec() { + return CompatMapCodec.of(super.codec()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java index ac7284995..943cfd824 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java @@ -1,15 +1,16 @@ package net.pitan76.mcpitanlib.api.block; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SlabBlock; -import net.minecraft.block.enums.SlabType; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour.Properties; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.state.properties.SlabType; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; @@ -32,7 +33,7 @@ public CompatibleBlockSettings getCompatSettings() { return settings; } - public CompatSlabBlock(Settings settings) { + public CompatSlabBlock(Properties settings) { super(settings); } @@ -41,22 +42,22 @@ public CompatSlabBlock(CompatibleBlockSettings settings) { } public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); + super.createBlockStateDefinition(args.builder); } public BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); + return super.getStateForPlacement(args.ctx); } @Deprecated @Override - public void appendProperties(StateManager.Builder builder) { + public void createBlockStateDefinition(StateDefinition.Builder builder) { appendProperties(new AppendPropertiesArgs(builder)); } @Deprecated @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { + public BlockState getStateForPlacement(BlockPlaceContext ctx) { return getPlacementState(new PlacementStateArgs(ctx)); } @@ -75,22 +76,22 @@ public BlockState getPlacementState(PlacementStateArgs args, Options options) { @Deprecated @Override - public MapCodec getCodec() { + public MapCodec codec() { return getCompatCodec().getCodec(); } public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); + return CompatMapCodec.of(super.codec()); } @Deprecated @Override - public boolean canPathfindThrough(BlockState state, NavigationType type) { + public boolean isPathfindable(BlockState state, PathComputationType type) { return canPathfindThrough(new CanPathfindThroughArgs(state, type)); } public boolean canPathfindThrough(CanPathfindThroughArgs args) { - return super.canPathfindThrough(args.state, args.type); + return super.isPathfindable(args.state, args.type); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java index 6ad2e57ab..8f6f57e23 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java @@ -2,18 +2,23 @@ import com.mojang.serialization.MapCodec; import net.minecraft.block.*; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.block.enums.StairShape; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.state.BlockBehaviour.Properties; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Half; +import net.minecraft.world.level.block.state.properties.StairsShape; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.shapes.CollisionContext; import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.level.BlockGetter; import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; import net.pitan76.mcpitanlib.api.event.block.CanPathfindThroughArgs; import net.pitan76.mcpitanlib.api.event.block.OutlineShapeEvent; @@ -22,12 +27,12 @@ import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; import net.pitan76.mcpitanlib.core.serialization.CompatMapCodec; -public class CompatStairsBlock extends StairsBlock implements CompatBlockProvider { +public class CompatStairsBlock extends StairBlock implements CompatBlockProvider { public static final DirectionProperty FACING = CompatProperties.HORIZONTAL_FACING; - public static final EnumProperty HALF = StairsBlock.HALF; - public static final EnumProperty SHAPE = StairsBlock.SHAPE; - public static final BooleanProperty WATERLOGGED = StairsBlock.WATERLOGGED; + public static final EnumProperty HALF = StairBlock.HALF; + public static final EnumProperty SHAPE = StairBlock.SHAPE; + public static final BooleanProperty WATERLOGGED = StairBlock.WATERLOGGED; public CompatibleBlockSettings compatSettings; @@ -40,7 +45,7 @@ public CompatibleBlockSettings getCompatSettings() { return compatSettings; } - public CompatStairsBlock(BlockState baseBlockState, Settings settings) { + public CompatStairsBlock(BlockState baseBlockState, Properties settings) { super(baseBlockState, settings); } @@ -50,32 +55,32 @@ public CompatStairsBlock(BlockState baseBlockState, CompatibleBlockSettings sett } public VoxelShape getOutlineShape(OutlineShapeEvent event) { - return super.getOutlineShape(event.state, event.world, event.pos, event.context); + return super.getShape(event.state, event.world, event.pos, event.context); } public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); + super.createBlockStateDefinition(args.builder); } public BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); + return super.getStateForPlacement(args.ctx); } @Deprecated @Override - public void appendProperties(StateManager.Builder builder) { + public void createBlockStateDefinition(StateDefinition.Builder builder) { appendProperties(new AppendPropertiesArgs(builder)); } @Deprecated @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { + public BlockState getStateForPlacement(BlockPlaceContext ctx) { return getPlacementState(new PlacementStateArgs(ctx)); } @Deprecated @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); } @@ -100,22 +105,22 @@ public VoxelShape getOutlineShape(OutlineShapeEvent event, Options options) { @Deprecated @Override - public MapCodec getCodec() { + public MapCodec codec() { return getCompatCodec().getCodec(); } - public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); + public CompatMapCodec getCompatCodec() { + return CompatMapCodec.of(super.codec()); } @Deprecated @Override - public boolean canPathfindThrough(BlockState state, NavigationType type) { + public boolean isPathfindable(BlockState state, PathComputationType type) { return canPathfindThrough(new CanPathfindThroughArgs(state, type)); } public boolean canPathfindThrough(CanPathfindThroughArgs args) { - return super.canPathfindThrough(args.state, args.type); + return super.isPathfindable(args.state, args.type); } @Override @@ -124,6 +129,6 @@ public Boolean canPathfindThrough(CanPathfindThroughArgs args, Options options) } public BlockState getBaseBlockState() { - return super.baseBlockState; + return super.baseState; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java index 0402b719d..aae0037b2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.Waterloggable; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.sounds.SoundEvent; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; import java.util.Optional; -public interface CompatWaterloggable extends Waterloggable { +public interface CompatWaterloggable extends SimpleWaterloggedBlock { @Override - default Optional getBucketFillSound() { + default Optional getPickupSound() { return getCompactBucketFillSound() .map(CompatSoundEvent::get); } default Optional getCompactBucketFillSound() { - return Waterloggable.super.getBucketFillSound() + return SimpleWaterloggedBlock.super.getPickupSound() .map(CompatSoundEvent::of); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java index 7a07599bf..f905b92aa 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java @@ -2,12 +2,12 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.MapColor; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.util.DyeColor; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.item.DyeColor; import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; import java.util.function.Function; @@ -17,10 +17,10 @@ public class CompatibleBlockSettings { public static final Codec CODEC = MapCodec.unitCodec(CompatibleBlockSettings::of); - protected final AbstractBlock.Settings settings; + protected final BlockBehaviour.Properties settings; public CompatibleBlockSettings() { - this.settings = AbstractBlock.Settings.create(); + this.settings = BlockBehaviour.Properties.of(); } @Deprecated @@ -34,36 +34,36 @@ private static CompatibleBlockSettings copyCompatibleMaterial(CompatibleMaterial if (material.isLiquid()) settings.settings.liquid(); if (material.isSolid()) - settings.settings.solid(); + settings.settings.forceSolidOn(); if (material.isReplaceable()) settings.settings.replaceable(); if (material.isSolid()) - settings.settings.solid(); + settings.settings.forceSolidOn(); if (material.isBurnable()) - settings.settings.burnable(); - settings.settings.pistonBehavior(material.getPistonBehavior()); + settings.settings.ignitedByLava(); + settings.settings.pushReaction(material.getPistonBehavior()); return settings; } public CompatibleBlockSettings(CompatibleMaterial material, MapColor mapColor) { - this.settings = AbstractBlock.Settings.create(); + this.settings = BlockBehaviour.Properties.of(); copyCompatibleMaterial(material, this); mapColor(mapColor); } public CompatibleBlockSettings(CompatibleMaterial material, DyeColor dyeColor) { - this.settings = AbstractBlock.Settings.create(); + this.settings = BlockBehaviour.Properties.of(); copyCompatibleMaterial(material, this); mapColor(dyeColor); } public CompatibleBlockSettings(CompatibleMaterial material) { - this.settings = AbstractBlock.Settings.create(); + this.settings = BlockBehaviour.Properties.of(); copyCompatibleMaterial(material, this); } public CompatibleBlockSettings(CompatibleMaterial material, Function mapColor) { - this.settings = AbstractBlock.Settings.create(); + this.settings = BlockBehaviour.Properties.of(); copyCompatibleMaterial(material, this); mapColor(mapColor); } @@ -88,12 +88,12 @@ public static CompatibleBlockSettings of(CompatibleMaterial material, Function luminance) { - settings.luminance(luminance); + settings.lightLevel(luminance); return this; } public CompatibleBlockSettings jumpVelocityMultiplier(float jumpVelocityMultiplier) { - settings.jumpVelocityMultiplier(jumpVelocityMultiplier); + settings.jumpFactor(jumpVelocityMultiplier); return this; } public CompatibleBlockSettings slipperiness(float slipperiness) { - settings.slipperiness(slipperiness); + settings.friction(slipperiness); return this; } public CompatibleBlockSettings velocityMultiplier(float velocityMultiplier) { - settings.velocityMultiplier(velocityMultiplier); + settings.speedFactor(velocityMultiplier); return this; } - public CompatibleBlockSettings emissiveLighting(AbstractBlock.ContextPredicate predicate) { - settings.emissiveLighting(predicate); + public CompatibleBlockSettings emissiveLighting(BlockBehaviour.StatePredicate predicate) { + settings.emissiveRendering(predicate); return this; } - public CompatibleBlockSettings offset(AbstractBlock.OffsetType offsetType) { - settings.offset(offsetType); + public CompatibleBlockSettings offset(BlockBehaviour.OffsetType offsetType) { + settings.offsetType(offsetType); return this; } - public CompatibleBlockSettings allowsSpawning(AbstractBlock.TypedContextPredicate> predicate) { - settings.allowsSpawning(predicate); + public CompatibleBlockSettings allowsSpawning(BlockBehaviour.StateArgumentPredicate> predicate) { + settings.isValidSpawn(predicate); return this; } - public AbstractBlock.Settings build() { + public BlockBehaviour.Properties build() { return settings; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java index e39962a99..c59a8288d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.MapColor; -import net.minecraft.block.piston.PistonBehavior; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.material.PushReaction; public final class CompatibleMaterial { public static final CompatibleMaterial AIR; @@ -52,13 +52,13 @@ public final class CompatibleMaterial { public static final CompatibleMaterial AMETHYST; public static final CompatibleMaterial POWDER_SNOW; private final MapColor color; - private final PistonBehavior pistonBehavior; + private final PushReaction pistonBehavior; private final boolean burnable; private final boolean liquid; private final boolean replaceable; private final boolean solid; - public CompatibleMaterial(MapColor color, boolean liquid, boolean solid, boolean burnable, boolean replaceable, PistonBehavior pistonBehavior) { + public CompatibleMaterial(MapColor color, boolean liquid, boolean solid, boolean burnable, boolean replaceable, PushReaction pistonBehavior) { this.color = color; this.liquid = liquid; this.solid = solid; @@ -83,7 +83,7 @@ public boolean isReplaceable() { return this.replaceable; } - public PistonBehavior getPistonBehavior() { + public PushReaction getPistonBehavior() { return this.pistonBehavior; } @@ -92,57 +92,57 @@ public MapColor getColor() { } static { - AIR = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); - STRUCTURE_VOID = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); - PORTAL = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().blocksPistons().build(); - CARPET = (new Builder(MapColor.WHITE_GRAY)).allowsMovement().lightPassesThrough().notSolid().burnable().build(); - PLANT = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); - UNDERWATER_PLANT = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); - REPLACEABLE_PLANT = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().burnable().build(); - NETHER_SHOOTS = (new Builder(MapColor.DARK_GREEN)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - REPLACEABLE_UNDERWATER_PLANT = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - WATER = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); - BUBBLE_COLUMN = (new Builder(MapColor.WATER_BLUE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); - LAVA = (new Builder(MapColor.BRIGHT_RED)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); - SNOW_LAYER = (new Builder(MapColor.WHITE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - FIRE = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); - DECORATION = (new Builder(MapColor.CLEAR)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); - COBWEB = (new Builder(MapColor.WHITE_GRAY)).allowsMovement().lightPassesThrough().destroyedByPiston().build(); - SCULK = (new Builder(MapColor.BLACK)).build(); - REDSTONE_LAMP = (new Builder(MapColor.CLEAR)).build(); - ORGANIC_PRODUCT = (new Builder(MapColor.LIGHT_BLUE_GRAY)).build(); - SOIL = (new Builder(MapColor.DIRT_BROWN)).build(); - SOLID_ORGANIC = (new Builder(MapColor.PALE_GREEN)).build(); - DENSE_ICE = (new Builder(MapColor.PALE_PURPLE)).build(); - AGGREGATE = (new Builder(MapColor.PALE_YELLOW)).build(); - SPONGE = (new Builder(MapColor.YELLOW)).build(); - SHULKER_BOX = (new Builder(MapColor.PURPLE)).build(); - WOOD = (new Builder(MapColor.OAK_TAN)).burnable().build(); - NETHER_WOOD = (new Builder(MapColor.OAK_TAN)).build(); - BAMBOO_SAPLING = (new Builder(MapColor.OAK_TAN)).burnable().destroyedByPiston().allowsMovement().build(); - BAMBOO = (new Builder(MapColor.OAK_TAN)).burnable().destroyedByPiston().build(); - WOOL = (new Builder(MapColor.WHITE_GRAY)).burnable().build(); - TNT = (new Builder(MapColor.BRIGHT_RED)).burnable().lightPassesThrough().build(); - LEAVES = (new Builder(MapColor.DARK_GREEN)).burnable().lightPassesThrough().destroyedByPiston().build(); - GLASS = (new Builder(MapColor.CLEAR)).lightPassesThrough().build(); - ICE = (new Builder(MapColor.PALE_PURPLE)).lightPassesThrough().build(); - CACTUS = (new Builder(MapColor.DARK_GREEN)).lightPassesThrough().destroyedByPiston().build(); - STONE = (new Builder(MapColor.STONE_GRAY)).build(); - METAL = (new Builder(MapColor.IRON_GRAY)).build(); - SNOW_BLOCK = (new Builder(MapColor.WHITE)).build(); - REPAIR_STATION = (new Builder(MapColor.IRON_GRAY)).blocksPistons().build(); - BARRIER = (new Builder(MapColor.CLEAR)).blocksPistons().build(); - PISTON = (new Builder(MapColor.STONE_GRAY)).blocksPistons().build(); - MOSS_BLOCK = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); - GOURD = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); - EGG = (new Builder(MapColor.DARK_GREEN)).destroyedByPiston().build(); - CAKE = (new Builder(MapColor.CLEAR)).destroyedByPiston().build(); - AMETHYST = (new Builder(MapColor.PURPLE)).build(); - POWDER_SNOW = (new Builder(MapColor.WHITE)).notSolid().allowsMovement().build(); + AIR = (new Builder(MapColor.NONE)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); + STRUCTURE_VOID = (new Builder(MapColor.NONE)).allowsMovement().lightPassesThrough().notSolid().replaceable().build(); + PORTAL = (new Builder(MapColor.NONE)).allowsMovement().lightPassesThrough().notSolid().blocksPistons().build(); + CARPET = (new Builder(MapColor.WOOL)).allowsMovement().lightPassesThrough().notSolid().burnable().build(); + PLANT = (new Builder(MapColor.PLANT)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); + UNDERWATER_PLANT = (new Builder(MapColor.WATER)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); + REPLACEABLE_PLANT = (new Builder(MapColor.PLANT)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().burnable().build(); + NETHER_SHOOTS = (new Builder(MapColor.PLANT)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + REPLACEABLE_UNDERWATER_PLANT = (new Builder(MapColor.WATER)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + WATER = (new Builder(MapColor.WATER)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); + BUBBLE_COLUMN = (new Builder(MapColor.WATER)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); + LAVA = (new Builder(MapColor.FIRE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().liquid().build(); + SNOW_LAYER = (new Builder(MapColor.SNOW)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + FIRE = (new Builder(MapColor.NONE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().replaceable().build(); + DECORATION = (new Builder(MapColor.NONE)).allowsMovement().lightPassesThrough().notSolid().destroyedByPiston().build(); + COBWEB = (new Builder(MapColor.WOOL)).allowsMovement().lightPassesThrough().destroyedByPiston().build(); + SCULK = (new Builder(MapColor.COLOR_BLACK)).build(); + REDSTONE_LAMP = (new Builder(MapColor.NONE)).build(); + ORGANIC_PRODUCT = (new Builder(MapColor.CLAY)).build(); + SOIL = (new Builder(MapColor.DIRT)).build(); + SOLID_ORGANIC = (new Builder(MapColor.GRASS)).build(); + DENSE_ICE = (new Builder(MapColor.ICE)).build(); + AGGREGATE = (new Builder(MapColor.SAND)).build(); + SPONGE = (new Builder(MapColor.COLOR_YELLOW)).build(); + SHULKER_BOX = (new Builder(MapColor.COLOR_PURPLE)).build(); + WOOD = (new Builder(MapColor.WOOD)).burnable().build(); + NETHER_WOOD = (new Builder(MapColor.WOOD)).build(); + BAMBOO_SAPLING = (new Builder(MapColor.WOOD)).burnable().destroyedByPiston().allowsMovement().build(); + BAMBOO = (new Builder(MapColor.WOOD)).burnable().destroyedByPiston().build(); + WOOL = (new Builder(MapColor.WOOL)).burnable().build(); + TNT = (new Builder(MapColor.FIRE)).burnable().lightPassesThrough().build(); + LEAVES = (new Builder(MapColor.PLANT)).burnable().lightPassesThrough().destroyedByPiston().build(); + GLASS = (new Builder(MapColor.NONE)).lightPassesThrough().build(); + ICE = (new Builder(MapColor.ICE)).lightPassesThrough().build(); + CACTUS = (new Builder(MapColor.PLANT)).lightPassesThrough().destroyedByPiston().build(); + STONE = (new Builder(MapColor.STONE)).build(); + METAL = (new Builder(MapColor.METAL)).build(); + SNOW_BLOCK = (new Builder(MapColor.SNOW)).build(); + REPAIR_STATION = (new Builder(MapColor.METAL)).blocksPistons().build(); + BARRIER = (new Builder(MapColor.NONE)).blocksPistons().build(); + PISTON = (new Builder(MapColor.STONE)).blocksPistons().build(); + MOSS_BLOCK = (new Builder(MapColor.PLANT)).destroyedByPiston().build(); + GOURD = (new Builder(MapColor.PLANT)).destroyedByPiston().build(); + EGG = (new Builder(MapColor.PLANT)).destroyedByPiston().build(); + CAKE = (new Builder(MapColor.NONE)).destroyedByPiston().build(); + AMETHYST = (new Builder(MapColor.COLOR_PURPLE)).build(); + POWDER_SNOW = (new Builder(MapColor.SNOW)).notSolid().allowsMovement().build(); } public static class Builder { - private PistonBehavior pistonBehavior; + private PushReaction pistonBehavior; private boolean blocksMovement; private boolean burnable; private boolean liquid; @@ -152,7 +152,7 @@ public static class Builder { private boolean blocksLight; public Builder(MapColor color) { - this.pistonBehavior = PistonBehavior.NORMAL; + this.pistonBehavior = PushReaction.NORMAL; this.blocksMovement = true; this.solid = true; this.blocksLight = true; @@ -190,12 +190,12 @@ public Builder replaceable() { } protected Builder destroyedByPiston() { - this.pistonBehavior = PistonBehavior.DESTROY; + this.pistonBehavior = PushReaction.DESTROY; return this; } protected Builder blocksPistons() { - this.pistonBehavior = PistonBehavior.BLOCK; + this.pistonBehavior = PushReaction.BLOCK; return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java index 89e9d54aa..c26f49145 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java @@ -1,35 +1,36 @@ package net.pitan76.mcpitanlib.api.block; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.SimpleNamedScreenHandlerFactory; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.block.WireOrientation; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour.Properties; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.InsideBlockEffectApplier; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.redstone.Orientation; +import net.minecraft.world.level.ScheduledTickAccess; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.block.*; import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; @@ -46,7 +47,7 @@ public class ExtendBlock extends Block { public CompatibleBlockSettings compatSettings; - public ExtendBlock(Settings settings) { + public ExtendBlock(Properties settings) { super(settings); } @@ -74,7 +75,7 @@ public VoxelShape getCollisionShape(CollisionShapeEvent event) { @Deprecated @Override - public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); } @@ -84,12 +85,12 @@ public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos * @return VoxelShape */ public VoxelShape getOutlineShape(OutlineShapeEvent event) { - return super.getOutlineShape(event.state, event.world, event.pos, event.context); + return super.getShape(event.state, event.world, event.pos, event.context); } @Deprecated @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); } @@ -98,19 +99,19 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po * @param event BlockScheduledTickEvent */ public void scheduledTick(BlockScheduledTickEvent event) { - super.scheduledTick(event.state, event.world, event.pos, event.random.getMcRandom()); + super.tick(event.state, event.world, event.pos, event.random.getMcRandom()); } @Override @Deprecated - public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { scheduledTick(new BlockScheduledTickEvent(state, world, pos, random)); } @Override @Deprecated - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - return onRightClick(new BlockUseEvent(state, world, pos, player, player.getActiveHand(), hit)).toActionResult(); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + return onRightClick(new BlockUseEvent(state, world, pos, player, player.getUsedItemHand(), hit)).toActionResult(); } /** @@ -119,14 +120,14 @@ protected ActionResult onUse(BlockState state, World world, BlockPos pos, Player * @return BlockUseEvent */ public CompatActionResult onRightClick(BlockUseEvent event) { - return CompatActionResult.create(super.onUse(event.state, event.world, event.pos, event.player.getPlayerEntity(), event.hit)); + return CompatActionResult.create(super.useWithoutItem(event.state, event.world, event.pos, event.player.getPlayerEntity(), event.hit)); } @Deprecated @Nullable @Override - public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) { - return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> + public MenuProvider getMenuProvider(BlockState state, Level world, BlockPos pos) { + return new SimpleMenuProvider((syncId, inventory, player) -> createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player)), getScreenTitle() ); } @@ -137,7 +138,7 @@ public NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, Wo * @return ScreenHandler */ @Nullable - public ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event) { + public AbstractContainerMenu createScreenHandler(ScreenHandlerCreateEvent event) { return null; } @@ -146,13 +147,13 @@ public ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event) { * @return Text */ @Nullable - public Text getScreenTitle() { + public Component getScreenTitle() { return TextUtil.literal(""); } @Override @Deprecated - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { onPlaced(new BlockPlacedEvent(world, pos, state, placer, itemStack)); } @@ -161,12 +162,12 @@ public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable Livi * @param event BlockPlacedEvent */ public void onPlaced(BlockPlacedEvent event) { - super.onPlaced(event.world, event.pos, event.state, event.placer, event.stack); + super.setPlacedBy(event.world, event.pos, event.state, event.placer, event.stack); } @Override @Deprecated - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { return onBreak(new BlockBreakEvent(world, pos, state, player)).state; } @@ -176,13 +177,13 @@ public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEnt * @return BlockBreakResult */ public BlockBreakResult onBreak(BlockBreakEvent event) { - BlockState state = super.onBreak(event.world, event.pos, event.state, event.getPlayerEntity()); + BlockState state = super.playerWillDestroy(event.world, event.pos, event.state, event.getPlayerEntity()); return new BlockBreakResult(state); } @Override @Deprecated - public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { + public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state, boolean includeData) { PickStackEvent event = new PickStackEvent(world, pos, state); event.setIncludeData(includeData); return getPickStack(event); @@ -194,12 +195,12 @@ public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, b * @return ItemStack */ public ItemStack getPickStack(PickStackEvent event) { - return super.getPickStack(event.worldView, event.pos, event.state, event.includeData); + return super.getCloneItemStack(event.worldView, event.pos, event.state, event.includeData); } @Override @Deprecated - public void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved) { + public void affectNeighborsAfterRemoval(BlockState state, ServerLevel world, BlockPos pos, boolean moved) { onStateReplaced(new StateReplacedEvent(state, world, pos, world.getBlockState(pos), moved)); } @@ -208,12 +209,12 @@ public void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, b * @param event StateReplacedEvent */ public void onStateReplaced(StateReplacedEvent event) { - super.onStateReplaced(event.state, (ServerWorld) event.world, event.pos, event.moved); + super.affectNeighborsAfterRemoval(event.state, (ServerLevel) event.world, event.pos, event.moved); } @Deprecated @Override - public List getDroppedStacks(BlockState state, LootWorldContext.Builder builder) { + public List getDrops(BlockState state, LootParams.Builder builder) { return getDroppedStacks(new DroppedStacksArgs(state, builder)); } @@ -223,12 +224,12 @@ public List getDroppedStacks(BlockState state, LootWorldContext.Build * @return List */ public List getDroppedStacks(DroppedStacksArgs args) { - return super.getDroppedStacks(args.state, args.builder); + return super.getDrops(args.state, args.builder); } @Deprecated @Override - public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, WireOrientation wireOrientation, boolean notify) { + public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, Orientation wireOrientation, boolean notify) { neighborUpdate(new NeighborUpdateEvent(state, world, pos, sourceBlock, wireOrientation, notify)); } @@ -237,12 +238,12 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block so * @param event NeighborUpdateEvent */ public void neighborUpdate(NeighborUpdateEvent event) { - super.neighborUpdate(event.state, event.world, event.pos, event.sourceBlock, event.wireOrientation, event.notify); + super.neighborChanged(event.state, event.world, event.pos, event.sourceBlock, event.wireOrientation, event.notify); } @Deprecated @Override - public void appendProperties(StateManager.Builder builder) { + public void createBlockStateDefinition(net.minecraft.world.level.block.state.StateDefinition.Builder builder) { appendProperties(new AppendPropertiesArgs(builder)); } @@ -251,7 +252,7 @@ public void appendProperties(StateManager.Builder builder) { * @param args AppendPropertiesArgs */ public void appendProperties(AppendPropertiesArgs args) { - super.appendProperties(args.builder); + super.createBlockStateDefinition(args.builder); } /** @@ -259,7 +260,7 @@ public void appendProperties(AppendPropertiesArgs args) { * @return default block state */ public BlockState getNewDefaultState() { - return super.getDefaultState(); + return super.defaultBlockState(); } /** @@ -267,12 +268,12 @@ public BlockState getNewDefaultState() { * @param state BlockState */ public void setNewDefaultState(BlockState state) { - super.setDefaultState(state); + super.registerDefaultState(state); } @Deprecated @Override - public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + public @Nullable BlockState getStateForPlacement(BlockPlaceContext ctx) { return this.getPlacementState(new PlacementStateArgs(ctx, this)); } @@ -282,7 +283,7 @@ public void setNewDefaultState(BlockState state) { * @return BlockState */ public @Nullable BlockState getPlacementState(PlacementStateArgs args) { - return super.getPlacementState(args.ctx); + return super.getStateForPlacement(args.ctx); } /** @@ -295,42 +296,42 @@ public void appendTooltip(ItemAppendTooltipEvent event) { @Deprecated @Override - public boolean canPathfindThrough(BlockState state, NavigationType type) { + public boolean isPathfindable(BlockState state, PathComputationType type) { return canPathfindThrough(new CanPathfindThroughArgs(state, type)); } public boolean canPathfindThrough(CanPathfindThroughArgs args) { - return super.canPathfindThrough(args.state, args.type); + return super.isPathfindable(args.state, args.type); } @Deprecated @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler, boolean bl) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity, InsideBlockEffectApplier handler, boolean bl) { onEntityCollision(new EntityCollisionEvent(state, world, pos, entity, handler, bl)); } public void onEntityCollision(EntityCollisionEvent e) { - super.onEntityCollision(e.state, e.world, e.pos, e.entity, e.handler, e.bl); + super.entityInside(e.state, e.world, e.pos, e.entity, e.handler, e.bl); } @Deprecated @Override - public void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) { + public void attack(BlockState state, Level world, BlockPos pos, Player player) { onBlockBreakStart(new BlockBreakStartEvent(state, world, pos, new Player(player))); } public void onBlockBreakStart(BlockBreakStartEvent e) { - super.onBlockBreakStart(e.state, e.world, e.pos, e.player.getPlayerEntity()); + super.attack(e.state, e.world, e.pos, e.player.getPlayerEntity()); } @Deprecated @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return getCompatCodec().getCodec(); } public CompatMapCodec getCompatCodec() { - return CompatMapCodec.of(super.getCodec()); + return CompatMapCodec.of(super.codec()); } @Deprecated @@ -345,12 +346,12 @@ public FluidState getFluidState(FluidStateArgs args) { @Deprecated @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { + protected BlockState updateShape(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random) { return getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random))); } public BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { - return super.getStateForNeighborUpdate(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom()); + return super.updateShape(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom()); } // @Deprecated @@ -363,7 +364,7 @@ public BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { // return super.(args.stateToShape); // } - public StateManager callGetStateManager() { - return super.getStateManager(); + public StateDefinition callGetStateManager() { + return super.getStateDefinition(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java index 2b9481a95..1e9ebd80f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.BlockEntityProvider; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import net.pitan76.mcpitanlib.api.tile.ExtendBlockEntityTicker; import org.jetbrains.annotations.Nullable; -public interface ExtendBlockEntityProvider extends BlockEntityProvider { +public interface ExtendBlockEntityProvider extends EntityBlock { /** * @deprecated Use {@link #createBlockEntity(TileCreateEvent)} instead. */ @Deprecated @Nullable - default BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + default BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return createBlockEntity(new TileCreateEvent(pos, state)); } @@ -37,7 +37,7 @@ default BlockEntity createBlockEntity(TileCreateEvent event) { if (getBlockEntityType() == null) return null; // return new ...BlockEntity(pos, state) - return getBlockEntityType().instantiate(event.getBlockPos(), event.getBlockState()); + return getBlockEntityType().create(event.getBlockPos(), event.getBlockState()); } @Nullable @@ -47,10 +47,10 @@ default BlockEntityType getBlockEntityType() { @Nullable @Override - default BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + default BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { if (isTick()) { return ((world1, pos, state1, blockEntity) -> { - if (getBlockEntityType() == null || blockEntity == getBlockEntityType().get(world, pos)) { + if (getBlockEntityType() == null || blockEntity == getBlockEntityType().getBlockEntity(world, pos)) { if (blockEntity instanceof ExtendBlockEntityTicker) { ExtendBlockEntityTicker ticker = (ExtendBlockEntityTicker) blockEntity; ticker.tick(world, pos, state, blockEntity); @@ -61,11 +61,11 @@ default BlockEntityTicker getTicker(World world, Bloc } }); } - return BlockEntityProvider.super.getTicker(world, state, type); + return EntityBlock.super.getTicker(world, state, type); } @Nullable - default ExtendBlockEntityTicker getCompatibleTicker(World world, BlockState state, BlockEntityType type) { + default ExtendBlockEntityTicker getCompatibleTicker(Level world, BlockState state, BlockEntityType type) { BlockEntityTicker ticker = getTicker(world, state, type); if (ticker instanceof ExtendBlockEntityTicker) return (ExtendBlockEntityTicker) ticker; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java index 996661e2f..23b91bb5c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.block; -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; +import net.minecraft.world.phys.shapes.VoxelShape; import net.pitan76.mcpitanlib.api.event.block.*; import net.pitan76.mcpitanlib.api.event.block.result.BlockBreakResult; import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; @@ -63,7 +63,7 @@ default CompatActionResult onRightClick(BlockUseEvent event, Options options) { * @param options Options * @return ScreenHandler */ - default ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event, Options options) { + default AbstractContainerMenu createScreenHandler(ScreenHandlerCreateEvent event, Options options) { options.cancel = false; return null; } @@ -72,7 +72,7 @@ default ScreenHandler createScreenHandler(ScreenHandlerCreateEvent event, Option * get screen title * @return Text */ - default Text getScreenTitle() { + default Component getScreenTitle() { return TextUtil.literal(""); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java index 645b17745..03d51bbfd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.block.args; -import net.minecraft.block.BlockState; +import net.minecraft.world.level.block.state.BlockState; import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; public class RenderTypeArgs implements BlockStatePropertyHolder { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java index 0b4e6339e..73b42a692 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.block.args; -import net.minecraft.block.BlockState; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.Direction; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.Direction; import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; public class RotateArgs implements BlockStatePropertyHolder { public BlockState state; - public BlockRotation rotation; + public Rotation rotation; - public RotateArgs(BlockState state, BlockRotation rotation) { + public RotateArgs(BlockState state, Rotation rotation) { this.state = state; this.rotation = rotation; } @@ -19,7 +19,7 @@ public BlockState getRawBlockState() { return state; } - public BlockRotation getRawRotation() { + public Rotation getRawRotation() { return rotation; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java index 503136183..cf7f5496a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.block.args; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.Direction; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.Direction; public class SideInvisibleArgs { public BlockState state; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java index c111c0aa3..87d133df0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java @@ -6,11 +6,11 @@ import net.pitan76.mcpitanlib.midohra.world.WorldView; public class CanPlaceAtArgs extends BaseEvent { - public final net.minecraft.block.BlockState state; - public final net.minecraft.world.WorldView world; - public final net.minecraft.util.math.BlockPos pos; + public final net.minecraft.world.level.block.state.BlockState state; + public final net.minecraft.world.level.LevelReader world; + public final net.minecraft.core.BlockPos pos; - public CanPlaceAtArgs(net.minecraft.block.BlockState state, net.minecraft.world.WorldView world, net.minecraft.util.math.BlockPos pos) { + public CanPlaceAtArgs(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos) { this.state = state; this.world = world; this.pos = pos; @@ -20,15 +20,15 @@ public CanPlaceAtArgs(BlockState state, WorldView world, BlockPos pos) { this(state.toMinecraft(), world.toMinecraft(), pos.toMinecraft()); } - public net.minecraft.block.BlockState getState() { + public net.minecraft.world.level.block.state.BlockState getState() { return state; } - public net.minecraft.world.WorldView getWorld() { + public net.minecraft.world.level.LevelReader getWorld() { return world; } - public net.minecraft.util.math.BlockPos getPos() { + public net.minecraft.core.BlockPos getPos() { return pos; } @@ -45,10 +45,10 @@ public BlockPos getMidohraPos() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public boolean isServer() { - return !world.isClient(); + return !world.isClientSide(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java index a5544b4db..1fe0b12b2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.block.args.v2; -import net.minecraft.block.ShapeContext; +import net.minecraft.world.phys.shapes.CollisionContext; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.world.BlockView; public class CollisionShapeEvent extends OutlineShapeEvent { - public CollisionShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public CollisionShapeEvent(BlockState state, BlockView world, BlockPos pos, CollisionContext context) { super(state, world, pos, context); } - public CollisionShapeEvent(net.minecraft.block.BlockState state, net.minecraft.world.BlockView world, net.minecraft.util.math.BlockPos pos, ShapeContext context) { + public CollisionShapeEvent(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, CollisionContext context) { super(BlockState.of(state), BlockView.of(world), BlockPos.of(pos), context); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java index 07aad3fef..4503ffd9c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java @@ -1,25 +1,25 @@ package net.pitan76.mcpitanlib.api.block.args.v2; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.api.util.screen.ScreenHandlerUtil; public class GetComparatorOutputArgs extends BaseEvent { public BlockState state; - public World world; + public Level world; public BlockPos pos; public Direction direction; - public GetComparatorOutputArgs(BlockState state, World world, BlockPos pos) { + public GetComparatorOutputArgs(BlockState state, Level world, BlockPos pos) { this(state, world, pos, Direction.NORTH); } - public GetComparatorOutputArgs(BlockState state, World world, BlockPos pos, Direction direction) { + public GetComparatorOutputArgs(BlockState state, Level world, BlockPos pos, Direction direction) { this.state = state; this.world = world; this.pos = pos; @@ -30,7 +30,7 @@ public BlockState getState() { return state; } - public World getWorld() { + public Level getWorld() { return world; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java index 2fe77f18a..38d2db82e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.block.args.v2; -import net.minecraft.block.BlockState; +import net.minecraft.world.level.block.state.BlockState; import net.pitan76.mcpitanlib.api.event.BaseEvent; public class HasComparatorOutputArgs extends BaseEvent { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java index 225949458..5aaade166 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.block.args.v2; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.Item; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; @@ -16,16 +16,16 @@ public class OutlineShapeEvent extends BaseEvent implements BlockStatePropertyHo public BlockState state; public BlockView world; public BlockPos pos; - public ShapeContext context; + public CollisionContext context; - public OutlineShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public OutlineShapeEvent(BlockState state, BlockView world, BlockPos pos, CollisionContext context) { this.state = state; this.world = world; this.pos = pos; this.context = context; } - public OutlineShapeEvent(net.minecraft.block.BlockState state, net.minecraft.world.BlockView world, net.minecraft.util.math.BlockPos pos, net.minecraft.block.ShapeContext context) { + public OutlineShapeEvent(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context) { this(BlockState.of(state), BlockView.of(world), BlockPos.of(pos), context); } @@ -50,12 +50,12 @@ public BlockPos getPos() { return pos; } - public ShapeContext getContext() { + public CollisionContext getContext() { return context; } public boolean isHolding(Item item) { - return getContext().isHolding(item); + return getContext().isHoldingItem(item); } public boolean isHolding(ItemWrapper item) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java index ebc3d207b..3f0a8ea03 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.block.args.v2; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.property.Property; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.Vec3; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; @@ -20,20 +20,20 @@ import net.pitan76.mcpitanlib.midohra.util.math.Direction; import net.pitan76.mcpitanlib.midohra.world.IWorldView; import net.pitan76.mcpitanlib.midohra.world.World; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; +import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; import org.jetbrains.annotations.Nullable; public class PlacementStateArgs extends BaseEvent implements BlockStatePropertyHolder { - public ItemPlacementContext ctx; + public BlockPlaceContext ctx; @Nullable public Block block; - public PlacementStateArgs(ItemPlacementContext ctx) { + public PlacementStateArgs(BlockPlaceContext ctx) { this.ctx = ctx; } - public PlacementStateArgs(ItemPlacementContext ctx, @Nullable Block block) { + public PlacementStateArgs(BlockPlaceContext ctx, @Nullable Block block) { this.ctx = ctx; this.block = block; } @@ -43,7 +43,7 @@ public boolean canPlace() { } public BlockPos getRawPos() { - return ctx.getBlockPos(); + return ctx.getClickedPos(); } public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getPos() { @@ -55,7 +55,7 @@ public Player getPlayer() { } public Direction[] getPlacementDirections() { - net.minecraft.util.math.Direction[] rawDirs = getRawPlacementDirections(); + net.minecraft.core.Direction[] rawDirs = getRawPlacementDirections(); Direction[] directions = new Direction[rawDirs.length]; for (int i = 0; i < directions.length; i++) { directions[i] = Direction.of(rawDirs[i]); @@ -64,11 +64,11 @@ public Direction[] getPlacementDirections() { return directions; } - public net.minecraft.util.math.Direction[] getRawPlacementDirections() { - return ctx.getPlacementDirections(); + public net.minecraft.core.Direction[] getRawPlacementDirections() { + return ctx.getNearestLookingDirections(); } - public Hand getHand() { + public InteractionHand getHand() { return ctx.getHand(); } @@ -76,24 +76,24 @@ public Direction getSide() { return Direction.of(getRawSide()); } - public net.minecraft.util.math.Direction getRawSide() { - return ctx.getSide(); + public net.minecraft.core.Direction getRawSide() { + return ctx.getClickedFace(); } public Direction getHorizontalPlayerFacing() { return Direction.of(getRawHorizontalPlayerFacing()); } - public net.minecraft.util.math.Direction getRawHorizontalPlayerFacing() { - return ctx.getHorizontalPlayerFacing(); + public net.minecraft.core.Direction getRawHorizontalPlayerFacing() { + return ctx.getHorizontalDirection(); } public float getPlayerYaw() { - return ctx.getPlayerYaw(); + return ctx.getRotation(); } public World getWorld() { - return World.of(ctx.getWorld()); + return World.of(ctx.getLevel()); } public IWorldView getWorldView() { @@ -104,28 +104,28 @@ public boolean isClient() { return getWorld().isClient(); } - public Vec3d getHitPos() { - return ctx.getHitPos(); + public Vec3 getHitPos() { + return ctx.getClickLocation(); } public boolean canReplaceExisting() { - return ctx.canReplaceExisting(); + return ctx.replacingClickedOnBlock(); } @Deprecated - public ItemUsageContextMixin getIUCAccessor() { - return (ItemUsageContextMixin) ctx; + public UseOnContextMixin getIUCAccessor() { + return (UseOnContextMixin) ctx; } public BlockHitResult getHitResult() { - return getIUCAccessor().getHit(); + return getIUCAccessor().getHitResult(); } public ItemUseOnBlockEvent toItemUseOnBlockEvent() { - return new ItemUseOnBlockEvent(getWorld().getRaw(), getPlayer().getPlayerEntity(), getHand(), ctx.getStack(), getHitResult()); + return new ItemUseOnBlockEvent(getWorld().getRaw(), getPlayer().getPlayerEntity(), getHand(), ctx.getItemInHand(), getHitResult()); } - public ItemPlacementContext getCtx() { + public BlockPlaceContext getCtx() { return ctx; } @@ -137,7 +137,7 @@ public boolean isBlockExist() { return block != null; } - public net.minecraft.block.BlockState getRawBlockState() { + public net.minecraft.world.level.block.state.BlockState getRawBlockState() { return BlockStateUtil.getDefaultState(block); } @@ -149,7 +149,7 @@ public BlockWrapper getBlock() { return BlockWrapper.of(block); } - public , V extends T> net.minecraft.block.BlockState with(Property property, V value) { + public , V extends T> net.minecraft.world.level.block.state.BlockState with(Property property, V value) { if (block == null) return null; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java index 1c4972fe8..38dfc1a21 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.block.args.v2; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; @@ -16,13 +16,13 @@ public class StateForNeighborUpdateArgs implements BlockStatePropertyHolder { public BlockState state; public Direction direction; public BlockState neighborState; - public WorldView world; + public LevelReader world; public BlockPos pos; public BlockPos neighborPos; - public ScheduledTickView tickView; + public ScheduledTickAccess tickView; public CompatRandom random; - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { this.state = state; this.direction = direction; this.neighborState = neighborState; @@ -31,7 +31,7 @@ public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockSt this.neighborPos = neighborPos; } - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldView world, BlockPos pos, BlockPos neighborPos, ScheduledTickView tickView, CompatRandom random) { + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, LevelReader world, BlockPos pos, BlockPos neighborPos, ScheduledTickAccess tickView, CompatRandom random) { this.state = state; this.direction = direction; this.neighborState = neighborState; @@ -50,7 +50,7 @@ public BlockState getRawNeighborState() { return neighborState; } - public WorldView getRawWorld() { + public LevelReader getRawWorld() { return world; } @@ -104,6 +104,6 @@ public BlockEntity getRawBlockEntity() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java index 95b2afca6..722514432 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.block.v2; -import net.minecraft.block.AbstractBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -89,7 +89,7 @@ public CompatibleBlockSettings build() { return build(id); } - public AbstractBlock.Settings _build() { + public BlockBehaviour.Properties _build() { return build().build(); } @@ -123,7 +123,7 @@ public CompatibleBlockSettings build(CompatIdentifier id) { return settings; } - public AbstractBlock.Settings _build(CompatIdentifier id) { + public BlockBehaviour.Properties _build(CompatIdentifier id) { return build(id).build(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java index 3b4b160a1..8c67c9888 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.api.block.v2; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; import net.pitan76.mcpitanlib.api.block.ExtendBlock; import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; @@ -42,17 +42,17 @@ public BlockWrapper getWrapper() { @Override @Deprecated - protected BlockRenderType getRenderType(BlockState state) { + protected RenderShape getRenderShape(BlockState state) { return getRenderType(new RenderTypeArgs(state)).renderType; } public CompatBlockRenderType getRenderType(RenderTypeArgs args) { - return new CompatBlockRenderType(super.getRenderType(args.state)); + return new CompatBlockRenderType(super.getRenderShape(args.state)); } @Override @Deprecated - protected BlockState rotate(BlockState state, BlockRotation rotation) { + protected BlockState rotate(BlockState state, Rotation rotation) { return rotate(new RotateArgs(state, rotation)).toMinecraft(); } @@ -62,12 +62,12 @@ public net.pitan76.mcpitanlib.midohra.block.BlockState rotate(RotateArgs args) { @Override @Deprecated - protected boolean isSideInvisible(BlockState state, BlockState stateFrom, Direction direction) { + protected boolean skipRendering(BlockState state, BlockState stateFrom, Direction direction) { return isSideInvisible(new SideInvisibleArgs(state, stateFrom, direction)); } public boolean isSideInvisible(SideInvisibleArgs args) { - return super.isSideInvisible(args.state, args.stateFrom, args.direction); + return super.skipRendering(args.state, args.stateFrom, args.direction); } /** @@ -87,11 +87,11 @@ public void setDefaultState(net.pitan76.mcpitanlib.midohra.block.BlockState stat } public @Nullable net.pitan76.mcpitanlib.midohra.block.BlockState getPlacementState(PlacementStateArgs args) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.getPlacementState(args.ctx)); + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.getStateForPlacement(args.ctx)); } @Override - public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { + public @Nullable BlockState getStateForPlacement(BlockPlaceContext ctx) { return getPlacementState(new PlacementStateArgs(ctx)).toMinecraft(); } @@ -102,11 +102,11 @@ public void setDefaultState(net.pitan76.mcpitanlib.midohra.block.BlockState stat } public net.pitan76.mcpitanlib.midohra.block.BlockState getStateForNeighborUpdate(StateForNeighborUpdateArgs args) { - return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.getStateForNeighborUpdate(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom())); + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(super.updateShape(args.state, args.world, args.tickView, args.pos, args.direction, args.neighborPos, args.neighborState, args.random.getMcRandom())); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { + protected BlockState updateShape(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random) { return getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random))).toMinecraft(); } @@ -117,11 +117,11 @@ public BlockState getStateForNeighborUpdate(net.pitan76.mcpitanlib.api.event.blo } public VoxelShape getOutlineShape(OutlineShapeEvent e) { - return super.getOutlineShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); + return super.getShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); } @@ -137,7 +137,7 @@ public VoxelShape getCollisionShape(CollisionShapeEvent e) { @Deprecated @Override - public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); } @@ -149,31 +149,31 @@ public VoxelShape getCollisionShape(net.pitan76.mcpitanlib.api.event.block.Colli @Deprecated @Override - public boolean hasComparatorOutput(BlockState state) { + public boolean hasAnalogOutputSignal(BlockState state) { return hasComparatorOutput(new HasComparatorOutputArgs(state)); } public boolean hasComparatorOutput(HasComparatorOutputArgs args) { - return super.hasComparatorOutput(args.state); + return super.hasAnalogOutputSignal(args.state); } @Deprecated @Override - public int getComparatorOutput(BlockState state, World world, BlockPos pos, Direction direction) { + public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos, Direction direction) { return getComparatorOutput(new GetComparatorOutputArgs(state, world, pos, direction)); } public int getComparatorOutput(GetComparatorOutputArgs args) { - return super.getComparatorOutput(args.state, args.world, args.pos, args.direction); + return super.getAnalogOutputSignal(args.state, args.world, args.pos, args.direction); } @Deprecated @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { return canPlaceAt(new CanPlaceAtArgs(state, world, pos)); } public boolean canPlaceAt(CanPlaceAtArgs args) { - return super.canPlaceAt(args.state, args.world, args.pos); + return super.canSurvive(args.state, args.world, args.pos); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java index 368be8ddc..4c677aa45 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.block.v2; -import net.minecraft.block.Block; -import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.phys.shapes.VoxelShape; import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; @@ -39,7 +39,7 @@ default Boolean isSideInvisible(SideInvisibleArgs args, Options options) { default BlockState getDefaultMidohraState() { if (this instanceof Block) { - return BlockState.of(((Block) this).getDefaultState()); + return BlockState.of(((Block) this).defaultBlockState()); } return null; @@ -53,7 +53,7 @@ default void setDefaultState(BlockState state) { @Override @Deprecated - default net.minecraft.block.BlockState getPlacementState(net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs args, Options options) { + default net.minecraft.world.level.block.state.BlockState getPlacementState(net.pitan76.mcpitanlib.api.event.block.PlacementStateArgs args, Options options) { return ExtendBlockProvider.super.getPlacementState(args, options); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java index f92115a8a..fc823a7ce 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.block.v2; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.StairsBlock; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.block.enums.StairShape; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.state.properties.Half; +import net.minecraft.world.level.block.state.properties.StairsShape; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.level.BlockGetter; import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; import net.pitan76.mcpitanlib.api.state.property.BooleanProperty; @@ -17,12 +17,12 @@ public class CompatStairsBlock extends net.pitan76.mcpitanlib.api.block.CompatStairsBlock { - public static final DirectionProperty FACING = CompatProperties.ofDir(StairsBlock.FACING); - public static final EnumProperty HALF = CompatProperties.of(StairsBlock.HALF); - public static final EnumProperty SHAPE = CompatProperties.of(StairsBlock.SHAPE); - public static final BooleanProperty WATERLOGGED = CompatProperties.of(StairsBlock.WATERLOGGED); + public static final DirectionProperty FACING = CompatProperties.ofDir(StairBlock.FACING); + public static final EnumProperty HALF = CompatProperties.of(StairBlock.HALF); + public static final EnumProperty SHAPE = CompatProperties.of(StairBlock.SHAPE); + public static final BooleanProperty WATERLOGGED = CompatProperties.of(StairBlock.WATERLOGGED); - public CompatStairsBlock(net.minecraft.block.BlockState baseBlockState, CompatibleBlockSettings settings) { + public CompatStairsBlock(net.minecraft.world.level.block.state.BlockState baseBlockState, CompatibleBlockSettings settings) { super(baseBlockState, settings); } @@ -31,7 +31,7 @@ public CompatStairsBlock(BlockState baseBlockState, CompatibleBlockSettings sett } public VoxelShape getOutlineShape(OutlineShapeEvent e) { - return super.getOutlineShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); + return super.getShape(e.state.toMinecraft(), e.world.getRaw(), e.pos.toMinecraft(), e.context); } public VoxelShape getCollisionShape(CollisionShapeEvent e) { @@ -46,7 +46,7 @@ public VoxelShape getOutlineShape(net.pitan76.mcpitanlib.api.event.block.Outline @Deprecated @Override - public VoxelShape getOutlineShape(net.minecraft.block.BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(net.minecraft.world.level.block.state.BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return getOutlineShape(new OutlineShapeEvent(state, world, pos, context)); } @@ -57,7 +57,7 @@ public VoxelShape getOutlineShape(OutlineShapeEvent e, Options options) { } @Override - public VoxelShape getCollisionShape(net.minecraft.block.BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getCollisionShape(net.minecraft.world.level.block.state.BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return getCollisionShape(new CollisionShapeEvent(state, world, pos, context)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java index 95d43c70f..d1e7a76f7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java @@ -2,14 +2,14 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.MapCodec; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.MapColor; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.util.DyeColor; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.item.DyeColor; import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -51,14 +51,14 @@ private static CompatibleBlockSettings copy(CompatibleMaterial material, Compati if (material.isLiquid()) settings.settings.liquid(); if (material.isSolid()) - settings.settings.solid(); + settings.settings.forceSolidOn(); if (material.isReplaceable()) settings.settings.replaceable(); if (material.isSolid()) - settings.settings.solid(); + settings.settings.forceSolidOn(); if (material.isBurnable()) - settings.settings.burnable(); - settings.settings.pistonBehavior(material.getPistonBehavior()); + settings.settings.ignitedByLava(); + settings.settings.pushReaction(material.getPistonBehavior()); return settings; } @@ -101,12 +101,12 @@ public static CompatibleBlockSettings of(CompatIdentifier id, CompatibleMaterial return new CompatibleBlockSettings(id, material, mapColor); } - public CompatibleBlockSettings(CompatIdentifier id, AbstractBlock block) { + public CompatibleBlockSettings(CompatIdentifier id, BlockBehaviour block) { super(block); setId(id); } - public static CompatibleBlockSettings copy(CompatIdentifier id, AbstractBlock block) { + public static CompatibleBlockSettings copy(CompatIdentifier id, BlockBehaviour block) { return new CompatibleBlockSettings(id, block); } @@ -115,22 +115,22 @@ public CompatibleBlockSettings air() { return this; } - public CompatibleBlockSettings blockVision(AbstractBlock.ContextPredicate predicate) { + public CompatibleBlockSettings blockVision(BlockBehaviour.StatePredicate predicate) { super.blockVision(predicate); return this; } - public CompatibleBlockSettings postProcess(AbstractBlock.ContextPredicate predicate) { + public CompatibleBlockSettings postProcess(BlockBehaviour.StatePredicate predicate) { super.postProcess(predicate); return this; } - public CompatibleBlockSettings solidBlock(AbstractBlock.ContextPredicate predicate) { + public CompatibleBlockSettings solidBlock(BlockBehaviour.StatePredicate predicate) { super.solidBlock(predicate); return this; } - public CompatibleBlockSettings suffocates(AbstractBlock.ContextPredicate predicate) { + public CompatibleBlockSettings suffocates(BlockBehaviour.StatePredicate predicate) { super.suffocates(predicate); return this; } @@ -256,26 +256,26 @@ public CompatibleBlockSettings velocityMultiplier(float velocityMultiplier) { return this; } - public CompatibleBlockSettings emissiveLighting(AbstractBlock.ContextPredicate predicate) { + public CompatibleBlockSettings emissiveLighting(BlockBehaviour.StatePredicate predicate) { super.emissiveLighting(predicate); return this; } - public CompatibleBlockSettings offset(AbstractBlock.OffsetType offsetType) { + public CompatibleBlockSettings offset(BlockBehaviour.OffsetType offsetType) { super.offset(offsetType); return this; } - public CompatibleBlockSettings allowsSpawning(AbstractBlock.TypedContextPredicate> predicate) { + public CompatibleBlockSettings allowsSpawning(BlockBehaviour.StateArgumentPredicate> predicate) { super.allowsSpawning(predicate); return this; } - public AbstractBlock.Settings build() { + public BlockBehaviour.Properties build() { super.build(); if (identifier != null) { - settings.registryKey(RegistryKey.of(RegistryKeys.BLOCK, identifier.toMinecraft())); + settings.setId(ResourceKey.create(Registries.BLOCK, identifier.toMinecraft())); } return settings; @@ -283,7 +283,7 @@ public AbstractBlock.Settings build() { @Deprecated @Override - public CompatibleBlockSettings sounds(BlockSoundGroup blockSoundGroup) { + public CompatibleBlockSettings sounds(SoundType blockSoundGroup) { super.sounds(blockSoundGroup); return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java index d6c273835..e20a330ab 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.client; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @Deprecated public abstract class CompatInventoryScreen extends SimpleInventoryScreen { - public CompatInventoryScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { + public CompatInventoryScreen(AbstractContainerMenu handler, Inventory inventory, Component title) { super(handler, inventory, title); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java index 73f5a6c72..dc9e7e781 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.api.client; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.input.KeyInput; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Renderable; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; @@ -26,16 +26,16 @@ import net.pitan76.mcpitanlib.core.datafixer.Pair; @Deprecated -public abstract class SimpleHandledScreen extends HandledScreen { +public abstract class SimpleHandledScreen extends AbstractContainerScreen { public int width, height, backgroundWidth, backgroundHeight, x, y; - public ScreenHandler handler; - public TextRenderer textRenderer; + public AbstractContainerMenu handler; + public Font textRenderer; public ItemRenderer itemRenderer; - public Text title; - public MinecraftClient client; - public SimpleHandledScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { + public Component title; + public Minecraft client; + public SimpleHandledScreen(AbstractContainerMenu handler, Inventory inventory, Component title) { super(handler, inventory, title); fixScreen(); this.handler = handler; @@ -43,13 +43,13 @@ public SimpleHandledScreen(ScreenHandler handler, PlayerInventory inventory, Tex } - public T addDrawableChild_compatibility(T drawableElement) { - return super.addDrawableChild(drawableElement); + public T addDrawableChild_compatibility(T drawableElement) { + return super.addRenderableWidget(drawableElement); // addButton } - public T addSelectableChild_compatibility(T selectableElement) { - return super.addSelectableChild(selectableElement); + public T addSelectableChild_compatibility(T selectableElement) { + return super.addWidget(selectableElement); } public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { @@ -58,7 +58,7 @@ public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWi @Deprecated @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); drawBackgroundOverride(new DrawBackgroundArgs(drawObjectDM, delta, mouseX, mouseY)); } @@ -67,13 +67,13 @@ protected void drawBackground(DrawContext context, float delta, int mouseX, int @Deprecated @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics context, int mouseX, int mouseY) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); drawForegroundOverride(new DrawForegroundArgs(drawObjectDM, mouseX, mouseY)); } protected void drawForegroundOverride(DrawForegroundArgs args) { - super.drawForeground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + super.renderLabels(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); } public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { @@ -95,14 +95,14 @@ public void callRenderBackground(RenderArgs args) { } public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { - super.drawMouseoverTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + super.renderTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); } public void renderOverride(RenderArgs args) { super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } - public void resizeOverride(MinecraftClient client, int width, int height) { + public void resizeOverride(Minecraft client, int width, int height) { } public void initOverride() { @@ -121,35 +121,35 @@ protected void init() { public void resize(int width, int height) { super.resize(width, height); fixScreen(); - resizeOverride(MinecraftClient.getInstance(), width, height); + resizeOverride(Minecraft.getInstance(), width, height); } public void fixScreen() { this.backgroundWidth = getBackgroundWidth(); this.backgroundHeight = getBackgroundHeight(); - this.x = super.x; //(this.width - this.backgroundWidth) / 2; - this.y = super.y; //(this.height - this.backgroundHeight) / 2; - this.textRenderer = super.textRenderer; - this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); + this.x = super.leftPos; //(this.width - this.backgroundWidth) / 2; + this.y = super.topPos; //(this.height - this.backgroundHeight) / 2; + this.textRenderer = super.font; + this.itemRenderer = Minecraft.getInstance().getItemRenderer(); this.width = super.width; this.height = super.height; - if (super.client == null) - this.client = MinecraftClient.getInstance(); + if (super.minecraft == null) + this.client = Minecraft.getInstance(); else - this.client = super.client; + this.client = super.minecraft; } public void setX(int x) { this.x = x; - super.x = x; + super.leftPos = x; } public void setY(int y) { this.y = y; - super.y = y; + super.topPos = y; } - public void setTextRenderer(TextRenderer textRenderer) { + public void setTextRenderer(Font textRenderer) { this.textRenderer = textRenderer; } @@ -164,12 +164,12 @@ public void setWidth(int width) { public void setBackgroundWidth(int backgroundWidth) { this.backgroundWidth = backgroundWidth; - super.backgroundWidth = backgroundWidth; + super.imageWidth = backgroundWidth; } public void setBackgroundHeight(int backgroundHeight) { this.backgroundHeight = backgroundHeight; - super.backgroundHeight = backgroundHeight; + super.imageHeight = backgroundHeight; } public void setHeight(int height) { @@ -178,31 +178,31 @@ public void setHeight(int height) { } public int getBackgroundWidth() { - return super.backgroundWidth; + return super.imageWidth; } public int getBackgroundHeight() { - return super.backgroundHeight; + return super.imageHeight; } @Deprecated @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); renderOverride(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); } public boolean keyReleased(KeyEventArgs args) { - return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + return super.keyReleased(new KeyEvent(args.keyCode, args.scanCode, args.modifiers)); } public boolean keyPressed(KeyEventArgs args) { - return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + return super.keyPressed(new KeyEvent(args.keyCode, args.scanCode, args.modifiers)); } public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { if (getBackgroundTexture() != null) - Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); + Screen.renderMenuBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); @@ -210,24 +210,24 @@ public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { @Deprecated @Override - public boolean keyReleased(KeyInput input) { + public boolean keyReleased(KeyEvent input) { return this.keyReleased(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); } @Deprecated @Override - public boolean keyPressed(KeyInput input) { + public boolean keyPressed(KeyEvent input) { return this.keyPressed(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); } @Deprecated @Override - public void renderDarkening(DrawContext context) { + public void renderMenuBackground(GuiGraphics context) { this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); } public void closeOverride() { - super.close(); + super.onClose(); } public void removedOverride() { @@ -235,7 +235,7 @@ public void removedOverride() { } @Override - public void close() { + public void onClose() { closeOverride(); } @@ -253,11 +253,11 @@ public CompatIdentifier getCompatBackgroundTexture() { } public void setTitleX(int x) { - this.titleX = x; + this.titleLabelX = x; } public void setTitleY(int y) { - this.titleY = y; + this.titleLabelY = y; } public void setTitlePos(int x, int y) { @@ -269,24 +269,24 @@ public void setTitleXCenter() { if (textRenderer == null) textRenderer = ClientUtil.getTextRenderer(); - setTitleX(backgroundWidth / 2 - textRenderer.getWidth(title) / 2); + setTitleX(backgroundWidth / 2 - textRenderer.width(title) / 2); } public int getTitleX() { - return titleX; + return titleLabelX; } public int getTitleY() { - return titleY; + return titleLabelY; } @Deprecated @Override - public Text getTitle() { + public Component getTitle() { return callGetTitle(); } - public Text callGetTitle() { + public Component callGetTitle() { return super.getTitle(); } @@ -295,19 +295,19 @@ public Pair getTitlePosP() { } public int getPlayerInvTitleX() { - return playerInventoryTitleX; + return inventoryLabelX; } public int getPlayerInvTitleY() { - return playerInventoryTitleY; + return inventoryLabelY; } public void setPlayerInvTitleX(int x) { - playerInventoryTitleX = x; + inventoryLabelX = x; } public void setPlayerInvTitleY(int y) { - playerInventoryTitleY = y; + inventoryLabelY = y; } public void setPlayerInvTitle(int x, int y) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java index 98d21aef1..c04f5ba63 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.client; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawMouseoverTooltipArgs; @@ -12,7 +12,7 @@ @Deprecated public abstract class SimpleInventoryScreen extends SimpleHandledScreen { - public SimpleInventoryScreen(ScreenHandler handler, PlayerInventory inventory, Text title) { + public SimpleInventoryScreen(AbstractContainerMenu handler, Inventory inventory, Component title) { super(handler, inventory, title); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java index 572621b5a..1464212bf 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.client; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.option.GameOptions; -import net.minecraft.text.Text; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.Options; +import net.minecraft.network.chat.Component; public class SimpleOptionsScreen extends SimpleScreen { protected final Screen parent; - protected final GameOptions gameOptions; + protected final Options gameOptions; - public SimpleOptionsScreen(Text title, Screen parent, GameOptions gameOptions) { + public SimpleOptionsScreen(Component title, Screen parent, Options gameOptions) { super(title); this.parent = parent; this.gameOptions = gameOptions; @@ -17,11 +17,11 @@ public SimpleOptionsScreen(Text title, Screen parent, GameOptions gameOptions) { @Override public void removed() { - client.options.write(); + client.options.save(); } @Override - public void close() { + public void onClose() { client.setScreen(this.parent); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java index fc0aeea52..c5be842e4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.client; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.input.KeyInput; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.text.Text; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Renderable; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; @@ -23,25 +23,25 @@ public abstract class SimpleScreen extends Screen { public int width, height; - public TextRenderer textRenderer; + public Font textRenderer; public ItemRenderer itemRenderer; - public Text title; - public MinecraftClient client; + public Component title; + public Minecraft client; - public SimpleScreen(Text title) { + public SimpleScreen(Component title) { super(title); fixScreen(); this.title = title; } - public T addDrawableChild_compatibility(T drawableElement) { - return super.addDrawableChild(drawableElement); + public T addDrawableChild_compatibility(T drawableElement) { + return super.addRenderableWidget(drawableElement); // addButton } - public T addSelectableChild_compatibility(T selectableElement) { - return super.addSelectableChild(selectableElement); + public T addSelectableChild_compatibility(T selectableElement) { + return super.addWidget(selectableElement); } public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { @@ -58,7 +58,7 @@ public void callDrawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, @Deprecated @Override - public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) { + public void renderBackground(GuiGraphics context, int mouseX, int mouseY, float delta) { renderBackground(new RenderArgs(new DrawObjectDM(context, this), mouseX, mouseY, delta)); } @@ -71,7 +71,7 @@ public void render(RenderArgs args) { super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } - public void resizeOverride(MinecraftClient client, int width, int height) { + public void resizeOverride(Minecraft client, int width, int height) { } public void initOverride() { @@ -90,21 +90,21 @@ protected void init() { public void resize(int width, int height) { super.resize(width, height); fixScreen(); - resizeOverride(MinecraftClient.getInstance(), width, height); + resizeOverride(Minecraft.getInstance(), width, height); } public void fixScreen() { - this.textRenderer = super.textRenderer; - this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); + this.textRenderer = super.font; + this.itemRenderer = Minecraft.getInstance().getItemRenderer(); this.width = super.width; this.height = super.height; - if (super.client == null) - this.client = MinecraftClient.getInstance(); + if (super.minecraft == null) + this.client = Minecraft.getInstance(); else - this.client = super.client; + this.client = super.minecraft; } - public void setTextRenderer(TextRenderer textRenderer) { + public void setTextRenderer(Font textRenderer) { this.textRenderer = textRenderer; } @@ -124,22 +124,22 @@ public void setHeight(int height) { @Deprecated @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); render(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); } public boolean keyReleased(KeyEventArgs args) { - return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + return super.keyReleased(new KeyEvent(args.keyCode, args.scanCode, args.modifiers)); } public boolean keyPressed(KeyEventArgs args) { - return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + return super.keyPressed(new KeyEvent(args.keyCode, args.scanCode, args.modifiers)); } public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { if (getBackgroundTexture() != null) - Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), 0, 0, 0, 0, this.width, this.height); + Screen.renderMenuBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), 0, 0, 0, 0, this.width, this.height); RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); @@ -147,24 +147,24 @@ public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { @Deprecated @Override - public boolean keyReleased(KeyInput keyInput) { + public boolean keyReleased(KeyEvent keyInput) { return this.keyReleased(new KeyEventArgs(keyInput.key(), keyInput.scancode(), keyInput.modifiers())); } @Deprecated @Override - public boolean keyPressed(KeyInput keyInput) { + public boolean keyPressed(KeyEvent keyInput) { return this.keyPressed(new KeyEventArgs(keyInput.key(), keyInput.scancode(), keyInput.modifiers())); } @Deprecated @Override - public void renderDarkening(DrawContext context) { + public void renderMenuBackground(GuiGraphics context) { this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); } public void closeOverride() { - super.close(); + super.onClose(); } public void removedOverride() { @@ -172,7 +172,7 @@ public void removedOverride() { } @Override - public void close() { + public void onClose() { closeOverride(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java index 50ceb12f4..a5432a754 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.client.color; -import net.minecraft.block.BlockState; -import net.minecraft.client.color.block.BlockColorProvider; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockRenderView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.client.color.block.BlockColor; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockAndTintGetter; import org.jetbrains.annotations.Nullable; -public interface CompatBlockColorProvider extends BlockColorProvider { - default int getColor(BlockState state, @Nullable BlockRenderView world, @Nullable BlockPos pos, int tintIndex) { +public interface CompatBlockColorProvider extends BlockColor { + default int getColor(BlockState state, @Nullable BlockAndTintGetter world, @Nullable BlockPos pos, int tintIndex) { return getColor(new BlockColorEvent(state, world, pos, tintIndex)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java index 3b189df69..3820cd5a3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.client.event.listener; -import net.minecraft.block.BlockState; -import net.minecraft.client.render.Camera; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.render.state.OutlineRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.client.Camera; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.state.BlockOutlineRenderState; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; @@ -21,7 +21,7 @@ public class BeforeBlockOutlineEvent { public WorldRenderContext context; public HitResult hitResult; - public BeforeBlockOutlineEvent(WorldRenderContext context, OutlineRenderState renderState) { + public BeforeBlockOutlineEvent(WorldRenderContext context, BlockOutlineRenderState renderState) { this.context = context; this.hitResult = context.getHitResult(); } @@ -39,7 +39,7 @@ public WorldRenderContext getContext() { return context; } - public WorldRenderer getWorldRenderer() { + public LevelRenderer getWorldRenderer() { return context.getWorldRenderer(); } @@ -47,7 +47,7 @@ public Optional getBlockState() { return Optional.ofNullable(getWorld().getBlockState(getBlockPos().orElse(null))); } - public World getWorld() { + public Level getWorld() { return context.getWorld(); } @@ -76,7 +76,7 @@ public Optional getOutlineShape() { return context.getOutlineShape(); } - public MatrixStack getMatrixStack() { + public PoseStack getMatrixStack() { return context.getMatrixStack(); } @@ -100,7 +100,7 @@ public void drawBox(float red, float green, float blue, float alpha) { context.drawBox(red, green, blue, alpha); } - public void drawBox(Box box, float red, float green, float blue, float alpha) { + public void drawBox(AABB box, float red, float green, float blue, float alpha) { context.drawBox(box, red, green, blue, alpha); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java index f2ac0da2e..a538df618 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.client.event.listener; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.TextUtil; @@ -12,13 +12,13 @@ public class ItemTooltipContext { public ItemStack stack; - public List texts; + public List texts; public Item.TooltipContext tooltipContext; @Deprecated - public TooltipType type; + public TooltipFlag type; - public ItemTooltipContext(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipType type) { + public ItemTooltipContext(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipFlag type) { this.stack = stack; this.texts = texts; this.tooltipContext = tooltipContext; @@ -29,7 +29,7 @@ public ItemStack getStack() { return stack; } - public List getTexts() { + public List getTexts() { return texts; } @@ -38,15 +38,15 @@ public Item.TooltipContext getTooltipContext() { } @Deprecated - public TooltipType getType() { + public TooltipFlag getType() { return type; } - public void addTooltip(Text text) { + public void addTooltip(Component text) { texts.add(text); } - public void addTooltip(List texts) { + public void addTooltip(List texts) { this.texts.addAll(texts); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java index d86227934..dc83f5a08 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.client.event.listener; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.network.chat.Component; import java.util.List; @@ -11,7 +11,7 @@ public interface ItemTooltipListener { void onTooltip(ItemTooltipContext context); - default void onTooltip(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipType type) { + default void onTooltip(ItemStack stack, List texts, Item.TooltipContext tooltipContext, TooltipFlag type) { onTooltip(new ItemTooltipContext(stack, texts, tooltipContext, type)); } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java index 2f67d7776..52e4dd582 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java @@ -1,18 +1,26 @@ package net.pitan76.mcpitanlib.api.client.event.listener; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; +import net.minecraft.client.Camera; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.rendertype.RenderTypes; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.Entity; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.VoxelShape; import net.pitan76.mcpitanlib.api.util.VoxelShapeUtil; import net.pitan76.mcpitanlib.api.util.client.render.VertexRenderingUtil; import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; @@ -24,9 +32,9 @@ public interface WorldRenderContext { - WorldRenderer getWorldRenderer(); + LevelRenderer getWorldRenderer(); - MatrixStack getMatrixStack(); + PoseStack getMatrixStack(); float getTickDelta(); @@ -34,17 +42,17 @@ public interface WorldRenderContext { GameRenderer getGameRenderer(); - LightmapTextureManager getLightmapTextureManager(); + LightTexture getLightmapTextureManager(); @Deprecated Matrix4f getProjectionMatrix(); - ClientWorld getWorld(); + ClientLevel getWorld(); @Deprecated boolean isAdvancedTranslucency(); - @Nullable VertexConsumerProvider getConsumers(); + @Nullable MultiBufferSource getConsumers(); @Nullable Frustum getFrustum(); @Environment(EnvType.CLIENT) @@ -66,7 +74,7 @@ interface BlockOutlineContext { } default HitResult getHitResult() { - return MinecraftClient.getInstance().crosshairTarget; + return Minecraft.getInstance().hitResult; } default Optional getBlockState() { @@ -86,12 +94,12 @@ default HitResult.Type getHitResultType() { } default Optional getOutlineShape() { - return getBlockState().map(blockState -> blockState.getOutlineShape(getWorld(), + return getBlockState().map(blockState -> blockState.getShape(getWorld(), getBlockPos().orElse(null))); } default void push() { - getMatrixStack().push(); + getMatrixStack().pushPose(); } default void translate(double x, double y, double z) { @@ -99,14 +107,14 @@ default void translate(double x, double y, double z) { } default void pop() { - getMatrixStack().pop(); + getMatrixStack().popPose(); } default Optional getVertexConsumer() { if (getConsumers() == null) return Optional.empty(); - return Optional.of(Objects.requireNonNull(getConsumers()).getBuffer(RenderLayers.lines())); + return Optional.of(Objects.requireNonNull(getConsumers()).getBuffer(RenderTypes.lines())); } default void drawBox(float red, float green, float blue, float alpha) { @@ -116,7 +124,7 @@ default void drawBox(float red, float green, float blue, float alpha) { drawBox(VoxelShapeUtil.getBoundingBox(outlineShape.get()), red, green, blue, alpha); } - default void drawBox(Box box, float red, float green, float blue, float alpha) { + default void drawBox(AABB box, float red, float green, float blue, float alpha) { Optional vertexConsumer = getVertexConsumer(); if (!vertexConsumer.isPresent()) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java index dbe5fcd85..9693d3d12 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java @@ -1,36 +1,43 @@ package net.pitan76.mcpitanlib.api.client.event.listener; +import net.minecraft.client.Camera; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.render.*; -import net.minecraft.client.render.state.WorldRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.state.LevelRenderState; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.multiplayer.ClientLevel; +import com.mojang.math.Axis; +import net.minecraft.world.phys.Vec3; import net.pitan76.mcpitanlib.api.util.client.ClientUtil; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; public class WorldRenderContextImpl implements WorldRenderContext { - public WorldRenderer worldRenderer; - public MatrixStack matrixStack; + public LevelRenderer worldRenderer; + public PoseStack matrixStack; public float tickDelta; public Camera camera; public GameRenderer gameRenderer; - public LightmapTextureManager lightmapTextureManager; + public LightTexture lightmapTextureManager; public Matrix4f projectionMatrix; - public ClientWorld world; + public ClientLevel world; public boolean advancedTranslucency; - public @Nullable VertexConsumerProvider consumers; + public @Nullable MultiBufferSource consumers; public @Nullable Frustum frustum; @Override - public WorldRenderer getWorldRenderer() { + public LevelRenderer getWorldRenderer() { return worldRenderer; } @Override - public MatrixStack getMatrixStack() { + public PoseStack getMatrixStack() { return matrixStack; } @@ -42,7 +49,7 @@ public float getTickDelta() { @Override public Camera getCamera() { if (camera == null) { - return getGameRenderer().getCamera(); + return getGameRenderer().getMainCamera(); } return camera; } @@ -56,7 +63,7 @@ public GameRenderer getGameRenderer() { } @Override - public LightmapTextureManager getLightmapTextureManager() { + public LightTexture getLightmapTextureManager() { return lightmapTextureManager; } @@ -66,7 +73,7 @@ public Matrix4f getProjectionMatrix() { } @Override - public ClientWorld getWorld() { + public ClientLevel getWorld() { if (world == null) { return ClientUtil.getWorld(); } @@ -79,7 +86,7 @@ public boolean isAdvancedTranslucency() { } @Override - public @Nullable VertexConsumerProvider getConsumers() { + public @Nullable MultiBufferSource getConsumers() { return consumers; } @@ -88,26 +95,26 @@ public boolean isAdvancedTranslucency() { return frustum; } - public void prepare(GameRenderer gameRenderer, WorldRenderer worldRenderer, WorldRenderState worldRenderState, @Nullable ClientWorld world, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix) { + public void prepare(GameRenderer gameRenderer, LevelRenderer worldRenderer, LevelRenderState worldRenderState, @Nullable ClientLevel world, DeltaTracker tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix) { this.gameRenderer = gameRenderer; this.worldRenderer = worldRenderer; this.world = world; this.camera = camera; - this.matrixStack = new MatrixStack(); - this.matrixStack.multiplyPositionMatrix(projectionMatrix); - this.matrixStack.push(); + this.matrixStack = new PoseStack(); + this.matrixStack.mulPose(projectionMatrix); + this.matrixStack.pushPose(); - matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw())); - matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch())); + matrixStack.mulPose(Axis.YP.rotationDegrees(-camera.yRot())); + matrixStack.mulPose(Axis.XP.rotationDegrees(camera.xRot())); - Vec3d camPos = camera.getCameraPos(); + Vec3 camPos = camera.position(); matrixStack.translate(-camPos.x, -camPos.y, -camPos.z); - this.matrixStack.pop(); + this.matrixStack.popPose(); this.projectionMatrix = projectionMatrix;; - this.tickDelta = tickCounter.getDynamicDeltaTicks(); - this.lightmapTextureManager = gameRenderer.getLightmapTextureManager(); + this.tickDelta = tickCounter.getGameTimeDeltaTicks(); + this.lightmapTextureManager = gameRenderer.lightTexture(); this.frustum = worldRenderer.getCapturedFrustum(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java index 0cd2b1ac5..9e55ffc07 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.client.gui.screen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; -public abstract class CompatInventoryScreen extends SimpleInventoryScreen { +public abstract class CompatInventoryScreen extends SimpleInventoryScreen { - public CompatInventoryScreen(S handler, PlayerInventory inventory, Text title) { + public CompatInventoryScreen(S handler, Inventory inventory, Component title) { super(handler, inventory, title); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java index da47fb543..df09019ac 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.client.gui.screen; -import net.minecraft.text.Text; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.util.TextUtil; public class ScreenTexts { - public static final Text ON = TextUtil.translatable("options.on"); - public static final Text OFF = TextUtil.translatable("options.off"); - public static final Text DONE = TextUtil.translatable("gui.done"); - public static final Text CANCEL = TextUtil.translatable("gui.cancel"); - public static final Text YES = TextUtil.translatable("gui.yes"); - public static final Text NO = TextUtil.translatable("gui.no"); - public static final Text PROCEED = TextUtil.translatable("gui.proceed"); - public static final Text BACK = TextUtil.translatable("gui.back"); - public static final Text CONNECT_FAILED = TextUtil.translatable("connect.failed"); - public static final Text LINE_BREAK = TextUtil.literal("\n"); - public static final Text SENTENCE_SEPARATOR = TextUtil.literal(". "); + public static final Component ON = TextUtil.translatable("options.on"); + public static final Component OFF = TextUtil.translatable("options.off"); + public static final Component DONE = TextUtil.translatable("gui.done"); + public static final Component CANCEL = TextUtil.translatable("gui.cancel"); + public static final Component YES = TextUtil.translatable("gui.yes"); + public static final Component NO = TextUtil.translatable("gui.no"); + public static final Component PROCEED = TextUtil.translatable("gui.proceed"); + public static final Component BACK = TextUtil.translatable("gui.back"); + public static final Component CONNECT_FAILED = TextUtil.translatable("connect.failed"); + public static final Component LINE_BREAK = TextUtil.literal("\n"); + public static final Component SENTENCE_SEPARATOR = TextUtil.literal(". "); public ScreenTexts() { } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java index df171ff21..59583414f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.api.client.gui.screen; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.input.KeyInput; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Renderable; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; @@ -26,16 +26,16 @@ import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; import net.pitan76.mcpitanlib.core.datafixer.Pair; -public abstract class SimpleHandledScreen extends HandledScreen { +public abstract class SimpleHandledScreen extends AbstractContainerScreen { public int width, height, backgroundWidth, backgroundHeight, x, y; public S handler; - public TextRenderer textRenderer; + public Font textRenderer; public ItemRenderer itemRenderer; - public Text title; - public MinecraftClient client; - public SimpleHandledScreen(S handler, PlayerInventory inventory, Text title) { + public Component title; + public Minecraft client; + public SimpleHandledScreen(S handler, Inventory inventory, Component title) { super(handler, inventory, title); fixScreen(); this.handler = handler; @@ -45,21 +45,21 @@ public SimpleHandledScreen(S handler, PlayerInventory inventory, Text title) { @Deprecated @Override - public S getScreenHandler() { + public S getMenu() { return getScreenHandlerOverride(); } public S getScreenHandlerOverride() { - return super.getScreenHandler(); + return super.getMenu(); } - public T addDrawableChild_compatibility(T drawableElement) { - return super.addDrawableChild(drawableElement); + public T addDrawableChild_compatibility(T drawableElement) { + return super.addRenderableWidget(drawableElement); // addButton } - public T addSelectableChild_compatibility(T selectableElement) { - return super.addSelectableChild(selectableElement); + public T addSelectableChild_compatibility(T selectableElement) { + return super.addWidget(selectableElement); } public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWidget widget) { @@ -68,7 +68,7 @@ public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWi @Deprecated @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); drawBackgroundOverride(new DrawBackgroundArgs(drawObjectDM, delta, mouseX, mouseY)); } @@ -77,13 +77,13 @@ protected void drawBackground(DrawContext context, float delta, int mouseX, int @Deprecated @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics context, int mouseX, int mouseY) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); drawForegroundOverride(new DrawForegroundArgs(drawObjectDM, mouseX, mouseY)); } protected void drawForegroundOverride(DrawForegroundArgs args) { - super.drawForeground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + super.renderLabels(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); } public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { @@ -105,14 +105,14 @@ public void callRenderBackground(RenderArgs args) { } public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { - super.drawMouseoverTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + super.renderTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); } public void renderOverride(RenderArgs args) { super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } - public void resizeOverride(MinecraftClient client, int width, int height) { + public void resizeOverride(Minecraft client, int width, int height) { } public void initOverride() { @@ -131,35 +131,35 @@ protected void init() { public void resize(int width, int height) { super.resize(width, height); fixScreen(); - resizeOverride(MinecraftClient.getInstance(), width, height); + resizeOverride(Minecraft.getInstance(), width, height); } public void fixScreen() { this.backgroundWidth = getBackgroundWidth(); this.backgroundHeight = getBackgroundHeight(); - this.x = super.x; //(this.width - this.backgroundWidth) / 2; - this.y = super.y; //(this.height - this.backgroundHeight) / 2; - this.textRenderer = super.textRenderer; - this.itemRenderer = MinecraftClient.getInstance().getItemRenderer(); + this.x = super.leftPos; //(this.width - this.backgroundWidth) / 2; + this.y = super.topPos; //(this.height - this.backgroundHeight) / 2; + this.textRenderer = super.font; + this.itemRenderer = Minecraft.getInstance().getItemRenderer(); this.width = super.width; this.height = super.height; - if (super.client == null) - this.client = MinecraftClient.getInstance(); + if (super.minecraft == null) + this.client = Minecraft.getInstance(); else - this.client = super.client; + this.client = super.minecraft; } public void setX(int x) { this.x = x; - super.x = x; + super.leftPos = x; } public void setY(int y) { this.y = y; - super.y = y; + super.topPos = y; } - public void setTextRenderer(TextRenderer textRenderer) { + public void setTextRenderer(Font textRenderer) { this.textRenderer = textRenderer; } @@ -174,12 +174,12 @@ public void setWidth(int width) { public void setBackgroundWidth(int backgroundWidth) { this.backgroundWidth = backgroundWidth; - super.backgroundWidth = backgroundWidth; + super.imageWidth = backgroundWidth; } public void setBackgroundHeight(int backgroundHeight) { this.backgroundHeight = backgroundHeight; - super.backgroundHeight = backgroundHeight; + super.imageHeight = backgroundHeight; } public void setHeight(int height) { @@ -188,31 +188,31 @@ public void setHeight(int height) { } public int getBackgroundWidth() { - return super.backgroundWidth; + return super.imageWidth; } public int getBackgroundHeight() { - return super.backgroundHeight; + return super.imageHeight; } @Deprecated @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); renderOverride(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); } public boolean keyReleased(KeyEventArgs args) { - return super.keyReleased(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + return super.keyReleased(new KeyEvent(args.keyCode, args.scanCode, args.modifiers)); } public boolean keyPressed(KeyEventArgs args) { - return super.keyPressed(new KeyInput(args.keyCode, args.scanCode, args.modifiers)); + return super.keyPressed(new KeyEvent(args.keyCode, args.scanCode, args.modifiers)); } public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { if (getBackgroundTexture() != null) - Screen.renderBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); + Screen.renderMenuBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); @@ -220,24 +220,24 @@ public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { @Deprecated @Override - public boolean keyReleased(KeyInput input) { + public boolean keyReleased(KeyEvent input) { return this.keyReleased(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); } @Deprecated @Override - public boolean keyPressed(KeyInput input) { + public boolean keyPressed(KeyEvent input) { return this.keyPressed(new KeyEventArgs(input.key(), input.scancode(), input.modifiers())); } @Deprecated @Override - public void renderDarkening(DrawContext context) { + public void renderMenuBackground(GuiGraphics context) { this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); } public void closeOverride() { - super.close(); + super.onClose(); } public void removedOverride() { @@ -245,7 +245,7 @@ public void removedOverride() { } @Override - public void close() { + public void onClose() { closeOverride(); } @@ -263,11 +263,11 @@ public CompatIdentifier getCompatBackgroundTexture() { } public void setTitleX(int x) { - this.titleX = x; + this.titleLabelX = x; } public void setTitleY(int y) { - this.titleY = y; + this.titleLabelY = y; } public void setTitlePos(int x, int y) { @@ -279,18 +279,18 @@ public void setTitleXCenter() { if (textRenderer == null) textRenderer = ClientUtil.getTextRenderer(); - setTitleX(backgroundWidth / 2 - textRenderer.getWidth(title) / 2); + setTitleX(backgroundWidth / 2 - textRenderer.width(title) / 2); } public int getTitleX() { - return titleX; + return titleLabelX; } public int getTitleY() { - return titleY; + return titleLabelY; } - public void drawText(DrawObjectDM drawObjectDM, Text text, int x, int y, int color) { + public void drawText(DrawObjectDM drawObjectDM, Component text, int x, int y, int color) { ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y, color); } @@ -298,7 +298,7 @@ public void drawText(DrawObjectDM drawObjectDM, TextComponent text, int x, int y ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y, color); } - public void drawText(DrawObjectDM drawObjectDM, Text text, int x, int y) { + public void drawText(DrawObjectDM drawObjectDM, Component text, int x, int y) { ScreenUtil.RendererUtil.drawText(textRenderer, drawObjectDM, text, x, y); } @@ -308,11 +308,11 @@ public void drawText(DrawObjectDM drawObjectDM, TextComponent text, int x, int y @Deprecated @Override - public Text getTitle() { + public Component getTitle() { return callGetTitle(); } - public Text callGetTitle() { + public Component callGetTitle() { return super.getTitle(); } @@ -321,19 +321,19 @@ public Pair getTitlePosP() { } public int getPlayerInvTitleX() { - return playerInventoryTitleX; + return inventoryLabelX; } public int getPlayerInvTitleY() { - return playerInventoryTitleY; + return inventoryLabelY; } public void setPlayerInvTitleX(int x) { - playerInventoryTitleX = x; + inventoryLabelX = x; } public void setPlayerInvTitleY(int y) { - playerInventoryTitleY = y; + inventoryLabelY = y; } public void setPlayerInvTitle(int x, int y) { @@ -341,12 +341,12 @@ public void setPlayerInvTitle(int x, int y) { setPlayerInvTitleY(y); } - public TextRenderer callGetTextRenderer() { + public Font callGetTextRenderer() { if (textRenderer != null) return textRenderer; - if (super.getTextRenderer() != null) - return super.getTextRenderer(); + if (super.getFont() != null) + return super.getFont(); return ClientUtil.getTextRenderer(); } @@ -358,7 +358,7 @@ public ItemRenderer callGetItemRenderer() { return ClientUtil.getItemRenderer(); } - public Text getPlayerInvTitle() { + public Component getPlayerInvTitle() { return playerInventoryTitle; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java index f2fadac7f..d91656e9b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.client.gui.screen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawMouseoverTooltipArgs; import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; import net.pitan76.mcpitanlib.api.util.client.RenderUtil; -public abstract class SimpleInventoryScreen extends SimpleHandledScreen { +public abstract class SimpleInventoryScreen extends SimpleHandledScreen { - public SimpleInventoryScreen(S handler, PlayerInventory inventory, Text title) { + public SimpleInventoryScreen(S handler, Inventory inventory, Component title) { super(handler, inventory, title); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java index 4c0d379cd..bcd3786d3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java @@ -1,33 +1,33 @@ package net.pitan76.mcpitanlib.api.client.gui.widget; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.input.CharInput; -import net.minecraft.client.input.KeyInput; -import net.minecraft.text.Text; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.input.CharacterEvent; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.util.TextUtil; import org.jetbrains.annotations.Nullable; -public class CompatTextFieldWidget extends TextFieldWidget { - public CompatTextFieldWidget(TextRenderer textRenderer, int width, int height) { +public class CompatTextFieldWidget extends EditBox { + public CompatTextFieldWidget(Font textRenderer, int width, int height) { this(textRenderer, width, height, TextUtil.empty()); } - public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height) { + public CompatTextFieldWidget(Font textRenderer, int x, int y, int width, int height) { this(textRenderer, x, y, width, height, TextUtil.empty()); } // ---- - public CompatTextFieldWidget(TextRenderer textRenderer, int width, int height, Text text) { + public CompatTextFieldWidget(Font textRenderer, int width, int height, Component text) { super(textRenderer, width, height, text); } - public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text text) { + public CompatTextFieldWidget(Font textRenderer, int x, int y, int width, int height, Component text) { super(textRenderer, x, y, width, height, text); } - public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, @Nullable TextFieldWidget copyFrom, Text text) { + public CompatTextFieldWidget(Font textRenderer, int x, int y, int width, int height, @Nullable EditBox copyFrom, Component text) { super(textRenderer, x, y, width, height, copyFrom, text); } @@ -35,12 +35,12 @@ public CompatTextFieldWidget(TextRenderer textRenderer, int x, int y, int width, @Deprecated @Override - public void setDrawsBackground(boolean drawsBackground) { + public void setBordered(boolean drawsBackground) { callSetDrawsBackground(drawsBackground); } public void callSetDrawsBackground(boolean drawsBackground) { - super.setDrawsBackground(drawsBackground); + super.setBordered(drawsBackground); } @Deprecated @@ -55,12 +55,12 @@ public void callSetFocused(boolean focused) { @Deprecated @Override - public void setFocusUnlocked(boolean focusUnlocked) { + public void setCanLoseFocus(boolean focusUnlocked) { callSetFocusUnlocked(focusUnlocked); } public void callSetFocusUnlocked(boolean focusUnlocked) { - super.setFocusUnlocked(focusUnlocked); + super.setCanLoseFocus(focusUnlocked); } @Deprecated @@ -75,22 +75,22 @@ public void callSetMaxLength(int maxLength) { @Deprecated @Override - public void setText(String text) { + public void setValue(String text) { callSetText(text); } public void callSetText(String text) { - super.setText(text); + super.setValue(text); } @Deprecated @Override - public String getText() { + public String getValue() { return callGetText(); } public String callGetText() { - return super.getText(); + return super.getValue(); } @Deprecated @@ -115,31 +115,31 @@ public boolean callIsFocused() { @Deprecated @Override - public boolean keyPressed(KeyInput input) { + public boolean keyPressed(KeyEvent input) { return callKeyPressed(input.key(), input.scancode(), input.modifiers()); } public boolean callKeyPressed(int keyCode, int scanCode, int modifiers) { - return super.keyPressed(new KeyInput(keyCode, scanCode, modifiers)); + return super.keyPressed(new KeyEvent(keyCode, scanCode, modifiers)); } @Deprecated @Override - public boolean keyReleased(KeyInput input) { + public boolean keyReleased(KeyEvent input) { return callKeyReleased(input.key(), input.scancode(), input.modifiers()); } public boolean callKeyReleased(int keyCode, int scanCode, int modifiers) { - return super.keyReleased(new KeyInput(keyCode, scanCode, modifiers)); + return super.keyReleased(new KeyEvent(keyCode, scanCode, modifiers)); } @Deprecated @Override - public boolean charTyped(CharInput input) { + public boolean charTyped(CharacterEvent input) { return callCharTyped((char) input.codepoint(), input.modifiers()); } public boolean callCharTyped(char chr, int modifiers) { - return super.charTyped(new CharInput(chr, modifiers)); + return super.charTyped(new CharacterEvent(chr, modifiers)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java index 9a0715a78..768ec9ccf 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.client.gui.widget; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ButtonTextures; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.gui.widget.TexturedButtonWidget; +import net.minecraft.client.renderer.RenderPipelines; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.WidgetSprites; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.ImageButton; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.TextUtil; -public class CompatibleTexturedButtonWidget extends TexturedButtonWidget { +public class CompatibleTexturedButtonWidget extends ImageButton { private final Identifier texture; private final int u; private final int v; @@ -17,20 +17,20 @@ public class CompatibleTexturedButtonWidget extends TexturedButtonWidget { private final int textureWidth; private final int textureHeight; - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, Button.OnPress pressAction) { this(x, y, width, height, u, v, height, texture, 256, 256, pressAction); } - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, Button.OnPress pressAction) { this(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); } - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction) { this(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, TextUtil.empty()); } - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, net.minecraft.text.Text text) { - super(x, y, width, height, new ButtonTextures(texture, texture), pressAction, text); + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction, net.minecraft.network.chat.Component text) { + super(x, y, width, height, new WidgetSprites(texture, texture), pressAction, text); this.textureWidth = textureWidth; this.textureHeight = textureHeight; this.u = u; @@ -39,19 +39,19 @@ public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u this.texture = texture; } - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, Button.OnPress pressAction) { this(x, y, width, height, u, v, texture.toMinecraft(), pressAction); } - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, Button.OnPress pressAction) { this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); } - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction) { this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); } - public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, net.minecraft.text.Text text) { + public CompatibleTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction, net.minecraft.network.chat.Component text) { this(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, text); } @@ -61,14 +61,14 @@ public void setPos(int x, int y) { } @Override - public void drawIcon(DrawContext context, int mouseX, int mouseY, float delta) { + public void renderContents(GuiGraphics context, int mouseX, int mouseY, float delta) { int i = v; - if (this.getNarrationMessage().toString().isEmpty()) { + if (this.createNarrationMessage().toString().isEmpty()) { i = v + hoveredVOffset * 2; } else if (this.isHovered()) { i += hoveredVOffset; } - context.drawTexture(RenderPipelines.GUI_TEXTURED, texture, this.getX(), this.getY(), u, i, this.width, this.height, textureWidth, textureHeight); + context.blit(RenderPipelines.GUI_TEXTURED, texture, this.getX(), this.getY(), u, i, this.width, this.height, textureWidth, textureHeight); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java index ac768e311..9d7924a4c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.api.client.gui.widget; -import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button.OnPress; import net.minecraft.resources.Identifier; public class RedrawableTexturedButtonWidget extends CompatibleTexturedButtonWidget { @@ -11,7 +12,7 @@ public class RedrawableTexturedButtonWidget extends CompatibleTexturedButtonWidg public int textureWidth; public int textureHeight; - public RedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, PressAction pressAction, net.minecraft.text.Text message) { + public RedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, OnPress pressAction, net.minecraft.network.chat.Component message) { super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); this.textureWidth = textureWidth; this.textureHeight = textureHeight; @@ -21,7 +22,7 @@ public RedrawableTexturedButtonWidget(int x, int y, int width, int height, int u this.texture = texture; } - public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) { + public void renderButton(GuiGraphics context, int mouseX, int mouseY, float delta) { super.renderWidget(context, mouseX, mouseY, delta); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java index 330f1e2b0..85790dc0c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java @@ -3,12 +3,13 @@ import com.google.common.collect.ImmutableList; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.Selectable; -import net.minecraft.client.gui.widget.ClickableWidget; -import net.minecraft.client.gui.widget.ElementListWidget; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.ContainerObjectSelectionList.Entry; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.components.ContainerObjectSelectionList; import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; import org.jetbrains.annotations.Nullable; @@ -16,18 +17,18 @@ import java.util.Optional; @Environment(EnvType.CLIENT) -public class SimpleListWidget extends ElementListWidget { +public class SimpleListWidget extends ContainerObjectSelectionList { - public SimpleListWidget(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) { + public SimpleListWidget(Minecraft client, int width, int height, int top, int bottom, int itemHeight) { this(client, width, bottom - top, top, itemHeight); } - public SimpleListWidget(MinecraftClient client, int width, int height, int y, int itemHeight) { + public SimpleListWidget(Minecraft client, int width, int height, int y, int itemHeight) { super(client, width, height, y, itemHeight); this.centerListVertically = false; } - public void add(ClickableWidget widget) { + public void add(AbstractWidget widget) { super.addEntry(WidgetEntry.create(widget)); } @@ -45,19 +46,19 @@ public int getHeight() { } @Override - protected int getScrollbarX() { - return super.getScrollbarX() + 32; + protected int scrollBarX() { + return super.scrollBarX() + 32; } @Nullable - public ClickableWidget getWidget(int index) { + public AbstractWidget getWidget(int index) { if (index < 0 || index >= this.children().size()) { return null; } return this.children().get(index).getWidget(); } - public Optional getHoveredWidget(double mouseX, double mouseY) { + public Optional getHoveredWidget(double mouseX, double mouseY) { for (WidgetEntry entry : this.children()) { if (entry.getWidget().isMouseOver(mouseX, mouseY)) { return Optional.of(entry.getWidget()); @@ -79,35 +80,35 @@ public void render(RenderArgs args) { @Environment(EnvType.CLIENT) public static class WidgetEntry extends Entry { - protected final ClickableWidget widget; + protected final AbstractWidget widget; - public WidgetEntry(ClickableWidget widget) { + public WidgetEntry(AbstractWidget widget) { this.widget = widget; } - public static WidgetEntry create(ClickableWidget widget) { + public static WidgetEntry create(AbstractWidget widget) { return new WidgetEntry(widget); } @Deprecated @Override - public void render(DrawContext context, int mouseX, int mouseY, boolean hovered, float deltaTicks) { + public void renderContent(GuiGraphics context, int mouseX, int mouseY, boolean hovered, float deltaTicks) { widget.render(context, mouseX, mouseY, deltaTicks); } @Deprecated @Override - public List children() { + public List children() { return ImmutableList.of(widget); } @Deprecated @Override - public List selectableChildren() { + public List narratables() { return ImmutableList.of(widget); } - public ClickableWidget getWidget() { + public AbstractWidget getWidget() { return widget; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java index 7c4b87d68..5f1edca92 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java @@ -2,9 +2,9 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.widget.SliderWidget; -import net.minecraft.text.Text; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.AbstractSliderButton; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; import net.pitan76.mcpitanlib.api.util.TextUtil; @@ -13,12 +13,12 @@ import java.util.function.Function; @Environment(EnvType.CLIENT) -public class SimpleSliderWidget extends SliderWidget { - protected final Function textGetter; +public class SimpleSliderWidget extends AbstractSliderButton { + protected final Function textGetter; protected final Consumer changeCallback; public SimpleListWidget listWidget = null; - public SimpleSliderWidget(int x, int y, int width, int height, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + public SimpleSliderWidget(int x, int y, int width, int height, Component text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { super(x, y, width, height, text, defaultValue); this.textGetter = (Double value) -> valueTextGetter.get(text, value); this.changeCallback = changeCallback; @@ -28,7 +28,7 @@ public SimpleSliderWidget(int x, int y, int width, int height, double defaultVal this(x, y, width, height, TextUtil.empty(), defaultValue, valueTextGetter, changeCallback); } - public SimpleSliderWidget(int x, int y, int width, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + public SimpleSliderWidget(int x, int y, int width, Component text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { this(x, y, width, 20, text, defaultValue, valueTextGetter, changeCallback); } @@ -36,7 +36,7 @@ public SimpleSliderWidget(int x, int y, int width, double defaultValue, ValueTex this(x, y, width, 20, defaultValue, valueTextGetter, changeCallback); } - public SimpleSliderWidget(SimpleListWidget listWidget, int width, Text text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { + public SimpleSliderWidget(SimpleListWidget listWidget, int width, Component text, double defaultValue, ValueTextGetter valueTextGetter, Consumer changeCallback) { this(listWidget.getWidth() / 2 - 155, 0, width, 20, text, defaultValue, valueTextGetter, changeCallback); this.listWidget = listWidget; } @@ -77,6 +77,6 @@ protected void applyValue() { @Environment(EnvType.CLIENT) @FunctionalInterface public interface ValueTextGetter { - Text get(Text optionText, Double value); + Component get(Component optionText, Double value); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java b/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java index 79e18403f..6139f1cec 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.client.option; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.text.Text; +import net.minecraft.client.KeyMapping; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import java.util.HashMap; @@ -9,55 +9,55 @@ import java.util.Objects; public class CompatKeyBinding { - private final KeyBinding keyBinding; - public static final Map categories = new HashMap<>(); + private final KeyMapping keyBinding; + public static final Map categories = new HashMap<>(); - public CompatKeyBinding(KeyBinding keyBinding) { + public CompatKeyBinding(KeyMapping keyBinding) { this.keyBinding = keyBinding; } public CompatKeyBinding(String translationKey, int defaultKeyCode, CompatIdentifier category) { - KeyBinding.Category cat; + KeyMapping.Category cat; if (categories.containsKey(category)) { cat = categories.get(category); } else { - cat = KeyBinding.Category.create(category.toMinecraft()); + cat = KeyMapping.Category.register(category.toMinecraft()); categories.put(category, cat); } - this.keyBinding = new KeyBinding(translationKey, defaultKeyCode, cat); + this.keyBinding = new KeyMapping(translationKey, defaultKeyCode, cat); } public CompatKeyBinding(String translationKey, int defaultKeyCode) { String[] parts = translationKey.split("\\."); if (Objects.equals(parts[0], "key") && parts.length == 3) { CompatIdentifier category = CompatIdentifier.of(parts[1], "main"); - KeyBinding.Category cat; + KeyMapping.Category cat; if (categories.containsKey(category)) { cat = categories.get(category); } else { - cat = KeyBinding.Category.create(category.toMinecraft()); + cat = KeyMapping.Category.register(category.toMinecraft()); categories.put(category, cat); } - this.keyBinding = new KeyBinding(translationKey, defaultKeyCode, cat); + this.keyBinding = new KeyMapping(translationKey, defaultKeyCode, cat); } else { throw new IllegalArgumentException("Cannot infer category from translation key: " + translationKey); } } public String getTranslationKey() { - return keyBinding.getBoundKeyTranslationKey(); + return keyBinding.saveString(); } - public Text getBoundKeyLocalizedText() { - return keyBinding.getBoundKeyLocalizedText(); + public Component getBoundKeyLocalizedText() { + return keyBinding.getTranslatedKeyMessage(); } public int getDefaultKeyCode() { - return keyBinding.getDefaultKey().getCode(); + return keyBinding.getDefaultKey().getValue(); } public static CompatKeyBinding of(String translationKey, int defaultKeyCode, CompatIdentifier category) { @@ -68,11 +68,11 @@ public static CompatKeyBinding of(String translationKey, int defaultKeyCode) { return new CompatKeyBinding(translationKey, defaultKeyCode); } - public KeyBinding toMinecraft() { + public KeyMapping toMinecraft() { return keyBinding; } - public KeyBinding getRaw() { + public KeyMapping getRaw() { return keyBinding; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java b/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java index 3bdfa6bfe..141034cf5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java @@ -1,19 +1,19 @@ package net.pitan76.mcpitanlib.api.client.option; -import net.minecraft.client.option.GameOptions; +import net.minecraft.client.Options; public class GameOptionsWrapper { - public final GameOptions raw; + public final Options raw; - public GameOptionsWrapper(GameOptions options) { + public GameOptionsWrapper(Options options) { this.raw = options; } - public GameOptions getRaw() { + public Options getRaw() { return raw; } public void write() { - raw.write(); + raw.save(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java index 93222526d..bf8aa3952 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java @@ -7,38 +7,38 @@ import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.particle.ParticleFactory; -import net.minecraft.client.particle.SpriteProvider; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.block.BlockRenderManager; -import net.minecraft.client.render.block.entity.BlockEntityRenderManager; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.minecraft.client.render.entity.EntityRenderManager; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.fluid.Fluid; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleType; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.text.Text; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.MenuAccess; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.particle.SpriteSet; +import net.minecraft.client.renderer.rendertype.RenderType; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; +import net.minecraft.client.renderer.entity.EntityRenderDispatcher; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; -import net.minecraft.util.math.random.Random; +import net.minecraft.util.RandomSource; import java.util.List; import java.util.function.Supplier; @@ -46,70 +46,70 @@ @Deprecated @Environment(EnvType.CLIENT) public class ArchRegistryClient { - public static > void registerScreen(ScreenHandlerType type, ScreenFactory factory) { + public static > void registerScreen(MenuType type, ScreenFactory factory) { ClientLifecycleEvent.CLIENT_SETUP.register((state) -> { }); MenuScreenRegistry.registerScreenFactory(type, factory::create); } - public interface ScreenFactory> { - S create(H handler, PlayerInventory inventory, Text text); + public interface ScreenFactory> { + S create(H handler, Inventory inventory, Component text); } - public static void registerParticle(ParticleType type, ParticleFactory factory) { + public static void registerParticle(ParticleType type, ParticleProvider factory) { ParticleProviderRegistry.register(type, factory); } - public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { + public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { ParticleProviderRegistry.register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { @Override - public SpriteAtlasTexture getAtlas() { + public TextureAtlas getAtlas() { return spriteSet.getAtlas(); } @Override - public List getSprites() { + public List getSprites() { return spriteSet.getSprites(); } @Override - public Sprite getSprite(int age, int maxAge) { - return spriteSet.getSprite(age, maxAge); + public TextureAtlasSprite get(int age, int maxAge) { + return spriteSet.get(age, maxAge); } @Override - public Sprite getSprite(Random random) { - return spriteSet.getSprite(random); + public TextureAtlasSprite get(RandomSource random) { + return spriteSet.get(random); } @Override - public Sprite getFirst() { - return spriteSet.getFirst(); + public TextureAtlasSprite first() { + return spriteSet.first(); } })); } - public static void registerEntityRenderer(Supplier> type, EntityRendererFactory provider) { + public static void registerEntityRenderer(Supplier> type, EntityRendererProvider provider) { EntityRendererRegistry.register(type, provider); } @FunctionalInterface - public interface DeferredParticleProvider { - ParticleFactory create(ExtendedSpriteSet spriteSet); + public interface DeferredParticleProvider { + ParticleProvider create(ExtendedSpriteSet spriteSet); } - public interface ExtendedSpriteSet extends SpriteProvider { - SpriteAtlasTexture getAtlas(); + public interface ExtendedSpriteSet extends SpriteSet { + TextureAtlas getAtlas(); - List getSprites(); + List getSprites(); } public static void registryClientSpriteAtlasTexture(Identifier identifier) { //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, identifier); } - public static void registryClientSpriteAtlasTexture(Sprite sprite) { + public static void registryClientSpriteAtlasTexture(TextureAtlasSprite sprite) { //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, sprite); } @@ -117,13 +117,13 @@ public static void registryClientSprite(Identifier atlasId, Identifier identifie // ~1.19.2 } - public static void registryClientSprite(Identifier atlasId, Sprite sprite) { + public static void registryClientSprite(Identifier atlasId, TextureAtlasSprite sprite) { // ~1.19.2 } public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.renderDispatcher(), ctx.renderManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer() + ctx.blockEntityRenderDispatcher(), ctx.blockRenderDispatcher(), ctx.itemRenderer(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font() ))); } @@ -132,14 +132,14 @@ public interface BlockEntityRendererFactory create(BlockEntityRendererFactory.Context ctx); class Context { - private final BlockEntityRenderManager renderDispatcher; - private final BlockRenderManager renderManager; + private final BlockEntityRenderDispatcher renderDispatcher; + private final BlockRenderDispatcher renderManager; private final ItemRenderer itemRenderer; - private final EntityRenderManager entityRenderDispatcher; - private final LoadedEntityModels layerRenderDispatcher; - private final TextRenderer textRenderer; + private final EntityRenderDispatcher entityRenderDispatcher; + private final EntityModelSet layerRenderDispatcher; + private final Font textRenderer; - public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager renderManager, ItemRenderer itemRenderer, EntityRenderManager entityRenderDispatcher, LoadedEntityModels layerRenderDispatcher, TextRenderer textRenderer) { + public Context(BlockEntityRenderDispatcher renderDispatcher, BlockRenderDispatcher renderManager, ItemRenderer itemRenderer, EntityRenderDispatcher entityRenderDispatcher, EntityModelSet layerRenderDispatcher, Font textRenderer) { this.renderDispatcher = renderDispatcher; this.renderManager = renderManager; this.itemRenderer = itemRenderer; @@ -148,15 +148,15 @@ public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager ren this.textRenderer = textRenderer; } - public BlockEntityRenderManager getRenderDispatcher() { + public BlockEntityRenderDispatcher getRenderDispatcher() { return this.renderDispatcher; } - public BlockRenderManager getRenderManager() { + public BlockRenderDispatcher getRenderManager() { return this.renderManager; } - public EntityRenderManager getEntityRenderDispatcher() { + public EntityRenderDispatcher getEntityRenderDispatcher() { return this.entityRenderDispatcher; } @@ -164,26 +164,26 @@ public ItemRenderer getItemRenderer() { return this.itemRenderer; } - public LoadedEntityModels getLayerRenderDispatcher() { + public EntityModelSet getLayerRenderDispatcher() { return this.layerRenderDispatcher; } - public ModelPart getLayerModelPart(EntityModelLayer modelLayer) { - return this.layerRenderDispatcher.getModelPart(modelLayer); + public ModelPart getLayerModelPart(ModelLayerLocation modelLayer) { + return this.layerRenderDispatcher.bakeLayer(modelLayer); } - public TextRenderer getTextRenderer() { + public Font getTextRenderer() { return this.textRenderer; } } } - public static void registerRenderTypeBlock(RenderLayer layer, Block block) { - CompatRegistryClient.registerRenderTypeBlock(layer, block); + public static void registerRenderTypeBlock(RenderType layer, Block block) { + CompatRegistryClient2.registerRenderTypeBlock(layer, block); } - public static void registerRenderTypeFluid(RenderLayer layer, Fluid fluid) { - CompatRegistryClient.registerRenderTypeFluid(layer, fluid); + public static void registerRenderTypeFluid(RenderType layer, Fluid fluid) { + CompatRegistryClient2.registerRenderTypeFluid(layer, fluid); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java index 7fa99982f..f5de9bfde 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.client.registry; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.FlyingItemEntityRenderer; -import net.minecraft.entity.EntityType; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.ThrownItemRenderer; +import net.minecraft.world.entity.EntityType; import java.util.function.Supplier; public class EntityRendererRegistry { public static void registerEntityRendererAsFlyingItem(Supplier> entityType) { - CompatRegistryClient.registerEntityRenderer(entityType, (ctx -> (EntityRenderer) new FlyingItemEntityRenderer<>(ctx))); + CompatRegistryClient2.registerEntityRenderer(entityType, (ctx -> (EntityRenderer) new ThrownItemRenderer<>(ctx))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java index 1c081c238..1fd2330ef 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java @@ -1,37 +1,37 @@ package net.pitan76.mcpitanlib.api.client.registry; import dev.architectury.registry.client.keymappings.KeyMappingRegistry; -import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.KeyMapping; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; import net.pitan76.mcpitanlib.api.network.ClientNetworking; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; public class KeybindingRegistry { - public static void register(KeyBinding keyBinding) { + public static void register(KeyMapping keyBinding) { KeyMappingRegistry.register(keyBinding); } - public static void register(KeyBinding keyBinding, ClientTickEventRegistry.Client client) { + public static void register(KeyMapping keyBinding, ClientTickEventRegistry.Client client) { register(keyBinding); ClientTickEventRegistry.registerPost(client); } - public static void registerOnLevel(KeyBinding keyBinding, ClientTickEventRegistry.ClientLevel level) { + public static void registerOnLevel(KeyMapping keyBinding, ClientTickEventRegistry.ClientLevel level) { register(keyBinding); ClientTickEventRegistry.registerLevelPost(level); } - public static void registerWithNetwork(KeyBinding keyBinding, Identifier identifier) { + public static void registerWithNetwork(KeyMapping keyBinding, Identifier identifier) { register(keyBinding, client -> { - if (keyBinding.wasPressed()) + if (keyBinding.consumeClick()) ClientNetworking.send(identifier, PacketByteUtil.create()); }); } - public static void registerOnLevelWithNetwork(KeyBinding keyBinding, Identifier identifier) { + public static void registerOnLevelWithNetwork(KeyMapping keyBinding, Identifier identifier) { registerOnLevel(keyBinding, client -> { - if (keyBinding.wasPressed()) + if (keyBinding.consumeClick()) ClientNetworking.send(identifier, PacketByteUtil.create()); }); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java index e1c746e02..c6279645b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.api.client.registry.v2; -import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.KeyMapping; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class KeybindingRegistry extends net.pitan76.mcpitanlib.api.client.registry.KeybindingRegistry { - public static void registerWithNetwork(KeyBinding keyBinding, CompatIdentifier identifier) { + public static void registerWithNetwork(KeyMapping keyBinding, CompatIdentifier identifier) { registerWithNetwork(keyBinding, identifier.toMinecraft()); } - public static void registerOnLevelWithNetwork(KeyBinding keyBinding, CompatIdentifier identifier) { + public static void registerOnLevelWithNetwork(KeyMapping keyBinding, CompatIdentifier identifier) { registerOnLevelWithNetwork(keyBinding, identifier.toMinecraft()); } public static void registerWithNetwork(String translationKey, int code, String category, CompatIdentifier identifier) { - registerWithNetwork(new KeyBinding(translationKey, code, KeyBinding.Category.create(CompatIdentifier.of(category).toMinecraft())), identifier); + registerWithNetwork(new KeyMapping(translationKey, code, KeyMapping.Category.register(CompatIdentifier.of(category).toMinecraft())), identifier); } public static void registerOnLevelWithNetwork(String translationKey, int code, String category, CompatIdentifier identifier) { // TODO: categoryの互換性 - registerOnLevelWithNetwork(new KeyBinding(translationKey, code, KeyBinding.Category.create(CompatIdentifier.of(category).toMinecraft())), identifier); + registerOnLevelWithNetwork(new KeyMapping(translationKey, code, KeyMapping.Category.register(CompatIdentifier.of(category).toMinecraft())), identifier); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java index 6961e1ffd..b8d2ba66d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java @@ -1,46 +1,46 @@ package net.pitan76.mcpitanlib.api.client.render; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.RenderLayers; +import net.minecraft.client.renderer.rendertype.RenderType; +import net.minecraft.client.renderer.rendertype.RenderTypes; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class CompatRenderLayer { - public static final CompatRenderLayer CUTOUT = new CompatRenderLayer(RenderLayers.cutout()); - public static final CompatRenderLayer CUTOUT_MIPPED = new CompatRenderLayer(RenderLayers.cutout()); - public static final CompatRenderLayer TRANSLUCENT = new CompatRenderLayer(RenderLayers.glintTranslucent()); - public static final CompatRenderLayer TRANSLUCENT_MOVING_BLOCK = new CompatRenderLayer(RenderLayers.translucentMovingBlock()); - public static final CompatRenderLayer SOLID = new CompatRenderLayer(RenderLayers.solid()); - public static final CompatRenderLayer LINES = new CompatRenderLayer(RenderLayers.lines()); - public static final CompatRenderLayer LINE_STRIP = new CompatRenderLayer(RenderLayers.linesTranslucent()); - public static final CompatRenderLayer GLINT = new CompatRenderLayer(RenderLayers.glint()); - - public final RenderLayer layer; - - public CompatRenderLayer(RenderLayer layer) { + public static final CompatRenderLayer CUTOUT = new CompatRenderLayer(RenderTypes.cutoutMovingBlock()); + public static final CompatRenderLayer CUTOUT_MIPPED = new CompatRenderLayer(RenderTypes.cutoutMovingBlock()); + public static final CompatRenderLayer TRANSLUCENT = new CompatRenderLayer(RenderTypes.glintTranslucent()); + public static final CompatRenderLayer TRANSLUCENT_MOVING_BLOCK = new CompatRenderLayer(RenderTypes.translucentMovingBlock()); + public static final CompatRenderLayer SOLID = new CompatRenderLayer(RenderTypes.solidMovingBlock()); + public static final CompatRenderLayer LINES = new CompatRenderLayer(RenderTypes.lines()); + public static final CompatRenderLayer LINE_STRIP = new CompatRenderLayer(RenderTypes.linesTranslucent()); + public static final CompatRenderLayer GLINT = new CompatRenderLayer(RenderTypes.glint()); + + public final RenderType layer; + + public CompatRenderLayer(RenderType layer) { this.layer = layer; } - public RenderLayer raw() { + public RenderType raw() { return layer; } public static CompatRenderLayer getEntityCutout(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entityCutout(id.toMinecraft())); + return new CompatRenderLayer(RenderTypes.entityCutout(id.toMinecraft())); } public static CompatRenderLayer getEntityCutoutNoCull(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entityCutoutNoCull(id.toMinecraft())); + return new CompatRenderLayer(RenderTypes.entityCutoutNoCull(id.toMinecraft())); } public static CompatRenderLayer getEntityTranslucent(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entityTranslucent(id.toMinecraft())); + return new CompatRenderLayer(RenderTypes.entityTranslucent(id.toMinecraft())); } public static CompatRenderLayer getArmorCutoutNoCull(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.armorCutoutNoCull(id.toMinecraft())); + return new CompatRenderLayer(RenderTypes.armorCutoutNoCull(id.toMinecraft())); } public static CompatRenderLayer getEntitySolid(CompatIdentifier id) { - return new CompatRenderLayer(RenderLayers.entitySolid(id.toMinecraft())); + return new CompatRenderLayer(RenderTypes.entitySolid(id.toMinecraft())); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java index e262ba0a3..1270512a2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.client.render; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.Text; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.Screen; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; @@ -11,35 +11,35 @@ import org.joml.Matrix3x2fStack; public class DrawObjectDM { - private MatrixStack stack; + private PoseStack stack; private Matrix3x2fStack matrix3x2fStack; - private DrawContext context; + private GuiGraphics context; private Screen screen = null; - public DrawObjectDM(DrawContext context) { + public DrawObjectDM(GuiGraphics context) { this.context = context; - this.matrix3x2fStack = context.getMatrices(); + this.matrix3x2fStack = context.pose(); } public DrawObjectDM(Matrix3x2fStack matrix3x2fStack) { this.matrix3x2fStack = matrix3x2fStack; } - public DrawObjectDM(MatrixStack stack) { + public DrawObjectDM(PoseStack stack) { this.stack = stack; } - public DrawObjectDM(DrawContext context, Screen screen) { + public DrawObjectDM(GuiGraphics context, Screen screen) { this(context); this.screen = screen; } - public DrawContext getContext() { + public GuiGraphics getContext() { return context; } - public MatrixStack getStack() { + public PoseStack getStack() { return stack; } @@ -47,11 +47,11 @@ public Screen getScreen() { return screen; } - public void setContext(DrawContext context) { + public void setContext(GuiGraphics context) { this.context = context; } - public void setStack(MatrixStack stack) { + public void setStack(PoseStack stack) { this.stack = stack; } @@ -71,11 +71,11 @@ public void drawTexture(CompatIdentifier texture, int x, int y, float u, float v RendererUtil.drawTexture(this, texture, x, y, u, v, width, height, textureWidth, textureHeight); } - public void drawText(Text text, int x, int y) { + public void drawText(Component text, int x, int y) { RendererUtil.drawText(RendererUtil.getTextRenderer(), this, text, x, y); } - public void drawTooltip(Text text, int x, int y) { + public void drawTooltip(Component text, int x, int y) { RendererUtil.drawTooltip(this, text, x, y); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java index 37e2df47d..c69abb2f5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java @@ -1,22 +1,22 @@ package net.pitan76.mcpitanlib.api.client.render; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.renderer.texture.OverlayTexture; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.blaze3d.vertex.PoseStack; import net.pitan76.mcpitanlib.api.util.client.render.VertexConsumerUtil; import org.joml.Matrix3f; import org.joml.Matrix4f; public class DrawObjectMV { - private final MatrixStack stack; + private final PoseStack stack; private final VertexConsumer buffer; - public DrawObjectMV(MatrixStack stack, VertexConsumer buffer) { + public DrawObjectMV(PoseStack stack, VertexConsumer buffer) { this.stack = stack; this.buffer = buffer; } - public DrawObjectMV(MatrixStack stack) { + public DrawObjectMV(PoseStack stack) { this(stack, null); } @@ -24,7 +24,7 @@ public DrawObjectMV(VertexConsumer buffer) { this(null, buffer); } - public MatrixStack getStack() { + public PoseStack getStack() { return stack; } @@ -73,14 +73,14 @@ public DrawObjectMV overlayDefaultUV() { public Matrix4f getMatrix4f() { if (matrix4f == null) - matrix4f = stack.peek().getPositionMatrix(); + matrix4f = stack.last().pose(); return matrix4f; } public Matrix3f getMatrix3f() { if (matrix3f == null) - matrix3f = stack.peek().getNormalMatrix(); + matrix3f = stack.last().normal(); return matrix3f; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java index d1d343924..6655fb13e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.client.render; -import net.minecraft.client.model.ModelData; +import net.minecraft.client.model.geom.builders.MeshDefinition; public class EntityModelLayerContext { - private final ModelData data; + private final MeshDefinition data; private final int width; private final int height; - public EntityModelLayerContext(ModelData data, int width, int height) { + public EntityModelLayerContext(MeshDefinition data, int width, int height) { this.data = data; this.width = width; this.height = height; @@ -21,7 +21,7 @@ public int getWidth() { return width; } - public ModelData getData() { + public MeshDefinition getData() { return data; } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java index 7e70f8046..be2a43dfb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.client.render.block.entity; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.minecraft.client.render.command.OrderedRenderCommandQueue; -import net.minecraft.client.render.state.CameraRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Vec3d; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.state.CameraRenderState; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.world.phys.Vec3; import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; @@ -14,32 +14,32 @@ public interface CompatBlockEntityRenderer extends BlockEntityRenderer { void render(BlockEntityRenderEvent event); - default void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { + default void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay, Vec3 cameraPos) { render(new BlockEntityRenderEvent<>(this, entity, tickProgress, matrices, vertexConsumers, light, overlay)); } @Override - default void render(S state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { + default void submit(S state, PoseStack matrices, SubmitNodeCollector queue, CameraRenderState cameraState) { render(new BlockEntityRenderEvent<>(this, state, matrices, queue, cameraState)); } default boolean rendersOutsideBoundingBoxOverride(T blockEntity) { - return BlockEntityRenderer.super.rendersOutsideBoundingBox(); + return BlockEntityRenderer.super.shouldRenderOffScreen(); } default int getRenderDistanceOverride() { - return BlockEntityRenderer.super.getRenderDistance(); + return BlockEntityRenderer.super.getViewDistance(); } @Deprecated @Override - default boolean rendersOutsideBoundingBox() { + default boolean shouldRenderOffScreen() { return rendersOutsideBoundingBoxOverride(null); } @Deprecated @Override - default int getRenderDistance() { + default int getViewDistance() { return getRenderDistanceOverride(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java index 67ed76f71..3c1333054 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java @@ -1,19 +1,19 @@ package net.pitan76.mcpitanlib.api.client.render.block.entity.event; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.BlockRenderLayer; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.minecraft.client.render.command.OrderedRenderCommandQueue; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.render.state.CameraRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.chunk.ChunkSectionLayer; +import net.minecraft.client.renderer.rendertype.RenderType; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.state.CameraRenderState; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; import net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer; @@ -28,12 +28,12 @@ public class BlockEntityRenderEvent { public T blockEntity; public float tickDelta; - public MatrixStack matrices; - public VertexConsumerProvider vertexConsumers; + public PoseStack matrices; + public MultiBufferSource vertexConsumers; int light; int overlay; - public BlockEntityRenderEvent(T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { + public BlockEntityRenderEvent(T blockEntity, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { this.blockEntity = blockEntity; this.tickDelta = tickDelta; this.matrices = matrices; @@ -43,11 +43,11 @@ public BlockEntityRenderEvent(T blockEntity, float tickDelta, MatrixStack matric } private BlockEntityRenderState state; - private OrderedRenderCommandQueue queue; + private SubmitNodeCollector queue; private CameraRenderState cameraState; - public BlockEntityRenderEvent(S state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { + public BlockEntityRenderEvent(S state, PoseStack matrices, SubmitNodeCollector queue, CameraRenderState cameraState) { this.state = state; this.queue = queue; this.cameraState = cameraState; @@ -55,18 +55,18 @@ public BlockEntityRenderEvent(S state, Matrix this.matrices = matrices; this.queue = queue; this.cameraState = cameraState; - this.tickDelta = MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); - BlockEntity blockEntity = state.type.get(MinecraftClient.getInstance().world, state.pos); + this.tickDelta = Minecraft.getInstance().getDeltaTracker().getGameTimeDeltaTicks(); + BlockEntity blockEntity = state.blockEntityType.getBlockEntity(Minecraft.getInstance().level, state.blockPos); if (blockEntity instanceof CompatBlockEntity) { this.blockEntity = (T) blockEntity; } else { //throw new IllegalArgumentException("BlockEntityRenderEvent: BlockEntity is not an instance of CompatBlockEntity"); } - this.vertexConsumers = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers(); - this.light = state.lightmapCoordinates; - if (state.crumblingOverlay != null) - this.overlay = state.crumblingOverlay.progress(); + this.vertexConsumers = Minecraft.getInstance().renderBuffers().bufferSource(); + this.light = state.lightCoords; + if (state.breakProgress != null) + this.overlay = state.breakProgress.progress(); else this.overlay = 0; } @@ -75,7 +75,7 @@ public T getBlockEntity() { return blockEntity; } - public MatrixStack getMatrices() { + public PoseStack getMatrices() { return matrices; } @@ -91,7 +91,7 @@ public int getOverlay() { return overlay; } - public VertexConsumer getVertexConsumer(RenderLayer layer) { + public VertexConsumer getVertexConsumer(RenderType layer) { return vertexConsumers.getBuffer(layer); } @@ -99,7 +99,7 @@ public VertexConsumer getVertexConsumer(CompatRenderLayer layer) { return getVertexConsumer(layer.raw()); } - public VertexConsumerProvider getVertexConsumers() { + public MultiBufferSource getVertexConsumers() { return vertexConsumers; } @@ -140,20 +140,20 @@ public DrawObjectMV getDrawObject(CompatRenderLayer layer) { public Matrix4f getMatrix4f() { if (matrix4f == null) - matrix4f = matrices.peek().getPositionMatrix(); + matrix4f = matrices.last().pose(); return matrix4f; } public Matrix3f getMatrix3f() { if (matrix3f == null) - matrix3f = matrices.peek().getNormalMatrix(); + matrix3f = matrices.last().normal(); return matrix3f; } public BlockPos getPos() { - return state.pos; + return state.blockPos; } public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { @@ -163,16 +163,16 @@ public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { //---- @Deprecated - public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; + public CompatRegistryClient2.BlockEntityRendererFactory.Context ctx; - public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { + public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, T blockEntity, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { this(blockEntity, tickDelta, matrices, vertexConsumers, light, overlay); if (renderer instanceof net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) { this.ctx = ((net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) renderer).ctx; } } - public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, BlockEntityRenderState state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState) { + public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, BlockEntityRenderState state, PoseStack matrices, SubmitNodeCollector queue, CameraRenderState cameraState) { this(state, matrices, queue, cameraState); if (renderer instanceof net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) { this.ctx = ((net.pitan76.mcpitanlib.api.client.render.block.entity.v2.CompatBlockEntityRenderer) renderer).ctx; @@ -184,7 +184,7 @@ public void renderItemFixed(ItemStack stack) { } @Deprecated - public OrderedRenderCommandQueue getQueue() { + public SubmitNodeCollector getQueue() { return queue; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java index 8af118910..6839a8f33 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.client.render.block.entity.event; -import net.minecraft.client.render.block.entity.BlockEntityRenderManager; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; import net.pitan76.mcpitanlib.api.util.client.ClientUtil; public class CompatBlockEntityRendererConstructArgs { - public final BlockEntityRenderManager dispatcher; + public final BlockEntityRenderDispatcher dispatcher; - public CompatBlockEntityRendererConstructArgs(BlockEntityRenderManager dispatcher) { + public CompatBlockEntityRendererConstructArgs(BlockEntityRenderDispatcher dispatcher) { this.dispatcher = dispatcher; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java index c28f891a7..39393d64f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.client.render.block.entity.v2; -import net.minecraft.client.render.block.entity.state.BlockEntityRenderState; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; import net.pitan76.mcpitanlib.api.client.render.block.entity.event.CompatBlockEntityRendererConstructArgs; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; public abstract class CompatBlockEntityRenderer implements net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer { @Deprecated - public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; + public CompatRegistryClient2.BlockEntityRendererFactory.Context ctx; public CompatBlockEntityRenderer(CompatBlockEntityRendererConstructArgs args) { } - public CompatBlockEntityRenderer(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { + public CompatBlockEntityRenderer(CompatRegistryClient2.BlockEntityRendererFactory.Context ctx) { this.ctx = ctx; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java index 03467b2a7..d0340c3be 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java @@ -3,9 +3,9 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import dev.architectury.event.events.common.CommandRegistrationEvent; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.Commands; +import net.minecraft.commands.CommandSourceStack; import net.pitan76.mcpitanlib.api.command.argument.*; import net.pitan76.mcpitanlib.api.event.*; @@ -14,7 +14,7 @@ public class CommandRegistry { @Deprecated - public static CommandRegistryAccess latestCommandRegistryAccess; + public static CommandBuildContext latestCommandRegistryAccess; public static void register(String name, LiteralCommand command) { CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { @@ -23,7 +23,7 @@ public static void register(String name, LiteralCommand command) { CommandSettings settings = new CommandSettings(); command.init(settings); - LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(name).requires(settings::requires) + LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(name).requires(settings::requires) .executes(context -> { ServerCommandEvent event = new ServerCommandEvent(); event.setContext(context); @@ -38,7 +38,7 @@ public static void register(String name, LiteralCommand command) { }); } - public static void register(LiteralArgumentBuilder builder) { + public static void register(LiteralArgumentBuilder builder) { CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { latestCommandRegistryAccess = registry; dispatcher.register(builder); @@ -46,17 +46,17 @@ public static void register(LiteralArgumentBuilder builder) ); } - private static > void forArgsCmd(AbstractCommand absCmd, ArgumentBuilder builder) { + private static > void forArgsCmd(AbstractCommand absCmd, ArgumentBuilder builder) { if (!absCmd.getArgumentCommands().isEmpty()) { // 引数コマンド for (Map.Entry> argCmd : absCmd.getArgumentCommands().entrySet()) { - ArgumentBuilder nextBuilder = null; + ArgumentBuilder nextBuilder = null; argCmd.getValue().init(new CommandSettings()); if (argCmd.getValue() instanceof LiteralCommand) { LiteralCommand command = (LiteralCommand) argCmd.getValue(); - nextBuilder = CommandManager.literal(argCmd.getKey()) + nextBuilder = Commands.literal(argCmd.getKey()) .executes(context -> { ServerCommandEvent event = new ServerCommandEvent(); event.setContext(context); @@ -70,7 +70,7 @@ private static > void forArgsC if (argCmd.getValue() instanceof RequiredCommand) { RequiredCommand command = (RequiredCommand) argCmd.getValue(); - nextBuilder = CommandManager.argument(argCmd.getKey(), command.getArgumentType()) + nextBuilder = Commands.argument(argCmd.getKey(), command.getArgumentType()) .executes(context -> { ServerCommandEvent event = new ServerCommandEvent(); if (command instanceof IntegerCommand) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java index 724a3615a..8e7326e64 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java @@ -1,27 +1,27 @@ package net.pitan76.mcpitanlib.api.command; -import net.minecraft.command.permission.Permission; -import net.minecraft.command.permission.PermissionLevel; -import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.server.permissions.Permission; +import net.minecraft.server.permissions.PermissionLevel; +import net.minecraft.commands.CommandSourceStack; public class CommandSettings { private int permissionLevel = -1; private ICustom iCustom = null; - private Permission.Level _level = null; + private Permission.HasCommandLevel _level = null; - public boolean requires(ServerCommandSource source) { + public boolean requires(CommandSourceStack source) { if (customRequires(source)) { if (permissionLevel == -1) return true; if (_level == null) - _level = new Permission.Level(PermissionLevel.fromLevel(permissionLevel)); + _level = new Permission.HasCommandLevel(PermissionLevel.byId(permissionLevel)); - return source.getPermissions().hasPermission(_level); + return source.permissions().hasPermission(_level); } return false; } - private boolean customRequires(ServerCommandSource source) { + private boolean customRequires(CommandSourceStack source) { if (iCustom == null) return true; return iCustom.custom(source); } @@ -38,6 +38,6 @@ public CommandSettings custom(ICustom iCustom) { @FunctionalInterface public interface ICustom { - boolean custom(ServerCommandSource source); + boolean custom(CommandSourceStack source); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java index 452c85dac..992b43c29 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.command.argument; -import net.minecraft.block.Block; -import net.minecraft.command.argument.BlockStateArgumentType; +import net.minecraft.world.level.block.Block; +import net.minecraft.commands.arguments.blocks.BlockStateArgument; import net.pitan76.mcpitanlib.api.command.CommandRegistry; import net.pitan76.mcpitanlib.api.event.BlockCommandEvent; import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; public abstract class BlockCommand extends RequiredCommand { @Override - public BlockStateArgumentType getArgumentType() { - return BlockStateArgumentType.blockState(CommandRegistry.latestCommandRegistryAccess); + public BlockStateArgument getArgumentType() { + return BlockStateArgument.block(CommandRegistry.latestCommandRegistryAccess); } public abstract void execute(BlockCommandEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java index 4157c76d3..e30a2651b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.command.argument; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.event.EntitiesCommandEvent; import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; public abstract class EntitiesCommand extends RequiredCommand { @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.entities(); + public EntityArgument getArgumentType() { + return EntityArgument.entities(); } public abstract void execute(EntitiesCommandEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java index cf0c76ec6..0af7e0e0c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.command.argument; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.event.EntityCommandEvent; import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; public abstract class EntityCommand extends RequiredCommand { @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.entity(); + public EntityArgument getArgumentType() { + return EntityArgument.entity(); } public abstract void execute(EntityCommandEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java index 2d24871bc..aeaac8193 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.command.argument; -import net.minecraft.command.argument.ItemStackArgumentType; -import net.minecraft.item.Item; +import net.minecraft.commands.arguments.item.ItemArgument; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.command.CommandRegistry; import net.pitan76.mcpitanlib.api.event.ItemCommandEvent; import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; public abstract class ItemCommand extends RequiredCommand { @Override - public ItemStackArgumentType getArgumentType() { - return ItemStackArgumentType.itemStack(CommandRegistry.latestCommandRegistryAccess); + public ItemArgument getArgumentType() { + return ItemArgument.item(CommandRegistry.latestCommandRegistryAccess); } public abstract void execute(ItemCommandEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java index 3a674b908..c9e444c7d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.command.argument; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.event.PlayerCommandEvent; import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; public abstract class PlayerCommand extends RequiredCommand { @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.player(); + public EntityArgument getArgumentType() { + return EntityArgument.player(); } public abstract void execute(PlayerCommandEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java index 195d81d3b..0003ec262 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.command.argument; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.event.PlayersCommandEvent; import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; public abstract class PlayersCommand extends RequiredCommand { @Override - public EntityArgumentType getArgumentType() { - return EntityArgumentType.players(); + public EntityArgument getArgumentType() { + return EntityArgument.players(); } public abstract void execute(PlayersCommandEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java b/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java index d930e9da9..a6a795834 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.api.enchantment; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.ItemStack; +import net.minecraft.data.registries.VanillaRegistries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; +import net.minecraft.core.Holder; import net.minecraft.resources.Identifier; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.EnchantmentUtil; import org.jetbrains.annotations.Nullable; import java.util.Optional; public class CompatEnchantment { - private final RegistryKey registryKey; + private final ResourceKey registryKey; @Deprecated - public CompatEnchantment(RegistryKey registryKey) { + public CompatEnchantment(ResourceKey registryKey) { this.registryKey = registryKey; } @@ -27,11 +27,11 @@ public CompatEnchantment of(Identifier identifier) { } public Identifier getId() { - return registryKey.getRegistry(); + return registryKey.registry(); } @Deprecated - public RegistryKey getRegistryKey() { + public ResourceKey getRegistryKey() { return registryKey; } @@ -47,23 +47,23 @@ public boolean equals(Object obj) { } @Deprecated - public RegistryEntry getEntry(@Nullable World world) { - Optional> optionalEntry; + public Holder getEntry(@Nullable Level world) { + Optional> optionalEntry; if (world == null) { - optionalEntry = BuiltinRegistries.createWrapperLookup() - .getOptionalEntry(registryKey); + optionalEntry = VanillaRegistries.createLookup() + .get(registryKey); } else { - optionalEntry = world.getRegistryManager().getOptionalEntry(registryKey); + optionalEntry = world.registryAccess().get(registryKey); } return optionalEntry.orElseThrow(); } - public Enchantment getEnchantment(@Nullable World world) { + public Enchantment getEnchantment(@Nullable Level world) { return getEntry(world).value(); } - public int getLevel(ItemStack stack, @Nullable World world) { - return EnchantmentHelper.getLevel(getEntry(world), stack); + public int getLevel(ItemStack stack, @Nullable Level world) { + return EnchantmentHelper.getItemEnchantmentLevel(getEntry(world), stack); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java index 2dab01c35..2d9fd5bfa 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.entity; -import net.minecraft.entity.ContainerUser; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.ContainerUser; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; public class CompatContainerUser { protected ContainerUser containerUser; @@ -16,15 +16,15 @@ public double getContainerInteractionRange() { } public LivingEntity asLivingEntity() { - return containerUser.asLivingEntity(); + return containerUser.getLivingEntity(); } public boolean isPlayer() { - return containerUser instanceof PlayerEntity; + return containerUser instanceof Player; } public Player asPlayer() { - return new Player((PlayerEntity) containerUser); + return new Player((Player) containerUser); } @Deprecated diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java index a5963fa7b..6b99202db 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.api.entity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.Packet; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.entity.InitDataTrackerArgs; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; @@ -20,18 +20,18 @@ import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; public class CompatEntity extends Entity { - public CompatEntity(EntityType type, World world) { + public CompatEntity(EntityType type, Level world) { super(type, world); } @Deprecated @Override - public void initDataTracker(DataTracker.Builder builder) { + public void defineSynchedData(SynchedEntityData.Builder builder) { initDataTracker(new InitDataTrackerArgs(builder)); } @Override - public boolean damage(ServerWorld world, DamageSource source, float amount) { + public boolean hurtServer(ServerLevel world, DamageSource source, float amount) { return false; } @@ -40,81 +40,81 @@ public void initDataTracker(InitDataTrackerArgs args) { } public void readCustomDataFromNbt(ReadNbtArgs nbt) { - readCustomData(nbt.view); + readAdditionalSaveData(nbt.view); } public void writeCustomDataToNbt(WriteNbtArgs nbt) { - writeCustomData(nbt.view); + addAdditionalSaveData(nbt.view); } @Deprecated @Override - protected void readCustomData(ReadView view) { - NbtCompound nbt = NbtDataConverter.data2nbt(view); + protected void readAdditionalSaveData(ValueInput view) { + CompoundTag nbt = NbtDataConverter.data2nbt(view); readCustomDataFromNbt(new ReadNbtArgs(nbt, view)); } @Deprecated @Override - protected void writeCustomData(WriteView view) { - NbtCompound nbt = new NbtCompound(); + protected void addAdditionalSaveData(ValueOutput view) { + CompoundTag nbt = new CompoundTag(); writeCustomDataToNbt(new WriteNbtArgs(nbt, view)); NbtDataConverter.nbt2writeData(nbt, view); } - public Packet createSpawnPacket() { + public Packet createSpawnPacket() { return null; } public void writeNbt(WriteNbtArgs args) { - writeData(args.view); + saveWithoutId(args.view); } public void readNbt(ReadNbtArgs args) { - readData(args.view); + load(args.view); } @Deprecated @Override - public void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = new NbtCompound(); + public void saveWithoutId(ValueOutput view) { + super.saveWithoutId(view); + CompoundTag nbt = new CompoundTag(); writeNbt(new WriteNbtArgs(nbt, view)); NbtDataConverter.nbt2writeData(nbt, view); } @Deprecated @Override - public void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); + public void load(ValueInput view) { + super.load(view); + CompoundTag nbt = NbtDataConverter.data2nbt(view); readNbt(new ReadNbtArgs(nbt, view)); } @Deprecated @Override - public World getEntityWorld() { + public Level level() { return callGetWorld(); } - public World callGetWorld() { - return super.getEntityWorld(); + public Level callGetWorld() { + return super.level(); } public BlockPos callGetBlockPos() { - return getBlockPos(); + return blockPosition(); } - public Vec3d callGetPos() { - return getEntityPos(); + public Vec3 callGetPos() { + return position(); } public boolean hasServerWorld() { - return callGetWorld() instanceof ServerWorld; + return callGetWorld() instanceof ServerLevel; } - public ServerWorld getServerWorld() { - return (ServerWorld) getEntityWorld(); + public ServerLevel getServerWorld() { + return (ServerLevel) level(); } public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java index 128049f42..9c31ac538 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.projectile.thrown.ThrownItemEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.world.World; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.world.entity.projectile.throwableitemprojectile.ThrowableItemProjectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.entity.CollisionEvent; import net.pitan76.mcpitanlib.api.event.entity.EntityHitEvent; import net.pitan76.mcpitanlib.api.event.entity.InitDataTrackerArgs; @@ -20,17 +20,17 @@ import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; -public abstract class CompatThrownItemEntity extends ThrownItemEntity { +public abstract class CompatThrownItemEntity extends ThrowableItemProjectile { - public CompatThrownItemEntity(EntityType entityType, World world) { + public CompatThrownItemEntity(EntityType entityType, Level world) { super(entityType, world); } - public CompatThrownItemEntity(EntityType entityType, double d, double e, double f, World world) { + public CompatThrownItemEntity(EntityType entityType, double d, double e, double f, Level world) { super(entityType, d, e, f, world, ItemStackUtil.empty()); } - public CompatThrownItemEntity(EntityType entityType, LivingEntity livingEntity, World world) { + public CompatThrownItemEntity(EntityType entityType, LivingEntity livingEntity, Level world) { super(entityType, livingEntity, world, ItemStackUtil.empty()); } @@ -43,12 +43,12 @@ protected Item getDefaultItem() { } public ItemStack callGetItem() { - return super.getStack(); + return super.getItem(); } @Deprecated @Override - public ItemStack getStack() { + public ItemStack getItem() { return callGetItem(); } @@ -63,32 +63,32 @@ public void setItem(ItemStack stack) { } public void callHandleStatus(byte status) { - super.handleStatus(status); + super.handleEntityEvent(status); } @Deprecated @Override - public void handleStatus(byte status) { + public void handleEntityEvent(byte status) { callHandleStatus(status); } public void onEntityHit(EntityHitEvent event) { - super.onEntityHit(event.entityHitResult); + super.onHitEntity(event.entityHitResult); } @Deprecated @Override - protected void onEntityHit(EntityHitResult entityHitResult) { + protected void onHitEntity(EntityHitResult entityHitResult) { onEntityHit(new EntityHitEvent(entityHitResult)); } public void onCollision(CollisionEvent event) { - super.onCollision(event.hitResult); + super.onHit(event.hitResult); } @Deprecated @Override - protected void onCollision(HitResult hitResult) { + protected void onHit(HitResult hitResult) { onCollision(new CollisionEvent(hitResult)); } @@ -96,64 +96,64 @@ protected void onCollision(HitResult hitResult) { @Deprecated @Override - public void initDataTracker(DataTracker.Builder builder) { - initDataTracker(new InitDataTrackerArgs(builder, dataTracker)); + public void defineSynchedData(SynchedEntityData.Builder builder) { + initDataTracker(new InitDataTrackerArgs(builder, entityData)); } public void initDataTracker(InitDataTrackerArgs args) { - super.initDataTracker(args.getBuilder()); + super.defineSynchedData(args.getBuilder()); } public void readCustomDataFromNbt(ReadNbtArgs nbt) { - super.readCustomData(nbt.view); + super.readAdditionalSaveData(nbt.view); } public void writeCustomDataToNbt(WriteNbtArgs nbt) { - super.writeCustomData(nbt.view); + super.addAdditionalSaveData(nbt.view); } @Deprecated @Override - protected void readCustomData(ReadView view) { - NbtCompound nbt = NbtDataConverter.data2nbt(view); + protected void readAdditionalSaveData(ValueInput view) { + CompoundTag nbt = NbtDataConverter.data2nbt(view); readCustomDataFromNbt(new ReadNbtArgs(nbt, view)); } @Deprecated @Override - protected void writeCustomData(WriteView view) { - NbtCompound nbt = new NbtCompound(); + protected void addAdditionalSaveData(ValueOutput view) { + CompoundTag nbt = new CompoundTag(); writeCustomDataToNbt(new WriteNbtArgs(nbt, view)); NbtDataConverter.nbt2writeData(nbt, view); } public void writeNbt(WriteNbtArgs args) { - super.writeData(args.view); + super.saveWithoutId(args.view); } public void readNbt(ReadNbtArgs args) { - super.readData(args.view); + super.load(args.view); } @Deprecated @Override - public void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = new NbtCompound(); + public void saveWithoutId(ValueOutput view) { + super.saveWithoutId(view); + CompoundTag nbt = new CompoundTag(); writeNbt(new WriteNbtArgs(nbt, view)); NbtDataConverter.nbt2writeData(nbt, view); } @Deprecated @Override - public void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); + public void load(ValueInput view) { + super.load(view); + CompoundTag nbt = NbtDataConverter.data2nbt(view); readNbt(new ReadNbtArgs(nbt, view)); } @Override - public World getEntityWorld() { - return super.getEntityWorld(); + public Level level() { + return super.level(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java index 933e0d8fc..e6835bd8e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.entity; import com.google.common.collect.ImmutableSet; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.loot.LootTable; -import net.minecraft.registry.RegistryKey; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.resources.ResourceKey; import net.pitan76.mcpitanlib.MCPitanLib; import java.util.Optional; public class EntityTypeBuilder { - private SpawnGroup spawnGroup; + private MobCategory spawnGroup; private ExtendEntityType.EntityFactory factory; private EntityDimensions entityDimensions; private boolean saveable; @@ -26,7 +26,7 @@ public class EntityTypeBuilder { private int trackTickInterval; private Boolean alwaysUpdateVelocity = null; private String translationKey = "entity." + MCPitanLib.MOD_ID; - private Optional> lootTable = Optional.empty(); + private Optional> lootTable = Optional.empty(); @Deprecated // Recommend: create() @@ -42,7 +42,7 @@ public EntityTypeBuilder() { } @Deprecated - public EntityTypeBuilder(SpawnGroup spawnGroup, ExtendEntityType.EntityFactory factory) { + public EntityTypeBuilder(MobCategory spawnGroup, ExtendEntityType.EntityFactory factory) { this(); this.spawnGroup = spawnGroup; this.factory = factory; @@ -52,7 +52,7 @@ public static EntityTypeBuilder create() { return new EntityTypeBuilder<>(); } - public static EntityTypeBuilder create(SpawnGroup spawnGroup, ExtendEntityType.EntityFactory factory) { + public static EntityTypeBuilder create(MobCategory spawnGroup, ExtendEntityType.EntityFactory factory) { return new EntityTypeBuilder<>(spawnGroup, factory); } @@ -60,7 +60,7 @@ public EntityType build() { return new ExtendEntityType<>(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, maxTrackDistance, trackTickInterval, translationKey, lootTable, alwaysUpdateVelocity); } - public EntityTypeBuilder setSpawnGroup(SpawnGroup spawnGroup) { + public EntityTypeBuilder setSpawnGroup(MobCategory spawnGroup) { this.spawnGroup = spawnGroup; return this; } @@ -80,7 +80,7 @@ public EntityTypeBuilder setFixedDimensions(float width, float height) { } public EntityTypeBuilder setChangingDimensions(float width, float height) { - return setDimensions(EntityDimensions.changing(width, height)); + return setDimensions(EntityDimensions.scalable(width, height)); } public EntityTypeBuilder setSaveable(boolean saveable) { @@ -127,7 +127,7 @@ public void setTranslationKey(String translationKey) { this.translationKey = translationKey; } - public void setLootTable(RegistryKey lootTable) { + public void setLootTable(ResourceKey lootTable) { this.lootTable = Optional.ofNullable(lootTable); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java index 29245d975..ee004c2e6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java @@ -1,47 +1,47 @@ package net.pitan76.mcpitanlib.api.entity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.Packet; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.nbt.NbtTag; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; public class ExtendEntity extends Entity { - public ExtendEntity(EntityType type, World world) { + public ExtendEntity(EntityType type, Level world) { super(type, world); } @Deprecated @Override - public void initDataTracker(DataTracker.Builder builder) { + public void defineSynchedData(SynchedEntityData.Builder builder) { initDataTracker(); } @Override - public boolean damage(ServerWorld world, DamageSource source, float amount) { + public boolean hurtServer(ServerLevel world, DamageSource source, float amount) { return false; } public void initDataTracker() { } - public void readCustomDataFromNbt(NbtCompound nbt) { + public void readCustomDataFromNbt(CompoundTag nbt) { } - public void writeCustomDataToNbt(NbtCompound nbt) { + public void writeCustomDataToNbt(CompoundTag nbt) { } - public Packet createSpawnPacket() { + public Packet createSpawnPacket() { return null; } @@ -56,47 +56,47 @@ public void readNbt(NbtTag nbt) { @Deprecated @Override - public void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = new NbtCompound(); + public void saveWithoutId(ValueOutput view) { + super.saveWithoutId(view); + CompoundTag nbt = new CompoundTag(); writeNbt(NbtTag.from(nbt)); NbtDataConverter.nbt2writeData(nbt, view); } @Deprecated @Override - public void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); + public void load(ValueInput view) { + super.load(view); + CompoundTag nbt = NbtDataConverter.data2nbt(view); readNbt(NbtTag.from(nbt)); } @Override - protected void readCustomData(ReadView view) { - NbtCompound nbt = NbtDataConverter.data2nbt(view); + protected void readAdditionalSaveData(ValueInput view) { + CompoundTag nbt = NbtDataConverter.data2nbt(view); readCustomDataFromNbt(nbt); } @Override - protected void writeCustomData(WriteView view) { - NbtCompound nbt = new NbtCompound(); + protected void addAdditionalSaveData(ValueOutput view) { + CompoundTag nbt = new CompoundTag(); writeCustomDataToNbt(nbt); NbtDataConverter.nbt2writeData(nbt, view); } // 1.14 - public NbtCompound toTag(NbtCompound nbt) { + public CompoundTag toTag(CompoundTag nbt) { this.writeNbt(NbtTag.from(nbt)); return nbt; } - public NbtCompound fromTag(NbtCompound nbt) { + public CompoundTag fromTag(CompoundTag nbt) { this.readNbt(NbtTag.from(nbt)); return nbt; } @Override - public World getEntityWorld() { - return super.getEntityWorld(); + public Level level() { + return super.level(); } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java index 207e9c949..e62aa7c88 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.entity; import com.google.common.collect.ImmutableSet; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.loot.LootTable; -import net.minecraft.registry.RegistryKey; -import net.minecraft.resource.featuretoggle.FeatureFlags; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.level.Level; import java.util.Optional; @@ -17,25 +17,25 @@ public class ExtendEntityType extends EntityType { private final Boolean alwaysUpdateVelocity; @Deprecated - public ExtendEntityType(EntityFactory factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { - super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_ENABLED_FEATURES, spawnGroup.isPeaceful()); + public ExtendEntityType(EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { + super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_FLAGS, spawnGroup.isFriendly()); this.alwaysUpdateVelocity = alwaysUpdateVelocity; } - public ExtendEntityType(EntityFactory factory, SpawnGroup spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { - super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, 5, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_ENABLED_FEATURES, spawnGroup.isPeaceful()); + public ExtendEntityType(EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnBlocks, EntityDimensions entityDimensions, int maxTrackDistance, int trackTickInterval, String translationKey, Optional> lootTable, Boolean alwaysUpdateVelocity) { + super((factory::create), spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnBlocks, entityDimensions, 5, maxTrackDistance, trackTickInterval, translationKey, lootTable, FeatureFlags.DEFAULT_FLAGS, spawnGroup.isFriendly()); this.alwaysUpdateVelocity = alwaysUpdateVelocity; } @Override - public boolean alwaysUpdateVelocity() { + public boolean trackDeltas() { if (alwaysUpdateVelocity != null) return alwaysUpdateVelocity; - return super.alwaysUpdateVelocity(); + return super.trackDeltas(); } public interface EntityFactory { - T create(EntityType type, World world); + T create(EntityType type, Level world); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index b86188772..1502598fc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -3,38 +3,38 @@ import dev.architectury.registry.menu.ExtendedMenuProvider; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.NbtComponent; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.player.ItemCooldownManager; -import net.minecraft.entity.player.PlayerAbilities; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayNetworkHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.stat.Stat; -import net.minecraft.stat.StatType; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.text.Text; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.Hand; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.component.CustomData; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemCooldowns; +import net.minecraft.world.entity.player.Abilities; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.stats.Stat; +import net.minecraft.stats.StatType; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.network.chat.Component; +import net.minecraft.util.ProblemReporter; +import net.minecraft.world.InteractionHand; import net.minecraft.resources.Identifier; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.core.NonNullList; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; import net.pitan76.mcpitanlib.api.gui.ExtendedNamedScreenHandlerFactory; @@ -55,17 +55,17 @@ PlayerEntity helper */ public class Player { - private final PlayerEntity entity; + private final net.minecraft.world.entity.player.Player entity; - public PlayerEntity getEntity() { + public net.minecraft.world.entity.player.Player getEntity() { return entity; } - public PlayerEntity getPlayerEntity() { + public net.minecraft.world.entity.player.Player getPlayerEntity() { return getEntity(); } - public Player(PlayerEntity playerEntity) { + public Player(net.minecraft.world.entity.player.Player playerEntity) { this.entity = playerEntity; } @@ -73,7 +73,7 @@ public Player(PlayerEntity playerEntity) { * Get player inventory * @return PlayerInventory */ - public PlayerInventory getInv() { + public Inventory getInv() { return getEntity().getInventory(); } @@ -81,7 +81,7 @@ public PlayerInventory getInv() { * Alias of getInv() * @return PlayerInventory */ - public PlayerInventory getInventory() { + public Inventory getInventory() { return getInv(); } @@ -89,12 +89,12 @@ public PlayerInventory getInventory() { * Get armor's item stack list * @return DefaultedList */ - public DefaultedList getArmor() { - DefaultedList stacks = DefaultedList.ofSize(4, ItemStack.EMPTY); - stacks.set(0, getInv().getStack(36)); - stacks.set(1, getInv().getStack(37)); - stacks.set(2, getInv().getStack(38)); - stacks.set(3, getInv().getStack(39)); + public NonNullList getArmor() { + NonNullList stacks = NonNullList.withSize(4, ItemStack.EMPTY); + stacks.set(0, getInv().getItem(36)); + stacks.set(1, getInv().getItem(37)); + stacks.set(2, getInv().getItem(38)); + stacks.set(3, getInv().getItem(39)); return stacks; } @@ -102,17 +102,17 @@ public DefaultedList getArmor() { * Get main's item stack list * @return DefaultedList */ - public DefaultedList getMain() { - return getInv().getMainStacks(); + public NonNullList getMain() { + return getInv().getNonEquipmentItems(); } /** * Get off hand's item stack list * @return DefaultedList */ - public DefaultedList getOffHand() { - DefaultedList stacks = DefaultedList.ofSize(1, ItemStack.EMPTY); - stacks.set(0, getInv().getStack(PlayerInventory.OFF_HAND_SLOT)); + public NonNullList getOffHand() { + NonNullList stacks = NonNullList.withSize(1, ItemStack.EMPTY); + stacks.set(0, getInv().getItem(Inventory.SLOT_OFFHAND)); return stacks; } @@ -129,54 +129,54 @@ public int getSelectSlot() { * @return player inventory size */ public int getInvSize() { - return getInv().size(); + return getInv().getContainerSize(); } - public OptionalInt openGuiScreen(NamedScreenHandlerFactory factory) { - return getEntity().openHandledScreen(factory); + public OptionalInt openGuiScreen(MenuProvider factory) { + return getEntity().openMenu(factory); } - public OptionalInt openGuiScreen(World world, BlockState state, BlockPos pos) { - return openGuiScreen(state.createScreenHandlerFactory(world, pos)); + public OptionalInt openGuiScreen(Level world, BlockState state, BlockPos pos) { + return openGuiScreen(state.getMenuProvider(world, pos)); } public boolean isServerPlayerEntity() { - return this.getEntity() instanceof ServerPlayerEntity; + return this.getEntity() instanceof ServerPlayer; } - public void openExtendedMenu(NamedScreenHandlerFactory provider, Consumer bufWriter) { + public void openExtendedMenu(MenuProvider provider, Consumer bufWriter) { if (isServerPlayerEntity()) - ScreenHandlerUtil.openExtendedMenu((ServerPlayerEntity) this.getPlayerEntity(), provider, bufWriter); + ScreenHandlerUtil.openExtendedMenu((ServerPlayer) this.getPlayerEntity(), provider, bufWriter); } public void openExtendedMenu(ExtendedMenuProvider provider) { if (isServerPlayerEntity()) - ScreenHandlerUtil.openExtendedMenu((ServerPlayerEntity) this.getPlayerEntity(), provider); + ScreenHandlerUtil.openExtendedMenu((ServerPlayer) this.getPlayerEntity(), provider); } public void openExtendedMenu(ExtendedNamedScreenHandlerFactory provider) { this.openExtendedMenu((ExtendedMenuProvider) provider); } - public void openMenu(NamedScreenHandlerFactory provider) { + public void openMenu(MenuProvider provider) { if (isServerPlayerEntity()) - ScreenHandlerUtil.openMenu((ServerPlayerEntity) this.getPlayerEntity(), provider); + ScreenHandlerUtil.openMenu((ServerPlayer) this.getPlayerEntity(), provider); } public void insertStack(ItemStack stack) { - getInv().insertStack(stack); + getInv().add(stack); } public void insertStack(int slot, ItemStack stack) { - getInv().insertStack(slot, stack); + getInv().add(slot, stack); } public void offerOrDrop(ItemStack itemStack) { - getInv().offerOrDrop(itemStack); + getInv().placeItemBackInInventory(itemStack); } public void giveStack(ItemStack stack) { - getEntity().giveItemStack(stack); + getEntity().addItem(stack); } public String getName() { @@ -184,10 +184,10 @@ public String getName() { } public UUID getUUID() { - return getEntity().getUuid(); + return getEntity().getUUID(); } - public PlayerAbilities getAbilities() { + public Abilities getAbilities() { return getEntity().getAbilities(); } @@ -195,7 +195,7 @@ public PlayerAbilities getAbilities() { * Returns whether this player is in creative mode. */ public boolean isCreative() { - return getAbilities().creativeMode; + return getAbilities().instabuild; } public boolean isFlying() { @@ -206,52 +206,52 @@ public boolean isInvulnerable() { return getAbilities().invulnerable; } - public World getWorld() { - return getEntity().getEntityWorld(); + public Level getWorld() { + return getEntity().level(); } - public ScreenHandler getCurrentScreenHandler() { - return getEntity().currentScreenHandler; + public AbstractContainerMenu getCurrentScreenHandler() { + return getEntity().containerMenu; } public boolean isSneaking() { - return getEntity().isSneaking(); + return getEntity().isShiftKeyDown(); } public ItemStack getCursorStack() { - return getCurrentScreenHandler().getCursorStack(); + return getCurrentScreenHandler().getCarried(); } public boolean isClient() { - return getWorld().isClient(); + return getWorld().isClientSide(); } public boolean isServer() { return !isClient(); } - public void readCustomDataFromNbt(NbtCompound nbt) { - getEntity().setComponent(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt)); + public void readCustomDataFromNbt(CompoundTag nbt) { + getEntity().setComponent(DataComponents.CUSTOM_DATA, CustomData.of(nbt)); } - public void writeCustomDataToNbt(NbtCompound nbt) { - NbtCompound source = getEntity().get(DataComponentTypes.CUSTOM_DATA).copyNbt(); + public void writeCustomDataToNbt(CompoundTag nbt) { + CompoundTag source = getEntity().get(DataComponents.CUSTOM_DATA).copyTag(); NbtUtil.copyFrom(source, nbt); } - public void sendMessage(Text text) { - getEntity().sendMessage(text, false); + public void sendMessage(Component text) { + getEntity().displayClientMessage(text, false); } - public void sendActionBar(Text text) { - getEntity().sendMessage(text, true); + public void sendActionBar(Component text) { + getEntity().displayClientMessage(text, true); } public void equipStack(EquipmentSlot slot, ItemStack stack) { - getEntity().equipStack(slot, stack); + getEntity().setItemSlot(slot, stack); } public void dropStack(ItemStack stack, boolean throwRandomly, boolean retainOwnership) { - getEntity().dropItem(stack, throwRandomly, retainOwnership); + getEntity().drop(stack, throwRandomly, retainOwnership); } public void dropStack(ItemStack stack, boolean retainOwnership) { @@ -263,15 +263,15 @@ public void dropStack(ItemStack stack) { } public BlockPos getBlockPos() { - return getEntity().getBlockPos(); + return getEntity().blockPosition(); } - public Vec3d getPos() { - return getEntity().getEntityPos(); + public Vec3 getPos() { + return getEntity().position(); } - public ItemStack getStackInHand(Hand hand) { - return this.getEntity().getStackInHand(hand); + public ItemStack getStackInHand(InteractionHand hand) { + return this.getEntity().getItemInHand(hand); } public void heal(float amount) { @@ -279,16 +279,16 @@ public void heal(float amount) { } public float getYaw() { - return this.getEntity().getYaw(); + return this.getEntity().getYRot(); } public float getPitch() { - return this.getEntity().getPitch(); + return this.getEntity().getXRot(); } - public void playSound(SoundEvent event, SoundCategory category, float volume, float pitch) { + public void playSound(SoundEvent event, SoundSource category, float volume, float pitch) { if (isServerPlayerEntity()) { - Optional player = getServerPlayer(); + Optional player = getServerPlayer(); if (player.isPresent()) { player.get().playSound(event, volume, pitch); return; @@ -300,7 +300,7 @@ public void playSound(SoundEvent event, SoundCategory category, float volume, fl public void playSound(SoundEvent event, float volume, float pitch) { if (isServerPlayerEntity()) { - Optional player = getServerPlayer(); + Optional player = getServerPlayer(); if (player.isPresent()) { player.get().playSound(event, volume, pitch); return; @@ -324,40 +324,40 @@ public ItemCooldown getItemCooldown() { return itemCooldown; } - public ItemCooldownManager getItemCooldownManager() { - return getEntity().getItemCooldownManager(); + public ItemCooldowns getItemCooldownManager() { + return getEntity().getCooldowns(); } public void incrementStat(Stat stat) { - getEntity().incrementStat(stat); + getEntity().awardStat(stat); } public void incrementStat(StatType type, T object) { - getEntity().incrementStat(type.getOrCreateStat(object)); + getEntity().awardStat(type.get(object)); } public void incrementStat(Identifier id) { - getEntity().incrementStat(id); + getEntity().awardStat(id); } public void incrementStat(CompatIdentifier id) { - getEntity().incrementStat(id.toMinecraft()); + getEntity().awardStat(id.toMinecraft()); } public void teleport(double x, double y, double z) { - getEntity().teleport(x, y, z, false); + getEntity().randomTeleport(x, y, z, false); } public ItemStack getMainHandStack() { - return getStackInHand(Hand.MAIN_HAND); + return getStackInHand(InteractionHand.MAIN_HAND); } public ItemStack getOffHandStack() { - return getStackInHand(Hand.OFF_HAND); + return getStackInHand(InteractionHand.OFF_HAND); } public Direction getHorizontalFacing() { - return getEntity().getHorizontalFacing(); + return getEntity().getDirection(); } public double getX() { @@ -373,39 +373,39 @@ public double getZ() { } public boolean isServerPlayer() { - return getEntity() instanceof ServerPlayerEntity; + return getEntity() instanceof ServerPlayer; } - public Optional getServerPlayer() { + public Optional getServerPlayer() { if (isServerPlayer()) - return Optional.of((ServerPlayerEntity) getEntity()); + return Optional.of((ServerPlayer) getEntity()); return Optional.empty(); } @Environment(EnvType.CLIENT) - public Optional getClientPlayer() { - if (getEntity() instanceof ClientPlayerEntity) - return Optional.of((ClientPlayerEntity) getEntity()); + public Optional getClientPlayer() { + if (getEntity() instanceof LocalPlayer) + return Optional.of((LocalPlayer) getEntity()); return Optional.empty(); } public void setVelocity(double x, double y, double z) { - getEntity().setVelocity(x, y, z); + getEntity().setDeltaMovement(x, y, z); } - public void setVelocity(Vec3d velocity) { - getEntity().setVelocity(velocity); + public void setVelocity(Vec3 velocity) { + getEntity().setDeltaMovement(velocity); } - public Vec3d getVelocity() { - return getEntity().getVelocity(); + public Vec3 getVelocity() { + return getEntity().getDeltaMovement(); } - public Optional getNetworkHandler() { - Optional player = getServerPlayer(); - return player.map(sp -> sp.networkHandler); + public Optional getNetworkHandler() { + Optional player = getServerPlayer(); + return player.map(sp -> sp.connection); } public boolean hasNetworkHandler() { @@ -436,17 +436,17 @@ public Optional getCurrentHandItem() { } public void addStatusEffect(CompatStatusEffectInstance effect) { - getEntity().addStatusEffect(effect.getInstance()); + getEntity().addEffect(effect.getInstance()); } public void removeStatusEffect(CompatStatusEffect effect) { - getEntity().removeStatusEffect(effect.getEntry(getWorld())); + getEntity().removeEffect(effect.getEntry(getWorld())); } public List getStatusEffects() { List compatEffects = new ArrayList<>(); - for (StatusEffectInstance effect : getEntity().getStatusEffects()) { + for (MobEffectInstance effect : getEntity().getActiveEffects()) { compatEffects.add(new CompatStatusEffectInstance(effect)); } @@ -454,7 +454,7 @@ public List getStatusEffects() { } public void addExperience(int experience) { - getEntity().addExperience(experience); + getEntity().giveExperiencePoints(experience); } public int getExperienceLevel() { @@ -462,7 +462,7 @@ public int getExperienceLevel() { } public void addExperienceLevels(int levels) { - getEntity().addExperienceLevels(levels); + getEntity().giveExperienceLevels(levels); } public void setExperienceLevel(int level) { @@ -470,7 +470,7 @@ public void setExperienceLevel(int level) { } public void addScore(int score) { - getEntity().addScore(score); + getEntity().increaseScore(score); } public int getScore() { @@ -493,28 +493,28 @@ public boolean isSwimming() { return getEntity().isSwimming(); } - public void setStackInHand(Hand hand, ItemStack stack) { - getEntity().setStackInHand(hand, stack); + public void setStackInHand(InteractionHand hand, ItemStack stack) { + getEntity().setItemInHand(hand, stack); } - public void setStackInHand(Hand hand, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + public void setStackInHand(InteractionHand hand, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { setStackInHand(hand, stack.toMinecraft()); } - public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStackInHand(Hand hand) { + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStackInHand(InteractionHand hand) { return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStackInHand(hand)); } - public Hand getActiveHand() { - return getEntity().getActiveHand(); + public InteractionHand getActiveHand() { + return getEntity().getUsedItemHand(); } public float getBlockBreakingSpeed(BlockState state) { - return getEntity().getBlockBreakingSpeed(state); + return getEntity().getDestroySpeed(state); } public boolean canHarvest(BlockState state) { - return getEntity().canHarvest(state); + return getEntity().hasCorrectToolForDrops(state); } public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { @@ -522,7 +522,7 @@ public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { } public void eatFood(ItemStack stack, CompatFoodComponent foodComponent) { - getEntity().getHungerManager().eat(foodComponent.build()); + getEntity().getFoodData().eat(foodComponent.build()); } public void sendMessage(String message) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java index dd71d5eb8..4879677ad 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java @@ -1,32 +1,32 @@ package net.pitan76.mcpitanlib.api.entity.attribute; -import net.minecraft.entity.attribute.EntityAttributeModifier; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; public class AttrModifierOperation { - private final EntityAttributeModifier.Operation raw; + private final AttributeModifier.Operation raw; - public static final AttrModifierOperation ADD = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_VALUE); - public static final AttrModifierOperation MUL_TOTAL = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL); - public static final AttrModifierOperation MUL_BASE = new AttrModifierOperation(EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE); + public static final AttrModifierOperation ADD = new AttrModifierOperation(AttributeModifier.Operation.ADD_VALUE); + public static final AttrModifierOperation MUL_TOTAL = new AttrModifierOperation(AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL); + public static final AttrModifierOperation MUL_BASE = new AttrModifierOperation(AttributeModifier.Operation.ADD_MULTIPLIED_BASE); @Deprecated - public AttrModifierOperation(EntityAttributeModifier.Operation raw) { + public AttrModifierOperation(AttributeModifier.Operation raw) { this.raw = raw; } - public static AttrModifierOperation of(EntityAttributeModifier.Operation raw) { - if (raw == EntityAttributeModifier.Operation.ADD_VALUE) { + public static AttrModifierOperation of(AttributeModifier.Operation raw) { + if (raw == AttributeModifier.Operation.ADD_VALUE) { return ADD; - } else if (raw == EntityAttributeModifier.Operation.ADD_MULTIPLIED_TOTAL) { + } else if (raw == AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL) { return MUL_TOTAL; - } else if (raw == EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE) { + } else if (raw == AttributeModifier.Operation.ADD_MULTIPLIED_BASE) { return MUL_BASE; } return new AttrModifierOperation(raw); } - public EntityAttributeModifier.Operation raw() { + public AttributeModifier.Operation raw() { return raw; } @@ -35,7 +35,7 @@ public String getName() { } public int getId() { - return raw().getId(); + return raw().id(); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java index 120a75040..076eb00a1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.entity.attribute; -import net.minecraft.component.type.AttributeModifiersComponent; +import net.minecraft.world.item.component.ItemAttributeModifiers; public class AttributeModifiersComponentBuilder { - public final AttributeModifiersComponent.Builder builder = AttributeModifiersComponent.builder(); + public final ItemAttributeModifiers.Builder builder = ItemAttributeModifiers.builder(); public AttributeModifiersComponentBuilder() { @@ -16,7 +16,7 @@ public AttributeModifiersComponentBuilder add(CompatEntityAttribute attribute, C } @Deprecated - public AttributeModifiersComponent build_raw() { + public ItemAttributeModifiers build_raw() { return builder.build(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java index 43595c06b..53b44517e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java @@ -1,51 +1,51 @@ package net.pitan76.mcpitanlib.api.entity.attribute; -import net.minecraft.component.type.AttributeModifierSlot; +import net.minecraft.world.entity.EquipmentSlotGroup; import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; public class CompatAttributeModifierSlot implements CompatStringIdentifiable { - private final AttributeModifierSlot raw; + private final EquipmentSlotGroup raw; - public static final CompatAttributeModifierSlot ANY = new CompatAttributeModifierSlot(AttributeModifierSlot.ANY); - public static final CompatAttributeModifierSlot MAIN_HAND = new CompatAttributeModifierSlot(AttributeModifierSlot.MAINHAND); - public static final CompatAttributeModifierSlot OFF_HAND = new CompatAttributeModifierSlot(AttributeModifierSlot.OFFHAND); - public static final CompatAttributeModifierSlot HEAD = new CompatAttributeModifierSlot(AttributeModifierSlot.HEAD); - public static final CompatAttributeModifierSlot FEET = new CompatAttributeModifierSlot(AttributeModifierSlot.FEET); - public static final CompatAttributeModifierSlot LEGS = new CompatAttributeModifierSlot(AttributeModifierSlot.LEGS); - public static final CompatAttributeModifierSlot CHEST = new CompatAttributeModifierSlot(AttributeModifierSlot.CHEST); - public static final CompatAttributeModifierSlot ARMOR = new CompatAttributeModifierSlot(AttributeModifierSlot.ARMOR); - public static final CompatAttributeModifierSlot BODY = new CompatAttributeModifierSlot(AttributeModifierSlot.BODY); - public static final CompatAttributeModifierSlot SADDLE = new CompatAttributeModifierSlot(AttributeModifierSlot.SADDLE); + public static final CompatAttributeModifierSlot ANY = new CompatAttributeModifierSlot(EquipmentSlotGroup.ANY); + public static final CompatAttributeModifierSlot MAIN_HAND = new CompatAttributeModifierSlot(EquipmentSlotGroup.MAINHAND); + public static final CompatAttributeModifierSlot OFF_HAND = new CompatAttributeModifierSlot(EquipmentSlotGroup.OFFHAND); + public static final CompatAttributeModifierSlot HEAD = new CompatAttributeModifierSlot(EquipmentSlotGroup.HEAD); + public static final CompatAttributeModifierSlot FEET = new CompatAttributeModifierSlot(EquipmentSlotGroup.FEET); + public static final CompatAttributeModifierSlot LEGS = new CompatAttributeModifierSlot(EquipmentSlotGroup.LEGS); + public static final CompatAttributeModifierSlot CHEST = new CompatAttributeModifierSlot(EquipmentSlotGroup.CHEST); + public static final CompatAttributeModifierSlot ARMOR = new CompatAttributeModifierSlot(EquipmentSlotGroup.ARMOR); + public static final CompatAttributeModifierSlot BODY = new CompatAttributeModifierSlot(EquipmentSlotGroup.BODY); + public static final CompatAttributeModifierSlot SADDLE = new CompatAttributeModifierSlot(EquipmentSlotGroup.SADDLE); @Deprecated - public CompatAttributeModifierSlot(AttributeModifierSlot raw) { + public CompatAttributeModifierSlot(EquipmentSlotGroup raw) { this.raw = raw; } - public static CompatAttributeModifierSlot of(AttributeModifierSlot slot) { - if (slot == AttributeModifierSlot.ANY) return ANY; - if (slot == AttributeModifierSlot.MAINHAND) return MAIN_HAND; - if (slot == AttributeModifierSlot.OFFHAND) return OFF_HAND; - if (slot == AttributeModifierSlot.HEAD) return HEAD; - if (slot == AttributeModifierSlot.FEET) return FEET; - if (slot == AttributeModifierSlot.LEGS) return LEGS; - if (slot == AttributeModifierSlot.CHEST) return CHEST; - if (slot == AttributeModifierSlot.ARMOR) return ARMOR; - if (slot == AttributeModifierSlot.BODY) return BODY; - if (slot == AttributeModifierSlot.SADDLE) return SADDLE; + public static CompatAttributeModifierSlot of(EquipmentSlotGroup slot) { + if (slot == EquipmentSlotGroup.ANY) return ANY; + if (slot == EquipmentSlotGroup.MAINHAND) return MAIN_HAND; + if (slot == EquipmentSlotGroup.OFFHAND) return OFF_HAND; + if (slot == EquipmentSlotGroup.HEAD) return HEAD; + if (slot == EquipmentSlotGroup.FEET) return FEET; + if (slot == EquipmentSlotGroup.LEGS) return LEGS; + if (slot == EquipmentSlotGroup.CHEST) return CHEST; + if (slot == EquipmentSlotGroup.ARMOR) return ARMOR; + if (slot == EquipmentSlotGroup.BODY) return BODY; + if (slot == EquipmentSlotGroup.SADDLE) return SADDLE; return new CompatAttributeModifierSlot(slot); } @Deprecated - public AttributeModifierSlot raw() { + public EquipmentSlotGroup raw() { return raw; } @Override public String asString_compat() { - return raw().asString(); + return raw().getSerializedName(); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java index ec9b8318c..62358b356 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.entity.attribute; -import net.minecraft.component.type.AttributeModifiersComponent; +import net.minecraft.world.item.component.ItemAttributeModifiers; public class CompatAttributeModifiersComponent { - private final AttributeModifiersComponent raw; + private final ItemAttributeModifiers raw; @Deprecated - public CompatAttributeModifiersComponent(AttributeModifiersComponent component) { + public CompatAttributeModifiersComponent(ItemAttributeModifiers component) { this.raw = component; } @Deprecated - public AttributeModifiersComponent raw() { + public ItemAttributeModifiers raw() { return raw; } - public static CompatAttributeModifiersComponent of(AttributeModifiersComponent component) { + public static CompatAttributeModifiersComponent of(ItemAttributeModifiers component) { return new CompatAttributeModifiersComponent(component); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java index 0b116dc14..a018655fc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.entity.attribute; -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.core.Holder; public class CompatEntityAttribute { - public final RegistryEntry raw; + public final Holder raw; @Deprecated - public CompatEntityAttribute(RegistryEntry attribute) { + public CompatEntityAttribute(Holder attribute) { this.raw = attribute; } @Deprecated - public RegistryEntry raw() { + public Holder raw() { return raw; } public String getId() { - return raw.getIdAsString(); + return raw.getRegisteredName(); } - public EntityAttribute getValue() { + public Attribute getValue() { return raw.value(); } @@ -29,7 +29,7 @@ public boolean isNull() { } @Deprecated - public static CompatEntityAttribute of(RegistryEntry attribute) { + public static CompatEntityAttribute of(Holder attribute) { return new CompatEntityAttribute(attribute); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java index e170013ca..f35752684 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java @@ -1,39 +1,39 @@ package net.pitan76.mcpitanlib.api.entity.attribute; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.attribute.EntityAttributeInstance; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import java.util.function.Consumer; public class CompatEntityAttributeInstance { - private final net.minecraft.entity.attribute.EntityAttributeInstance raw; + private final net.minecraft.world.entity.ai.attributes.AttributeInstance raw; @Deprecated - public CompatEntityAttributeInstance(net.minecraft.entity.attribute.EntityAttributeInstance instance) { + public CompatEntityAttributeInstance(net.minecraft.world.entity.ai.attributes.AttributeInstance instance) { this.raw = instance; } @Deprecated - public net.minecraft.entity.attribute.EntityAttributeInstance raw() { + public net.minecraft.world.entity.ai.attributes.AttributeInstance raw() { return raw; } @Deprecated - public static CompatEntityAttributeInstance of(net.minecraft.entity.attribute.EntityAttributeInstance instance) { + public static CompatEntityAttributeInstance of(net.minecraft.world.entity.ai.attributes.AttributeInstance instance) { return new CompatEntityAttributeInstance(instance); } public static CompatEntityAttributeInstance create(CompatEntityAttribute type, Consumer updateCallback) { - return of(new EntityAttributeInstance(type.raw(), modifier -> { + return of(new AttributeInstance(type.raw(), modifier -> { if (updateCallback != null) updateCallback.accept(of(modifier)); })); } public static CompatEntityAttributeInstance get(LivingEntity entity, CompatEntityAttribute attribute) { - return new CompatEntityAttributeInstance(entity.getAttributeInstance(attribute.raw())); + return new CompatEntityAttributeInstance(entity.getAttribute(attribute.raw())); } public static CompatEntityAttributeInstance get(Player player, CompatEntityAttribute attribute) { @@ -53,7 +53,7 @@ public void setBaseValue(double value) { } public void addPersistentModifier(CompatEntityAttributeModifier modifier) { - raw().addPersistentModifier(modifier.raw()); + raw().addPermanentModifier(modifier.raw()); } public void removeModifier(CompatIdentifier id) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java index 59b4f2b74..28726e95e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java @@ -3,24 +3,24 @@ import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class CompatEntityAttributeModifier { - private final net.minecraft.entity.attribute.EntityAttributeModifier raw; + private final net.minecraft.world.entity.ai.attributes.AttributeModifier raw; @Deprecated - public CompatEntityAttributeModifier(net.minecraft.entity.attribute.EntityAttributeModifier raw) { + public CompatEntityAttributeModifier(net.minecraft.world.entity.ai.attributes.AttributeModifier raw) { this.raw = raw; } @Deprecated - public static CompatEntityAttributeModifier of(net.minecraft.entity.attribute.EntityAttributeModifier raw) { + public static CompatEntityAttributeModifier of(net.minecraft.world.entity.ai.attributes.AttributeModifier raw) { return new CompatEntityAttributeModifier(raw); } public static CompatEntityAttributeModifier of(CompatIdentifier id, double value, AttrModifierOperation operation) { - return new CompatEntityAttributeModifier(new net.minecraft.entity.attribute.EntityAttributeModifier(id.toMinecraft(), value, operation.raw())); + return new CompatEntityAttributeModifier(new net.minecraft.world.entity.ai.attributes.AttributeModifier(id.toMinecraft(), value, operation.raw())); } @Deprecated - public net.minecraft.entity.attribute.EntityAttributeModifier raw() { + public net.minecraft.world.entity.ai.attributes.AttributeModifier raw() { return raw; } @@ -29,7 +29,7 @@ public AttrModifierOperation getOperation() { } public double getValue() { - return raw().value(); + return raw().amount(); } public CompatIdentifier getId() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java index d0c1f595f..4676293a3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.entity.attribute; -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.core.Holder; public class CompatEntityAttributes { - public static final CompatEntityAttribute ARMOR = of(EntityAttributes.ARMOR); - public static final CompatEntityAttribute ARMOR_TOUGHNESS = of(EntityAttributes.ARMOR_TOUGHNESS); - public static final CompatEntityAttribute ATTACK_DAMAGE = of(EntityAttributes.ATTACK_DAMAGE); - public static final CompatEntityAttribute ATTACK_KNOCKBACK = of(EntityAttributes.ATTACK_KNOCKBACK); - public static final CompatEntityAttribute ATTACK_SPEED = of(EntityAttributes.ATTACK_SPEED); - public static final CompatEntityAttribute FOLLOW_RANGE = of(EntityAttributes.FOLLOW_RANGE); - public static final CompatEntityAttribute KNOCKBACK_RESISTANCE = of(EntityAttributes.KNOCKBACK_RESISTANCE); - public static final CompatEntityAttribute LUCK = of(EntityAttributes.LUCK); - public static final CompatEntityAttribute MOVEMENT_SPEED = of(EntityAttributes.MOVEMENT_SPEED); - public static final CompatEntityAttribute MAX_HEALTH = of(EntityAttributes.MAX_HEALTH); - public static final CompatEntityAttribute JUMP_STRENGTH = of(EntityAttributes.JUMP_STRENGTH); - public static final CompatEntityAttribute GRAVITY = of(EntityAttributes.GRAVITY); - public static final CompatEntityAttribute FLYING_SPEED = of(EntityAttributes.FLYING_SPEED); - public static final CompatEntityAttribute BLOCK_BREAK_SPEED = of(EntityAttributes.BLOCK_BREAK_SPEED); - public static final CompatEntityAttribute BLOCK_INTERACTION_RANGE = of(EntityAttributes.BLOCK_INTERACTION_RANGE); + public static final CompatEntityAttribute ARMOR = of(Attributes.ARMOR); + public static final CompatEntityAttribute ARMOR_TOUGHNESS = of(Attributes.ARMOR_TOUGHNESS); + public static final CompatEntityAttribute ATTACK_DAMAGE = of(Attributes.ATTACK_DAMAGE); + public static final CompatEntityAttribute ATTACK_KNOCKBACK = of(Attributes.ATTACK_KNOCKBACK); + public static final CompatEntityAttribute ATTACK_SPEED = of(Attributes.ATTACK_SPEED); + public static final CompatEntityAttribute FOLLOW_RANGE = of(Attributes.FOLLOW_RANGE); + public static final CompatEntityAttribute KNOCKBACK_RESISTANCE = of(Attributes.KNOCKBACK_RESISTANCE); + public static final CompatEntityAttribute LUCK = of(Attributes.LUCK); + public static final CompatEntityAttribute MOVEMENT_SPEED = of(Attributes.MOVEMENT_SPEED); + public static final CompatEntityAttribute MAX_HEALTH = of(Attributes.MAX_HEALTH); + public static final CompatEntityAttribute JUMP_STRENGTH = of(Attributes.JUMP_STRENGTH); + public static final CompatEntityAttribute GRAVITY = of(Attributes.GRAVITY); + public static final CompatEntityAttribute FLYING_SPEED = of(Attributes.FLYING_SPEED); + public static final CompatEntityAttribute BLOCK_BREAK_SPEED = of(Attributes.BLOCK_BREAK_SPEED); + public static final CompatEntityAttribute BLOCK_INTERACTION_RANGE = of(Attributes.BLOCK_INTERACTION_RANGE); - public static CompatEntityAttribute of(RegistryEntry attribute) { + public static CompatEntityAttribute of(Holder attribute) { return CompatEntityAttribute.of(attribute); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java index 2c33c4a89..00d8f54f8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.entity.effect; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.data.registries.VanillaRegistries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.Holder; import net.minecraft.resources.Identifier; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.StatusEffectUtil; import org.jetbrains.annotations.Nullable; import java.util.Optional; public class CompatStatusEffect { - private final RegistryKey registryKey; + private final ResourceKey registryKey; @Deprecated - public CompatStatusEffect(RegistryKey registryKey) { + public CompatStatusEffect(ResourceKey registryKey) { this.registryKey = registryKey; } @@ -24,11 +24,11 @@ public CompatStatusEffect of(Identifier identifier) { } public Identifier getId() { - return registryKey.getRegistry(); + return registryKey.registry(); } @Deprecated - public RegistryKey getRegistryKey() { + public ResourceKey getRegistryKey() { return registryKey; } @@ -44,19 +44,19 @@ public boolean equals(Object obj) { } @Deprecated - public RegistryEntry getEntry(@Nullable World world) { - Optional> optionalEntry; + public Holder getEntry(@Nullable Level world) { + Optional> optionalEntry; if (world == null) { - optionalEntry = BuiltinRegistries.createWrapperLookup() - .getOptionalEntry(registryKey); + optionalEntry = VanillaRegistries.createLookup() + .get(registryKey); } else { - optionalEntry = world.getRegistryManager().getOptionalEntry(registryKey); + optionalEntry = world.registryAccess().get(registryKey); } return optionalEntry.orElseThrow(); } - public StatusEffect getStatusEffect(@Nullable World world) { + public MobEffect getStatusEffect(@Nullable Level world) { return getEntry(world).value(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java index fe23894f3..c5f7fe2c0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.entity.effect; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.registry.RegistryKey; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.resources.ResourceKey; import org.jetbrains.annotations.Nullable; import java.util.Optional; public class CompatStatusEffectInstance { - private final StatusEffectInstance instance; + private final MobEffectInstance instance; @Deprecated - public CompatStatusEffectInstance(StatusEffectInstance instance) { + public CompatStatusEffectInstance(MobEffectInstance instance) { this.instance = instance; } - public StatusEffectInstance getInstance() { + public MobEffectInstance getInstance() { return instance; } public Optional getCompatStatusEffect() { - Optional> optional = instance.getEffectType().getKey(); + Optional> optional = instance.getEffect().unwrapKey(); return optional.map(CompatStatusEffect::new); } @@ -44,8 +44,8 @@ public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int a this(effect, duration, amplifier, ambient, showParticles, showIcon, null); } - public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable StatusEffectInstance hiddenEffect) { - this.instance = new StatusEffectInstance(effect.getEntry(null), duration, amplifier, ambient, showParticles, showIcon, hiddenEffect); + public CompatStatusEffectInstance(CompatStatusEffect effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable MobEffectInstance hiddenEffect) { + this.instance = new MobEffectInstance(effect.getEntry(null), duration, amplifier, ambient, showParticles, showIcon, hiddenEffect); } public int getDuration() { @@ -61,14 +61,14 @@ public boolean isAmbient() { } public boolean showParticles() { - return instance.shouldShowParticles(); + return instance.isVisible(); } public boolean showIcon() { - return instance.shouldShowIcon(); + return instance.showIcon(); } public boolean isInfinite() { - return instance.isInfinite(); + return instance.isInfiniteDuration(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java index b54933766..5019fc031 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.event; -import net.minecraft.block.Block; -import net.minecraft.command.argument.BlockStateArgumentType; +import net.minecraft.world.level.block.Block; +import net.minecraft.commands.arguments.blocks.BlockStateArgument; import net.pitan76.mcpitanlib.api.command.argument.BlockCommand; public class BlockCommandEvent extends RequiredCommandEvent { public Block getValue() { - return BlockStateArgumentType.getBlockState(context, ((BlockCommand) getCommand()).getArgumentName()).getBlockState().getBlock(); + return BlockStateArgument.getBlock(context, ((BlockCommand) getCommand()).getArgumentName()).getState().getBlock(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java index 38110c090..b006fb665 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.event; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.command.argument.EntitiesCommand; public class EntitiesCommandEvent extends RequiredCommandEvent { public Entity getValue() { try { - return EntityArgumentType.getEntity(context, ((EntitiesCommand) getCommand()).getArgumentName()); + return EntityArgument.getEntity(context, ((EntitiesCommand) getCommand()).getArgumentName()); } catch (CommandSyntaxException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java index ea90b106e..7b5e73655 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.event; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.command.argument.EntityCommand; public class EntityCommandEvent extends RequiredCommandEvent { public Entity getValue() { try { - return EntityArgumentType.getEntity(context, ((EntityCommand) getCommand()).getArgumentName()); + return EntityArgument.getEntity(context, ((EntityCommand) getCommand()).getArgumentName()); } catch (CommandSyntaxException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java index 1888aa422..30f21640c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.event; -import net.minecraft.command.argument.ItemStackArgumentType; -import net.minecraft.item.Item; +import net.minecraft.commands.arguments.item.ItemArgument; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.command.argument.ItemCommand; public class ItemCommandEvent extends RequiredCommandEvent { public Item getValue() { - return ItemStackArgumentType.getItemStackArgument(context, ((ItemCommand) getCommand()).getArgumentName()).getItem(); + return ItemArgument.getItem(context, ((ItemCommand) getCommand()).getArgumentName()).getItem(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java index 7fad3ba41..d20b974c8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.event; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.command.argument.PlayerCommand; public class PlayerCommandEvent extends RequiredCommandEvent { public Entity getValue() { try { - return EntityArgumentType.getPlayer(context, ((PlayerCommand) getCommand()).getArgumentName()); + return EntityArgument.getPlayer(context, ((PlayerCommand) getCommand()).getArgumentName()); } catch (CommandSyntaxException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java index aa845fd17..7908087c5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.event; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.entity.Entity; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.command.argument.PlayersCommand; public class PlayersCommandEvent extends RequiredCommandEvent { public Entity getValue() { try { - return EntityArgumentType.getPlayer(context, ((PlayersCommand) getCommand()).getArgumentName()); + return EntityArgument.getPlayer(context, ((PlayersCommand) getCommand()).getArgumentName()); } catch (CommandSyntaxException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java index 8cf6a1860..1ae347801 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java @@ -4,31 +4,31 @@ import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.StringRange; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.Text; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.TextUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; -public class ServerCommandEvent extends CommandEvent { +public class ServerCommandEvent extends CommandEvent { - public CommandContext getContext() { + public CommandContext getContext() { return context; } - public void setContext(CommandContext context) { + public void setContext(CommandContext context) { this.context = context; } - public ServerCommandSource getSource() { + public CommandSourceStack getSource() { return getContext().getSource(); } - public PlayerEntity getPlayerEntity() throws CommandSyntaxException { + public Player getPlayerEntity() throws CommandSyntaxException { return getSource().getPlayer(); } @@ -36,8 +36,8 @@ public Player getPlayer() throws CommandSyntaxException { return new Player(getPlayerEntity()); } - public World getWorld() { - return getSource().getWorld(); + public Level getWorld() { + return getSource().getLevel(); } public Entity getEntity() { @@ -48,15 +48,15 @@ public String getInput() { return getContext().getInput(); } - public Command getContextCommand() { + public Command getContextCommand() { return getContext().getCommand(); } - public CommandContext getChild() { + public CommandContext getChild() { return getContext().getChild(); } - public CommandContext getLastChild() { + public CommandContext getLastChild() { return getContext().getLastChild(); } @@ -65,15 +65,15 @@ public StringRange getRange() { } // Text - public void sendSuccess(Text message, boolean broadcastToOps) { - getSource().sendFeedback(() -> message, broadcastToOps); + public void sendSuccess(Component message, boolean broadcastToOps) { + getSource().sendSuccess(() -> message, broadcastToOps); } - public void sendFailure(Text message) { - getSource().sendError(message); + public void sendFailure(Component message) { + getSource().sendFailure(message); } - public void sendSuccess(Text message) { + public void sendSuccess(Component message) { sendSuccess(message, false); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java index 087efa37b..696a73505 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.Property; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.Property; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.state.property.IProperty; import net.pitan76.mcpitanlib.api.util.DirectionBoolPropertyUtil; public class AppendPropertiesArgs extends BaseEvent { - public StateManager.Builder builder; + public StateDefinition.Builder builder; - public AppendPropertiesArgs(StateManager.Builder builder) { + public AppendPropertiesArgs(StateDefinition.Builder builder) { this.builder = builder; } - public StateManager.Builder getBuilder() { + public StateDefinition.Builder getBuilder() { return builder; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java index a5351d2aa..d1284ae1a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; @@ -13,12 +13,12 @@ import net.pitan76.mcpitanlib.midohra.world.IWorldView; public class BlockBreakEvent extends BaseEvent { - public World world; + public Level world; public BlockPos pos; public BlockState state; public Player player; - public BlockBreakEvent(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public BlockBreakEvent(Level world, BlockPos pos, BlockState state, Player player) { this.world = world; this.pos = pos; this.state = state; @@ -37,16 +37,16 @@ public Player getPlayer() { return player; } - public PlayerEntity getPlayerEntity() { + public Player getPlayerEntity() { return player.getPlayerEntity(); } - public World getWorld() { + public Level getWorld() { return world; } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public BlockEntity getBlockEntity() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java index c50170a81..a73cfcd2c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; @@ -12,11 +12,11 @@ public class BlockBreakStartEvent extends BaseEvent { public BlockState state; - public World world; + public Level world; public BlockPos pos; public Player player; - public BlockBreakStartEvent(BlockState state, World world, BlockPos pos, Player player) { + public BlockBreakStartEvent(BlockState state, Level world, BlockPos pos, Player player) { this.state = state; this.world = world; this.pos = pos; @@ -31,7 +31,7 @@ public BlockState getState() { return state; } - public World getWorld() { + public Level getWorld() { return world; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java index c0b365e0a..3f68af73c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; @@ -14,13 +14,13 @@ public class BlockPlacedEvent extends BaseEvent { - public World world; + public Level world; public BlockPos pos; public BlockState state; public LivingEntity placer; public ItemStack stack; - public BlockPlacedEvent(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + public BlockPlacedEvent(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { this.world = world; this.pos = pos; this.state = state; @@ -36,7 +36,7 @@ public BlockPos getPos() { return pos; } - public World getWorld() { + public Level getWorld() { return world; } @@ -49,7 +49,7 @@ public LivingEntity getPlacer() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public BlockEntity getBlockEntity() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java index f80420f5b..e9f0db538 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.util.RandomSource; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; @@ -12,11 +12,11 @@ public class BlockScheduledTickEvent extends BaseEvent implements BlockStatePropertyHolder { public BlockState state; - public ServerWorld world; + public ServerLevel world; public BlockPos pos; public CompatRandom random; - public BlockScheduledTickEvent(BlockState state, ServerWorld world, BlockPos pos, Random random) { + public BlockScheduledTickEvent(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { this.state = state; this.world = world; this.pos = pos; @@ -31,7 +31,7 @@ public BlockPos getPos() { return pos; } - public ServerWorld getWorld() { + public ServerLevel getWorld() { return world; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java index 9d3b86a2c..7491b64dc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; @@ -20,14 +20,14 @@ public class BlockUseEvent extends BaseEvent { public BlockState state; - public World world; + public Level world; public BlockPos pos; public Player player; - public Hand hand; + public InteractionHand hand; public BlockHitResult hit; public ItemStack stack; - public BlockUseEvent(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + public BlockUseEvent(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { this.state = state; this.world = world; this.pos = pos; @@ -49,11 +49,11 @@ public Player getPlayer() { return player; } - public Hand getHand() { + public InteractionHand getHand() { return hand; } - public World getWorld() { + public Level getWorld() { return world; } @@ -66,7 +66,7 @@ public BlockPos getPos() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public CompatActionResult success() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java index eb92b3f7f..3c7e26970 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.fluid.FluidState; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.material.FluidState; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.FluidStateUtil; public class CanPathfindThroughArgs extends BaseEvent { public BlockState state; - public NavigationType type; + public PathComputationType type; - public CanPathfindThroughArgs(BlockState state, NavigationType type) { + public CanPathfindThroughArgs(BlockState state, PathComputationType type) { this.state = state; this.type = type; @@ -20,7 +20,7 @@ public BlockState getState() { return state; } - public NavigationType getType() { + public PathComputationType getType() { return type; } @@ -29,15 +29,15 @@ public FluidState getFluidState() { } public boolean isWaterNavigationType() { - return type == NavigationType.WATER; + return type == PathComputationType.WATER; } public boolean isAirNavigationType() { - return type == NavigationType.AIR; + return type == PathComputationType.AIR; } public boolean isLandNavigationType() { - return type == NavigationType.LAND; + return type == PathComputationType.LAND; } public boolean isWaterState() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java index 43fab8bc5..575291168 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; public class CollisionShapeEvent extends OutlineShapeEvent { - public CollisionShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public CollisionShapeEvent(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { super(state, world, pos, context); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java index b2d322b87..891ed850c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.loot.context.LootContextParameters; -import net.minecraft.loot.context.LootWorldContext; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.level.storage.loot.LootParams; import net.pitan76.mcpitanlib.api.event.BaseEvent; public class DroppedStacksArgs extends BaseEvent { public BlockState state; - public LootWorldContext.Builder builder; + public LootParams.Builder builder; - public DroppedStacksArgs(BlockState state, LootWorldContext.Builder builder) { + public DroppedStacksArgs(BlockState state, LootParams.Builder builder) { this.state = state; this.builder = builder; } @@ -20,11 +20,11 @@ public BlockState getState() { } @Deprecated - public LootWorldContext.Builder getBuilder() { + public LootParams.Builder getBuilder() { return builder; } public BlockEntity getBlockEntity() { - return builder.get(LootContextParameters.BLOCK_ENTITY); + return builder.getParameter(LootContextParams.BLOCK_ENTITY); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java index d5b17a6ba..a6b5fd63e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.InsideBlockEffectApplier; +import net.minecraft.world.entity.player.Player; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.SoundEventUtil; @@ -19,20 +19,20 @@ public class EntityCollisionEvent extends BaseEvent { public BlockState state; - public World world; + public Level world; public BlockPos pos; public Entity entity; - public EntityCollisionHandler handler; + public InsideBlockEffectApplier handler; public boolean bl = false; - public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity) { + public EntityCollisionEvent(BlockState state, Level world, BlockPos pos, Entity entity) { this.state = state; this.world = world; this.pos = pos; this.entity = entity; } - public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { + public EntityCollisionEvent(BlockState state, Level world, BlockPos pos, Entity entity, InsideBlockEffectApplier handler) { this.state = state; this.world = world; this.pos = pos; @@ -40,7 +40,7 @@ public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity this.handler = handler; } - public EntityCollisionEvent(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler, boolean bl) { + public EntityCollisionEvent(BlockState state, Level world, BlockPos pos, Entity entity, InsideBlockEffectApplier handler, boolean bl) { this.state = state; this.world = world; this.pos = pos; @@ -54,7 +54,7 @@ public boolean isClient() { } public BlockPos getEntityPos() { - return entity.getBlockPos(); + return entity.blockPosition(); } public BlockPos getBlockPos() { @@ -69,44 +69,44 @@ public Entity getEntity() { return entity; } - public World getWorld() { + public Level getWorld() { return world; } - public void playSound(SoundEvent event, SoundCategory category, float volume, float pitch) { - WorldUtil.playSound(world, null, entity.getBlockPos(), event, category, volume, pitch); + public void playSound(SoundEvent event, SoundSource category, float volume, float pitch) { + WorldUtil.playSound(world, null, entity.blockPosition(), event, category, volume, pitch); } public void playSound(SoundEvent event, float volume, float pitch) { - playSound(event, SoundCategory.BLOCKS, volume, pitch); + playSound(event, SoundSource.BLOCKS, volume, pitch); } public void playSound(SoundEvent event) { playSound(event, 1f, 1f); } - public void playSound(SoundEvent event, SoundCategory category) { + public void playSound(SoundEvent event, SoundSource category) { playSound(event, category, 1f, 1f); } - public void playSound(CompatIdentifier id, SoundCategory category, float volume, float pitch) { + public void playSound(CompatIdentifier id, SoundSource category, float volume, float pitch) { playSound(SoundEventUtil.getSoundEvent(id), category, volume, pitch); } public boolean hasPlayerEntity() { - return entity instanceof PlayerEntity; + return entity instanceof Player; } - public Optional getPlayerEntity() { + public Optional getPlayerEntity() { if (!hasPlayerEntity()) return Optional.empty(); - return Optional.of((PlayerEntity) entity); + return Optional.of((Player) entity); } public BlockEntity getBlockEntity() { return WorldUtil.getBlockEntity(getWorld(), getBlockPos()); } - public EntityCollisionHandler getHandler() { + public InsideBlockEffectApplier getHandler() { return handler; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java index 9bcda6872..890e373f4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; +import net.minecraft.world.level.block.state.BlockState; public class FluidStateArgs { public BlockState state; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java index cb8c81462..c84c2c985 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java @@ -1,50 +1,50 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ItemScatterer; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.Containers; +import net.minecraft.core.NonNullList; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class ItemScattererUtil { - public static void spawn(World world, BlockPos pos, BlockEntity blockEntity) { - if (blockEntity instanceof Inventory) { - spawn(world, pos, (Inventory) blockEntity); + public static void spawn(Level world, BlockPos pos, BlockEntity blockEntity) { + if (blockEntity instanceof Container) { + spawn(world, pos, (Container) blockEntity); } } - public static void spawn(World world, BlockPos pos, Inventory inventory) { - ItemScatterer.spawn(world, pos, inventory); + public static void spawn(Level world, BlockPos pos, Container inventory) { + Containers.dropContents(world, pos, inventory); } - public static void spawn(World world, BlockPos pos, ItemStack stack) { - ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), stack); + public static void spawn(Level world, BlockPos pos, ItemStack stack) { + Containers.dropItemStack(world, pos.getX(), pos.getY(), pos.getZ(), stack); } - public static void spawn(World world, BlockPos pos, DefaultedList stacks) { - ItemScatterer.spawn(world, pos, stacks); + public static void spawn(Level world, BlockPos pos, NonNullList stacks) { + Containers.dropContents(world, pos, stacks); } public static void onStateReplaced(StateReplacedEvent e) { onStateReplaced(e.getState(), e.getNewState(), e.getWorld(), e.getPos()); } - public static void onStateReplaced(BlockState state, BlockState newState, World world, BlockPos pos) { - ItemScatterer.onStateReplaced(state, world, pos); + public static void onStateReplaced(BlockState state, BlockState newState, Level world, BlockPos pos) { + Containers.updateNeighboursAfterDestroy(state, world, pos); } public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, ItemStack stack) { spawn(world.getRaw(), pos.toMinecraft(), stack); } - public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, DefaultedList stacks) { + public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, NonNullList stacks) { spawn(world.getRaw(), pos.toMinecraft(), stacks); } - public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, Inventory inventory) { + public static void spawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, Container inventory) { spawn(world.getRaw(), pos.toMinecraft(), inventory); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java index 4617ce6bc..989c88743 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.block.WireOrientation; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.redstone.Orientation; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; @@ -13,7 +13,7 @@ public class NeighborUpdateEvent extends BaseEvent { public BlockState state; - public World world; + public Level world; public BlockPos pos; public Block sourceBlock; @@ -21,11 +21,11 @@ public class NeighborUpdateEvent extends BaseEvent { public BlockPos sourcePos; @Nullable - public WireOrientation wireOrientation; + public Orientation wireOrientation; public boolean notify; - public NeighborUpdateEvent(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable BlockPos sourcePos, boolean notify) { + public NeighborUpdateEvent(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable BlockPos sourcePos, boolean notify) { this.state = state; this.world = world; this.pos = pos; @@ -34,7 +34,7 @@ public NeighborUpdateEvent(BlockState state, World world, BlockPos pos, Block so this.notify = notify; } - public NeighborUpdateEvent(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) { + public NeighborUpdateEvent(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { this(state, world, pos, sourceBlock, (BlockPos) null, notify); this.wireOrientation = wireOrientation; } @@ -43,7 +43,7 @@ public BlockState getState() { return state; } - public World getWorld() { + public Level getWorld() { return world; } @@ -76,7 +76,7 @@ public boolean hasBlockEntity() { } @Deprecated - public @Nullable WireOrientation getWireOrientation() { + public @Nullable Orientation getWireOrientation() { return wireOrientation; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java index 7131ee630..b62f9f0fd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.state.property.Property; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.state.property.IProperty; public class OutlineShapeEvent extends BaseEvent { public BlockState state; - public BlockView world; + public BlockGetter world; public BlockPos pos; - public ShapeContext context; + public CollisionContext context; - public OutlineShapeEvent(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public OutlineShapeEvent(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { this.state = state; this.world = world; this.pos = pos; @@ -29,24 +29,24 @@ public BlockState getState() { return state; } - public BlockView getWorld() { + public BlockGetter getWorld() { return world; } - public ShapeContext getContext() { + public CollisionContext getContext() { return context; } public > T getProperty(Property property) { - return state.get(property); + return state.getValue(property); } public > boolean containsProperty(Property property) { - return state.contains(property); + return state.hasProperty(property); } public , V extends T> BlockState with(Property property, V value) { - return state.with(property, value); + return state.setValue(property, value); } public > T get(IProperty property) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java index 762907be8..0b63f3223 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java @@ -1,32 +1,32 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; import org.jetbrains.annotations.Nullable; public class PickStackEvent { @Deprecated - public WorldView worldView; + public LevelReader worldView; @Deprecated - public BlockView blockView; + public BlockGetter blockView; public BlockPos pos; public BlockState state; public boolean includeData = true; - public PickStackEvent(WorldView world, BlockPos pos, BlockState state) { + public PickStackEvent(LevelReader world, BlockPos pos, BlockState state) { this.worldView = world; this.pos = pos; this.state = state; } - public PickStackEvent(BlockView world, BlockPos pos, BlockState state) { + public PickStackEvent(BlockGetter world, BlockPos pos, BlockState state) { this.blockView = world; this.pos = pos; this.state = state; @@ -41,12 +41,12 @@ public BlockPos getPos() { } @Nullable - public BlockView getBlockView() { + public BlockGetter getBlockView() { return blockView; } @Nullable - public WorldView getWorldView() { + public LevelReader getWorldView() { return worldView; } @@ -71,12 +71,12 @@ public BlockEntity getBlockEntity() { public boolean isClient() { if (blockView != null) - return getBlockEntity().getWorld().isClient(); + return getBlockEntity().getLevel().isClientSide(); if (worldView != null) - return worldView.isClient(); + return worldView.isClientSide(); try { - net.minecraft.client.MinecraftClient.getInstance(); + net.minecraft.client.Minecraft.getInstance(); return true; } catch (Error e) { return false; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java index 63df37634..766cb874b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java @@ -1,36 +1,36 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.property.Property; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; import net.pitan76.mcpitanlib.api.state.property.IProperty; import net.pitan76.mcpitanlib.api.util.BlockStateUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; +import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; import org.jetbrains.annotations.Nullable; public class PlacementStateArgs extends BaseEvent { - public ItemPlacementContext ctx; + public BlockPlaceContext ctx; @Nullable public Block block; - public PlacementStateArgs(ItemPlacementContext ctx) { + public PlacementStateArgs(BlockPlaceContext ctx) { this.ctx = ctx; } - public PlacementStateArgs(ItemPlacementContext ctx, @Nullable Block block) { + public PlacementStateArgs(BlockPlaceContext ctx, @Nullable Block block) { this.ctx = ctx; this.block = block; } @@ -40,7 +40,7 @@ public boolean canPlace() { } public BlockPos getPos() { - return ctx.getBlockPos(); + return ctx.getClickedPos(); } public Player getPlayer() { @@ -48,55 +48,55 @@ public Player getPlayer() { } public Direction[] getPlacementDirections() { - return ctx.getPlacementDirections(); + return ctx.getNearestLookingDirections(); } - public Hand getHand() { + public InteractionHand getHand() { return ctx.getHand(); } public Direction getSide() { - return ctx.getSide(); + return ctx.getClickedFace(); } public Direction getHorizontalPlayerFacing() { - return ctx.getHorizontalPlayerFacing(); + return ctx.getHorizontalDirection(); } public float getPlayerYaw() { - return ctx.getPlayerYaw(); + return ctx.getRotation(); } - public World getWorld() { - return ctx.getWorld(); + public Level getWorld() { + return ctx.getLevel(); } public boolean isClient() { - return getWorld().isClient(); + return getWorld().isClientSide(); } - public Vec3d getHitPos() { - return ctx.getHitPos(); + public Vec3 getHitPos() { + return ctx.getClickLocation(); } public boolean canReplaceExisting() { - return ctx.canReplaceExisting(); + return ctx.replacingClickedOnBlock(); } @Deprecated - public ItemUsageContextMixin getIUCAccessor() { - return (ItemUsageContextMixin) ctx; + public UseOnContextMixin getIUCAccessor() { + return (UseOnContextMixin) ctx; } public BlockHitResult getHitResult() { - return getIUCAccessor().getHit(); + return getIUCAccessor().getHitResult(); } public ItemUseOnBlockEvent toItemUseOnBlockEvent() { - return new ItemUseOnBlockEvent(getWorld(), getPlayer().getPlayerEntity(), getHand(), ctx.getStack(), getHitResult()); + return new ItemUseOnBlockEvent(getWorld(), getPlayer().getPlayerEntity(), getHand(), ctx.getItemInHand(), getHitResult()); } - public ItemPlacementContext getCtx() { + public BlockPlaceContext getCtx() { return ctx; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java index bc140e4cd..80b40c4e2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java @@ -1,23 +1,23 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; public class ScreenHandlerCreateEvent extends BaseEvent { public BlockState state; - public World world; + public Level world; public BlockPos pos; public int syncId; - public PlayerInventory inventory; + public Inventory inventory; public Player player; - public ScreenHandlerCreateEvent(BlockState state, World world, BlockPos pos, int syncId, PlayerInventory inventory, PlayerEntity player) { + public ScreenHandlerCreateEvent(BlockState state, Level world, BlockPos pos, int syncId, Inventory inventory, Player player) { this.state = state; this.world = world; this.pos = pos; @@ -34,7 +34,7 @@ public BlockPos getPos() { return pos; } - public World getWorld() { + public Level getWorld() { return world; } @@ -42,7 +42,7 @@ public int getSyncId() { return syncId; } - public PlayerInventory getInventory() { + public Inventory getInventory() { return inventory; } @@ -51,6 +51,6 @@ public Player getPlayer() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java index 75cacef6a..d8023b86e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.VoxelShape; import java.util.function.Function; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java index 034355d4c..44cf25443 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java @@ -1,25 +1,25 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; public class StateForNeighborUpdateArgs { public BlockState state; public Direction direction; public BlockState neighborState; - public WorldView world; + public LevelReader world; public BlockPos pos; public BlockPos neighborPos; - public ScheduledTickView tickView; + public ScheduledTickAccess tickView; public CompatRandom random; - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { this.state = state; this.direction = direction; this.neighborState = neighborState; @@ -28,7 +28,7 @@ public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockSt this.neighborPos = neighborPos; } - public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, WorldView world, BlockPos pos, BlockPos neighborPos, ScheduledTickView tickView, CompatRandom random) { + public StateForNeighborUpdateArgs(BlockState state, Direction direction, BlockState neighborState, LevelReader world, BlockPos pos, BlockPos neighborPos, ScheduledTickAccess tickView, CompatRandom random) { this.state = state; this.direction = direction; this.neighborState = neighborState; @@ -63,7 +63,7 @@ public BlockState getNeighborState() { return neighborState; } - public WorldView getWorld() { + public LevelReader getWorld() { return world; } @@ -80,7 +80,7 @@ public CompatRandom getRandom() { } @Deprecated - public ScheduledTickView getTickView() { + public ScheduledTickAccess getTickView() { return tickView; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java index 4be061fb6..7e16a481d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.Container; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; @@ -14,7 +14,7 @@ public class StateReplacedEvent extends BaseEvent { public BlockState state; - public World world; + public Level world; public BlockPos pos; public BlockState newState; public boolean moved; @@ -22,7 +22,7 @@ public class StateReplacedEvent extends BaseEvent { // Captured at construction time so getBlockEntity() works even after the world (1.21.x) private final BlockEntity cachedBlockEntity; - public StateReplacedEvent(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { + public StateReplacedEvent(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { this.state = state; this.world = world; this.pos = pos; @@ -36,7 +36,7 @@ public BlockState getState() { return state; } - public World getWorld() { + public Level getWorld() { return world; } @@ -53,7 +53,7 @@ public boolean isMoved() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } /** @@ -61,7 +61,7 @@ public boolean isClient() { * @return boolean */ public boolean isSameState() { - return state.isOf(newState.getBlock()); + return state.is(newState.getBlock()); } /** @@ -96,7 +96,7 @@ public void spawnDropsInContainer() { } public boolean hasInventory() { - return getBlockEntity() instanceof Inventory; + return getBlockEntity() instanceof Container; } /** diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java index ff0ad3ed9..d92f4d888 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.event.block; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; import net.pitan76.mcpitanlib.api.event.BaseEvent; public class TileCreateEvent extends BaseEvent { // ~1.16.5 - private BlockView blockView; + private BlockGetter blockView; - public TileCreateEvent(BlockView blockView) { + public TileCreateEvent(BlockGetter blockView) { this.blockView = blockView; this.blockPos = null; this.blockState = null; } - public BlockView getBlockView() { + public BlockGetter getBlockView() { return blockView; } - public void setBlockView(BlockView blockView) { + public void setBlockView(BlockGetter blockView) { this.blockView = blockView; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java index 4973eee09..a6ebd9ac5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.block.result; -import net.minecraft.block.BlockState; +import net.minecraft.world.level.block.state.BlockState; public class BlockBreakResult { public BlockState state; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java index 2b8c2d729..9180deb31 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.event.container.factory; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.server.level.ServerPlayer; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; public class ExtraDataArgs extends BaseEvent { - public PacketByteBuf buf; - public ServerPlayerEntity player; + public FriendlyByteBuf buf; + public ServerPlayer player; - public ExtraDataArgs(PacketByteBuf buf, ServerPlayerEntity player) { + public ExtraDataArgs(FriendlyByteBuf buf, ServerPlayer player) { super(); this.buf = buf; this.player = player; @@ -20,7 +20,7 @@ public ExtraDataArgs() { super(); } - public ExtraDataArgs(PacketByteBuf buf) { + public ExtraDataArgs(FriendlyByteBuf buf) { super(); this.buf = buf; } @@ -33,11 +33,11 @@ public boolean hasBuf() { return buf != null; } - public PacketByteBuf getBuf() { + public FriendlyByteBuf getBuf() { return buf; } - public ServerPlayerEntity getPlayer() { + public ServerPlayer getPlayer() { return player; } @@ -47,7 +47,7 @@ public Player getCompatPlayer() { /** * @param obj The object to write - * @see PacketByteUtil#writeVar(PacketByteBuf, Object) + * @see PacketByteUtil#writeVar(FriendlyByteBuf, Object) */ public void writeVar(Object obj) { PacketByteUtil.writeVar(getBuf(), obj); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java index 0ea55b691..257db4d00 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.event.entity; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.Vec3d; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; public class CollisionEvent { @@ -20,8 +20,8 @@ public HitResult.Type getType() { return hitResult.getType(); } - public Vec3d getPos() { - return hitResult.getPos(); + public Vec3 getPos() { + return hitResult.getLocation(); } public net.pitan76.mcpitanlib.midohra.util.hit.HitResult getHitResultM() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java index 048b496ed..aba80f41f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.event.entity; -import net.minecraft.entity.Entity; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; public class EntityHitEvent { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java index 875b6a939..9b6c1a676 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java @@ -1,39 +1,39 @@ package net.pitan76.mcpitanlib.api.event.entity; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.network.syncher.EntityDataAccessor; import org.jetbrains.annotations.Nullable; public class InitDataTrackerArgs { - public DataTracker.Builder builder; - public DataTracker tracker; + public SynchedEntityData.Builder builder; + public SynchedEntityData tracker; - public InitDataTrackerArgs(DataTracker.Builder builder) { + public InitDataTrackerArgs(SynchedEntityData.Builder builder) { this.builder = builder; } - public InitDataTrackerArgs(DataTracker tracker) { + public InitDataTrackerArgs(SynchedEntityData tracker) { this.tracker = tracker; } - public InitDataTrackerArgs(DataTracker.Builder builder, @Nullable DataTracker tracker) { + public InitDataTrackerArgs(SynchedEntityData.Builder builder, @Nullable SynchedEntityData tracker) { this.builder = builder; this.tracker = tracker; } - public DataTracker.Builder getBuilder() { + public SynchedEntityData.Builder getBuilder() { return builder; } - public DataTracker.Builder add(TrackedData data, T value) { - return builder.add(data, value); + public SynchedEntityData.Builder add(EntityDataAccessor data, T value) { + return builder.define(data, value); } - public void set(TrackedData data, T value) { + public void set(EntityDataAccessor data, T value) { tracker.set(data, value); } - public void addTracking(TrackedData data, T value) { + public void addTracking(EntityDataAccessor data, T value) { if (builder != null) { add(data, value); return; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java index 769b66b63..31bb70acb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.entity.Entity; -import net.minecraft.entity.damage.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.damagesource.DamageSource; public class BonusAttackDamageArgs { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java index 8456d4488..58da500c0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.util.WorldUtil; public class CanMineArgs { public BlockState state; - public World world; + public Level world; public BlockPos pos; @Deprecated @@ -22,7 +22,7 @@ public class CanMineArgs { public LivingEntity entity; - public CanMineArgs(BlockState state, World world, BlockPos pos, PlayerEntity miner) { + public CanMineArgs(BlockState state, Level world, BlockPos pos, Player miner) { this.state = state; this.world = world; this.pos = pos; @@ -30,15 +30,15 @@ public CanMineArgs(BlockState state, World world, BlockPos pos, PlayerEntity min this.entity = miner; } - public CanMineArgs(ItemStack stack, BlockState state, World world, BlockPos pos, LivingEntity entity) { + public CanMineArgs(ItemStack stack, BlockState state, Level world, BlockPos pos, LivingEntity entity) { this.stack = stack; this.state = state; this.world = world; this.pos = pos; this.entity = entity; - if (entity instanceof PlayerEntity) { - this.miner = new Player((PlayerEntity) entity); + if (entity instanceof Player) { + this.miner = new Player((Player) entity); } } @@ -46,7 +46,7 @@ public BlockState getState() { return state; } - public World getWorld() { + public Level getWorld() { return world; } @@ -67,7 +67,7 @@ public boolean isClient() { } public ItemStack getStack() { - return stack != null ? stack : entity.getMainHandStack(); + return stack != null ? stack : entity.getMainHandItem(); } public LivingEntity getEntity() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java index 2bd98d890..4392e550f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.event.BaseEvent; public class CanRepairArgs extends BaseEvent { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java index a80abdbba..3218b724e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java @@ -1,30 +1,30 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import org.jetbrains.annotations.Nullable; public class CraftEvent { public ItemStack stack; - public World world; + public Level world; public Player player; - public CraftEvent(ItemStack stack, World world, Player player) { + public CraftEvent(ItemStack stack, Level world, Player player) { this.stack = stack; this.world = world; this.player = player; } - public CraftEvent(ItemStack stack, World world, PlayerEntity player) { + public CraftEvent(ItemStack stack, Level world, Player player) { this.stack = stack; this.world = world; this.player = new Player(player); } - public CraftEvent(ItemStack stack, World world) { + public CraftEvent(ItemStack stack, Level world) { this.stack = stack; this.world = world; } @@ -33,7 +33,7 @@ public ItemStack getStack() { return stack; } - public World getWorld() { + public Level getWorld() { return world; } @@ -43,6 +43,6 @@ public Player getPlayer() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java index d466f2a51..3ac396201 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class EnchantableArgs { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java index 58b0913e9..f73850ed8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.api.util.entity.EquipmentSlotUtil; @@ -13,13 +13,13 @@ public class InventoryTickEvent extends BaseEvent { public ItemStack stack; - public World world; + public Level world; public Entity entity; public int slot; public boolean selected; public EquipmentSlot equipmentSlot; - public InventoryTickEvent(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + public InventoryTickEvent(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { this.stack = stack; this.world = world; this.entity = entity; @@ -28,7 +28,7 @@ public InventoryTickEvent(ItemStack stack, World world, Entity entity, int slot, this.equipmentSlot = EquipmentSlotUtil.fromEntitySlotId(slot); } - public InventoryTickEvent(ItemStack stack, ServerWorld world, Entity entity, EquipmentSlot slot) { + public InventoryTickEvent(ItemStack stack, ServerLevel world, Entity entity, EquipmentSlot slot) { this(stack, world, entity, EquipmentSlotUtil.getEntitySlotId(slot), isSelected(entity, slot, stack)); this.equipmentSlot = slot; } @@ -37,7 +37,7 @@ private static boolean isSelected(Entity entity, EquipmentSlot slot, ItemStack s if (entity instanceof LivingEntity) { LivingEntity livingEntity = (LivingEntity) entity; ItemStack equippedStack = LivingEntityUtil.getEquippedStack(livingEntity, slot); - return equippedStack.isOf(stack.getItem()) && equippedStack.getCount() == stack.getCount(); + return equippedStack.is(stack.getItem()) && equippedStack.getCount() == stack.getCount(); } else { return false; } @@ -47,7 +47,7 @@ public ItemStack getStack() { return stack; } - public World getWorld() { + public Level getWorld() { return world; } @@ -55,8 +55,8 @@ public boolean isServer() { return !isClient(); } - public ServerWorld getServerWorld() { - return (ServerWorld) world; + public ServerLevel getServerWorld() { + return (ServerLevel) world; } public Entity getEntity() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java index e695b5369..588fd19b2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.world.World; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.text.TextComponent; @@ -21,18 +21,18 @@ public class ItemAppendTooltipEvent extends BaseEvent { public ItemStack stack; @Deprecated - public World world; + public Level world; @Deprecated - public List tooltip; + public List tooltip; - public TooltipType type; + public TooltipFlag type; public Item.TooltipContext context; - public TooltipDisplayComponent displayComponent; - public Consumer textConsumer; + public TooltipDisplay displayComponent; + public Consumer textConsumer; - public ItemAppendTooltipEvent(ItemStack stack, @Nullable World world, List tooltip, TooltipType type, Item.TooltipContext context) { + public ItemAppendTooltipEvent(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag type, Item.TooltipContext context) { this.stack = stack; this.world = world; this.tooltip = tooltip; @@ -40,7 +40,7 @@ public ItemAppendTooltipEvent(ItemStack stack, @Nullable World world, List this.context = context; } - public ItemAppendTooltipEvent(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + public ItemAppendTooltipEvent(ItemStack stack, Item.TooltipContext context, TooltipDisplay displayComponent, Consumer textConsumer, TooltipFlag type) { this.stack = stack; this.context = context; this.displayComponent = displayComponent; @@ -52,11 +52,11 @@ public ItemStack getStack() { return stack; } - public World getWorld() { + public Level getWorld() { return world; } - public List getTooltip() { + public List getTooltip() { return new ArrayList<>(); } @@ -64,17 +64,17 @@ public Item.TooltipContext getContext() { return context; } - public void addTooltip(Text text) { + public void addTooltip(Component text) { textConsumer.accept(text); } - public void addTooltip(List texts) { - for (Text text : texts) { + public void addTooltip(List texts) { + for (Component text : texts) { addTooltip(text); } } - public boolean removeTooltip(Text text) { + public boolean removeTooltip(Component text) { return false; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java index aae12a9a0..e81d85983 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class ItemBarColorArgs { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java index 86742fa45..5ed860d36 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class ItemBarStepArgs { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java index 509bb4634..5a95772fe 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class ItemBarVisibleArgs { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java index 6aa476db8..3a4b6ce7d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; public class ItemFinishUsingEvent extends BaseEvent { public ItemStack stack; - public World world; + public Level world; public LivingEntity user; - public ItemFinishUsingEvent(ItemStack stack, World world, LivingEntity user) { + public ItemFinishUsingEvent(ItemStack stack, Level world, LivingEntity user) { this.stack = stack; this.world = world; this.user = user; @@ -22,7 +22,7 @@ public ItemStack getStack() { return stack; } - public World getWorld() { + public Level getWorld() { return world; } @@ -31,7 +31,7 @@ public LivingEntity getUser() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java index 2f76d9aa6..4d6bacdbd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; @@ -16,16 +16,16 @@ public class ItemUseEvent extends BaseEvent { - public World world; + public Level world; public Player user; - public Hand hand; + public InteractionHand hand; public ItemStack stack; - public ItemUseEvent(World world, PlayerEntity user, Hand hand) { + public ItemUseEvent(Level world, Player user, InteractionHand hand) { this.world = world; this.user = new Player(user); this.hand = hand; - this.stack = user.getStackInHand(hand); + this.stack = user.getItemInHand(hand); } public ItemStack getStack() { @@ -36,11 +36,11 @@ public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); } - public Hand getHand() { + public InteractionHand getHand() { return hand; } - public World getWorld() { + public Level getWorld() { return world; } @@ -49,7 +49,7 @@ public Player getUser() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public StackActionResult success(ItemStack stack) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java index 06e5b9c6b..446b86f37 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; @@ -24,17 +24,17 @@ public class ItemUseOnBlockEvent extends BaseEvent { public Player player; - public Hand hand; + public InteractionHand hand; public BlockHitResult hit; public ItemStack stack; - public World world; + public Level world; public BlockPos blockPos; - public ItemUseOnBlockEvent(PlayerEntity player, Hand hand, BlockHitResult hit) { - this(player.getEntityWorld(), player, hand, player.getStackInHand(hand), hit); + public ItemUseOnBlockEvent(Player player, InteractionHand hand, BlockHitResult hit) { + this(player.level(), player, hand, player.getItemInHand(hand), hit); } - public ItemUseOnBlockEvent(World world, @Nullable PlayerEntity player, Hand hand, ItemStack stack, BlockHitResult hit) { + public ItemUseOnBlockEvent(Level world, @Nullable Player player, InteractionHand hand, ItemStack stack, BlockHitResult hit) { if (player != null) this.player = new Player(player); this.hand = hand; @@ -44,23 +44,23 @@ public ItemUseOnBlockEvent(World world, @Nullable PlayerEntity player, Hand hand this.blockPos = hit.getBlockPos(); } - public ItemUseOnBlockEvent(Player player, Hand hand, BlockHitResult hit) { + public ItemUseOnBlockEvent(Player player, InteractionHand hand, BlockHitResult hit) { this(player.getWorld(), player.getEntity(), hand, player.getStackInHand(hand), hit); } - public ItemUsageContext toIUC() { - return new ItemUsageContext(player.getPlayerEntity(), hand, hit); + public UseOnContext toIUC() { + return new UseOnContext(player.getPlayerEntity(), hand, hit); } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public Player getPlayer() { return player; } - public World getWorld() { + public Level getWorld() { return world; } @@ -72,7 +72,7 @@ public BlockPos getBlockPos() { return blockPos; } - public Hand getHand() { + public InteractionHand getHand() { return hand; } @@ -108,12 +108,12 @@ public BlockState getBlockState() { return WorldUtil.getBlockState(world, blockPos); } - public Vec3d getPos() { - return hit.getPos(); + public Vec3 getPos() { + return hit.getLocation(); } public Direction getSide() { - return hit.getSide(); + return hit.getDirection(); } public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java index e2675e4db..14ceea22b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionHand; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; @@ -15,16 +15,16 @@ public class ItemUseOnEntityEvent extends BaseEvent { public ItemStack stack; public Player user; public LivingEntity entity; - public Hand hand; + public InteractionHand hand; - public ItemUseOnEntityEvent(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + public ItemUseOnEntityEvent(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { this.stack = stack; this.user = new Player(user); this.hand = hand; this.entity = entity; } - public ItemUseOnEntityEvent(ItemStack stack, Player user, LivingEntity entity, Hand hand) { + public ItemUseOnEntityEvent(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { this.stack = stack; this.user = user; this.hand = hand; @@ -35,7 +35,7 @@ public ItemStack getStack() { return stack; } - public Hand getHand() { + public InteractionHand getHand() { return hand; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java index 1f5083152..c396dbc24 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.event.BaseEvent; public class PostHitEvent extends BaseEvent { @@ -34,6 +34,6 @@ public LivingEntity getTarget() { * @param slot the slot to damage */ public void damageStack(int amount, EquipmentSlot slot) { - stack.damage(amount, attacker, slot); + stack.hurtAndBreak(amount, attacker, slot); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java index 73ca209bc..de8760f2c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; @@ -18,12 +18,12 @@ public class PostMineEvent extends BaseEvent { public ItemStack stack; - public World world; + public Level world; public BlockState state; public BlockPos pos; public LivingEntity miner; - public PostMineEvent(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public PostMineEvent(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { this.stack = stack; this.world = world; this.state = state; @@ -39,7 +39,7 @@ public BlockPos getPos() { return pos; } - public World getWorld() { + public Level getWorld() { return world; } @@ -56,7 +56,7 @@ public BlockEntity getBlockEntity() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public boolean stateIsIn(TagKey tagKey) { @@ -73,7 +73,7 @@ public boolean stateIsOf(Block block) { * @param slot the slot to damage */ public void damageStack(int amount, EquipmentSlot slot) { - stack.damage(amount, miner, slot); + stack.hurtAndBreak(amount, miner, slot); } /** @@ -82,7 +82,7 @@ public void damageStack(int amount, EquipmentSlot slot) { * @param type the type of armor equipment */ public void damageStack(int amount, ArmorEquipmentType type) { - stack.damage(amount, miner, type.getSlot()); + stack.hurtAndBreak(amount, miner, type.getSlot()); } /** @@ -90,16 +90,16 @@ public void damageStack(int amount, ArmorEquipmentType type) { * @param amount the amount of damage to deal */ public void damageStack(int amount) { - stack.damage(amount, miner, EquipmentSlot.MAINHAND); + stack.hurtAndBreak(amount, miner, EquipmentSlot.MAINHAND); } public boolean isPlayer() { - return miner instanceof PlayerEntity; + return miner instanceof Player; } public Player getPlayer() { if (isPlayer()) - return new Player((PlayerEntity) miner); + return new Player((Player) miner); return null; } @@ -109,10 +109,10 @@ public boolean isCreative() { } public boolean isSneaking() { - return miner.isSneaking(); + return miner.isShiftKeyDown(); } public ItemStack getMainHandStack() { - return miner.getMainHandStack(); + return miner.getMainHandItem(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java index 7f935aa41..45e32ff4d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.event.nbt; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; public class NbtRWArgs { - public NbtCompound nbt; + public CompoundTag nbt; public CompatRegistryLookup registryLookup; - public NbtRWArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { + public NbtRWArgs(CompoundTag nbt, CompatRegistryLookup registryLookup) { this.nbt = nbt; this.registryLookup = registryLookup; } @Deprecated - public NbtRWArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { + public NbtRWArgs(CompoundTag nbt, HolderLookup.Provider wrapperLookup) { this(nbt, new CompatRegistryLookup(wrapperLookup)); } - public NbtRWArgs(NbtCompound nbt) { + public NbtRWArgs(CompoundTag nbt) { this(nbt, (CompatRegistryLookup) null); } - public NbtCompound getNbt() { + public CompoundTag getNbt() { return nbt; } @@ -35,7 +35,7 @@ public boolean hasRegistryLookup() { } @Deprecated - public RegistryWrapper.WrapperLookup getWrapperLookup() { + public HolderLookup.Provider getWrapperLookup() { if (registryLookup == null) registryLookup = new CompatRegistryLookup(); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java index 70f6e57a3..45c0d5ef0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java @@ -1,41 +1,41 @@ package net.pitan76.mcpitanlib.api.event.nbt; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.ReadView; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.ValueInput; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; public class ReadNbtArgs extends NbtRWArgs { @Deprecated - public ReadView view; + public ValueInput view; @Deprecated - public ReadNbtArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { + public ReadNbtArgs(CompoundTag nbt, HolderLookup.Provider wrapperLookup) { super(nbt, wrapperLookup); } - public ReadNbtArgs(NbtCompound nbt) { + public ReadNbtArgs(CompoundTag nbt) { super(nbt); if (registryLookup == null) registryLookup = new CompatRegistryLookup(); view = NbtDataConverter.nbt2readData(nbt, registryLookup); } - public ReadNbtArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { + public ReadNbtArgs(CompoundTag nbt, CompatRegistryLookup registryLookup) { super(nbt, registryLookup); view = NbtDataConverter.nbt2readData(nbt, registryLookup); } @Deprecated - public ReadNbtArgs(NbtCompound nbt, ReadView view) { + public ReadNbtArgs(CompoundTag nbt, ValueInput view) { this(nbt); this.view = view; } @Deprecated - public ReadNbtArgs(NbtCompound nbt, ReadView view, CompatRegistryLookup registryLookup) { + public ReadNbtArgs(CompoundTag nbt, ValueInput view, CompatRegistryLookup registryLookup) { this(nbt, registryLookup); this.view = view; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java index 1403f1bb9..c702ada20 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java @@ -1,38 +1,38 @@ package net.pitan76.mcpitanlib.api.event.nbt; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.storage.WriteView; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; +import net.minecraft.world.level.storage.ValueOutput; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; public class WriteNbtArgs extends NbtRWArgs { @Deprecated - public WriteView view; + public ValueOutput view; @Deprecated - public WriteNbtArgs(NbtCompound nbt, RegistryWrapper.WrapperLookup wrapperLookup) { + public WriteNbtArgs(CompoundTag nbt, HolderLookup.Provider wrapperLookup) { super(nbt, wrapperLookup); } - public WriteNbtArgs(NbtCompound nbt, CompatRegistryLookup registryLookup) { + public WriteNbtArgs(CompoundTag nbt, CompatRegistryLookup registryLookup) { super(nbt, registryLookup); view = NbtDataConverter.nbt2writeData(nbt, registryLookup); } - public WriteNbtArgs(NbtCompound nbt) { + public WriteNbtArgs(CompoundTag nbt) { super(nbt); view = NbtDataConverter.nbt2writeData(nbt, (CompatRegistryLookup) null); } @Deprecated - public WriteNbtArgs(NbtCompound nbt, WriteView view) { + public WriteNbtArgs(CompoundTag nbt, ValueOutput view) { this(nbt); this.view = view; } @Deprecated - public WriteNbtArgs(NbtCompound nbt, WriteView view, CompatRegistryLookup registryLookup) { + public WriteNbtArgs(CompoundTag nbt, ValueOutput view, CompatRegistryLookup registryLookup) { this(nbt, registryLookup); this.view = view; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java index 67dcae814..b02290b0c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.result; -import net.minecraft.util.ActionResult; +import net.minecraft.world.InteractionResult; import net.pitan76.mcpitanlib.api.util.CompatActionResult; public class EventResult { @@ -38,7 +38,7 @@ public dev.architectury.event.EventResult getResult() { return result; } - public ActionResult toActionResult() { + public InteractionResult toActionResult() { return result.asMinecraft(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java index dacb8ca36..5f4d23593 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.event.result; import dev.architectury.event.CompoundEventResult; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionResult; import net.pitan76.mcpitanlib.api.util.CompatActionResult; public class TypedEventResult { @@ -33,7 +33,7 @@ public dev.architectury.event.CompoundEventResult getResult() { return result; } - public ActionResult toActionResult() { + public InteractionResult toActionResult() { return result.result().asMinecraft(); } @@ -45,10 +45,10 @@ public CompatActionResult toCompatActionResult(ItemStack stack) { if (result.object() != stack) return toCompatActionResult(); - if (toActionResult() instanceof ActionResult.Success) { - ActionResult.Success success = (ActionResult.Success) toActionResult(); + if (toActionResult() instanceof InteractionResult.Success) { + InteractionResult.Success success = (InteractionResult.Success) toActionResult(); - return CompatActionResult.create(success.withNewHandStack(stack)); + return CompatActionResult.create(success.heldItemTransformedTo(stack)); } return toCompatActionResult(); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java index 4dea5f138..c78a0a69f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java @@ -1,22 +1,22 @@ package net.pitan76.mcpitanlib.api.event.tile; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; import net.pitan76.mcpitanlib.midohra.world.IWorldView; public class TileTickEvent implements BlockStatePropertyHolder { - public World world; + public Level world; public BlockPos pos; public BlockState state; public T blockEntity; - public TileTickEvent(World world, BlockPos pos, BlockState state, T blockEntity) { + public TileTickEvent(Level world, BlockPos pos, BlockState state, T blockEntity) { this.world = world; this.pos = pos; this.state = state; @@ -24,7 +24,7 @@ public TileTickEvent(World world, BlockPos pos, BlockState state, T blockEntity) } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public boolean isServer() { @@ -35,7 +35,7 @@ public boolean hasWorld() { return world != null; } - public World getWorld() { + public Level getWorld() { return world; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java index 466ac1f70..2591dc186 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java @@ -2,11 +2,11 @@ import dev.architectury.event.EventResult; import dev.architectury.event.events.common.PlayerEvent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import org.jetbrains.annotations.Nullable; @@ -17,10 +17,10 @@ public static void register(AttackEntity attackEntity) { } public interface AttackEntity { - default EventResult attack(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + default EventResult attack(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { return attack(new Player(player), level, target, hand, result); } - EventResult attack(Player player, World level, Entity target, Hand hand, @Nullable EntityHitResult result); + EventResult attack(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java index 4c4efbe16..c2e73f69f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java @@ -3,8 +3,8 @@ import dev.architectury.event.events.client.ClientTickEvent; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.world.ClientWorld; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; public class ClientTickEventRegistry { public static void registerPost(Client client) { @@ -25,11 +25,11 @@ public static void registerLevelPre(ClientLevel world) { @Environment(EnvType.CLIENT) public interface Client { - void tick(MinecraftClient instance); + void tick(Minecraft instance); } @Environment(EnvType.CLIENT) public interface ClientLevel { - void tick(ClientWorld instance); + void tick(net.minecraft.client.multiplayer.ClientLevel instance); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java index 17b2fa79d..7c51d7b82 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.event.v0; import dev.architectury.event.events.common.LifecycleEvent; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.World; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.v0.event.ItemStackActionEvent; import net.pitan76.mcpitanlib.api.event.v0.event.ServerConnectionEvent; @@ -22,11 +22,11 @@ public static void quit(PlayerQuit state) { } public interface PlayerJoin { - void join(ServerPlayerEntity player); + void join(ServerPlayer player); } public interface PlayerQuit { - void quit(ServerPlayerEntity player); + void quit(ServerPlayer player); } } @@ -77,11 +77,11 @@ public interface InstanceState { void stateChanged(T instance); } - public interface WorldState { + public interface WorldState { void act(T world); } - public interface ServerWorldState extends WorldState { + public interface ServerWorldState extends WorldState { } } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java index 65a8d74b9..975340f34 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.event.v0; import dev.architectury.event.events.common.InteractionEvent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.result.EventResult; import net.pitan76.mcpitanlib.api.event.v0.event.ClickBlockEvent; @@ -46,35 +46,35 @@ public interface RightClickBlock { } public interface RightClickItem { - default ActionResult click(PlayerEntity var1, Hand var2) { + default InteractionResult click(Player var1, InteractionHand var2) { return click(new Player(var1), var2).toActionResult(); } - CompatActionResult click(Player player, Hand hand); + CompatActionResult click(Player player, InteractionHand hand); } public interface ClientLeftClickAir { - default void click(PlayerEntity var1, Hand var2) { + default void click(Player var1, InteractionHand var2) { click(new Player(var1), var2); } - void click(Player player, Hand hand); + void click(Player player, InteractionHand hand); } public interface ClientRightClickAir { - default void click(PlayerEntity var1, Hand var2) { + default void click(Player var1, InteractionHand var2) { click(new Player(var1), var2); } - void click(Player player, Hand hand); + void click(Player player, InteractionHand hand); } public interface InteractEntity { @SuppressWarnings("deprecation") - default dev.architectury.event.EventResult interact(PlayerEntity var1, Entity var2, Hand var3) { + default dev.architectury.event.EventResult interact(Player var1, Entity var2, InteractionHand var3) { return interact(new Player(var1), var2, var3).toEventResult().getResult(); } - CompatActionResult interact(Player player, Entity entity, Hand hand); + CompatActionResult interact(Player player, Entity entity, InteractionHand hand); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java index 3777e195e..657cdf6c9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java @@ -2,8 +2,8 @@ import dev.architectury.event.EventResult; import dev.architectury.event.events.common.EntityEvent; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.damagesource.DamageSource; import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; public class LivingHurtEventRegistry { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java index 231235154..5d6b1ee9c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java @@ -1,31 +1,31 @@ package net.pitan76.mcpitanlib.api.event.v0.event; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.util.BlockStateUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; public class ClickBlockEvent { public Player player; - public Hand hand; + public InteractionHand hand; public BlockPos pos; public Direction direction; - public ClickBlockEvent(Player player, Hand hand, BlockPos pos, Direction direction) { + public ClickBlockEvent(Player player, InteractionHand hand, BlockPos pos, Direction direction) { this.player = player; this.hand = hand; this.pos = pos; this.direction = direction; } - public ClickBlockEvent(PlayerEntity player, Hand hand, BlockPos pos, Direction direction) { + public ClickBlockEvent(Player player, InteractionHand hand, BlockPos pos, Direction direction) { this.player = new Player(player); this.hand = hand; this.pos = pos; @@ -36,7 +36,7 @@ public Player getPlayer() { return player; } - public Hand getHand() { + public InteractionHand getHand() { return hand; } @@ -60,7 +60,7 @@ public boolean isEmptyStackInHand() { return getStackInHand().isEmpty(); } - public World getWorld() { + public Level getWorld() { return player.getWorld(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java index f8872ead7..07e2b0095 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.v0.event; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; import java.util.ArrayList; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java index 078061cb0..cdb9a4864 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.event.v0.event; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; public class LivingHurtEvent { @@ -33,11 +33,11 @@ public float getDamageAmount() { } public Entity getAttacker() { - return damageSource.getAttacker(); + return damageSource.getEntity(); } public Entity getSource() { - return damageSource.getSource(); + return damageSource.getDirectEntity(); } public boolean isDirect() { @@ -45,27 +45,27 @@ public boolean isDirect() { } public boolean isPlayerAttacker() { - return getAttacker() instanceof PlayerEntity; + return getAttacker() instanceof Player; } - public PlayerEntity getPlayerEntityAttacker() { - return (PlayerEntity) getAttacker(); + public Player getPlayerEntityAttacker() { + return (Player) getAttacker(); } public Player getPlayerAttacker() { return new Player(getPlayerEntityAttacker()); } - public World getWorld() { - return entity.getEntityWorld(); + public Level getWorld() { + return entity.level(); } public boolean isClient() { - return getWorld().isClient(); + return getWorld().isClientSide(); } public ItemStack getWeaponStack() { - return getAttacker().getWeaponStack(); + return getAttacker().getWeaponItem(); } public Item getWeaponItem() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java index 8a955dd4e..35a3171d2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.event.v0.event; -import net.minecraft.recipe.Recipe; -import net.minecraft.resource.ResourceManager; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.resources.Identifier; -import net.minecraft.util.profiler.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; @@ -17,15 +17,15 @@ public class RecipeManagerEvent { private SortedMap> sortedMap; public ResourceManager resourceManager; - public Profiler profiler; + public ProfilerFiller profiler; - public RecipeManagerEvent(SortedMap> sortedMap, ResourceManager resourceManager, Profiler profiler) { + public RecipeManagerEvent(SortedMap> sortedMap, ResourceManager resourceManager, ProfilerFiller profiler) { this.sortedMap = sortedMap; this.resourceManager = resourceManager; this.profiler = profiler; } - public Profiler getProfiler() { + public ProfilerFiller getProfiler() { return profiler; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java index 894a89cd8..7ced46d48 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java @@ -2,11 +2,11 @@ import dev.architectury.event.EventResult; import dev.architectury.event.events.common.PlayerEvent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.v1.event.AttackEntityEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; import org.jetbrains.annotations.Nullable; @@ -17,7 +17,7 @@ public static void register(AttackEntity attackEntity) { } public interface AttackEntity { - default EventResult attack(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + default EventResult attack(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { return attack(new AttackEntityEvent(player, level, target, hand, result)).toEventResult().getResult(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java index a95a7e9be..a2faf4a97 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java @@ -2,8 +2,8 @@ import dev.architectury.event.EventResult; import dev.architectury.event.events.common.EntityEvent; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.damagesource.DamageSource; import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; public class LivingHurtEventRegistry { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java index 4748c9ca4..b7ab9898c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.event.v1.event; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import org.jetbrains.annotations.Nullable; @@ -14,16 +14,16 @@ public class AttackEntityEvent { public Player player; - public World world; + public Level world; public Entity target; - public Hand hand; + public InteractionHand hand; public EntityHitResult result; - public AttackEntityEvent(PlayerEntity player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + public AttackEntityEvent(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { this(new Player(player), level, target, hand, result); } - public AttackEntityEvent(Player player, World level, Entity target, Hand hand, @Nullable EntityHitResult result) { + public AttackEntityEvent(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { this.player = player; this.world = level; this.target = target; @@ -35,7 +35,7 @@ public Player getPlayer() { return player; } - public World getWorld() { + public Level getWorld() { return world; } @@ -47,7 +47,7 @@ public EntityHitResult getResult() { return result; } - public Hand getHand() { + public InteractionHand getHand() { return hand; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java index da542b658..19fada63a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.gen; -import net.minecraft.block.Block; +import net.minecraft.world.level.block.Block; import net.minecraft.resources.Identifier; -import net.minecraft.world.gen.GenerationStep; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.PlacedFeature; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.pitan76.mcpitanlib.api.registry.WorldGenRegistry; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.util.BlockUtil; @@ -23,10 +23,10 @@ public class OreRegistry { * @return Identifier of feature */ public static Identifier registerStoneOre(WorldGenRegistry registry, Block block, int size, int height, int count) { - Identifier identifier = BlockUtil.toID(block).withSuffixedPath("_ore_feature"); + Identifier identifier = BlockUtil.toID(block).withSuffix("_ore_feature"); RegistryResult> configuredFuture = registry.registerFeature(identifier, () -> FeatureConfigUtil.createConfiguredFeature( - FeatureConfigUtil.createStoneOreFeatureConfig(block.getDefaultState(), size) + FeatureConfigUtil.createStoneOreFeatureConfig(block.defaultBlockState(), size) ) ); @@ -36,7 +36,7 @@ public static Identifier registerStoneOre(WorldGenRegistry registry, Block block ) ); - WorldGenRegistry.addProperties(GenerationStep.Feature.UNDERGROUND_DECORATION, placedFeature); + WorldGenRegistry.addProperties(GenerationStep.Decoration.UNDERGROUND_DECORATION, placedFeature); return identifier; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java index e5324df34..c27b03570 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java @@ -1,46 +1,46 @@ package net.pitan76.mcpitanlib.api.gui; import dev.architectury.registry.menu.ExtendedMenuProvider; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerFactory; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuConstructor; +import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; @Deprecated public class ExtendedNamedScreenHandlerFactory implements ExtendedMenuProvider { - private final Text name; - private final ScreenHandlerFactory baseFactory; + private final Component name; + private final MenuConstructor baseFactory; private final PacketByteBufFactory bufFactory; - public ExtendedNamedScreenHandlerFactory(Text name, ScreenHandlerFactory baseFactory, PacketByteBufFactory bufFactory) { + public ExtendedNamedScreenHandlerFactory(Component name, MenuConstructor baseFactory, PacketByteBufFactory bufFactory) { this.name = name; this.baseFactory = baseFactory; this.bufFactory = bufFactory; } @Override - public void saveExtraData(PacketByteBuf buf) { + public void saveExtraData(FriendlyByteBuf buf) { bufFactory.saveExtraData(buf); } @Override - public Text getDisplayName() { + public Component getDisplayName() { return name; } @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player) { + public AbstractContainerMenu createMenu(int syncId, Inventory inv, Player player) { return baseFactory.createMenu(syncId, inv, player); } @FunctionalInterface public interface PacketByteBufFactory { - void saveExtraData(PacketByteBuf buf); + void saveExtraData(FriendlyByteBuf buf); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java index 45d413cfb..73ef4de9b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.gui; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.inventory.MenuType; import org.jetbrains.annotations.Nullable; public class ExtendedScreenHandler extends SimpleScreenHandler { - protected ExtendedScreenHandler(@Nullable ScreenHandlerType type, int syncId, PacketByteBuf buf) { + protected ExtendedScreenHandler(@Nullable MenuType type, int syncId, FriendlyByteBuf buf) { this(type, syncId); } - protected ExtendedScreenHandler(@Nullable ScreenHandlerType type, int syncId) { + protected ExtendedScreenHandler(@Nullable MenuType type, int syncId) { super(type, syncId); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java index 17d6586b0..35d363fdd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.api.gui; import dev.architectury.registry.menu.ExtendedMenuProvider; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.text.Text; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; import net.pitan76.mcpitanlib.api.event.container.factory.ExtraDataArgs; @Deprecated public interface ExtendedScreenHandlerFactory extends ExtendedMenuProvider { @Override - default Text getDisplayName() { + default Component getDisplayName() { return getDisplayName(new DisplayNameArgs()); } @Override - default void saveExtraData(PacketByteBuf buf) { + default void saveExtraData(FriendlyByteBuf buf) { writeExtraData(new ExtraDataArgs(buf)); } - Text getDisplayName(DisplayNameArgs args); + Component getDisplayName(DisplayNameArgs args); void writeExtraData(ExtraDataArgs args); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java index dd672f9a6..33b0f8e29 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.gui; import dev.architectury.registry.menu.MenuRegistry; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -public class ExtendedScreenHandlerTypeBuilder { +public class ExtendedScreenHandlerTypeBuilder { private final Factory factory; @@ -19,21 +19,21 @@ public ExtendedScreenHandlerTypeBuilder(Factory2 factory) { this.factory = factory; } - public ScreenHandlerType build() { + public MenuType build() { return MenuRegistry.ofExtended(factory::create); } @FunctionalInterface - public interface Factory { - T create(int syncId, PlayerInventory inventory, PacketByteBuf buf); + public interface Factory { + T create(int syncId, Inventory inventory, FriendlyByteBuf buf); } @FunctionalInterface - public interface Factory2 extends Factory { - T create(CreateMenuEvent e, PacketByteBuf buf); + public interface Factory2 extends Factory { + T create(CreateMenuEvent e, FriendlyByteBuf buf); @Override - default T create(int syncId, PlayerInventory inventory, PacketByteBuf buf) { + default T create(int syncId, Inventory inventory, FriendlyByteBuf buf) { return create(new CreateMenuEvent(syncId, inventory), buf); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java index 334c42388..99550bf35 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.gui; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.slot.Slot; -import net.minecraft.screen.slot.SlotActionType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.inventory.ClickType; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.api.gui.args.SlotClickEvent; @@ -19,12 +19,12 @@ import java.util.ArrayList; import java.util.List; -public class SimpleScreenHandler extends ScreenHandler { - protected SimpleScreenHandler(@Nullable ScreenHandlerType type, int syncId) { +public class SimpleScreenHandler extends AbstractContainerMenu { + protected SimpleScreenHandler(@Nullable MenuType type, int syncId) { super(type, syncId); } - protected SimpleScreenHandler(@Nullable ScreenHandlerType type, CreateMenuEvent e) { + protected SimpleScreenHandler(@Nullable MenuType type, CreateMenuEvent e) { this(type, e.getSyncId()); } @@ -33,7 +33,7 @@ protected SimpleScreenHandler(@Nullable ScreenHandlerType type, CreateMenuEve @Deprecated @Override - public boolean canUse(PlayerEntity player) { + public boolean stillValid(Player player) { return canUse(new Player(player)); } @@ -41,18 +41,18 @@ public boolean canUse(Player player) { return true; } - public Slot addNormalSlot(Inventory inventory, int index, int x, int y) { + public Slot addNormalSlot(Container inventory, int index, int x, int y) { Slot slot = new Slot(inventory, index, x, y); return this.addSlot(slot); } - public Slot addSlot(Inventory inventory, int index, int x, int y, SlotFactory factory) { + public Slot addSlot(Container inventory, int index, int x, int y, SlotFactory factory) { Slot slot = factory.create(inventory, index, x, y); return this.addSlot(slot); } public interface SlotFactory { - T create(Inventory inventory, int index, int x, int y); + T create(Container inventory, int index, int x, int y); } public Slot callAddSlot(Slot slot) { @@ -67,12 +67,12 @@ protected Slot addSlot(Slot slot) { @Deprecated @Override - public void onClosed(PlayerEntity player) { + public void removed(Player player) { this.close(new Player(player)); } public void close(Player player) { - super.onClosed(player.getPlayerEntity()); + super.removed(player.getPlayerEntity()); } @@ -84,7 +84,7 @@ public void close(Player player) { * @param x start x * @param y start y */ - protected List addPlayerMainInventorySlots(PlayerInventory inventory, int x, int y) { + protected List addPlayerMainInventorySlots(Inventory inventory, int x, int y) { hasMainInventory = true; return this.addSlots(inventory, 9, x, y, DEFAULT_SLOT_SIZE, 9, 3); } @@ -95,7 +95,7 @@ protected List addPlayerMainInventorySlots(PlayerInventory inventory, int * @param x start x * @param y start y */ - protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int y) { + protected List addPlayerHotbarSlots(Inventory inventory, int x, int y) { hasHotbar = true; return this.addSlotsX(inventory, 0, x, y, DEFAULT_SLOT_SIZE, 9); } @@ -111,7 +111,7 @@ protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int * @param maxAmountY y line slot max amount * @return Slot list */ - protected List addSlots(Inventory inventory, int firstIndex, int firstX, int firstY, int size, int maxAmountX, int maxAmountY) { + protected List addSlots(Container inventory, int firstIndex, int firstX, int firstY, int size, int maxAmountX, int maxAmountY) { if (size < 0) size = DEFAULT_SLOT_SIZE; List slots = new ArrayList<>(); for (int y = 0; y < maxAmountY; ++y) { @@ -131,7 +131,7 @@ protected List addSlots(Inventory inventory, int firstIndex, int firstX, i * @param amount slot amount * @return Slot list */ - protected List addSlotsX(Inventory inventory, int firstIndex, int firstX, int y, int size, int amount) { + protected List addSlotsX(Container inventory, int firstIndex, int firstX, int y, int size, int amount) { if (size < 0) size = DEFAULT_SLOT_SIZE; List slots = new ArrayList<>(); for (int x = 0; x < amount; ++x) { @@ -151,7 +151,7 @@ protected List addSlotsX(Inventory inventory, int firstIndex, int firstX, * @param amount slot amount * @return Slot list */ - protected List addSlotsY(Inventory inventory, int firstIndex, int x, int firstY, int size, int amount) { + protected List addSlotsY(Container inventory, int firstIndex, int x, int firstY, int size, int amount) { if (size < 0) size = DEFAULT_SLOT_SIZE; List slots = new ArrayList<>(); for (int y = 0; y < amount; ++y) { @@ -162,18 +162,18 @@ protected List addSlotsY(Inventory inventory, int firstIndex, int x, int f } @Deprecated - public ItemStack quickMoveOverride(PlayerEntity player, int index) { + public ItemStack quickMoveOverride(Player player, int index) { return quickMoveOverride(new Player(player), index); } public boolean callInsertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { - return this.insertItem(stack, startIndex, endIndex, fromLast); + return this.moveItemStackTo(stack, startIndex, endIndex, fromLast); } @Deprecated @Override - protected boolean insertItem(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { - return super.insertItem(stack, startIndex, endIndex, fromLast); + protected boolean moveItemStackTo(ItemStack stack, int startIndex, int endIndex, boolean fromLast) { + return super.moveItemStackTo(stack, startIndex, endIndex, fromLast); } public ItemStack quickMoveOverride(Player player, int index) { @@ -216,7 +216,7 @@ public ItemStack quickMoveOverride(Player player, int index) { @Deprecated @Override - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { return quickMoveOverride(player, slot); } @@ -232,45 +232,45 @@ public Slot callGetSlot(int index) { @Deprecated @Override - public void onSlotClick(int slotIndex, int button, SlotActionType actionType, PlayerEntity player) { + public void clicked(int slotIndex, int button, ClickType actionType, Player player) { overrideOnSlotClick(slotIndex, button, actionType, new Player(player)); } - public void overrideOnSlotClick(int slotIndex, int button, SlotActionType actionType, Player player) { + public void overrideOnSlotClick(int slotIndex, int button, ClickType actionType, Player player) { onSlotClick(new SlotClickEvent(slotIndex, button, actionType, player)); } public void onSlotClick(SlotClickEvent e) { - super.onSlotClick(e.slot, e.button, e.actionType, e.player.getEntity()); + super.clicked(e.slot, e.button, e.actionType, e.player.getEntity()); } @Override @Deprecated - public void setCursorStack(ItemStack stack) { + public void setCarried(ItemStack stack) { callSetCursorStack(stack); } public void callSetCursorStack(ItemStack stack) { - super.setCursorStack(stack); + super.setCarried(stack); } @Override @Deprecated - public void setStackInSlot(int slot, int revision, ItemStack stack) { + public void setItem(int slot, int revision, ItemStack stack) { callSetStackInSlot(slot, revision, stack); } public void callSetStackInSlot(int slot, int revision, ItemStack stack) { - super.setStackInSlot(slot, revision, stack); + super.setItem(slot, revision, stack); } @Override @Deprecated - public int getRevision() { + public int getStateId() { return callGetRevision(); } public int callGetRevision() { - return super.getRevision(); + return super.getStateId(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java index 39d18ee67..d50054a17 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.gui; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.resource.featuretoggle.FeatureFlags; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -public class SimpleScreenHandlerTypeBuilder { +public class SimpleScreenHandlerTypeBuilder { private final Factory factory; @@ -18,21 +18,21 @@ public SimpleScreenHandlerTypeBuilder(Factory2 factory) { this.factory = factory; } - public ScreenHandlerType build() { - return new ScreenHandlerType<>(factory::create, FeatureFlags.VANILLA_FEATURES); + public MenuType build() { + return new MenuType<>(factory::create, FeatureFlags.VANILLA_SET); } @FunctionalInterface - public interface Factory { - T create(int syncId, PlayerInventory inventory); + public interface Factory { + T create(int syncId, Inventory inventory); } @FunctionalInterface - public interface Factory2 extends Factory { + public interface Factory2 extends Factory { T create(CreateMenuEvent e); @Override - default T create(int syncId, PlayerInventory inventory) { + default T create(int syncId, Inventory inventory) { return create(new CreateMenuEvent(syncId, inventory)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java index 1fface96e..bedcff8b7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java @@ -1,22 +1,22 @@ package net.pitan76.mcpitanlib.api.gui.args; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.world.World; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; public class CreateMenuEvent { public int syncId; - public PlayerInventory playerInventory; - public PlayerEntity player; + public Inventory playerInventory; + public Player player; - public CreateMenuEvent(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + public CreateMenuEvent(int syncId, Inventory playerInventory, Player player) { this.syncId = syncId; this.playerInventory = playerInventory; this.player = player; } - public CreateMenuEvent(int syncId, PlayerInventory playerInventory) { + public CreateMenuEvent(int syncId, Inventory playerInventory) { this.syncId = syncId; this.playerInventory = playerInventory; this.player = playerInventory.player; @@ -32,11 +32,11 @@ public int getSyncId() { return syncId; } - public PlayerInventory getPlayerInventory() { + public Inventory getPlayerInventory() { return playerInventory; } - public PlayerEntity getPlayerEntity() { + public Player getPlayerEntity() { return player; } @@ -52,7 +52,7 @@ public boolean isClient() { return getPlayer().isClient(); } - public World getWorld() { + public Level getWorld() { return getPlayer().getWorld(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java index 2c63f0d20..9466ae7c6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.gui.args; -import net.minecraft.screen.slot.SlotActionType; +import net.minecraft.world.inventory.ClickType; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.slot.CompatSlotActionType; public class SlotClickEvent { public int slot; public int button; - public SlotActionType actionType; + public ClickType actionType; public Player player; - public SlotClickEvent(int slot, int button, SlotActionType actionType, Player player) { + public SlotClickEvent(int slot, int button, ClickType actionType, Player player) { this.slot = slot; this.button = button; this.actionType = actionType; @@ -25,7 +25,7 @@ public int getButton() { return button; } - public SlotActionType getRawActionType() { + public ClickType getRawActionType() { return actionType; } @@ -46,22 +46,22 @@ public boolean isServer() { } public boolean isSwapAction() { - return actionType == SlotActionType.SWAP; + return actionType == ClickType.SWAP; } public boolean isPickupAction() { - return actionType == SlotActionType.PICKUP; + return actionType == ClickType.PICKUP; } public boolean isQuickCraftAction() { - return actionType == SlotActionType.QUICK_CRAFT; + return actionType == ClickType.QUICK_CRAFT; } public boolean isQuickMoveAction() { - return actionType == SlotActionType.QUICK_MOVE; + return actionType == ClickType.QUICK_MOVE; } public boolean isThrowAction() { - return actionType == SlotActionType.THROW; + return actionType == ClickType.THROW; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java index aea703cca..773beb145 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java @@ -1,32 +1,32 @@ package net.pitan76.mcpitanlib.api.gui.inventory; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.NonNullList; -public interface IInventory extends Inventory { +public interface IInventory extends Container { - DefaultedList getItems(); + NonNullList getItems(); - static IInventory of(DefaultedList items) { + static IInventory of(NonNullList items) { return () -> items; } static IInventory ofSize(int size) { - return of(DefaultedList.ofSize(size, ItemStack.EMPTY)); + return of(NonNullList.withSize(size, ItemStack.EMPTY)); } @Override - default int size() { + default int getContainerSize() { return getItems().size(); } @Override default boolean isEmpty() { - for (int i = 0; i < size(); i++) { - ItemStack stack = getStack(i); + for (int i = 0; i < getContainerSize(); i++) { + ItemStack stack = getItem(i); if (!stack.isEmpty()) { return false; } @@ -35,43 +35,43 @@ default boolean isEmpty() { } @Override - default ItemStack getStack(int slot) { + default ItemStack getItem(int slot) { return getItems().get(slot); } @Override - default ItemStack removeStack(int slot, int count) { - ItemStack result = Inventories.splitStack(getItems(), slot, count); + default ItemStack removeItem(int slot, int count) { + ItemStack result = ContainerHelper.removeItem(getItems(), slot, count); if (!result.isEmpty()) { - markDirty(); + setChanged(); } return result; } @Override - default ItemStack removeStack(int slot) { - return Inventories.removeStack(getItems(), slot); + default ItemStack removeItemNoUpdate(int slot) { + return ContainerHelper.takeItem(getItems(), slot); } @Override - default void setStack(int slot, ItemStack stack) { + default void setItem(int slot, ItemStack stack) { getItems().set(slot, stack); - if (stack.getCount() > getMaxCountPerStack()) { - stack.setCount(getMaxCountPerStack()); + if (stack.getCount() > getMaxStackSize()) { + stack.setCount(getMaxStackSize()); } } @Override - default void clear() { + default void clearContent() { getItems().clear(); } @Override - default void markDirty() { + default void setChanged() { } @Override - default boolean canPlayerUse(PlayerEntity player) { + default boolean stillValid(Player player) { return true; } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java index 5f4ce81b3..51b268cac 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.gui.inventory.sided; -import net.minecraft.inventory.SidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Direction; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.Direction; import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.AvailableSlotsArgs; import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanExtractArgs; import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanInsertArgs; import org.jetbrains.annotations.Nullable; -public interface CompatSidedInventory extends SidedInventory { +public interface CompatSidedInventory extends WorldlyContainer { @Override @Deprecated - default int[] getAvailableSlots(Direction side) { + default int[] getSlotsForFace(Direction side) { return getAvailableSlots(new AvailableSlotsArgs(side, this)); } @@ -19,7 +19,7 @@ default int[] getAvailableSlots(Direction side) { @Override @Deprecated - default boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { + default boolean canPlaceItemThroughFace(int slot, ItemStack stack, @Nullable Direction dir) { return canInsert(new CanInsertArgs(slot, stack, dir)); } @@ -27,7 +27,7 @@ default boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { @Override @Deprecated - default boolean canExtract(int slot, ItemStack stack, Direction dir) { + default boolean canTakeItemThroughFace(int slot, ItemStack stack, Direction dir) { return canExtract(new CanExtractArgs(slot, stack, dir)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java index 119a59057..de089581e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.gui.inventory.sided; -import net.minecraft.util.math.Direction; +import net.minecraft.core.Direction; import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanExtractArgs; import net.pitan76.mcpitanlib.api.gui.inventory.sided.args.CanInsertArgs; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java index 748b47420..b137b989e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; -import net.minecraft.util.math.Direction; +import net.minecraft.core.Direction; import net.pitan76.mcpitanlib.api.gui.inventory.sided.CompatSidedInventory; import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; @@ -26,7 +26,7 @@ public int[] getAllSlots() { return new int[0]; IInventory inv = (IInventory) inventory; - int size = inv.size(); + int size = inv.getContainerSize(); int[] slots = new int[size]; for (int i = 0; i < size; i++) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java index 568dcbe4c..62f24ed49 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.Direction; public class CanExtractArgs { public int slot; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java index a6aa1a662..5fdf4ff9c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.gui.inventory.sided.args; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.Direction; import org.jetbrains.annotations.Nullable; public class CanInsertArgs { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java index 0addfd2a2..72b1cb566 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java @@ -1,43 +1,43 @@ package net.pitan76.mcpitanlib.api.gui.slot; -import net.minecraft.screen.slot.SlotActionType; +import net.minecraft.world.inventory.ClickType; public class CompatSlotActionType { - public static final CompatSlotActionType PICKUP = new CompatSlotActionType(SlotActionType.PICKUP); - public static final CompatSlotActionType QUICK_MOVE = new CompatSlotActionType(SlotActionType.QUICK_MOVE); - public static final CompatSlotActionType SWAP = new CompatSlotActionType(SlotActionType.SWAP); - public static final CompatSlotActionType THROW = new CompatSlotActionType(SlotActionType.THROW); - public static final CompatSlotActionType CLONE = new CompatSlotActionType(SlotActionType.CLONE); - public static final CompatSlotActionType QUICK_CRAFT = new CompatSlotActionType(SlotActionType.QUICK_CRAFT); - public static final CompatSlotActionType PICKUP_ALL = new CompatSlotActionType(SlotActionType.PICKUP_ALL); + public static final CompatSlotActionType PICKUP = new CompatSlotActionType(ClickType.PICKUP); + public static final CompatSlotActionType QUICK_MOVE = new CompatSlotActionType(ClickType.QUICK_MOVE); + public static final CompatSlotActionType SWAP = new CompatSlotActionType(ClickType.SWAP); + public static final CompatSlotActionType THROW = new CompatSlotActionType(ClickType.THROW); + public static final CompatSlotActionType CLONE = new CompatSlotActionType(ClickType.CLONE); + public static final CompatSlotActionType QUICK_CRAFT = new CompatSlotActionType(ClickType.QUICK_CRAFT); + public static final CompatSlotActionType PICKUP_ALL = new CompatSlotActionType(ClickType.PICKUP_ALL); - public final SlotActionType raw; + public final ClickType raw; - protected CompatSlotActionType(SlotActionType raw) { + protected CompatSlotActionType(ClickType raw) { this.raw = raw; } - public static CompatSlotActionType of(SlotActionType raw) { - if (raw == SlotActionType.PICKUP) return PICKUP; - if (raw == SlotActionType.QUICK_MOVE) return QUICK_MOVE; - if (raw == SlotActionType.SWAP) return SWAP; - if (raw == SlotActionType.THROW) return THROW; - if (raw == SlotActionType.CLONE) return CLONE; - if (raw == SlotActionType.QUICK_CRAFT) return QUICK_CRAFT; - if (raw == SlotActionType.PICKUP_ALL) return PICKUP_ALL; + public static CompatSlotActionType of(ClickType raw) { + if (raw == ClickType.PICKUP) return PICKUP; + if (raw == ClickType.QUICK_MOVE) return QUICK_MOVE; + if (raw == ClickType.SWAP) return SWAP; + if (raw == ClickType.THROW) return THROW; + if (raw == ClickType.CLONE) return CLONE; + if (raw == ClickType.QUICK_CRAFT) return QUICK_CRAFT; + if (raw == ClickType.PICKUP_ALL) return PICKUP_ALL; return new CompatSlotActionType(raw); } public boolean isSwapOrPickupOrQuickMoveOrThrow() { - return raw == SlotActionType.SWAP || raw == SlotActionType.PICKUP || raw == SlotActionType.QUICK_MOVE || raw == SlotActionType.THROW; + return raw == ClickType.SWAP || raw == ClickType.PICKUP || raw == ClickType.QUICK_MOVE || raw == ClickType.THROW; } - public SlotActionType getRaw() { + public ClickType getRaw() { return raw; } public int getIndex() { - return raw.getIndex(); + return raw.id(); } public String getName() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java index f49db49df..5bc2fd712 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java @@ -1,19 +1,19 @@ package net.pitan76.mcpitanlib.api.gui.slot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.Slot; import net.pitan76.mcpitanlib.api.entity.Player; public class CompatibleSlot extends Slot { - public Inventory inventory; + public Container inventory; public int index; public int x; public int y; - public CompatibleSlot(Inventory inventory, int index, int x, int y) { + public CompatibleSlot(Container inventory, int index, int x, int y) { super(inventory, index, x, y); this.inventory = inventory; this.index = index; @@ -22,65 +22,65 @@ public CompatibleSlot(Inventory inventory, int index, int x, int y) { } public void callSetStack(ItemStack stack) { - super.setStack(stack); + super.setByPlayer(stack); } public void callSetStackNoCallbacks(ItemStack stack) { - super.setStackNoCallbacks(stack); + super.set(stack); } public ItemStack callGetStack() { - return super.getStack(); + return super.getItem(); } public ItemStack callTakeStack(int amount) { - return super.takeStack(amount); + return super.remove(amount); } public boolean callHasStack() { - return super.hasStack(); + return super.hasItem(); } @Deprecated @Override - public void setStack(ItemStack stack) { + public void setByPlayer(ItemStack stack) { callSetStack(stack); } @Deprecated @Override - public void setStackNoCallbacks(ItemStack stack) { + public void set(ItemStack stack) { callSetStackNoCallbacks(stack); } @Deprecated @Override - public ItemStack getStack() { + public ItemStack getItem() { return callGetStack(); } @Deprecated @Override - public ItemStack takeStack(int amount) { + public ItemStack remove(int amount) { return callTakeStack(amount); } @Deprecated @Override - public boolean hasStack() { + public boolean hasItem() { return callHasStack(); } - public Inventory callGetInventory() { + public Container callGetInventory() { return inventory; } public int callGetIndex() { - return super.getIndex(); + return super.getContainerSlot(); } public int callGetId() { - return super.id; + return super.index; } public int callGetX() { @@ -92,34 +92,34 @@ public int callGetY() { } public void callMarkDirty() { - super.markDirty(); + super.setChanged(); } @Override - public boolean canInsert(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack)); } @Override - public boolean canTakeItems(PlayerEntity playerEntity) { + public boolean mayPickup(Player playerEntity) { return canTakeItems(new Player(playerEntity)); } public boolean canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - return super.canInsert(stack.toMinecraft()); + return super.mayPlace(stack.toMinecraft()); } public boolean canTakeItems(Player player) { - return super.canTakeItems(player.getEntity()); + return super.mayPickup(player.getEntity()); } @Deprecated @Override - public boolean canTakePartial(PlayerEntity player) { + public boolean allowModification(Player player) { return canTakePartial(new Player(player)); } public boolean canTakePartial(Player player) { - return super.canTakePartial(player.getEntity()); + return super.allowModification(player.getEntity()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java index b26d1915f..306dea95f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.gui.v2; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandler; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; @SuppressWarnings("deprecation") public interface ExtendedScreenHandlerFactory extends net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerFactory { @Override - default ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + default AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { return createMenu(new CreateMenuEvent(syncId, playerInventory, player)); } - ScreenHandler createMenu(CreateMenuEvent event); + AbstractContainerMenu createMenu(CreateMenuEvent event); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java index 8d447ebb3..775d9790f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java @@ -1,25 +1,25 @@ package net.pitan76.mcpitanlib.api.gui.v2; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; -public interface SimpleScreenHandlerFactory extends NamedScreenHandlerFactory { +public interface SimpleScreenHandlerFactory extends MenuProvider { @Override - default Text getDisplayName() { + default Component getDisplayName() { return getDisplayName(new DisplayNameArgs()); } - Text getDisplayName(DisplayNameArgs args); + Component getDisplayName(DisplayNameArgs args); @Override - default ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + default AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { return createMenu(new CreateMenuEvent(syncId, playerInventory, player)); } - ScreenHandler createMenu(CreateMenuEvent event); + AbstractContainerMenu createMenu(CreateMenuEvent event); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java b/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java index 763444f86..b3dab7cb9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.helper; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; import net.pitan76.mcpitanlib.api.block.ExtendBlock; import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; @@ -63,7 +63,7 @@ public static CreativeTabBuilder createCreativeTab(CompatRegistryV2 registry, Co return builder; } - public static CreativeTabBuilder createCreativeTabByItem(CompatRegistryV2 registry, CompatIdentifier id, Supplier item) { + public static CreativeTabBuilder createCreativeTabByItem(CompatRegistryV2 registry, CompatIdentifier id, Supplier item) { return createCreativeTab(registry, id, () -> ItemStackUtil.create(item.get())); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java index 14e0cf624..154f8ad94 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java @@ -1,22 +1,22 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.equipment.EquipmentType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.equipment.ArmorType; import org.jetbrains.annotations.Nullable; public class ArmorEquipmentType { - public static ArmorEquipmentType HEAD = new ArmorEquipmentType(EquipmentSlot.HEAD, EquipmentType.HELMET); - public static ArmorEquipmentType CHEST = new ArmorEquipmentType(EquipmentSlot.CHEST, EquipmentType.CHESTPLATE); - public static ArmorEquipmentType LEGS = new ArmorEquipmentType(EquipmentSlot.LEGS, EquipmentType.LEGGINGS); - public static ArmorEquipmentType FEET = new ArmorEquipmentType(EquipmentSlot.FEET, EquipmentType.BOOTS); + public static ArmorEquipmentType HEAD = new ArmorEquipmentType(EquipmentSlot.HEAD, ArmorType.HELMET); + public static ArmorEquipmentType CHEST = new ArmorEquipmentType(EquipmentSlot.CHEST, ArmorType.CHESTPLATE); + public static ArmorEquipmentType LEGS = new ArmorEquipmentType(EquipmentSlot.LEGS, ArmorType.LEGGINGS); + public static ArmorEquipmentType FEET = new ArmorEquipmentType(EquipmentSlot.FEET, ArmorType.BOOTS); // New type for animals from 1.20.5 - public static ArmorEquipmentType BODY = new ArmorEquipmentType(EquipmentSlot.BODY, EquipmentType.BODY); + public static ArmorEquipmentType BODY = new ArmorEquipmentType(EquipmentSlot.BODY, ArmorType.BODY); protected final EquipmentSlot slot; - protected final EquipmentType type; + protected final ArmorType type; - protected ArmorEquipmentType(EquipmentSlot slot, EquipmentType type) { + protected ArmorEquipmentType(EquipmentSlot slot, ArmorType type) { this.slot = slot; this.type = type; } @@ -27,7 +27,7 @@ public EquipmentSlot getSlot() { } @Deprecated - public EquipmentType getType() { + public ArmorType getType() { return type; } @@ -53,7 +53,7 @@ public static ArmorEquipmentType of(EquipmentSlot slot) { } @Nullable - public static ArmorEquipmentType of(EquipmentType type) { + public static ArmorEquipmentType of(ArmorType type) { switch (type) { case HELMET -> { return HEAD; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java index c7cf23987..bdfea8efb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.item; import com.mojang.datafixers.util.Pair; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.effect.MobEffectInstance; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; import java.util.ArrayList; @@ -14,9 +14,9 @@ public class CompatFoodComponent { private boolean meat; private boolean alwaysEdible; private boolean snack; - private final List> statusEffects = new ArrayList<>(); + private final List> statusEffects = new ArrayList<>(); - private FoodComponent latestComponent = null; + private FoodProperties latestComponent = null; public static CompatFoodComponent create() { return new CompatFoodComponent(); @@ -48,7 +48,7 @@ public CompatFoodComponent setMeat() { } @Deprecated - public CompatFoodComponent addStatusEffect(StatusEffectInstance effect, float chance) { + public CompatFoodComponent addStatusEffect(MobEffectInstance effect, float chance) { statusEffects.add(Pair.of(effect, chance)); return this; } @@ -57,26 +57,26 @@ public CompatFoodComponent addStatusEffect(CompatStatusEffectInstance instance, return addStatusEffect(instance.getInstance(), chance); } - public FoodComponent.Builder getVanillaBuilder() { - FoodComponent.Builder builder = new FoodComponent.Builder(); + public FoodProperties.Builder getVanillaBuilder() { + FoodProperties.Builder builder = new FoodProperties.Builder(); builder.nutrition(hunger).saturationModifier(saturation); if (alwaysEdible) builder.alwaysEdible(); return builder; } - public FoodComponent build() { + public FoodProperties build() { if (latestComponent != null) return latestComponent; float eatSeconds = 1.6f; if (snack) eatSeconds = 0.8f; if (meat) eatSeconds = 1.6f; - latestComponent = new FoodComponent(hunger, saturation, alwaysEdible); + latestComponent = new FoodProperties(hunger, saturation, alwaysEdible); return latestComponent; } - public FoodComponent vanillaBuild() { + public FoodProperties vanillaBuild() { if (latestComponent != null) return latestComponent; latestComponent = getVanillaBuilder().build(); @@ -106,13 +106,13 @@ public boolean isAlwaysEdible() { } @Deprecated - public List> getStatusEffects() { + public List> getStatusEffects() { return statusEffects; } public List> getCompatStatusEffects() { List> compatStatusEffects = new ArrayList<>(); - for (Pair pair : statusEffects) { + for (Pair pair : statusEffects) { compatStatusEffects.add(Pair.of(new CompatStatusEffectInstance(pair.getFirst()), pair.getSecond())); } return compatStatusEffects; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java index d7c0e9958..a35a073d6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.item.Item; -import net.minecraft.item.Items; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; public class CompatItems { public static Item SHORT_GRASS = Items.SHORT_GRASS; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java index 0a6db5d51..c6e4cd33b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; @@ -11,7 +11,7 @@ public class CompatibleArmorItem extends Item implements CompatItemProvider { public CompatibleItemSettings settings; public CompatibleArmorItem(CompatibleArmorMaterial material, ArmorEquipmentType type, CompatibleItemSettings settings) { - super(settings.build().armor(material.build(), type.getType())); + super(settings.build().humanoidArmor(material.build(), type.getType())); this.type = type; this.material = material; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java index b5ee77b72..ab7438054 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.item.Item; -import net.minecraft.item.equipment.ArmorMaterial; -import net.minecraft.item.equipment.EquipmentAssetKeys; -import net.minecraft.item.equipment.EquipmentType; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.equipment.ArmorMaterial; +import net.minecraft.world.item.equipment.EquipmentAssets; +import net.minecraft.world.item.equipment.ArmorType; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.Holder; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.IngredientUtil; @@ -25,7 +25,7 @@ public interface CompatibleArmorMaterial { SoundEvent getEquipSound(); default Ingredient getRepairIngredient() { - return IngredientUtil.fromTagByIdentifier(getRepairTag().id()); + return IngredientUtil.fromTagByIdentifier(getRepairTag().location()); } /** @@ -50,15 +50,15 @@ default TagKey getRepairTag() { @Deprecated default ArmorMaterial build() { - return new ArmorMaterial(0, getDefense(), getEnchantability(), RegistryEntry.of(getEquipSound()), getToughness(), getKnockbackResistance(), getRepairTag(), RegistryKey.of(EquipmentAssetKeys.REGISTRY_KEY, getId())); + return new ArmorMaterial(0, getDefense(), getEnchantability(), Holder.direct(getEquipSound()), getToughness(), getKnockbackResistance(), getRepairTag(), ResourceKey.create(EquipmentAssets.ROOT_ID, getId())); } - default EnumMap getDefense() { - EnumMap map = new EnumMap<>(EquipmentType.class); - map.put(EquipmentType.HELMET, this.getProtection(ArmorEquipmentType.HEAD)); - map.put(EquipmentType.CHESTPLATE, this.getProtection(ArmorEquipmentType.CHEST)); - map.put(EquipmentType.LEGGINGS, this.getProtection(ArmorEquipmentType.LEGS)); - map.put(EquipmentType.BOOTS, this.getProtection(ArmorEquipmentType.FEET)); + default EnumMap getDefense() { + EnumMap map = new EnumMap<>(ArmorType.class); + map.put(ArmorType.HELMET, this.getProtection(ArmorEquipmentType.HEAD)); + map.put(ArmorType.CHESTPLATE, this.getProtection(ArmorEquipmentType.CHEST)); + map.put(ArmorType.LEGGINGS, this.getProtection(ArmorEquipmentType.LEGS)); + map.put(ArmorType.BOOTS, this.getProtection(ArmorEquipmentType.FEET)); return map; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java index dddfb3219..74978a660 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.item; import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; -import net.minecraft.util.Rarity; +import net.minecraft.world.item.Rarity; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; @@ -26,20 +26,20 @@ public static CompatibleItemSettings of() { } // ~1.19.2 - public CompatibleItemSettings addGroup(ItemGroup itemGroup) { + public CompatibleItemSettings addGroup(CreativeModeTab itemGroup) { settings.addGroup(itemGroup); return this; } // 1.19.3~ // identifier: Item ID - public CompatibleItemSettings addGroup(ItemGroup itemGroup, Identifier identifier) { + public CompatibleItemSettings addGroup(CreativeModeTab itemGroup, Identifier identifier) { settings.addGroup(itemGroup, identifier); _itemId = identifier; return this; } - public CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { + public CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { settings.addGroup(itemGroup, identifier); _itemId = identifier; return this; @@ -51,25 +51,25 @@ public CompatibleItemSettings addGroup(CreativeTabBuilder itemGroup) { } public CompatibleItemSettings maxCount(int maxCount) { - settings.maxCount(maxCount); + settings.stacksTo(maxCount); return this; } public CompatibleItemSettings maxDamage(int maxDamage) { - settings.maxDamage(maxDamage); + settings.durability(maxDamage); return this; } public CompatibleItemSettings maxDamageIfAbsent(int maxDamage) { try { - settings.maxDamage(maxDamage); + settings.durability(maxDamage); } catch (Exception ignored) {} return this; } @Deprecated - public CompatibleItemSettings food(FoodComponent foodComponent) { + public CompatibleItemSettings food(FoodProperties foodComponent) { settings.food(foodComponent); return this; } @@ -80,28 +80,28 @@ public CompatibleItemSettings rarity(Rarity rarity) { } public CompatibleItemSettings recipeRemainder(Item recipeRemainder) { - settings.recipeRemainder(recipeRemainder); + settings.craftRemainder(recipeRemainder); return this; } public ExtendSettings build() { if (itemGroupId != null) { - RegistrySupplier itemGroup = MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(itemGroupId); + RegistrySupplier itemGroup = MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(itemGroupId); settings.arch$tab(itemGroup); } if (_itemId != null && !(this instanceof net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings)) { - settings.registryKey(RegistryKey.of(RegistryKeys.ITEM, _itemId)); + settings.setId(ResourceKey.create(Registries.ITEM, _itemId)); } return settings; } - public CompatibleItemSettings addGroup(ItemGroup itemGroup, CompatIdentifier identifier) { + public CompatibleItemSettings addGroup(CreativeModeTab itemGroup, CompatIdentifier identifier) { return addGroup(itemGroup, identifier.toMinecraft()); } - public CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { + public CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { return addGroup(itemGroup, identifier.toMinecraft()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java index 790aa3de2..812b47ebd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.item; import dev.architectury.registry.CreativeTabRegistry; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.IdentifierUtil; @@ -16,7 +16,7 @@ public class CreativeTabBuilder { private final Identifier identifier; - private Text displayName = null; + private Component displayName = null; private Supplier iconSupplier = null; private boolean noRenderedName = false; private boolean noScrollbar = false; @@ -37,7 +37,7 @@ public static CreativeTabBuilder create(CompatIdentifier identifier) { return create(identifier.toMinecraft()); } - public CreativeTabBuilder setDisplayName(Text text) { + public CreativeTabBuilder setDisplayName(Component text) { this.displayName = text; return this; } @@ -81,16 +81,16 @@ public void setTexture(String texture) { * Build ItemGroup (If loader is forge, not recommended) * @return ItemGroup */ - public ItemGroup build() { + public CreativeModeTab build() { return CreativeTabRegistry.create((builder -> { - if (displayName != null) builder.displayName(displayName); - else builder.displayName(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); + if (displayName != null) builder.title(displayName); + else builder.title(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); if (iconSupplier != null) builder.icon(iconSupplier); - if (noRenderedName) builder.noRenderedName(); - if (noScrollbar) builder.noScrollbar(); - if (special) builder.special(); - if (texture != null) builder.texture(IdentifierUtil.id(texture)); + if (noRenderedName) builder.hideTitle(); + if (noScrollbar) builder.noScrollBar(); + if (special) builder.alignedRight(); + if (texture != null) builder.backgroundTexture(IdentifierUtil.id(texture)); })); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java index 91b0afabd..c3b25afb6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.item; import dev.architectury.registry.CreativeTabRegistry; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.ItemUtil; @@ -17,23 +17,23 @@ public class CreativeTabManager { // グループ予約済みアイテム public static class BookingItem { @Deprecated - public ItemGroup itemGroup; + public CreativeModeTab itemGroup; - public Supplier itemGroupSupplier; + public Supplier itemGroupSupplier; public Identifier identifier; @Deprecated - private BookingItem(ItemGroup itemGroup, Identifier identifier) { + private BookingItem(CreativeModeTab itemGroup, Identifier identifier) { this.itemGroup = itemGroup; this.identifier = identifier; } - private BookingItem(Supplier itemGroup, Identifier identifier) { + private BookingItem(Supplier itemGroup, Identifier identifier) { this.itemGroupSupplier = itemGroup; this.identifier = identifier; } - public ItemGroup getItemGroup() { + public CreativeModeTab getItemGroup() { if (itemGroupSupplier != null) return itemGroupSupplier.get(); return itemGroup; @@ -43,23 +43,23 @@ public ItemGroup getItemGroup() { // グループ予約済みアイテムスタック public static class BookingStack { @Deprecated - public ItemGroup itemGroup; + public CreativeModeTab itemGroup; - public Supplier itemGroupSupplier; + public Supplier itemGroupSupplier; public ItemStack stack; @Deprecated - private BookingStack(ItemGroup itemGroup, ItemStack stack) { + private BookingStack(CreativeModeTab itemGroup, ItemStack stack) { this.itemGroup = itemGroup; this.stack = stack; } - private BookingStack(Supplier itemGroup, ItemStack stack) { + private BookingStack(Supplier itemGroup, ItemStack stack) { this.itemGroupSupplier = itemGroup; this.stack = stack; } - public ItemGroup getItemGroup() { + public CreativeModeTab getItemGroup() { if (itemGroupSupplier != null) return itemGroupSupplier.get(); return itemGroup; @@ -93,20 +93,20 @@ public static void register(Identifier identifier) { } @Deprecated - public static void addItem(ItemGroup itemGroup, Identifier identifier) { + public static void addItem(CreativeModeTab itemGroup, Identifier identifier) { bookingItems.add(new BookingItem(itemGroup, identifier)); } @Deprecated - public static void addStack(ItemGroup itemGroup, ItemStack stack) { + public static void addStack(CreativeModeTab itemGroup, ItemStack stack) { bookingStacks.add(new BookingStack(itemGroup, stack)); } - public static void addItem(Supplier itemGroup, Identifier identifier) { + public static void addItem(Supplier itemGroup, Identifier identifier) { bookingItems.add(new BookingItem(itemGroup, identifier)); } - public static void addStack(Supplier itemGroup, ItemStack stack) { + public static void addStack(Supplier itemGroup, ItemStack stack) { bookingStacks.add(new BookingStack(itemGroup, stack)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java b/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java index b5d5f17ce..727a81c42 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.ItemGroups; -import net.minecraft.registry.Registries; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.core.registries.BuiltInRegistries; public class DefaultItemGroups { - public static final ItemGroup BUILDING_BLOCKS = Registries.ITEM_GROUP.get(ItemGroups.BUILDING_BLOCKS); - public static final ItemGroup COLORED_BLOCKS = Registries.ITEM_GROUP.get(ItemGroups.COLORED_BLOCKS); // if 1.19.2 and below, BUILDING_BLOCKS - public static final ItemGroup NATURAL = Registries.ITEM_GROUP.get(ItemGroups.NATURAL); // if 1.19.2 and below, DECORATIONS - public static final ItemGroup FUNCTIONAL = Registries.ITEM_GROUP.get(ItemGroups.FUNCTIONAL); // if 1.19.2 and below, TRANSPORTATION - public static final ItemGroup REDSTONE = Registries.ITEM_GROUP.get(ItemGroups.REDSTONE); - public static final ItemGroup HOTBAR = Registries.ITEM_GROUP.get(ItemGroups.HOTBAR); - public static final ItemGroup SEARCH = Registries.ITEM_GROUP.get(ItemGroups.SEARCH); - public static final ItemGroup TOOLS = Registries.ITEM_GROUP.get(ItemGroups.TOOLS); - public static final ItemGroup COMBAT = Registries.ITEM_GROUP.get(ItemGroups.COMBAT); - public static final ItemGroup FOOD_AND_DRINK = Registries.ITEM_GROUP.get(ItemGroups.FOOD_AND_DRINK); // if 1.19.2 and below, FOOD - public static final ItemGroup INGREDIENTS = Registries.ITEM_GROUP.get(ItemGroups.INGREDIENTS); // if 1.19.2 and below, MISC - public static final ItemGroup SPAWN_EGGS = Registries.ITEM_GROUP.get(ItemGroups.SPAWN_EGGS); // if 1.19.2 and below, MISC - public static final ItemGroup OPERATOR = Registries.ITEM_GROUP.get(ItemGroups.OPERATOR); // if 1.19.2 and below, MISC - public static final ItemGroup INVENTORY = Registries.ITEM_GROUP.get(ItemGroups.INVENTORY); + public static final CreativeModeTab BUILDING_BLOCKS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.BUILDING_BLOCKS); + public static final CreativeModeTab COLORED_BLOCKS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.COLORED_BLOCKS); // if 1.19.2 and below, BUILDING_BLOCKS + public static final CreativeModeTab NATURAL = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.NATURAL_BLOCKS); // if 1.19.2 and below, DECORATIONS + public static final CreativeModeTab FUNCTIONAL = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.FUNCTIONAL_BLOCKS); // if 1.19.2 and below, TRANSPORTATION + public static final CreativeModeTab REDSTONE = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.REDSTONE_BLOCKS); + public static final CreativeModeTab HOTBAR = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.HOTBAR); + public static final CreativeModeTab SEARCH = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.SEARCH); + public static final CreativeModeTab TOOLS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.TOOLS_AND_UTILITIES); + public static final CreativeModeTab COMBAT = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.COMBAT); + public static final CreativeModeTab FOOD_AND_DRINK = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.FOOD_AND_DRINKS); // if 1.19.2 and below, FOOD + public static final CreativeModeTab INGREDIENTS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.INGREDIENTS); // if 1.19.2 and below, MISC + public static final CreativeModeTab SPAWN_EGGS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.SPAWN_EGGS); // if 1.19.2 and below, MISC + public static final CreativeModeTab OPERATOR = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.OP_BLOCKS); // if 1.19.2 and below, MISC + public static final CreativeModeTab INVENTORY = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.INVENTORY); // ~1.19.2 Item Group - public static final ItemGroup BREWING = FOOD_AND_DRINK; - public static final ItemGroup TRANSPORTATION = FUNCTIONAL; - public static final ItemGroup DECORATIONS = NATURAL; - public static final ItemGroup MISC = INGREDIENTS; + public static final CreativeModeTab BREWING = FOOD_AND_DRINK; + public static final CreativeModeTab TRANSPORTATION = FUNCTIONAL; + public static final CreativeModeTab DECORATIONS = NATURAL; + public static final CreativeModeTab MISC = INGREDIENTS; } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java index d69eaa553..d185dc2aa 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java @@ -1,29 +1,31 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.block.Block; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.world.World; +import net.minecraft.world.item.Item.Properties; +import net.minecraft.world.item.Item.TooltipContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.*; import net.pitan76.mcpitanlib.api.util.CompatActionResult; import net.pitan76.mcpitanlib.api.util.StackActionResult; import net.pitan76.mcpitanlib.core.Dummy; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; +import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; import java.util.List; import java.util.function.Consumer; public class ExtendBlockItem extends BlockItem implements ExtendItemProvider { - public ExtendBlockItem(Block block, Settings settings) { + public ExtendBlockItem(Block block, Properties settings) { super(block, settings); } @@ -34,26 +36,26 @@ public ExtendBlockItem(Block block, CompatibleItemSettings settings) { // ExtendItem @Deprecated @Override - public ActionResult use(World world, PlayerEntity user, Hand hand) { + public InteractionResult use(Level world, Player user, InteractionHand hand) { return onRightClick(new ItemUseEvent(world, user, hand)).toActionResult(); } @Deprecated @Override - public ActionResult useOnBlock(ItemUsageContext context) { - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; - return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); + public InteractionResult useOn(UseOnContext context) { + UseOnContextMixin contextAccessor = (UseOnContextMixin) context; + return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHitResult())).toActionResult(); } @Deprecated @Override - public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { + public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) { return onFinishUsing(new ItemFinishUsingEvent(stack, world, user)); } @Deprecated @Override - public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); } @@ -64,13 +66,13 @@ public boolean hasRecipeRemainder() { @Deprecated @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + public void appendHoverText(ItemStack stack, TooltipContext context, TooltipDisplay displayComponent, Consumer textConsumer, TooltipFlag type) { appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); } @Deprecated @Override - public void onCraft(ItemStack stack, World world) { + public void onCraftedPostProcess(ItemStack stack, Level world) { onCraft(new CraftEvent(stack, world)); } @@ -90,7 +92,7 @@ public StackActionResult onRightClick(ItemUseEvent event) { * @return ActionResultType */ public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { - return CompatActionResult.create(super.useOnBlock(event.toIUC())); + return CompatActionResult.create(super.useOn(event.toIUC())); } /** @@ -99,7 +101,7 @@ public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { * @return ItemStack */ public ItemStack onFinishUsing(ItemFinishUsingEvent event) { - return super.finishUsing(event.stack, event.world, event.user); + return super.finishUsingItem(event.stack, event.world, event.user); } /** @@ -108,7 +110,7 @@ public ItemStack onFinishUsing(ItemFinishUsingEvent event) { * @return ActionResultType */ public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event) { - return CompatActionResult.create(super.useOnEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); + return CompatActionResult.create(super.interactLivingEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); } /** @@ -125,7 +127,7 @@ public boolean hasRecipeRemainder(Dummy dummy) { * @param event ItemAppendTooltipEvent */ public void appendTooltip(ItemAppendTooltipEvent event) { - super.appendTooltip(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); + super.appendHoverText(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); } /** @@ -133,6 +135,6 @@ public void appendTooltip(ItemAppendTooltipEvent event) { * @param event CraftEvent */ public void onCraft(CraftEvent event) { - super.onCraft(event.stack, event.world); + super.onCraftedPostProcess(event.stack, event.world); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java index 54e1391cc..81863f2ea 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java @@ -1,34 +1,36 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.block.BlockState; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.item.consume.UseAction; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Rarity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.item.Item.Properties; +import net.minecraft.world.item.Item.TooltipContext; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.item.Rarity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.*; import net.pitan76.mcpitanlib.api.util.CompatActionResult; import net.pitan76.mcpitanlib.api.util.StackActionResult; import net.pitan76.mcpitanlib.core.Dummy; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; +import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; import java.util.List; import java.util.function.Consumer; public class ExtendItem extends Item { - public ExtendItem(Settings settings) { + public ExtendItem(Properties settings) { super(settings); } @@ -38,32 +40,32 @@ public ExtendItem(CompatibleItemSettings settings) { @Deprecated @Override - public ActionResult use(World world, PlayerEntity user, Hand hand) { + public InteractionResult use(Level world, Player user, InteractionHand hand) { return onRightClick(new ItemUseEvent(world, user, hand)).toActionResult(); } @Deprecated @Override - public ActionResult useOnBlock(ItemUsageContext context) { - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; - return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); + public InteractionResult useOn(UseOnContext context) { + UseOnContextMixin contextAccessor = (UseOnContextMixin) context; + return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHitResult())).toActionResult(); } @Deprecated @Override - public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { + public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) { return onFinishUsing(new ItemFinishUsingEvent(stack, world, user)); } @Deprecated @Override - public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); } @Override - public UseAction getUseAction(ItemStack stack) { - return super.getUseAction(stack); + public ItemUseAnimation getUseAnimation(ItemStack stack) { + return super.getUseAnimation(stack); } @Deprecated @@ -74,25 +76,25 @@ public boolean hasRecipeRemainder() { @Deprecated @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + public void appendHoverText(ItemStack stack, TooltipContext context, TooltipDisplay displayComponent, Consumer textConsumer, TooltipFlag type) { appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); } @Deprecated @Override - public void onCraft(ItemStack stack, World world) { + public void onCraftedPostProcess(ItemStack stack, Level world) { onCraft(new CraftEvent(stack, world)); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -112,7 +114,7 @@ public StackActionResult onRightClick(ItemUseEvent event) { * @return ActionResultType */ public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { - return CompatActionResult.create(super.useOnBlock(event.toIUC())); + return CompatActionResult.create(super.useOn(event.toIUC())); } /** @@ -121,7 +123,7 @@ public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { * @return ItemStack */ public ItemStack onFinishUsing(ItemFinishUsingEvent event) { - return super.finishUsing(event.stack, event.world, event.user); + return super.finishUsingItem(event.stack, event.world, event.user); } /** @@ -130,7 +132,7 @@ public ItemStack onFinishUsing(ItemFinishUsingEvent event) { * @return ActionResultType */ public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event) { - return CompatActionResult.create(super.useOnEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); + return CompatActionResult.create(super.interactLivingEntity(event.stack, event.user.getEntity(), event.entity, event.hand)); } /** @@ -147,7 +149,7 @@ public boolean hasRecipeRemainder(Dummy dummy) { * @param event ItemAppendTooltipEvent */ public void appendTooltip(ItemAppendTooltipEvent event) { - super.appendTooltip(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); + super.appendHoverText(event.stack, event.context, event.displayComponent, event.textConsumer, event.type); } /** @@ -155,7 +157,7 @@ public void appendTooltip(ItemAppendTooltipEvent event) { * @param event CraftEvent */ public void onCraft(CraftEvent event) { - super.onCraft(event.stack, event.world); + super.onCraftedPostProcess(event.stack, event.world); } /** @@ -164,7 +166,7 @@ public void onCraft(CraftEvent event) { * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -174,7 +176,7 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } // -1.20.6 @@ -202,42 +204,42 @@ public int getEnchantability(EnchantabilityArgs args) { @Deprecated @Override - public int getItemBarColor(ItemStack stack) { + public int getBarColor(ItemStack stack) { return getItemBarColor(new ItemBarColorArgs(stack)); } public int getItemBarColor(ItemBarColorArgs args) { - return super.getItemBarColor(args.stack); + return super.getBarColor(args.stack); } @Deprecated @Override - public boolean isItemBarVisible(ItemStack stack) { + public boolean isBarVisible(ItemStack stack) { return isItemBarVisible(new ItemBarVisibleArgs(stack)); } public boolean isItemBarVisible(ItemBarVisibleArgs args) { - return super.isItemBarVisible(args.stack); + return super.isBarVisible(args.stack); } @Deprecated @Override - public int getItemBarStep(ItemStack stack) { + public int getBarWidth(ItemStack stack) { return getItemBarStep(new ItemBarStepArgs(stack)); } public int getItemBarStep(ItemBarStepArgs args) { - return super.getItemBarStep(args.stack); + return super.getBarWidth(args.stack); } @Deprecated @Override - public float getBonusAttackDamage(Entity target, float baseAttackDamage, DamageSource damageSource) { + public float getAttackDamageBonus(Entity target, float baseAttackDamage, DamageSource damageSource) { return getBonusAttackDamage(new BonusAttackDamageArgs(target, baseAttackDamage, damageSource)); } public float getBonusAttackDamage(BonusAttackDamageArgs args) { - return super.getBonusAttackDamage(args.target, args.baseAttackDamage, args.damageSource); + return super.getAttackDamageBonus(args.target, args.baseAttackDamage, args.damageSource); } @Deprecated @@ -252,11 +254,11 @@ public boolean canRepair(CanRepairArgs args) { @Deprecated @Override - public boolean canMine(ItemStack stack, BlockState state, World world, BlockPos pos, LivingEntity user) { + public boolean canDestroyBlock(ItemStack stack, BlockState state, Level world, BlockPos pos, LivingEntity user) { return canMine(new CanMineArgs(stack, state, world, pos, user)); } public boolean canMine(CanMineArgs args) { - return super.canMine(args.stack, args.state, args.world, args.pos, args.entity); + return super.canDestroyBlock(args.stack, args.state, args.world, args.pos, args.entity); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java index 7742fa05e..b5a366ad9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Rarity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Rarity; import net.pitan76.mcpitanlib.api.event.item.*; import net.pitan76.mcpitanlib.api.util.CompatActionResult; import net.pitan76.mcpitanlib.api.util.StackActionResult; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java index 5e7db67a0..ccb9da55d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.resources.Identifier; import java.util.function.Supplier; @@ -9,25 +9,25 @@ /** * Use {@link CompatibleItemSettings} instead. */ -public class ExtendSettings extends Item.Settings { +public class ExtendSettings extends Item.Properties { // ~1.19.2 @Deprecated - public ExtendSettings addGroup(ItemGroup itemGroup) { + public ExtendSettings addGroup(CreativeModeTab itemGroup) { return this; } // 1.19.3~ // identifier: Item ID @Deprecated - public ExtendSettings addGroup(ItemGroup itemGroup, Identifier identifier) { + public ExtendSettings addGroup(CreativeModeTab itemGroup, Identifier identifier) { this.arch$tab(itemGroup); CreativeTabManager.addItem(itemGroup, identifier); return this; } @Deprecated - public ExtendSettings addGroup(Supplier itemGroup, Identifier identifier) { + public ExtendSettings addGroup(Supplier itemGroup, Identifier identifier) { CreativeTabManager.addItem(itemGroup, identifier); return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java index c96382ed2..9e712d0ac 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public interface FixedRecipeRemainderItem { ItemStack getFixedRecipeRemainder(ItemStack stack); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java index 6db9d79f4..3d5e8b752 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item.args; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class RarityArgs { public ItemStack stack; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java index e7c9e8446..2ff8c846f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.item.args; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import java.util.Optional; @@ -11,26 +11,26 @@ public class StoppedUsingArgs { public ItemStack stack; - public World world; + public Level world; public LivingEntity user; public int remainingUseTicks; - public StoppedUsingArgs(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { + public StoppedUsingArgs(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) { this.stack = stack; this.world = world; this.user = user; this.remainingUseTicks = remainingUseTicks; } - public StoppedUsingArgs(ItemStack stack, World world, LivingEntity user) { + public StoppedUsingArgs(ItemStack stack, Level world, LivingEntity user) { this(stack, world, user, 0); } - public StoppedUsingArgs(ItemStack stack, World world, Player player, int remainingUseTicks) { + public StoppedUsingArgs(ItemStack stack, Level world, Player player, int remainingUseTicks) { this(stack, world, player.getEntity(), remainingUseTicks); } - public StoppedUsingArgs(ItemStack stack, World world, Player player) { + public StoppedUsingArgs(ItemStack stack, Level world, Player player) { this(stack, world, player, 0); } @@ -42,7 +42,7 @@ public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack() { return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); } - public World getWorld() { + public Level getWorld() { return world; } @@ -63,7 +63,7 @@ public boolean hasNoRemainingUseTicks() { } public boolean isClient() { - return world.isClient(); + return world.isClientSide(); } public boolean isServer() { @@ -71,10 +71,10 @@ public boolean isServer() { } public boolean isPlayer() { - return user instanceof PlayerEntity; + return user instanceof Player; } public Optional getPlayer() { - return isPlayer() ? Optional.of(new Player((PlayerEntity) user)) : Optional.empty(); + return isPlayer() ? Optional.of(new Player((Player) user)) : Optional.empty(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java index acdbd404d..db37fb3a0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item.args; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; public class UseActionArgs { public ItemStack stack; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java b/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java index e3350697c..4a923b921 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java @@ -1,32 +1,32 @@ package net.pitan76.mcpitanlib.api.item.consume; -import net.minecraft.item.consume.UseAction; +import net.minecraft.world.item.ItemUseAnimation; import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; public class CompatUseAction implements CompatStringIdentifiable { - private final UseAction useAction; - - public static final CompatUseAction NONE = of(UseAction.NONE); - public static final CompatUseAction EAT = of(UseAction.EAT); - public static final CompatUseAction DRINK = of(UseAction.DRINK); - public static final CompatUseAction BLOCK = of(UseAction.BLOCK); - public static final CompatUseAction BOW = of(UseAction.BOW); - public static final CompatUseAction SPEAR = of(UseAction.SPEAR); - public static final CompatUseAction CROSSBOW = of(UseAction.CROSSBOW); - public static final CompatUseAction SPYGLASS = of(UseAction.SPYGLASS); - public static final CompatUseAction TOOT_HORN = of(UseAction.TOOT_HORN); - public static final CompatUseAction BRUSH = of(UseAction.BRUSH); - - public CompatUseAction(UseAction useAction) { + private final ItemUseAnimation useAction; + + public static final CompatUseAction NONE = of(ItemUseAnimation.NONE); + public static final CompatUseAction EAT = of(ItemUseAnimation.EAT); + public static final CompatUseAction DRINK = of(ItemUseAnimation.DRINK); + public static final CompatUseAction BLOCK = of(ItemUseAnimation.BLOCK); + public static final CompatUseAction BOW = of(ItemUseAnimation.BOW); + public static final CompatUseAction SPEAR = of(ItemUseAnimation.SPEAR); + public static final CompatUseAction CROSSBOW = of(ItemUseAnimation.CROSSBOW); + public static final CompatUseAction SPYGLASS = of(ItemUseAnimation.SPYGLASS); + public static final CompatUseAction TOOT_HORN = of(ItemUseAnimation.TOOT_HORN); + public static final CompatUseAction BRUSH = of(ItemUseAnimation.BRUSH); + + public CompatUseAction(ItemUseAnimation useAction) { this.useAction = useAction; } - public static CompatUseAction of(UseAction useAction) { + public static CompatUseAction of(ItemUseAnimation useAction) { return new CompatUseAction(useAction); } @Deprecated - public UseAction get() { + public ItemUseAnimation get() { return useAction; } @@ -35,7 +35,7 @@ public int getId() { } public String getName() { - return useAction.asString(); + return useAction.getSerializedName(); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java index 3a979fc7e..c2d20f70f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java @@ -1,33 +1,33 @@ package net.pitan76.mcpitanlib.api.item.equipment; -import net.minecraft.item.equipment.EquipmentAssetKeys; -import net.minecraft.registry.RegistryKey; +import net.minecraft.world.item.equipment.EquipmentAssets; +import net.minecraft.resources.ResourceKey; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class CompatEquipmentAsset { - private final RegistryKey raw; + private final ResourceKey raw; @Deprecated - public CompatEquipmentAsset(RegistryKey key) { + public CompatEquipmentAsset(ResourceKey key) { this.raw = key; } @Deprecated - public RegistryKey raw() { + public ResourceKey raw() { return raw; } public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(raw.getValue()); + return CompatIdentifier.fromMinecraft(raw.identifier()); } @Deprecated - public static CompatEquipmentAsset of(RegistryKey key) { + public static CompatEquipmentAsset of(ResourceKey key) { return new CompatEquipmentAsset(key); } public static CompatEquipmentAsset of(CompatIdentifier id) { - return of(RegistryKey.of(EquipmentAssetKeys.REGISTRY_KEY, id.toMinecraft())); + return of(ResourceKey.create(EquipmentAssets.ROOT_ID, id.toMinecraft())); } public static CompatEquipmentAsset of(String id) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java index e66cde67e..993c4bbae 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java @@ -1,22 +1,22 @@ package net.pitan76.mcpitanlib.api.item.equipment; -import net.minecraft.component.type.EquippableComponent; +import net.minecraft.world.item.equipment.Equippable; public class CompatEquippableComponent { - private final EquippableComponent raw; + private final Equippable raw; @Deprecated - public CompatEquippableComponent(EquippableComponent component) { + public CompatEquippableComponent(Equippable component) { this.raw = component; } @Deprecated - public EquippableComponent raw() { + public Equippable raw() { return raw; } @Deprecated - public static CompatEquippableComponent of(EquippableComponent component) { + public static CompatEquippableComponent of(Equippable component) { return new CompatEquippableComponent(component); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java index 5ced28a55..bf47cb0b9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.item.equipment; -import net.minecraft.component.type.EquippableComponent; -import net.minecraft.entity.EntityType; -import net.minecraft.registry.Registries; -import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.world.item.equipment.Equippable; +import net.minecraft.world.entity.EntityType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.HolderGetter; import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; import net.pitan76.mcpitanlib.api.tag.TagKey; @@ -75,18 +75,18 @@ public EquippableComponentBuilder allowedEntities(String tagId) { } public CompatEquippableComponent build() { - EquippableComponent.Builder component = EquippableComponent.builder(equipmentType.getSlot()); + Equippable.Builder component = Equippable.builder(equipmentType.getSlot()); if (equipSound != null) - component.equipSound(equipSound.getEntry() != null ? equipSound.getEntry() : equipSound.getReference()); + component.setEquipSound(equipSound.getEntry() != null ? equipSound.getEntry() : equipSound.getReference()); if (shearingSound != null) - component.shearingSound(shearingSound.getEntry() != null ? shearingSound.getEntry() : shearingSound.getReference()); + component.setShearingSound(shearingSound.getEntry() != null ? shearingSound.getEntry() : shearingSound.getReference()); - component.equipOnInteract(equipOnInteract); - component.canBeSheared(canBeSheared); - if (model != null) component.model(model.raw()); + component.setEquipOnInteract(equipOnInteract); + component.setCanBeSheared(canBeSheared); + if (model != null) component.setAsset(model.raw()); if (allowedEntities != null) { - RegistryEntryLookup> registryEntryLookup = Registries.createEntryLookup(Registries.ENTITY_TYPE); - component.allowedEntities(registryEntryLookup.getOrThrow((net.minecraft.registry.tag.TagKey>) allowedEntities.getTagKey())); + HolderGetter> registryEntryLookup = BuiltInRegistries.acquireBootstrapRegistrationLookup(BuiltInRegistries.ENTITY_TYPE); + component.setAllowedEntities(registryEntryLookup.getOrThrow((net.minecraft.tags.TagKey>) allowedEntities.getTagKey())); } return CompatEquippableComponent.of(component.build()); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java index e29531d73..54d6ce9f4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java @@ -1,25 +1,25 @@ package net.pitan76.mcpitanlib.api.item.stack; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.LoreComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.component.ItemLore; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.chat.Component; import java.util.List; public class LoreUtil { public static boolean hasLore(ItemStack stack) { - return stack.contains(DataComponentTypes.LORE); + return stack.has(DataComponents.LORE); } - public static List getLore(ItemStack stack) { + public static List getLore(ItemStack stack) { if (!hasLore(stack)) return List.of(); - return stack.get(DataComponentTypes.LORE).lines(); + return stack.get(DataComponents.LORE).lines(); } public static List getLoreAsStringList(ItemStack stack) { return getLore(stack).stream() - .map(Text::getString) + .map(Component::getString) .toList(); } @@ -28,19 +28,19 @@ public static String getLoreAsString(ItemStack stack) { .reduce("", (a, b) -> a + "\n" + b); } - public static void setLore(ItemStack stack, List lore) { - stack.set(DataComponentTypes.LORE, new LoreComponent(lore)); + public static void setLore(ItemStack stack, List lore) { + stack.set(DataComponents.LORE, new ItemLore(lore)); } public static void setLoreStringList(ItemStack stack, List lore) { setLore(stack, lore.stream() - .map(Text::of) + .map(Component::nullToEmpty) .toList()); } public static void setLore(ItemStack stack, String lore) { setLore(stack, lore.lines() - .map(Text::of) + .map(Component::nullToEmpty) .toList()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java index f6023e0ac..81f794924 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.AxeItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.AxeItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; @@ -33,12 +33,12 @@ public CompatibleItemSettings getCompatSettings() { } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -48,19 +48,19 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + public float getDestroySpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getDestroySpeed(stack, state); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -70,7 +70,7 @@ public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -80,7 +80,7 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } // -1.20.6 diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java index 0842a0fd9..7a7f8ee02 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.HoeItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.HoeItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; @@ -33,12 +33,12 @@ public net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings getCompatSettin } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -48,19 +48,19 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + public float getDestroySpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getDestroySpeed(stack, state); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -70,7 +70,7 @@ public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -80,7 +80,7 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } // -1.20.6 diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java index 153b473b2..57dc79af3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java @@ -1,16 +1,17 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.item.Item.Properties; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.ItemUseOnEntityEvent; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; @@ -27,7 +28,7 @@ public class CompatibleMiningToolItem extends Item implements CompatItemProvider public CompatibleItemSettings settings; @Deprecated - protected CompatibleMiningToolItem(float attackDamage, float attackSpeed, ToolMaterial material, net.minecraft.registry.tag.TagKey effectiveBlocks, Settings settings) { + protected CompatibleMiningToolItem(float attackDamage, float attackSpeed, ToolMaterial material, net.minecraft.tags.TagKey effectiveBlocks, Properties settings) { super(settings.tool(material, effectiveBlocks, attackDamage, attackSpeed, 0)); } @@ -52,12 +53,12 @@ public CompatibleItemSettings getCompatSettings() { } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -67,7 +68,7 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { + public float getDestroySpeed(ItemStack stack, BlockState state) { return overrideGetMiningSpeedMultiplier(stack, state); } @@ -77,7 +78,7 @@ public float getMiningSpeed(ItemStack stack, BlockState state) { * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -87,18 +88,18 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -109,7 +110,7 @@ public boolean isDamageableOnDefault() { @Deprecated @Override - public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { return onRightClickOnEntity(new ItemUseOnEntityEvent(stack, user, entity, hand)).toActionResult(); } @@ -120,6 +121,6 @@ public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent event, Optio } public CompatActionResult onRightClickOnEntity(ItemUseOnEntityEvent e) { - return CompatActionResult.of(super.useOnEntity(e.stack, e.user.getEntity(), e.entity, e.hand)); + return CompatActionResult.of(super.interactLivingEntity(e.stack, e.user.getEntity(), e.entity, e.hand)); } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java index 6a7d66539..cba7a7722 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; @@ -33,12 +33,12 @@ public CompatibleItemSettings getCompatSettings() { } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -48,19 +48,19 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + public float getDestroySpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getDestroySpeed(stack, state); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -70,7 +70,7 @@ public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -80,7 +80,7 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } // -1.20.6 diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java index baf1308b3..478348ecb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java @@ -1,11 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ShearsItem; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.item.Item.Properties; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ShearsItem; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; @@ -17,7 +18,7 @@ public class CompatibleShearsItem extends ShearsItem implements CompatItemProvid public CompatibleItemSettings settings; @Deprecated - public CompatibleShearsItem(Settings settings) { + public CompatibleShearsItem(Properties settings) { super(settings); } @@ -32,12 +33,12 @@ public CompatibleItemSettings getCompatSettings() { } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -47,19 +48,19 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + public float getDestroySpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getDestroySpeed(stack, state); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -69,7 +70,7 @@ public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -79,7 +80,7 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } // -1.20.6 diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java index d3737e319..268b15cd4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ShovelItem; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ShovelItem; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; @@ -31,12 +31,12 @@ public CompatibleItemSettings getCompatSettings() { } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -46,19 +46,19 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + public float getDestroySpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getDestroySpeed(stack, state); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -69,7 +69,7 @@ public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -80,7 +80,7 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } // -1.20.6 diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java index cba960cde..145df647e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ToolMaterial; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; @@ -33,12 +33,12 @@ public CompatibleItemSettings getCompatSettings() { } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -48,19 +48,19 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { - return overrideGetMiningSpeedMultiplier(stack, state) * super.getMiningSpeed(stack, state); + public float getDestroySpeed(ItemStack stack, BlockState state) { + return overrideGetMiningSpeedMultiplier(stack, state) * super.getDestroySpeed(stack, state); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -70,7 +70,7 @@ public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -80,7 +80,7 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } // -1.20.6 diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java index 27907c3ce..10ddc81fb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java @@ -1,11 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.item.Item.Properties; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.PostHitEvent; import net.pitan76.mcpitanlib.api.event.item.PostMineEvent; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; @@ -18,7 +19,7 @@ public class CompatibleToolItem extends Item implements CompatItemProvider { public CompatibleItemSettings settings; @Deprecated - protected CompatibleToolItem(Settings settings) { + protected CompatibleToolItem(Properties settings) { super(settings); } @@ -34,12 +35,12 @@ public CompatibleItemSettings getCompatSettings() { } public boolean overrideIsSuitableFor(BlockState state) { - return super.isCorrectForDrops(getDefaultStack(), state); + return super.isCorrectToolForDrops(getDefaultInstance(), state); } @Deprecated @Override - public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { return overrideIsSuitableFor(state); } @@ -49,19 +50,19 @@ public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) @Deprecated @Override - public float getMiningSpeed(ItemStack stack, BlockState state) { + public float getDestroySpeed(ItemStack stack, BlockState state) { return overrideGetMiningSpeedMultiplier(stack, state) * material.getCompatMiningSpeedMultiplier(); } @Deprecated @Override - public void postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) { + public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { postHit(new PostHitEvent(stack, target, attacker)); } @Deprecated @Override - public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) { + public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { return postMine(new PostMineEvent(stack, world, state, pos, miner)); } @@ -71,7 +72,7 @@ public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos * @return boolean */ public boolean postHit(PostHitEvent event) { - super.postHit(event.stack, event.target, event.attacker); + super.hurtEnemy(event.stack, event.target, event.attacker); return true; } @@ -81,6 +82,6 @@ public boolean postHit(PostHitEvent event) { * @return boolean */ public boolean postMine(PostMineEvent event) { - return super.postMine(event.stack, event.world, event.state, event.pos, event.miner); + return super.mineBlock(event.stack, event.world, event.state, event.pos, event.miner); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java index ab44f30bf..90b0dd03a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.item.tool; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ToolMaterial; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.util.IngredientUtil; public interface CompatibleToolMaterial { @@ -18,7 +18,7 @@ public interface CompatibleToolMaterial { float getCompatMiningSpeedMultiplier(); default Ingredient getCompatRepairIngredient() { - return IngredientUtil.fromTagByIdentifier(getRepairTag().id()); + return IngredientUtil.fromTagByIdentifier(getRepairTag().location()); } int getCompatDurability(); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java index f43e2ad83..bfb10e892 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item.v2; -import net.minecraft.sound.SoundEvent; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java index aa542b01b..3d109d387 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.item.v2; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.consume.UseAction; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Rarity; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.CanRepairArgs; import net.pitan76.mcpitanlib.api.event.item.EnchantabilityArgs; import net.pitan76.mcpitanlib.api.event.item.EnchantableArgs; @@ -42,12 +42,12 @@ public ItemWrapper getWrapper() { @Deprecated @Override - public UseAction getUseAction(ItemStack stack) { + public ItemUseAnimation getUseAnimation(ItemStack stack) { return getUseAction(new UseActionArgs(stack)).get(); } public CompatUseAction getUseAction(UseActionArgs args) { - return CompatUseAction.of(super.getUseAction(args.stack)); + return CompatUseAction.of(super.getUseAnimation(args.stack)); } @Deprecated @@ -83,17 +83,17 @@ public boolean hasRecipeRemainder(Dummy dummy) { @Deprecated @Override - public boolean onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { + public boolean releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) { return onStoppedUsing(new StoppedUsingArgs(stack, world, user, remainingUseTicks)); } public boolean onStoppedUsing(StoppedUsingArgs args) { - return super.onStoppedUsing(args.stack, args.world, args.user, args.remainingUseTicks); + return super.releaseUsing(args.stack, args.world, args.user, args.remainingUseTicks); } @Deprecated @Override - public void inventoryTick(ItemStack stack, ServerWorld world, Entity entity, @Nullable EquipmentSlot slot) { + public void inventoryTick(ItemStack stack, ServerLevel world, Entity entity, @Nullable EquipmentSlot slot) { inventoryTick(new InventoryTickEvent(stack, world, entity, slot)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java index 67cb774ea..c0a540983 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item.v2; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.event.item.CanRepairArgs; import net.pitan76.mcpitanlib.api.event.item.EnchantabilityArgs; import net.pitan76.mcpitanlib.api.event.item.EnchantableArgs; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java index 4c823e2b2..a9e72281f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.item.v2; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; -import net.minecraft.util.Rarity; +import net.minecraft.world.item.Rarity; import net.pitan76.mcpitanlib.api.entity.attribute.AttributeModifiersComponentBuilder; import net.pitan76.mcpitanlib.api.entity.attribute.CompatAttributeModifiersComponent; import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; @@ -46,12 +46,12 @@ public CompatibleItemSettings setId(CompatIdentifier identifier) { return this; } - public CompatibleItemSettings addGroup(ItemGroup itemGroup) { + public CompatibleItemSettings addGroup(CreativeModeTab itemGroup) { super.addGroup(itemGroup, identifier); return this; } - public CompatibleItemSettings addGroup(Supplier itemGroup) { + public CompatibleItemSettings addGroup(Supplier itemGroup) { super.addGroup(itemGroup, identifier); return this; } @@ -116,19 +116,19 @@ public CompatibleItemSettings food(CompatFoodComponent foodComponent) { } public CompatibleItemSettings useItemPrefixedTranslationKey() { - settings.useItemPrefixedTranslationKey(); + settings.useItemDescriptionPrefix(); changedTranslationKey = true; return this; } public CompatibleItemSettings useBlockPrefixedTranslationKey() { - settings.useBlockPrefixedTranslationKey(); + settings.useBlockDescriptionPrefix(); changedTranslationKey = true; return this; } public CompatibleItemSettings translationKey(String translationKey) { - settings.translationKey(translationKey); + settings.overrideDescription(translationKey); changedTranslationKey = true; return this; } @@ -146,7 +146,7 @@ public CompatibleItemSettings repairable(RepairIngredientTag tag) { } public CompatibleItemSettings equipable(CompatEquippableComponent component) { - settings.component(DataComponentTypes.EQUIPPABLE, component.raw()); + settings.component(DataComponents.EQUIPPABLE, component.raw()); return this; } @@ -155,7 +155,7 @@ public CompatibleItemSettings equipable(EquippableComponentBuilder builder) { } public CompatibleItemSettings attributeModifiers(CompatAttributeModifiersComponent component) { - settings.component(DataComponentTypes.ATTRIBUTE_MODIFIERS, component.raw()); + settings.component(DataComponents.ATTRIBUTE_MODIFIERS, component.raw()); return this; } @@ -168,7 +168,7 @@ public ExtendSettings build() { super.build(); if (identifier != null) { - settings.registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier.toMinecraft())); + settings.setId(ResourceKey.create(Registries.ITEM, identifier.toMinecraft())); } return settings; @@ -178,25 +178,25 @@ public ExtendSettings build() { @Deprecated @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(ItemGroup itemGroup, Identifier identifier) { + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(CreativeModeTab itemGroup, Identifier identifier) { return super.addGroup(itemGroup, identifier); } @Deprecated @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, Identifier identifier) { return super.addGroup(itemGroup, identifier); } @Deprecated @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(Supplier itemGroup, CompatIdentifier identifier) { return super.addGroup(itemGroup, identifier); } @Deprecated @Override - public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(ItemGroup itemGroup, CompatIdentifier identifier) { + public net.pitan76.mcpitanlib.api.item.CompatibleItemSettings addGroup(CreativeModeTab itemGroup, CompatIdentifier identifier) { return super.addGroup(itemGroup, identifier); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java index ef6761f3e..7a58c2d1e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java @@ -1,17 +1,19 @@ package net.pitan76.mcpitanlib.api.item.v2; -import net.minecraft.block.Block; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; +import net.minecraft.world.item.Item.Properties; +import net.minecraft.world.item.Item.TooltipContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionResult; import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import net.pitan76.mcpitanlib.mixin.ItemUsageContextMixin; +import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; import java.util.List; import java.util.function.Consumer; @@ -21,7 +23,7 @@ public class ExtendBlockItem extends BlockItem implements CompatItemProvider { public CompatibleItemSettings settings; @Deprecated - public ExtendBlockItem(Block block, Settings settings) { + public ExtendBlockItem(Block block, Properties settings) { super(block, settings); } @@ -37,9 +39,9 @@ public CompatibleItemSettings getCompatSettings() { @Deprecated @Override - public ActionResult useOnBlock(ItemUsageContext context) { - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; - return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit())).toActionResult(); + public InteractionResult useOn(UseOnContext context) { + UseOnContextMixin contextAccessor = (UseOnContextMixin) context; + return onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHitResult())).toActionResult(); } @Deprecated @@ -49,12 +51,12 @@ public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event, Options } public CompatActionResult onRightClickOnBlock(ItemUseOnBlockEvent event) { - return CompatActionResult.create(super.useOnBlock(event.toIUC())); + return CompatActionResult.create(super.useOn(event.toIUC())); } @Deprecated @Override - public void appendTooltip(ItemStack stack, TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type) { + public void appendHoverText(ItemStack stack, TooltipContext context, TooltipDisplay displayComponent, Consumer textConsumer, TooltipFlag type) { appendTooltip(new ItemAppendTooltipEvent(stack, context, displayComponent, textConsumer, type)); } @@ -65,7 +67,7 @@ public void appendTooltip(ItemAppendTooltipEvent event, Options options) { } public void appendTooltip(ItemAppendTooltipEvent event) { - super.appendTooltip(event.getStack(), event.getContext(), event.displayComponent, event.textConsumer, event.type); + super.appendHoverText(event.getStack(), event.getContext(), event.displayComponent, event.textConsumer, event.type); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java index d545d09cc..1e0dbc712 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.item.v3; -import net.minecraft.item.Item; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; public interface CompatArmorMaterial extends net.pitan76.mcpitanlib.api.item.v2.CompatArmorMaterial { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java index 004134948..00748c68e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.item.v3; -import net.minecraft.item.Item; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java index 41c63b9ba..305d63f1f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.item.v3; -import net.minecraft.block.Block; -import net.minecraft.item.ToolMaterial; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; public class VanillaCompatToolMaterial implements CompatToolMaterial { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java index 34b588f58..eed193c6e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.nbt; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.NbtComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtType; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.component.CustomData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.TagType; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.scanner.NbtScanner; -import net.minecraft.nbt.visitor.NbtElementVisitor; +import net.minecraft.nbt.Tag; +import net.minecraft.nbt.StreamTagVisitor; +import net.minecraft.nbt.TagVisitor; import java.io.DataOutput; import java.io.IOException; @Deprecated public class NbtTag { - public NbtCompound nbt; + public CompoundTag nbt; public NbtTag() { super(); @@ -35,7 +35,7 @@ public static NbtTag create() { * @return NbtTag */ public static NbtTag from(Object nbt) { - if (nbt instanceof NbtCompound) { + if (nbt instanceof CompoundTag) { return (NbtTag) nbt; } return (NbtTag) nbt; @@ -56,7 +56,7 @@ public static boolean hasNbt(ItemStack stack) { * @return NbtTag */ public static NbtTag getNbt(ItemStack stack) { - return from(stack.get(DataComponentTypes.CUSTOM_DATA).copyNbt()); + return from(stack.get(DataComponents.CUSTOM_DATA).copyTag()); } /** @@ -65,7 +65,7 @@ public static NbtTag getNbt(ItemStack stack) { * @param nbt NbtTag */ public static void setNbt(ItemStack stack, NbtTag nbt) { - stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt.nbt)); + stack.set(DataComponents.CUSTOM_DATA, CustomData.of(nbt.nbt)); } public boolean contains(String key) { @@ -77,26 +77,26 @@ public void write(DataOutput output) throws IOException { } public byte getType() { - return nbt.getType(); + return nbt.getId(); } - public NbtType getNbtType() { - return nbt.getNbtType(); + public TagType getNbtType() { + return nbt.getType(); } - public NbtElement copy() { + public Tag copy() { return nbt.copy(); } public int getSizeInBytes() { - return nbt.getSizeInBytes(); + return nbt.sizeInBytes(); } - public void accept(NbtElementVisitor visitor) { + public void accept(TagVisitor visitor) { nbt.accept(visitor); } - public NbtScanner.Result doAccept(NbtScanner visitor) { - return nbt.doAccept(visitor); + public StreamTagVisitor.ValueResult doAccept(StreamTagVisitor visitor) { + return nbt.accept(visitor); } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java index f034b4339..b1d6d464f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.nbt; -import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.Tag; public class NbtTypeBytes { - public static final byte END = NbtElement.END_TYPE; - public static final byte BYTE = NbtElement.BYTE_TYPE; - public static final byte SHORT = NbtElement.SHORT_TYPE; - public static final byte INT = NbtElement.INT_TYPE; - public static final byte LONG = NbtElement.LONG_TYPE; - public static final byte FLOAT = NbtElement.FLOAT_TYPE; - public static final byte DOUBLE = NbtElement.DOUBLE_TYPE; - public static final byte BYTE_ARRAY = NbtElement.BYTE_ARRAY_TYPE; - public static final byte STRING = NbtElement.STRING_TYPE; - public static final byte LIST = NbtElement.LIST_TYPE; - public static final byte COMPOUND = NbtElement.COMPOUND_TYPE; - public static final byte INT_ARRAY = NbtElement.INT_ARRAY_TYPE; - public static final byte LONG_ARRAY = NbtElement.LONG_ARRAY_TYPE; - public static final byte NUMBER = NbtElement.INT_TYPE; + public static final byte END = Tag.TAG_END; + public static final byte BYTE = Tag.TAG_BYTE; + public static final byte SHORT = Tag.TAG_SHORT; + public static final byte INT = Tag.TAG_INT; + public static final byte LONG = Tag.TAG_LONG; + public static final byte FLOAT = Tag.TAG_FLOAT; + public static final byte DOUBLE = Tag.TAG_DOUBLE; + public static final byte BYTE_ARRAY = Tag.TAG_BYTE_ARRAY; + public static final byte STRING = Tag.TAG_STRING; + public static final byte LIST = Tag.TAG_LIST; + public static final byte COMPOUND = Tag.TAG_COMPOUND; + public static final byte INT_ARRAY = Tag.TAG_INT_ARRAY; + public static final byte LONG_ARRAY = Tag.TAG_LONG_ARRAY; + public static final byte NUMBER = Tag.TAG_INT; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java index 0e915d07d..afa6a7f00 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java @@ -3,12 +3,12 @@ import dev.architectury.networking.NetworkManager; import dev.architectury.networking.transformers.PacketTransformer; import io.netty.buffer.Unpooled; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.packet.CustomPayload; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.core.network.BufPayload; @@ -17,7 +17,7 @@ import static dev.architectury.impl.NetworkAggregator.*; public class ClientNetworking { - public static void send(Identifier identifier, PacketByteBuf buf) { + public static void send(Identifier identifier, FriendlyByteBuf buf) { /* if (!C2S_TYPE.containsKey(identifier)) { CustomPayload.Id type = new CustomPayload.Id<>(identifier); @@ -31,28 +31,28 @@ public static void send(Identifier identifier, PacketByteBuf buf) { } public static void registerReceiver(Identifier identifier, ClientNetworkHandler handler) { - BufPayload.Id id = BufPayload.id(identifier); + BufPayload.Type id = BufPayload.id(identifier); NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, BufPayload.getCodec(id), (payload, context) -> { - PacketByteBuf buf = new PacketByteBuf(Unpooled.wrappedBuffer(payload.getData())); + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); - ClientPlayerEntity player = null; - if (context.getPlayer() instanceof ClientPlayerEntity) - player = (ClientPlayerEntity) context.getPlayer(); + LocalPlayer player = null; + if (context.getPlayer() instanceof LocalPlayer) + player = (LocalPlayer) context.getPlayer(); - handler.receive(MinecraftClient.getInstance(), player, buf); + handler.receive(Minecraft.getInstance(), player, buf); buf.release(); }); } @FunctionalInterface public interface ClientNetworkHandler { - void receive(MinecraftClient client, ClientPlayerEntity player, PacketByteBuf buf); + void receive(Minecraft client, LocalPlayer player, FriendlyByteBuf buf); } - public static void registerC2SType(CustomPayload.Id type, PacketCodec codec, List packetTransformers) { + public static void registerC2SType(CustomPacketPayload.Type type, StreamCodec codec, List packetTransformers) { // Objects.requireNonNull(type, "Cannot register a null type!"); // packetTransformers = Objects.requireNonNullElse(packetTransformers, List.of()); // C2S_CODECS.put(type.id(), (PacketCodec) codec); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java index 46015f8a9..b60b7711b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java @@ -2,14 +2,14 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.NbtSizeTracker; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.text.Text; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.nbt.NbtAccounter; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; import net.pitan76.mcpitanlib.api.util.TextUtil; import java.util.Map; @@ -18,31 +18,31 @@ import java.util.function.Function; public class PacketByteUtil { - public static PacketByteBuf create() { - return new PacketByteBuf(Unpooled.buffer()); + public static FriendlyByteBuf create() { + return new FriendlyByteBuf(Unpooled.buffer()); } - public static PacketByteBuf empty() { - return new PacketByteBuf(Unpooled.EMPTY_BUFFER); + public static FriendlyByteBuf empty() { + return new FriendlyByteBuf(Unpooled.EMPTY_BUFFER); } - public static Map readMap(PacketByteBuf buf, Function keyParser, Function valueParser) { + public static Map readMap(FriendlyByteBuf buf, Function keyParser, Function valueParser) { return buf.readMap(keyParser::apply, valueParser::apply); } - public static void writeMap(PacketByteBuf buf, Map map) { + public static void writeMap(FriendlyByteBuf buf, Map map) { writeMap(buf, map, PacketByteUtil::writeVar, PacketByteUtil::writeVar); } - public static void writeMap(PacketByteBuf buf, Map map, BiConsumer keySerializer, BiConsumer valueSerializer) { + public static void writeMap(FriendlyByteBuf buf, Map map, BiConsumer keySerializer, BiConsumer valueSerializer) { buf.writeMap(map, keySerializer::accept, valueSerializer::accept); } - public static void writeVar(PacketByteBuf buf, Object obj) { + public static void writeVar(FriendlyByteBuf buf, Object obj) { if (obj instanceof String) { String s = (String) obj; - buf.writeString(s); + buf.writeUtf(s); } if (obj instanceof Integer) { int i = (int) obj; @@ -64,13 +64,13 @@ public static void writeVar(PacketByteBuf buf, Object obj) { byte b = (byte) obj; buf.writeByte(b); } - if (obj instanceof NbtCompound) { - NbtCompound nbt = (NbtCompound) obj; + if (obj instanceof CompoundTag) { + CompoundTag nbt = (CompoundTag) obj; buf.writeNbt(nbt); } if (obj instanceof ItemStack) { ItemStack stack = (ItemStack) obj; - buf.encodeAsJson(ItemStack.CODEC, stack); + buf.writeJsonWithCodec(ItemStack.CODEC, stack); } if (obj instanceof Identifier) { Identifier identifier = (Identifier) obj; @@ -82,11 +82,11 @@ public static void writeVar(PacketByteBuf buf, Object obj) { } if (obj instanceof UUID) { UUID uuid = (UUID) obj; - buf.writeUuid(uuid); + buf.writeUUID(uuid); } - if (obj instanceof Text) { - Text text = (Text) obj; - buf.writeString(text.getString()); + if (obj instanceof Component) { + Component text = (Component) obj; + buf.writeUtf(text.getString()); } if (obj instanceof BlockPos) { BlockPos pos = (BlockPos) obj; @@ -98,161 +98,161 @@ public static void writeVar(PacketByteBuf buf, Object obj) { } } - public static PacketByteBuf writeNbt(PacketByteBuf buf, NbtCompound nbt) { + public static FriendlyByteBuf writeNbt(FriendlyByteBuf buf, CompoundTag nbt) { return buf.writeNbt(nbt); } - public static NbtCompound readNbt(PacketByteBuf buf) { + public static CompoundTag readNbt(FriendlyByteBuf buf) { return buf.readNbt(); } - public static PacketByteBuf writeItemStack(PacketByteBuf buf, ItemStack stack) { - buf.encodeAsJson(ItemStack.CODEC, stack); + public static FriendlyByteBuf writeItemStack(FriendlyByteBuf buf, ItemStack stack) { + buf.writeJsonWithCodec(ItemStack.CODEC, stack); return buf; } - public static ItemStack readItemStack(PacketByteBuf buf) { - return buf.decodeAsJson(ItemStack.CODEC); + public static ItemStack readItemStack(FriendlyByteBuf buf) { + return buf.readLenientJsonWithCodec(ItemStack.CODEC); } - public static PacketByteBuf writeIdentifier(PacketByteBuf buf, Identifier identifier) { + public static FriendlyByteBuf writeIdentifier(FriendlyByteBuf buf, Identifier identifier) { return buf.writeIdentifier(identifier); } - public static Identifier readIdentifier(PacketByteBuf buf) { + public static Identifier readIdentifier(FriendlyByteBuf buf) { return buf.readIdentifier(); } - public static PacketByteBuf writeText(PacketByteBuf buf, Text text) { - return buf.writeString(text.getString()); + public static FriendlyByteBuf writeText(FriendlyByteBuf buf, Component text) { + return buf.writeUtf(text.getString()); } - public static Text readText(PacketByteBuf buf) { - return TextUtil.literal(buf.readString()); + public static Component readText(FriendlyByteBuf buf) { + return TextUtil.literal(buf.readUtf()); } - public static PacketByteBuf writeBlockPos(PacketByteBuf buf, BlockPos pos) { + public static FriendlyByteBuf writeBlockPos(FriendlyByteBuf buf, BlockPos pos) { return buf.writeBlockPos(pos); } - public static BlockPos readBlockPos(PacketByteBuf buf) { + public static BlockPos readBlockPos(FriendlyByteBuf buf) { return buf.readBlockPos(); } - public static PacketByteBuf writeUuid(PacketByteBuf buf, UUID uuid) { - return buf.writeUuid(uuid); + public static FriendlyByteBuf writeUuid(FriendlyByteBuf buf, UUID uuid) { + return buf.writeUUID(uuid); } - public static UUID readUuid(PacketByteBuf buf) { - return buf.readUuid(); + public static UUID readUuid(FriendlyByteBuf buf) { + return buf.readUUID(); } - public static PacketByteBuf writeVarInt(PacketByteBuf buf, int i) { + public static FriendlyByteBuf writeVarInt(FriendlyByteBuf buf, int i) { return buf.writeVarInt(i); } - public static int readVarInt(PacketByteBuf buf) { + public static int readVarInt(FriendlyByteBuf buf) { return buf.readVarInt(); } - public static PacketByteBuf writeVarLong(PacketByteBuf buf, long l) { + public static FriendlyByteBuf writeVarLong(FriendlyByteBuf buf, long l) { return buf.writeVarLong(l); } - public static long readVarLong(PacketByteBuf buf) { + public static long readVarLong(FriendlyByteBuf buf) { return buf.readVarLong(); } - public static ByteBuf writeBoolean(PacketByteBuf buf, boolean b) { + public static ByteBuf writeBoolean(FriendlyByteBuf buf, boolean b) { return buf.writeBoolean(b); } - public static boolean readBoolean(PacketByteBuf buf) { + public static boolean readBoolean(FriendlyByteBuf buf) { return buf.readBoolean(); } - public static ByteBuf writeByte(PacketByteBuf buf, byte b) { + public static ByteBuf writeByte(FriendlyByteBuf buf, byte b) { return buf.writeByte(b); } - public static byte readByte(PacketByteBuf buf) { + public static byte readByte(FriendlyByteBuf buf) { return buf.readByte(); } - public static ByteBuf writeShort(PacketByteBuf buf, short s) { + public static ByteBuf writeShort(FriendlyByteBuf buf, short s) { return buf.writeShort(s); } - public static short readShort(PacketByteBuf buf) { + public static short readShort(FriendlyByteBuf buf) { return buf.readShort(); } - public static ByteBuf writeInt(PacketByteBuf buf, int i) { + public static ByteBuf writeInt(FriendlyByteBuf buf, int i) { return buf.writeInt(i); } - public static int readInt(PacketByteBuf buf) { + public static int readInt(FriendlyByteBuf buf) { return buf.readInt(); } - public static ByteBuf writeLong(PacketByteBuf buf, long l) { + public static ByteBuf writeLong(FriendlyByteBuf buf, long l) { return buf.writeLong(l); } - public static long readLong(PacketByteBuf buf) { + public static long readLong(FriendlyByteBuf buf) { return buf.readLong(); } - public static ByteBuf writeFloat(PacketByteBuf buf, float f) { + public static ByteBuf writeFloat(FriendlyByteBuf buf, float f) { return buf.writeFloat(f); } - public static float readFloat(PacketByteBuf buf) { + public static float readFloat(FriendlyByteBuf buf) { return buf.readFloat(); } - public static ByteBuf writeDouble(PacketByteBuf buf, double d) { + public static ByteBuf writeDouble(FriendlyByteBuf buf, double d) { return buf.writeDouble(d); } - public static double readDouble(PacketByteBuf buf) { + public static double readDouble(FriendlyByteBuf buf) { return buf.readDouble(); } - public static PacketByteBuf writeByteArray(PacketByteBuf buf, byte[] bytes) { + public static FriendlyByteBuf writeByteArray(FriendlyByteBuf buf, byte[] bytes) { return buf.writeByteArray(bytes); } - public static byte[] readByteArray(PacketByteBuf buf) { + public static byte[] readByteArray(FriendlyByteBuf buf) { return buf.readByteArray(); } - public static PacketByteBuf writeString(PacketByteBuf buf, String s) { - return buf.writeString(s); + public static FriendlyByteBuf writeString(FriendlyByteBuf buf, String s) { + return buf.writeUtf(s); } - public static String readString(PacketByteBuf buf) { - return buf.readString(); + public static String readString(FriendlyByteBuf buf) { + return buf.readUtf(); } - public static PacketByteBuf writeIntArray(PacketByteBuf buf, int[] ints) { - return buf.writeIntArray(ints); + public static FriendlyByteBuf writeIntArray(FriendlyByteBuf buf, int[] ints) { + return buf.writeVarIntArray(ints); } - public static int[] readIntArray(PacketByteBuf buf) { - return buf.readIntArray(); + public static int[] readIntArray(FriendlyByteBuf buf) { + return buf.readVarIntArray(); } - public static PacketByteBuf writeLongArray(PacketByteBuf buf, long[] longs) { + public static FriendlyByteBuf writeLongArray(FriendlyByteBuf buf, long[] longs) { return buf.writeLongArray(longs); } - public static long[] readLongArray(PacketByteBuf buf) { + public static long[] readLongArray(FriendlyByteBuf buf) { return buf.readLongArray(); } - public static NbtElement readUnlimitedNbt(PacketByteBuf buf) { - return buf.readNbt(NbtSizeTracker.ofUnlimitedBytes()); + public static Tag readUnlimitedNbt(FriendlyByteBuf buf) { + return buf.readNbt(NbtAccounter.unlimitedHeap()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java index c63b6b33e..8d0964fe1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java @@ -3,9 +3,9 @@ import dev.architectury.impl.NetworkAggregator; import dev.architectury.networking.NetworkManager; import io.netty.buffer.Unpooled; -import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.core.network.BufPayload; @@ -13,35 +13,35 @@ import java.util.List; public class ServerNetworking { - public static void send(ServerPlayerEntity player, Identifier identifier, PacketByteBuf buf) { + public static void send(ServerPlayer player, Identifier identifier, FriendlyByteBuf buf) { registerS2CPayloadType(identifier); BufPayload payload = new BufPayload(buf, identifier); NetworkManager.sendToPlayer(player, payload); } - public static void send(Iterable players, Identifier identifier, PacketByteBuf buf) { + public static void send(Iterable players, Identifier identifier, FriendlyByteBuf buf) { registerS2CPayloadType(identifier); BufPayload payload = new BufPayload(buf, identifier); NetworkManager.sendToPlayers(players, payload); } - public static void sendAll(MinecraftServer server, Identifier identifier, PacketByteBuf buf) { - send(server.getPlayerManager().getPlayerList(), identifier, buf); + public static void sendAll(MinecraftServer server, Identifier identifier, FriendlyByteBuf buf) { + send(server.getPlayerList().getPlayers(), identifier, buf); } public static void registerReceiver(Identifier identifier, ServerNetworkHandler handler) { - BufPayload.Id id = BufPayload.id(identifier); + BufPayload.Type id = BufPayload.id(identifier); NetworkManager.registerReceiver(NetworkManager.Side.C2S, id, BufPayload.getCodec(id), (payload, context) -> { - PacketByteBuf buf = new PacketByteBuf(Unpooled.wrappedBuffer(payload.getData())); + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); - ServerPlayerEntity player = null; - if (context.getPlayer() instanceof ServerPlayerEntity) - player = (ServerPlayerEntity) context.getPlayer(); + ServerPlayer player = null; + if (context.getPlayer() instanceof ServerPlayer) + player = (ServerPlayer) context.getPlayer(); - handler.receive(context.getPlayer().getEntityWorld().getServer(), player, buf); + handler.receive(context.getPlayer().level().getServer(), player, buf); buf.release(); }); } @@ -54,12 +54,12 @@ public static void registerS2CPayloadType(Identifier identifier) { if (NetworkAggregator.S2C_CODECS.containsKey(identifier)) return; - BufPayload.Id id = BufPayload.id(identifier); + BufPayload.Type id = BufPayload.id(identifier); NetworkManager.registerS2CPayloadType(id, BufPayload.getCodec(id)); } @FunctionalInterface public interface ServerNetworkHandler { - void receive(MinecraftServer server, ServerPlayerEntity player, PacketByteBuf buf); + void receive(MinecraftServer server, ServerPlayer player, FriendlyByteBuf buf); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java index 67fef00ce..0ba88114a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.network.v2; -import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.FriendlyByteBuf; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; import net.pitan76.mcpitanlib.api.network.v2.args.ClientReceiveEvent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -9,7 +9,7 @@ import java.util.function.Consumer; public class ClientNetworking { - public static void send(CompatIdentifier id, PacketByteBuf buf) { + public static void send(CompatIdentifier id, FriendlyByteBuf buf) { net.pitan76.mcpitanlib.api.network.ClientNetworking.send(id.toMinecraft(), buf); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java index f5356c9d0..ec2cc1a36 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.network.v2; -import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.world.World; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; import net.pitan76.mcpitanlib.api.network.v2.args.ServerReceiveEvent; @@ -16,36 +16,36 @@ import java.util.function.Consumer; public class ServerNetworking { - public static void send(ServerPlayerEntity serverPlayerEntity, CompatIdentifier id, PacketByteBuf buf) { + public static void send(ServerPlayer serverPlayerEntity, CompatIdentifier id, FriendlyByteBuf buf) { net.pitan76.mcpitanlib.api.network.ServerNetworking.send(serverPlayerEntity, id.toMinecraft(), buf); } - public static void sendByServerPlayerEntity(Iterable players, CompatIdentifier id, PacketByteBuf buf) { + public static void sendByServerPlayerEntity(Iterable players, CompatIdentifier id, FriendlyByteBuf buf) { net.pitan76.mcpitanlib.api.network.ServerNetworking.send(players, id.toMinecraft(), buf); } - public static void send(Player player, CompatIdentifier id, PacketByteBuf buf) { - Optional optional = player.getServerPlayer(); + public static void send(Player player, CompatIdentifier id, FriendlyByteBuf buf) { + Optional optional = player.getServerPlayer(); if (optional.isEmpty()) return; send(optional.get(), id, buf); } - public static void send(Iterable players, CompatIdentifier id, PacketByteBuf buf) { - List list = new ArrayList<>(); + public static void send(Iterable players, CompatIdentifier id, FriendlyByteBuf buf) { + List list = new ArrayList<>(); for (Player player : players) { - Optional optional = player.getServerPlayer(); + Optional optional = player.getServerPlayer(); optional.ifPresent(list::add); } sendByServerPlayerEntity(list, id, buf); } - public static void sendAll(MinecraftServer server, CompatIdentifier id, PacketByteBuf buf) { + public static void sendAll(MinecraftServer server, CompatIdentifier id, FriendlyByteBuf buf) { net.pitan76.mcpitanlib.api.network.ServerNetworking.sendAll(server, id.toMinecraft(), buf); } - public static void sendAll(World world, CompatIdentifier id, PacketByteBuf buf) { + public static void sendAll(Level world, CompatIdentifier id, FriendlyByteBuf buf) { sendAll(world.getServer(), id, buf); } @@ -55,7 +55,7 @@ public static void registerReceiver(CompatIdentifier id, Consumer> { public static final CompatRecipeType BLASTING = new CompatRecipeType<>(RecipeType.BLASTING); public static final CompatRecipeType SMOKING = new CompatRecipeType<>(RecipeType.SMOKING); public static final CompatRecipeType CAMPFIRE_COOKING = new CompatRecipeType<>(RecipeType.CAMPFIRE_COOKING); - public static final CompatRecipeType STONECUTTING = new CompatRecipeType<>(RecipeType.STONECUTTING); + public static final CompatRecipeType STONECUTTING = new CompatRecipeType<>(RecipeType.STONECUTTING); public static final CompatRecipeType SMITHING = new CompatRecipeType<>(RecipeType.SMITHING); private final RecipeType type; @@ -30,14 +39,14 @@ public RecipeType getType() { } public CompatIdentifier getName() { - Identifier id = Registries.RECIPE_TYPE.getId(type); + Identifier id = BuiltInRegistries.RECIPE_TYPE.getKey(type); if (id == null) return CompatIdentifier.empty(); return CompatIdentifier.fromMinecraft(id); } public static CompatRecipeType of(CompatIdentifier id) { - RecipeType type = Registries.RECIPE_TYPE.get(id.toMinecraft()); + RecipeType type = BuiltInRegistries.RECIPE_TYPE.getValue(id.toMinecraft()); if (type == null) return null; return new CompatRecipeType<>(type); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java index 2395df79b..99534d294 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java @@ -1,27 +1,32 @@ package net.pitan76.mcpitanlib.api.recipe; import net.minecraft.recipe.*; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.ShapelessRecipe; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.RecipeUtil; import org.jetbrains.annotations.Nullable; @Deprecated public class CompatibleRecipeEntry { - private final RecipeEntry entry; + private final RecipeHolder entry; public String group = ""; public RecipeUtil.CompatibilityCraftingRecipeCategory category = null; @Deprecated - public CompatibleRecipeEntry(RecipeEntry entry) { + public CompatibleRecipeEntry(RecipeHolder entry) { this.entry = entry; } public CompatibleRecipeEntry(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ShapelessRecipe shapelessRecipe) { - this.entry = new RecipeEntry<>(RegistryKey.of(RegistryKeys.RECIPE, id), shapelessRecipe); + this.entry = new RecipeHolder<>(ResourceKey.create(Registries.RECIPE, id), shapelessRecipe); this.group = group; this.category = category; } @@ -31,7 +36,7 @@ public CompatibleRecipeEntry(CompatIdentifier id, String group, RecipeUtil.Compa } @Deprecated - public RecipeEntry getRecipeEntry() { + public RecipeHolder getRecipeEntry() { return entry; } @@ -44,7 +49,7 @@ public Recipe getRecipe() { } public Identifier getId() { - return entry.id().getValue(); + return entry.id().identifier(); } public CompatIdentifier getCompatId() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java index e0ec74ef3..59eb2a97d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.recipe; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.input.RecipeInput; -import net.minecraft.world.World; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeInput; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; @@ -10,5 +10,5 @@ @Deprecated public interface MatchGetter> { - Optional> getFirstMatch(CompatRecipeInput input, World world); + Optional> getFirstMatch(CompatRecipeInput input, Level world); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java index 5f97fc400..41beec474 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.recipe.input; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.input.RecipeInput; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeInput; public class CompatRecipeInput { protected I input; @@ -15,7 +15,7 @@ public I getInput() { } public ItemStack getStack(int slot) { - return input.getStackInSlot(slot); + return input.getItem(slot); } public net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack(int slot) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java index 833622368..d4f362208 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java @@ -1,27 +1,31 @@ package net.pitan76.mcpitanlib.api.recipe.v2; import net.minecraft.recipe.*; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.RecipeUtil; import org.jetbrains.annotations.Nullable; @Deprecated public class CompatRecipeEntry> { - private final RecipeEntry entry; + private final RecipeHolder entry; public String group = ""; public RecipeUtil.CompatibilityCraftingRecipeCategory category = null; @Deprecated - public CompatRecipeEntry(RecipeEntry entry) { + public CompatRecipeEntry(RecipeHolder entry) { this.entry = entry; } public CompatRecipeEntry(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, T recipe) { - this.entry = new RecipeEntry<>(RegistryKey.of(RegistryKeys.RECIPE, id), recipe); + this.entry = new RecipeHolder<>(ResourceKey.create(Registries.RECIPE, id), recipe); this.group = group; this.category = category; } @@ -35,7 +39,7 @@ public boolean isNull() { } @Deprecated - public RecipeEntry getRecipeEntry() { + public RecipeHolder getRecipeEntry() { return entry; } @@ -44,7 +48,7 @@ public T getRecipe() { } public Identifier getId() { - return entry.id().getValue(); + return entry.id().identifier(); } public CompatIdentifier getCompatId() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java index 09b62e257..332c62b73 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.recipe.v2; -import net.minecraft.recipe.Recipe; +import net.minecraft.world.item.crafting.Recipe; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.RecipeUtil; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java index 7569fcf50..0dbf26188 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.recipe.v3; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeType; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; @@ -21,8 +21,8 @@ public CompatRecipe(Recipe recipe, Identifier id) { } @Deprecated - public CompatRecipe(net.minecraft.recipe.RecipeEntry entry) { - this(entry.value(), entry.id().getValue()); + public CompatRecipe(net.minecraft.world.item.crafting.RecipeHolder entry) { + this(entry.value(), entry.id().identifier()); } @Deprecated @@ -61,13 +61,13 @@ public CompatRecipeEntry getRecipeEntry() { @Deprecated public CompatibleRecipeEntry getCompatibleRecipeEntry() { - return new CompatibleRecipeEntry(new net.minecraft.recipe.RecipeEntry>(RegistryKey.of(RegistryKeys.RECIPE, getId()), getRecipe())); + return new CompatibleRecipeEntry(new net.minecraft.world.item.crafting.RecipeHolder>(ResourceKey.create(Registries.RECIPE, getId()), getRecipe())); } // MidohraAPI public net.pitan76.mcpitanlib.midohra.recipe.Recipe getMidohraRecipe() { if (getMidohraType() == net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING) { - return net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) getRecipe()); + return net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe.of((net.minecraft.world.item.crafting.CraftingRecipe) getRecipe()); } return net.pitan76.mcpitanlib.midohra.recipe.Recipe.of(getRecipe()); @@ -75,7 +75,7 @@ public net.pitan76.mcpitanlib.midohra.recipe.Recipe getMidohraRecipe() { public net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry getMidohraRecipeEntry() { if (getMidohraType() == net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING) { - return net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry.of((net.minecraft.recipe.CraftingRecipe) getRecipe(), getCompatId()); + return net.pitan76.mcpitanlib.midohra.recipe.entry.CraftingRecipeEntry.of((net.minecraft.world.item.crafting.CraftingRecipe) getRecipe(), getCompatId()); } return RecipeEntry.of(getRecipe(), getCompatId()); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java index 0ffb50750..a4dd26270 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java @@ -1,19 +1,19 @@ package net.pitan76.mcpitanlib.api.registry; import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.component.ComponentType; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemGroup; -import net.minecraft.particle.ParticleType; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.MCPitanLib; import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; @@ -89,16 +89,16 @@ public RegistryResult registerBlock(Identifier id, Supplier suppli return new RegistryResult<>(mcplr.registryBlock(id, supplier)); } - public RegistryResult> registerScreenHandlerType(Identifier id, Supplier> supplier) { + public RegistryResult> registerScreenHandlerType(Identifier id, Supplier> supplier) { return new RegistryResult<>(mcplr.registryScreenHandlerType(id, supplier)); } @Deprecated - public RegistryResult> registerExtendedScreenHandlerType(Identifier id, Supplier> supplier) { + public RegistryResult> registerExtendedScreenHandlerType(Identifier id, Supplier> supplier) { return registerScreenHandlerType(id, () -> supplier.get().build()); } - public RegistryResult> registerMenu(Identifier id, Supplier> supplier) { + public RegistryResult> registerMenu(Identifier id, Supplier> supplier) { return registerScreenHandlerType(id, supplier); } @@ -116,11 +116,11 @@ public RegistryResult registerSoundEvent(Identifier id, Supplier registerSoundEvent(Identifier id) { - return registerSoundEvent(id, () -> SoundEvent.of(id)); + return registerSoundEvent(id, () -> SoundEvent.createVariableRangeEvent(id)); } public RegistryResult registerSoundEvent(Identifier id, float distanceToTravel) { - return registerSoundEvent(id, () -> SoundEvent.of(id, distanceToTravel)); + return registerSoundEvent(id, () -> SoundEvent.createFixedRangeEvent(id, distanceToTravel)); } public RegistryResult registerFluid(Identifier id, Supplier supplier) { @@ -135,27 +135,27 @@ public RegistryResult registerEnchantment(Identifier id, Supplier(mcplr.registryEnchantment(id, supplier)); } - public RegistryResult registerStatusEffect(Identifier id, Supplier supplier) { + public RegistryResult registerStatusEffect(Identifier id, Supplier supplier) { return new RegistryResult<>(mcplr.registryStatusEffect(id, supplier)); } - public RegistryResult registerItemGroup(Identifier id, Supplier supplier) { + public RegistryResult registerItemGroup(Identifier id, Supplier supplier) { return new RegistryResult<>(mcplr1_20.registryItemGroup(id, supplier)); } - public RegistryResult registerItemGroup(Identifier id, CreativeTabBuilder builder) { + public RegistryResult registerItemGroup(Identifier id, CreativeTabBuilder builder) { return new RegistryResult<>(mcplr1_20.registryItemGroup(id, builder)); } - public RegistryResult registerItemGroup(CreativeTabBuilder builder) { + public RegistryResult registerItemGroup(CreativeTabBuilder builder) { return registerItemGroup(builder.getIdentifier(), builder); } - public RegistryResult> registerDataComponentType(Identifier id, Supplier> supplier) { + public RegistryResult> registerDataComponentType(Identifier id, Supplier> supplier) { return new RegistryResult<>(mcplr1_21.registryDataComponentType(id, supplier)); } - public static void registerFuel(int time, ItemConvertible... item) { + public static void registerFuel(int time, ItemLike... item) { FuelRegistry.register(time, item); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java index 1a3afc996..2866c6dcf 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java @@ -1,42 +1,42 @@ package net.pitan76.mcpitanlib.api.registry; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.BuiltinRegistries; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.data.registries.VanillaRegistries; +import net.minecraft.core.HolderLookup; import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; public class CompatRegistryLookup { - private final RegistryWrapper.WrapperLookup registryLookup; + private final HolderLookup.Provider registryLookup; @Deprecated - public CompatRegistryLookup(RegistryWrapper.WrapperLookup registryLookup) { + public CompatRegistryLookup(HolderLookup.Provider registryLookup) { this.registryLookup = registryLookup; } public CompatRegistryLookup() { - this.registryLookup = BuiltinRegistries.createWrapperLookup(); + this.registryLookup = VanillaRegistries.createLookup(); } @Deprecated - public RegistryWrapper.WrapperLookup getRegistryLookup() { + public HolderLookup.Provider getRegistryLookup() { if (registryLookup == null) - return BuiltinRegistries.createWrapperLookup(); + return VanillaRegistries.createLookup(); return registryLookup; } - public NbtRWArgs getNbtRWArgs(NbtCompound nbt) { + public NbtRWArgs getNbtRWArgs(CompoundTag nbt) { return new NbtRWArgs(nbt, registryLookup); } - public WriteNbtArgs createWriteNbtArgs(NbtCompound nbt) { + public WriteNbtArgs createWriteNbtArgs(CompoundTag nbt) { return new WriteNbtArgs(nbt, registryLookup); } - public ReadNbtArgs createReadNbtArgs(NbtCompound nbt) { + public ReadNbtArgs createReadNbtArgs(CompoundTag nbt) { return new ReadNbtArgs(nbt, registryLookup); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java index f5dc51bb4..78bdf9da3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.registry; -import net.minecraft.item.ItemConvertible; +import net.minecraft.world.level.ItemLike; import java.util.HashMap; import java.util.Map; @@ -8,10 +8,10 @@ public class FuelRegistry { - private static final Map, Integer>> FUEL_MAP = new HashMap<>(); + private static final Map, Integer>> FUEL_MAP = new HashMap<>(); - public static void register(Supplier itemSupplier, int time, String namespace) { - Map, Integer> map = new HashMap<>(); + public static void register(Supplier itemSupplier, int time, String namespace) { + Map, Integer> map = new HashMap<>(); map.put(itemSupplier, time); FUEL_MAP.put(namespace, map); @@ -21,8 +21,8 @@ public static void register(Supplier itemSupplier, int time, St public static void allRegister(String namespace) { if (!FUEL_MAP.containsKey(namespace)) return; - Map, Integer> map = FUEL_MAP.get(namespace); - for (Map.Entry, Integer> entry : map.entrySet()) { + Map, Integer> map = FUEL_MAP.get(namespace); + for (Map.Entry, Integer> entry : map.entrySet()) { net.pitan76.mcpitanlib.core.registry.FuelRegistry.register(entry.getValue(), entry.getKey().get()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java index 615ad877b..077fc77bc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java @@ -3,12 +3,12 @@ import dev.architectury.registry.level.biome.BiomeModifications; import dev.architectury.registry.registries.DeferredRegister; import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.core.registries.Registries; +import net.minecraft.core.Holder; import net.minecraft.resources.Identifier; -import net.minecraft.world.gen.GenerationStep; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.PlacedFeature; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import java.util.function.Supplier; @@ -22,8 +22,8 @@ public class WorldGenRegistry { @Deprecated public WorldGenRegistry(String MOD_ID) { this.MOD_ID = MOD_ID; - CONFIGURED_FEATURE = DeferredRegister.create(MOD_ID, RegistryKeys.CONFIGURED_FEATURE); - PLACED_FEATURE = DeferredRegister.create(MOD_ID, RegistryKeys.PLACED_FEATURE); + CONFIGURED_FEATURE = DeferredRegister.create(MOD_ID, Registries.CONFIGURED_FEATURE); + PLACED_FEATURE = DeferredRegister.create(MOD_ID, Registries.PLACED_FEATURE); } /** @@ -66,11 +66,11 @@ public RegistryResult registerPlacedFeature(Identifier id, Suppli * @param decoration The decoration step * @param feature The feature to replace */ - public static void replaceProperties(GenerationStep.Feature decoration, RegistrySupplier feature) { + public static void replaceProperties(GenerationStep.Decoration decoration, RegistrySupplier feature) { BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); } - public static void replaceProperties(GenerationStep.Feature decoration, RegistryResult feature) { + public static void replaceProperties(GenerationStep.Decoration decoration, RegistryResult feature) { replaceProperties(decoration, feature.supplier); } @@ -79,8 +79,8 @@ public static void replaceProperties(GenerationStep.Feature decoration, Registry * @param decoration The decoration step * @param feature The feature to replace */ - public static void replaceProperties(GenerationStep.Feature decoration, PlacedFeature feature) { - BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, RegistryEntry.of(feature))); + public static void replaceProperties(GenerationStep.Decoration decoration, PlacedFeature feature) { + BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, Holder.direct(feature))); } /** @@ -88,11 +88,11 @@ public static void replaceProperties(GenerationStep.Feature decoration, PlacedFe * @param decoration The decoration step * @param feature The feature to add */ - public static void addProperties(GenerationStep.Feature decoration, RegistrySupplier feature) { + public static void addProperties(GenerationStep.Decoration decoration, RegistrySupplier feature) { BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); } - public static void addProperties(GenerationStep.Feature decoration, RegistryResult feature) { + public static void addProperties(GenerationStep.Decoration decoration, RegistryResult feature) { addProperties(decoration, feature.supplier); } @@ -101,7 +101,7 @@ public static void addProperties(GenerationStep.Feature decoration, RegistryResu * @param decoration The decoration step * @param feature The feature to add */ - public static void addProperties(GenerationStep.Feature decoration, PlacedFeature feature) { - BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, RegistryEntry.of(feature))); + public static void addProperties(GenerationStep.Decoration decoration, PlacedFeature feature) { + BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, Holder.direct(feature))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java index 82bfbd83d..40560cbd4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.api.registry.v2; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; -import net.minecraft.particle.ParticleType; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.block.ExtendBlock; import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; @@ -86,20 +86,20 @@ public Supplier registerExtendBlock(CompatIdentifier id, Supplier (ExtendBlock) result.get(); } - public RegistryResult> registerScreenHandlerType(CompatIdentifier id, Supplier> supplier) { + public RegistryResult> registerScreenHandlerType(CompatIdentifier id, Supplier> supplier) { return cr1.registerScreenHandlerType(id.toMinecraft(), supplier); } - public Supplier> registerScreenHandlerTypeSavingGenerics(CompatIdentifier id, Supplier> supplier) { - RegistryResult> result = cr1.registerScreenHandlerType(id.toMinecraft(), supplier::get); - return () -> (ScreenHandlerType) result.getOrNull(); + public Supplier> registerScreenHandlerTypeSavingGenerics(CompatIdentifier id, Supplier> supplier) { + RegistryResult> result = cr1.registerScreenHandlerType(id.toMinecraft(), supplier::get); + return () -> (MenuType) result.getOrNull(); } - public SupplierResult> registerScreenHandlerType(CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { + public SupplierResult> registerScreenHandlerType(CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { return SupplierResult.of(registerScreenHandlerTypeSavingGenerics(id, builder::build)); } - public SupplierResult> registerScreenHandlerType(CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { + public SupplierResult> registerScreenHandlerType(CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { return SupplierResult.of(registerScreenHandlerTypeSavingGenerics(id, builder::build)); } @@ -144,19 +144,19 @@ public RegistryResult registerEnchantment(CompatIdentifier id, Supp return cr1.registerEnchantment(id.toMinecraft(), () -> supplier.get().getEnchantment(null)); } - public RegistryResult registryStatusEffect(CompatIdentifier id, Supplier supplier) { + public RegistryResult registryStatusEffect(CompatIdentifier id, Supplier supplier) { return cr1.registerStatusEffect(id.toMinecraft(), () -> supplier.get().getStatusEffect(null)); } - public RegistryResult registerItemGroup(CompatIdentifier id, Supplier supplier) { + public RegistryResult registerItemGroup(CompatIdentifier id, Supplier supplier) { return cr1.registerItemGroup(id.toMinecraft(), supplier); } - public RegistryResult registerItemGroup(CompatIdentifier id, CreativeTabBuilder builder) { + public RegistryResult registerItemGroup(CompatIdentifier id, CreativeTabBuilder builder) { return cr1.registerItemGroup(id.toMinecraft(), builder); } - public RegistryResult registerItemGroup(CreativeTabBuilder builder) { + public RegistryResult registerItemGroup(CreativeTabBuilder builder) { return cr1.registerItemGroup(builder.getIdentifier(), builder); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java index 2353be362..e42c5d580 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.api.simple.block; -import net.minecraft.text.Text; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.pitan76.mcpitanlib.api.block.ExtendBlock; import net.pitan76.mcpitanlib.api.event.block.BlockUseEvent; import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; @@ -9,7 +10,7 @@ public abstract class SimpleGuiBlock extends ExtendBlock implements SimpleScreenHandlerFactory { - public SimpleGuiBlock(Settings settings) { + public SimpleGuiBlock(Properties settings) { super(settings); } @@ -22,7 +23,7 @@ public CompatActionResult onRightClick(BlockUseEvent e) { } @Override - public Text getDisplayName(DisplayNameArgs args) { + public Component getDisplayName(DisplayNameArgs args) { return getName(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java b/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java index 570410379..b2332a3e8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.simple.item; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; @@ -13,9 +13,9 @@ public class SimpleGuiItem extends CompatItem implements SimpleScreenHandlerFactory { public ScreenHandlerFactory factory; - public Text name; + public Component name; - public SimpleGuiItem(CompatibleItemSettings settings, ScreenHandlerFactory factory, Text name) { + public SimpleGuiItem(CompatibleItemSettings settings, ScreenHandlerFactory factory, Component name) { super(settings); this.factory = factory; this.name = name; @@ -39,7 +39,7 @@ public StackActionResult onRightClick(ItemUseEvent e) { } @Override - public Text getDisplayName(DisplayNameArgs args) { + public Component getDisplayName(DisplayNameArgs args) { if (name == null) return getName(); @@ -47,7 +47,7 @@ public Text getDisplayName(DisplayNameArgs args) { } @Override - public ScreenHandler createMenu(CreateMenuEvent e) { + public AbstractContainerMenu createMenu(CreateMenuEvent e) { if (factory == null) return null; @@ -56,6 +56,6 @@ public ScreenHandler createMenu(CreateMenuEvent e) { @FunctionalInterface public interface ScreenHandlerFactory { - ScreenHandler create(CreateMenuEvent e); + AbstractContainerMenu create(CreateMenuEvent e); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java index 55563b8ae..fd0241215 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java @@ -1,124 +1,124 @@ package net.pitan76.mcpitanlib.api.sound; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.sounds.SoundEvent; public class CompatBlockSoundGroup { - public static final CompatBlockSoundGroup INTENTIONALLY_EMPTY = of(BlockSoundGroup.INTENTIONALLY_EMPTY); - public static final CompatBlockSoundGroup WOOD = of(BlockSoundGroup.WOOD); - public static final CompatBlockSoundGroup GRAVEL = of(BlockSoundGroup.GRAVEL); - public static final CompatBlockSoundGroup GRASS = of(BlockSoundGroup.GRASS); - public static final CompatBlockSoundGroup LILY_PAD = of(BlockSoundGroup.LILY_PAD); - public static final CompatBlockSoundGroup STONE = of(BlockSoundGroup.STONE); - public static final CompatBlockSoundGroup METAL = of(BlockSoundGroup.METAL); - public static final CompatBlockSoundGroup GLASS = of(BlockSoundGroup.GLASS); - public static final CompatBlockSoundGroup WOOL = of(BlockSoundGroup.WOOL); - public static final CompatBlockSoundGroup SAND = of(BlockSoundGroup.SAND); - public static final CompatBlockSoundGroup SNOW = of(BlockSoundGroup.SNOW); - public static final CompatBlockSoundGroup POWDER_SNOW = of(BlockSoundGroup.POWDER_SNOW); - public static final CompatBlockSoundGroup LADDER = of(BlockSoundGroup.LADDER); - public static final CompatBlockSoundGroup ANVIL = of(BlockSoundGroup.ANVIL); - public static final CompatBlockSoundGroup SLIME = of(BlockSoundGroup.SLIME); - public static final CompatBlockSoundGroup HONEY = of(BlockSoundGroup.HONEY); - public static final CompatBlockSoundGroup WET_GRASS = of(BlockSoundGroup.WET_GRASS); - public static final CompatBlockSoundGroup CORAL = of(BlockSoundGroup.CORAL); - public static final CompatBlockSoundGroup BAMBOO = of(BlockSoundGroup.BAMBOO); - public static final CompatBlockSoundGroup BAMBOO_SAPLING = of(BlockSoundGroup.BAMBOO_SAPLING); - public static final CompatBlockSoundGroup SCAFFOLDING = of(BlockSoundGroup.SCAFFOLDING); - public static final CompatBlockSoundGroup SWEET_BERRY_BUSH = of(BlockSoundGroup.SWEET_BERRY_BUSH); - public static final CompatBlockSoundGroup CROP = of(BlockSoundGroup.CROP); - public static final CompatBlockSoundGroup STEM = of(BlockSoundGroup.STEM); - public static final CompatBlockSoundGroup VINE = of(BlockSoundGroup.VINE); - public static final CompatBlockSoundGroup NETHER_WART = of(BlockSoundGroup.NETHER_WART); - public static final CompatBlockSoundGroup LANTERN = of(BlockSoundGroup.LANTERN); - public static final CompatBlockSoundGroup NETHER_STEM = of(BlockSoundGroup.NETHER_STEM); - public static final CompatBlockSoundGroup NYLIUM = of(BlockSoundGroup.NYLIUM); - public static final CompatBlockSoundGroup FUNGUS = of(BlockSoundGroup.FUNGUS); - public static final CompatBlockSoundGroup ROOTS = of(BlockSoundGroup.ROOTS); - public static final CompatBlockSoundGroup SHROOMLIGHT = of(BlockSoundGroup.SHROOMLIGHT); - public static final CompatBlockSoundGroup WEEPING_VINES = of(BlockSoundGroup.WEEPING_VINES); - public static final CompatBlockSoundGroup WEEPING_VINES_LOW_PITCH = of(BlockSoundGroup.WEEPING_VINES_LOW_PITCH); - public static final CompatBlockSoundGroup SOUL_SAND = of(BlockSoundGroup.SOUL_SAND); - public static final CompatBlockSoundGroup SOUL_SOIL = of(BlockSoundGroup.SOUL_SOIL); - public static final CompatBlockSoundGroup BASALT = of(BlockSoundGroup.BASALT); - public static final CompatBlockSoundGroup WART_BLOCK = of(BlockSoundGroup.WART_BLOCK); - public static final CompatBlockSoundGroup NETHERRACK = of(BlockSoundGroup.NETHERRACK); - public static final CompatBlockSoundGroup NETHER_BRICKS = of(BlockSoundGroup.NETHER_BRICKS); - public static final CompatBlockSoundGroup NETHER_SPROUTS = of(BlockSoundGroup.NETHER_SPROUTS); - public static final CompatBlockSoundGroup NETHER_ORE = of(BlockSoundGroup.NETHER_ORE); - public static final CompatBlockSoundGroup BONE = of(BlockSoundGroup.BONE); - public static final CompatBlockSoundGroup NETHERITE = of(BlockSoundGroup.NETHERITE); - public static final CompatBlockSoundGroup ANCIENT_DEBRIS = of(BlockSoundGroup.ANCIENT_DEBRIS); - public static final CompatBlockSoundGroup LODESTONE = of(BlockSoundGroup.LODESTONE); - public static final CompatBlockSoundGroup CHAIN = of(BlockSoundGroup.CHAIN); - public static final CompatBlockSoundGroup NETHER_GOLD_ORE = of(BlockSoundGroup.NETHER_GOLD_ORE); - public static final CompatBlockSoundGroup GILDED_BLACKSTONE = of(BlockSoundGroup.GILDED_BLACKSTONE); - public static final CompatBlockSoundGroup CANDLE = of(BlockSoundGroup.CANDLE); - public static final CompatBlockSoundGroup AMETHYST_BLOCK = of(BlockSoundGroup.AMETHYST_BLOCK); - public static final CompatBlockSoundGroup AMETHYST_CLUSTER = of(BlockSoundGroup.AMETHYST_CLUSTER); - public static final CompatBlockSoundGroup SMALL_AMETHYST_BUD = of(BlockSoundGroup.SMALL_AMETHYST_BUD); - public static final CompatBlockSoundGroup MEDIUM_AMETHYST_BUD = of(BlockSoundGroup.MEDIUM_AMETHYST_BUD); - public static final CompatBlockSoundGroup LARGE_AMETHYST_BUD = of(BlockSoundGroup.LARGE_AMETHYST_BUD); - public static final CompatBlockSoundGroup TUFF = of(BlockSoundGroup.TUFF); - public static final CompatBlockSoundGroup TUFF_BRICKS = of(BlockSoundGroup.TUFF_BRICKS); - public static final CompatBlockSoundGroup POLISHED_TUFF = of(BlockSoundGroup.POLISHED_TUFF); - public static final CompatBlockSoundGroup CALCITE = of(BlockSoundGroup.CALCITE); - public static final CompatBlockSoundGroup DRIPSTONE_BLOCK = of(BlockSoundGroup.DRIPSTONE_BLOCK); - public static final CompatBlockSoundGroup POINTED_DRIPSTONE = of(BlockSoundGroup.POINTED_DRIPSTONE); - public static final CompatBlockSoundGroup COPPER = of(BlockSoundGroup.COPPER); - public static final CompatBlockSoundGroup COPPER_BULB = of(BlockSoundGroup.COPPER_BULB); - public static final CompatBlockSoundGroup COPPER_GRATE = of(BlockSoundGroup.COPPER_GRATE); - public static final CompatBlockSoundGroup CAVE_VINES = of(BlockSoundGroup.CAVE_VINES); - public static final CompatBlockSoundGroup SPORE_BLOSSOM = of(BlockSoundGroup.SPORE_BLOSSOM); - public static final CompatBlockSoundGroup AZALEA = of(BlockSoundGroup.AZALEA); - public static final CompatBlockSoundGroup FLOWERING_AZALEA = of(BlockSoundGroup.FLOWERING_AZALEA); - public static final CompatBlockSoundGroup MOSS_CARPET = of(BlockSoundGroup.MOSS_CARPET); - public static final CompatBlockSoundGroup PINK_PETALS = of(BlockSoundGroup.CHERRY_LEAVES); - public static final CompatBlockSoundGroup MOSS_BLOCK = of(BlockSoundGroup.MOSS_BLOCK); - public static final CompatBlockSoundGroup BIG_DRIPLEAF = of(BlockSoundGroup.BIG_DRIPLEAF); - public static final CompatBlockSoundGroup SMALL_DRIPLEAF = of(BlockSoundGroup.SMALL_DRIPLEAF); - public static final CompatBlockSoundGroup ROOTED_DIRT = of(BlockSoundGroup.ROOTED_DIRT); - public static final CompatBlockSoundGroup HANGING_ROOTS = of(BlockSoundGroup.HANGING_ROOTS); - public static final CompatBlockSoundGroup AZALEA_LEAVES = of(BlockSoundGroup.AZALEA_LEAVES); - public static final CompatBlockSoundGroup SCULK_SENSOR = of(BlockSoundGroup.SCULK_SENSOR); - public static final CompatBlockSoundGroup SCULK_CATALYST = of(BlockSoundGroup.SCULK_CATALYST); - public static final CompatBlockSoundGroup SCULK = of(BlockSoundGroup.SCULK); - public static final CompatBlockSoundGroup SCULK_VEIN = of(BlockSoundGroup.SCULK_VEIN); - public static final CompatBlockSoundGroup SCULK_SHRIEKER = of(BlockSoundGroup.SCULK_SHRIEKER); - public static final CompatBlockSoundGroup GLOW_LICHEN = of(BlockSoundGroup.GLOW_LICHEN); - public static final CompatBlockSoundGroup DEEPSLATE = of(BlockSoundGroup.DEEPSLATE); - public static final CompatBlockSoundGroup DEEPSLATE_BRICKS = of(BlockSoundGroup.DEEPSLATE_BRICKS); - public static final CompatBlockSoundGroup DEEPSLATE_TILES = of(BlockSoundGroup.DEEPSLATE_TILES); - public static final CompatBlockSoundGroup POLISHED_DEEPSLATE = of(BlockSoundGroup.POLISHED_DEEPSLATE); - public static final CompatBlockSoundGroup FROGLIGHT = of(BlockSoundGroup.FROGLIGHT); - public static final CompatBlockSoundGroup FROGSPAWN = of(BlockSoundGroup.FROGSPAWN); - public static final CompatBlockSoundGroup MANGROVE_ROOTS = of(BlockSoundGroup.MANGROVE_ROOTS); - public static final CompatBlockSoundGroup MUDDY_MANGROVE_ROOTS = of(BlockSoundGroup.MUDDY_MANGROVE_ROOTS); - public static final CompatBlockSoundGroup MUD = of(BlockSoundGroup.MUD); - public static final CompatBlockSoundGroup MUD_BRICKS = of(BlockSoundGroup.MUD_BRICKS); - public static final CompatBlockSoundGroup PACKED_MUD = of(BlockSoundGroup.PACKED_MUD); - public static final CompatBlockSoundGroup HANGING_SIGN = of(BlockSoundGroup.HANGING_SIGN); - public static final CompatBlockSoundGroup NETHER_WOOD_HANGING_SIGN = of(BlockSoundGroup.NETHER_WOOD_HANGING_SIGN); - public static final CompatBlockSoundGroup BAMBOO_WOOD_HANGING_SIGN = of(BlockSoundGroup.BAMBOO_WOOD_HANGING_SIGN); - public static final CompatBlockSoundGroup BAMBOO_WOOD = of(BlockSoundGroup.BAMBOO_WOOD); - public static final CompatBlockSoundGroup NETHER_WOOD = of(BlockSoundGroup.NETHER_WOOD); - public static final CompatBlockSoundGroup CHERRY_WOOD = of(BlockSoundGroup.CHERRY_WOOD); - public static final CompatBlockSoundGroup CHERRY_SAPLING = of(BlockSoundGroup.CHERRY_SAPLING); - public static final CompatBlockSoundGroup CHERRY_LEAVES = of(BlockSoundGroup.CHERRY_LEAVES); - public static final CompatBlockSoundGroup CHERRY_WOOD_HANGING_SIGN = of(BlockSoundGroup.CHERRY_WOOD_HANGING_SIGN); - public static final CompatBlockSoundGroup CHISELED_BOOKSHELF = of(BlockSoundGroup.CHISELED_BOOKSHELF); - public static final CompatBlockSoundGroup SUSPICIOUS_SAND = of(BlockSoundGroup.SUSPICIOUS_SAND); - public static final CompatBlockSoundGroup SUSPICIOUS_GRAVEL = of(BlockSoundGroup.SUSPICIOUS_GRAVEL); - public static final CompatBlockSoundGroup DECORATED_POT = of(BlockSoundGroup.DECORATED_POT); - public static final CompatBlockSoundGroup DECORATED_POT_SHATTER = of(BlockSoundGroup.DECORATED_POT_SHATTER); - public static final CompatBlockSoundGroup TRIAL_SPAWNER = of(BlockSoundGroup.TRIAL_SPAWNER); - public static final CompatBlockSoundGroup SPONGE = of(BlockSoundGroup.SPONGE); - public static final CompatBlockSoundGroup WET_SPONGE = of(BlockSoundGroup.WET_SPONGE); - public static final CompatBlockSoundGroup VAULT = of(BlockSoundGroup.VAULT); - public static final CompatBlockSoundGroup HEAVY_CORE = of(BlockSoundGroup.HEAVY_CORE); - public static final CompatBlockSoundGroup COBWEB = of(BlockSoundGroup.COBWEB); - - public BlockSoundGroup blockSoundGroup; + public static final CompatBlockSoundGroup INTENTIONALLY_EMPTY = of(SoundType.EMPTY); + public static final CompatBlockSoundGroup WOOD = of(SoundType.WOOD); + public static final CompatBlockSoundGroup GRAVEL = of(SoundType.GRAVEL); + public static final CompatBlockSoundGroup GRASS = of(SoundType.GRASS); + public static final CompatBlockSoundGroup LILY_PAD = of(SoundType.LILY_PAD); + public static final CompatBlockSoundGroup STONE = of(SoundType.STONE); + public static final CompatBlockSoundGroup METAL = of(SoundType.METAL); + public static final CompatBlockSoundGroup GLASS = of(SoundType.GLASS); + public static final CompatBlockSoundGroup WOOL = of(SoundType.WOOL); + public static final CompatBlockSoundGroup SAND = of(SoundType.SAND); + public static final CompatBlockSoundGroup SNOW = of(SoundType.SNOW); + public static final CompatBlockSoundGroup POWDER_SNOW = of(SoundType.POWDER_SNOW); + public static final CompatBlockSoundGroup LADDER = of(SoundType.LADDER); + public static final CompatBlockSoundGroup ANVIL = of(SoundType.ANVIL); + public static final CompatBlockSoundGroup SLIME = of(SoundType.SLIME_BLOCK); + public static final CompatBlockSoundGroup HONEY = of(SoundType.HONEY_BLOCK); + public static final CompatBlockSoundGroup WET_GRASS = of(SoundType.WET_GRASS); + public static final CompatBlockSoundGroup CORAL = of(SoundType.CORAL_BLOCK); + public static final CompatBlockSoundGroup BAMBOO = of(SoundType.BAMBOO); + public static final CompatBlockSoundGroup BAMBOO_SAPLING = of(SoundType.BAMBOO_SAPLING); + public static final CompatBlockSoundGroup SCAFFOLDING = of(SoundType.SCAFFOLDING); + public static final CompatBlockSoundGroup SWEET_BERRY_BUSH = of(SoundType.SWEET_BERRY_BUSH); + public static final CompatBlockSoundGroup CROP = of(SoundType.CROP); + public static final CompatBlockSoundGroup STEM = of(SoundType.HARD_CROP); + public static final CompatBlockSoundGroup VINE = of(SoundType.VINE); + public static final CompatBlockSoundGroup NETHER_WART = of(SoundType.NETHER_WART); + public static final CompatBlockSoundGroup LANTERN = of(SoundType.LANTERN); + public static final CompatBlockSoundGroup NETHER_STEM = of(SoundType.STEM); + public static final CompatBlockSoundGroup NYLIUM = of(SoundType.NYLIUM); + public static final CompatBlockSoundGroup FUNGUS = of(SoundType.FUNGUS); + public static final CompatBlockSoundGroup ROOTS = of(SoundType.ROOTS); + public static final CompatBlockSoundGroup SHROOMLIGHT = of(SoundType.SHROOMLIGHT); + public static final CompatBlockSoundGroup WEEPING_VINES = of(SoundType.WEEPING_VINES); + public static final CompatBlockSoundGroup WEEPING_VINES_LOW_PITCH = of(SoundType.TWISTING_VINES); + public static final CompatBlockSoundGroup SOUL_SAND = of(SoundType.SOUL_SAND); + public static final CompatBlockSoundGroup SOUL_SOIL = of(SoundType.SOUL_SOIL); + public static final CompatBlockSoundGroup BASALT = of(SoundType.BASALT); + public static final CompatBlockSoundGroup WART_BLOCK = of(SoundType.WART_BLOCK); + public static final CompatBlockSoundGroup NETHERRACK = of(SoundType.NETHERRACK); + public static final CompatBlockSoundGroup NETHER_BRICKS = of(SoundType.NETHER_BRICKS); + public static final CompatBlockSoundGroup NETHER_SPROUTS = of(SoundType.NETHER_SPROUTS); + public static final CompatBlockSoundGroup NETHER_ORE = of(SoundType.NETHER_ORE); + public static final CompatBlockSoundGroup BONE = of(SoundType.BONE_BLOCK); + public static final CompatBlockSoundGroup NETHERITE = of(SoundType.NETHERITE_BLOCK); + public static final CompatBlockSoundGroup ANCIENT_DEBRIS = of(SoundType.ANCIENT_DEBRIS); + public static final CompatBlockSoundGroup LODESTONE = of(SoundType.LODESTONE); + public static final CompatBlockSoundGroup CHAIN = of(SoundType.CHAIN); + public static final CompatBlockSoundGroup NETHER_GOLD_ORE = of(SoundType.NETHER_GOLD_ORE); + public static final CompatBlockSoundGroup GILDED_BLACKSTONE = of(SoundType.GILDED_BLACKSTONE); + public static final CompatBlockSoundGroup CANDLE = of(SoundType.CANDLE); + public static final CompatBlockSoundGroup AMETHYST_BLOCK = of(SoundType.AMETHYST); + public static final CompatBlockSoundGroup AMETHYST_CLUSTER = of(SoundType.AMETHYST_CLUSTER); + public static final CompatBlockSoundGroup SMALL_AMETHYST_BUD = of(SoundType.SMALL_AMETHYST_BUD); + public static final CompatBlockSoundGroup MEDIUM_AMETHYST_BUD = of(SoundType.MEDIUM_AMETHYST_BUD); + public static final CompatBlockSoundGroup LARGE_AMETHYST_BUD = of(SoundType.LARGE_AMETHYST_BUD); + public static final CompatBlockSoundGroup TUFF = of(SoundType.TUFF); + public static final CompatBlockSoundGroup TUFF_BRICKS = of(SoundType.TUFF_BRICKS); + public static final CompatBlockSoundGroup POLISHED_TUFF = of(SoundType.POLISHED_TUFF); + public static final CompatBlockSoundGroup CALCITE = of(SoundType.CALCITE); + public static final CompatBlockSoundGroup DRIPSTONE_BLOCK = of(SoundType.DRIPSTONE_BLOCK); + public static final CompatBlockSoundGroup POINTED_DRIPSTONE = of(SoundType.POINTED_DRIPSTONE); + public static final CompatBlockSoundGroup COPPER = of(SoundType.COPPER); + public static final CompatBlockSoundGroup COPPER_BULB = of(SoundType.COPPER_BULB); + public static final CompatBlockSoundGroup COPPER_GRATE = of(SoundType.COPPER_GRATE); + public static final CompatBlockSoundGroup CAVE_VINES = of(SoundType.CAVE_VINES); + public static final CompatBlockSoundGroup SPORE_BLOSSOM = of(SoundType.SPORE_BLOSSOM); + public static final CompatBlockSoundGroup AZALEA = of(SoundType.AZALEA); + public static final CompatBlockSoundGroup FLOWERING_AZALEA = of(SoundType.FLOWERING_AZALEA); + public static final CompatBlockSoundGroup MOSS_CARPET = of(SoundType.MOSS_CARPET); + public static final CompatBlockSoundGroup PINK_PETALS = of(SoundType.CHERRY_LEAVES); + public static final CompatBlockSoundGroup MOSS_BLOCK = of(SoundType.MOSS); + public static final CompatBlockSoundGroup BIG_DRIPLEAF = of(SoundType.BIG_DRIPLEAF); + public static final CompatBlockSoundGroup SMALL_DRIPLEAF = of(SoundType.SMALL_DRIPLEAF); + public static final CompatBlockSoundGroup ROOTED_DIRT = of(SoundType.ROOTED_DIRT); + public static final CompatBlockSoundGroup HANGING_ROOTS = of(SoundType.HANGING_ROOTS); + public static final CompatBlockSoundGroup AZALEA_LEAVES = of(SoundType.AZALEA_LEAVES); + public static final CompatBlockSoundGroup SCULK_SENSOR = of(SoundType.SCULK_SENSOR); + public static final CompatBlockSoundGroup SCULK_CATALYST = of(SoundType.SCULK_CATALYST); + public static final CompatBlockSoundGroup SCULK = of(SoundType.SCULK); + public static final CompatBlockSoundGroup SCULK_VEIN = of(SoundType.SCULK_VEIN); + public static final CompatBlockSoundGroup SCULK_SHRIEKER = of(SoundType.SCULK_SHRIEKER); + public static final CompatBlockSoundGroup GLOW_LICHEN = of(SoundType.GLOW_LICHEN); + public static final CompatBlockSoundGroup DEEPSLATE = of(SoundType.DEEPSLATE); + public static final CompatBlockSoundGroup DEEPSLATE_BRICKS = of(SoundType.DEEPSLATE_BRICKS); + public static final CompatBlockSoundGroup DEEPSLATE_TILES = of(SoundType.DEEPSLATE_TILES); + public static final CompatBlockSoundGroup POLISHED_DEEPSLATE = of(SoundType.POLISHED_DEEPSLATE); + public static final CompatBlockSoundGroup FROGLIGHT = of(SoundType.FROGLIGHT); + public static final CompatBlockSoundGroup FROGSPAWN = of(SoundType.FROGSPAWN); + public static final CompatBlockSoundGroup MANGROVE_ROOTS = of(SoundType.MANGROVE_ROOTS); + public static final CompatBlockSoundGroup MUDDY_MANGROVE_ROOTS = of(SoundType.MUDDY_MANGROVE_ROOTS); + public static final CompatBlockSoundGroup MUD = of(SoundType.MUD); + public static final CompatBlockSoundGroup MUD_BRICKS = of(SoundType.MUD_BRICKS); + public static final CompatBlockSoundGroup PACKED_MUD = of(SoundType.PACKED_MUD); + public static final CompatBlockSoundGroup HANGING_SIGN = of(SoundType.HANGING_SIGN); + public static final CompatBlockSoundGroup NETHER_WOOD_HANGING_SIGN = of(SoundType.NETHER_WOOD_HANGING_SIGN); + public static final CompatBlockSoundGroup BAMBOO_WOOD_HANGING_SIGN = of(SoundType.BAMBOO_WOOD_HANGING_SIGN); + public static final CompatBlockSoundGroup BAMBOO_WOOD = of(SoundType.BAMBOO_WOOD); + public static final CompatBlockSoundGroup NETHER_WOOD = of(SoundType.NETHER_WOOD); + public static final CompatBlockSoundGroup CHERRY_WOOD = of(SoundType.CHERRY_WOOD); + public static final CompatBlockSoundGroup CHERRY_SAPLING = of(SoundType.CHERRY_SAPLING); + public static final CompatBlockSoundGroup CHERRY_LEAVES = of(SoundType.CHERRY_LEAVES); + public static final CompatBlockSoundGroup CHERRY_WOOD_HANGING_SIGN = of(SoundType.CHERRY_WOOD_HANGING_SIGN); + public static final CompatBlockSoundGroup CHISELED_BOOKSHELF = of(SoundType.CHISELED_BOOKSHELF); + public static final CompatBlockSoundGroup SUSPICIOUS_SAND = of(SoundType.SUSPICIOUS_SAND); + public static final CompatBlockSoundGroup SUSPICIOUS_GRAVEL = of(SoundType.SUSPICIOUS_GRAVEL); + public static final CompatBlockSoundGroup DECORATED_POT = of(SoundType.DECORATED_POT); + public static final CompatBlockSoundGroup DECORATED_POT_SHATTER = of(SoundType.DECORATED_POT_CRACKED); + public static final CompatBlockSoundGroup TRIAL_SPAWNER = of(SoundType.TRIAL_SPAWNER); + public static final CompatBlockSoundGroup SPONGE = of(SoundType.SPONGE); + public static final CompatBlockSoundGroup WET_SPONGE = of(SoundType.WET_SPONGE); + public static final CompatBlockSoundGroup VAULT = of(SoundType.VAULT); + public static final CompatBlockSoundGroup HEAVY_CORE = of(SoundType.HEAVY_CORE); + public static final CompatBlockSoundGroup COBWEB = of(SoundType.COBWEB); + + public SoundType blockSoundGroup; private final float volume; private final float pitch; @@ -128,7 +128,7 @@ public class CompatBlockSoundGroup { private final SoundEvent hitSound; private final SoundEvent fallSound; - public CompatBlockSoundGroup(BlockSoundGroup blockSoundGroup) { + public CompatBlockSoundGroup(SoundType blockSoundGroup) { this.blockSoundGroup = blockSoundGroup; this.volume = blockSoundGroup.getVolume(); @@ -141,7 +141,7 @@ public CompatBlockSoundGroup(BlockSoundGroup blockSoundGroup) { } public CompatBlockSoundGroup(float volume, float pitch, SoundEvent breakSound, SoundEvent stepSound, SoundEvent placeSound, SoundEvent hitSound, SoundEvent fallSound) { - this.blockSoundGroup = new BlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); + this.blockSoundGroup = new SoundType(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); this.volume = volume; this.pitch = pitch; @@ -152,14 +152,14 @@ public CompatBlockSoundGroup(float volume, float pitch, SoundEvent breakSound, S this.fallSound = fallSound; } - public BlockSoundGroup get() { + public SoundType get() { if (blockSoundGroup == null) { - return new BlockSoundGroup(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); + return new SoundType(volume, pitch, breakSound, stepSound, placeSound, hitSound, fallSound); } return blockSoundGroup; } - public static CompatBlockSoundGroup of(BlockSoundGroup blockSoundGroup) { + public static CompatBlockSoundGroup of(SoundType blockSoundGroup) { return new CompatBlockSoundGroup(blockSoundGroup); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java index 4fdd2bd18..ad9ece4ce 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java @@ -1,31 +1,31 @@ package net.pitan76.mcpitanlib.api.sound; -import net.minecraft.sound.SoundCategory; +import net.minecraft.sounds.SoundSource; public class CompatSoundCategory { - public static final CompatSoundCategory MASTER = of(SoundCategory.MASTER); - public static final CompatSoundCategory MUSIC = of(SoundCategory.MUSIC); - public static final CompatSoundCategory RECORDS = of(SoundCategory.RECORDS); - public static final CompatSoundCategory WEATHER = of(SoundCategory.WEATHER); - public static final CompatSoundCategory BLOCKS = of(SoundCategory.BLOCKS); - public static final CompatSoundCategory HOSTILE = of(SoundCategory.HOSTILE); - public static final CompatSoundCategory NEUTRAL = of(SoundCategory.NEUTRAL); - public static final CompatSoundCategory PLAYERS = of(SoundCategory.PLAYERS); - public static final CompatSoundCategory AMBIENT = of(SoundCategory.AMBIENT); - public static final CompatSoundCategory VOICE = of(SoundCategory.VOICE); + public static final CompatSoundCategory MASTER = of(SoundSource.MASTER); + public static final CompatSoundCategory MUSIC = of(SoundSource.MUSIC); + public static final CompatSoundCategory RECORDS = of(SoundSource.RECORDS); + public static final CompatSoundCategory WEATHER = of(SoundSource.WEATHER); + public static final CompatSoundCategory BLOCKS = of(SoundSource.BLOCKS); + public static final CompatSoundCategory HOSTILE = of(SoundSource.HOSTILE); + public static final CompatSoundCategory NEUTRAL = of(SoundSource.NEUTRAL); + public static final CompatSoundCategory PLAYERS = of(SoundSource.PLAYERS); + public static final CompatSoundCategory AMBIENT = of(SoundSource.AMBIENT); + public static final CompatSoundCategory VOICE = of(SoundSource.VOICE); - public SoundCategory soundCategory; + public SoundSource soundCategory; - public CompatSoundCategory(SoundCategory soundCategory) { + public CompatSoundCategory(SoundSource soundCategory) { this.soundCategory = soundCategory; } - public static CompatSoundCategory of(SoundCategory soundCategory) { + public static CompatSoundCategory of(SoundSource soundCategory) { return new CompatSoundCategory(soundCategory); } - public SoundCategory get() { + public SoundSource get() { return soundCategory; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java index f18fcf204..454f218aa 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java @@ -1,23 +1,23 @@ package net.pitan76.mcpitanlib.api.sound; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.sound.SoundEvent; +import net.minecraft.core.Holder; +import net.minecraft.sounds.SoundEvent; import org.jetbrains.annotations.Nullable; public class CompatSoundEvent { private SoundEvent soundEvent; - private RegistryEntry.Reference reference; - private RegistryEntry entry; + private Holder.Reference reference; + private Holder entry; public CompatSoundEvent(SoundEvent soundEvent) { this.soundEvent = soundEvent; } - public CompatSoundEvent(RegistryEntry.Reference reference) { + public CompatSoundEvent(Holder.Reference reference) { this.reference = reference; } - public CompatSoundEvent(RegistryEntry entry) { + public CompatSoundEvent(Holder entry) { this.entry = entry; } @@ -39,15 +39,15 @@ public SoundEvent get() { @Nullable @Deprecated - public RegistryEntry.Reference getReference() { + public Holder.Reference getReference() { return reference; } @Nullable @Deprecated - public RegistryEntry getEntry() { + public Holder getEntry() { if (entry == null) { - entry = RegistryEntry.of(soundEvent); + entry = Holder.direct(soundEvent); } return entry; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java index e535953d6..b4c92170f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.sound; import com.google.common.collect.ImmutableList; -import net.minecraft.entity.passive.WolfSoundVariants; -import net.minecraft.sound.SoundEvents; +import net.minecraft.world.entity.animal.wolf.WolfSoundVariants; +import net.minecraft.sounds.SoundEvents; public class CompatSoundEvents { - public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITH_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_AMBIENT_WITH_ITEM); - public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM); - public static final CompatSoundEvent ENTITY_ALLAY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_DEATH); - public static final CompatSoundEvent ENTITY_ALLAY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_HURT); - public static final CompatSoundEvent ENTITY_ALLAY_ITEM_GIVEN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_GIVEN); - public static final CompatSoundEvent ENTITY_ALLAY_ITEM_TAKEN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_TAKEN); - public static final CompatSoundEvent ENTITY_ALLAY_ITEM_THROWN = new CompatSoundEvent(SoundEvents.ENTITY_ALLAY_ITEM_THROWN); + public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITH_ITEM = new CompatSoundEvent(SoundEvents.ALLAY_AMBIENT_WITH_ITEM); + public static final CompatSoundEvent ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM = new CompatSoundEvent(SoundEvents.ALLAY_AMBIENT_WITHOUT_ITEM); + public static final CompatSoundEvent ENTITY_ALLAY_DEATH = new CompatSoundEvent(SoundEvents.ALLAY_DEATH); + public static final CompatSoundEvent ENTITY_ALLAY_HURT = new CompatSoundEvent(SoundEvents.ALLAY_HURT); + public static final CompatSoundEvent ENTITY_ALLAY_ITEM_GIVEN = new CompatSoundEvent(SoundEvents.ALLAY_ITEM_GIVEN); + public static final CompatSoundEvent ENTITY_ALLAY_ITEM_TAKEN = new CompatSoundEvent(SoundEvents.ALLAY_ITEM_TAKEN); + public static final CompatSoundEvent ENTITY_ALLAY_ITEM_THROWN = new CompatSoundEvent(SoundEvents.ALLAY_THROW); public static final CompatSoundEvent AMBIENT_CAVE = new CompatSoundEvent(SoundEvents.AMBIENT_CAVE); public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_ADDITIONS); public static final CompatSoundEvent AMBIENT_BASALT_DELTAS_LOOP = new CompatSoundEvent(SoundEvents.AMBIENT_BASALT_DELTAS_LOOP); @@ -34,839 +34,839 @@ public class CompatSoundEvents { public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS); public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE); public static final CompatSoundEvent AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE = new CompatSoundEvent(SoundEvents.AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_RESONATE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_RESONATE); - public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_BREAK); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_FALL); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_HIT); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_PLACE); - public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AMETHYST_CLUSTER_STEP); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_BREAK); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_STEP); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_PLACE); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_HIT); - public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ANCIENT_DEBRIS_FALL); - public static final CompatSoundEvent BLOCK_ANVIL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_BREAK); - public static final CompatSoundEvent BLOCK_ANVIL_DESTROY = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_DESTROY); - public static final CompatSoundEvent BLOCK_ANVIL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_FALL); - public static final CompatSoundEvent BLOCK_ANVIL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_HIT); - public static final CompatSoundEvent BLOCK_ANVIL_LAND = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_LAND); - public static final CompatSoundEvent BLOCK_ANVIL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_PLACE); - public static final CompatSoundEvent BLOCK_ANVIL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_STEP); - public static final CompatSoundEvent BLOCK_ANVIL_USE = new CompatSoundEvent(SoundEvents.BLOCK_ANVIL_USE); - public static final CompatSoundEvent ENTITY_ARMADILLO_EAT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_EAT); - public static final CompatSoundEvent ENTITY_ARMADILLO_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_HURT); - public static final CompatSoundEvent ENTITY_ARMADILLO_HURT_REDUCED = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_HURT_REDUCED); - public static final CompatSoundEvent ENTITY_ARMADILLO_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_AMBIENT); - public static final CompatSoundEvent ENTITY_ARMADILLO_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_STEP); - public static final CompatSoundEvent ENTITY_ARMADILLO_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_DEATH); - public static final CompatSoundEvent ENTITY_ARMADILLO_ROLL = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_ROLL); - public static final CompatSoundEvent ENTITY_ARMADILLO_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_LAND); - public static final CompatSoundEvent ENTITY_ARMADILLO_SCUTE_DROP = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_SCUTE_DROP); - public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_FINISH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_UNROLL_FINISH); - public static final CompatSoundEvent ENTITY_ARMADILLO_PEEK = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_PEEK); - public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_START = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_UNROLL_START); - public static final CompatSoundEvent ENTITY_ARMADILLO_BRUSH = new CompatSoundEvent(SoundEvents.ENTITY_ARMADILLO_BRUSH); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_CHAIN = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_CHAIN); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_DIAMOND = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_ELYTRA = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_ELYTRA); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GENERIC = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_GENERIC); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GOLD = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_GOLD); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_IRON = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_IRON); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_LEATHER = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_LEATHER); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_NETHERITE = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_TURTLE = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_TURTLE); - public static final CompatSoundEvent ITEM_ARMOR_EQUIP_WOLF = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_EQUIP_WOLF); - public static final CompatSoundEvent ITEM_ARMOR_UNEQUIP_WOLF = new CompatSoundEvent(SoundEvents.ITEM_ARMOR_UNEQUIP_WOLF); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_BREAK); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_FALL = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_FALL); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_HIT = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_HIT); - public static final CompatSoundEvent ENTITY_ARMOR_STAND_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_ARMOR_STAND_PLACE); - public static final CompatSoundEvent ENTITY_ARROW_HIT = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_HIT); - public static final CompatSoundEvent ENTITY_ARROW_HIT_PLAYER = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_HIT_PLAYER); - public static final CompatSoundEvent ENTITY_ARROW_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_ARROW_SHOOT); - public static final CompatSoundEvent ITEM_AXE_STRIP = new CompatSoundEvent(SoundEvents.ITEM_AXE_STRIP); - public static final CompatSoundEvent ITEM_AXE_SCRAPE = new CompatSoundEvent(SoundEvents.ITEM_AXE_SCRAPE); - public static final CompatSoundEvent ITEM_AXE_WAX_OFF = new CompatSoundEvent(SoundEvents.ITEM_AXE_WAX_OFF); - public static final CompatSoundEvent ENTITY_AXOLOTL_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_ATTACK); - public static final CompatSoundEvent ENTITY_AXOLOTL_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_DEATH); - public static final CompatSoundEvent ENTITY_AXOLOTL_HURT = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_HURT); - public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_AIR = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_IDLE_AIR); - public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_WATER = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_IDLE_WATER); - public static final CompatSoundEvent ENTITY_AXOLOTL_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_SPLASH); - public static final CompatSoundEvent ENTITY_AXOLOTL_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_AXOLOTL_SWIM); - public static final CompatSoundEvent BLOCK_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_BREAK); - public static final CompatSoundEvent BLOCK_AZALEA_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_FALL); - public static final CompatSoundEvent BLOCK_AZALEA_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_HIT); - public static final CompatSoundEvent BLOCK_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_PLACE); - public static final CompatSoundEvent BLOCK_AZALEA_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_STEP); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_BREAK); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_FALL); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_HIT); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_PLACE); - public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_AZALEA_LEAVES_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_FALL); - public static final CompatSoundEvent BLOCK_BAMBOO_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_SAPLING_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FALL); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN); - public static final CompatSoundEvent BLOCK_BARREL_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_BARREL_CLOSE); - public static final CompatSoundEvent BLOCK_BARREL_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_BARREL_OPEN); - public static final CompatSoundEvent BLOCK_BASALT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_BREAK); - public static final CompatSoundEvent BLOCK_BASALT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_STEP); - public static final CompatSoundEvent BLOCK_BASALT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_PLACE); - public static final CompatSoundEvent BLOCK_BASALT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_HIT); - public static final CompatSoundEvent BLOCK_BASALT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BASALT_FALL); - public static final CompatSoundEvent ENTITY_BAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BAT_AMBIENT); - public static final CompatSoundEvent ENTITY_BAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BAT_DEATH); - public static final CompatSoundEvent ENTITY_BAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BAT_HURT); - public static final CompatSoundEvent ENTITY_BAT_LOOP = new CompatSoundEvent(SoundEvents.ENTITY_BAT_LOOP); - public static final CompatSoundEvent ENTITY_BAT_TAKEOFF = new CompatSoundEvent(SoundEvents.ENTITY_BAT_TAKEOFF); - public static final CompatSoundEvent BLOCK_BEACON_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_ACTIVATE); - public static final CompatSoundEvent BLOCK_BEACON_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_AMBIENT); - public static final CompatSoundEvent BLOCK_BEACON_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_DEACTIVATE); - public static final CompatSoundEvent BLOCK_BEACON_POWER_SELECT = new CompatSoundEvent(SoundEvents.BLOCK_BEACON_POWER_SELECT); - public static final CompatSoundEvent ENTITY_BEE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BEE_DEATH); - public static final CompatSoundEvent ENTITY_BEE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BEE_HURT); - public static final CompatSoundEvent ENTITY_BEE_LOOP_AGGRESSIVE = new CompatSoundEvent(SoundEvents.ENTITY_BEE_LOOP_AGGRESSIVE); - public static final CompatSoundEvent ENTITY_BEE_LOOP = new CompatSoundEvent(SoundEvents.ENTITY_BEE_LOOP); - public static final CompatSoundEvent ENTITY_BEE_STING = new CompatSoundEvent(SoundEvents.ENTITY_BEE_STING); - public static final CompatSoundEvent ENTITY_BEE_POLLINATE = new CompatSoundEvent(SoundEvents.ENTITY_BEE_POLLINATE); - public static final CompatSoundEvent BLOCK_BEEHIVE_DRIP = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_DRIP); - public static final CompatSoundEvent BLOCK_BEEHIVE_ENTER = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_ENTER); - public static final CompatSoundEvent BLOCK_BEEHIVE_EXIT = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_EXIT); - public static final CompatSoundEvent BLOCK_BEEHIVE_SHEAR = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_SHEAR); - public static final CompatSoundEvent BLOCK_BEEHIVE_WORK = new CompatSoundEvent(SoundEvents.BLOCK_BEEHIVE_WORK); - public static final CompatSoundEvent BLOCK_BELL_USE = new CompatSoundEvent(SoundEvents.BLOCK_BELL_USE); - public static final CompatSoundEvent BLOCK_BELL_RESONATE = new CompatSoundEvent(SoundEvents.BLOCK_BELL_RESONATE); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_BREAK); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_FALL); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_HIT); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_PLACE); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_STEP); - public static final CompatSoundEvent ENTITY_BLAZE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_AMBIENT); - public static final CompatSoundEvent ENTITY_BLAZE_BURN = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_BURN); - public static final CompatSoundEvent ENTITY_BLAZE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_DEATH); - public static final CompatSoundEvent ENTITY_BLAZE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_HURT); - public static final CompatSoundEvent ENTITY_BLAZE_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_BLAZE_SHOOT); - public static final CompatSoundEvent ENTITY_BOAT_PADDLE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_BOAT_PADDLE_LAND); - public static final CompatSoundEvent ENTITY_BOAT_PADDLE_WATER = new CompatSoundEvent(SoundEvents.ENTITY_BOAT_PADDLE_WATER); - public static final CompatSoundEvent ENTITY_BOGGED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_AMBIENT); - public static final CompatSoundEvent ENTITY_BOGGED_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_DEATH); - public static final CompatSoundEvent ENTITY_BOGGED_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_HURT); - public static final CompatSoundEvent ENTITY_BOGGED_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_SHEAR); - public static final CompatSoundEvent ENTITY_BOGGED_STEP = new CompatSoundEvent(SoundEvents.ENTITY_BOGGED_STEP); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_BONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BONE_BLOCK_STEP); - public static final CompatSoundEvent ITEM_BONE_MEAL_USE = new CompatSoundEvent(SoundEvents.ITEM_BONE_MEAL_USE); - public static final CompatSoundEvent ITEM_BOOK_PAGE_TURN = new CompatSoundEvent(SoundEvents.ITEM_BOOK_PAGE_TURN); - public static final CompatSoundEvent ITEM_BOOK_PUT = new CompatSoundEvent(SoundEvents.ITEM_BOOK_PUT); - public static final CompatSoundEvent BLOCK_BLASTFURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_BLASTFURNACE_FIRE_CRACKLE); - public static final CompatSoundEvent ITEM_BOTTLE_EMPTY = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_EMPTY); - public static final CompatSoundEvent ITEM_BOTTLE_FILL = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_FILL); - public static final CompatSoundEvent ITEM_BOTTLE_FILL_DRAGONBREATH = new CompatSoundEvent(SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH); - public static final CompatSoundEvent ENTITY_BREEZE_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_CHARGE); - public static final CompatSoundEvent ENTITY_BREEZE_DEFLECT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_DEFLECT); - public static final CompatSoundEvent ENTITY_BREEZE_INHALE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_INHALE); - public static final CompatSoundEvent ENTITY_BREEZE_IDLE_GROUND = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_IDLE_GROUND); - public static final CompatSoundEvent ENTITY_BREEZE_IDLE_AIR = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_IDLE_AIR); - public static final CompatSoundEvent ENTITY_BREEZE_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_SHOOT); - public static final CompatSoundEvent ENTITY_BREEZE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_JUMP); - public static final CompatSoundEvent ENTITY_BREEZE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_LAND); - public static final CompatSoundEvent ENTITY_BREEZE_SLIDE = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_SLIDE); - public static final CompatSoundEvent ENTITY_BREEZE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_DEATH); - public static final CompatSoundEvent ENTITY_BREEZE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_HURT); - public static final CompatSoundEvent ENTITY_BREEZE_WHIRL = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_WHIRL); - public static final CompatSoundEvent ENTITY_BREEZE_WIND_BURST = new CompatSoundEvent(SoundEvents.ENTITY_BREEZE_WIND_BURST); - public static final CompatSoundEvent BLOCK_BREWING_STAND_BREW = new CompatSoundEvent(SoundEvents.BLOCK_BREWING_STAND_BREW); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GENERIC = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GENERIC); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_SAND); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GRAVEL); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND_COMPLETE = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_SAND_COMPLETE); - public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL_COMPLETE = new CompatSoundEvent(SoundEvents.ITEM_BRUSH_BRUSHING_GRAVEL_COMPLETE); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_BUBBLE_POP = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_BUBBLE_POP); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT); - public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = new CompatSoundEvent(SoundEvents.BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_AXOLOTL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_AXOLOTL); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_FISH = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_FISH); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_LAVA = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_LAVA); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_POWDER_SNOW = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_POWDER_SNOW); - public static final CompatSoundEvent ITEM_BUCKET_EMPTY_TADPOLE = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_EMPTY_TADPOLE); - public static final CompatSoundEvent ITEM_BUCKET_FILL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL); - public static final CompatSoundEvent ITEM_BUCKET_FILL_AXOLOTL = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_AXOLOTL); - public static final CompatSoundEvent ITEM_BUCKET_FILL_FISH = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_FISH); - public static final CompatSoundEvent ITEM_BUCKET_FILL_LAVA = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_LAVA); - public static final CompatSoundEvent ITEM_BUCKET_FILL_POWDER_SNOW = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_POWDER_SNOW); - public static final CompatSoundEvent ITEM_BUCKET_FILL_TADPOLE = new CompatSoundEvent(SoundEvents.ITEM_BUCKET_FILL_TADPOLE); - public static final CompatSoundEvent ITEM_BUNDLE_DROP_CONTENTS = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_DROP_CONTENTS); - public static final CompatSoundEvent ITEM_BUNDLE_INSERT = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_INSERT); - public static final CompatSoundEvent ITEM_BUNDLE_REMOVE_ONE = new CompatSoundEvent(SoundEvents.ITEM_BUNDLE_REMOVE_ONE); - public static final CompatSoundEvent BLOCK_CAKE_ADD_CANDLE = new CompatSoundEvent(SoundEvents.BLOCK_CAKE_ADD_CANDLE); - public static final CompatSoundEvent BLOCK_CALCITE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_BREAK); - public static final CompatSoundEvent BLOCK_CALCITE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_STEP); - public static final CompatSoundEvent BLOCK_CALCITE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_PLACE); - public static final CompatSoundEvent BLOCK_CALCITE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_HIT); - public static final CompatSoundEvent BLOCK_CALCITE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CALCITE_FALL); - public static final CompatSoundEvent ENTITY_CAMEL_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_AMBIENT); - public static final CompatSoundEvent ENTITY_CAMEL_DASH = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DASH); - public static final CompatSoundEvent ENTITY_CAMEL_DASH_READY = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DASH_READY); - public static final CompatSoundEvent ENTITY_CAMEL_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_DEATH); - public static final CompatSoundEvent ENTITY_CAMEL_EAT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_EAT); - public static final CompatSoundEvent ENTITY_CAMEL_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_HURT); - public static final CompatSoundEvent ENTITY_CAMEL_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_SADDLE); - public static final CompatSoundEvent ENTITY_CAMEL_SIT = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_SIT); - public static final CompatSoundEvent ENTITY_CAMEL_STAND = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STAND); - public static final CompatSoundEvent ENTITY_CAMEL_STEP = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STEP); - public static final CompatSoundEvent ENTITY_CAMEL_STEP_SAND = new CompatSoundEvent(SoundEvents.ENTITY_CAMEL_STEP_SAND); - public static final CompatSoundEvent BLOCK_CAMPFIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_CAMPFIRE_CRACKLE); - public static final CompatSoundEvent BLOCK_CANDLE_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_AMBIENT); - public static final CompatSoundEvent BLOCK_CANDLE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_BREAK); - public static final CompatSoundEvent BLOCK_CANDLE_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_EXTINGUISH); - public static final CompatSoundEvent BLOCK_CANDLE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_FALL); - public static final CompatSoundEvent BLOCK_CANDLE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_HIT); - public static final CompatSoundEvent BLOCK_CANDLE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_PLACE); - public static final CompatSoundEvent BLOCK_CANDLE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CANDLE_STEP); - public static final CompatSoundEvent ENTITY_CAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_AMBIENT); - public static final CompatSoundEvent ENTITY_CAT_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_STRAY_AMBIENT); - public static final CompatSoundEvent ENTITY_CAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CAT_DEATH); - public static final CompatSoundEvent ENTITY_CAT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_EAT); - public static final CompatSoundEvent ENTITY_CAT_HISS = new CompatSoundEvent(SoundEvents.ENTITY_CAT_HISS); - public static final CompatSoundEvent ENTITY_CAT_BEG_FOR_FOOD = new CompatSoundEvent(SoundEvents.ENTITY_CAT_BEG_FOR_FOOD); - public static final CompatSoundEvent ENTITY_CAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CAT_HURT); - public static final CompatSoundEvent ENTITY_CAT_PURR = new CompatSoundEvent(SoundEvents.ENTITY_CAT_PURR); - public static final CompatSoundEvent ENTITY_CAT_PURREOW = new CompatSoundEvent(SoundEvents.ENTITY_CAT_PURREOW); - public static final CompatSoundEvent BLOCK_CAVE_VINES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_BREAK); - public static final CompatSoundEvent BLOCK_CAVE_VINES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_FALL); - public static final CompatSoundEvent BLOCK_CAVE_VINES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_HIT); - public static final CompatSoundEvent BLOCK_CAVE_VINES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_PLACE); - public static final CompatSoundEvent BLOCK_CAVE_VINES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_STEP); - public static final CompatSoundEvent BLOCK_CAVE_VINES_PICK_BERRIES = new CompatSoundEvent(SoundEvents.BLOCK_CAVE_VINES_PICK_BERRIES); - public static final CompatSoundEvent BLOCK_CHAIN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_BREAK); - public static final CompatSoundEvent BLOCK_CHAIN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_FALL); - public static final CompatSoundEvent BLOCK_CHAIN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_HIT); - public static final CompatSoundEvent BLOCK_CHAIN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_PLACE); - public static final CompatSoundEvent BLOCK_CHAIN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHAIN_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_SAPLING_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_LEAVES_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN); - public static final CompatSoundEvent BLOCK_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_CLOSE); - public static final CompatSoundEvent BLOCK_CHEST_LOCKED = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_LOCKED); - public static final CompatSoundEvent BLOCK_CHEST_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_CHEST_OPEN); - public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_AMBIENT); - public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_DEATH); - public static final CompatSoundEvent ENTITY_CHICKEN_EGG = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_EGG); - public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_HURT); - public static final CompatSoundEvent ENTITY_CHICKEN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_CHICKEN_STEP); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_BREAK); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_FALL); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_HIT); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_INSERT); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT_ENCHANTED = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_INSERT_ENCHANTED); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_STEP); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PICKUP); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP_ENCHANTED = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PICKUP_ENCHANTED); - public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CHISELED_BOOKSHELF_PLACE); - public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_DEATH = new CompatSoundEvent(SoundEvents.BLOCK_CHORUS_FLOWER_DEATH); - public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_GROW = new CompatSoundEvent(SoundEvents.BLOCK_CHORUS_FLOWER_GROW); - public static final CompatSoundEvent ITEM_CHORUS_FRUIT_TELEPORT = new CompatSoundEvent(SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT); - public static final CompatSoundEvent BLOCK_COBWEB_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_BREAK); - public static final CompatSoundEvent BLOCK_COBWEB_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_STEP); - public static final CompatSoundEvent BLOCK_COBWEB_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_PLACE); - public static final CompatSoundEvent BLOCK_COBWEB_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_HIT); - public static final CompatSoundEvent BLOCK_COBWEB_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COBWEB_FALL); - public static final CompatSoundEvent ENTITY_COD_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_COD_AMBIENT); - public static final CompatSoundEvent ENTITY_COD_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_COD_DEATH); - public static final CompatSoundEvent ENTITY_COD_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_COD_FLOP); - public static final CompatSoundEvent ENTITY_COD_HURT = new CompatSoundEvent(SoundEvents.ENTITY_COD_HURT); - public static final CompatSoundEvent BLOCK_COMPARATOR_CLICK = new CompatSoundEvent(SoundEvents.BLOCK_COMPARATOR_CLICK); - public static final CompatSoundEvent BLOCK_COMPOSTER_EMPTY = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_EMPTY); - public static final CompatSoundEvent BLOCK_COMPOSTER_FILL = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_FILL); - public static final CompatSoundEvent BLOCK_COMPOSTER_FILL_SUCCESS = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_FILL_SUCCESS); - public static final CompatSoundEvent BLOCK_COMPOSTER_READY = new CompatSoundEvent(SoundEvents.BLOCK_COMPOSTER_READY); - public static final CompatSoundEvent BLOCK_CONDUIT_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_ACTIVATE); - public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_AMBIENT); - public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT_SHORT = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_AMBIENT_SHORT); - public static final CompatSoundEvent BLOCK_CONDUIT_ATTACK_TARGET = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_ATTACK_TARGET); - public static final CompatSoundEvent BLOCK_CONDUIT_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_CONDUIT_DEACTIVATE); - public static final CompatSoundEvent BLOCK_COPPER_BULB_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_BREAK); - public static final CompatSoundEvent BLOCK_COPPER_BULB_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_STEP); - public static final CompatSoundEvent BLOCK_COPPER_BULB_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_PLACE); - public static final CompatSoundEvent BLOCK_COPPER_BULB_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_HIT); - public static final CompatSoundEvent BLOCK_COPPER_BULB_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_FALL); - public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_ON = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_TURN_ON); - public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_OFF = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BULB_TURN_OFF); - public static final CompatSoundEvent BLOCK_COPPER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_BREAK); - public static final CompatSoundEvent BLOCK_COPPER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_STEP); - public static final CompatSoundEvent BLOCK_COPPER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_PLACE); - public static final CompatSoundEvent BLOCK_COPPER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_HIT); - public static final CompatSoundEvent BLOCK_COPPER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_FALL); - public static final CompatSoundEvent BLOCK_COPPER_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_COPPER_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_BREAK); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_STEP); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_PLACE); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_HIT); - public static final CompatSoundEvent BLOCK_COPPER_GRATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_GRATE_FALL); - public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_COPPER_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_CORAL_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_CORAL_BLOCK_STEP); - public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_COW_AMBIENT); - public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_COW_DEATH); - public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.ENTITY_COW_HURT); - public static final CompatSoundEvent ENTITY_COW_MILK = new CompatSoundEvent(SoundEvents.ENTITY_COW_MILK); - public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.ENTITY_COW_STEP); - public static final CompatSoundEvent BLOCK_CRAFTER_CRAFT = new CompatSoundEvent(SoundEvents.BLOCK_CRAFTER_CRAFT); - public static final CompatSoundEvent BLOCK_CRAFTER_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_CRAFTER_FAIL); - public static final CompatSoundEvent ENTITY_CREEPER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_DEATH); - public static final CompatSoundEvent ENTITY_CREEPER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_HURT); - public static final CompatSoundEvent ENTITY_CREEPER_PRIMED = new CompatSoundEvent(SoundEvents.ENTITY_CREEPER_PRIMED); - public static final CompatSoundEvent BLOCK_CROP_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_CROP_BREAK); - public static final CompatSoundEvent ITEM_CROP_PLANT = new CompatSoundEvent(SoundEvents.ITEM_CROP_PLANT); - public static final CompatSoundEvent ITEM_CROSSBOW_HIT = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_HIT); - public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_END = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_END); - public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_MIDDLE = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_MIDDLE); - public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_START = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_LOADING_START); - public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_1 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_1); - public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_2 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_2); - public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_3 = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_QUICK_CHARGE_3); - public static final CompatSoundEvent ITEM_CROSSBOW_SHOOT = new CompatSoundEvent(SoundEvents.ITEM_CROSSBOW_SHOOT); - public static final CompatSoundEvent BLOCK_DECORATED_POT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_BREAK); - public static final CompatSoundEvent BLOCK_DECORATED_POT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_FALL); - public static final CompatSoundEvent BLOCK_DECORATED_POT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_HIT); - public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_INSERT); - public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_INSERT_FAIL); - public static final CompatSoundEvent BLOCK_DECORATED_POT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_STEP); - public static final CompatSoundEvent BLOCK_DECORATED_POT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_PLACE); - public static final CompatSoundEvent BLOCK_DECORATED_POT_SHATTER = new CompatSoundEvent(SoundEvents.BLOCK_DECORATED_POT_SHATTER); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_BREAK); - public static final CompatSoundEvent BLOCK_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_FALL); - public static final CompatSoundEvent BLOCK_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_HIT); - public static final CompatSoundEvent BLOCK_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_PLACE); - public static final CompatSoundEvent BLOCK_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_STEP); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_BREAK); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_FALL); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_HIT); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_PLACE); - public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DEEPSLATE_TILES_STEP); - public static final CompatSoundEvent BLOCK_DISPENSER_DISPENSE = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_DISPENSE); - public static final CompatSoundEvent BLOCK_DISPENSER_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_FAIL); - public static final CompatSoundEvent BLOCK_DISPENSER_LAUNCH = new CompatSoundEvent(SoundEvents.BLOCK_DISPENSER_LAUNCH); - public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_AMBIENT); - public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_AMBIENT_WATER); - public static final CompatSoundEvent ENTITY_DOLPHIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_ATTACK); - public static final CompatSoundEvent ENTITY_DOLPHIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_DEATH); - public static final CompatSoundEvent ENTITY_DOLPHIN_EAT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_EAT); - public static final CompatSoundEvent ENTITY_DOLPHIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_HURT); - public static final CompatSoundEvent ENTITY_DOLPHIN_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_JUMP); - public static final CompatSoundEvent ENTITY_DOLPHIN_PLAY = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_PLAY); - public static final CompatSoundEvent ENTITY_DOLPHIN_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_SPLASH); - public static final CompatSoundEvent ENTITY_DOLPHIN_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_DOLPHIN_SWIM); - public static final CompatSoundEvent ENTITY_DONKEY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_AMBIENT); - public static final CompatSoundEvent ENTITY_DONKEY_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_ANGRY); - public static final CompatSoundEvent ENTITY_DONKEY_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_CHEST); - public static final CompatSoundEvent ENTITY_DONKEY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_DEATH); - public static final CompatSoundEvent ENTITY_DONKEY_EAT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_EAT); - public static final CompatSoundEvent ENTITY_DONKEY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_HURT); - public static final CompatSoundEvent ENTITY_DONKEY_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_DONKEY_JUMP); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_DRIPSTONE_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_BREAK); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_STEP); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_PLACE); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_HIT); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_FALL); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_LAND = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_LAND); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_LAVA); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_WATER); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON); - public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.BLOCK_POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_DOWN = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_DOWN); - public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_UP = new CompatSoundEvent(SoundEvents.BLOCK_BIG_DRIPLEAF_TILT_UP); - public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_AMBIENT); - public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_AMBIENT_WATER); - public static final CompatSoundEvent ENTITY_DROWNED_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_DEATH); - public static final CompatSoundEvent ENTITY_DROWNED_DEATH_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_DEATH_WATER); - public static final CompatSoundEvent ENTITY_DROWNED_HURT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_HURT); - public static final CompatSoundEvent ENTITY_DROWNED_HURT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_HURT_WATER); - public static final CompatSoundEvent ENTITY_DROWNED_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_SHOOT); - public static final CompatSoundEvent ENTITY_DROWNED_STEP = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_STEP); - public static final CompatSoundEvent ENTITY_DROWNED_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_DROWNED_SWIM); - public static final CompatSoundEvent ITEM_DYE_USE = new CompatSoundEvent(SoundEvents.ITEM_DYE_USE); - public static final CompatSoundEvent ENTITY_EGG_THROW = new CompatSoundEvent(SoundEvents.ENTITY_EGG_THROW); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_AMBIENT); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_AMBIENT_LAND); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_CURSE = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_CURSE); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_DEATH); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_DEATH_LAND); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_FLOP); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_HURT); - public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_ELDER_GUARDIAN_HURT_LAND); - public static final CompatSoundEvent ITEM_ELYTRA_FLYING = new CompatSoundEvent(SoundEvents.ITEM_ELYTRA_FLYING); - public static final CompatSoundEvent BLOCK_ENCHANTMENT_TABLE_USE = new CompatSoundEvent(SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE); - public static final CompatSoundEvent BLOCK_ENDER_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_ENDER_CHEST_CLOSE); - public static final CompatSoundEvent BLOCK_ENDER_CHEST_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_ENDER_CHEST_OPEN); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_AMBIENT); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_DEATH); - public static final CompatSoundEvent ENTITY_DRAGON_FIREBALL_EXPLODE = new CompatSoundEvent(SoundEvents.ENTITY_DRAGON_FIREBALL_EXPLODE); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_FLAP = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_FLAP); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_GROWL = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_GROWL); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_HURT); - public static final CompatSoundEvent ENTITY_ENDER_DRAGON_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_DRAGON_SHOOT); - public static final CompatSoundEvent ENTITY_ENDER_EYE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_EYE_DEATH); - public static final CompatSoundEvent ENTITY_ENDER_EYE_LAUNCH = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_EYE_LAUNCH); - public static final CompatSoundEvent ENTITY_ENDERMAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_AMBIENT); - public static final CompatSoundEvent ENTITY_ENDERMAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_DEATH); - public static final CompatSoundEvent ENTITY_ENDERMAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_HURT); - public static final CompatSoundEvent ENTITY_ENDERMAN_SCREAM = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_SCREAM); - public static final CompatSoundEvent ENTITY_ENDERMAN_STARE = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_STARE); - public static final CompatSoundEvent ENTITY_ENDERMAN_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMAN_TELEPORT); - public static final CompatSoundEvent ENTITY_ENDERMITE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_AMBIENT); - public static final CompatSoundEvent ENTITY_ENDERMITE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_DEATH); - public static final CompatSoundEvent ENTITY_ENDERMITE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_HURT); - public static final CompatSoundEvent ENTITY_ENDERMITE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ENDERMITE_STEP); - public static final CompatSoundEvent ENTITY_ENDER_PEARL_THROW = new CompatSoundEvent(SoundEvents.ENTITY_ENDER_PEARL_THROW); - public static final CompatSoundEvent BLOCK_END_GATEWAY_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_END_GATEWAY_SPAWN); - public static final CompatSoundEvent BLOCK_END_PORTAL_FRAME_FILL = new CompatSoundEvent(SoundEvents.BLOCK_END_PORTAL_FRAME_FILL); - public static final CompatSoundEvent BLOCK_END_PORTAL_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_END_PORTAL_SPAWN); - public static final CompatSoundEvent ENTITY_EVOKER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_AMBIENT); - public static final CompatSoundEvent ENTITY_EVOKER_CAST_SPELL = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_CAST_SPELL); - public static final CompatSoundEvent ENTITY_EVOKER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_CELEBRATE); - public static final CompatSoundEvent ENTITY_EVOKER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_DEATH); - public static final CompatSoundEvent ENTITY_EVOKER_FANGS_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_FANGS_ATTACK); - public static final CompatSoundEvent ENTITY_EVOKER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_HURT); - public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_ATTACK); - public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_SUMMON = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_SUMMON); - public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_WOLOLO = new CompatSoundEvent(SoundEvents.ENTITY_EVOKER_PREPARE_WOLOLO); - public static final CompatSoundEvent ENTITY_EXPERIENCE_BOTTLE_THROW = new CompatSoundEvent(SoundEvents.ENTITY_EXPERIENCE_BOTTLE_THROW); - public static final CompatSoundEvent ENTITY_EXPERIENCE_ORB_PICKUP = new CompatSoundEvent(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP); - public static final CompatSoundEvent BLOCK_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_FENCE_GATE_OPEN); - public static final CompatSoundEvent ITEM_FIRECHARGE_USE = new CompatSoundEvent(SoundEvents.ITEM_FIRECHARGE_USE); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_BLAST); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_BLAST_FAR); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LARGE_BLAST); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LAUNCH = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_LAUNCH); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_SHOOT); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_TWINKLE); - public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE_FAR = new CompatSoundEvent(SoundEvents.ENTITY_FIREWORK_ROCKET_TWINKLE_FAR); - public static final CompatSoundEvent BLOCK_FIRE_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_FIRE_AMBIENT); - public static final CompatSoundEvent BLOCK_FIRE_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_FIRE_EXTINGUISH); - public static final CompatSoundEvent ENTITY_FISH_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_FISH_SWIM); - public static final CompatSoundEvent ENTITY_FISHING_BOBBER_RETRIEVE = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_RETRIEVE); - public static final CompatSoundEvent ENTITY_FISHING_BOBBER_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_SPLASH); - public static final CompatSoundEvent ENTITY_FISHING_BOBBER_THROW = new CompatSoundEvent(SoundEvents.ENTITY_FISHING_BOBBER_THROW); - public static final CompatSoundEvent ITEM_FLINTANDSTEEL_USE = new CompatSoundEvent(SoundEvents.ITEM_FLINTANDSTEEL_USE); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_BREAK); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_FALL); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_HIT); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_PLACE); - public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FLOWERING_AZALEA_STEP); - public static final CompatSoundEvent ENTITY_FOX_AGGRO = new CompatSoundEvent(SoundEvents.ENTITY_FOX_AGGRO); - public static final CompatSoundEvent ENTITY_FOX_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_AMBIENT); - public static final CompatSoundEvent ENTITY_FOX_BITE = new CompatSoundEvent(SoundEvents.ENTITY_FOX_BITE); - public static final CompatSoundEvent ENTITY_FOX_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_FOX_DEATH); - public static final CompatSoundEvent ENTITY_FOX_EAT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_EAT); - public static final CompatSoundEvent ENTITY_FOX_HURT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_HURT); - public static final CompatSoundEvent ENTITY_FOX_SCREECH = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SCREECH); - public static final CompatSoundEvent ENTITY_FOX_SLEEP = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SLEEP); - public static final CompatSoundEvent ENTITY_FOX_SNIFF = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SNIFF); - public static final CompatSoundEvent ENTITY_FOX_SPIT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_SPIT); - public static final CompatSoundEvent ENTITY_FOX_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_FOX_TELEPORT); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_BREAK); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_STEP); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_PLACE); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_HIT); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_SAND_FALL); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_BREAK); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_STEP); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_PLACE); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_HIT); - public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SUSPICIOUS_GRAVEL_FALL); - public static final CompatSoundEvent BLOCK_FROGLIGHT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_BREAK); - public static final CompatSoundEvent BLOCK_FROGLIGHT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_FALL); - public static final CompatSoundEvent BLOCK_FROGLIGHT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_HIT); - public static final CompatSoundEvent BLOCK_FROGLIGHT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_PLACE); - public static final CompatSoundEvent BLOCK_FROGLIGHT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FROGLIGHT_STEP); - public static final CompatSoundEvent BLOCK_FROGSPAWN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_STEP); - public static final CompatSoundEvent BLOCK_FROGSPAWN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_BREAK); - public static final CompatSoundEvent BLOCK_FROGSPAWN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_FALL); - public static final CompatSoundEvent BLOCK_FROGSPAWN_HATCH = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_HATCH); - public static final CompatSoundEvent BLOCK_FROGSPAWN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_HIT); - public static final CompatSoundEvent BLOCK_FROGSPAWN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FROGSPAWN_PLACE); - public static final CompatSoundEvent ENTITY_FROG_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_AMBIENT); - public static final CompatSoundEvent ENTITY_FROG_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_FROG_DEATH); - public static final CompatSoundEvent ENTITY_FROG_EAT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_EAT); - public static final CompatSoundEvent ENTITY_FROG_HURT = new CompatSoundEvent(SoundEvents.ENTITY_FROG_HURT); - public static final CompatSoundEvent ENTITY_FROG_LAY_SPAWN = new CompatSoundEvent(SoundEvents.ENTITY_FROG_LAY_SPAWN); - public static final CompatSoundEvent ENTITY_FROG_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_FROG_LONG_JUMP); - public static final CompatSoundEvent ENTITY_FROG_STEP = new CompatSoundEvent(SoundEvents.ENTITY_FROG_STEP); - public static final CompatSoundEvent ENTITY_FROG_TONGUE = new CompatSoundEvent(SoundEvents.ENTITY_FROG_TONGUE); - public static final CompatSoundEvent BLOCK_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_STEP); - public static final CompatSoundEvent BLOCK_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_FURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE); - public static final CompatSoundEvent ENTITY_GENERIC_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_BIG_FALL); - public static final CompatSoundEvent ENTITY_GENERIC_BURN = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_BURN); - public static final CompatSoundEvent ENTITY_GENERIC_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_DEATH); - public static final CompatSoundEvent ENTITY_GENERIC_DRINK = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_DRINK); - public static final CompatSoundEvent ENTITY_GENERIC_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EAT); - public static final CompatSoundEvent ENTITY_GENERIC_EXPLODE = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EXPLODE); - public static final CompatSoundEvent ENTITY_GENERIC_EXTINGUISH_FIRE = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE); - public static final CompatSoundEvent ENTITY_GENERIC_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_HURT); - public static final CompatSoundEvent ENTITY_GENERIC_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SMALL_FALL); - public static final CompatSoundEvent ENTITY_GENERIC_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SPLASH); - public static final CompatSoundEvent ENTITY_GENERIC_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_GENERIC_SWIM); - public static final CompatSoundEvent ENTITY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_AMBIENT); - public static final CompatSoundEvent ENTITY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_DEATH); - public static final CompatSoundEvent ENTITY_GHAST_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_HURT); - public static final CompatSoundEvent ENTITY_GHAST_SCREAM = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_SCREAM); - public static final CompatSoundEvent ENTITY_GHAST_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_SHOOT); - public static final CompatSoundEvent ENTITY_GHAST_WARN = new CompatSoundEvent(SoundEvents.ENTITY_GHAST_WARN); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_BREAK); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_FALL); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_HIT); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_PLACE); - public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GILDED_BLACKSTONE_STEP); - public static final CompatSoundEvent BLOCK_GLASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_BREAK); - public static final CompatSoundEvent BLOCK_GLASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_FALL); - public static final CompatSoundEvent BLOCK_GLASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_HIT); - public static final CompatSoundEvent BLOCK_GLASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_PLACE); - public static final CompatSoundEvent BLOCK_GLASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GLASS_STEP); - public static final CompatSoundEvent ITEM_GLOW_INK_SAC_USE = new CompatSoundEvent(SoundEvents.ITEM_GLOW_INK_SAC_USE); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_ADD_ITEM); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_BREAK); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_PLACE); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_REMOVE_ITEM); - public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_ITEM_FRAME_ROTATE_ITEM); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_AMBIENT); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_DEATH); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_HURT); - public static final CompatSoundEvent ENTITY_GLOW_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.ENTITY_GLOW_SQUID_SQUIRT); - public static final CompatSoundEvent ENTITY_GOAT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_AMBIENT); - public static final CompatSoundEvent ENTITY_GOAT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_DEATH); - public static final CompatSoundEvent ENTITY_GOAT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_EAT); - public static final CompatSoundEvent ENTITY_GOAT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HURT); - public static final CompatSoundEvent ENTITY_GOAT_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_LONG_JUMP); - public static final CompatSoundEvent ENTITY_GOAT_MILK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_MILK); - public static final CompatSoundEvent ENTITY_GOAT_PREPARE_RAM = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_PREPARE_RAM); - public static final CompatSoundEvent ENTITY_GOAT_RAM_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_RAM_IMPACT); - public static final CompatSoundEvent ENTITY_GOAT_HORN_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HORN_BREAK); - public static final CompatSoundEvent ITEM_GOAT_HORN_PLAY = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_STEP); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_AMBIENT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_DEATH); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_EAT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_EAT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_HURT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_LONG_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_LONG_JUMP); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_MILK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_MILK); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_PREPARE_RAM = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_PREPARE_RAM); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_RAM_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_SCREAMING_RAM_IMPACT); - public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HORN_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_HORN_BREAK); - public static final CompatSoundEvent ENTITY_GOAT_STEP = new CompatSoundEvent(SoundEvents.ENTITY_GOAT_STEP); - public static final CompatSoundEvent BLOCK_GRASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_BREAK); - public static final CompatSoundEvent BLOCK_GRASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_FALL); - public static final CompatSoundEvent BLOCK_GRASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_HIT); - public static final CompatSoundEvent BLOCK_GRASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_PLACE); - public static final CompatSoundEvent BLOCK_GRASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GRASS_STEP); - public static final CompatSoundEvent BLOCK_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_BREAK); - public static final CompatSoundEvent BLOCK_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_FALL); - public static final CompatSoundEvent BLOCK_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_HIT); - public static final CompatSoundEvent BLOCK_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_PLACE); - public static final CompatSoundEvent BLOCK_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_GRAVEL_STEP); - public static final CompatSoundEvent BLOCK_GRINDSTONE_USE = new CompatSoundEvent(SoundEvents.BLOCK_GRINDSTONE_USE); - public static final CompatSoundEvent BLOCK_GROWING_PLANT_CROP = new CompatSoundEvent(SoundEvents.BLOCK_GROWING_PLANT_CROP); - public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_AMBIENT); - public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_AMBIENT_LAND); - public static final CompatSoundEvent ENTITY_GUARDIAN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_ATTACK); - public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_DEATH); - public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_DEATH_LAND); - public static final CompatSoundEvent ENTITY_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_FLOP); - public static final CompatSoundEvent ENTITY_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_HURT); - public static final CompatSoundEvent ENTITY_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_GUARDIAN_HURT_LAND); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_HANGING_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_ROOTS_STEP); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_BREAK); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_FALL); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_HIT); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_PLACE); - public static final CompatSoundEvent BLOCK_HEAVY_CORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HEAVY_CORE_STEP); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_STEP); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_BREAK); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_FALL); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_HIT); - public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_BAMBOO_WOOD_HANGING_SIGN_PLACE); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_BREAK); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_STEP); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_PLACE); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_HIT); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_FALL); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_MOB = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_MOB); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_ITEM); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_DETECT_PLAYER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_DETECT_PLAYER); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OMINOUS_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_OMINOUS_ACTIVATE); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_AMBIENT); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT_OMINOUS = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_AMBIENT_OMINOUS); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER); - public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_EJECT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_TRIAL_SPAWNER_EJECT_ITEM); - public static final CompatSoundEvent ITEM_HOE_TILL = new CompatSoundEvent(SoundEvents.ITEM_HOE_TILL); - public static final CompatSoundEvent ENTITY_HOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_HOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_HOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_ATTACK); - public static final CompatSoundEvent ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED); - public static final CompatSoundEvent ENTITY_HOGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_DEATH); - public static final CompatSoundEvent ENTITY_HOGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_HURT); - public static final CompatSoundEvent ENTITY_HOGLIN_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_RETREAT); - public static final CompatSoundEvent ENTITY_HOGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HOGLIN_STEP); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_SLIDE = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_SLIDE); - public static final CompatSoundEvent BLOCK_HONEY_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_HONEY_BLOCK_STEP); - public static final CompatSoundEvent ITEM_HONEYCOMB_WAX_ON = new CompatSoundEvent(SoundEvents.ITEM_HONEYCOMB_WAX_ON); - public static final CompatSoundEvent ITEM_HONEY_BOTTLE_DRINK = new CompatSoundEvent(SoundEvents.ITEM_HONEY_BOTTLE_DRINK); - public static final int GOAT_HORN_SOUNDS_COUNT = SoundEvents.GOAT_HORN_SOUND_COUNT; + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.AMETHYST_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.AMETHYST_BLOCK_CHIME); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_FALL = new CompatSoundEvent(SoundEvents.AMETHYST_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_HIT = new CompatSoundEvent(SoundEvents.AMETHYST_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.AMETHYST_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_RESONATE = new CompatSoundEvent(SoundEvents.AMETHYST_BLOCK_RESONATE); + public static final CompatSoundEvent BLOCK_AMETHYST_BLOCK_STEP = new CompatSoundEvent(SoundEvents.AMETHYST_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_BREAK = new CompatSoundEvent(SoundEvents.AMETHYST_CLUSTER_BREAK); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_FALL = new CompatSoundEvent(SoundEvents.AMETHYST_CLUSTER_FALL); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_HIT = new CompatSoundEvent(SoundEvents.AMETHYST_CLUSTER_HIT); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_PLACE = new CompatSoundEvent(SoundEvents.AMETHYST_CLUSTER_PLACE); + public static final CompatSoundEvent BLOCK_AMETHYST_CLUSTER_STEP = new CompatSoundEvent(SoundEvents.AMETHYST_CLUSTER_STEP); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_BREAK = new CompatSoundEvent(SoundEvents.ANCIENT_DEBRIS_BREAK); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_STEP = new CompatSoundEvent(SoundEvents.ANCIENT_DEBRIS_STEP); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_PLACE = new CompatSoundEvent(SoundEvents.ANCIENT_DEBRIS_PLACE); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_HIT = new CompatSoundEvent(SoundEvents.ANCIENT_DEBRIS_HIT); + public static final CompatSoundEvent BLOCK_ANCIENT_DEBRIS_FALL = new CompatSoundEvent(SoundEvents.ANCIENT_DEBRIS_FALL); + public static final CompatSoundEvent BLOCK_ANVIL_BREAK = new CompatSoundEvent(SoundEvents.ANVIL_BREAK); + public static final CompatSoundEvent BLOCK_ANVIL_DESTROY = new CompatSoundEvent(SoundEvents.ANVIL_DESTROY); + public static final CompatSoundEvent BLOCK_ANVIL_FALL = new CompatSoundEvent(SoundEvents.ANVIL_FALL); + public static final CompatSoundEvent BLOCK_ANVIL_HIT = new CompatSoundEvent(SoundEvents.ANVIL_HIT); + public static final CompatSoundEvent BLOCK_ANVIL_LAND = new CompatSoundEvent(SoundEvents.ANVIL_LAND); + public static final CompatSoundEvent BLOCK_ANVIL_PLACE = new CompatSoundEvent(SoundEvents.ANVIL_PLACE); + public static final CompatSoundEvent BLOCK_ANVIL_STEP = new CompatSoundEvent(SoundEvents.ANVIL_STEP); + public static final CompatSoundEvent BLOCK_ANVIL_USE = new CompatSoundEvent(SoundEvents.ANVIL_USE); + public static final CompatSoundEvent ENTITY_ARMADILLO_EAT = new CompatSoundEvent(SoundEvents.ARMADILLO_EAT); + public static final CompatSoundEvent ENTITY_ARMADILLO_HURT = new CompatSoundEvent(SoundEvents.ARMADILLO_HURT); + public static final CompatSoundEvent ENTITY_ARMADILLO_HURT_REDUCED = new CompatSoundEvent(SoundEvents.ARMADILLO_HURT_REDUCED); + public static final CompatSoundEvent ENTITY_ARMADILLO_AMBIENT = new CompatSoundEvent(SoundEvents.ARMADILLO_AMBIENT); + public static final CompatSoundEvent ENTITY_ARMADILLO_STEP = new CompatSoundEvent(SoundEvents.ARMADILLO_STEP); + public static final CompatSoundEvent ENTITY_ARMADILLO_DEATH = new CompatSoundEvent(SoundEvents.ARMADILLO_DEATH); + public static final CompatSoundEvent ENTITY_ARMADILLO_ROLL = new CompatSoundEvent(SoundEvents.ARMADILLO_ROLL); + public static final CompatSoundEvent ENTITY_ARMADILLO_LAND = new CompatSoundEvent(SoundEvents.ARMADILLO_LAND); + public static final CompatSoundEvent ENTITY_ARMADILLO_SCUTE_DROP = new CompatSoundEvent(SoundEvents.ARMADILLO_SCUTE_DROP); + public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_FINISH = new CompatSoundEvent(SoundEvents.ARMADILLO_UNROLL_FINISH); + public static final CompatSoundEvent ENTITY_ARMADILLO_PEEK = new CompatSoundEvent(SoundEvents.ARMADILLO_PEEK); + public static final CompatSoundEvent ENTITY_ARMADILLO_UNROLL_START = new CompatSoundEvent(SoundEvents.ARMADILLO_UNROLL_START); + public static final CompatSoundEvent ENTITY_ARMADILLO_BRUSH = new CompatSoundEvent(SoundEvents.ARMADILLO_BRUSH); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_CHAIN = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_CHAIN); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_DIAMOND = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_DIAMOND); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_ELYTRA = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_ELYTRA); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GENERIC = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_GENERIC); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_GOLD = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_GOLD); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_IRON = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_IRON); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_LEATHER = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_LEATHER); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_NETHERITE = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_NETHERITE); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_TURTLE = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_TURTLE); + public static final CompatSoundEvent ITEM_ARMOR_EQUIP_WOLF = new CompatSoundEvent(SoundEvents.ARMOR_EQUIP_WOLF); + public static final CompatSoundEvent ITEM_ARMOR_UNEQUIP_WOLF = new CompatSoundEvent(SoundEvents.ARMOR_UNEQUIP_WOLF); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_BREAK = new CompatSoundEvent(SoundEvents.ARMOR_STAND_BREAK); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_FALL = new CompatSoundEvent(SoundEvents.ARMOR_STAND_FALL); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_HIT = new CompatSoundEvent(SoundEvents.ARMOR_STAND_HIT); + public static final CompatSoundEvent ENTITY_ARMOR_STAND_PLACE = new CompatSoundEvent(SoundEvents.ARMOR_STAND_PLACE); + public static final CompatSoundEvent ENTITY_ARROW_HIT = new CompatSoundEvent(SoundEvents.ARROW_HIT); + public static final CompatSoundEvent ENTITY_ARROW_HIT_PLAYER = new CompatSoundEvent(SoundEvents.ARROW_HIT_PLAYER); + public static final CompatSoundEvent ENTITY_ARROW_SHOOT = new CompatSoundEvent(SoundEvents.ARROW_SHOOT); + public static final CompatSoundEvent ITEM_AXE_STRIP = new CompatSoundEvent(SoundEvents.AXE_STRIP); + public static final CompatSoundEvent ITEM_AXE_SCRAPE = new CompatSoundEvent(SoundEvents.AXE_SCRAPE); + public static final CompatSoundEvent ITEM_AXE_WAX_OFF = new CompatSoundEvent(SoundEvents.AXE_WAX_OFF); + public static final CompatSoundEvent ENTITY_AXOLOTL_ATTACK = new CompatSoundEvent(SoundEvents.AXOLOTL_ATTACK); + public static final CompatSoundEvent ENTITY_AXOLOTL_DEATH = new CompatSoundEvent(SoundEvents.AXOLOTL_DEATH); + public static final CompatSoundEvent ENTITY_AXOLOTL_HURT = new CompatSoundEvent(SoundEvents.AXOLOTL_HURT); + public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_AIR = new CompatSoundEvent(SoundEvents.AXOLOTL_IDLE_AIR); + public static final CompatSoundEvent ENTITY_AXOLOTL_IDLE_WATER = new CompatSoundEvent(SoundEvents.AXOLOTL_IDLE_WATER); + public static final CompatSoundEvent ENTITY_AXOLOTL_SPLASH = new CompatSoundEvent(SoundEvents.AXOLOTL_SPLASH); + public static final CompatSoundEvent ENTITY_AXOLOTL_SWIM = new CompatSoundEvent(SoundEvents.AXOLOTL_SWIM); + public static final CompatSoundEvent BLOCK_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.AZALEA_BREAK); + public static final CompatSoundEvent BLOCK_AZALEA_FALL = new CompatSoundEvent(SoundEvents.AZALEA_FALL); + public static final CompatSoundEvent BLOCK_AZALEA_HIT = new CompatSoundEvent(SoundEvents.AZALEA_HIT); + public static final CompatSoundEvent BLOCK_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.AZALEA_PLACE); + public static final CompatSoundEvent BLOCK_AZALEA_STEP = new CompatSoundEvent(SoundEvents.AZALEA_STEP); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.AZALEA_LEAVES_BREAK); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_FALL = new CompatSoundEvent(SoundEvents.AZALEA_LEAVES_FALL); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_HIT = new CompatSoundEvent(SoundEvents.AZALEA_LEAVES_HIT); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.AZALEA_LEAVES_PLACE); + public static final CompatSoundEvent BLOCK_AZALEA_LEAVES_STEP = new CompatSoundEvent(SoundEvents.AZALEA_LEAVES_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_BREAK = new CompatSoundEvent(SoundEvents.BAMBOO_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_FALL = new CompatSoundEvent(SoundEvents.BAMBOO_FALL); + public static final CompatSoundEvent BLOCK_BAMBOO_HIT = new CompatSoundEvent(SoundEvents.BAMBOO_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_PLACE = new CompatSoundEvent(SoundEvents.BAMBOO_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_STEP = new CompatSoundEvent(SoundEvents.BAMBOO_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.BAMBOO_SAPLING_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_HIT = new CompatSoundEvent(SoundEvents.BAMBOO_SAPLING_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.BAMBOO_SAPLING_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FALL = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_FALL); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HIT = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_STEP = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_FENCE_GATE_OPEN); + public static final CompatSoundEvent BLOCK_BARREL_CLOSE = new CompatSoundEvent(SoundEvents.BARREL_CLOSE); + public static final CompatSoundEvent BLOCK_BARREL_OPEN = new CompatSoundEvent(SoundEvents.BARREL_OPEN); + public static final CompatSoundEvent BLOCK_BASALT_BREAK = new CompatSoundEvent(SoundEvents.BASALT_BREAK); + public static final CompatSoundEvent BLOCK_BASALT_STEP = new CompatSoundEvent(SoundEvents.BASALT_STEP); + public static final CompatSoundEvent BLOCK_BASALT_PLACE = new CompatSoundEvent(SoundEvents.BASALT_PLACE); + public static final CompatSoundEvent BLOCK_BASALT_HIT = new CompatSoundEvent(SoundEvents.BASALT_HIT); + public static final CompatSoundEvent BLOCK_BASALT_FALL = new CompatSoundEvent(SoundEvents.BASALT_FALL); + public static final CompatSoundEvent ENTITY_BAT_AMBIENT = new CompatSoundEvent(SoundEvents.BAT_AMBIENT); + public static final CompatSoundEvent ENTITY_BAT_DEATH = new CompatSoundEvent(SoundEvents.BAT_DEATH); + public static final CompatSoundEvent ENTITY_BAT_HURT = new CompatSoundEvent(SoundEvents.BAT_HURT); + public static final CompatSoundEvent ENTITY_BAT_LOOP = new CompatSoundEvent(SoundEvents.BAT_LOOP); + public static final CompatSoundEvent ENTITY_BAT_TAKEOFF = new CompatSoundEvent(SoundEvents.BAT_TAKEOFF); + public static final CompatSoundEvent BLOCK_BEACON_ACTIVATE = new CompatSoundEvent(SoundEvents.BEACON_ACTIVATE); + public static final CompatSoundEvent BLOCK_BEACON_AMBIENT = new CompatSoundEvent(SoundEvents.BEACON_AMBIENT); + public static final CompatSoundEvent BLOCK_BEACON_DEACTIVATE = new CompatSoundEvent(SoundEvents.BEACON_DEACTIVATE); + public static final CompatSoundEvent BLOCK_BEACON_POWER_SELECT = new CompatSoundEvent(SoundEvents.BEACON_POWER_SELECT); + public static final CompatSoundEvent ENTITY_BEE_DEATH = new CompatSoundEvent(SoundEvents.BEE_DEATH); + public static final CompatSoundEvent ENTITY_BEE_HURT = new CompatSoundEvent(SoundEvents.BEE_HURT); + public static final CompatSoundEvent ENTITY_BEE_LOOP_AGGRESSIVE = new CompatSoundEvent(SoundEvents.BEE_LOOP_AGGRESSIVE); + public static final CompatSoundEvent ENTITY_BEE_LOOP = new CompatSoundEvent(SoundEvents.BEE_LOOP); + public static final CompatSoundEvent ENTITY_BEE_STING = new CompatSoundEvent(SoundEvents.BEE_STING); + public static final CompatSoundEvent ENTITY_BEE_POLLINATE = new CompatSoundEvent(SoundEvents.BEE_POLLINATE); + public static final CompatSoundEvent BLOCK_BEEHIVE_DRIP = new CompatSoundEvent(SoundEvents.BEEHIVE_DRIP); + public static final CompatSoundEvent BLOCK_BEEHIVE_ENTER = new CompatSoundEvent(SoundEvents.BEEHIVE_ENTER); + public static final CompatSoundEvent BLOCK_BEEHIVE_EXIT = new CompatSoundEvent(SoundEvents.BEEHIVE_EXIT); + public static final CompatSoundEvent BLOCK_BEEHIVE_SHEAR = new CompatSoundEvent(SoundEvents.BEEHIVE_SHEAR); + public static final CompatSoundEvent BLOCK_BEEHIVE_WORK = new CompatSoundEvent(SoundEvents.BEEHIVE_WORK); + public static final CompatSoundEvent BLOCK_BELL_USE = new CompatSoundEvent(SoundEvents.BELL_BLOCK); + public static final CompatSoundEvent BLOCK_BELL_RESONATE = new CompatSoundEvent(SoundEvents.BELL_RESONATE); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.BIG_DRIPLEAF_BREAK); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.BIG_DRIPLEAF_FALL); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.BIG_DRIPLEAF_HIT); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.BIG_DRIPLEAF_PLACE); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.BIG_DRIPLEAF_STEP); + public static final CompatSoundEvent ENTITY_BLAZE_AMBIENT = new CompatSoundEvent(SoundEvents.BLAZE_AMBIENT); + public static final CompatSoundEvent ENTITY_BLAZE_BURN = new CompatSoundEvent(SoundEvents.BLAZE_BURN); + public static final CompatSoundEvent ENTITY_BLAZE_DEATH = new CompatSoundEvent(SoundEvents.BLAZE_DEATH); + public static final CompatSoundEvent ENTITY_BLAZE_HURT = new CompatSoundEvent(SoundEvents.BLAZE_HURT); + public static final CompatSoundEvent ENTITY_BLAZE_SHOOT = new CompatSoundEvent(SoundEvents.BLAZE_SHOOT); + public static final CompatSoundEvent ENTITY_BOAT_PADDLE_LAND = new CompatSoundEvent(SoundEvents.BOAT_PADDLE_LAND); + public static final CompatSoundEvent ENTITY_BOAT_PADDLE_WATER = new CompatSoundEvent(SoundEvents.BOAT_PADDLE_WATER); + public static final CompatSoundEvent ENTITY_BOGGED_AMBIENT = new CompatSoundEvent(SoundEvents.BOGGED_AMBIENT); + public static final CompatSoundEvent ENTITY_BOGGED_DEATH = new CompatSoundEvent(SoundEvents.BOGGED_DEATH); + public static final CompatSoundEvent ENTITY_BOGGED_HURT = new CompatSoundEvent(SoundEvents.BOGGED_HURT); + public static final CompatSoundEvent ENTITY_BOGGED_SHEAR = new CompatSoundEvent(SoundEvents.BOGGED_SHEAR); + public static final CompatSoundEvent ENTITY_BOGGED_STEP = new CompatSoundEvent(SoundEvents.BOGGED_STEP); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BONE_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BONE_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BONE_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BONE_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_BONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BONE_BLOCK_STEP); + public static final CompatSoundEvent ITEM_BONE_MEAL_USE = new CompatSoundEvent(SoundEvents.BONE_MEAL_USE); + public static final CompatSoundEvent ITEM_BOOK_PAGE_TURN = new CompatSoundEvent(SoundEvents.BOOK_PAGE_TURN); + public static final CompatSoundEvent ITEM_BOOK_PUT = new CompatSoundEvent(SoundEvents.BOOK_PUT); + public static final CompatSoundEvent BLOCK_BLASTFURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.BLASTFURNACE_FIRE_CRACKLE); + public static final CompatSoundEvent ITEM_BOTTLE_EMPTY = new CompatSoundEvent(SoundEvents.BOTTLE_EMPTY); + public static final CompatSoundEvent ITEM_BOTTLE_FILL = new CompatSoundEvent(SoundEvents.BOTTLE_FILL); + public static final CompatSoundEvent ITEM_BOTTLE_FILL_DRAGONBREATH = new CompatSoundEvent(SoundEvents.BOTTLE_FILL_DRAGONBREATH); + public static final CompatSoundEvent ENTITY_BREEZE_CHARGE = new CompatSoundEvent(SoundEvents.BREEZE_CHARGE); + public static final CompatSoundEvent ENTITY_BREEZE_DEFLECT = new CompatSoundEvent(SoundEvents.BREEZE_DEFLECT); + public static final CompatSoundEvent ENTITY_BREEZE_INHALE = new CompatSoundEvent(SoundEvents.BREEZE_INHALE); + public static final CompatSoundEvent ENTITY_BREEZE_IDLE_GROUND = new CompatSoundEvent(SoundEvents.BREEZE_IDLE_GROUND); + public static final CompatSoundEvent ENTITY_BREEZE_IDLE_AIR = new CompatSoundEvent(SoundEvents.BREEZE_IDLE_AIR); + public static final CompatSoundEvent ENTITY_BREEZE_SHOOT = new CompatSoundEvent(SoundEvents.BREEZE_SHOOT); + public static final CompatSoundEvent ENTITY_BREEZE_JUMP = new CompatSoundEvent(SoundEvents.BREEZE_JUMP); + public static final CompatSoundEvent ENTITY_BREEZE_LAND = new CompatSoundEvent(SoundEvents.BREEZE_LAND); + public static final CompatSoundEvent ENTITY_BREEZE_SLIDE = new CompatSoundEvent(SoundEvents.BREEZE_SLIDE); + public static final CompatSoundEvent ENTITY_BREEZE_DEATH = new CompatSoundEvent(SoundEvents.BREEZE_DEATH); + public static final CompatSoundEvent ENTITY_BREEZE_HURT = new CompatSoundEvent(SoundEvents.BREEZE_HURT); + public static final CompatSoundEvent ENTITY_BREEZE_WHIRL = new CompatSoundEvent(SoundEvents.BREEZE_WHIRL); + public static final CompatSoundEvent ENTITY_BREEZE_WIND_BURST = new CompatSoundEvent(SoundEvents.BREEZE_WIND_CHARGE_BURST); + public static final CompatSoundEvent BLOCK_BREWING_STAND_BREW = new CompatSoundEvent(SoundEvents.BREWING_STAND_BREW); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GENERIC = new CompatSoundEvent(SoundEvents.BRUSH_GENERIC); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND = new CompatSoundEvent(SoundEvents.BRUSH_SAND); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL = new CompatSoundEvent(SoundEvents.BRUSH_GRAVEL); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_SAND_COMPLETE = new CompatSoundEvent(SoundEvents.BRUSH_SAND_COMPLETED); + public static final CompatSoundEvent ITEM_BRUSH_BRUSHING_GRAVEL_COMPLETE = new CompatSoundEvent(SoundEvents.BRUSH_GRAVEL_COMPLETED); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_BUBBLE_POP = new CompatSoundEvent(SoundEvents.BUBBLE_COLUMN_BUBBLE_POP); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT = new CompatSoundEvent(SoundEvents.BUBBLE_COLUMN_UPWARDS_AMBIENT); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE = new CompatSoundEvent(SoundEvents.BUBBLE_COLUMN_UPWARDS_INSIDE); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT = new CompatSoundEvent(SoundEvents.BUBBLE_COLUMN_WHIRLPOOL_AMBIENT); + public static final CompatSoundEvent BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = new CompatSoundEvent(SoundEvents.BUBBLE_COLUMN_WHIRLPOOL_INSIDE); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY = new CompatSoundEvent(SoundEvents.BUCKET_EMPTY); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_AXOLOTL = new CompatSoundEvent(SoundEvents.BUCKET_EMPTY_AXOLOTL); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_FISH = new CompatSoundEvent(SoundEvents.BUCKET_EMPTY_FISH); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_LAVA = new CompatSoundEvent(SoundEvents.BUCKET_EMPTY_LAVA); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_POWDER_SNOW = new CompatSoundEvent(SoundEvents.BUCKET_EMPTY_POWDER_SNOW); + public static final CompatSoundEvent ITEM_BUCKET_EMPTY_TADPOLE = new CompatSoundEvent(SoundEvents.BUCKET_EMPTY_TADPOLE); + public static final CompatSoundEvent ITEM_BUCKET_FILL = new CompatSoundEvent(SoundEvents.BUCKET_FILL); + public static final CompatSoundEvent ITEM_BUCKET_FILL_AXOLOTL = new CompatSoundEvent(SoundEvents.BUCKET_FILL_AXOLOTL); + public static final CompatSoundEvent ITEM_BUCKET_FILL_FISH = new CompatSoundEvent(SoundEvents.BUCKET_FILL_FISH); + public static final CompatSoundEvent ITEM_BUCKET_FILL_LAVA = new CompatSoundEvent(SoundEvents.BUCKET_FILL_LAVA); + public static final CompatSoundEvent ITEM_BUCKET_FILL_POWDER_SNOW = new CompatSoundEvent(SoundEvents.BUCKET_FILL_POWDER_SNOW); + public static final CompatSoundEvent ITEM_BUCKET_FILL_TADPOLE = new CompatSoundEvent(SoundEvents.BUCKET_FILL_TADPOLE); + public static final CompatSoundEvent ITEM_BUNDLE_DROP_CONTENTS = new CompatSoundEvent(SoundEvents.BUNDLE_DROP_CONTENTS); + public static final CompatSoundEvent ITEM_BUNDLE_INSERT = new CompatSoundEvent(SoundEvents.BUNDLE_INSERT); + public static final CompatSoundEvent ITEM_BUNDLE_REMOVE_ONE = new CompatSoundEvent(SoundEvents.BUNDLE_REMOVE_ONE); + public static final CompatSoundEvent BLOCK_CAKE_ADD_CANDLE = new CompatSoundEvent(SoundEvents.CAKE_ADD_CANDLE); + public static final CompatSoundEvent BLOCK_CALCITE_BREAK = new CompatSoundEvent(SoundEvents.CALCITE_BREAK); + public static final CompatSoundEvent BLOCK_CALCITE_STEP = new CompatSoundEvent(SoundEvents.CALCITE_STEP); + public static final CompatSoundEvent BLOCK_CALCITE_PLACE = new CompatSoundEvent(SoundEvents.CALCITE_PLACE); + public static final CompatSoundEvent BLOCK_CALCITE_HIT = new CompatSoundEvent(SoundEvents.CALCITE_HIT); + public static final CompatSoundEvent BLOCK_CALCITE_FALL = new CompatSoundEvent(SoundEvents.CALCITE_FALL); + public static final CompatSoundEvent ENTITY_CAMEL_AMBIENT = new CompatSoundEvent(SoundEvents.CAMEL_AMBIENT); + public static final CompatSoundEvent ENTITY_CAMEL_DASH = new CompatSoundEvent(SoundEvents.CAMEL_DASH); + public static final CompatSoundEvent ENTITY_CAMEL_DASH_READY = new CompatSoundEvent(SoundEvents.CAMEL_DASH_READY); + public static final CompatSoundEvent ENTITY_CAMEL_DEATH = new CompatSoundEvent(SoundEvents.CAMEL_DEATH); + public static final CompatSoundEvent ENTITY_CAMEL_EAT = new CompatSoundEvent(SoundEvents.CAMEL_EAT); + public static final CompatSoundEvent ENTITY_CAMEL_HURT = new CompatSoundEvent(SoundEvents.CAMEL_HURT); + public static final CompatSoundEvent ENTITY_CAMEL_SADDLE = new CompatSoundEvent(SoundEvents.CAMEL_SADDLE); + public static final CompatSoundEvent ENTITY_CAMEL_SIT = new CompatSoundEvent(SoundEvents.CAMEL_SIT); + public static final CompatSoundEvent ENTITY_CAMEL_STAND = new CompatSoundEvent(SoundEvents.CAMEL_STAND); + public static final CompatSoundEvent ENTITY_CAMEL_STEP = new CompatSoundEvent(SoundEvents.CAMEL_STEP); + public static final CompatSoundEvent ENTITY_CAMEL_STEP_SAND = new CompatSoundEvent(SoundEvents.CAMEL_STEP_SAND); + public static final CompatSoundEvent BLOCK_CAMPFIRE_CRACKLE = new CompatSoundEvent(SoundEvents.CAMPFIRE_CRACKLE); + public static final CompatSoundEvent BLOCK_CANDLE_AMBIENT = new CompatSoundEvent(SoundEvents.CANDLE_AMBIENT); + public static final CompatSoundEvent BLOCK_CANDLE_BREAK = new CompatSoundEvent(SoundEvents.CANDLE_BREAK); + public static final CompatSoundEvent BLOCK_CANDLE_EXTINGUISH = new CompatSoundEvent(SoundEvents.CANDLE_EXTINGUISH); + public static final CompatSoundEvent BLOCK_CANDLE_FALL = new CompatSoundEvent(SoundEvents.CANDLE_FALL); + public static final CompatSoundEvent BLOCK_CANDLE_HIT = new CompatSoundEvent(SoundEvents.CANDLE_HIT); + public static final CompatSoundEvent BLOCK_CANDLE_PLACE = new CompatSoundEvent(SoundEvents.CANDLE_PLACE); + public static final CompatSoundEvent BLOCK_CANDLE_STEP = new CompatSoundEvent(SoundEvents.CANDLE_STEP); + public static final CompatSoundEvent ENTITY_CAT_AMBIENT = new CompatSoundEvent(SoundEvents.CAT_AMBIENT); + public static final CompatSoundEvent ENTITY_CAT_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.CAT_STRAY_AMBIENT); + public static final CompatSoundEvent ENTITY_CAT_DEATH = new CompatSoundEvent(SoundEvents.CAT_DEATH); + public static final CompatSoundEvent ENTITY_CAT_EAT = new CompatSoundEvent(SoundEvents.CAT_EAT); + public static final CompatSoundEvent ENTITY_CAT_HISS = new CompatSoundEvent(SoundEvents.CAT_HISS); + public static final CompatSoundEvent ENTITY_CAT_BEG_FOR_FOOD = new CompatSoundEvent(SoundEvents.CAT_BEG_FOR_FOOD); + public static final CompatSoundEvent ENTITY_CAT_HURT = new CompatSoundEvent(SoundEvents.CAT_HURT); + public static final CompatSoundEvent ENTITY_CAT_PURR = new CompatSoundEvent(SoundEvents.CAT_PURR); + public static final CompatSoundEvent ENTITY_CAT_PURREOW = new CompatSoundEvent(SoundEvents.CAT_PURREOW); + public static final CompatSoundEvent BLOCK_CAVE_VINES_BREAK = new CompatSoundEvent(SoundEvents.CAVE_VINES_BREAK); + public static final CompatSoundEvent BLOCK_CAVE_VINES_FALL = new CompatSoundEvent(SoundEvents.CAVE_VINES_FALL); + public static final CompatSoundEvent BLOCK_CAVE_VINES_HIT = new CompatSoundEvent(SoundEvents.CAVE_VINES_HIT); + public static final CompatSoundEvent BLOCK_CAVE_VINES_PLACE = new CompatSoundEvent(SoundEvents.CAVE_VINES_PLACE); + public static final CompatSoundEvent BLOCK_CAVE_VINES_STEP = new CompatSoundEvent(SoundEvents.CAVE_VINES_STEP); + public static final CompatSoundEvent BLOCK_CAVE_VINES_PICK_BERRIES = new CompatSoundEvent(SoundEvents.CAVE_VINES_PICK_BERRIES); + public static final CompatSoundEvent BLOCK_CHAIN_BREAK = new CompatSoundEvent(SoundEvents.CHAIN_BREAK); + public static final CompatSoundEvent BLOCK_CHAIN_FALL = new CompatSoundEvent(SoundEvents.CHAIN_FALL); + public static final CompatSoundEvent BLOCK_CHAIN_HIT = new CompatSoundEvent(SoundEvents.CHAIN_HIT); + public static final CompatSoundEvent BLOCK_CHAIN_PLACE = new CompatSoundEvent(SoundEvents.CHAIN_PLACE); + public static final CompatSoundEvent BLOCK_CHAIN_STEP = new CompatSoundEvent(SoundEvents.CHAIN_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BREAK = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FALL = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HIT = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PLACE = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_STEP = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_BREAK = new CompatSoundEvent(SoundEvents.CHERRY_SAPLING_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_FALL = new CompatSoundEvent(SoundEvents.CHERRY_SAPLING_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_HIT = new CompatSoundEvent(SoundEvents.CHERRY_SAPLING_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_PLACE = new CompatSoundEvent(SoundEvents.CHERRY_SAPLING_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_SAPLING_STEP = new CompatSoundEvent(SoundEvents.CHERRY_SAPLING_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_BREAK = new CompatSoundEvent(SoundEvents.CHERRY_LEAVES_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_FALL = new CompatSoundEvent(SoundEvents.CHERRY_LEAVES_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_HIT = new CompatSoundEvent(SoundEvents.CHERRY_LEAVES_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_PLACE = new CompatSoundEvent(SoundEvents.CHERRY_LEAVES_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_LEAVES_STEP = new CompatSoundEvent(SoundEvents.CHERRY_LEAVES_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_CHERRY_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.CHERRY_WOOD_FENCE_GATE_OPEN); + public static final CompatSoundEvent BLOCK_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.CHEST_CLOSE); + public static final CompatSoundEvent BLOCK_CHEST_LOCKED = new CompatSoundEvent(SoundEvents.CHEST_LOCKED); + public static final CompatSoundEvent BLOCK_CHEST_OPEN = new CompatSoundEvent(SoundEvents.CHEST_OPEN); + public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.CHICKEN_AMBIENT); + public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.CHICKEN_DEATH); + public static final CompatSoundEvent ENTITY_CHICKEN_EGG = new CompatSoundEvent(SoundEvents.CHICKEN_EGG); + public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.CHICKEN_HURT); + public static final CompatSoundEvent ENTITY_CHICKEN_STEP = new CompatSoundEvent(SoundEvents.CHICKEN_STEP); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_BREAK = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_BREAK); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_FALL = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_FALL); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_HIT = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_HIT); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_INSERT); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_INSERT_ENCHANTED = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_INSERT_ENCHANTED); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_STEP = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_STEP); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_PICKUP); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PICKUP_ENCHANTED = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_PICKUP_ENCHANTED); + public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_PLACE = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_PLACE); + public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_DEATH = new CompatSoundEvent(SoundEvents.CHORUS_FLOWER_DEATH); + public static final CompatSoundEvent BLOCK_CHORUS_FLOWER_GROW = new CompatSoundEvent(SoundEvents.CHORUS_FLOWER_GROW); + public static final CompatSoundEvent ITEM_CHORUS_FRUIT_TELEPORT = new CompatSoundEvent(SoundEvents.CHORUS_FRUIT_TELEPORT); + public static final CompatSoundEvent BLOCK_COBWEB_BREAK = new CompatSoundEvent(SoundEvents.COBWEB_BREAK); + public static final CompatSoundEvent BLOCK_COBWEB_STEP = new CompatSoundEvent(SoundEvents.COBWEB_STEP); + public static final CompatSoundEvent BLOCK_COBWEB_PLACE = new CompatSoundEvent(SoundEvents.COBWEB_PLACE); + public static final CompatSoundEvent BLOCK_COBWEB_HIT = new CompatSoundEvent(SoundEvents.COBWEB_HIT); + public static final CompatSoundEvent BLOCK_COBWEB_FALL = new CompatSoundEvent(SoundEvents.COBWEB_FALL); + public static final CompatSoundEvent ENTITY_COD_AMBIENT = new CompatSoundEvent(SoundEvents.COD_AMBIENT); + public static final CompatSoundEvent ENTITY_COD_DEATH = new CompatSoundEvent(SoundEvents.COD_DEATH); + public static final CompatSoundEvent ENTITY_COD_FLOP = new CompatSoundEvent(SoundEvents.COD_FLOP); + public static final CompatSoundEvent ENTITY_COD_HURT = new CompatSoundEvent(SoundEvents.COD_HURT); + public static final CompatSoundEvent BLOCK_COMPARATOR_CLICK = new CompatSoundEvent(SoundEvents.COMPARATOR_CLICK); + public static final CompatSoundEvent BLOCK_COMPOSTER_EMPTY = new CompatSoundEvent(SoundEvents.COMPOSTER_EMPTY); + public static final CompatSoundEvent BLOCK_COMPOSTER_FILL = new CompatSoundEvent(SoundEvents.COMPOSTER_FILL); + public static final CompatSoundEvent BLOCK_COMPOSTER_FILL_SUCCESS = new CompatSoundEvent(SoundEvents.COMPOSTER_FILL_SUCCESS); + public static final CompatSoundEvent BLOCK_COMPOSTER_READY = new CompatSoundEvent(SoundEvents.COMPOSTER_READY); + public static final CompatSoundEvent BLOCK_CONDUIT_ACTIVATE = new CompatSoundEvent(SoundEvents.CONDUIT_ACTIVATE); + public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT = new CompatSoundEvent(SoundEvents.CONDUIT_AMBIENT); + public static final CompatSoundEvent BLOCK_CONDUIT_AMBIENT_SHORT = new CompatSoundEvent(SoundEvents.CONDUIT_AMBIENT_SHORT); + public static final CompatSoundEvent BLOCK_CONDUIT_ATTACK_TARGET = new CompatSoundEvent(SoundEvents.CONDUIT_ATTACK_TARGET); + public static final CompatSoundEvent BLOCK_CONDUIT_DEACTIVATE = new CompatSoundEvent(SoundEvents.CONDUIT_DEACTIVATE); + public static final CompatSoundEvent BLOCK_COPPER_BULB_BREAK = new CompatSoundEvent(SoundEvents.COPPER_BULB_BREAK); + public static final CompatSoundEvent BLOCK_COPPER_BULB_STEP = new CompatSoundEvent(SoundEvents.COPPER_BULB_STEP); + public static final CompatSoundEvent BLOCK_COPPER_BULB_PLACE = new CompatSoundEvent(SoundEvents.COPPER_BULB_PLACE); + public static final CompatSoundEvent BLOCK_COPPER_BULB_HIT = new CompatSoundEvent(SoundEvents.COPPER_BULB_HIT); + public static final CompatSoundEvent BLOCK_COPPER_BULB_FALL = new CompatSoundEvent(SoundEvents.COPPER_BULB_FALL); + public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_ON = new CompatSoundEvent(SoundEvents.COPPER_BULB_TURN_ON); + public static final CompatSoundEvent BLOCK_COPPER_BULB_TURN_OFF = new CompatSoundEvent(SoundEvents.COPPER_BULB_TURN_OFF); + public static final CompatSoundEvent BLOCK_COPPER_BREAK = new CompatSoundEvent(SoundEvents.COPPER_BREAK); + public static final CompatSoundEvent BLOCK_COPPER_STEP = new CompatSoundEvent(SoundEvents.COPPER_STEP); + public static final CompatSoundEvent BLOCK_COPPER_PLACE = new CompatSoundEvent(SoundEvents.COPPER_PLACE); + public static final CompatSoundEvent BLOCK_COPPER_HIT = new CompatSoundEvent(SoundEvents.COPPER_HIT); + public static final CompatSoundEvent BLOCK_COPPER_FALL = new CompatSoundEvent(SoundEvents.COPPER_FALL); + public static final CompatSoundEvent BLOCK_COPPER_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.COPPER_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_COPPER_DOOR_OPEN = new CompatSoundEvent(SoundEvents.COPPER_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_BREAK = new CompatSoundEvent(SoundEvents.COPPER_GRATE_BREAK); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_STEP = new CompatSoundEvent(SoundEvents.COPPER_GRATE_STEP); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_PLACE = new CompatSoundEvent(SoundEvents.COPPER_GRATE_PLACE); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_HIT = new CompatSoundEvent(SoundEvents.COPPER_GRATE_HIT); + public static final CompatSoundEvent BLOCK_COPPER_GRATE_FALL = new CompatSoundEvent(SoundEvents.COPPER_GRATE_FALL); + public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.COPPER_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_COPPER_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.COPPER_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_FALL = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_HIT = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_CORAL_BLOCK_STEP = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_STEP); + public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.COW_AMBIENT); + public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.COW_DEATH); + public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.COW_HURT); + public static final CompatSoundEvent ENTITY_COW_MILK = new CompatSoundEvent(SoundEvents.COW_MILK); + public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.COW_STEP); + public static final CompatSoundEvent BLOCK_CRAFTER_CRAFT = new CompatSoundEvent(SoundEvents.CRAFTER_CRAFT); + public static final CompatSoundEvent BLOCK_CRAFTER_FAIL = new CompatSoundEvent(SoundEvents.CRAFTER_FAIL); + public static final CompatSoundEvent ENTITY_CREEPER_DEATH = new CompatSoundEvent(SoundEvents.CREEPER_DEATH); + public static final CompatSoundEvent ENTITY_CREEPER_HURT = new CompatSoundEvent(SoundEvents.CREEPER_HURT); + public static final CompatSoundEvent ENTITY_CREEPER_PRIMED = new CompatSoundEvent(SoundEvents.CREEPER_PRIMED); + public static final CompatSoundEvent BLOCK_CROP_BREAK = new CompatSoundEvent(SoundEvents.CROP_BREAK); + public static final CompatSoundEvent ITEM_CROP_PLANT = new CompatSoundEvent(SoundEvents.CROP_PLANTED); + public static final CompatSoundEvent ITEM_CROSSBOW_HIT = new CompatSoundEvent(SoundEvents.CROSSBOW_HIT); + public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_END = new CompatSoundEvent(SoundEvents.CROSSBOW_LOADING_END); + public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_MIDDLE = new CompatSoundEvent(SoundEvents.CROSSBOW_LOADING_MIDDLE); + public static final CompatSoundEvent ITEM_CROSSBOW_LOADING_START = new CompatSoundEvent(SoundEvents.CROSSBOW_LOADING_START); + public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_1 = new CompatSoundEvent(SoundEvents.CROSSBOW_QUICK_CHARGE_1); + public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_2 = new CompatSoundEvent(SoundEvents.CROSSBOW_QUICK_CHARGE_2); + public static final CompatSoundEvent ITEM_CROSSBOW_QUICK_CHARGE_3 = new CompatSoundEvent(SoundEvents.CROSSBOW_QUICK_CHARGE_3); + public static final CompatSoundEvent ITEM_CROSSBOW_SHOOT = new CompatSoundEvent(SoundEvents.CROSSBOW_SHOOT); + public static final CompatSoundEvent BLOCK_DECORATED_POT_BREAK = new CompatSoundEvent(SoundEvents.DECORATED_POT_BREAK); + public static final CompatSoundEvent BLOCK_DECORATED_POT_FALL = new CompatSoundEvent(SoundEvents.DECORATED_POT_FALL); + public static final CompatSoundEvent BLOCK_DECORATED_POT_HIT = new CompatSoundEvent(SoundEvents.DECORATED_POT_HIT); + public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT = new CompatSoundEvent(SoundEvents.DECORATED_POT_INSERT); + public static final CompatSoundEvent BLOCK_DECORATED_POT_INSERT_FAIL = new CompatSoundEvent(SoundEvents.DECORATED_POT_INSERT_FAIL); + public static final CompatSoundEvent BLOCK_DECORATED_POT_STEP = new CompatSoundEvent(SoundEvents.DECORATED_POT_STEP); + public static final CompatSoundEvent BLOCK_DECORATED_POT_PLACE = new CompatSoundEvent(SoundEvents.DECORATED_POT_PLACE); + public static final CompatSoundEvent BLOCK_DECORATED_POT_SHATTER = new CompatSoundEvent(SoundEvents.DECORATED_POT_SHATTER); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.DEEPSLATE_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_FALL = new CompatSoundEvent(SoundEvents.DEEPSLATE_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_HIT = new CompatSoundEvent(SoundEvents.DEEPSLATE_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.DEEPSLATE_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BRICKS_STEP = new CompatSoundEvent(SoundEvents.DEEPSLATE_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.DEEPSLATE_BREAK); + public static final CompatSoundEvent BLOCK_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.DEEPSLATE_FALL); + public static final CompatSoundEvent BLOCK_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.DEEPSLATE_HIT); + public static final CompatSoundEvent BLOCK_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.DEEPSLATE_PLACE); + public static final CompatSoundEvent BLOCK_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.DEEPSLATE_STEP); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_BREAK = new CompatSoundEvent(SoundEvents.DEEPSLATE_TILES_BREAK); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_FALL = new CompatSoundEvent(SoundEvents.DEEPSLATE_TILES_FALL); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_HIT = new CompatSoundEvent(SoundEvents.DEEPSLATE_TILES_HIT); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_PLACE = new CompatSoundEvent(SoundEvents.DEEPSLATE_TILES_PLACE); + public static final CompatSoundEvent BLOCK_DEEPSLATE_TILES_STEP = new CompatSoundEvent(SoundEvents.DEEPSLATE_TILES_STEP); + public static final CompatSoundEvent BLOCK_DISPENSER_DISPENSE = new CompatSoundEvent(SoundEvents.DISPENSER_DISPENSE); + public static final CompatSoundEvent BLOCK_DISPENSER_FAIL = new CompatSoundEvent(SoundEvents.DISPENSER_FAIL); + public static final CompatSoundEvent BLOCK_DISPENSER_LAUNCH = new CompatSoundEvent(SoundEvents.DISPENSER_LAUNCH); + public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT = new CompatSoundEvent(SoundEvents.DOLPHIN_AMBIENT); + public static final CompatSoundEvent ENTITY_DOLPHIN_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.DOLPHIN_AMBIENT_WATER); + public static final CompatSoundEvent ENTITY_DOLPHIN_ATTACK = new CompatSoundEvent(SoundEvents.DOLPHIN_ATTACK); + public static final CompatSoundEvent ENTITY_DOLPHIN_DEATH = new CompatSoundEvent(SoundEvents.DOLPHIN_DEATH); + public static final CompatSoundEvent ENTITY_DOLPHIN_EAT = new CompatSoundEvent(SoundEvents.DOLPHIN_EAT); + public static final CompatSoundEvent ENTITY_DOLPHIN_HURT = new CompatSoundEvent(SoundEvents.DOLPHIN_HURT); + public static final CompatSoundEvent ENTITY_DOLPHIN_JUMP = new CompatSoundEvent(SoundEvents.DOLPHIN_JUMP); + public static final CompatSoundEvent ENTITY_DOLPHIN_PLAY = new CompatSoundEvent(SoundEvents.DOLPHIN_PLAY); + public static final CompatSoundEvent ENTITY_DOLPHIN_SPLASH = new CompatSoundEvent(SoundEvents.DOLPHIN_SPLASH); + public static final CompatSoundEvent ENTITY_DOLPHIN_SWIM = new CompatSoundEvent(SoundEvents.DOLPHIN_SWIM); + public static final CompatSoundEvent ENTITY_DONKEY_AMBIENT = new CompatSoundEvent(SoundEvents.DONKEY_AMBIENT); + public static final CompatSoundEvent ENTITY_DONKEY_ANGRY = new CompatSoundEvent(SoundEvents.DONKEY_ANGRY); + public static final CompatSoundEvent ENTITY_DONKEY_CHEST = new CompatSoundEvent(SoundEvents.DONKEY_CHEST); + public static final CompatSoundEvent ENTITY_DONKEY_DEATH = new CompatSoundEvent(SoundEvents.DONKEY_DEATH); + public static final CompatSoundEvent ENTITY_DONKEY_EAT = new CompatSoundEvent(SoundEvents.DONKEY_EAT); + public static final CompatSoundEvent ENTITY_DONKEY_HURT = new CompatSoundEvent(SoundEvents.DONKEY_HURT); + public static final CompatSoundEvent ENTITY_DONKEY_JUMP = new CompatSoundEvent(SoundEvents.DONKEY_JUMP); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.DRIPSTONE_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.DRIPSTONE_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.DRIPSTONE_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.DRIPSTONE_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_DRIPSTONE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.DRIPSTONE_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_BREAK = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_BREAK); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_STEP = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_STEP); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_PLACE = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_PLACE); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_HIT = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_HIT); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_FALL = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_FALL); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_LAND = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_LAND); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_DRIP_LAVA); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_DRIP_WATER); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_DRIP_LAVA_INTO_CAULDRON); + public static final CompatSoundEvent BLOCK_POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON = new CompatSoundEvent(SoundEvents.POINTED_DRIPSTONE_DRIP_WATER_INTO_CAULDRON); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_DOWN = new CompatSoundEvent(SoundEvents.BIG_DRIPLEAF_TILT_DOWN); + public static final CompatSoundEvent BLOCK_BIG_DRIPLEAF_TILT_UP = new CompatSoundEvent(SoundEvents.BIG_DRIPLEAF_TILT_UP); + public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT = new CompatSoundEvent(SoundEvents.DROWNED_AMBIENT); + public static final CompatSoundEvent ENTITY_DROWNED_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.DROWNED_AMBIENT_WATER); + public static final CompatSoundEvent ENTITY_DROWNED_DEATH = new CompatSoundEvent(SoundEvents.DROWNED_DEATH); + public static final CompatSoundEvent ENTITY_DROWNED_DEATH_WATER = new CompatSoundEvent(SoundEvents.DROWNED_DEATH_WATER); + public static final CompatSoundEvent ENTITY_DROWNED_HURT = new CompatSoundEvent(SoundEvents.DROWNED_HURT); + public static final CompatSoundEvent ENTITY_DROWNED_HURT_WATER = new CompatSoundEvent(SoundEvents.DROWNED_HURT_WATER); + public static final CompatSoundEvent ENTITY_DROWNED_SHOOT = new CompatSoundEvent(SoundEvents.DROWNED_SHOOT); + public static final CompatSoundEvent ENTITY_DROWNED_STEP = new CompatSoundEvent(SoundEvents.DROWNED_STEP); + public static final CompatSoundEvent ENTITY_DROWNED_SWIM = new CompatSoundEvent(SoundEvents.DROWNED_SWIM); + public static final CompatSoundEvent ITEM_DYE_USE = new CompatSoundEvent(SoundEvents.DYE_USE); + public static final CompatSoundEvent ENTITY_EGG_THROW = new CompatSoundEvent(SoundEvents.EGG_THROW); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_AMBIENT); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_AMBIENT_LAND); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_CURSE = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_CURSE); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_DEATH); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_DEATH_LAND); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_FLOP); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_HURT); + public static final CompatSoundEvent ENTITY_ELDER_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.ELDER_GUARDIAN_HURT_LAND); + public static final CompatSoundEvent ITEM_ELYTRA_FLYING = new CompatSoundEvent(SoundEvents.ELYTRA_FLYING); + public static final CompatSoundEvent BLOCK_ENCHANTMENT_TABLE_USE = new CompatSoundEvent(SoundEvents.ENCHANTMENT_TABLE_USE); + public static final CompatSoundEvent BLOCK_ENDER_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.ENDER_CHEST_CLOSE); + public static final CompatSoundEvent BLOCK_ENDER_CHEST_OPEN = new CompatSoundEvent(SoundEvents.ENDER_CHEST_OPEN); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_AMBIENT = new CompatSoundEvent(SoundEvents.ENDER_DRAGON_AMBIENT); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_DEATH = new CompatSoundEvent(SoundEvents.ENDER_DRAGON_DEATH); + public static final CompatSoundEvent ENTITY_DRAGON_FIREBALL_EXPLODE = new CompatSoundEvent(SoundEvents.DRAGON_FIREBALL_EXPLODE); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_FLAP = new CompatSoundEvent(SoundEvents.ENDER_DRAGON_FLAP); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_GROWL = new CompatSoundEvent(SoundEvents.ENDER_DRAGON_GROWL); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_HURT = new CompatSoundEvent(SoundEvents.ENDER_DRAGON_HURT); + public static final CompatSoundEvent ENTITY_ENDER_DRAGON_SHOOT = new CompatSoundEvent(SoundEvents.ENDER_DRAGON_SHOOT); + public static final CompatSoundEvent ENTITY_ENDER_EYE_DEATH = new CompatSoundEvent(SoundEvents.ENDER_EYE_DEATH); + public static final CompatSoundEvent ENTITY_ENDER_EYE_LAUNCH = new CompatSoundEvent(SoundEvents.ENDER_EYE_LAUNCH); + public static final CompatSoundEvent ENTITY_ENDERMAN_AMBIENT = new CompatSoundEvent(SoundEvents.ENDERMAN_AMBIENT); + public static final CompatSoundEvent ENTITY_ENDERMAN_DEATH = new CompatSoundEvent(SoundEvents.ENDERMAN_DEATH); + public static final CompatSoundEvent ENTITY_ENDERMAN_HURT = new CompatSoundEvent(SoundEvents.ENDERMAN_HURT); + public static final CompatSoundEvent ENTITY_ENDERMAN_SCREAM = new CompatSoundEvent(SoundEvents.ENDERMAN_SCREAM); + public static final CompatSoundEvent ENTITY_ENDERMAN_STARE = new CompatSoundEvent(SoundEvents.ENDERMAN_STARE); + public static final CompatSoundEvent ENTITY_ENDERMAN_TELEPORT = new CompatSoundEvent(SoundEvents.ENDERMAN_TELEPORT); + public static final CompatSoundEvent ENTITY_ENDERMITE_AMBIENT = new CompatSoundEvent(SoundEvents.ENDERMITE_AMBIENT); + public static final CompatSoundEvent ENTITY_ENDERMITE_DEATH = new CompatSoundEvent(SoundEvents.ENDERMITE_DEATH); + public static final CompatSoundEvent ENTITY_ENDERMITE_HURT = new CompatSoundEvent(SoundEvents.ENDERMITE_HURT); + public static final CompatSoundEvent ENTITY_ENDERMITE_STEP = new CompatSoundEvent(SoundEvents.ENDERMITE_STEP); + public static final CompatSoundEvent ENTITY_ENDER_PEARL_THROW = new CompatSoundEvent(SoundEvents.ENDER_PEARL_THROW); + public static final CompatSoundEvent BLOCK_END_GATEWAY_SPAWN = new CompatSoundEvent(SoundEvents.END_GATEWAY_SPAWN); + public static final CompatSoundEvent BLOCK_END_PORTAL_FRAME_FILL = new CompatSoundEvent(SoundEvents.END_PORTAL_FRAME_FILL); + public static final CompatSoundEvent BLOCK_END_PORTAL_SPAWN = new CompatSoundEvent(SoundEvents.END_PORTAL_SPAWN); + public static final CompatSoundEvent ENTITY_EVOKER_AMBIENT = new CompatSoundEvent(SoundEvents.EVOKER_AMBIENT); + public static final CompatSoundEvent ENTITY_EVOKER_CAST_SPELL = new CompatSoundEvent(SoundEvents.EVOKER_CAST_SPELL); + public static final CompatSoundEvent ENTITY_EVOKER_CELEBRATE = new CompatSoundEvent(SoundEvents.EVOKER_CELEBRATE); + public static final CompatSoundEvent ENTITY_EVOKER_DEATH = new CompatSoundEvent(SoundEvents.EVOKER_DEATH); + public static final CompatSoundEvent ENTITY_EVOKER_FANGS_ATTACK = new CompatSoundEvent(SoundEvents.EVOKER_FANGS_ATTACK); + public static final CompatSoundEvent ENTITY_EVOKER_HURT = new CompatSoundEvent(SoundEvents.EVOKER_HURT); + public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_ATTACK = new CompatSoundEvent(SoundEvents.EVOKER_PREPARE_ATTACK); + public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_SUMMON = new CompatSoundEvent(SoundEvents.EVOKER_PREPARE_SUMMON); + public static final CompatSoundEvent ENTITY_EVOKER_PREPARE_WOLOLO = new CompatSoundEvent(SoundEvents.EVOKER_PREPARE_WOLOLO); + public static final CompatSoundEvent ENTITY_EXPERIENCE_BOTTLE_THROW = new CompatSoundEvent(SoundEvents.EXPERIENCE_BOTTLE_THROW); + public static final CompatSoundEvent ENTITY_EXPERIENCE_ORB_PICKUP = new CompatSoundEvent(SoundEvents.EXPERIENCE_ORB_PICKUP); + public static final CompatSoundEvent BLOCK_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.FENCE_GATE_OPEN); + public static final CompatSoundEvent ITEM_FIRECHARGE_USE = new CompatSoundEvent(SoundEvents.FIRECHARGE_USE); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_BLAST); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_BLAST_FAR = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_BLAST_FAR); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_LARGE_BLAST); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_LARGE_BLAST_FAR); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_LAUNCH = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_LAUNCH); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_SHOOT = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_SHOOT); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_TWINKLE); + public static final CompatSoundEvent ENTITY_FIREWORK_ROCKET_TWINKLE_FAR = new CompatSoundEvent(SoundEvents.FIREWORK_ROCKET_TWINKLE_FAR); + public static final CompatSoundEvent BLOCK_FIRE_AMBIENT = new CompatSoundEvent(SoundEvents.FIRE_AMBIENT); + public static final CompatSoundEvent BLOCK_FIRE_EXTINGUISH = new CompatSoundEvent(SoundEvents.FIRE_EXTINGUISH); + public static final CompatSoundEvent ENTITY_FISH_SWIM = new CompatSoundEvent(SoundEvents.FISH_SWIM); + public static final CompatSoundEvent ENTITY_FISHING_BOBBER_RETRIEVE = new CompatSoundEvent(SoundEvents.FISHING_BOBBER_RETRIEVE); + public static final CompatSoundEvent ENTITY_FISHING_BOBBER_SPLASH = new CompatSoundEvent(SoundEvents.FISHING_BOBBER_SPLASH); + public static final CompatSoundEvent ENTITY_FISHING_BOBBER_THROW = new CompatSoundEvent(SoundEvents.FISHING_BOBBER_THROW); + public static final CompatSoundEvent ITEM_FLINTANDSTEEL_USE = new CompatSoundEvent(SoundEvents.FLINTANDSTEEL_USE); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_BREAK = new CompatSoundEvent(SoundEvents.FLOWERING_AZALEA_BREAK); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_FALL = new CompatSoundEvent(SoundEvents.FLOWERING_AZALEA_FALL); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_HIT = new CompatSoundEvent(SoundEvents.FLOWERING_AZALEA_HIT); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_PLACE = new CompatSoundEvent(SoundEvents.FLOWERING_AZALEA_PLACE); + public static final CompatSoundEvent BLOCK_FLOWERING_AZALEA_STEP = new CompatSoundEvent(SoundEvents.FLOWERING_AZALEA_STEP); + public static final CompatSoundEvent ENTITY_FOX_AGGRO = new CompatSoundEvent(SoundEvents.FOX_AGGRO); + public static final CompatSoundEvent ENTITY_FOX_AMBIENT = new CompatSoundEvent(SoundEvents.FOX_AMBIENT); + public static final CompatSoundEvent ENTITY_FOX_BITE = new CompatSoundEvent(SoundEvents.FOX_BITE); + public static final CompatSoundEvent ENTITY_FOX_DEATH = new CompatSoundEvent(SoundEvents.FOX_DEATH); + public static final CompatSoundEvent ENTITY_FOX_EAT = new CompatSoundEvent(SoundEvents.FOX_EAT); + public static final CompatSoundEvent ENTITY_FOX_HURT = new CompatSoundEvent(SoundEvents.FOX_HURT); + public static final CompatSoundEvent ENTITY_FOX_SCREECH = new CompatSoundEvent(SoundEvents.FOX_SCREECH); + public static final CompatSoundEvent ENTITY_FOX_SLEEP = new CompatSoundEvent(SoundEvents.FOX_SLEEP); + public static final CompatSoundEvent ENTITY_FOX_SNIFF = new CompatSoundEvent(SoundEvents.FOX_SNIFF); + public static final CompatSoundEvent ENTITY_FOX_SPIT = new CompatSoundEvent(SoundEvents.FOX_SPIT); + public static final CompatSoundEvent ENTITY_FOX_TELEPORT = new CompatSoundEvent(SoundEvents.FOX_TELEPORT); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_BREAK = new CompatSoundEvent(SoundEvents.SUSPICIOUS_SAND_BREAK); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_STEP = new CompatSoundEvent(SoundEvents.SUSPICIOUS_SAND_STEP); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_PLACE = new CompatSoundEvent(SoundEvents.SUSPICIOUS_SAND_PLACE); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_HIT = new CompatSoundEvent(SoundEvents.SUSPICIOUS_SAND_HIT); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_SAND_FALL = new CompatSoundEvent(SoundEvents.SUSPICIOUS_SAND_FALL); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.SUSPICIOUS_GRAVEL_BREAK); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.SUSPICIOUS_GRAVEL_STEP); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.SUSPICIOUS_GRAVEL_PLACE); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.SUSPICIOUS_GRAVEL_HIT); + public static final CompatSoundEvent BLOCK_SUSPICIOUS_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.SUSPICIOUS_GRAVEL_FALL); + public static final CompatSoundEvent BLOCK_FROGLIGHT_BREAK = new CompatSoundEvent(SoundEvents.FROGLIGHT_BREAK); + public static final CompatSoundEvent BLOCK_FROGLIGHT_FALL = new CompatSoundEvent(SoundEvents.FROGLIGHT_FALL); + public static final CompatSoundEvent BLOCK_FROGLIGHT_HIT = new CompatSoundEvent(SoundEvents.FROGLIGHT_HIT); + public static final CompatSoundEvent BLOCK_FROGLIGHT_PLACE = new CompatSoundEvent(SoundEvents.FROGLIGHT_PLACE); + public static final CompatSoundEvent BLOCK_FROGLIGHT_STEP = new CompatSoundEvent(SoundEvents.FROGLIGHT_STEP); + public static final CompatSoundEvent BLOCK_FROGSPAWN_STEP = new CompatSoundEvent(SoundEvents.FROGSPAWNSTEP); + public static final CompatSoundEvent BLOCK_FROGSPAWN_BREAK = new CompatSoundEvent(SoundEvents.FROGSPAWN_BREAK); + public static final CompatSoundEvent BLOCK_FROGSPAWN_FALL = new CompatSoundEvent(SoundEvents.FROGSPAWN_FALL); + public static final CompatSoundEvent BLOCK_FROGSPAWN_HATCH = new CompatSoundEvent(SoundEvents.FROGSPAWN_HATCH); + public static final CompatSoundEvent BLOCK_FROGSPAWN_HIT = new CompatSoundEvent(SoundEvents.FROGSPAWN_HIT); + public static final CompatSoundEvent BLOCK_FROGSPAWN_PLACE = new CompatSoundEvent(SoundEvents.FROGSPAWN_PLACE); + public static final CompatSoundEvent ENTITY_FROG_AMBIENT = new CompatSoundEvent(SoundEvents.FROG_AMBIENT); + public static final CompatSoundEvent ENTITY_FROG_DEATH = new CompatSoundEvent(SoundEvents.FROG_DEATH); + public static final CompatSoundEvent ENTITY_FROG_EAT = new CompatSoundEvent(SoundEvents.FROG_EAT); + public static final CompatSoundEvent ENTITY_FROG_HURT = new CompatSoundEvent(SoundEvents.FROG_HURT); + public static final CompatSoundEvent ENTITY_FROG_LAY_SPAWN = new CompatSoundEvent(SoundEvents.FROG_LAY_SPAWN); + public static final CompatSoundEvent ENTITY_FROG_LONG_JUMP = new CompatSoundEvent(SoundEvents.FROG_LONG_JUMP); + public static final CompatSoundEvent ENTITY_FROG_STEP = new CompatSoundEvent(SoundEvents.FROG_STEP); + public static final CompatSoundEvent ENTITY_FROG_TONGUE = new CompatSoundEvent(SoundEvents.FROG_TONGUE); + public static final CompatSoundEvent BLOCK_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_ROOTS_STEP = new CompatSoundEvent(SoundEvents.ROOTS_STEP); + public static final CompatSoundEvent BLOCK_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_ROOTS_HIT = new CompatSoundEvent(SoundEvents.ROOTS_HIT); + public static final CompatSoundEvent BLOCK_ROOTS_FALL = new CompatSoundEvent(SoundEvents.ROOTS_FALL); + public static final CompatSoundEvent BLOCK_FURNACE_FIRE_CRACKLE = new CompatSoundEvent(SoundEvents.FURNACE_FIRE_CRACKLE); + public static final CompatSoundEvent ENTITY_GENERIC_BIG_FALL = new CompatSoundEvent(SoundEvents.GENERIC_BIG_FALL); + public static final CompatSoundEvent ENTITY_GENERIC_BURN = new CompatSoundEvent(SoundEvents.GENERIC_BURN); + public static final CompatSoundEvent ENTITY_GENERIC_DEATH = new CompatSoundEvent(SoundEvents.GENERIC_DEATH); + public static final CompatSoundEvent ENTITY_GENERIC_DRINK = new CompatSoundEvent(SoundEvents.GENERIC_DRINK); + public static final CompatSoundEvent ENTITY_GENERIC_EAT = new CompatSoundEvent(SoundEvents.GENERIC_EAT); + public static final CompatSoundEvent ENTITY_GENERIC_EXPLODE = new CompatSoundEvent(SoundEvents.GENERIC_EXPLODE); + public static final CompatSoundEvent ENTITY_GENERIC_EXTINGUISH_FIRE = new CompatSoundEvent(SoundEvents.GENERIC_EXTINGUISH_FIRE); + public static final CompatSoundEvent ENTITY_GENERIC_HURT = new CompatSoundEvent(SoundEvents.GENERIC_HURT); + public static final CompatSoundEvent ENTITY_GENERIC_SMALL_FALL = new CompatSoundEvent(SoundEvents.GENERIC_SMALL_FALL); + public static final CompatSoundEvent ENTITY_GENERIC_SPLASH = new CompatSoundEvent(SoundEvents.GENERIC_SPLASH); + public static final CompatSoundEvent ENTITY_GENERIC_SWIM = new CompatSoundEvent(SoundEvents.GENERIC_SWIM); + public static final CompatSoundEvent ENTITY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.GHAST_AMBIENT); + public static final CompatSoundEvent ENTITY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.GHAST_DEATH); + public static final CompatSoundEvent ENTITY_GHAST_HURT = new CompatSoundEvent(SoundEvents.GHAST_HURT); + public static final CompatSoundEvent ENTITY_GHAST_SCREAM = new CompatSoundEvent(SoundEvents.GHAST_SCREAM); + public static final CompatSoundEvent ENTITY_GHAST_SHOOT = new CompatSoundEvent(SoundEvents.GHAST_SHOOT); + public static final CompatSoundEvent ENTITY_GHAST_WARN = new CompatSoundEvent(SoundEvents.GHAST_WARN); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_BREAK = new CompatSoundEvent(SoundEvents.GILDED_BLACKSTONE_BREAK); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_FALL = new CompatSoundEvent(SoundEvents.GILDED_BLACKSTONE_FALL); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_HIT = new CompatSoundEvent(SoundEvents.GILDED_BLACKSTONE_HIT); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_PLACE = new CompatSoundEvent(SoundEvents.GILDED_BLACKSTONE_PLACE); + public static final CompatSoundEvent BLOCK_GILDED_BLACKSTONE_STEP = new CompatSoundEvent(SoundEvents.GILDED_BLACKSTONE_STEP); + public static final CompatSoundEvent BLOCK_GLASS_BREAK = new CompatSoundEvent(SoundEvents.GLASS_BREAK); + public static final CompatSoundEvent BLOCK_GLASS_FALL = new CompatSoundEvent(SoundEvents.GLASS_FALL); + public static final CompatSoundEvent BLOCK_GLASS_HIT = new CompatSoundEvent(SoundEvents.GLASS_HIT); + public static final CompatSoundEvent BLOCK_GLASS_PLACE = new CompatSoundEvent(SoundEvents.GLASS_PLACE); + public static final CompatSoundEvent BLOCK_GLASS_STEP = new CompatSoundEvent(SoundEvents.GLASS_STEP); + public static final CompatSoundEvent ITEM_GLOW_INK_SAC_USE = new CompatSoundEvent(SoundEvents.GLOW_INK_SAC_USE); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.GLOW_ITEM_FRAME_ADD_ITEM); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.GLOW_ITEM_FRAME_BREAK); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.GLOW_ITEM_FRAME_PLACE); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.GLOW_ITEM_FRAME_REMOVE_ITEM); + public static final CompatSoundEvent ENTITY_GLOW_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.GLOW_ITEM_FRAME_ROTATE_ITEM); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.GLOW_SQUID_AMBIENT); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_DEATH = new CompatSoundEvent(SoundEvents.GLOW_SQUID_DEATH); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_HURT = new CompatSoundEvent(SoundEvents.GLOW_SQUID_HURT); + public static final CompatSoundEvent ENTITY_GLOW_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.GLOW_SQUID_SQUIRT); + public static final CompatSoundEvent ENTITY_GOAT_AMBIENT = new CompatSoundEvent(SoundEvents.GOAT_AMBIENT); + public static final CompatSoundEvent ENTITY_GOAT_DEATH = new CompatSoundEvent(SoundEvents.GOAT_DEATH); + public static final CompatSoundEvent ENTITY_GOAT_EAT = new CompatSoundEvent(SoundEvents.GOAT_EAT); + public static final CompatSoundEvent ENTITY_GOAT_HURT = new CompatSoundEvent(SoundEvents.GOAT_HURT); + public static final CompatSoundEvent ENTITY_GOAT_LONG_JUMP = new CompatSoundEvent(SoundEvents.GOAT_LONG_JUMP); + public static final CompatSoundEvent ENTITY_GOAT_MILK = new CompatSoundEvent(SoundEvents.GOAT_MILK); + public static final CompatSoundEvent ENTITY_GOAT_PREPARE_RAM = new CompatSoundEvent(SoundEvents.GOAT_PREPARE_RAM); + public static final CompatSoundEvent ENTITY_GOAT_RAM_IMPACT = new CompatSoundEvent(SoundEvents.GOAT_RAM_IMPACT); + public static final CompatSoundEvent ENTITY_GOAT_HORN_BREAK = new CompatSoundEvent(SoundEvents.GOAT_HORN_BREAK); + public static final CompatSoundEvent ITEM_GOAT_HORN_PLAY = new CompatSoundEvent(SoundEvents.GOAT_STEP); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_AMBIENT = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_AMBIENT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_DEATH = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_DEATH); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_EAT = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_EAT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HURT = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_HURT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_LONG_JUMP = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_LONG_JUMP); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_MILK = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_MILK); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_PREPARE_RAM = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_PREPARE_RAM); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_RAM_IMPACT = new CompatSoundEvent(SoundEvents.GOAT_SCREAMING_RAM_IMPACT); + public static final CompatSoundEvent ENTITY_GOAT_SCREAMING_HORN_BREAK = new CompatSoundEvent(SoundEvents.GOAT_HORN_BREAK); + public static final CompatSoundEvent ENTITY_GOAT_STEP = new CompatSoundEvent(SoundEvents.GOAT_STEP); + public static final CompatSoundEvent BLOCK_GRASS_BREAK = new CompatSoundEvent(SoundEvents.GRASS_BREAK); + public static final CompatSoundEvent BLOCK_GRASS_FALL = new CompatSoundEvent(SoundEvents.GRASS_FALL); + public static final CompatSoundEvent BLOCK_GRASS_HIT = new CompatSoundEvent(SoundEvents.GRASS_HIT); + public static final CompatSoundEvent BLOCK_GRASS_PLACE = new CompatSoundEvent(SoundEvents.GRASS_PLACE); + public static final CompatSoundEvent BLOCK_GRASS_STEP = new CompatSoundEvent(SoundEvents.GRASS_STEP); + public static final CompatSoundEvent BLOCK_GRAVEL_BREAK = new CompatSoundEvent(SoundEvents.GRAVEL_BREAK); + public static final CompatSoundEvent BLOCK_GRAVEL_FALL = new CompatSoundEvent(SoundEvents.GRAVEL_FALL); + public static final CompatSoundEvent BLOCK_GRAVEL_HIT = new CompatSoundEvent(SoundEvents.GRAVEL_HIT); + public static final CompatSoundEvent BLOCK_GRAVEL_PLACE = new CompatSoundEvent(SoundEvents.GRAVEL_PLACE); + public static final CompatSoundEvent BLOCK_GRAVEL_STEP = new CompatSoundEvent(SoundEvents.GRAVEL_STEP); + public static final CompatSoundEvent BLOCK_GRINDSTONE_USE = new CompatSoundEvent(SoundEvents.GRINDSTONE_USE); + public static final CompatSoundEvent BLOCK_GROWING_PLANT_CROP = new CompatSoundEvent(SoundEvents.GROWING_PLANT_CROP); + public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT = new CompatSoundEvent(SoundEvents.GUARDIAN_AMBIENT); + public static final CompatSoundEvent ENTITY_GUARDIAN_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.GUARDIAN_AMBIENT_LAND); + public static final CompatSoundEvent ENTITY_GUARDIAN_ATTACK = new CompatSoundEvent(SoundEvents.GUARDIAN_ATTACK); + public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH = new CompatSoundEvent(SoundEvents.GUARDIAN_DEATH); + public static final CompatSoundEvent ENTITY_GUARDIAN_DEATH_LAND = new CompatSoundEvent(SoundEvents.GUARDIAN_DEATH_LAND); + public static final CompatSoundEvent ENTITY_GUARDIAN_FLOP = new CompatSoundEvent(SoundEvents.GUARDIAN_FLOP); + public static final CompatSoundEvent ENTITY_GUARDIAN_HURT = new CompatSoundEvent(SoundEvents.GUARDIAN_HURT); + public static final CompatSoundEvent ENTITY_GUARDIAN_HURT_LAND = new CompatSoundEvent(SoundEvents.GUARDIAN_HURT_LAND); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.HANGING_ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_FALL = new CompatSoundEvent(SoundEvents.HANGING_ROOTS_FALL); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_HIT = new CompatSoundEvent(SoundEvents.HANGING_ROOTS_HIT); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.HANGING_ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_HANGING_ROOTS_STEP = new CompatSoundEvent(SoundEvents.HANGING_ROOTS_STEP); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_BREAK = new CompatSoundEvent(SoundEvents.HEAVY_CORE_BREAK); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_FALL = new CompatSoundEvent(SoundEvents.HEAVY_CORE_FALL); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_HIT = new CompatSoundEvent(SoundEvents.HEAVY_CORE_HIT); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_PLACE = new CompatSoundEvent(SoundEvents.HEAVY_CORE_PLACE); + public static final CompatSoundEvent BLOCK_HEAVY_CORE_STEP = new CompatSoundEvent(SoundEvents.HEAVY_CORE_STEP); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.NETHER_WOOD_HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.NETHER_WOOD_HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.NETHER_WOOD_HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.NETHER_WOOD_HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.NETHER_WOOD_HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_STEP = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_HANGING_SIGN_STEP); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_BREAK = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_HANGING_SIGN_BREAK); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_FALL = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_HANGING_SIGN_FALL); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_HIT = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_HANGING_SIGN_HIT); + public static final CompatSoundEvent BLOCK_BAMBOO_WOOD_HANGING_SIGN_PLACE = new CompatSoundEvent(SoundEvents.BAMBOO_WOOD_HANGING_SIGN_PLACE); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_BREAK = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_BREAK); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_STEP = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_STEP); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_PLACE = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_PLACE); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_HIT = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_HIT); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_FALL = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_FALL); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_MOB = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_SPAWN_MOB); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_SPAWN_ITEM); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_SPAWN_ITEM_BEGIN); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_DETECT_PLAYER = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_DETECT_PLAYER); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OMINOUS_ACTIVATE = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_OMINOUS_ACTIVATE); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_AMBIENT); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_AMBIENT_OMINOUS = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_AMBIENT_OMINOUS); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_OPEN_SHUTTER); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_CLOSE_SHUTTER); + public static final CompatSoundEvent BLOCK_TRIAL_SPAWNER_EJECT_ITEM = new CompatSoundEvent(SoundEvents.TRIAL_SPAWNER_EJECT_ITEM); + public static final CompatSoundEvent ITEM_HOE_TILL = new CompatSoundEvent(SoundEvents.HOE_TILL); + public static final CompatSoundEvent ENTITY_HOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.HOGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_HOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.HOGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_HOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.HOGLIN_ATTACK); + public static final CompatSoundEvent ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED); + public static final CompatSoundEvent ENTITY_HOGLIN_DEATH = new CompatSoundEvent(SoundEvents.HOGLIN_DEATH); + public static final CompatSoundEvent ENTITY_HOGLIN_HURT = new CompatSoundEvent(SoundEvents.HOGLIN_HURT); + public static final CompatSoundEvent ENTITY_HOGLIN_RETREAT = new CompatSoundEvent(SoundEvents.HOGLIN_RETREAT); + public static final CompatSoundEvent ENTITY_HOGLIN_STEP = new CompatSoundEvent(SoundEvents.HOGLIN_STEP); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.HONEY_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_FALL = new CompatSoundEvent(SoundEvents.HONEY_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_HIT = new CompatSoundEvent(SoundEvents.HONEY_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.HONEY_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_SLIDE = new CompatSoundEvent(SoundEvents.HONEY_BLOCK_SLIDE); + public static final CompatSoundEvent BLOCK_HONEY_BLOCK_STEP = new CompatSoundEvent(SoundEvents.HONEY_BLOCK_STEP); + public static final CompatSoundEvent ITEM_HONEYCOMB_WAX_ON = new CompatSoundEvent(SoundEvents.HONEYCOMB_WAX_ON); + public static final CompatSoundEvent ITEM_HONEY_BOTTLE_DRINK = new CompatSoundEvent(SoundEvents.HONEY_DRINK); + public static final int GOAT_HORN_SOUNDS_COUNT = SoundEvents.GOAT_HORN_VARIANT_COUNT; public static final ImmutableList GOAT_HORN_SOUNDS; - public static final CompatSoundEvent ENTITY_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_AMBIENT); - public static final CompatSoundEvent ENTITY_HORSE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_ANGRY); - public static final CompatSoundEvent ENTITY_HORSE_ARMOR = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_ARMOR); - public static final CompatSoundEvent ENTITY_HORSE_BREATHE = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_BREATHE); - public static final CompatSoundEvent ENTITY_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_DEATH); - public static final CompatSoundEvent ENTITY_HORSE_EAT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_EAT); - public static final CompatSoundEvent ENTITY_HORSE_GALLOP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_GALLOP); - public static final CompatSoundEvent ENTITY_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_HURT); - public static final CompatSoundEvent ENTITY_HORSE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_JUMP); - public static final CompatSoundEvent ENTITY_HORSE_LAND = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_LAND); - public static final CompatSoundEvent ENTITY_HORSE_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_SADDLE); - public static final CompatSoundEvent ENTITY_HORSE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_STEP); - public static final CompatSoundEvent ENTITY_HORSE_STEP_WOOD = new CompatSoundEvent(SoundEvents.ENTITY_HORSE_STEP_WOOD); - public static final CompatSoundEvent ENTITY_HOSTILE_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_BIG_FALL); - public static final CompatSoundEvent ENTITY_HOSTILE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_DEATH); - public static final CompatSoundEvent ENTITY_HOSTILE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_HURT); - public static final CompatSoundEvent ENTITY_HOSTILE_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SMALL_FALL); - public static final CompatSoundEvent ENTITY_HOSTILE_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SPLASH); - public static final CompatSoundEvent ENTITY_HOSTILE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_HOSTILE_SWIM); - public static final CompatSoundEvent ENTITY_HUSK_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_AMBIENT); - public static final CompatSoundEvent ENTITY_HUSK_CONVERTED_TO_ZOMBIE = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_CONVERTED_TO_ZOMBIE); - public static final CompatSoundEvent ENTITY_HUSK_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_DEATH); - public static final CompatSoundEvent ENTITY_HUSK_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_HURT); - public static final CompatSoundEvent ENTITY_HUSK_STEP = new CompatSoundEvent(SoundEvents.ENTITY_HUSK_STEP); - public static final CompatSoundEvent ENTITY_ILLUSIONER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_AMBIENT); - public static final CompatSoundEvent ENTITY_ILLUSIONER_CAST_SPELL = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_CAST_SPELL); - public static final CompatSoundEvent ENTITY_ILLUSIONER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_DEATH); - public static final CompatSoundEvent ENTITY_ILLUSIONER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_HURT); - public static final CompatSoundEvent ENTITY_ILLUSIONER_MIRROR_MOVE = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_MIRROR_MOVE); - public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_BLINDNESS = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_PREPARE_BLINDNESS); - public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_MIRROR = new CompatSoundEvent(SoundEvents.ENTITY_ILLUSIONER_PREPARE_MIRROR); - public static final CompatSoundEvent ITEM_INK_SAC_USE = new CompatSoundEvent(SoundEvents.ITEM_INK_SAC_USE); - public static final CompatSoundEvent BLOCK_IRON_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_IRON_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_IRON_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_IRON_DOOR_OPEN); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_ATTACK); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_DAMAGE = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_DAMAGE); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_DEATH); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_HURT); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_REPAIR = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_REPAIR); - public static final CompatSoundEvent ENTITY_IRON_GOLEM_STEP = new CompatSoundEvent(SoundEvents.ENTITY_IRON_GOLEM_STEP); - public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_IRON_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_BREAK); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_PLACE); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_REMOVE_ITEM); - public static final CompatSoundEvent ENTITY_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_FRAME_ROTATE_ITEM); - public static final CompatSoundEvent ENTITY_ITEM_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_BREAK); - public static final CompatSoundEvent ENTITY_ITEM_PICKUP = new CompatSoundEvent(SoundEvents.ENTITY_ITEM_PICKUP); - public static final CompatSoundEvent BLOCK_LADDER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_BREAK); - public static final CompatSoundEvent BLOCK_LADDER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_FALL); - public static final CompatSoundEvent BLOCK_LADDER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_HIT); - public static final CompatSoundEvent BLOCK_LADDER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_PLACE); - public static final CompatSoundEvent BLOCK_LADDER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LADDER_STEP); - public static final CompatSoundEvent BLOCK_LANTERN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_BREAK); - public static final CompatSoundEvent BLOCK_LANTERN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_FALL); - public static final CompatSoundEvent BLOCK_LANTERN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_HIT); - public static final CompatSoundEvent BLOCK_LANTERN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_PLACE); - public static final CompatSoundEvent BLOCK_LANTERN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LANTERN_STEP); - public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LARGE_AMETHYST_BUD_BREAK); - public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LARGE_AMETHYST_BUD_PLACE); - public static final CompatSoundEvent BLOCK_LAVA_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_AMBIENT); - public static final CompatSoundEvent BLOCK_LAVA_EXTINGUISH = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_EXTINGUISH); - public static final CompatSoundEvent BLOCK_LAVA_POP = new CompatSoundEvent(SoundEvents.BLOCK_LAVA_POP); - public static final CompatSoundEvent ENTITY_LEASH_KNOT_BREAK = new CompatSoundEvent(SoundEvents.ITEM_LEAD_BREAK); - public static final CompatSoundEvent ENTITY_LEASH_KNOT_PLACE = new CompatSoundEvent(SoundEvents.ITEM_LEAD_TIED); - public static final CompatSoundEvent BLOCK_LEVER_CLICK = new CompatSoundEvent(SoundEvents.BLOCK_LEVER_CLICK); - public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_LIGHTNING_BOLT_IMPACT); - public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_THUNDER = new CompatSoundEvent(SoundEvents.ENTITY_LIGHTNING_BOLT_THUNDER); - public static final CompatSoundEvent ENTITY_LINGERING_POTION_THROW = new CompatSoundEvent(SoundEvents.ENTITY_LINGERING_POTION_THROW); - public static final CompatSoundEvent ENTITY_LLAMA_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_AMBIENT); - public static final CompatSoundEvent ENTITY_LLAMA_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_ANGRY); - public static final CompatSoundEvent ENTITY_LLAMA_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_CHEST); - public static final CompatSoundEvent ENTITY_LLAMA_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_DEATH); - public static final CompatSoundEvent ENTITY_LLAMA_EAT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_EAT); - public static final CompatSoundEvent ENTITY_LLAMA_HURT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_HURT); - public static final CompatSoundEvent ENTITY_LLAMA_SPIT = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_SPIT); - public static final CompatSoundEvent ENTITY_LLAMA_STEP = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_STEP); - public static final CompatSoundEvent ENTITY_LLAMA_SWAG = new CompatSoundEvent(SoundEvents.ENTITY_LLAMA_SWAG); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_DEATH_SMALL); - public static final CompatSoundEvent BLOCK_LODESTONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_BREAK); - public static final CompatSoundEvent BLOCK_LODESTONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_STEP); - public static final CompatSoundEvent BLOCK_LODESTONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_PLACE); - public static final CompatSoundEvent BLOCK_LODESTONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_HIT); - public static final CompatSoundEvent BLOCK_LODESTONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_LODESTONE_FALL); - public static final CompatSoundEvent ITEM_LODESTONE_COMPASS_LOCK = new CompatSoundEvent(SoundEvents.ITEM_LODESTONE_COMPASS_LOCK); - public static final CompatSoundEvent ITEM_MACE_SMASH_AIR = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_AIR); - public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_GROUND); - public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND_HEAVY = new CompatSoundEvent(SoundEvents.ITEM_MACE_SMASH_GROUND_HEAVY); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_DEATH); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_HURT); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_HURT_SMALL); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_JUMP); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_SQUISH); - public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_MAGMA_CUBE_SQUISH_SMALL); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MANGROVE_ROOTS_STEP); - public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MEDIUM_AMETHYST_BUD_BREAK); - public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MEDIUM_AMETHYST_BUD_PLACE); - public static final CompatSoundEvent BLOCK_METAL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_METAL_BREAK); - public static final CompatSoundEvent BLOCK_METAL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_METAL_FALL); - public static final CompatSoundEvent BLOCK_METAL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_METAL_HIT); - public static final CompatSoundEvent BLOCK_METAL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PLACE); - public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_METAL_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_METAL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_METAL_STEP); - public static final CompatSoundEvent ENTITY_MINECART_INSIDE_UNDERWATER = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_INSIDE_UNDERWATER); - public static final CompatSoundEvent ENTITY_MINECART_INSIDE = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_INSIDE); - public static final CompatSoundEvent ENTITY_MINECART_RIDING = new CompatSoundEvent(SoundEvents.ENTITY_MINECART_RIDING); - public static final CompatSoundEvent ENTITY_MOOSHROOM_CONVERT = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_CONVERT); - public static final CompatSoundEvent ENTITY_MOOSHROOM_EAT = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_EAT); - public static final CompatSoundEvent ENTITY_MOOSHROOM_MILK = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_MILK); - public static final CompatSoundEvent ENTITY_MOOSHROOM_SUSPICIOUS_MILK = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_SUSPICIOUS_MILK); - public static final CompatSoundEvent ENTITY_MOOSHROOM_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_MOOSHROOM_SHEAR); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_BREAK); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_FALL); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_HIT); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_PLACE); - public static final CompatSoundEvent BLOCK_MOSS_CARPET_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_CARPET_STEP); - public static final CompatSoundEvent BLOCK_PINK_PETALS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_BREAK); - public static final CompatSoundEvent BLOCK_PINK_PETALS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_FALL); - public static final CompatSoundEvent BLOCK_PINK_PETALS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_HIT); - public static final CompatSoundEvent BLOCK_PINK_PETALS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_PLACE); - public static final CompatSoundEvent BLOCK_PINK_PETALS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_PINK_PETALS_STEP); - public static final CompatSoundEvent BLOCK_MOSS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_BREAK); - public static final CompatSoundEvent BLOCK_MOSS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_FALL); - public static final CompatSoundEvent BLOCK_MOSS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_HIT); - public static final CompatSoundEvent BLOCK_MOSS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_PLACE); - public static final CompatSoundEvent BLOCK_MOSS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MOSS_STEP); - public static final CompatSoundEvent BLOCK_MUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BREAK); - public static final CompatSoundEvent BLOCK_MUD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUD_FALL); - public static final CompatSoundEvent BLOCK_MUD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUD_HIT); - public static final CompatSoundEvent BLOCK_MUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUD_PLACE); - public static final CompatSoundEvent BLOCK_MUD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUD_STEP); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_MUD_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUD_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_BREAK); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_FALL); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_HIT); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_PLACE); - public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_MUDDY_MANGROVE_ROOTS_STEP); - public static final CompatSoundEvent ENTITY_MULE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_AMBIENT); - public static final CompatSoundEvent ENTITY_MULE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_MULE_ANGRY); - public static final CompatSoundEvent ENTITY_MULE_CHEST = new CompatSoundEvent(SoundEvents.ENTITY_MULE_CHEST); - public static final CompatSoundEvent ENTITY_MULE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_MULE_DEATH); - public static final CompatSoundEvent ENTITY_MULE_EAT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_EAT); - public static final CompatSoundEvent ENTITY_MULE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_MULE_HURT); - public static final CompatSoundEvent ENTITY_MULE_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_MULE_JUMP); + public static final CompatSoundEvent ENTITY_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.HORSE_AMBIENT); + public static final CompatSoundEvent ENTITY_HORSE_ANGRY = new CompatSoundEvent(SoundEvents.HORSE_ANGRY); + public static final CompatSoundEvent ENTITY_HORSE_ARMOR = new CompatSoundEvent(SoundEvents.HORSE_ARMOR); + public static final CompatSoundEvent ENTITY_HORSE_BREATHE = new CompatSoundEvent(SoundEvents.HORSE_BREATHE); + public static final CompatSoundEvent ENTITY_HORSE_DEATH = new CompatSoundEvent(SoundEvents.HORSE_DEATH); + public static final CompatSoundEvent ENTITY_HORSE_EAT = new CompatSoundEvent(SoundEvents.HORSE_EAT); + public static final CompatSoundEvent ENTITY_HORSE_GALLOP = new CompatSoundEvent(SoundEvents.HORSE_GALLOP); + public static final CompatSoundEvent ENTITY_HORSE_HURT = new CompatSoundEvent(SoundEvents.HORSE_HURT); + public static final CompatSoundEvent ENTITY_HORSE_JUMP = new CompatSoundEvent(SoundEvents.HORSE_JUMP); + public static final CompatSoundEvent ENTITY_HORSE_LAND = new CompatSoundEvent(SoundEvents.HORSE_LAND); + public static final CompatSoundEvent ENTITY_HORSE_SADDLE = new CompatSoundEvent(SoundEvents.HORSE_SADDLE); + public static final CompatSoundEvent ENTITY_HORSE_STEP = new CompatSoundEvent(SoundEvents.HORSE_STEP); + public static final CompatSoundEvent ENTITY_HORSE_STEP_WOOD = new CompatSoundEvent(SoundEvents.HORSE_STEP_WOOD); + public static final CompatSoundEvent ENTITY_HOSTILE_BIG_FALL = new CompatSoundEvent(SoundEvents.HOSTILE_BIG_FALL); + public static final CompatSoundEvent ENTITY_HOSTILE_DEATH = new CompatSoundEvent(SoundEvents.HOSTILE_DEATH); + public static final CompatSoundEvent ENTITY_HOSTILE_HURT = new CompatSoundEvent(SoundEvents.HOSTILE_HURT); + public static final CompatSoundEvent ENTITY_HOSTILE_SMALL_FALL = new CompatSoundEvent(SoundEvents.HOSTILE_SMALL_FALL); + public static final CompatSoundEvent ENTITY_HOSTILE_SPLASH = new CompatSoundEvent(SoundEvents.HOSTILE_SPLASH); + public static final CompatSoundEvent ENTITY_HOSTILE_SWIM = new CompatSoundEvent(SoundEvents.HOSTILE_SWIM); + public static final CompatSoundEvent ENTITY_HUSK_AMBIENT = new CompatSoundEvent(SoundEvents.HUSK_AMBIENT); + public static final CompatSoundEvent ENTITY_HUSK_CONVERTED_TO_ZOMBIE = new CompatSoundEvent(SoundEvents.HUSK_CONVERTED_TO_ZOMBIE); + public static final CompatSoundEvent ENTITY_HUSK_DEATH = new CompatSoundEvent(SoundEvents.HUSK_DEATH); + public static final CompatSoundEvent ENTITY_HUSK_HURT = new CompatSoundEvent(SoundEvents.HUSK_HURT); + public static final CompatSoundEvent ENTITY_HUSK_STEP = new CompatSoundEvent(SoundEvents.HUSK_STEP); + public static final CompatSoundEvent ENTITY_ILLUSIONER_AMBIENT = new CompatSoundEvent(SoundEvents.ILLUSIONER_AMBIENT); + public static final CompatSoundEvent ENTITY_ILLUSIONER_CAST_SPELL = new CompatSoundEvent(SoundEvents.ILLUSIONER_CAST_SPELL); + public static final CompatSoundEvent ENTITY_ILLUSIONER_DEATH = new CompatSoundEvent(SoundEvents.ILLUSIONER_DEATH); + public static final CompatSoundEvent ENTITY_ILLUSIONER_HURT = new CompatSoundEvent(SoundEvents.ILLUSIONER_HURT); + public static final CompatSoundEvent ENTITY_ILLUSIONER_MIRROR_MOVE = new CompatSoundEvent(SoundEvents.ILLUSIONER_MIRROR_MOVE); + public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_BLINDNESS = new CompatSoundEvent(SoundEvents.ILLUSIONER_PREPARE_BLINDNESS); + public static final CompatSoundEvent ENTITY_ILLUSIONER_PREPARE_MIRROR = new CompatSoundEvent(SoundEvents.ILLUSIONER_PREPARE_MIRROR); + public static final CompatSoundEvent ITEM_INK_SAC_USE = new CompatSoundEvent(SoundEvents.INK_SAC_USE); + public static final CompatSoundEvent BLOCK_IRON_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.IRON_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_IRON_DOOR_OPEN = new CompatSoundEvent(SoundEvents.IRON_DOOR_OPEN); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_ATTACK = new CompatSoundEvent(SoundEvents.IRON_GOLEM_ATTACK); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_DAMAGE = new CompatSoundEvent(SoundEvents.IRON_GOLEM_DAMAGE); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.IRON_GOLEM_DEATH); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_HURT = new CompatSoundEvent(SoundEvents.IRON_GOLEM_HURT); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_REPAIR = new CompatSoundEvent(SoundEvents.IRON_GOLEM_REPAIR); + public static final CompatSoundEvent ENTITY_IRON_GOLEM_STEP = new CompatSoundEvent(SoundEvents.IRON_GOLEM_STEP); + public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.IRON_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_IRON_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.IRON_TRAPDOOR_OPEN); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_ADD_ITEM = new CompatSoundEvent(SoundEvents.ITEM_FRAME_ADD_ITEM); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_BREAK = new CompatSoundEvent(SoundEvents.ITEM_FRAME_BREAK); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_PLACE = new CompatSoundEvent(SoundEvents.ITEM_FRAME_PLACE); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_REMOVE_ITEM = new CompatSoundEvent(SoundEvents.ITEM_FRAME_REMOVE_ITEM); + public static final CompatSoundEvent ENTITY_ITEM_FRAME_ROTATE_ITEM = new CompatSoundEvent(SoundEvents.ITEM_FRAME_ROTATE_ITEM); + public static final CompatSoundEvent ENTITY_ITEM_BREAK = new CompatSoundEvent(SoundEvents.ITEM_BREAK); + public static final CompatSoundEvent ENTITY_ITEM_PICKUP = new CompatSoundEvent(SoundEvents.ITEM_PICKUP); + public static final CompatSoundEvent BLOCK_LADDER_BREAK = new CompatSoundEvent(SoundEvents.LADDER_BREAK); + public static final CompatSoundEvent BLOCK_LADDER_FALL = new CompatSoundEvent(SoundEvents.LADDER_FALL); + public static final CompatSoundEvent BLOCK_LADDER_HIT = new CompatSoundEvent(SoundEvents.LADDER_HIT); + public static final CompatSoundEvent BLOCK_LADDER_PLACE = new CompatSoundEvent(SoundEvents.LADDER_PLACE); + public static final CompatSoundEvent BLOCK_LADDER_STEP = new CompatSoundEvent(SoundEvents.LADDER_STEP); + public static final CompatSoundEvent BLOCK_LANTERN_BREAK = new CompatSoundEvent(SoundEvents.LANTERN_BREAK); + public static final CompatSoundEvent BLOCK_LANTERN_FALL = new CompatSoundEvent(SoundEvents.LANTERN_FALL); + public static final CompatSoundEvent BLOCK_LANTERN_HIT = new CompatSoundEvent(SoundEvents.LANTERN_HIT); + public static final CompatSoundEvent BLOCK_LANTERN_PLACE = new CompatSoundEvent(SoundEvents.LANTERN_PLACE); + public static final CompatSoundEvent BLOCK_LANTERN_STEP = new CompatSoundEvent(SoundEvents.LANTERN_STEP); + public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.LARGE_AMETHYST_BUD_BREAK); + public static final CompatSoundEvent BLOCK_LARGE_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.LARGE_AMETHYST_BUD_PLACE); + public static final CompatSoundEvent BLOCK_LAVA_AMBIENT = new CompatSoundEvent(SoundEvents.LAVA_AMBIENT); + public static final CompatSoundEvent BLOCK_LAVA_EXTINGUISH = new CompatSoundEvent(SoundEvents.LAVA_EXTINGUISH); + public static final CompatSoundEvent BLOCK_LAVA_POP = new CompatSoundEvent(SoundEvents.LAVA_POP); + public static final CompatSoundEvent ENTITY_LEASH_KNOT_BREAK = new CompatSoundEvent(SoundEvents.LEAD_BREAK); + public static final CompatSoundEvent ENTITY_LEASH_KNOT_PLACE = new CompatSoundEvent(SoundEvents.LEAD_TIED); + public static final CompatSoundEvent BLOCK_LEVER_CLICK = new CompatSoundEvent(SoundEvents.LEVER_CLICK); + public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_IMPACT = new CompatSoundEvent(SoundEvents.LIGHTNING_BOLT_IMPACT); + public static final CompatSoundEvent ENTITY_LIGHTNING_BOLT_THUNDER = new CompatSoundEvent(SoundEvents.LIGHTNING_BOLT_THUNDER); + public static final CompatSoundEvent ENTITY_LINGERING_POTION_THROW = new CompatSoundEvent(SoundEvents.LINGERING_POTION_THROW); + public static final CompatSoundEvent ENTITY_LLAMA_AMBIENT = new CompatSoundEvent(SoundEvents.LLAMA_AMBIENT); + public static final CompatSoundEvent ENTITY_LLAMA_ANGRY = new CompatSoundEvent(SoundEvents.LLAMA_ANGRY); + public static final CompatSoundEvent ENTITY_LLAMA_CHEST = new CompatSoundEvent(SoundEvents.LLAMA_CHEST); + public static final CompatSoundEvent ENTITY_LLAMA_DEATH = new CompatSoundEvent(SoundEvents.LLAMA_DEATH); + public static final CompatSoundEvent ENTITY_LLAMA_EAT = new CompatSoundEvent(SoundEvents.LLAMA_EAT); + public static final CompatSoundEvent ENTITY_LLAMA_HURT = new CompatSoundEvent(SoundEvents.LLAMA_HURT); + public static final CompatSoundEvent ENTITY_LLAMA_SPIT = new CompatSoundEvent(SoundEvents.LLAMA_SPIT); + public static final CompatSoundEvent ENTITY_LLAMA_STEP = new CompatSoundEvent(SoundEvents.LLAMA_STEP); + public static final CompatSoundEvent ENTITY_LLAMA_SWAG = new CompatSoundEvent(SoundEvents.LLAMA_SWAG); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH_SMALL = new CompatSoundEvent(SoundEvents.MAGMA_CUBE_DEATH_SMALL); + public static final CompatSoundEvent BLOCK_LODESTONE_BREAK = new CompatSoundEvent(SoundEvents.LODESTONE_BREAK); + public static final CompatSoundEvent BLOCK_LODESTONE_STEP = new CompatSoundEvent(SoundEvents.LODESTONE_STEP); + public static final CompatSoundEvent BLOCK_LODESTONE_PLACE = new CompatSoundEvent(SoundEvents.LODESTONE_PLACE); + public static final CompatSoundEvent BLOCK_LODESTONE_HIT = new CompatSoundEvent(SoundEvents.LODESTONE_HIT); + public static final CompatSoundEvent BLOCK_LODESTONE_FALL = new CompatSoundEvent(SoundEvents.LODESTONE_FALL); + public static final CompatSoundEvent ITEM_LODESTONE_COMPASS_LOCK = new CompatSoundEvent(SoundEvents.LODESTONE_COMPASS_LOCK); + public static final CompatSoundEvent ITEM_MACE_SMASH_AIR = new CompatSoundEvent(SoundEvents.MACE_SMASH_AIR); + public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND = new CompatSoundEvent(SoundEvents.MACE_SMASH_GROUND); + public static final CompatSoundEvent ITEM_MACE_SMASH_GROUND_HEAVY = new CompatSoundEvent(SoundEvents.MACE_SMASH_GROUND_HEAVY); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_DEATH = new CompatSoundEvent(SoundEvents.MAGMA_CUBE_DEATH); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT = new CompatSoundEvent(SoundEvents.MAGMA_CUBE_HURT); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_HURT_SMALL = new CompatSoundEvent(SoundEvents.MAGMA_CUBE_HURT_SMALL); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_JUMP = new CompatSoundEvent(SoundEvents.MAGMA_CUBE_JUMP); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH = new CompatSoundEvent(SoundEvents.MAGMA_CUBE_SQUISH); + public static final CompatSoundEvent ENTITY_MAGMA_CUBE_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.MAGMA_CUBE_SQUISH_SMALL); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.MANGROVE_ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.MANGROVE_ROOTS_FALL); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.MANGROVE_ROOTS_HIT); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.MANGROVE_ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.MANGROVE_ROOTS_STEP); + public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.MEDIUM_AMETHYST_BUD_BREAK); + public static final CompatSoundEvent BLOCK_MEDIUM_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.MEDIUM_AMETHYST_BUD_PLACE); + public static final CompatSoundEvent BLOCK_METAL_BREAK = new CompatSoundEvent(SoundEvents.METAL_BREAK); + public static final CompatSoundEvent BLOCK_METAL_FALL = new CompatSoundEvent(SoundEvents.METAL_FALL); + public static final CompatSoundEvent BLOCK_METAL_HIT = new CompatSoundEvent(SoundEvents.METAL_HIT); + public static final CompatSoundEvent BLOCK_METAL_PLACE = new CompatSoundEvent(SoundEvents.METAL_PLACE); + public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.METAL_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_METAL_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.METAL_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_METAL_STEP = new CompatSoundEvent(SoundEvents.METAL_STEP); + public static final CompatSoundEvent ENTITY_MINECART_INSIDE_UNDERWATER = new CompatSoundEvent(SoundEvents.MINECART_INSIDE_UNDERWATER); + public static final CompatSoundEvent ENTITY_MINECART_INSIDE = new CompatSoundEvent(SoundEvents.MINECART_INSIDE); + public static final CompatSoundEvent ENTITY_MINECART_RIDING = new CompatSoundEvent(SoundEvents.MINECART_RIDING); + public static final CompatSoundEvent ENTITY_MOOSHROOM_CONVERT = new CompatSoundEvent(SoundEvents.MOOSHROOM_CONVERT); + public static final CompatSoundEvent ENTITY_MOOSHROOM_EAT = new CompatSoundEvent(SoundEvents.MOOSHROOM_EAT); + public static final CompatSoundEvent ENTITY_MOOSHROOM_MILK = new CompatSoundEvent(SoundEvents.MOOSHROOM_MILK); + public static final CompatSoundEvent ENTITY_MOOSHROOM_SUSPICIOUS_MILK = new CompatSoundEvent(SoundEvents.MOOSHROOM_MILK_SUSPICIOUSLY); + public static final CompatSoundEvent ENTITY_MOOSHROOM_SHEAR = new CompatSoundEvent(SoundEvents.MOOSHROOM_SHEAR); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_BREAK = new CompatSoundEvent(SoundEvents.MOSS_CARPET_BREAK); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_FALL = new CompatSoundEvent(SoundEvents.MOSS_CARPET_FALL); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_HIT = new CompatSoundEvent(SoundEvents.MOSS_CARPET_HIT); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_PLACE = new CompatSoundEvent(SoundEvents.MOSS_CARPET_PLACE); + public static final CompatSoundEvent BLOCK_MOSS_CARPET_STEP = new CompatSoundEvent(SoundEvents.MOSS_CARPET_STEP); + public static final CompatSoundEvent BLOCK_PINK_PETALS_BREAK = new CompatSoundEvent(SoundEvents.PINK_PETALS_BREAK); + public static final CompatSoundEvent BLOCK_PINK_PETALS_FALL = new CompatSoundEvent(SoundEvents.PINK_PETALS_FALL); + public static final CompatSoundEvent BLOCK_PINK_PETALS_HIT = new CompatSoundEvent(SoundEvents.PINK_PETALS_HIT); + public static final CompatSoundEvent BLOCK_PINK_PETALS_PLACE = new CompatSoundEvent(SoundEvents.PINK_PETALS_PLACE); + public static final CompatSoundEvent BLOCK_PINK_PETALS_STEP = new CompatSoundEvent(SoundEvents.PINK_PETALS_STEP); + public static final CompatSoundEvent BLOCK_MOSS_BREAK = new CompatSoundEvent(SoundEvents.MOSS_BREAK); + public static final CompatSoundEvent BLOCK_MOSS_FALL = new CompatSoundEvent(SoundEvents.MOSS_FALL); + public static final CompatSoundEvent BLOCK_MOSS_HIT = new CompatSoundEvent(SoundEvents.MOSS_HIT); + public static final CompatSoundEvent BLOCK_MOSS_PLACE = new CompatSoundEvent(SoundEvents.MOSS_PLACE); + public static final CompatSoundEvent BLOCK_MOSS_STEP = new CompatSoundEvent(SoundEvents.MOSS_STEP); + public static final CompatSoundEvent BLOCK_MUD_BREAK = new CompatSoundEvent(SoundEvents.MUD_BREAK); + public static final CompatSoundEvent BLOCK_MUD_FALL = new CompatSoundEvent(SoundEvents.MUD_FALL); + public static final CompatSoundEvent BLOCK_MUD_HIT = new CompatSoundEvent(SoundEvents.MUD_HIT); + public static final CompatSoundEvent BLOCK_MUD_PLACE = new CompatSoundEvent(SoundEvents.MUD_PLACE); + public static final CompatSoundEvent BLOCK_MUD_STEP = new CompatSoundEvent(SoundEvents.MUD_STEP); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.MUD_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_FALL = new CompatSoundEvent(SoundEvents.MUD_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_HIT = new CompatSoundEvent(SoundEvents.MUD_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.MUD_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_MUD_BRICKS_STEP = new CompatSoundEvent(SoundEvents.MUD_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_BREAK = new CompatSoundEvent(SoundEvents.MUDDY_MANGROVE_ROOTS_BREAK); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_FALL = new CompatSoundEvent(SoundEvents.MUDDY_MANGROVE_ROOTS_FALL); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_HIT = new CompatSoundEvent(SoundEvents.MUDDY_MANGROVE_ROOTS_HIT); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_PLACE = new CompatSoundEvent(SoundEvents.MUDDY_MANGROVE_ROOTS_PLACE); + public static final CompatSoundEvent BLOCK_MUDDY_MANGROVE_ROOTS_STEP = new CompatSoundEvent(SoundEvents.MUDDY_MANGROVE_ROOTS_STEP); + public static final CompatSoundEvent ENTITY_MULE_AMBIENT = new CompatSoundEvent(SoundEvents.MULE_AMBIENT); + public static final CompatSoundEvent ENTITY_MULE_ANGRY = new CompatSoundEvent(SoundEvents.MULE_ANGRY); + public static final CompatSoundEvent ENTITY_MULE_CHEST = new CompatSoundEvent(SoundEvents.MULE_CHEST); + public static final CompatSoundEvent ENTITY_MULE_DEATH = new CompatSoundEvent(SoundEvents.MULE_DEATH); + public static final CompatSoundEvent ENTITY_MULE_EAT = new CompatSoundEvent(SoundEvents.MULE_EAT); + public static final CompatSoundEvent ENTITY_MULE_HURT = new CompatSoundEvent(SoundEvents.MULE_HURT); + public static final CompatSoundEvent ENTITY_MULE_JUMP = new CompatSoundEvent(SoundEvents.MULE_JUMP); public static final CompatSoundEvent MUSIC_CREATIVE = new CompatSoundEvent(SoundEvents.MUSIC_CREATIVE); public static final CompatSoundEvent MUSIC_CREDITS = new CompatSoundEvent(SoundEvents.MUSIC_CREDITS); public static final CompatSoundEvent MUSIC_DISC_5 = new CompatSoundEvent(SoundEvents.MUSIC_DISC_5); @@ -892,540 +892,540 @@ public class CompatSoundEvents { public static final CompatSoundEvent MUSIC_END = new CompatSoundEvent(SoundEvents.MUSIC_END); public static final CompatSoundEvent MUSIC_GAME = new CompatSoundEvent(SoundEvents.MUSIC_GAME); public static final CompatSoundEvent MUSIC_MENU = new CompatSoundEvent(SoundEvents.MUSIC_MENU); - public static final CompatSoundEvent MUSIC_NETHER_BASALT_DELTAS = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_BASALT_DELTAS); - public static final CompatSoundEvent MUSIC_NETHER_CRIMSON_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_CRIMSON_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_DEEP_DARK = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DEEP_DARK); - public static final CompatSoundEvent MUSIC_OVERWORLD_DRIPSTONE_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DRIPSTONE_CAVES); - public static final CompatSoundEvent MUSIC_OVERWORLD_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_GROVE); - public static final CompatSoundEvent MUSIC_OVERWORLD_JAGGED_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_JAGGED_PEAKS); - public static final CompatSoundEvent MUSIC_OVERWORLD_LUSH_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_LUSH_CAVES); - public static final CompatSoundEvent MUSIC_OVERWORLD_SWAMP = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SWAMP); - public static final CompatSoundEvent MUSIC_OVERWORLD_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_OLD_GROWTH_TAIGA = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_OLD_GROWTH_TAIGA); - public static final CompatSoundEvent MUSIC_OVERWORLD_MEADOW = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_MEADOW); - public static final CompatSoundEvent MUSIC_OVERWORLD_CHERRY_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_CHERRY_GROVE); - public static final CompatSoundEvent MUSIC_NETHER_NETHER_WASTES = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_NETHER_WASTES); - public static final CompatSoundEvent MUSIC_OVERWORLD_FROZEN_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FROZEN_PEAKS); - public static final CompatSoundEvent MUSIC_OVERWORLD_SNOWY_SLOPES = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SNOWY_SLOPES); - public static final CompatSoundEvent MUSIC_NETHER_SOUL_SAND_VALLEY = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_SOUL_SAND_VALLEY); - public static final CompatSoundEvent MUSIC_OVERWORLD_STONY_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_STONY_PEAKS); - public static final CompatSoundEvent MUSIC_NETHER_WARPED_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_NETHER_WARPED_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_FLOWER_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_FLOWER_FOREST); - public static final CompatSoundEvent MUSIC_OVERWORLD_DESERT = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_DESERT); - public static final CompatSoundEvent MUSIC_OVERWORLD_BADLANDS = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_BADLANDS); - public static final CompatSoundEvent MUSIC_OVERWORLD_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_JUNGLE); - public static final CompatSoundEvent MUSIC_OVERWORLD_SPARSE_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_SPARSE_JUNGLE); - public static final CompatSoundEvent MUSIC_OVERWORLD_BAMBOO_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_OVERWORLD_BAMBOO_JUNGLE); + public static final CompatSoundEvent MUSIC_NETHER_BASALT_DELTAS = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_BASALT_DELTAS); + public static final CompatSoundEvent MUSIC_NETHER_CRIMSON_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_CRIMSON_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_DEEP_DARK = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_DEEP_DARK); + public static final CompatSoundEvent MUSIC_OVERWORLD_DRIPSTONE_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_DRIPSTONE_CAVES); + public static final CompatSoundEvent MUSIC_OVERWORLD_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_GROVE); + public static final CompatSoundEvent MUSIC_OVERWORLD_JAGGED_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_JAGGED_PEAKS); + public static final CompatSoundEvent MUSIC_OVERWORLD_LUSH_CAVES = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_LUSH_CAVES); + public static final CompatSoundEvent MUSIC_OVERWORLD_SWAMP = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_SWAMP); + public static final CompatSoundEvent MUSIC_OVERWORLD_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_OLD_GROWTH_TAIGA = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_OLD_GROWTH_TAIGA); + public static final CompatSoundEvent MUSIC_OVERWORLD_MEADOW = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_MEADOW); + public static final CompatSoundEvent MUSIC_OVERWORLD_CHERRY_GROVE = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_CHERRY_GROVE); + public static final CompatSoundEvent MUSIC_NETHER_NETHER_WASTES = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_NETHER_WASTES); + public static final CompatSoundEvent MUSIC_OVERWORLD_FROZEN_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_FROZEN_PEAKS); + public static final CompatSoundEvent MUSIC_OVERWORLD_SNOWY_SLOPES = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_SNOWY_SLOPES); + public static final CompatSoundEvent MUSIC_NETHER_SOUL_SAND_VALLEY = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_SOUL_SAND_VALLEY); + public static final CompatSoundEvent MUSIC_OVERWORLD_STONY_PEAKS = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_STONY_PEAKS); + public static final CompatSoundEvent MUSIC_NETHER_WARPED_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_WARPED_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_FLOWER_FOREST = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_FLOWER_FOREST); + public static final CompatSoundEvent MUSIC_OVERWORLD_DESERT = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_DESERT); + public static final CompatSoundEvent MUSIC_OVERWORLD_BADLANDS = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_BADLANDS); + public static final CompatSoundEvent MUSIC_OVERWORLD_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_JUNGLE); + public static final CompatSoundEvent MUSIC_OVERWORLD_SPARSE_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_SPARSE_JUNGLE); + public static final CompatSoundEvent MUSIC_OVERWORLD_BAMBOO_JUNGLE = new CompatSoundEvent(SoundEvents.MUSIC_BIOME_BAMBOO_JUNGLE); public static final CompatSoundEvent MUSIC_UNDER_WATER = new CompatSoundEvent(SoundEvents.MUSIC_UNDER_WATER); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_NETHER_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_NETHER_WART_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WART_BREAK); - public static final CompatSoundEvent ITEM_NETHER_WART_PLANT = new CompatSoundEvent(SoundEvents.ITEM_NETHER_WART_PLANT); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FALL); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_HIT); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_STEP); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE); - public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_WOOD_FENCE_GATE_OPEN); - public static final CompatSoundEvent INTENTIONALLY_EMPTY = new CompatSoundEvent(SoundEvents.INTENTIONALLY_EMPTY); - public static final CompatSoundEvent BLOCK_PACKED_MUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_BREAK); - public static final CompatSoundEvent BLOCK_PACKED_MUD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_FALL); - public static final CompatSoundEvent BLOCK_PACKED_MUD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_HIT); - public static final CompatSoundEvent BLOCK_PACKED_MUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_PLACE); - public static final CompatSoundEvent BLOCK_PACKED_MUD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_PACKED_MUD_STEP); - public static final CompatSoundEvent BLOCK_STEM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_STEM_BREAK); - public static final CompatSoundEvent BLOCK_STEM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_STEM_STEP); - public static final CompatSoundEvent BLOCK_STEM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_STEM_PLACE); - public static final CompatSoundEvent BLOCK_STEM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_STEM_HIT); - public static final CompatSoundEvent BLOCK_STEM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_STEM_FALL); - public static final CompatSoundEvent BLOCK_NYLIUM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_BREAK); - public static final CompatSoundEvent BLOCK_NYLIUM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_STEP); - public static final CompatSoundEvent BLOCK_NYLIUM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_PLACE); - public static final CompatSoundEvent BLOCK_NYLIUM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_HIT); - public static final CompatSoundEvent BLOCK_NYLIUM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NYLIUM_FALL); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_STEP); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_HIT); - public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_SPROUTS_FALL); - public static final CompatSoundEvent BLOCK_FUNGUS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_BREAK); - public static final CompatSoundEvent BLOCK_FUNGUS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_STEP); - public static final CompatSoundEvent BLOCK_FUNGUS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_PLACE); - public static final CompatSoundEvent BLOCK_FUNGUS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_HIT); - public static final CompatSoundEvent BLOCK_FUNGUS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_FUNGUS_FALL); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_BREAK); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_STEP); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_PLACE); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_HIT); - public static final CompatSoundEvent BLOCK_WEEPING_VINES_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WEEPING_VINES_FALL); - public static final CompatSoundEvent BLOCK_WART_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_WART_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_WART_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_WART_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_WART_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WART_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHERITE_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_NETHERRACK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_BREAK); - public static final CompatSoundEvent BLOCK_NETHERRACK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_STEP); - public static final CompatSoundEvent BLOCK_NETHERRACK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_PLACE); - public static final CompatSoundEvent BLOCK_NETHERRACK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_HIT); - public static final CompatSoundEvent BLOCK_NETHERRACK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHERRACK_FALL); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASEDRUM = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BASEDRUM); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASS = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BASS); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BELL = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BELL); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_CHIME); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_FLUTE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_FLUTE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_GUITAR = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_GUITAR); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HARP = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_HARP); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HAT = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_HAT); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_PLING = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_PLING); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_SNARE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_SNARE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_XYLOPHONE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_XYLOPHONE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IRON_XYLOPHONE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_COW_BELL = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_COW_BELL); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_DIDGERIDOO = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_DIDGERIDOO); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BIT = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BIT); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BANJO = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_BANJO); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_SKELETON); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_CREEPER); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON); - public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.BLOCK_NOTE_BLOCK_IMITATE_PIGLIN); - public static final CompatSoundEvent ENTITY_OCELOT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_HURT); - public static final CompatSoundEvent ENTITY_OCELOT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_AMBIENT); - public static final CompatSoundEvent ENTITY_OCELOT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_OCELOT_DEATH); - public static final CompatSoundEvent ITEM_OMINOUS_BOTTLE_DISPOSE = new CompatSoundEvent(SoundEvents.ITEM_OMINOUS_BOTTLE_DISPOSE); - public static final CompatSoundEvent ENTITY_PAINTING_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_PAINTING_BREAK); - public static final CompatSoundEvent ENTITY_PAINTING_PLACE = new CompatSoundEvent(SoundEvents.ENTITY_PAINTING_PLACE); - public static final CompatSoundEvent ENTITY_PANDA_PRE_SNEEZE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_PRE_SNEEZE); - public static final CompatSoundEvent ENTITY_PANDA_SNEEZE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_SNEEZE); - public static final CompatSoundEvent ENTITY_PANDA_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_AMBIENT); - public static final CompatSoundEvent ENTITY_PANDA_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_DEATH); - public static final CompatSoundEvent ENTITY_PANDA_EAT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_EAT); - public static final CompatSoundEvent ENTITY_PANDA_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_STEP); - public static final CompatSoundEvent ENTITY_PANDA_CANT_BREED = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_CANT_BREED); - public static final CompatSoundEvent ENTITY_PANDA_AGGRESSIVE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_AGGRESSIVE_AMBIENT); - public static final CompatSoundEvent ENTITY_PANDA_WORRIED_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_WORRIED_AMBIENT); - public static final CompatSoundEvent ENTITY_PANDA_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_HURT); - public static final CompatSoundEvent ENTITY_PANDA_BITE = new CompatSoundEvent(SoundEvents.ENTITY_PANDA_BITE); - public static final CompatSoundEvent ENTITY_PARROT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_AMBIENT); - public static final CompatSoundEvent ENTITY_PARROT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_DEATH); - public static final CompatSoundEvent ENTITY_PARROT_EAT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_EAT); - public static final CompatSoundEvent ENTITY_PARROT_FLY = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_FLY); - public static final CompatSoundEvent ENTITY_PARROT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_HURT); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BLAZE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BLAZE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BOGGED = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BOGGED); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BREEZE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_BREEZE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_CREEPER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_DROWNED = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_DROWNED); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ELDER_GUARDIAN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ELDER_GUARDIAN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ENDER_DRAGON); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDERMITE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ENDERMITE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_EVOKER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_EVOKER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GHAST = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_GHAST); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GUARDIAN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_GUARDIAN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HOGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_HOGLIN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HUSK = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_HUSK); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ILLUSIONER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ILLUSIONER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_MAGMA_CUBE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_MAGMA_CUBE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PHANTOM = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PHANTOM); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PIGLIN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN_BRUTE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PIGLIN_BRUTE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PILLAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_PILLAGER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_RAVAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_RAVAGER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SHULKER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SHULKER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SILVERFISH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SILVERFISH); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SKELETON); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SLIME = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SLIME); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SPIDER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_SPIDER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_STRAY = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_STRAY); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VEX = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_VEX); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VINDICATOR = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_VINDICATOR); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WARDEN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WARDEN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITCH = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITCH); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITHER); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_WITHER_SKELETON); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOGLIN = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOGLIN); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOMBIE); - public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER); - public static final CompatSoundEvent ENTITY_PARROT_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PARROT_STEP); - public static final CompatSoundEvent ENTITY_PHANTOM_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_AMBIENT); - public static final CompatSoundEvent ENTITY_PHANTOM_BITE = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_BITE); - public static final CompatSoundEvent ENTITY_PHANTOM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_DEATH); - public static final CompatSoundEvent ENTITY_PHANTOM_FLAP = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_FLAP); - public static final CompatSoundEvent ENTITY_PHANTOM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_HURT); - public static final CompatSoundEvent ENTITY_PHANTOM_SWOOP = new CompatSoundEvent(SoundEvents.ENTITY_PHANTOM_SWOOP); - public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIG_AMBIENT); - public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIG_DEATH); - public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIG_HURT); - public static final CompatSoundEvent ENTITY_PIG_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_PIG_SADDLE); - public static final CompatSoundEvent ENTITY_PIG_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIG_STEP); - public static final CompatSoundEvent ENTITY_PIGLIN_ADMIRING_ITEM = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_ADMIRING_ITEM); - public static final CompatSoundEvent ENTITY_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_PIGLIN_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_CELEBRATE); - public static final CompatSoundEvent ENTITY_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_DEATH); - public static final CompatSoundEvent ENTITY_PIGLIN_JEALOUS = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_JEALOUS); - public static final CompatSoundEvent ENTITY_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_HURT); - public static final CompatSoundEvent ENTITY_PIGLIN_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_RETREAT); - public static final CompatSoundEvent ENTITY_PIGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_STEP); - public static final CompatSoundEvent ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_AMBIENT); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_ANGRY); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_DEATH); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_HURT); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_STEP); - public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED); - public static final CompatSoundEvent ENTITY_PILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_PILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_CELEBRATE); - public static final CompatSoundEvent ENTITY_PILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_DEATH); - public static final CompatSoundEvent ENTITY_PILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PILLAGER_HURT); - public static final CompatSoundEvent BLOCK_PISTON_CONTRACT = new CompatSoundEvent(SoundEvents.BLOCK_PISTON_CONTRACT); - public static final CompatSoundEvent BLOCK_PISTON_EXTEND = new CompatSoundEvent(SoundEvents.BLOCK_PISTON_EXTEND); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_CRIT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_CRIT); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_KNOCKBACK = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_NODAMAGE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_STRONG = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_STRONG); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_SWEEP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP); - public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_WEAK = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_ATTACK_WEAK); - public static final CompatSoundEvent ENTITY_PLAYER_BIG_FALL = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BIG_FALL); - public static final CompatSoundEvent ENTITY_PLAYER_BREATH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BREATH); - public static final CompatSoundEvent ENTITY_PLAYER_BURP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_BURP); - public static final CompatSoundEvent ENTITY_PLAYER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_DEATH); - public static final CompatSoundEvent ENTITY_PLAYER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_DROWN = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_DROWN); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_FREEZE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_FREEZE); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_ON_FIRE = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_ON_FIRE); - public static final CompatSoundEvent ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH); - public static final CompatSoundEvent ENTITY_PLAYER_LEVELUP = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_LEVELUP); - public static final CompatSoundEvent ENTITY_PLAYER_SMALL_FALL = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SMALL_FALL); - public static final CompatSoundEvent ENTITY_PLAYER_SPLASH = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SPLASH); - public static final CompatSoundEvent ENTITY_PLAYER_SPLASH_HIGH_SPEED = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SPLASH_HIGH_SPEED); - public static final CompatSoundEvent ENTITY_PLAYER_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_SWIM); - public static final CompatSoundEvent ENTITY_PLAYER_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_PLAYER_TELEPORT); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_AMBIENT); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT_BABY = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_AMBIENT_BABY); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_DEATH); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_HURT = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_HURT); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_STEP = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_STEP); - public static final CompatSoundEvent ENTITY_POLAR_BEAR_WARNING = new CompatSoundEvent(SoundEvents.ENTITY_POLAR_BEAR_WARNING); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_BREAK); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_FALL); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_HIT); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_PLACE); - public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_DEEPSLATE_STEP); - public static final CompatSoundEvent BLOCK_PORTAL_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_AMBIENT); - public static final CompatSoundEvent BLOCK_PORTAL_TRAVEL = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_TRAVEL); - public static final CompatSoundEvent BLOCK_PORTAL_TRIGGER = new CompatSoundEvent(SoundEvents.BLOCK_PORTAL_TRIGGER); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_BREAK); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_FALL); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_HIT); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_PLACE); - public static final CompatSoundEvent BLOCK_POWDER_SNOW_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POWDER_SNOW_STEP); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_STING); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_OUT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_BLOW_OUT); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_UP = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_BLOW_UP); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_DEATH); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_FLOP); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_HURT); - public static final CompatSoundEvent ENTITY_PUFFER_FISH_STING = new CompatSoundEvent(SoundEvents.ENTITY_PUFFER_FISH_STING); - public static final CompatSoundEvent BLOCK_PUMPKIN_CARVE = new CompatSoundEvent(SoundEvents.BLOCK_PUMPKIN_CARVE); - public static final CompatSoundEvent ENTITY_RABBIT_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_AMBIENT); - public static final CompatSoundEvent ENTITY_RABBIT_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_ATTACK); - public static final CompatSoundEvent ENTITY_RABBIT_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_DEATH); - public static final CompatSoundEvent ENTITY_RABBIT_HURT = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_HURT); - public static final CompatSoundEvent ENTITY_RABBIT_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_RABBIT_JUMP); - public static final CompatSoundEvent EVENT_RAID_HORN = new CompatSoundEvent(SoundEvents.EVENT_RAID_HORN); - public static final CompatSoundEvent ENTITY_RAVAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_RAVAGER_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_ATTACK); - public static final CompatSoundEvent ENTITY_RAVAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_CELEBRATE); - public static final CompatSoundEvent ENTITY_RAVAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_DEATH); - public static final CompatSoundEvent ENTITY_RAVAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_HURT); - public static final CompatSoundEvent ENTITY_RAVAGER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_STEP); - public static final CompatSoundEvent ENTITY_RAVAGER_STUNNED = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_STUNNED); - public static final CompatSoundEvent ENTITY_RAVAGER_ROAR = new CompatSoundEvent(SoundEvents.ENTITY_RAVAGER_ROAR); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_FALL); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_HIT); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_GOLD_ORE_STEP); - public static final CompatSoundEvent BLOCK_NETHER_ORE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_BREAK); - public static final CompatSoundEvent BLOCK_NETHER_ORE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_FALL); - public static final CompatSoundEvent BLOCK_NETHER_ORE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_HIT); - public static final CompatSoundEvent BLOCK_NETHER_ORE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_PLACE); - public static final CompatSoundEvent BLOCK_NETHER_ORE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_NETHER_ORE_STEP); - public static final CompatSoundEvent BLOCK_REDSTONE_TORCH_BURNOUT = new CompatSoundEvent(SoundEvents.BLOCK_REDSTONE_TORCH_BURNOUT); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_AMBIENT); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_CHARGE = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_CHARGE); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_DEPLETE = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_DEPLETE); - public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_SET_SPAWN = new CompatSoundEvent(SoundEvents.BLOCK_RESPAWN_ANCHOR_SET_SPAWN); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_BREAK); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_FALL); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_HIT); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_PLACE); - public static final CompatSoundEvent BLOCK_ROOTED_DIRT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_ROOTED_DIRT_STEP); - public static final CompatSoundEvent ENTITY_SALMON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_AMBIENT); - public static final CompatSoundEvent ENTITY_SALMON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_DEATH); - public static final CompatSoundEvent ENTITY_SALMON_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_FLOP); - public static final CompatSoundEvent ENTITY_SALMON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SALMON_HURT); - public static final CompatSoundEvent BLOCK_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SAND_BREAK); - public static final CompatSoundEvent BLOCK_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SAND_FALL); - public static final CompatSoundEvent BLOCK_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SAND_HIT); - public static final CompatSoundEvent BLOCK_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SAND_PLACE); - public static final CompatSoundEvent BLOCK_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SAND_STEP); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_BREAK); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_FALL); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_HIT); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_PLACE); - public static final CompatSoundEvent BLOCK_SCAFFOLDING_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCAFFOLDING_STEP); - public static final CompatSoundEvent BLOCK_SCULK_SPREAD = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SPREAD); - public static final CompatSoundEvent BLOCK_SCULK_CHARGE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CHARGE); - public static final CompatSoundEvent BLOCK_SCULK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_FALL); - public static final CompatSoundEvent BLOCK_SCULK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_HIT); - public static final CompatSoundEvent BLOCK_SCULK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_STEP); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BLOOM = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_BLOOM); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_FALL); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_HIT); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_CATALYST_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_CATALYST_STEP); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_CLICKING); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING_STOP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_CLICKING_STOP); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_FALL); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_HIT); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_SENSOR_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SENSOR_STEP); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_FALL); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_HIT); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_SHRIEK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_SHRIEK); - public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_SHRIEKER_STEP); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_BREAK); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_FALL); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_HIT); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_PLACE); - public static final CompatSoundEvent BLOCK_SCULK_VEIN_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SCULK_VEIN_STEP); - public static final CompatSoundEvent ENTITY_SHEEP_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_AMBIENT); - public static final CompatSoundEvent ENTITY_SHEEP_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_DEATH); - public static final CompatSoundEvent ENTITY_SHEEP_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_HURT); - public static final CompatSoundEvent ENTITY_SHEEP_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_SHEAR); - public static final CompatSoundEvent ENTITY_SHEEP_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SHEEP_STEP); - public static final CompatSoundEvent ITEM_SHIELD_BLOCK = new CompatSoundEvent(SoundEvents.ITEM_SHIELD_BLOCK); - public static final CompatSoundEvent ITEM_SHIELD_BREAK = new CompatSoundEvent(SoundEvents.ITEM_SHIELD_BREAK); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_BREAK); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_STEP); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_PLACE); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_HIT); - public static final CompatSoundEvent BLOCK_SHROOMLIGHT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SHROOMLIGHT_FALL); - public static final CompatSoundEvent ITEM_SHOVEL_FLATTEN = new CompatSoundEvent(SoundEvents.ITEM_SHOVEL_FLATTEN); - public static final CompatSoundEvent ENTITY_SHULKER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_AMBIENT); - public static final CompatSoundEvent BLOCK_SHULKER_BOX_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_SHULKER_BOX_CLOSE); - public static final CompatSoundEvent BLOCK_SHULKER_BOX_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_SHULKER_BOX_OPEN); - public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HIT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_BULLET_HIT); - public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_BULLET_HURT); - public static final CompatSoundEvent ENTITY_SHULKER_CLOSE = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_CLOSE); - public static final CompatSoundEvent ENTITY_SHULKER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_DEATH); - public static final CompatSoundEvent ENTITY_SHULKER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_HURT); - public static final CompatSoundEvent ENTITY_SHULKER_HURT_CLOSED = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_HURT_CLOSED); - public static final CompatSoundEvent ENTITY_SHULKER_OPEN = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_OPEN); - public static final CompatSoundEvent ENTITY_SHULKER_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_SHOOT); - public static final CompatSoundEvent ENTITY_SHULKER_TELEPORT = new CompatSoundEvent(SoundEvents.ENTITY_SHULKER_TELEPORT); - public static final CompatSoundEvent ENTITY_SILVERFISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_AMBIENT); - public static final CompatSoundEvent ENTITY_SILVERFISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_DEATH); - public static final CompatSoundEvent ENTITY_SILVERFISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_HURT); - public static final CompatSoundEvent ENTITY_SILVERFISH_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SILVERFISH_STEP); - public static final CompatSoundEvent ENTITY_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_AMBIENT); - public static final CompatSoundEvent ENTITY_SKELETON_CONVERTED_TO_STRAY = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_CONVERTED_TO_STRAY); - public static final CompatSoundEvent ENTITY_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_DEATH); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_AMBIENT); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_DEATH); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_HURT); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_SWIM); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_AMBIENT_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_GALLOP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_GALLOP_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_JUMP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_JUMP_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HORSE_STEP_WATER = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HORSE_STEP_WATER); - public static final CompatSoundEvent ENTITY_SKELETON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_HURT); - public static final CompatSoundEvent ENTITY_SKELETON_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_SHOOT); - public static final CompatSoundEvent ENTITY_SKELETON_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SKELETON_STEP); - public static final CompatSoundEvent ENTITY_SLIME_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_ATTACK); - public static final CompatSoundEvent ENTITY_SLIME_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_DEATH); - public static final CompatSoundEvent ENTITY_SLIME_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_HURT); - public static final CompatSoundEvent ENTITY_SLIME_JUMP = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_JUMP); - public static final CompatSoundEvent ENTITY_SLIME_SQUISH = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_SQUISH); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_BREAK); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_FALL); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_HIT); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_PLACE); - public static final CompatSoundEvent BLOCK_SLIME_BLOCK_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SLIME_BLOCK_STEP); - public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_AMETHYST_BUD_BREAK); - public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_AMETHYST_BUD_PLACE); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_BREAK); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_FALL); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_HIT); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_PLACE); - public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SMALL_DRIPLEAF_STEP); - public static final CompatSoundEvent BLOCK_SOUL_SAND_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_BREAK); - public static final CompatSoundEvent BLOCK_SOUL_SAND_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_STEP); - public static final CompatSoundEvent BLOCK_SOUL_SAND_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_PLACE); - public static final CompatSoundEvent BLOCK_SOUL_SAND_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_HIT); - public static final CompatSoundEvent BLOCK_SOUL_SAND_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SAND_FALL); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_BREAK); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_STEP); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_PLACE); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_HIT); - public static final CompatSoundEvent BLOCK_SOUL_SOIL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SOUL_SOIL_FALL); - public static final CompatSoundEvent PARTICLE_SOUL_ESCAPE = new CompatSoundEvent(SoundEvents.PARTICLE_SOUL_ESCAPE); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_BREAK); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_FALL); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_HIT); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_PLACE); - public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SPORE_BLOSSOM_STEP); - public static final CompatSoundEvent ENTITY_STRIDER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_AMBIENT); - public static final CompatSoundEvent ENTITY_STRIDER_HAPPY = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_HAPPY); - public static final CompatSoundEvent ENTITY_STRIDER_RETREAT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_RETREAT); - public static final CompatSoundEvent ENTITY_STRIDER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_DEATH); - public static final CompatSoundEvent ENTITY_STRIDER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_HURT); - public static final CompatSoundEvent ENTITY_STRIDER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_STEP); - public static final CompatSoundEvent ENTITY_STRIDER_STEP_LAVA = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_STEP_LAVA); - public static final CompatSoundEvent ENTITY_STRIDER_EAT = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_EAT); - public static final CompatSoundEvent ENTITY_STRIDER_SADDLE = new CompatSoundEvent(SoundEvents.ENTITY_STRIDER_SADDLE); - public static final CompatSoundEvent ENTITY_SLIME_DEATH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_DEATH_SMALL); - public static final CompatSoundEvent ENTITY_SLIME_HURT_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_HURT_SMALL); - public static final CompatSoundEvent ENTITY_SLIME_JUMP_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_JUMP_SMALL); - public static final CompatSoundEvent ENTITY_SLIME_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.ENTITY_SLIME_SQUISH_SMALL); - public static final CompatSoundEvent BLOCK_SMITHING_TABLE_USE = new CompatSoundEvent(SoundEvents.BLOCK_SMITHING_TABLE_USE); - public static final CompatSoundEvent BLOCK_SMOKER_SMOKE = new CompatSoundEvent(SoundEvents.BLOCK_SMOKER_SMOKE); - public static final CompatSoundEvent ENTITY_SNIFFER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_STEP); - public static final CompatSoundEvent ENTITY_SNIFFER_EAT = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_EAT); - public static final CompatSoundEvent ENTITY_SNIFFER_IDLE = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_IDLE); - public static final CompatSoundEvent ENTITY_SNIFFER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_HURT); - public static final CompatSoundEvent ENTITY_SNIFFER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DEATH); - public static final CompatSoundEvent ENTITY_SNIFFER_DROP_SEED = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DROP_SEED); - public static final CompatSoundEvent ENTITY_SNIFFER_SCENTING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SCENTING); - public static final CompatSoundEvent ENTITY_SNIFFER_SNIFFING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SNIFFING); - public static final CompatSoundEvent ENTITY_SNIFFER_SEARCHING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_SEARCHING); - public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DIGGING); - public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING_STOP = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_DIGGING_STOP); - public static final CompatSoundEvent ENTITY_SNIFFER_HAPPY = new CompatSoundEvent(SoundEvents.ENTITY_SNIFFER_HAPPY); - public static final CompatSoundEvent BLOCK_SNIFFER_EGG_PLOP = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_PLOP); - public static final CompatSoundEvent BLOCK_SNIFFER_EGG_CRACK = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_CRACK); - public static final CompatSoundEvent BLOCK_SNIFFER_EGG_HATCH = new CompatSoundEvent(SoundEvents.BLOCK_SNIFFER_EGG_HATCH); - public static final CompatSoundEvent ENTITY_SNOWBALL_THROW = new CompatSoundEvent(SoundEvents.ENTITY_SNOWBALL_THROW); - public static final CompatSoundEvent BLOCK_SNOW_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_BREAK); - public static final CompatSoundEvent BLOCK_SNOW_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_FALL); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_AMBIENT); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_DEATH); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_HURT); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_SHOOT); - public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHEAR = new CompatSoundEvent(SoundEvents.ENTITY_SNOW_GOLEM_SHEAR); - public static final CompatSoundEvent BLOCK_SNOW_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_HIT); - public static final CompatSoundEvent BLOCK_SNOW_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_PLACE); - public static final CompatSoundEvent BLOCK_SNOW_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SNOW_STEP); - public static final CompatSoundEvent ENTITY_SPIDER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_AMBIENT); - public static final CompatSoundEvent ENTITY_SPIDER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_DEATH); - public static final CompatSoundEvent ENTITY_SPIDER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_HURT); - public static final CompatSoundEvent ENTITY_SPIDER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_SPIDER_STEP); - public static final CompatSoundEvent ENTITY_SPLASH_POTION_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_SPLASH_POTION_BREAK); - public static final CompatSoundEvent ENTITY_SPLASH_POTION_THROW = new CompatSoundEvent(SoundEvents.ENTITY_SPLASH_POTION_THROW); - public static final CompatSoundEvent BLOCK_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_BREAK); - public static final CompatSoundEvent BLOCK_SPONGE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_FALL); - public static final CompatSoundEvent BLOCK_SPONGE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_HIT); - public static final CompatSoundEvent BLOCK_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_PLACE); - public static final CompatSoundEvent BLOCK_SPONGE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_STEP); - public static final CompatSoundEvent BLOCK_SPONGE_ABSORB = new CompatSoundEvent(SoundEvents.BLOCK_SPONGE_ABSORB); - public static final CompatSoundEvent ITEM_SPYGLASS_USE = new CompatSoundEvent(SoundEvents.ITEM_SPYGLASS_USE); - public static final CompatSoundEvent ITEM_SPYGLASS_STOP_USING = new CompatSoundEvent(SoundEvents.ITEM_SPYGLASS_STOP_USING); - public static final CompatSoundEvent ENTITY_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_AMBIENT); - public static final CompatSoundEvent ENTITY_SQUID_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_DEATH); - public static final CompatSoundEvent ENTITY_SQUID_HURT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_HURT); - public static final CompatSoundEvent ENTITY_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.ENTITY_SQUID_SQUIRT); - public static final CompatSoundEvent BLOCK_STONE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BREAK); - public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_STONE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_STONE_FALL); - public static final CompatSoundEvent BLOCK_STONE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_STONE_HIT); - public static final CompatSoundEvent BLOCK_STONE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PLACE); - public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_STONE_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_STONE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_STONE_STEP); - public static final CompatSoundEvent ENTITY_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_AMBIENT); - public static final CompatSoundEvent ENTITY_STRAY_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_DEATH); - public static final CompatSoundEvent ENTITY_STRAY_HURT = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_HURT); - public static final CompatSoundEvent ENTITY_STRAY_STEP = new CompatSoundEvent(SoundEvents.ENTITY_STRAY_STEP); - public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_BREAK); - public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_PLACE); - public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES = new CompatSoundEvent(SoundEvents.BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES); - public static final CompatSoundEvent ENTITY_TADPOLE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_DEATH); - public static final CompatSoundEvent ENTITY_TADPOLE_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_FLOP); - public static final CompatSoundEvent ENTITY_TADPOLE_GROW_UP = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_GROW_UP); - public static final CompatSoundEvent ENTITY_TADPOLE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TADPOLE_HURT); - public static final CompatSoundEvent ENCHANT_THORNS_HIT = new CompatSoundEvent(SoundEvents.ENCHANT_THORNS_HIT); - public static final CompatSoundEvent ENTITY_TNT_PRIMED = new CompatSoundEvent(SoundEvents.ENTITY_TNT_PRIMED); - public static final CompatSoundEvent ITEM_TOTEM_USE = new CompatSoundEvent(SoundEvents.ITEM_TOTEM_USE); - public static final CompatSoundEvent ITEM_TRIDENT_HIT = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_HIT); - public static final CompatSoundEvent ITEM_TRIDENT_HIT_GROUND = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_HIT_GROUND); - public static final CompatSoundEvent ITEM_TRIDENT_RETURN = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RETURN); - public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_1 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_1); - public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_2 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_2); - public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_3 = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_RIPTIDE_3); - public static final CompatSoundEvent ITEM_TRIDENT_THROW = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_THROW); - public static final CompatSoundEvent ITEM_TRIDENT_THUNDER = new CompatSoundEvent(SoundEvents.ITEM_TRIDENT_THUNDER); - public static final CompatSoundEvent BLOCK_TRIPWIRE_ATTACH = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_ATTACH); - public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_CLICK_ON); - public static final CompatSoundEvent BLOCK_TRIPWIRE_DETACH = new CompatSoundEvent(SoundEvents.BLOCK_TRIPWIRE_DETACH); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_AMBIENT); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_DEATH); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_FLOP = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_FLOP); - public static final CompatSoundEvent ENTITY_TROPICAL_FISH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TROPICAL_FISH_HURT); - public static final CompatSoundEvent BLOCK_TUFF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BREAK); - public static final CompatSoundEvent BLOCK_TUFF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_STEP); - public static final CompatSoundEvent BLOCK_TUFF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_PLACE); - public static final CompatSoundEvent BLOCK_TUFF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_HIT); - public static final CompatSoundEvent BLOCK_TUFF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_FALL); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_BREAK); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_FALL); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_HIT); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_PLACE); - public static final CompatSoundEvent BLOCK_TUFF_BRICKS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_TUFF_BRICKS_STEP); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_BREAK); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_FALL = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_FALL); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_HIT = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_HIT); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_PLACE); - public static final CompatSoundEvent BLOCK_POLISHED_TUFF_STEP = new CompatSoundEvent(SoundEvents.BLOCK_POLISHED_TUFF_STEP); - public static final CompatSoundEvent ENTITY_TURTLE_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_AMBIENT_LAND); - public static final CompatSoundEvent ENTITY_TURTLE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_DEATH); - public static final CompatSoundEvent ENTITY_TURTLE_DEATH_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_DEATH_BABY); - public static final CompatSoundEvent ENTITY_TURTLE_EGG_BREAK = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_BREAK); - public static final CompatSoundEvent ENTITY_TURTLE_EGG_CRACK = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_CRACK); - public static final CompatSoundEvent ENTITY_TURTLE_EGG_HATCH = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_EGG_HATCH); - public static final CompatSoundEvent ENTITY_TURTLE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_HURT); - public static final CompatSoundEvent ENTITY_TURTLE_HURT_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_HURT_BABY); - public static final CompatSoundEvent ENTITY_TURTLE_LAY_EGG = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_LAY_EGG); - public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SHAMBLE); - public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE_BABY = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SHAMBLE_BABY); - public static final CompatSoundEvent ENTITY_TURTLE_SWIM = new CompatSoundEvent(SoundEvents.ENTITY_TURTLE_SWIM); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.NETHER_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_STEP = new CompatSoundEvent(SoundEvents.NETHER_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.NETHER_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_HIT = new CompatSoundEvent(SoundEvents.NETHER_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_NETHER_BRICKS_FALL = new CompatSoundEvent(SoundEvents.NETHER_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_NETHER_WART_BREAK = new CompatSoundEvent(SoundEvents.NETHER_WART_BREAK); + public static final CompatSoundEvent ITEM_NETHER_WART_PLANT = new CompatSoundEvent(SoundEvents.NETHER_WART_PLANTED); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_BREAK = new CompatSoundEvent(SoundEvents.NETHER_WOOD_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_FALL = new CompatSoundEvent(SoundEvents.NETHER_WOOD_FALL); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_HIT = new CompatSoundEvent(SoundEvents.NETHER_WOOD_HIT); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_PLACE = new CompatSoundEvent(SoundEvents.NETHER_WOOD_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_STEP = new CompatSoundEvent(SoundEvents.NETHER_WOOD_STEP); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.NETHER_WOOD_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_DOOR_OPEN = new CompatSoundEvent(SoundEvents.NETHER_WOOD_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.NETHER_WOOD_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.NETHER_WOOD_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.NETHER_WOOD_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.NETHER_WOOD_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.NETHER_WOOD_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_CLOSE = new CompatSoundEvent(SoundEvents.NETHER_WOOD_FENCE_GATE_CLOSE); + public static final CompatSoundEvent BLOCK_NETHER_WOOD_FENCE_GATE_OPEN = new CompatSoundEvent(SoundEvents.NETHER_WOOD_FENCE_GATE_OPEN); + public static final CompatSoundEvent INTENTIONALLY_EMPTY = new CompatSoundEvent(SoundEvents.EMPTY); + public static final CompatSoundEvent BLOCK_PACKED_MUD_BREAK = new CompatSoundEvent(SoundEvents.PACKED_MUD_BREAK); + public static final CompatSoundEvent BLOCK_PACKED_MUD_FALL = new CompatSoundEvent(SoundEvents.PACKED_MUD_FALL); + public static final CompatSoundEvent BLOCK_PACKED_MUD_HIT = new CompatSoundEvent(SoundEvents.PACKED_MUD_HIT); + public static final CompatSoundEvent BLOCK_PACKED_MUD_PLACE = new CompatSoundEvent(SoundEvents.PACKED_MUD_PLACE); + public static final CompatSoundEvent BLOCK_PACKED_MUD_STEP = new CompatSoundEvent(SoundEvents.PACKED_MUD_STEP); + public static final CompatSoundEvent BLOCK_STEM_BREAK = new CompatSoundEvent(SoundEvents.STEM_BREAK); + public static final CompatSoundEvent BLOCK_STEM_STEP = new CompatSoundEvent(SoundEvents.STEM_STEP); + public static final CompatSoundEvent BLOCK_STEM_PLACE = new CompatSoundEvent(SoundEvents.STEM_PLACE); + public static final CompatSoundEvent BLOCK_STEM_HIT = new CompatSoundEvent(SoundEvents.STEM_HIT); + public static final CompatSoundEvent BLOCK_STEM_FALL = new CompatSoundEvent(SoundEvents.STEM_FALL); + public static final CompatSoundEvent BLOCK_NYLIUM_BREAK = new CompatSoundEvent(SoundEvents.NYLIUM_BREAK); + public static final CompatSoundEvent BLOCK_NYLIUM_STEP = new CompatSoundEvent(SoundEvents.NYLIUM_STEP); + public static final CompatSoundEvent BLOCK_NYLIUM_PLACE = new CompatSoundEvent(SoundEvents.NYLIUM_PLACE); + public static final CompatSoundEvent BLOCK_NYLIUM_HIT = new CompatSoundEvent(SoundEvents.NYLIUM_HIT); + public static final CompatSoundEvent BLOCK_NYLIUM_FALL = new CompatSoundEvent(SoundEvents.NYLIUM_FALL); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_BREAK = new CompatSoundEvent(SoundEvents.NETHER_SPROUTS_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_STEP = new CompatSoundEvent(SoundEvents.NETHER_SPROUTS_STEP); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_PLACE = new CompatSoundEvent(SoundEvents.NETHER_SPROUTS_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_HIT = new CompatSoundEvent(SoundEvents.NETHER_SPROUTS_HIT); + public static final CompatSoundEvent BLOCK_NETHER_SPROUTS_FALL = new CompatSoundEvent(SoundEvents.NETHER_SPROUTS_FALL); + public static final CompatSoundEvent BLOCK_FUNGUS_BREAK = new CompatSoundEvent(SoundEvents.FUNGUS_BREAK); + public static final CompatSoundEvent BLOCK_FUNGUS_STEP = new CompatSoundEvent(SoundEvents.FUNGUS_STEP); + public static final CompatSoundEvent BLOCK_FUNGUS_PLACE = new CompatSoundEvent(SoundEvents.FUNGUS_PLACE); + public static final CompatSoundEvent BLOCK_FUNGUS_HIT = new CompatSoundEvent(SoundEvents.FUNGUS_HIT); + public static final CompatSoundEvent BLOCK_FUNGUS_FALL = new CompatSoundEvent(SoundEvents.FUNGUS_FALL); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_BREAK = new CompatSoundEvent(SoundEvents.WEEPING_VINES_BREAK); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_STEP = new CompatSoundEvent(SoundEvents.WEEPING_VINES_STEP); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_PLACE = new CompatSoundEvent(SoundEvents.WEEPING_VINES_PLACE); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_HIT = new CompatSoundEvent(SoundEvents.WEEPING_VINES_HIT); + public static final CompatSoundEvent BLOCK_WEEPING_VINES_FALL = new CompatSoundEvent(SoundEvents.WEEPING_VINES_FALL); + public static final CompatSoundEvent BLOCK_WART_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.WART_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_WART_BLOCK_STEP = new CompatSoundEvent(SoundEvents.WART_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_WART_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.WART_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_WART_BLOCK_HIT = new CompatSoundEvent(SoundEvents.WART_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_WART_BLOCK_FALL = new CompatSoundEvent(SoundEvents.WART_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.NETHERITE_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_STEP = new CompatSoundEvent(SoundEvents.NETHERITE_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.NETHERITE_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_HIT = new CompatSoundEvent(SoundEvents.NETHERITE_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_NETHERITE_BLOCK_FALL = new CompatSoundEvent(SoundEvents.NETHERITE_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_NETHERRACK_BREAK = new CompatSoundEvent(SoundEvents.NETHERRACK_BREAK); + public static final CompatSoundEvent BLOCK_NETHERRACK_STEP = new CompatSoundEvent(SoundEvents.NETHERRACK_STEP); + public static final CompatSoundEvent BLOCK_NETHERRACK_PLACE = new CompatSoundEvent(SoundEvents.NETHERRACK_PLACE); + public static final CompatSoundEvent BLOCK_NETHERRACK_HIT = new CompatSoundEvent(SoundEvents.NETHERRACK_HIT); + public static final CompatSoundEvent BLOCK_NETHERRACK_FALL = new CompatSoundEvent(SoundEvents.NETHERRACK_FALL); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASEDRUM = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_BASEDRUM); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BASS = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_BASS); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BELL = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_BELL); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_CHIME = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_CHIME); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_FLUTE = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_FLUTE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_GUITAR = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_GUITAR); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HARP = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_HARP); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_HAT = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_HAT); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_PLING = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_PLING); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_SNARE = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_SNARE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_XYLOPHONE = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_XYLOPHONE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IRON_XYLOPHONE = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_IRON_XYLOPHONE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_COW_BELL = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_COW_BELL); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_DIDGERIDOO = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_DIDGERIDOO); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BIT = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_BIT); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_BANJO = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_BANJO); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_IMITATE_ZOMBIE); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_IMITATE_SKELETON); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_IMITATE_CREEPER); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_IMITATE_ENDER_DRAGON); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_IMITATE_WITHER_SKELETON); + public static final CompatSoundEvent BLOCK_NOTE_BLOCK_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.NOTE_BLOCK_IMITATE_PIGLIN); + public static final CompatSoundEvent ENTITY_OCELOT_HURT = new CompatSoundEvent(SoundEvents.OCELOT_HURT); + public static final CompatSoundEvent ENTITY_OCELOT_AMBIENT = new CompatSoundEvent(SoundEvents.OCELOT_AMBIENT); + public static final CompatSoundEvent ENTITY_OCELOT_DEATH = new CompatSoundEvent(SoundEvents.OCELOT_DEATH); + public static final CompatSoundEvent ITEM_OMINOUS_BOTTLE_DISPOSE = new CompatSoundEvent(SoundEvents.OMINOUS_BOTTLE_DISPOSE); + public static final CompatSoundEvent ENTITY_PAINTING_BREAK = new CompatSoundEvent(SoundEvents.PAINTING_BREAK); + public static final CompatSoundEvent ENTITY_PAINTING_PLACE = new CompatSoundEvent(SoundEvents.PAINTING_PLACE); + public static final CompatSoundEvent ENTITY_PANDA_PRE_SNEEZE = new CompatSoundEvent(SoundEvents.PANDA_PRE_SNEEZE); + public static final CompatSoundEvent ENTITY_PANDA_SNEEZE = new CompatSoundEvent(SoundEvents.PANDA_SNEEZE); + public static final CompatSoundEvent ENTITY_PANDA_AMBIENT = new CompatSoundEvent(SoundEvents.PANDA_AMBIENT); + public static final CompatSoundEvent ENTITY_PANDA_DEATH = new CompatSoundEvent(SoundEvents.PANDA_DEATH); + public static final CompatSoundEvent ENTITY_PANDA_EAT = new CompatSoundEvent(SoundEvents.PANDA_EAT); + public static final CompatSoundEvent ENTITY_PANDA_STEP = new CompatSoundEvent(SoundEvents.PANDA_STEP); + public static final CompatSoundEvent ENTITY_PANDA_CANT_BREED = new CompatSoundEvent(SoundEvents.PANDA_CANT_BREED); + public static final CompatSoundEvent ENTITY_PANDA_AGGRESSIVE_AMBIENT = new CompatSoundEvent(SoundEvents.PANDA_AGGRESSIVE_AMBIENT); + public static final CompatSoundEvent ENTITY_PANDA_WORRIED_AMBIENT = new CompatSoundEvent(SoundEvents.PANDA_WORRIED_AMBIENT); + public static final CompatSoundEvent ENTITY_PANDA_HURT = new CompatSoundEvent(SoundEvents.PANDA_HURT); + public static final CompatSoundEvent ENTITY_PANDA_BITE = new CompatSoundEvent(SoundEvents.PANDA_BITE); + public static final CompatSoundEvent ENTITY_PARROT_AMBIENT = new CompatSoundEvent(SoundEvents.PARROT_AMBIENT); + public static final CompatSoundEvent ENTITY_PARROT_DEATH = new CompatSoundEvent(SoundEvents.PARROT_DEATH); + public static final CompatSoundEvent ENTITY_PARROT_EAT = new CompatSoundEvent(SoundEvents.PARROT_EAT); + public static final CompatSoundEvent ENTITY_PARROT_FLY = new CompatSoundEvent(SoundEvents.PARROT_FLY); + public static final CompatSoundEvent ENTITY_PARROT_HURT = new CompatSoundEvent(SoundEvents.PARROT_HURT); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BLAZE = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_BLAZE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BOGGED = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_BOGGED); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_BREEZE = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_BREEZE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_CREEPER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_CREEPER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_DROWNED = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_DROWNED); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ELDER_GUARDIAN = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_ELDER_GUARDIAN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDER_DRAGON = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_ENDER_DRAGON); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ENDERMITE = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_ENDERMITE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_EVOKER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_EVOKER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GHAST = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_GHAST); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_GUARDIAN = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_GUARDIAN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HOGLIN = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_HOGLIN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_HUSK = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_HUSK); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ILLUSIONER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_ILLUSIONER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_MAGMA_CUBE = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_MAGMA_CUBE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PHANTOM = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_PHANTOM); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_PIGLIN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PIGLIN_BRUTE = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_PIGLIN_BRUTE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_PILLAGER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_PILLAGER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_RAVAGER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_RAVAGER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SHULKER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_SHULKER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SILVERFISH = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_SILVERFISH); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SKELETON = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_SKELETON); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SLIME = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_SLIME); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_SPIDER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_SPIDER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_STRAY = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_STRAY); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VEX = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_VEX); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_VINDICATOR = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_VINDICATOR); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WARDEN = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_WARDEN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITCH = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_WITCH); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_WITHER); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_WITHER_SKELETON = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_WITHER_SKELETON); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOGLIN = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_ZOGLIN); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_ZOMBIE); + public static final CompatSoundEvent ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER = new CompatSoundEvent(SoundEvents.PARROT_IMITATE_ZOMBIE_VILLAGER); + public static final CompatSoundEvent ENTITY_PARROT_STEP = new CompatSoundEvent(SoundEvents.PARROT_STEP); + public static final CompatSoundEvent ENTITY_PHANTOM_AMBIENT = new CompatSoundEvent(SoundEvents.PHANTOM_AMBIENT); + public static final CompatSoundEvent ENTITY_PHANTOM_BITE = new CompatSoundEvent(SoundEvents.PHANTOM_BITE); + public static final CompatSoundEvent ENTITY_PHANTOM_DEATH = new CompatSoundEvent(SoundEvents.PHANTOM_DEATH); + public static final CompatSoundEvent ENTITY_PHANTOM_FLAP = new CompatSoundEvent(SoundEvents.PHANTOM_FLAP); + public static final CompatSoundEvent ENTITY_PHANTOM_HURT = new CompatSoundEvent(SoundEvents.PHANTOM_HURT); + public static final CompatSoundEvent ENTITY_PHANTOM_SWOOP = new CompatSoundEvent(SoundEvents.PHANTOM_SWOOP); + public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.PIG_AMBIENT); + public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.PIG_DEATH); + public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.PIG_HURT); + public static final CompatSoundEvent ENTITY_PIG_SADDLE = new CompatSoundEvent(SoundEvents.PIG_SADDLE); + public static final CompatSoundEvent ENTITY_PIG_STEP = new CompatSoundEvent(SoundEvents.PIG_STEP); + public static final CompatSoundEvent ENTITY_PIGLIN_ADMIRING_ITEM = new CompatSoundEvent(SoundEvents.PIGLIN_ADMIRING_ITEM); + public static final CompatSoundEvent ENTITY_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.PIGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.PIGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_PIGLIN_CELEBRATE = new CompatSoundEvent(SoundEvents.PIGLIN_CELEBRATE); + public static final CompatSoundEvent ENTITY_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.PIGLIN_DEATH); + public static final CompatSoundEvent ENTITY_PIGLIN_JEALOUS = new CompatSoundEvent(SoundEvents.PIGLIN_JEALOUS); + public static final CompatSoundEvent ENTITY_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.PIGLIN_HURT); + public static final CompatSoundEvent ENTITY_PIGLIN_RETREAT = new CompatSoundEvent(SoundEvents.PIGLIN_RETREAT); + public static final CompatSoundEvent ENTITY_PIGLIN_STEP = new CompatSoundEvent(SoundEvents.PIGLIN_STEP); + public static final CompatSoundEvent ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.PIGLIN_CONVERTED_TO_ZOMBIFIED); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_AMBIENT = new CompatSoundEvent(SoundEvents.PIGLIN_BRUTE_AMBIENT); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_ANGRY = new CompatSoundEvent(SoundEvents.PIGLIN_BRUTE_ANGRY); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_DEATH = new CompatSoundEvent(SoundEvents.PIGLIN_BRUTE_DEATH); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_HURT = new CompatSoundEvent(SoundEvents.PIGLIN_BRUTE_HURT); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_STEP = new CompatSoundEvent(SoundEvents.PIGLIN_BRUTE_STEP); + public static final CompatSoundEvent ENTITY_PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED = new CompatSoundEvent(SoundEvents.PIGLIN_BRUTE_CONVERTED_TO_ZOMBIFIED); + public static final CompatSoundEvent ENTITY_PILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.PILLAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_PILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.PILLAGER_CELEBRATE); + public static final CompatSoundEvent ENTITY_PILLAGER_DEATH = new CompatSoundEvent(SoundEvents.PILLAGER_DEATH); + public static final CompatSoundEvent ENTITY_PILLAGER_HURT = new CompatSoundEvent(SoundEvents.PILLAGER_HURT); + public static final CompatSoundEvent BLOCK_PISTON_CONTRACT = new CompatSoundEvent(SoundEvents.PISTON_CONTRACT); + public static final CompatSoundEvent BLOCK_PISTON_EXTEND = new CompatSoundEvent(SoundEvents.PISTON_EXTEND); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_CRIT = new CompatSoundEvent(SoundEvents.PLAYER_ATTACK_CRIT); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_KNOCKBACK = new CompatSoundEvent(SoundEvents.PLAYER_ATTACK_KNOCKBACK); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_NODAMAGE = new CompatSoundEvent(SoundEvents.PLAYER_ATTACK_NODAMAGE); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_STRONG = new CompatSoundEvent(SoundEvents.PLAYER_ATTACK_STRONG); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_SWEEP = new CompatSoundEvent(SoundEvents.PLAYER_ATTACK_SWEEP); + public static final CompatSoundEvent ENTITY_PLAYER_ATTACK_WEAK = new CompatSoundEvent(SoundEvents.PLAYER_ATTACK_WEAK); + public static final CompatSoundEvent ENTITY_PLAYER_BIG_FALL = new CompatSoundEvent(SoundEvents.PLAYER_BIG_FALL); + public static final CompatSoundEvent ENTITY_PLAYER_BREATH = new CompatSoundEvent(SoundEvents.PLAYER_BREATH); + public static final CompatSoundEvent ENTITY_PLAYER_BURP = new CompatSoundEvent(SoundEvents.PLAYER_BURP); + public static final CompatSoundEvent ENTITY_PLAYER_DEATH = new CompatSoundEvent(SoundEvents.PLAYER_DEATH); + public static final CompatSoundEvent ENTITY_PLAYER_HURT = new CompatSoundEvent(SoundEvents.PLAYER_HURT); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_DROWN = new CompatSoundEvent(SoundEvents.PLAYER_HURT_DROWN); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_FREEZE = new CompatSoundEvent(SoundEvents.PLAYER_HURT_FREEZE); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_ON_FIRE = new CompatSoundEvent(SoundEvents.PLAYER_HURT_ON_FIRE); + public static final CompatSoundEvent ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH = new CompatSoundEvent(SoundEvents.PLAYER_HURT_SWEET_BERRY_BUSH); + public static final CompatSoundEvent ENTITY_PLAYER_LEVELUP = new CompatSoundEvent(SoundEvents.PLAYER_LEVELUP); + public static final CompatSoundEvent ENTITY_PLAYER_SMALL_FALL = new CompatSoundEvent(SoundEvents.PLAYER_SMALL_FALL); + public static final CompatSoundEvent ENTITY_PLAYER_SPLASH = new CompatSoundEvent(SoundEvents.PLAYER_SPLASH); + public static final CompatSoundEvent ENTITY_PLAYER_SPLASH_HIGH_SPEED = new CompatSoundEvent(SoundEvents.PLAYER_SPLASH_HIGH_SPEED); + public static final CompatSoundEvent ENTITY_PLAYER_SWIM = new CompatSoundEvent(SoundEvents.PLAYER_SWIM); + public static final CompatSoundEvent ENTITY_PLAYER_TELEPORT = new CompatSoundEvent(SoundEvents.PLAYER_TELEPORT); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT = new CompatSoundEvent(SoundEvents.POLAR_BEAR_AMBIENT); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_AMBIENT_BABY = new CompatSoundEvent(SoundEvents.POLAR_BEAR_AMBIENT_BABY); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_DEATH = new CompatSoundEvent(SoundEvents.POLAR_BEAR_DEATH); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_HURT = new CompatSoundEvent(SoundEvents.POLAR_BEAR_HURT); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_STEP = new CompatSoundEvent(SoundEvents.POLAR_BEAR_STEP); + public static final CompatSoundEvent ENTITY_POLAR_BEAR_WARNING = new CompatSoundEvent(SoundEvents.POLAR_BEAR_WARNING); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_BREAK = new CompatSoundEvent(SoundEvents.POLISHED_DEEPSLATE_BREAK); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_FALL = new CompatSoundEvent(SoundEvents.POLISHED_DEEPSLATE_FALL); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_HIT = new CompatSoundEvent(SoundEvents.POLISHED_DEEPSLATE_HIT); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_PLACE = new CompatSoundEvent(SoundEvents.POLISHED_DEEPSLATE_PLACE); + public static final CompatSoundEvent BLOCK_POLISHED_DEEPSLATE_STEP = new CompatSoundEvent(SoundEvents.POLISHED_DEEPSLATE_STEP); + public static final CompatSoundEvent BLOCK_PORTAL_AMBIENT = new CompatSoundEvent(SoundEvents.PORTAL_AMBIENT); + public static final CompatSoundEvent BLOCK_PORTAL_TRAVEL = new CompatSoundEvent(SoundEvents.PORTAL_TRAVEL); + public static final CompatSoundEvent BLOCK_PORTAL_TRIGGER = new CompatSoundEvent(SoundEvents.PORTAL_TRIGGER); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_BREAK = new CompatSoundEvent(SoundEvents.POWDER_SNOW_BREAK); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_FALL = new CompatSoundEvent(SoundEvents.POWDER_SNOW_FALL); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_HIT = new CompatSoundEvent(SoundEvents.POWDER_SNOW_HIT); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_PLACE = new CompatSoundEvent(SoundEvents.POWDER_SNOW_PLACE); + public static final CompatSoundEvent BLOCK_POWDER_SNOW_STEP = new CompatSoundEvent(SoundEvents.POWDER_SNOW_STEP); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.PUFFER_FISH_STING); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_OUT = new CompatSoundEvent(SoundEvents.PUFFER_FISH_BLOW_OUT); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_BLOW_UP = new CompatSoundEvent(SoundEvents.PUFFER_FISH_BLOW_UP); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_DEATH = new CompatSoundEvent(SoundEvents.PUFFER_FISH_DEATH); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_FLOP = new CompatSoundEvent(SoundEvents.PUFFER_FISH_FLOP); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_HURT = new CompatSoundEvent(SoundEvents.PUFFER_FISH_HURT); + public static final CompatSoundEvent ENTITY_PUFFER_FISH_STING = new CompatSoundEvent(SoundEvents.PUFFER_FISH_STING); + public static final CompatSoundEvent BLOCK_PUMPKIN_CARVE = new CompatSoundEvent(SoundEvents.PUMPKIN_CARVE); + public static final CompatSoundEvent ENTITY_RABBIT_AMBIENT = new CompatSoundEvent(SoundEvents.RABBIT_AMBIENT); + public static final CompatSoundEvent ENTITY_RABBIT_ATTACK = new CompatSoundEvent(SoundEvents.RABBIT_ATTACK); + public static final CompatSoundEvent ENTITY_RABBIT_DEATH = new CompatSoundEvent(SoundEvents.RABBIT_DEATH); + public static final CompatSoundEvent ENTITY_RABBIT_HURT = new CompatSoundEvent(SoundEvents.RABBIT_HURT); + public static final CompatSoundEvent ENTITY_RABBIT_JUMP = new CompatSoundEvent(SoundEvents.RABBIT_JUMP); + public static final CompatSoundEvent EVENT_RAID_HORN = new CompatSoundEvent(SoundEvents.RAID_HORN); + public static final CompatSoundEvent ENTITY_RAVAGER_AMBIENT = new CompatSoundEvent(SoundEvents.RAVAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_RAVAGER_ATTACK = new CompatSoundEvent(SoundEvents.RAVAGER_ATTACK); + public static final CompatSoundEvent ENTITY_RAVAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.RAVAGER_CELEBRATE); + public static final CompatSoundEvent ENTITY_RAVAGER_DEATH = new CompatSoundEvent(SoundEvents.RAVAGER_DEATH); + public static final CompatSoundEvent ENTITY_RAVAGER_HURT = new CompatSoundEvent(SoundEvents.RAVAGER_HURT); + public static final CompatSoundEvent ENTITY_RAVAGER_STEP = new CompatSoundEvent(SoundEvents.RAVAGER_STEP); + public static final CompatSoundEvent ENTITY_RAVAGER_STUNNED = new CompatSoundEvent(SoundEvents.RAVAGER_STUNNED); + public static final CompatSoundEvent ENTITY_RAVAGER_ROAR = new CompatSoundEvent(SoundEvents.RAVAGER_ROAR); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_BREAK = new CompatSoundEvent(SoundEvents.NETHER_GOLD_ORE_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_FALL = new CompatSoundEvent(SoundEvents.NETHER_GOLD_ORE_FALL); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_HIT = new CompatSoundEvent(SoundEvents.NETHER_GOLD_ORE_HIT); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_PLACE = new CompatSoundEvent(SoundEvents.NETHER_GOLD_ORE_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_GOLD_ORE_STEP = new CompatSoundEvent(SoundEvents.NETHER_GOLD_ORE_STEP); + public static final CompatSoundEvent BLOCK_NETHER_ORE_BREAK = new CompatSoundEvent(SoundEvents.NETHER_ORE_BREAK); + public static final CompatSoundEvent BLOCK_NETHER_ORE_FALL = new CompatSoundEvent(SoundEvents.NETHER_ORE_FALL); + public static final CompatSoundEvent BLOCK_NETHER_ORE_HIT = new CompatSoundEvent(SoundEvents.NETHER_ORE_HIT); + public static final CompatSoundEvent BLOCK_NETHER_ORE_PLACE = new CompatSoundEvent(SoundEvents.NETHER_ORE_PLACE); + public static final CompatSoundEvent BLOCK_NETHER_ORE_STEP = new CompatSoundEvent(SoundEvents.NETHER_ORE_STEP); + public static final CompatSoundEvent BLOCK_REDSTONE_TORCH_BURNOUT = new CompatSoundEvent(SoundEvents.REDSTONE_TORCH_BURNOUT); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_AMBIENT = new CompatSoundEvent(SoundEvents.RESPAWN_ANCHOR_AMBIENT); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_CHARGE = new CompatSoundEvent(SoundEvents.RESPAWN_ANCHOR_CHARGE); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_DEPLETE = new CompatSoundEvent(SoundEvents.RESPAWN_ANCHOR_DEPLETE); + public static final CompatSoundEvent BLOCK_RESPAWN_ANCHOR_SET_SPAWN = new CompatSoundEvent(SoundEvents.RESPAWN_ANCHOR_SET_SPAWN); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_BREAK = new CompatSoundEvent(SoundEvents.ROOTED_DIRT_BREAK); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_FALL = new CompatSoundEvent(SoundEvents.ROOTED_DIRT_FALL); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_HIT = new CompatSoundEvent(SoundEvents.ROOTED_DIRT_HIT); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_PLACE = new CompatSoundEvent(SoundEvents.ROOTED_DIRT_PLACE); + public static final CompatSoundEvent BLOCK_ROOTED_DIRT_STEP = new CompatSoundEvent(SoundEvents.ROOTED_DIRT_STEP); + public static final CompatSoundEvent ENTITY_SALMON_AMBIENT = new CompatSoundEvent(SoundEvents.SALMON_AMBIENT); + public static final CompatSoundEvent ENTITY_SALMON_DEATH = new CompatSoundEvent(SoundEvents.SALMON_DEATH); + public static final CompatSoundEvent ENTITY_SALMON_FLOP = new CompatSoundEvent(SoundEvents.SALMON_FLOP); + public static final CompatSoundEvent ENTITY_SALMON_HURT = new CompatSoundEvent(SoundEvents.SALMON_HURT); + public static final CompatSoundEvent BLOCK_SAND_BREAK = new CompatSoundEvent(SoundEvents.SAND_BREAK); + public static final CompatSoundEvent BLOCK_SAND_FALL = new CompatSoundEvent(SoundEvents.SAND_FALL); + public static final CompatSoundEvent BLOCK_SAND_HIT = new CompatSoundEvent(SoundEvents.SAND_HIT); + public static final CompatSoundEvent BLOCK_SAND_PLACE = new CompatSoundEvent(SoundEvents.SAND_PLACE); + public static final CompatSoundEvent BLOCK_SAND_STEP = new CompatSoundEvent(SoundEvents.SAND_STEP); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_BREAK = new CompatSoundEvent(SoundEvents.SCAFFOLDING_BREAK); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_FALL = new CompatSoundEvent(SoundEvents.SCAFFOLDING_FALL); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_HIT = new CompatSoundEvent(SoundEvents.SCAFFOLDING_HIT); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_PLACE = new CompatSoundEvent(SoundEvents.SCAFFOLDING_PLACE); + public static final CompatSoundEvent BLOCK_SCAFFOLDING_STEP = new CompatSoundEvent(SoundEvents.SCAFFOLDING_STEP); + public static final CompatSoundEvent BLOCK_SCULK_SPREAD = new CompatSoundEvent(SoundEvents.SCULK_BLOCK_SPREAD); + public static final CompatSoundEvent BLOCK_SCULK_CHARGE = new CompatSoundEvent(SoundEvents.SCULK_BLOCK_CHARGE); + public static final CompatSoundEvent BLOCK_SCULK_BREAK = new CompatSoundEvent(SoundEvents.SCULK_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_FALL = new CompatSoundEvent(SoundEvents.SCULK_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_SCULK_HIT = new CompatSoundEvent(SoundEvents.SCULK_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_SCULK_PLACE = new CompatSoundEvent(SoundEvents.SCULK_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_STEP = new CompatSoundEvent(SoundEvents.SCULK_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BLOOM = new CompatSoundEvent(SoundEvents.SCULK_CATALYST_BLOOM); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_BREAK = new CompatSoundEvent(SoundEvents.SCULK_CATALYST_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_FALL = new CompatSoundEvent(SoundEvents.SCULK_CATALYST_FALL); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_HIT = new CompatSoundEvent(SoundEvents.SCULK_CATALYST_HIT); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_PLACE = new CompatSoundEvent(SoundEvents.SCULK_CATALYST_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_CATALYST_STEP = new CompatSoundEvent(SoundEvents.SCULK_CATALYST_STEP); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING = new CompatSoundEvent(SoundEvents.SCULK_CLICKING); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_CLICKING_STOP = new CompatSoundEvent(SoundEvents.SCULK_CLICKING_STOP); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_BREAK = new CompatSoundEvent(SoundEvents.SCULK_SENSOR_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_FALL = new CompatSoundEvent(SoundEvents.SCULK_SENSOR_FALL); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_HIT = new CompatSoundEvent(SoundEvents.SCULK_SENSOR_HIT); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_PLACE = new CompatSoundEvent(SoundEvents.SCULK_SENSOR_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_SENSOR_STEP = new CompatSoundEvent(SoundEvents.SCULK_SENSOR_STEP); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_BREAK = new CompatSoundEvent(SoundEvents.SCULK_SHRIEKER_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_FALL = new CompatSoundEvent(SoundEvents.SCULK_SHRIEKER_FALL); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_HIT = new CompatSoundEvent(SoundEvents.SCULK_SHRIEKER_HIT); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_PLACE = new CompatSoundEvent(SoundEvents.SCULK_SHRIEKER_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_SHRIEK = new CompatSoundEvent(SoundEvents.SCULK_SHRIEKER_SHRIEK); + public static final CompatSoundEvent BLOCK_SCULK_SHRIEKER_STEP = new CompatSoundEvent(SoundEvents.SCULK_SHRIEKER_STEP); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_BREAK = new CompatSoundEvent(SoundEvents.SCULK_VEIN_BREAK); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_FALL = new CompatSoundEvent(SoundEvents.SCULK_VEIN_FALL); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_HIT = new CompatSoundEvent(SoundEvents.SCULK_VEIN_HIT); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_PLACE = new CompatSoundEvent(SoundEvents.SCULK_VEIN_PLACE); + public static final CompatSoundEvent BLOCK_SCULK_VEIN_STEP = new CompatSoundEvent(SoundEvents.SCULK_VEIN_STEP); + public static final CompatSoundEvent ENTITY_SHEEP_AMBIENT = new CompatSoundEvent(SoundEvents.SHEEP_AMBIENT); + public static final CompatSoundEvent ENTITY_SHEEP_DEATH = new CompatSoundEvent(SoundEvents.SHEEP_DEATH); + public static final CompatSoundEvent ENTITY_SHEEP_HURT = new CompatSoundEvent(SoundEvents.SHEEP_HURT); + public static final CompatSoundEvent ENTITY_SHEEP_SHEAR = new CompatSoundEvent(SoundEvents.SHEEP_SHEAR); + public static final CompatSoundEvent ENTITY_SHEEP_STEP = new CompatSoundEvent(SoundEvents.SHEEP_STEP); + public static final CompatSoundEvent ITEM_SHIELD_BLOCK = new CompatSoundEvent(SoundEvents.SHIELD_BLOCK); + public static final CompatSoundEvent ITEM_SHIELD_BREAK = new CompatSoundEvent(SoundEvents.SHIELD_BREAK); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_BREAK = new CompatSoundEvent(SoundEvents.SHROOMLIGHT_BREAK); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_STEP = new CompatSoundEvent(SoundEvents.SHROOMLIGHT_STEP); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_PLACE = new CompatSoundEvent(SoundEvents.SHROOMLIGHT_PLACE); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_HIT = new CompatSoundEvent(SoundEvents.SHROOMLIGHT_HIT); + public static final CompatSoundEvent BLOCK_SHROOMLIGHT_FALL = new CompatSoundEvent(SoundEvents.SHROOMLIGHT_FALL); + public static final CompatSoundEvent ITEM_SHOVEL_FLATTEN = new CompatSoundEvent(SoundEvents.SHOVEL_FLATTEN); + public static final CompatSoundEvent ENTITY_SHULKER_AMBIENT = new CompatSoundEvent(SoundEvents.SHULKER_AMBIENT); + public static final CompatSoundEvent BLOCK_SHULKER_BOX_CLOSE = new CompatSoundEvent(SoundEvents.SHULKER_BOX_CLOSE); + public static final CompatSoundEvent BLOCK_SHULKER_BOX_OPEN = new CompatSoundEvent(SoundEvents.SHULKER_BOX_OPEN); + public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HIT = new CompatSoundEvent(SoundEvents.SHULKER_BULLET_HIT); + public static final CompatSoundEvent ENTITY_SHULKER_BULLET_HURT = new CompatSoundEvent(SoundEvents.SHULKER_BULLET_HURT); + public static final CompatSoundEvent ENTITY_SHULKER_CLOSE = new CompatSoundEvent(SoundEvents.SHULKER_CLOSE); + public static final CompatSoundEvent ENTITY_SHULKER_DEATH = new CompatSoundEvent(SoundEvents.SHULKER_DEATH); + public static final CompatSoundEvent ENTITY_SHULKER_HURT = new CompatSoundEvent(SoundEvents.SHULKER_HURT); + public static final CompatSoundEvent ENTITY_SHULKER_HURT_CLOSED = new CompatSoundEvent(SoundEvents.SHULKER_HURT_CLOSED); + public static final CompatSoundEvent ENTITY_SHULKER_OPEN = new CompatSoundEvent(SoundEvents.SHULKER_OPEN); + public static final CompatSoundEvent ENTITY_SHULKER_SHOOT = new CompatSoundEvent(SoundEvents.SHULKER_SHOOT); + public static final CompatSoundEvent ENTITY_SHULKER_TELEPORT = new CompatSoundEvent(SoundEvents.SHULKER_TELEPORT); + public static final CompatSoundEvent ENTITY_SILVERFISH_AMBIENT = new CompatSoundEvent(SoundEvents.SILVERFISH_AMBIENT); + public static final CompatSoundEvent ENTITY_SILVERFISH_DEATH = new CompatSoundEvent(SoundEvents.SILVERFISH_DEATH); + public static final CompatSoundEvent ENTITY_SILVERFISH_HURT = new CompatSoundEvent(SoundEvents.SILVERFISH_HURT); + public static final CompatSoundEvent ENTITY_SILVERFISH_STEP = new CompatSoundEvent(SoundEvents.SILVERFISH_STEP); + public static final CompatSoundEvent ENTITY_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.SKELETON_AMBIENT); + public static final CompatSoundEvent ENTITY_SKELETON_CONVERTED_TO_STRAY = new CompatSoundEvent(SoundEvents.SKELETON_CONVERTED_TO_STRAY); + public static final CompatSoundEvent ENTITY_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.SKELETON_DEATH); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_AMBIENT); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_DEATH = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_DEATH); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_HURT = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_HURT); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_SWIM = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_SWIM); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_AMBIENT_WATER = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_AMBIENT_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_GALLOP_WATER = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_GALLOP_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_JUMP_WATER = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_JUMP_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HORSE_STEP_WATER = new CompatSoundEvent(SoundEvents.SKELETON_HORSE_STEP_WATER); + public static final CompatSoundEvent ENTITY_SKELETON_HURT = new CompatSoundEvent(SoundEvents.SKELETON_HURT); + public static final CompatSoundEvent ENTITY_SKELETON_SHOOT = new CompatSoundEvent(SoundEvents.SKELETON_SHOOT); + public static final CompatSoundEvent ENTITY_SKELETON_STEP = new CompatSoundEvent(SoundEvents.SKELETON_STEP); + public static final CompatSoundEvent ENTITY_SLIME_ATTACK = new CompatSoundEvent(SoundEvents.SLIME_ATTACK); + public static final CompatSoundEvent ENTITY_SLIME_DEATH = new CompatSoundEvent(SoundEvents.SLIME_DEATH); + public static final CompatSoundEvent ENTITY_SLIME_HURT = new CompatSoundEvent(SoundEvents.SLIME_HURT); + public static final CompatSoundEvent ENTITY_SLIME_JUMP = new CompatSoundEvent(SoundEvents.SLIME_JUMP); + public static final CompatSoundEvent ENTITY_SLIME_SQUISH = new CompatSoundEvent(SoundEvents.SLIME_SQUISH); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_BREAK = new CompatSoundEvent(SoundEvents.SLIME_BLOCK_BREAK); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_FALL = new CompatSoundEvent(SoundEvents.SLIME_BLOCK_FALL); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_HIT = new CompatSoundEvent(SoundEvents.SLIME_BLOCK_HIT); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.SLIME_BLOCK_PLACE); + public static final CompatSoundEvent BLOCK_SLIME_BLOCK_STEP = new CompatSoundEvent(SoundEvents.SLIME_BLOCK_STEP); + public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_BREAK = new CompatSoundEvent(SoundEvents.SMALL_AMETHYST_BUD_BREAK); + public static final CompatSoundEvent BLOCK_SMALL_AMETHYST_BUD_PLACE = new CompatSoundEvent(SoundEvents.SMALL_AMETHYST_BUD_PLACE); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_BREAK = new CompatSoundEvent(SoundEvents.SMALL_DRIPLEAF_BREAK); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_FALL = new CompatSoundEvent(SoundEvents.SMALL_DRIPLEAF_FALL); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_HIT = new CompatSoundEvent(SoundEvents.SMALL_DRIPLEAF_HIT); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_PLACE = new CompatSoundEvent(SoundEvents.SMALL_DRIPLEAF_PLACE); + public static final CompatSoundEvent BLOCK_SMALL_DRIPLEAF_STEP = new CompatSoundEvent(SoundEvents.SMALL_DRIPLEAF_STEP); + public static final CompatSoundEvent BLOCK_SOUL_SAND_BREAK = new CompatSoundEvent(SoundEvents.SOUL_SAND_BREAK); + public static final CompatSoundEvent BLOCK_SOUL_SAND_STEP = new CompatSoundEvent(SoundEvents.SOUL_SAND_STEP); + public static final CompatSoundEvent BLOCK_SOUL_SAND_PLACE = new CompatSoundEvent(SoundEvents.SOUL_SAND_PLACE); + public static final CompatSoundEvent BLOCK_SOUL_SAND_HIT = new CompatSoundEvent(SoundEvents.SOUL_SAND_HIT); + public static final CompatSoundEvent BLOCK_SOUL_SAND_FALL = new CompatSoundEvent(SoundEvents.SOUL_SAND_FALL); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_BREAK = new CompatSoundEvent(SoundEvents.SOUL_SOIL_BREAK); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_STEP = new CompatSoundEvent(SoundEvents.SOUL_SOIL_STEP); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_PLACE = new CompatSoundEvent(SoundEvents.SOUL_SOIL_PLACE); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_HIT = new CompatSoundEvent(SoundEvents.SOUL_SOIL_HIT); + public static final CompatSoundEvent BLOCK_SOUL_SOIL_FALL = new CompatSoundEvent(SoundEvents.SOUL_SOIL_FALL); + public static final CompatSoundEvent PARTICLE_SOUL_ESCAPE = new CompatSoundEvent(SoundEvents.SOUL_ESCAPE); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_BREAK = new CompatSoundEvent(SoundEvents.SPORE_BLOSSOM_BREAK); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_FALL = new CompatSoundEvent(SoundEvents.SPORE_BLOSSOM_FALL); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_HIT = new CompatSoundEvent(SoundEvents.SPORE_BLOSSOM_HIT); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_PLACE = new CompatSoundEvent(SoundEvents.SPORE_BLOSSOM_PLACE); + public static final CompatSoundEvent BLOCK_SPORE_BLOSSOM_STEP = new CompatSoundEvent(SoundEvents.SPORE_BLOSSOM_STEP); + public static final CompatSoundEvent ENTITY_STRIDER_AMBIENT = new CompatSoundEvent(SoundEvents.STRIDER_AMBIENT); + public static final CompatSoundEvent ENTITY_STRIDER_HAPPY = new CompatSoundEvent(SoundEvents.STRIDER_HAPPY); + public static final CompatSoundEvent ENTITY_STRIDER_RETREAT = new CompatSoundEvent(SoundEvents.STRIDER_RETREAT); + public static final CompatSoundEvent ENTITY_STRIDER_DEATH = new CompatSoundEvent(SoundEvents.STRIDER_DEATH); + public static final CompatSoundEvent ENTITY_STRIDER_HURT = new CompatSoundEvent(SoundEvents.STRIDER_HURT); + public static final CompatSoundEvent ENTITY_STRIDER_STEP = new CompatSoundEvent(SoundEvents.STRIDER_STEP); + public static final CompatSoundEvent ENTITY_STRIDER_STEP_LAVA = new CompatSoundEvent(SoundEvents.STRIDER_STEP_LAVA); + public static final CompatSoundEvent ENTITY_STRIDER_EAT = new CompatSoundEvent(SoundEvents.STRIDER_EAT); + public static final CompatSoundEvent ENTITY_STRIDER_SADDLE = new CompatSoundEvent(SoundEvents.STRIDER_SADDLE); + public static final CompatSoundEvent ENTITY_SLIME_DEATH_SMALL = new CompatSoundEvent(SoundEvents.SLIME_DEATH_SMALL); + public static final CompatSoundEvent ENTITY_SLIME_HURT_SMALL = new CompatSoundEvent(SoundEvents.SLIME_HURT_SMALL); + public static final CompatSoundEvent ENTITY_SLIME_JUMP_SMALL = new CompatSoundEvent(SoundEvents.SLIME_JUMP_SMALL); + public static final CompatSoundEvent ENTITY_SLIME_SQUISH_SMALL = new CompatSoundEvent(SoundEvents.SLIME_SQUISH_SMALL); + public static final CompatSoundEvent BLOCK_SMITHING_TABLE_USE = new CompatSoundEvent(SoundEvents.SMITHING_TABLE_USE); + public static final CompatSoundEvent BLOCK_SMOKER_SMOKE = new CompatSoundEvent(SoundEvents.SMOKER_SMOKE); + public static final CompatSoundEvent ENTITY_SNIFFER_STEP = new CompatSoundEvent(SoundEvents.SNIFFER_STEP); + public static final CompatSoundEvent ENTITY_SNIFFER_EAT = new CompatSoundEvent(SoundEvents.SNIFFER_EAT); + public static final CompatSoundEvent ENTITY_SNIFFER_IDLE = new CompatSoundEvent(SoundEvents.SNIFFER_IDLE); + public static final CompatSoundEvent ENTITY_SNIFFER_HURT = new CompatSoundEvent(SoundEvents.SNIFFER_HURT); + public static final CompatSoundEvent ENTITY_SNIFFER_DEATH = new CompatSoundEvent(SoundEvents.SNIFFER_DEATH); + public static final CompatSoundEvent ENTITY_SNIFFER_DROP_SEED = new CompatSoundEvent(SoundEvents.SNIFFER_DROP_SEED); + public static final CompatSoundEvent ENTITY_SNIFFER_SCENTING = new CompatSoundEvent(SoundEvents.SNIFFER_SCENTING); + public static final CompatSoundEvent ENTITY_SNIFFER_SNIFFING = new CompatSoundEvent(SoundEvents.SNIFFER_SNIFFING); + public static final CompatSoundEvent ENTITY_SNIFFER_SEARCHING = new CompatSoundEvent(SoundEvents.SNIFFER_SEARCHING); + public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING = new CompatSoundEvent(SoundEvents.SNIFFER_DIGGING); + public static final CompatSoundEvent ENTITY_SNIFFER_DIGGING_STOP = new CompatSoundEvent(SoundEvents.SNIFFER_DIGGING_STOP); + public static final CompatSoundEvent ENTITY_SNIFFER_HAPPY = new CompatSoundEvent(SoundEvents.SNIFFER_HAPPY); + public static final CompatSoundEvent BLOCK_SNIFFER_EGG_PLOP = new CompatSoundEvent(SoundEvents.SNIFFER_EGG_PLOP); + public static final CompatSoundEvent BLOCK_SNIFFER_EGG_CRACK = new CompatSoundEvent(SoundEvents.SNIFFER_EGG_CRACK); + public static final CompatSoundEvent BLOCK_SNIFFER_EGG_HATCH = new CompatSoundEvent(SoundEvents.SNIFFER_EGG_HATCH); + public static final CompatSoundEvent ENTITY_SNOWBALL_THROW = new CompatSoundEvent(SoundEvents.SNOWBALL_THROW); + public static final CompatSoundEvent BLOCK_SNOW_BREAK = new CompatSoundEvent(SoundEvents.SNOW_BREAK); + public static final CompatSoundEvent BLOCK_SNOW_FALL = new CompatSoundEvent(SoundEvents.SNOW_FALL); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_AMBIENT = new CompatSoundEvent(SoundEvents.SNOW_GOLEM_AMBIENT); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_DEATH = new CompatSoundEvent(SoundEvents.SNOW_GOLEM_DEATH); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_HURT = new CompatSoundEvent(SoundEvents.SNOW_GOLEM_HURT); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHOOT = new CompatSoundEvent(SoundEvents.SNOW_GOLEM_SHOOT); + public static final CompatSoundEvent ENTITY_SNOW_GOLEM_SHEAR = new CompatSoundEvent(SoundEvents.SNOW_GOLEM_SHEAR); + public static final CompatSoundEvent BLOCK_SNOW_HIT = new CompatSoundEvent(SoundEvents.SNOW_HIT); + public static final CompatSoundEvent BLOCK_SNOW_PLACE = new CompatSoundEvent(SoundEvents.SNOW_PLACE); + public static final CompatSoundEvent BLOCK_SNOW_STEP = new CompatSoundEvent(SoundEvents.SNOW_STEP); + public static final CompatSoundEvent ENTITY_SPIDER_AMBIENT = new CompatSoundEvent(SoundEvents.SPIDER_AMBIENT); + public static final CompatSoundEvent ENTITY_SPIDER_DEATH = new CompatSoundEvent(SoundEvents.SPIDER_DEATH); + public static final CompatSoundEvent ENTITY_SPIDER_HURT = new CompatSoundEvent(SoundEvents.SPIDER_HURT); + public static final CompatSoundEvent ENTITY_SPIDER_STEP = new CompatSoundEvent(SoundEvents.SPIDER_STEP); + public static final CompatSoundEvent ENTITY_SPLASH_POTION_BREAK = new CompatSoundEvent(SoundEvents.SPLASH_POTION_BREAK); + public static final CompatSoundEvent ENTITY_SPLASH_POTION_THROW = new CompatSoundEvent(SoundEvents.SPLASH_POTION_THROW); + public static final CompatSoundEvent BLOCK_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.SPONGE_BREAK); + public static final CompatSoundEvent BLOCK_SPONGE_FALL = new CompatSoundEvent(SoundEvents.SPONGE_FALL); + public static final CompatSoundEvent BLOCK_SPONGE_HIT = new CompatSoundEvent(SoundEvents.SPONGE_HIT); + public static final CompatSoundEvent BLOCK_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.SPONGE_PLACE); + public static final CompatSoundEvent BLOCK_SPONGE_STEP = new CompatSoundEvent(SoundEvents.SPONGE_STEP); + public static final CompatSoundEvent BLOCK_SPONGE_ABSORB = new CompatSoundEvent(SoundEvents.SPONGE_ABSORB); + public static final CompatSoundEvent ITEM_SPYGLASS_USE = new CompatSoundEvent(SoundEvents.SPYGLASS_USE); + public static final CompatSoundEvent ITEM_SPYGLASS_STOP_USING = new CompatSoundEvent(SoundEvents.SPYGLASS_STOP_USING); + public static final CompatSoundEvent ENTITY_SQUID_AMBIENT = new CompatSoundEvent(SoundEvents.SQUID_AMBIENT); + public static final CompatSoundEvent ENTITY_SQUID_DEATH = new CompatSoundEvent(SoundEvents.SQUID_DEATH); + public static final CompatSoundEvent ENTITY_SQUID_HURT = new CompatSoundEvent(SoundEvents.SQUID_HURT); + public static final CompatSoundEvent ENTITY_SQUID_SQUIRT = new CompatSoundEvent(SoundEvents.SQUID_SQUIRT); + public static final CompatSoundEvent BLOCK_STONE_BREAK = new CompatSoundEvent(SoundEvents.STONE_BREAK); + public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.STONE_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_STONE_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.STONE_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_STONE_FALL = new CompatSoundEvent(SoundEvents.STONE_FALL); + public static final CompatSoundEvent BLOCK_STONE_HIT = new CompatSoundEvent(SoundEvents.STONE_HIT); + public static final CompatSoundEvent BLOCK_STONE_PLACE = new CompatSoundEvent(SoundEvents.STONE_PLACE); + public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.STONE_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_STONE_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.STONE_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_STONE_STEP = new CompatSoundEvent(SoundEvents.STONE_STEP); + public static final CompatSoundEvent ENTITY_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.STRAY_AMBIENT); + public static final CompatSoundEvent ENTITY_STRAY_DEATH = new CompatSoundEvent(SoundEvents.STRAY_DEATH); + public static final CompatSoundEvent ENTITY_STRAY_HURT = new CompatSoundEvent(SoundEvents.STRAY_HURT); + public static final CompatSoundEvent ENTITY_STRAY_STEP = new CompatSoundEvent(SoundEvents.STRAY_STEP); + public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_BREAK = new CompatSoundEvent(SoundEvents.SWEET_BERRY_BUSH_BREAK); + public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PLACE = new CompatSoundEvent(SoundEvents.SWEET_BERRY_BUSH_PLACE); + public static final CompatSoundEvent BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES = new CompatSoundEvent(SoundEvents.SWEET_BERRY_BUSH_PICK_BERRIES); + public static final CompatSoundEvent ENTITY_TADPOLE_DEATH = new CompatSoundEvent(SoundEvents.TADPOLE_DEATH); + public static final CompatSoundEvent ENTITY_TADPOLE_FLOP = new CompatSoundEvent(SoundEvents.TADPOLE_FLOP); + public static final CompatSoundEvent ENTITY_TADPOLE_GROW_UP = new CompatSoundEvent(SoundEvents.TADPOLE_GROW_UP); + public static final CompatSoundEvent ENTITY_TADPOLE_HURT = new CompatSoundEvent(SoundEvents.TADPOLE_HURT); + public static final CompatSoundEvent ENCHANT_THORNS_HIT = new CompatSoundEvent(SoundEvents.THORNS_HIT); + public static final CompatSoundEvent ENTITY_TNT_PRIMED = new CompatSoundEvent(SoundEvents.TNT_PRIMED); + public static final CompatSoundEvent ITEM_TOTEM_USE = new CompatSoundEvent(SoundEvents.TOTEM_USE); + public static final CompatSoundEvent ITEM_TRIDENT_HIT = new CompatSoundEvent(SoundEvents.TRIDENT_HIT); + public static final CompatSoundEvent ITEM_TRIDENT_HIT_GROUND = new CompatSoundEvent(SoundEvents.TRIDENT_HIT_GROUND); + public static final CompatSoundEvent ITEM_TRIDENT_RETURN = new CompatSoundEvent(SoundEvents.TRIDENT_RETURN); + public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_1 = new CompatSoundEvent(SoundEvents.TRIDENT_RIPTIDE_1); + public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_2 = new CompatSoundEvent(SoundEvents.TRIDENT_RIPTIDE_2); + public static final CompatSoundEvent ITEM_TRIDENT_RIPTIDE_3 = new CompatSoundEvent(SoundEvents.TRIDENT_RIPTIDE_3); + public static final CompatSoundEvent ITEM_TRIDENT_THROW = new CompatSoundEvent(SoundEvents.TRIDENT_THROW); + public static final CompatSoundEvent ITEM_TRIDENT_THUNDER = new CompatSoundEvent(SoundEvents.TRIDENT_THUNDER); + public static final CompatSoundEvent BLOCK_TRIPWIRE_ATTACH = new CompatSoundEvent(SoundEvents.TRIPWIRE_ATTACH); + public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_OFF = new CompatSoundEvent(SoundEvents.TRIPWIRE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_TRIPWIRE_CLICK_ON = new CompatSoundEvent(SoundEvents.TRIPWIRE_CLICK_ON); + public static final CompatSoundEvent BLOCK_TRIPWIRE_DETACH = new CompatSoundEvent(SoundEvents.TRIPWIRE_DETACH); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_AMBIENT = new CompatSoundEvent(SoundEvents.TROPICAL_FISH_AMBIENT); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_DEATH = new CompatSoundEvent(SoundEvents.TROPICAL_FISH_DEATH); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_FLOP = new CompatSoundEvent(SoundEvents.TROPICAL_FISH_FLOP); + public static final CompatSoundEvent ENTITY_TROPICAL_FISH_HURT = new CompatSoundEvent(SoundEvents.TROPICAL_FISH_HURT); + public static final CompatSoundEvent BLOCK_TUFF_BREAK = new CompatSoundEvent(SoundEvents.TUFF_BREAK); + public static final CompatSoundEvent BLOCK_TUFF_STEP = new CompatSoundEvent(SoundEvents.TUFF_STEP); + public static final CompatSoundEvent BLOCK_TUFF_PLACE = new CompatSoundEvent(SoundEvents.TUFF_PLACE); + public static final CompatSoundEvent BLOCK_TUFF_HIT = new CompatSoundEvent(SoundEvents.TUFF_HIT); + public static final CompatSoundEvent BLOCK_TUFF_FALL = new CompatSoundEvent(SoundEvents.TUFF_FALL); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_BREAK = new CompatSoundEvent(SoundEvents.TUFF_BRICKS_BREAK); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_FALL = new CompatSoundEvent(SoundEvents.TUFF_BRICKS_FALL); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_HIT = new CompatSoundEvent(SoundEvents.TUFF_BRICKS_HIT); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_PLACE = new CompatSoundEvent(SoundEvents.TUFF_BRICKS_PLACE); + public static final CompatSoundEvent BLOCK_TUFF_BRICKS_STEP = new CompatSoundEvent(SoundEvents.TUFF_BRICKS_STEP); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_BREAK = new CompatSoundEvent(SoundEvents.POLISHED_TUFF_BREAK); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_FALL = new CompatSoundEvent(SoundEvents.POLISHED_TUFF_FALL); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_HIT = new CompatSoundEvent(SoundEvents.POLISHED_TUFF_HIT); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_PLACE = new CompatSoundEvent(SoundEvents.POLISHED_TUFF_PLACE); + public static final CompatSoundEvent BLOCK_POLISHED_TUFF_STEP = new CompatSoundEvent(SoundEvents.POLISHED_TUFF_STEP); + public static final CompatSoundEvent ENTITY_TURTLE_AMBIENT_LAND = new CompatSoundEvent(SoundEvents.TURTLE_AMBIENT_LAND); + public static final CompatSoundEvent ENTITY_TURTLE_DEATH = new CompatSoundEvent(SoundEvents.TURTLE_DEATH); + public static final CompatSoundEvent ENTITY_TURTLE_DEATH_BABY = new CompatSoundEvent(SoundEvents.TURTLE_DEATH_BABY); + public static final CompatSoundEvent ENTITY_TURTLE_EGG_BREAK = new CompatSoundEvent(SoundEvents.TURTLE_EGG_BREAK); + public static final CompatSoundEvent ENTITY_TURTLE_EGG_CRACK = new CompatSoundEvent(SoundEvents.TURTLE_EGG_CRACK); + public static final CompatSoundEvent ENTITY_TURTLE_EGG_HATCH = new CompatSoundEvent(SoundEvents.TURTLE_EGG_HATCH); + public static final CompatSoundEvent ENTITY_TURTLE_HURT = new CompatSoundEvent(SoundEvents.TURTLE_HURT); + public static final CompatSoundEvent ENTITY_TURTLE_HURT_BABY = new CompatSoundEvent(SoundEvents.TURTLE_HURT_BABY); + public static final CompatSoundEvent ENTITY_TURTLE_LAY_EGG = new CompatSoundEvent(SoundEvents.TURTLE_LAY_EGG); + public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE = new CompatSoundEvent(SoundEvents.TURTLE_SHAMBLE); + public static final CompatSoundEvent ENTITY_TURTLE_SHAMBLE_BABY = new CompatSoundEvent(SoundEvents.TURTLE_SHAMBLE_BABY); + public static final CompatSoundEvent ENTITY_TURTLE_SWIM = new CompatSoundEvent(SoundEvents.TURTLE_SWIM); public static final CompatSoundEvent UI_BUTTON_CLICK = new CompatSoundEvent(SoundEvents.UI_BUTTON_CLICK); public static final CompatSoundEvent UI_LOOM_SELECT_PATTERN = new CompatSoundEvent(SoundEvents.UI_LOOM_SELECT_PATTERN); public static final CompatSoundEvent UI_LOOM_TAKE_RESULT = new CompatSoundEvent(SoundEvents.UI_LOOM_TAKE_RESULT); @@ -1435,191 +1435,191 @@ public class CompatSoundEvents { public static final CompatSoundEvent UI_TOAST_CHALLENGE_COMPLETE = new CompatSoundEvent(SoundEvents.UI_TOAST_CHALLENGE_COMPLETE); public static final CompatSoundEvent UI_TOAST_IN = new CompatSoundEvent(SoundEvents.UI_TOAST_IN); public static final CompatSoundEvent UI_TOAST_OUT = new CompatSoundEvent(SoundEvents.UI_TOAST_OUT); - public static final CompatSoundEvent BLOCK_VAULT_ACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_ACTIVATE); - public static final CompatSoundEvent BLOCK_VAULT_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_AMBIENT); - public static final CompatSoundEvent BLOCK_VAULT_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_BREAK); - public static final CompatSoundEvent BLOCK_VAULT_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_CLOSE_SHUTTER); - public static final CompatSoundEvent BLOCK_VAULT_DEACTIVATE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_DEACTIVATE); - public static final CompatSoundEvent BLOCK_VAULT_EJECT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_EJECT_ITEM); - public static final CompatSoundEvent BLOCK_VAULT_REJECT_REWARDED_PLAYER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_REJECT_REWARDED_PLAYER); - public static final CompatSoundEvent BLOCK_VAULT_FALL = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_FALL); - public static final CompatSoundEvent BLOCK_VAULT_HIT = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_HIT); - public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_INSERT_ITEM); - public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_INSERT_ITEM_FAIL); - public static final CompatSoundEvent BLOCK_VAULT_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_OPEN_SHUTTER); - public static final CompatSoundEvent BLOCK_VAULT_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_PLACE); - public static final CompatSoundEvent BLOCK_VAULT_STEP = new CompatSoundEvent(SoundEvents.BLOCK_VAULT_STEP); - public static final CompatSoundEvent ENTITY_VEX_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VEX_AMBIENT); - public static final CompatSoundEvent ENTITY_VEX_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_VEX_CHARGE); - public static final CompatSoundEvent ENTITY_VEX_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VEX_DEATH); - public static final CompatSoundEvent ENTITY_VEX_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VEX_HURT); - public static final CompatSoundEvent ENTITY_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_VILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_CELEBRATE); - public static final CompatSoundEvent ENTITY_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_DEATH); - public static final CompatSoundEvent ENTITY_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_HURT); - public static final CompatSoundEvent ENTITY_VILLAGER_NO = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_NO); - public static final CompatSoundEvent ENTITY_VILLAGER_TRADE = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_TRADE); - public static final CompatSoundEvent ENTITY_VILLAGER_YES = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_YES); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_ARMORER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_ARMORER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_BUTCHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_BUTCHER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CARTOGRAPHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_CARTOGRAPHER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CLERIC = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_CLERIC); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FARMER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FARMER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FISHERMAN = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FISHERMAN); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FLETCHER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_FLETCHER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LEATHERWORKER = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_LEATHERWORKER); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LIBRARIAN = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_LIBRARIAN); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_MASON = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_MASON); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_SHEPHERD = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_SHEPHERD); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_TOOLSMITH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH); - public static final CompatSoundEvent ENTITY_VILLAGER_WORK_WEAPONSMITH = new CompatSoundEvent(SoundEvents.ENTITY_VILLAGER_WORK_WEAPONSMITH); - public static final CompatSoundEvent ENTITY_VINDICATOR_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_AMBIENT); - public static final CompatSoundEvent ENTITY_VINDICATOR_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_CELEBRATE); - public static final CompatSoundEvent ENTITY_VINDICATOR_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_DEATH); - public static final CompatSoundEvent ENTITY_VINDICATOR_HURT = new CompatSoundEvent(SoundEvents.ENTITY_VINDICATOR_HURT); - public static final CompatSoundEvent BLOCK_VINE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_VINE_BREAK); - public static final CompatSoundEvent BLOCK_VINE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_VINE_FALL); - public static final CompatSoundEvent BLOCK_VINE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_VINE_HIT); - public static final CompatSoundEvent BLOCK_VINE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_VINE_PLACE); - public static final CompatSoundEvent BLOCK_VINE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_VINE_STEP); - public static final CompatSoundEvent BLOCK_LILY_PAD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_LILY_PAD_PLACE); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_AMBIENT); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DEATH); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DISAPPEARED = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DISAPPEARED); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_MILK = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DRINK_MILK); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_POTION = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_DRINK_POTION); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_HURT); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_NO = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_NO); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_REAPPEARED = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_REAPPEARED); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_TRADE = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_TRADE); - public static final CompatSoundEvent ENTITY_WANDERING_TRADER_YES = new CompatSoundEvent(SoundEvents.ENTITY_WANDERING_TRADER_YES); - public static final CompatSoundEvent ENTITY_WARDEN_AGITATED = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_AGITATED); - public static final CompatSoundEvent ENTITY_WARDEN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_AMBIENT); - public static final CompatSoundEvent ENTITY_WARDEN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ANGRY); - public static final CompatSoundEvent ENTITY_WARDEN_ATTACK_IMPACT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ATTACK_IMPACT); - public static final CompatSoundEvent ENTITY_WARDEN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_DEATH); - public static final CompatSoundEvent ENTITY_WARDEN_DIG = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_DIG); - public static final CompatSoundEvent ENTITY_WARDEN_EMERGE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_EMERGE); - public static final CompatSoundEvent ENTITY_WARDEN_HEARTBEAT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_HEARTBEAT); - public static final CompatSoundEvent ENTITY_WARDEN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_HURT); - public static final CompatSoundEvent ENTITY_WARDEN_LISTENING = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_LISTENING); - public static final CompatSoundEvent ENTITY_WARDEN_LISTENING_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_LISTENING_ANGRY); - public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSE); - public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSER = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSER); - public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSEST = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_NEARBY_CLOSEST); - public static final CompatSoundEvent ENTITY_WARDEN_ROAR = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_ROAR); - public static final CompatSoundEvent ENTITY_WARDEN_SNIFF = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SNIFF); - public static final CompatSoundEvent ENTITY_WARDEN_SONIC_BOOM = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SONIC_BOOM); - public static final CompatSoundEvent ENTITY_WARDEN_SONIC_CHARGE = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_SONIC_CHARGE); - public static final CompatSoundEvent ENTITY_WARDEN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_STEP); - public static final CompatSoundEvent ENTITY_WARDEN_TENDRIL_CLICKS = new CompatSoundEvent(SoundEvents.ENTITY_WARDEN_TENDRIL_CLICKS); - public static final CompatSoundEvent BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL); - public static final CompatSoundEvent BLOCK_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.BLOCK_SIGN_WAXED_INTERACT_FAIL); - public static final CompatSoundEvent BLOCK_WATER_AMBIENT = new CompatSoundEvent(SoundEvents.BLOCK_WATER_AMBIENT); + public static final CompatSoundEvent BLOCK_VAULT_ACTIVATE = new CompatSoundEvent(SoundEvents.VAULT_ACTIVATE); + public static final CompatSoundEvent BLOCK_VAULT_AMBIENT = new CompatSoundEvent(SoundEvents.VAULT_AMBIENT); + public static final CompatSoundEvent BLOCK_VAULT_BREAK = new CompatSoundEvent(SoundEvents.VAULT_BREAK); + public static final CompatSoundEvent BLOCK_VAULT_CLOSE_SHUTTER = new CompatSoundEvent(SoundEvents.VAULT_CLOSE_SHUTTER); + public static final CompatSoundEvent BLOCK_VAULT_DEACTIVATE = new CompatSoundEvent(SoundEvents.VAULT_DEACTIVATE); + public static final CompatSoundEvent BLOCK_VAULT_EJECT_ITEM = new CompatSoundEvent(SoundEvents.VAULT_EJECT_ITEM); + public static final CompatSoundEvent BLOCK_VAULT_REJECT_REWARDED_PLAYER = new CompatSoundEvent(SoundEvents.VAULT_REJECT_REWARDED_PLAYER); + public static final CompatSoundEvent BLOCK_VAULT_FALL = new CompatSoundEvent(SoundEvents.VAULT_FALL); + public static final CompatSoundEvent BLOCK_VAULT_HIT = new CompatSoundEvent(SoundEvents.VAULT_HIT); + public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM = new CompatSoundEvent(SoundEvents.VAULT_INSERT_ITEM); + public static final CompatSoundEvent BLOCK_VAULT_INSERT_ITEM_FAIL = new CompatSoundEvent(SoundEvents.VAULT_INSERT_ITEM_FAIL); + public static final CompatSoundEvent BLOCK_VAULT_OPEN_SHUTTER = new CompatSoundEvent(SoundEvents.VAULT_OPEN_SHUTTER); + public static final CompatSoundEvent BLOCK_VAULT_PLACE = new CompatSoundEvent(SoundEvents.VAULT_PLACE); + public static final CompatSoundEvent BLOCK_VAULT_STEP = new CompatSoundEvent(SoundEvents.VAULT_STEP); + public static final CompatSoundEvent ENTITY_VEX_AMBIENT = new CompatSoundEvent(SoundEvents.VEX_AMBIENT); + public static final CompatSoundEvent ENTITY_VEX_CHARGE = new CompatSoundEvent(SoundEvents.VEX_CHARGE); + public static final CompatSoundEvent ENTITY_VEX_DEATH = new CompatSoundEvent(SoundEvents.VEX_DEATH); + public static final CompatSoundEvent ENTITY_VEX_HURT = new CompatSoundEvent(SoundEvents.VEX_HURT); + public static final CompatSoundEvent ENTITY_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.VILLAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_VILLAGER_CELEBRATE = new CompatSoundEvent(SoundEvents.VILLAGER_CELEBRATE); + public static final CompatSoundEvent ENTITY_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.VILLAGER_DEATH); + public static final CompatSoundEvent ENTITY_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.VILLAGER_HURT); + public static final CompatSoundEvent ENTITY_VILLAGER_NO = new CompatSoundEvent(SoundEvents.VILLAGER_NO); + public static final CompatSoundEvent ENTITY_VILLAGER_TRADE = new CompatSoundEvent(SoundEvents.VILLAGER_TRADE); + public static final CompatSoundEvent ENTITY_VILLAGER_YES = new CompatSoundEvent(SoundEvents.VILLAGER_YES); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_ARMORER = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_ARMORER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_BUTCHER = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_BUTCHER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CARTOGRAPHER = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_CARTOGRAPHER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_CLERIC = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_CLERIC); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FARMER = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_FARMER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FISHERMAN = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_FISHERMAN); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_FLETCHER = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_FLETCHER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LEATHERWORKER = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_LEATHERWORKER); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_LIBRARIAN = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_LIBRARIAN); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_MASON = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_MASON); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_SHEPHERD = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_SHEPHERD); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_TOOLSMITH = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_TOOLSMITH); + public static final CompatSoundEvent ENTITY_VILLAGER_WORK_WEAPONSMITH = new CompatSoundEvent(SoundEvents.VILLAGER_WORK_WEAPONSMITH); + public static final CompatSoundEvent ENTITY_VINDICATOR_AMBIENT = new CompatSoundEvent(SoundEvents.VINDICATOR_AMBIENT); + public static final CompatSoundEvent ENTITY_VINDICATOR_CELEBRATE = new CompatSoundEvent(SoundEvents.VINDICATOR_CELEBRATE); + public static final CompatSoundEvent ENTITY_VINDICATOR_DEATH = new CompatSoundEvent(SoundEvents.VINDICATOR_DEATH); + public static final CompatSoundEvent ENTITY_VINDICATOR_HURT = new CompatSoundEvent(SoundEvents.VINDICATOR_HURT); + public static final CompatSoundEvent BLOCK_VINE_BREAK = new CompatSoundEvent(SoundEvents.VINE_BREAK); + public static final CompatSoundEvent BLOCK_VINE_FALL = new CompatSoundEvent(SoundEvents.VINE_FALL); + public static final CompatSoundEvent BLOCK_VINE_HIT = new CompatSoundEvent(SoundEvents.VINE_HIT); + public static final CompatSoundEvent BLOCK_VINE_PLACE = new CompatSoundEvent(SoundEvents.VINE_PLACE); + public static final CompatSoundEvent BLOCK_VINE_STEP = new CompatSoundEvent(SoundEvents.VINE_STEP); + public static final CompatSoundEvent BLOCK_LILY_PAD_PLACE = new CompatSoundEvent(SoundEvents.LILY_PAD_PLACE); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_AMBIENT = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_AMBIENT); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DEATH = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_DEATH); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DISAPPEARED = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_DISAPPEARED); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_MILK = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_DRINK_MILK); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_DRINK_POTION = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_DRINK_POTION); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_HURT = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_HURT); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_NO = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_NO); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_REAPPEARED = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_REAPPEARED); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_TRADE = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_TRADE); + public static final CompatSoundEvent ENTITY_WANDERING_TRADER_YES = new CompatSoundEvent(SoundEvents.WANDERING_TRADER_YES); + public static final CompatSoundEvent ENTITY_WARDEN_AGITATED = new CompatSoundEvent(SoundEvents.WARDEN_AGITATED); + public static final CompatSoundEvent ENTITY_WARDEN_AMBIENT = new CompatSoundEvent(SoundEvents.WARDEN_AMBIENT); + public static final CompatSoundEvent ENTITY_WARDEN_ANGRY = new CompatSoundEvent(SoundEvents.WARDEN_ANGRY); + public static final CompatSoundEvent ENTITY_WARDEN_ATTACK_IMPACT = new CompatSoundEvent(SoundEvents.WARDEN_ATTACK_IMPACT); + public static final CompatSoundEvent ENTITY_WARDEN_DEATH = new CompatSoundEvent(SoundEvents.WARDEN_DEATH); + public static final CompatSoundEvent ENTITY_WARDEN_DIG = new CompatSoundEvent(SoundEvents.WARDEN_DIG); + public static final CompatSoundEvent ENTITY_WARDEN_EMERGE = new CompatSoundEvent(SoundEvents.WARDEN_EMERGE); + public static final CompatSoundEvent ENTITY_WARDEN_HEARTBEAT = new CompatSoundEvent(SoundEvents.WARDEN_HEARTBEAT); + public static final CompatSoundEvent ENTITY_WARDEN_HURT = new CompatSoundEvent(SoundEvents.WARDEN_HURT); + public static final CompatSoundEvent ENTITY_WARDEN_LISTENING = new CompatSoundEvent(SoundEvents.WARDEN_LISTENING); + public static final CompatSoundEvent ENTITY_WARDEN_LISTENING_ANGRY = new CompatSoundEvent(SoundEvents.WARDEN_LISTENING_ANGRY); + public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSE = new CompatSoundEvent(SoundEvents.WARDEN_NEARBY_CLOSE); + public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSER = new CompatSoundEvent(SoundEvents.WARDEN_NEARBY_CLOSER); + public static final CompatSoundEvent ENTITY_WARDEN_NEARBY_CLOSEST = new CompatSoundEvent(SoundEvents.WARDEN_NEARBY_CLOSEST); + public static final CompatSoundEvent ENTITY_WARDEN_ROAR = new CompatSoundEvent(SoundEvents.WARDEN_ROAR); + public static final CompatSoundEvent ENTITY_WARDEN_SNIFF = new CompatSoundEvent(SoundEvents.WARDEN_SNIFF); + public static final CompatSoundEvent ENTITY_WARDEN_SONIC_BOOM = new CompatSoundEvent(SoundEvents.WARDEN_SONIC_BOOM); + public static final CompatSoundEvent ENTITY_WARDEN_SONIC_CHARGE = new CompatSoundEvent(SoundEvents.WARDEN_SONIC_CHARGE); + public static final CompatSoundEvent ENTITY_WARDEN_STEP = new CompatSoundEvent(SoundEvents.WARDEN_STEP); + public static final CompatSoundEvent ENTITY_WARDEN_TENDRIL_CLICKS = new CompatSoundEvent(SoundEvents.WARDEN_TENDRIL_CLICKS); + public static final CompatSoundEvent BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.WAXED_HANGING_SIGN_INTERACT_FAIL); + public static final CompatSoundEvent BLOCK_SIGN_WAXED_INTERACT_FAIL = new CompatSoundEvent(SoundEvents.WAXED_SIGN_INTERACT_FAIL); + public static final CompatSoundEvent BLOCK_WATER_AMBIENT = new CompatSoundEvent(SoundEvents.WATER_AMBIENT); public static final CompatSoundEvent WEATHER_RAIN = new CompatSoundEvent(SoundEvents.WEATHER_RAIN); public static final CompatSoundEvent WEATHER_RAIN_ABOVE = new CompatSoundEvent(SoundEvents.WEATHER_RAIN_ABOVE); - public static final CompatSoundEvent BLOCK_WET_GRASS_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_BREAK); - public static final CompatSoundEvent BLOCK_WET_GRASS_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_FALL); - public static final CompatSoundEvent BLOCK_WET_GRASS_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_HIT); - public static final CompatSoundEvent BLOCK_WET_GRASS_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_PLACE); - public static final CompatSoundEvent BLOCK_WET_GRASS_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WET_GRASS_STEP); - public static final CompatSoundEvent BLOCK_WET_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_BREAK); - public static final CompatSoundEvent BLOCK_WET_SPONGE_DRIES = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_DRIES); - public static final CompatSoundEvent BLOCK_WET_SPONGE_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_FALL); - public static final CompatSoundEvent BLOCK_WET_SPONGE_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_HIT); - public static final CompatSoundEvent BLOCK_WET_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_PLACE); - public static final CompatSoundEvent BLOCK_WET_SPONGE_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WET_SPONGE_STEP); - public static final CompatSoundEvent ENTITY_WIND_CHARGE_WIND_BURST = new CompatSoundEvent(SoundEvents.ENTITY_WIND_CHARGE_WIND_BURST); - public static final CompatSoundEvent ENTITY_WIND_CHARGE_THROW = new CompatSoundEvent(SoundEvents.ENTITY_WIND_CHARGE_THROW); - public static final CompatSoundEvent ENTITY_WITCH_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_AMBIENT); - public static final CompatSoundEvent ENTITY_WITCH_CELEBRATE = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_CELEBRATE); - public static final CompatSoundEvent ENTITY_WITCH_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_DEATH); - public static final CompatSoundEvent ENTITY_WITCH_DRINK = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_DRINK); - public static final CompatSoundEvent ENTITY_WITCH_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_HURT); - public static final CompatSoundEvent ENTITY_WITCH_THROW = new CompatSoundEvent(SoundEvents.ENTITY_WITCH_THROW); - public static final CompatSoundEvent ENTITY_WITHER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_AMBIENT); - public static final CompatSoundEvent ENTITY_WITHER_BREAK_BLOCK = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_BREAK_BLOCK); - public static final CompatSoundEvent ENTITY_WITHER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_DEATH); - public static final CompatSoundEvent ENTITY_WITHER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_HURT); - public static final CompatSoundEvent ENTITY_WITHER_SHOOT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SHOOT); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_AMBIENT); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_DEATH); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_HURT = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_HURT); - public static final CompatSoundEvent ENTITY_WITHER_SKELETON_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SKELETON_STEP); - public static final CompatSoundEvent ENTITY_WITHER_SPAWN = new CompatSoundEvent(SoundEvents.ENTITY_WITHER_SPAWN); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_BREAK = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_BREAK); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_CRACK = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_CRACK); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_DAMAGE = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_DAMAGE); - public static final CompatSoundEvent ITEM_WOLF_ARMOR_REPAIR = new CompatSoundEvent(SoundEvents.ITEM_WOLF_ARMOR_REPAIR); - public static final CompatSoundEvent ENTITY_WOLF_AMBIENT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).ambientSound()); - public static final CompatSoundEvent ENTITY_WOLF_DEATH = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).deathSound()); - public static final CompatSoundEvent ENTITY_WOLF_GROWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).growlSound()); - public static final CompatSoundEvent ENTITY_WOLF_HOWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).ambientSound()); - public static final CompatSoundEvent ENTITY_WOLF_HURT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).hurtSound()); - public static final CompatSoundEvent ENTITY_WOLF_PANT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).pantSound()); - public static final CompatSoundEvent ENTITY_WOLF_SHAKE = new CompatSoundEvent(SoundEvents.ENTITY_WOLF_SHAKE); - public static final CompatSoundEvent ENTITY_WOLF_STEP = new CompatSoundEvent(SoundEvents.ENTITY_WOLF_STEP); - public static final CompatSoundEvent ENTITY_WOLF_WHINE = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.CLASSIC).whineSound()); - public static final CompatSoundEvent BLOCK_WOODEN_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_DOOR_CLOSE); - public static final CompatSoundEvent BLOCK_WOODEN_DOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_DOOR_OPEN); - public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE); - public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN); - public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF); - public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON); - public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF); - public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON); - public static final CompatSoundEvent BLOCK_WOOD_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_BREAK); - public static final CompatSoundEvent BLOCK_WOOD_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_FALL); - public static final CompatSoundEvent BLOCK_WOOD_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_HIT); - public static final CompatSoundEvent BLOCK_WOOD_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_PLACE); - public static final CompatSoundEvent BLOCK_WOOD_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WOOD_STEP); - public static final CompatSoundEvent BLOCK_WOOL_BREAK = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_BREAK); - public static final CompatSoundEvent BLOCK_WOOL_FALL = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_FALL); - public static final CompatSoundEvent BLOCK_WOOL_HIT = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_HIT); - public static final CompatSoundEvent BLOCK_WOOL_PLACE = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_PLACE); - public static final CompatSoundEvent BLOCK_WOOL_STEP = new CompatSoundEvent(SoundEvents.BLOCK_WOOL_STEP); - public static final CompatSoundEvent ENTITY_ZOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_ZOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_ATTACK); - public static final CompatSoundEvent ENTITY_ZOGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_DEATH); - public static final CompatSoundEvent ENTITY_ZOGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_HURT); - public static final CompatSoundEvent ENTITY_ZOGLIN_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOGLIN_STEP); - public static final CompatSoundEvent ENTITY_ZOMBIE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR); - public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_IRON_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_ATTACK_IRON_DOOR); - public static final CompatSoundEvent ENTITY_ZOMBIE_BREAK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR); - public static final CompatSoundEvent ENTITY_ZOMBIE_CONVERTED_TO_DROWNED = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_CONVERTED_TO_DROWNED); - public static final CompatSoundEvent ENTITY_ZOMBIE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIE_DESTROY_EGG = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_DESTROY_EGG); - public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HORSE_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_INFECT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_INFECT); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_ANGRY); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIFIED_PIGLIN_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_STEP); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_AMBIENT); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CONVERTED = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CONVERTED); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CURE = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_DEATH); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_HURT); - public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_STEP = new CompatSoundEvent(SoundEvents.ENTITY_ZOMBIE_VILLAGER_STEP); - public static final CompatSoundEvent EVENT_MOB_EFFECT_BAD_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_BAD_OMEN); - public static final CompatSoundEvent EVENT_MOB_EFFECT_TRIAL_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_TRIAL_OMEN); - public static final CompatSoundEvent EVENT_MOB_EFFECT_RAID_OMEN = new CompatSoundEvent(SoundEvents.EVENT_MOB_EFFECT_RAID_OMEN); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_EQUIP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_EQUIP); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_AMBIENT); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_DEATH); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HURT = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HURT); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_RIDING = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_RIDING); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP); - public static final CompatSoundEvent ENTITY_HAPPY_GHAST_UNEQUIP = new CompatSoundEvent(SoundEvents.ENTITY_HAPPY_GHAST_UNEQUIP); + public static final CompatSoundEvent BLOCK_WET_GRASS_BREAK = new CompatSoundEvent(SoundEvents.WET_GRASS_BREAK); + public static final CompatSoundEvent BLOCK_WET_GRASS_FALL = new CompatSoundEvent(SoundEvents.WET_GRASS_FALL); + public static final CompatSoundEvent BLOCK_WET_GRASS_HIT = new CompatSoundEvent(SoundEvents.WET_GRASS_HIT); + public static final CompatSoundEvent BLOCK_WET_GRASS_PLACE = new CompatSoundEvent(SoundEvents.WET_GRASS_PLACE); + public static final CompatSoundEvent BLOCK_WET_GRASS_STEP = new CompatSoundEvent(SoundEvents.WET_GRASS_STEP); + public static final CompatSoundEvent BLOCK_WET_SPONGE_BREAK = new CompatSoundEvent(SoundEvents.WET_SPONGE_BREAK); + public static final CompatSoundEvent BLOCK_WET_SPONGE_DRIES = new CompatSoundEvent(SoundEvents.WET_SPONGE_DRIES); + public static final CompatSoundEvent BLOCK_WET_SPONGE_FALL = new CompatSoundEvent(SoundEvents.WET_SPONGE_FALL); + public static final CompatSoundEvent BLOCK_WET_SPONGE_HIT = new CompatSoundEvent(SoundEvents.WET_SPONGE_HIT); + public static final CompatSoundEvent BLOCK_WET_SPONGE_PLACE = new CompatSoundEvent(SoundEvents.WET_SPONGE_PLACE); + public static final CompatSoundEvent BLOCK_WET_SPONGE_STEP = new CompatSoundEvent(SoundEvents.WET_SPONGE_STEP); + public static final CompatSoundEvent ENTITY_WIND_CHARGE_WIND_BURST = new CompatSoundEvent(SoundEvents.WIND_CHARGE_BURST); + public static final CompatSoundEvent ENTITY_WIND_CHARGE_THROW = new CompatSoundEvent(SoundEvents.WIND_CHARGE_THROW); + public static final CompatSoundEvent ENTITY_WITCH_AMBIENT = new CompatSoundEvent(SoundEvents.WITCH_AMBIENT); + public static final CompatSoundEvent ENTITY_WITCH_CELEBRATE = new CompatSoundEvent(SoundEvents.WITCH_CELEBRATE); + public static final CompatSoundEvent ENTITY_WITCH_DEATH = new CompatSoundEvent(SoundEvents.WITCH_DEATH); + public static final CompatSoundEvent ENTITY_WITCH_DRINK = new CompatSoundEvent(SoundEvents.WITCH_DRINK); + public static final CompatSoundEvent ENTITY_WITCH_HURT = new CompatSoundEvent(SoundEvents.WITCH_HURT); + public static final CompatSoundEvent ENTITY_WITCH_THROW = new CompatSoundEvent(SoundEvents.WITCH_THROW); + public static final CompatSoundEvent ENTITY_WITHER_AMBIENT = new CompatSoundEvent(SoundEvents.WITHER_AMBIENT); + public static final CompatSoundEvent ENTITY_WITHER_BREAK_BLOCK = new CompatSoundEvent(SoundEvents.WITHER_BREAK_BLOCK); + public static final CompatSoundEvent ENTITY_WITHER_DEATH = new CompatSoundEvent(SoundEvents.WITHER_DEATH); + public static final CompatSoundEvent ENTITY_WITHER_HURT = new CompatSoundEvent(SoundEvents.WITHER_HURT); + public static final CompatSoundEvent ENTITY_WITHER_SHOOT = new CompatSoundEvent(SoundEvents.WITHER_SHOOT); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_AMBIENT = new CompatSoundEvent(SoundEvents.WITHER_SKELETON_AMBIENT); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_DEATH = new CompatSoundEvent(SoundEvents.WITHER_SKELETON_DEATH); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_HURT = new CompatSoundEvent(SoundEvents.WITHER_SKELETON_HURT); + public static final CompatSoundEvent ENTITY_WITHER_SKELETON_STEP = new CompatSoundEvent(SoundEvents.WITHER_SKELETON_STEP); + public static final CompatSoundEvent ENTITY_WITHER_SPAWN = new CompatSoundEvent(SoundEvents.WITHER_SPAWN); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_BREAK = new CompatSoundEvent(SoundEvents.WOLF_ARMOR_BREAK); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_CRACK = new CompatSoundEvent(SoundEvents.WOLF_ARMOR_CRACK); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_DAMAGE = new CompatSoundEvent(SoundEvents.WOLF_ARMOR_DAMAGE); + public static final CompatSoundEvent ITEM_WOLF_ARMOR_REPAIR = new CompatSoundEvent(SoundEvents.WOLF_ARMOR_REPAIR); + public static final CompatSoundEvent ENTITY_WOLF_AMBIENT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).ambientSound()); + public static final CompatSoundEvent ENTITY_WOLF_DEATH = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).deathSound()); + public static final CompatSoundEvent ENTITY_WOLF_GROWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).growlSound()); + public static final CompatSoundEvent ENTITY_WOLF_HOWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).ambientSound()); + public static final CompatSoundEvent ENTITY_WOLF_HURT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).hurtSound()); + public static final CompatSoundEvent ENTITY_WOLF_PANT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).pantSound()); + public static final CompatSoundEvent ENTITY_WOLF_SHAKE = new CompatSoundEvent(SoundEvents.WOLF_SHAKE); + public static final CompatSoundEvent ENTITY_WOLF_STEP = new CompatSoundEvent(SoundEvents.WOLF_STEP); + public static final CompatSoundEvent ENTITY_WOLF_WHINE = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).whineSound()); + public static final CompatSoundEvent BLOCK_WOODEN_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.WOODEN_DOOR_CLOSE); + public static final CompatSoundEvent BLOCK_WOODEN_DOOR_OPEN = new CompatSoundEvent(SoundEvents.WOODEN_DOOR_OPEN); + public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.WOODEN_TRAPDOOR_CLOSE); + public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_OPEN = new CompatSoundEvent(SoundEvents.WOODEN_TRAPDOOR_OPEN); + public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_OFF = new CompatSoundEvent(SoundEvents.WOODEN_BUTTON_CLICK_OFF); + public static final CompatSoundEvent BLOCK_WOODEN_BUTTON_CLICK_ON = new CompatSoundEvent(SoundEvents.WOODEN_BUTTON_CLICK_ON); + public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF = new CompatSoundEvent(SoundEvents.WOODEN_PRESSURE_PLATE_CLICK_OFF); + public static final CompatSoundEvent BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON = new CompatSoundEvent(SoundEvents.WOODEN_PRESSURE_PLATE_CLICK_ON); + public static final CompatSoundEvent BLOCK_WOOD_BREAK = new CompatSoundEvent(SoundEvents.WOOD_BREAK); + public static final CompatSoundEvent BLOCK_WOOD_FALL = new CompatSoundEvent(SoundEvents.WOOD_FALL); + public static final CompatSoundEvent BLOCK_WOOD_HIT = new CompatSoundEvent(SoundEvents.WOOD_HIT); + public static final CompatSoundEvent BLOCK_WOOD_PLACE = new CompatSoundEvent(SoundEvents.WOOD_PLACE); + public static final CompatSoundEvent BLOCK_WOOD_STEP = new CompatSoundEvent(SoundEvents.WOOD_STEP); + public static final CompatSoundEvent BLOCK_WOOL_BREAK = new CompatSoundEvent(SoundEvents.WOOL_BREAK); + public static final CompatSoundEvent BLOCK_WOOL_FALL = new CompatSoundEvent(SoundEvents.WOOL_FALL); + public static final CompatSoundEvent BLOCK_WOOL_HIT = new CompatSoundEvent(SoundEvents.WOOL_HIT); + public static final CompatSoundEvent BLOCK_WOOL_PLACE = new CompatSoundEvent(SoundEvents.WOOL_PLACE); + public static final CompatSoundEvent BLOCK_WOOL_STEP = new CompatSoundEvent(SoundEvents.WOOL_STEP); + public static final CompatSoundEvent ENTITY_ZOGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ZOGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ZOGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_ZOGLIN_ATTACK = new CompatSoundEvent(SoundEvents.ZOGLIN_ATTACK); + public static final CompatSoundEvent ENTITY_ZOGLIN_DEATH = new CompatSoundEvent(SoundEvents.ZOGLIN_DEATH); + public static final CompatSoundEvent ENTITY_ZOGLIN_HURT = new CompatSoundEvent(SoundEvents.ZOGLIN_HURT); + public static final CompatSoundEvent ENTITY_ZOGLIN_STEP = new CompatSoundEvent(SoundEvents.ZOGLIN_STEP); + public static final CompatSoundEvent ENTITY_ZOMBIE_AMBIENT = new CompatSoundEvent(SoundEvents.ZOMBIE_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ZOMBIE_ATTACK_WOODEN_DOOR); + public static final CompatSoundEvent ENTITY_ZOMBIE_ATTACK_IRON_DOOR = new CompatSoundEvent(SoundEvents.ZOMBIE_ATTACK_IRON_DOOR); + public static final CompatSoundEvent ENTITY_ZOMBIE_BREAK_WOODEN_DOOR = new CompatSoundEvent(SoundEvents.ZOMBIE_BREAK_WOODEN_DOOR); + public static final CompatSoundEvent ENTITY_ZOMBIE_CONVERTED_TO_DROWNED = new CompatSoundEvent(SoundEvents.ZOMBIE_CONVERTED_TO_DROWNED); + public static final CompatSoundEvent ENTITY_ZOMBIE_DEATH = new CompatSoundEvent(SoundEvents.ZOMBIE_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIE_DESTROY_EGG = new CompatSoundEvent(SoundEvents.ZOMBIE_DESTROY_EGG); + public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_AMBIENT = new CompatSoundEvent(SoundEvents.ZOMBIE_HORSE_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_DEATH = new CompatSoundEvent(SoundEvents.ZOMBIE_HORSE_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIE_HORSE_HURT = new CompatSoundEvent(SoundEvents.ZOMBIE_HORSE_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_HURT = new CompatSoundEvent(SoundEvents.ZOMBIE_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_INFECT = new CompatSoundEvent(SoundEvents.ZOMBIE_INFECT); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_AMBIENT = new CompatSoundEvent(SoundEvents.ZOMBIFIED_PIGLIN_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_ANGRY = new CompatSoundEvent(SoundEvents.ZOMBIFIED_PIGLIN_ANGRY); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_DEATH = new CompatSoundEvent(SoundEvents.ZOMBIFIED_PIGLIN_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIFIED_PIGLIN_HURT = new CompatSoundEvent(SoundEvents.ZOMBIFIED_PIGLIN_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_STEP = new CompatSoundEvent(SoundEvents.ZOMBIE_STEP); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_AMBIENT = new CompatSoundEvent(SoundEvents.ZOMBIE_VILLAGER_AMBIENT); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CONVERTED = new CompatSoundEvent(SoundEvents.ZOMBIE_VILLAGER_CONVERTED); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_CURE = new CompatSoundEvent(SoundEvents.ZOMBIE_VILLAGER_CURE); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_DEATH = new CompatSoundEvent(SoundEvents.ZOMBIE_VILLAGER_DEATH); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_HURT = new CompatSoundEvent(SoundEvents.ZOMBIE_VILLAGER_HURT); + public static final CompatSoundEvent ENTITY_ZOMBIE_VILLAGER_STEP = new CompatSoundEvent(SoundEvents.ZOMBIE_VILLAGER_STEP); + public static final CompatSoundEvent EVENT_MOB_EFFECT_BAD_OMEN = new CompatSoundEvent(SoundEvents.APPLY_EFFECT_BAD_OMEN); + public static final CompatSoundEvent EVENT_MOB_EFFECT_TRIAL_OMEN = new CompatSoundEvent(SoundEvents.APPLY_EFFECT_TRIAL_OMEN); + public static final CompatSoundEvent EVENT_MOB_EFFECT_RAID_OMEN = new CompatSoundEvent(SoundEvents.APPLY_EFFECT_RAID_OMEN); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_EQUIP = new CompatSoundEvent(SoundEvents.HARNESS_EQUIP); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_AMBIENT = new CompatSoundEvent(SoundEvents.HAPPY_GHAST_AMBIENT); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_DEATH = new CompatSoundEvent(SoundEvents.HAPPY_GHAST_DEATH); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HURT = new CompatSoundEvent(SoundEvents.HAPPY_GHAST_HURT); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_RIDING = new CompatSoundEvent(SoundEvents.HAPPY_GHAST_RIDING); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN = new CompatSoundEvent(SoundEvents.HARNESS_GOGGLES_DOWN); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP = new CompatSoundEvent(SoundEvents.HARNESS_GOGGLES_UP); + public static final CompatSoundEvent ENTITY_HAPPY_GHAST_UNEQUIP = new CompatSoundEvent(SoundEvents.HARNESS_UNEQUIP); static { - GOAT_HORN_SOUNDS = SoundEvents.GOAT_HORN_SOUNDS.stream().map(CompatSoundEvent::new).collect(ImmutableList.toImmutableList()); + GOAT_HORN_SOUNDS = SoundEvents.GOAT_HORN_SOUND_VARIANTS.stream().map(CompatSoundEvent::new).collect(ImmutableList.toImmutableList()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java index c9a68ee56..46f4f14db 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.sound; -import net.minecraft.sound.SoundEvent; +import net.minecraft.sounds.SoundEvent; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; public class RegistryResultCompatSoundEvent extends CompatSoundEvent { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java index a6b7775be..86bcdd66f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java @@ -2,13 +2,13 @@ public class BooleanProperty implements IProperty { - private final net.minecraft.state.property.BooleanProperty property; + private final net.minecraft.world.level.block.state.properties.BooleanProperty property; public BooleanProperty(String name) { - this(net.minecraft.state.property.BooleanProperty.of(name)); + this(net.minecraft.world.level.block.state.properties.BooleanProperty.create(name)); } - public BooleanProperty(net.minecraft.state.property.BooleanProperty property) { + public BooleanProperty(net.minecraft.world.level.block.state.properties.BooleanProperty property) { this.property = property; } @@ -16,12 +16,12 @@ public static BooleanProperty of(String name) { return new BooleanProperty(name); } - public static BooleanProperty of(net.minecraft.state.property.BooleanProperty property) { + public static BooleanProperty of(net.minecraft.world.level.block.state.properties.BooleanProperty property) { return new BooleanProperty(property); } @Override - public net.minecraft.state.property.BooleanProperty getProperty() { + public net.minecraft.world.level.block.state.properties.BooleanProperty getProperty() { return property; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java index 92cd6000a..8d244f5fe 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java @@ -1,116 +1,122 @@ package net.pitan76.mcpitanlib.api.state.property; import net.minecraft.block.enums.*; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.StringIdentifiable; -import net.minecraft.util.math.Direction; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.ChestType; +import net.minecraft.world.level.block.state.properties.ComparatorMode; +import net.minecraft.world.level.block.state.properties.Half; +import net.minecraft.world.level.block.state.properties.PistonType; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.util.StringRepresentable; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.properties.SlabType; +import net.minecraft.world.level.block.state.properties.StairsShape; public class CompatProperties { - public static final DirectionProperty FACING = new DirectionProperty(Properties.FACING); - public static final DirectionProperty HORIZONTAL_FACING = new DirectionProperty(Properties.HORIZONTAL_FACING); - public static final DirectionProperty HOPPER_FACING = new DirectionProperty(Properties.HOPPER_FACING); - public static final DirectionProperty VERTICAL_DIRECTION = new DirectionProperty(Properties.VERTICAL_DIRECTION); + public static final DirectionProperty FACING = new DirectionProperty(BlockStateProperties.FACING); + public static final DirectionProperty HORIZONTAL_FACING = new DirectionProperty(BlockStateProperties.HORIZONTAL_FACING); + public static final DirectionProperty HOPPER_FACING = new DirectionProperty(BlockStateProperties.FACING_HOPPER); + public static final DirectionProperty VERTICAL_DIRECTION = new DirectionProperty(BlockStateProperties.VERTICAL_DIRECTION); - public static final BooleanProperty POWERED = new BooleanProperty(Properties.POWERED); - public static final BooleanProperty ENABLED = new BooleanProperty(Properties.ENABLED); - public static final BooleanProperty WATERLOGGED = new BooleanProperty(Properties.WATERLOGGED); - public static final BooleanProperty LIT = new BooleanProperty(Properties.LIT); - public static final BooleanProperty OCCUPIED = new BooleanProperty(Properties.OCCUPIED); - public static final BooleanProperty ATTACHED = new BooleanProperty(Properties.ATTACHED); - public static final BooleanProperty HANGING = new BooleanProperty(Properties.HANGING); - public static final BooleanProperty BOTTOM = new BooleanProperty(Properties.BOTTOM); - public static final BooleanProperty OPEN = new BooleanProperty(Properties.OPEN); - public static final BooleanProperty UNSTABLE = new BooleanProperty(Properties.UNSTABLE); - public static final BooleanProperty UP = new BooleanProperty(Properties.UP); - public static final BooleanProperty DOWN = new BooleanProperty(Properties.DOWN); - public static final BooleanProperty NORTH = new BooleanProperty(Properties.NORTH); - public static final BooleanProperty EAST = new BooleanProperty(Properties.EAST); - public static final BooleanProperty SOUTH = new BooleanProperty(Properties.SOUTH); - public static final BooleanProperty WEST = new BooleanProperty(Properties.WEST); + public static final BooleanProperty POWERED = new BooleanProperty(BlockStateProperties.POWERED); + public static final BooleanProperty ENABLED = new BooleanProperty(BlockStateProperties.ENABLED); + public static final BooleanProperty WATERLOGGED = new BooleanProperty(BlockStateProperties.WATERLOGGED); + public static final BooleanProperty LIT = new BooleanProperty(BlockStateProperties.LIT); + public static final BooleanProperty OCCUPIED = new BooleanProperty(BlockStateProperties.OCCUPIED); + public static final BooleanProperty ATTACHED = new BooleanProperty(BlockStateProperties.ATTACHED); + public static final BooleanProperty HANGING = new BooleanProperty(BlockStateProperties.HANGING); + public static final BooleanProperty BOTTOM = new BooleanProperty(BlockStateProperties.BOTTOM); + public static final BooleanProperty OPEN = new BooleanProperty(BlockStateProperties.OPEN); + public static final BooleanProperty UNSTABLE = new BooleanProperty(BlockStateProperties.UNSTABLE); + public static final BooleanProperty UP = new BooleanProperty(BlockStateProperties.UP); + public static final BooleanProperty DOWN = new BooleanProperty(BlockStateProperties.DOWN); + public static final BooleanProperty NORTH = new BooleanProperty(BlockStateProperties.NORTH); + public static final BooleanProperty EAST = new BooleanProperty(BlockStateProperties.EAST); + public static final BooleanProperty SOUTH = new BooleanProperty(BlockStateProperties.SOUTH); + public static final BooleanProperty WEST = new BooleanProperty(BlockStateProperties.WEST); - public static final IntProperty POWER = new IntProperty(Properties.POWER); - public static final IntProperty LAYERS = new IntProperty(Properties.LAYERS); - public static final IntProperty NOTE = new IntProperty(Properties.NOTE); - public static final IntProperty ROTATION = new IntProperty(Properties.ROTATION); - public static final IntProperty EGGS = new IntProperty(Properties.EGGS); - public static final IntProperty DELAY = new IntProperty(Properties.DELAY); + public static final IntProperty POWER = new IntProperty(BlockStateProperties.POWER); + public static final IntProperty LAYERS = new IntProperty(BlockStateProperties.LAYERS); + public static final IntProperty NOTE = new IntProperty(BlockStateProperties.NOTE); + public static final IntProperty ROTATION = new IntProperty(BlockStateProperties.ROTATION_16); + public static final IntProperty EGGS = new IntProperty(BlockStateProperties.EGGS); + public static final IntProperty DELAY = new IntProperty(BlockStateProperties.DELAY); - public static final EnumProperty BLOCK_HALF = new EnumProperty<>(Properties.BLOCK_HALF); - public static final EnumProperty STAIR_SHAPE = new EnumProperty<>(Properties.STAIR_SHAPE); - public static final EnumProperty SLAB_TYPE = new EnumProperty<>(Properties.SLAB_TYPE); - public static final EnumProperty CHEST_TYPE = new EnumProperty<>(Properties.CHEST_TYPE); - public static final EnumProperty PISTON_TYPE = new EnumProperty<>(Properties.PISTON_TYPE); - public static final EnumProperty AXIS = new EnumProperty<>(Properties.AXIS); - public static final EnumProperty HORIZONTAL_AXIS = new EnumProperty<>(Properties.HORIZONTAL_AXIS); - public static final EnumProperty COMPARATOR_MODE = new EnumProperty<>(Properties.COMPARATOR_MODE); + public static final EnumProperty BLOCK_HALF = new EnumProperty<>(BlockStateProperties.HALF); + public static final EnumProperty STAIR_SHAPE = new EnumProperty<>(BlockStateProperties.STAIRS_SHAPE); + public static final EnumProperty SLAB_TYPE = new EnumProperty<>(BlockStateProperties.SLAB_TYPE); + public static final EnumProperty CHEST_TYPE = new EnumProperty<>(BlockStateProperties.CHEST_TYPE); + public static final EnumProperty PISTON_TYPE = new EnumProperty<>(BlockStateProperties.PISTON_TYPE); + public static final EnumProperty AXIS = new EnumProperty<>(BlockStateProperties.AXIS); + public static final EnumProperty HORIZONTAL_AXIS = new EnumProperty<>(BlockStateProperties.HORIZONTAL_AXIS); + public static final EnumProperty COMPARATOR_MODE = new EnumProperty<>(BlockStateProperties.MODE_COMPARATOR); public static IProperty of(Property property) { - if (property instanceof net.minecraft.state.property.IntProperty) { - return of((net.minecraft.state.property.IntProperty) property); + if (property instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) { + return of((net.minecraft.world.level.block.state.properties.IntegerProperty) property); } - if (property instanceof net.minecraft.state.property.BooleanProperty) { - return of((net.minecraft.state.property.BooleanProperty) property); + if (property instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) { + return of((net.minecraft.world.level.block.state.properties.BooleanProperty) property); } - if (property instanceof net.minecraft.state.property.EnumProperty) { - if (property.getType() == Direction.class) { - return ofDir((net.minecraft.state.property.EnumProperty) property); + if (property instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { + if (property.getValueClass() == Direction.class) { + return ofDir((net.minecraft.world.level.block.state.properties.EnumProperty) property); } - return of((net.minecraft.state.property.EnumProperty) property); + return of((net.minecraft.world.level.block.state.properties.EnumProperty) property); } return UnknownProperty.of(property); } - public static IntProperty of(net.minecraft.state.property.IntProperty property) { - if (property == Properties.POWER) return POWER; - if (property == Properties.LAYERS) return LAYERS; - if (property == Properties.NOTE) return NOTE; - if (property == Properties.ROTATION) return ROTATION; - if (property == Properties.EGGS) return EGGS; - if (property == Properties.DELAY) return DELAY; + public static IntProperty of(net.minecraft.world.level.block.state.properties.IntegerProperty property) { + if (property == BlockStateProperties.POWER) return POWER; + if (property == BlockStateProperties.LAYERS) return LAYERS; + if (property == BlockStateProperties.NOTE) return NOTE; + if (property == BlockStateProperties.ROTATION_16) return ROTATION; + if (property == BlockStateProperties.EGGS) return EGGS; + if (property == BlockStateProperties.DELAY) return DELAY; return new IntProperty(property); } - public static BooleanProperty of(net.minecraft.state.property.BooleanProperty property) { - if (property == Properties.POWERED) return POWERED; - if (property == Properties.ENABLED) return ENABLED; - if (property == Properties.WATERLOGGED) return WATERLOGGED; - if (property == Properties.LIT) return LIT; - if (property == Properties.OCCUPIED) return OCCUPIED; - if (property == Properties.ATTACHED) return ATTACHED; - if (property == Properties.HANGING) return HANGING; - if (property == Properties.BOTTOM) return BOTTOM; - if (property == Properties.OPEN) return OPEN; - if (property == Properties.UNSTABLE) return UNSTABLE; - if (property == Properties.UP) return UP; - if (property == Properties.DOWN) return DOWN; - if (property == Properties.NORTH) return NORTH; - if (property == Properties.EAST) return EAST; - if (property == Properties.SOUTH) return SOUTH; - if (property == Properties.WEST) return WEST; + public static BooleanProperty of(net.minecraft.world.level.block.state.properties.BooleanProperty property) { + if (property == BlockStateProperties.POWERED) return POWERED; + if (property == BlockStateProperties.ENABLED) return ENABLED; + if (property == BlockStateProperties.WATERLOGGED) return WATERLOGGED; + if (property == BlockStateProperties.LIT) return LIT; + if (property == BlockStateProperties.OCCUPIED) return OCCUPIED; + if (property == BlockStateProperties.ATTACHED) return ATTACHED; + if (property == BlockStateProperties.HANGING) return HANGING; + if (property == BlockStateProperties.BOTTOM) return BOTTOM; + if (property == BlockStateProperties.OPEN) return OPEN; + if (property == BlockStateProperties.UNSTABLE) return UNSTABLE; + if (property == BlockStateProperties.UP) return UP; + if (property == BlockStateProperties.DOWN) return DOWN; + if (property == BlockStateProperties.NORTH) return NORTH; + if (property == BlockStateProperties.EAST) return EAST; + if (property == BlockStateProperties.SOUTH) return SOUTH; + if (property == BlockStateProperties.WEST) return WEST; return new BooleanProperty(property); } - public static & StringIdentifiable> EnumProperty of(net.minecraft.state.property.EnumProperty property) { - if (property.equals(Properties.BLOCK_HALF)) return (EnumProperty) BLOCK_HALF; - if (property.equals(Properties.STAIR_SHAPE)) return (EnumProperty) STAIR_SHAPE; - if (property.equals(Properties.SLAB_TYPE)) return (EnumProperty) SLAB_TYPE; - if (property.equals(Properties.CHEST_TYPE)) return (EnumProperty) CHEST_TYPE; - if (property.equals(Properties.PISTON_TYPE)) return (EnumProperty) PISTON_TYPE; - if (property.equals(Properties.AXIS)) return (EnumProperty) AXIS; - if (property.equals(Properties.HORIZONTAL_AXIS)) return (EnumProperty) HORIZONTAL_AXIS; - if (property.equals(Properties.COMPARATOR_MODE)) return (EnumProperty) COMPARATOR_MODE; + public static & StringRepresentable> EnumProperty of(net.minecraft.world.level.block.state.properties.EnumProperty property) { + if (property.equals(BlockStateProperties.HALF)) return (EnumProperty) BLOCK_HALF; + if (property.equals(BlockStateProperties.STAIRS_SHAPE)) return (EnumProperty) STAIR_SHAPE; + if (property.equals(BlockStateProperties.SLAB_TYPE)) return (EnumProperty) SLAB_TYPE; + if (property.equals(BlockStateProperties.CHEST_TYPE)) return (EnumProperty) CHEST_TYPE; + if (property.equals(BlockStateProperties.PISTON_TYPE)) return (EnumProperty) PISTON_TYPE; + if (property.equals(BlockStateProperties.AXIS)) return (EnumProperty) AXIS; + if (property.equals(BlockStateProperties.HORIZONTAL_AXIS)) return (EnumProperty) HORIZONTAL_AXIS; + if (property.equals(BlockStateProperties.MODE_COMPARATOR)) return (EnumProperty) COMPARATOR_MODE; return new EnumProperty<>(property); } - public static DirectionProperty ofDir(net.minecraft.state.property.EnumProperty property) { - if (property == Properties.FACING) return FACING; - if (property == Properties.HORIZONTAL_FACING) return HORIZONTAL_FACING; - if (property == Properties.HOPPER_FACING) return HOPPER_FACING; - if (property == Properties.VERTICAL_DIRECTION) return VERTICAL_DIRECTION; + public static DirectionProperty ofDir(net.minecraft.world.level.block.state.properties.EnumProperty property) { + if (property == BlockStateProperties.FACING) return FACING; + if (property == BlockStateProperties.HORIZONTAL_FACING) return HORIZONTAL_FACING; + if (property == BlockStateProperties.FACING_HOPPER) return HOPPER_FACING; + if (property == BlockStateProperties.VERTICAL_DIRECTION) return VERTICAL_DIRECTION; return new DirectionProperty(property); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java index f1bd61a7b..2fa278e1c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.state.property; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Property; -import net.minecraft.util.math.Direction; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.core.Direction; import net.pitan76.mcpitanlib.midohra.block.BlockState; import java.util.function.Predicate; @@ -12,7 +12,7 @@ public class DirectionProperty implements IProperty { private final EnumProperty property; public DirectionProperty(String name, Predicate filter) { - this(EnumProperty.of(name, Direction.class, filter)); + this(EnumProperty.create(name, Direction.class, filter)); } public DirectionProperty(String name) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java index 7e7e9522b..d80a945c9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java @@ -1,40 +1,40 @@ package net.pitan76.mcpitanlib.api.state.property; -import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.StringRepresentable; import java.util.function.Predicate; -public class EnumProperty & StringIdentifiable> implements IProperty { +public class EnumProperty & StringRepresentable> implements IProperty { - private final net.minecraft.state.property.EnumProperty property; + private final net.minecraft.world.level.block.state.properties.EnumProperty property; public EnumProperty(String name, Class type) { - this(net.minecraft.state.property.EnumProperty.of(name, type)); + this(net.minecraft.world.level.block.state.properties.EnumProperty.create(name, type)); } public EnumProperty(String name, Class type, Predicate filter) { - this(net.minecraft.state.property.EnumProperty.of(name, type, filter)); + this(net.minecraft.world.level.block.state.properties.EnumProperty.create(name, type, filter)); } - public EnumProperty(net.minecraft.state.property.EnumProperty property) { + public EnumProperty(net.minecraft.world.level.block.state.properties.EnumProperty property) { this.property = property; } - public static & StringIdentifiable> EnumProperty of(String name, Class type) { + public static & StringRepresentable> EnumProperty of(String name, Class type) { return new EnumProperty<>(name, type); } - public static & StringIdentifiable> EnumProperty of(String name, Class type, Predicate filter) { + public static & StringRepresentable> EnumProperty of(String name, Class type, Predicate filter) { return new EnumProperty<>(name, type, filter); } - public static & StringIdentifiable> EnumProperty of(net.minecraft.state.property.EnumProperty property) { + public static & StringRepresentable> EnumProperty of(net.minecraft.world.level.block.state.properties.EnumProperty property) { return new EnumProperty<>(property); } @Override - public net.minecraft.state.property.EnumProperty getProperty() { + public net.minecraft.world.level.block.state.properties.EnumProperty getProperty() { return property; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java index 2274a41e3..868ff1e4b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.state.property; -import net.minecraft.block.BlockState; -import net.minecraft.state.property.Property; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Property; import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; public interface IProperty> { @@ -10,15 +10,15 @@ default void apply(AppendPropertiesArgs args) { } default T get(BlockState state) { - return state.get(getProperty()); + return state.getValue(getProperty()); } default BlockState with(BlockState state, T value) { - return state.with(getProperty(), value); + return state.setValue(getProperty(), value); } default boolean contains(BlockState state) { - return state.contains(getProperty()); + return state.hasProperty(getProperty()); } default BlockState cycle(BlockState state) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java index 850604d9f..b1e2e62e9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java @@ -2,17 +2,17 @@ public class IntProperty implements IProperty { - private final net.minecraft.state.property.IntProperty property; + private final net.minecraft.world.level.block.state.properties.IntegerProperty property; public IntProperty(String name, int min, int max) { - this(net.minecraft.state.property.IntProperty.of(name, min, max)); + this(net.minecraft.world.level.block.state.properties.IntegerProperty.create(name, min, max)); } public IntProperty(String name) { this(name, 0, 15); } - public IntProperty(net.minecraft.state.property.IntProperty property) { + public IntProperty(net.minecraft.world.level.block.state.properties.IntegerProperty property) { this.property = property; } @@ -24,12 +24,12 @@ public static IntProperty of(String name, int min, int max) { return new IntProperty(name, min, max); } - public static IntProperty of(net.minecraft.state.property.IntProperty property) { + public static IntProperty of(net.minecraft.world.level.block.state.properties.IntegerProperty property) { return new IntProperty(property); } @Override - public net.minecraft.state.property.IntProperty getProperty() { + public net.minecraft.world.level.block.state.properties.IntegerProperty getProperty() { return property; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java index e59d0cad5..10f241c52 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.state.property; -import net.minecraft.state.property.Property; +import net.minecraft.world.level.block.state.properties.Property; public class UnknownProperty implements IProperty { - private final net.minecraft.state.property.Property property; + private final net.minecraft.world.level.block.state.properties.Property property; - public UnknownProperty(net.minecraft.state.property.Property property) { + public UnknownProperty(net.minecraft.world.level.block.state.properties.Property property) { this.property = property; } - public static UnknownProperty of(net.minecraft.state.property.Property property) { + public static UnknownProperty of(net.minecraft.world.level.block.state.properties.Property property) { return new UnknownProperty(property); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java index 55fa28254..6f37c9dfb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.tag; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityType; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.item.Item; +import net.minecraft.core.registries.Registries; +import net.minecraft.core.Holder; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.*; public class TagKey { - private final net.minecraft.registry.tag.TagKey tagKey; + private final net.minecraft.tags.TagKey tagKey; @Deprecated - public TagKey(net.minecraft.registry.tag.TagKey tagKey) { + public TagKey(net.minecraft.tags.TagKey tagKey) { this.tagKey = tagKey; } public static TagKey create(Type type, Identifier identifier) { return switch (type) { - case BLOCK -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.BLOCK, identifier)); - case ITEM -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.ITEM, identifier)); - case FLUID -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.FLUID, identifier)); - case ENTITY_TYPE -> new TagKey<>(net.minecraft.registry.tag.TagKey.of(RegistryKeys.ENTITY_TYPE, identifier)); + case BLOCK -> new TagKey<>(net.minecraft.tags.TagKey.create(Registries.BLOCK, identifier)); + case ITEM -> new TagKey<>(net.minecraft.tags.TagKey.create(Registries.ITEM, identifier)); + case FLUID -> new TagKey<>(net.minecraft.tags.TagKey.create(Registries.FLUID, identifier)); + case ENTITY_TYPE -> new TagKey<>(net.minecraft.tags.TagKey.create(Registries.ENTITY_TYPE, identifier)); }; } @@ -31,7 +31,7 @@ public static TagKey create(Type type, CompatIdentifier id) { } @Deprecated - public net.minecraft.registry.tag.TagKey getTagKey() { + public net.minecraft.tags.TagKey getTagKey() { return tagKey; } @@ -44,14 +44,14 @@ public enum Type { public boolean isOf(T value) { if (value instanceof Item) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.ITEM, ItemUtil.toID((Item) value)); + return getTagKey() == net.minecraft.tags.TagKey.create(Registries.ITEM, ItemUtil.toID((Item) value)); if (value instanceof Block) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.BLOCK, BlockUtil.toID((Block) value)); + return getTagKey() == net.minecraft.tags.TagKey.create(Registries.BLOCK, BlockUtil.toID((Block) value)); if (value instanceof Fluid) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.FLUID, FluidUtil.toID((Fluid) value)); + return getTagKey() == net.minecraft.tags.TagKey.create(Registries.FLUID, FluidUtil.toID((Fluid) value)); if (value instanceof EntityType) - return getTagKey() == net.minecraft.registry.tag.TagKey.of(RegistryKeys.ENTITY_TYPE, EntityTypeUtil.toID((EntityType) value)); + return getTagKey() == net.minecraft.tags.TagKey.create(Registries.ENTITY_TYPE, EntityTypeUtil.toID((EntityType) value)); - return RegistryEntry.of(value).isIn(getTagKey()); + return Holder.direct(value).is(getTagKey()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java index ed91ce35e..9cddf078b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.tag.item; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.core.registries.Registries; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.IngredientUtil; import net.pitan76.mcpitanlib.api.util.item.ItemUtil; @@ -30,7 +30,7 @@ public class RepairIngredientTag { private TagKey tag; public RepairIngredientTag(CompatIdentifier identifier) { - this.tag = TagKey.of(RegistryKeys.ITEM, identifier.toMinecraft()); + this.tag = TagKey.create(Registries.ITEM, identifier.toMinecraft()); } @Deprecated @@ -45,14 +45,14 @@ public TagKey getTag() { @Deprecated public Ingredient getIngredient() { - return IngredientUtil.fromTagByIdentifier(tag.id()); + return IngredientUtil.fromTagByIdentifier(tag.location()); } public boolean contains(Item item) { if (item == null || tag == null) return false; - return ItemUtil.isInTag(item, CompatIdentifier.fromMinecraft(tag.id())); + return ItemUtil.isInTag(item, CompatIdentifier.fromMinecraft(tag.location())); } public boolean contains(ItemStack stack) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java index 63f4df308..627036a1f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java @@ -1,29 +1,29 @@ package net.pitan76.mcpitanlib.api.tag.v2; -import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.core.Holder; import net.pitan76.mcpitanlib.api.tag.TagKey; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class CompatTagKey extends TagKey { @Deprecated - public CompatTagKey(net.minecraft.registry.tag.TagKey tagKey) { + public CompatTagKey(net.minecraft.tags.TagKey tagKey) { super(tagKey); } @Deprecated - public static CompatTagKey of(net.minecraft.registry.tag.TagKey tagKey) { + public static CompatTagKey of(net.minecraft.tags.TagKey tagKey) { return new CompatTagKey<>(tagKey); } public static CompatTagKey of(CompatTagKeyType type, CompatIdentifier identifier) { - return of(net.minecraft.registry.tag.TagKey.of(type.getRegistryKey(), identifier.toMinecraft())); + return of(net.minecraft.tags.TagKey.create(type.getRegistryKey(), identifier.toMinecraft())); } public boolean isOf(T value) { - return RegistryEntry.of(value).isIn(getTagKey()); + return Holder.direct(value).is(getTagKey()); } public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(getTagKey().id()); + return CompatIdentifier.fromMinecraft(getTagKey().location()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java index 2a0dabc61..c66bb0523 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java @@ -1,23 +1,23 @@ package net.pitan76.mcpitanlib.api.tag.v2; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.EntityType; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.item.Item; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class CompatTagKeyType { - public static final CompatTagKeyType BLOCK = of(RegistryKeys.BLOCK); - public static final CompatTagKeyType ITEM = new CompatTagKeyType<>(RegistryKeys.ITEM); - public static final CompatTagKeyType FLUID = new CompatTagKeyType<>(RegistryKeys.FLUID); - public static final CompatTagKeyType> ENTITY_TYPE = new CompatTagKeyType<>(RegistryKeys.ENTITY_TYPE); - public static final CompatTagKeyType> BLOCK_ENTITY_TYPE = new CompatTagKeyType<>(RegistryKeys.BLOCK_ENTITY_TYPE); - public static final CompatTagKeyType> SCREEN_HANDLER = new CompatTagKeyType<>(RegistryKeys.SCREEN_HANDLER); + public static final CompatTagKeyType BLOCK = of(Registries.BLOCK); + public static final CompatTagKeyType ITEM = new CompatTagKeyType<>(Registries.ITEM); + public static final CompatTagKeyType FLUID = new CompatTagKeyType<>(Registries.FLUID); + public static final CompatTagKeyType> ENTITY_TYPE = new CompatTagKeyType<>(Registries.ENTITY_TYPE); + public static final CompatTagKeyType> BLOCK_ENTITY_TYPE = new CompatTagKeyType<>(Registries.BLOCK_ENTITY_TYPE); + public static final CompatTagKeyType> SCREEN_HANDLER = new CompatTagKeyType<>(Registries.MENU); public final CompatIdentifier id; @@ -30,19 +30,19 @@ public static CompatTagKeyType of(CompatIdentifier id) { } // RegistryKey - private RegistryKey> key; + private ResourceKey> key; - protected CompatTagKeyType(RegistryKey> key) { - this.id = CompatIdentifier.fromMinecraft(key.getRegistry()); + protected CompatTagKeyType(ResourceKey> key) { + this.id = CompatIdentifier.fromMinecraft(key.registry()); this.key = key; } - public static CompatTagKeyType of(RegistryKey> key) { + public static CompatTagKeyType of(ResourceKey> key) { return new CompatTagKeyType<>(key); } @Deprecated - public RegistryKey> getRegistryKey() { + public ResourceKey> getRegistryKey() { return key; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java index 382e101b8..84feb6333 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.tag.v2.typed; -import net.minecraft.block.Block; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.level.block.Block; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -16,7 +16,7 @@ public BlockTagKey(TagKey tagKey) { } public static BlockTagKey of(CompatIdentifier identifier) { - return new BlockTagKey(TagKey.of(CompatTagKeyType.BLOCK.getRegistryKey(), identifier.toMinecraft())); + return new BlockTagKey(TagKey.create(CompatTagKeyType.BLOCK.getRegistryKey(), identifier.toMinecraft())); } public List values() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java index 61d57fee9..2a4de2769 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.tag.v2.typed; -import net.minecraft.entity.EntityType; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.entity.EntityType; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -15,6 +15,6 @@ public EntityTagKey(TagKey> tagKey) { } public static EntityTagKey of(CompatIdentifier identifier) { - return new EntityTagKey(TagKey.of(CompatTagKeyType.ENTITY_TYPE.getRegistryKey(), identifier.toMinecraft())); + return new EntityTagKey(TagKey.create(CompatTagKeyType.ENTITY_TYPE.getRegistryKey(), identifier.toMinecraft())); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java index 03cdeb507..15810680d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.tag.v2.typed; -import net.minecraft.fluid.Fluid; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -13,6 +13,6 @@ public FluidTagKey(TagKey tagKey) { } public static FluidTagKey of(CompatIdentifier identifier) { - return new FluidTagKey(TagKey.of(CompatTagKeyType.FLUID.getRegistryKey(), identifier.toMinecraft())); + return new FluidTagKey(TagKey.create(CompatTagKeyType.FLUID.getRegistryKey(), identifier.toMinecraft())); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java index cce0a7cb2..ba7da7d87 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.tag.v2.typed; -import net.minecraft.item.Item; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.tags.TagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKeyType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -18,11 +18,11 @@ public ItemTagKey(TagKey tagKey) { } public static ItemTagKey of(CompatIdentifier identifier) { - return new ItemTagKey(net.minecraft.registry.tag.TagKey.of(CompatTagKeyType.ITEM.getRegistryKey(), identifier.toMinecraft())); + return new ItemTagKey(net.minecraft.tags.TagKey.create(CompatTagKeyType.ITEM.getRegistryKey(), identifier.toMinecraft())); } public Ingredient asIngredient() { - return IngredientUtil.fromTagByIdentifier(getTagKey().id()); + return IngredientUtil.fromTagByIdentifier(getTagKey().location()); } public List values() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java index 1de5acf72..6a53061d4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java @@ -1,49 +1,49 @@ package net.pitan76.mcpitanlib.api.text; -import net.minecraft.util.Formatting; +import net.minecraft.ChatFormatting; import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; public class CompatFormatting implements CompatStringIdentifiable { - private final Formatting formatting; + private final ChatFormatting formatting; - public static final CompatFormatting BLACK = of(Formatting.BLACK); - public static final CompatFormatting DARK_BLUE = of(Formatting.DARK_BLUE); - public static final CompatFormatting DARK_GREEN = of(Formatting.DARK_GREEN); - public static final CompatFormatting DARK_AQUA = of(Formatting.DARK_AQUA); - public static final CompatFormatting DARK_RED = of(Formatting.DARK_RED); - public static final CompatFormatting DARK_PURPLE = of(Formatting.DARK_PURPLE); - public static final CompatFormatting GOLD = of(Formatting.GOLD); - public static final CompatFormatting GRAY = of(Formatting.GRAY); - public static final CompatFormatting DARK_GRAY = of(Formatting.DARK_GRAY); - public static final CompatFormatting BLUE = of(Formatting.BLUE); - public static final CompatFormatting GREEN = of(Formatting.GREEN); - public static final CompatFormatting AQUA = of(Formatting.AQUA); - public static final CompatFormatting RED = of(Formatting.RED); - public static final CompatFormatting LIGHT_PURPLE = of(Formatting.LIGHT_PURPLE); - public static final CompatFormatting YELLOW = of(Formatting.YELLOW); - public static final CompatFormatting WHITE = of(Formatting.WHITE); - public static final CompatFormatting OBFUSCATED = of(Formatting.OBFUSCATED); - public static final CompatFormatting BOLD = of(Formatting.BOLD); - public static final CompatFormatting STRIKETHROUGH = of(Formatting.STRIKETHROUGH); - public static final CompatFormatting UNDERLINE = of(Formatting.UNDERLINE); - public static final CompatFormatting ITALIC = of(Formatting.ITALIC); - public static final CompatFormatting RESET = of(Formatting.RESET); + public static final CompatFormatting BLACK = of(ChatFormatting.BLACK); + public static final CompatFormatting DARK_BLUE = of(ChatFormatting.DARK_BLUE); + public static final CompatFormatting DARK_GREEN = of(ChatFormatting.DARK_GREEN); + public static final CompatFormatting DARK_AQUA = of(ChatFormatting.DARK_AQUA); + public static final CompatFormatting DARK_RED = of(ChatFormatting.DARK_RED); + public static final CompatFormatting DARK_PURPLE = of(ChatFormatting.DARK_PURPLE); + public static final CompatFormatting GOLD = of(ChatFormatting.GOLD); + public static final CompatFormatting GRAY = of(ChatFormatting.GRAY); + public static final CompatFormatting DARK_GRAY = of(ChatFormatting.DARK_GRAY); + public static final CompatFormatting BLUE = of(ChatFormatting.BLUE); + public static final CompatFormatting GREEN = of(ChatFormatting.GREEN); + public static final CompatFormatting AQUA = of(ChatFormatting.AQUA); + public static final CompatFormatting RED = of(ChatFormatting.RED); + public static final CompatFormatting LIGHT_PURPLE = of(ChatFormatting.LIGHT_PURPLE); + public static final CompatFormatting YELLOW = of(ChatFormatting.YELLOW); + public static final CompatFormatting WHITE = of(ChatFormatting.WHITE); + public static final CompatFormatting OBFUSCATED = of(ChatFormatting.OBFUSCATED); + public static final CompatFormatting BOLD = of(ChatFormatting.BOLD); + public static final CompatFormatting STRIKETHROUGH = of(ChatFormatting.STRIKETHROUGH); + public static final CompatFormatting UNDERLINE = of(ChatFormatting.UNDERLINE); + public static final CompatFormatting ITALIC = of(ChatFormatting.ITALIC); + public static final CompatFormatting RESET = of(ChatFormatting.RESET); - public CompatFormatting(Formatting formatting) { + public CompatFormatting(ChatFormatting formatting) { this.formatting = formatting; } - public static CompatFormatting of(Formatting formatting) { + public static CompatFormatting of(ChatFormatting formatting) { return new CompatFormatting(formatting); } - public Formatting getRaw() { + public ChatFormatting getRaw() { return formatting; } @Override public String asString_compat() { - return formatting.asString(); + return formatting.getSerializedName(); } public boolean isColor() { @@ -51,19 +51,19 @@ public boolean isColor() { } public boolean isModifier() { - return formatting.isModifier(); + return formatting.isFormat(); } public char getCode() { - return formatting.getCode(); + return formatting.getChar(); } public Integer getColorValue() { - return formatting.getColorValue(); + return formatting.getColor(); } public int getColorIndex() { - return formatting.getColorIndex(); + return formatting.getId(); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java index 43b9aee73..c7c291ae4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.text; -import net.minecraft.text.Style; +import net.minecraft.network.chat.Style; public class CompatStyle { private final Style style; @@ -42,7 +42,7 @@ public CompatStyle withItalic(boolean italic) { } public CompatStyle withUnderline(boolean underline) { - return new CompatStyle(style.withUnderline(underline)); + return new CompatStyle(style.withUnderlined(underline)); } public CompatStyle withStrikethrough(boolean strikethrough) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java index 306034382..a9436a1ea 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java @@ -1,27 +1,27 @@ package net.pitan76.mcpitanlib.api.text; -import net.minecraft.text.TextColor; -import net.minecraft.util.Formatting; +import net.minecraft.network.chat.TextColor; +import net.minecraft.ChatFormatting; public class CompatTextColor { private final TextColor textColor; - public static final CompatTextColor BLACK = of(TextColor.fromFormatting(Formatting.BLACK)); - public static final CompatTextColor DARK_BLUE = of(TextColor.fromFormatting(Formatting.DARK_BLUE)); - public static final CompatTextColor DARK_GREEN = of(TextColor.fromFormatting(Formatting.DARK_GREEN)); - public static final CompatTextColor DARK_AQUA = of(TextColor.fromFormatting(Formatting.DARK_AQUA)); - public static final CompatTextColor DARK_RED = of(TextColor.fromFormatting(Formatting.DARK_RED)); - public static final CompatTextColor DARK_PURPLE = of(TextColor.fromFormatting(Formatting.DARK_PURPLE)); - public static final CompatTextColor GOLD = of(TextColor.fromFormatting(Formatting.GOLD)); - public static final CompatTextColor GRAY = of(TextColor.fromFormatting(Formatting.GRAY)); - public static final CompatTextColor DARK_GRAY = of(TextColor.fromFormatting(Formatting.DARK_GRAY)); - public static final CompatTextColor BLUE = of(TextColor.fromFormatting(Formatting.BLUE)); - public static final CompatTextColor GREEN = of(TextColor.fromFormatting(Formatting.GREEN)); - public static final CompatTextColor AQUA = of(TextColor.fromFormatting(Formatting.AQUA)); - public static final CompatTextColor RED = of(TextColor.fromFormatting(Formatting.RED)); - public static final CompatTextColor LIGHT_PURPLE = of(TextColor.fromFormatting(Formatting.LIGHT_PURPLE)); - public static final CompatTextColor YELLOW = of(TextColor.fromFormatting(Formatting.YELLOW)); - public static final CompatTextColor WHITE = of(TextColor.fromFormatting(Formatting.WHITE)); + public static final CompatTextColor BLACK = of(TextColor.fromLegacyFormat(ChatFormatting.BLACK)); + public static final CompatTextColor DARK_BLUE = of(TextColor.fromLegacyFormat(ChatFormatting.DARK_BLUE)); + public static final CompatTextColor DARK_GREEN = of(TextColor.fromLegacyFormat(ChatFormatting.DARK_GREEN)); + public static final CompatTextColor DARK_AQUA = of(TextColor.fromLegacyFormat(ChatFormatting.DARK_AQUA)); + public static final CompatTextColor DARK_RED = of(TextColor.fromLegacyFormat(ChatFormatting.DARK_RED)); + public static final CompatTextColor DARK_PURPLE = of(TextColor.fromLegacyFormat(ChatFormatting.DARK_PURPLE)); + public static final CompatTextColor GOLD = of(TextColor.fromLegacyFormat(ChatFormatting.GOLD)); + public static final CompatTextColor GRAY = of(TextColor.fromLegacyFormat(ChatFormatting.GRAY)); + public static final CompatTextColor DARK_GRAY = of(TextColor.fromLegacyFormat(ChatFormatting.DARK_GRAY)); + public static final CompatTextColor BLUE = of(TextColor.fromLegacyFormat(ChatFormatting.BLUE)); + public static final CompatTextColor GREEN = of(TextColor.fromLegacyFormat(ChatFormatting.GREEN)); + public static final CompatTextColor AQUA = of(TextColor.fromLegacyFormat(ChatFormatting.AQUA)); + public static final CompatTextColor RED = of(TextColor.fromLegacyFormat(ChatFormatting.RED)); + public static final CompatTextColor LIGHT_PURPLE = of(TextColor.fromLegacyFormat(ChatFormatting.LIGHT_PURPLE)); + public static final CompatTextColor YELLOW = of(TextColor.fromLegacyFormat(ChatFormatting.YELLOW)); + public static final CompatTextColor WHITE = of(TextColor.fromLegacyFormat(ChatFormatting.WHITE)); public CompatTextColor(TextColor textColor) { this.textColor = textColor; @@ -35,8 +35,8 @@ public static CompatTextColor of(TextColor textColor) { return new CompatTextColor(textColor); } - public static CompatTextColor fromFormatting(Formatting formatting) { - return new CompatTextColor(TextColor.fromFormatting(formatting)); + public static CompatTextColor fromFormatting(ChatFormatting formatting) { + return new CompatTextColor(TextColor.fromLegacyFormat(formatting)); } public static CompatTextColor fromFormatting(CompatFormatting formatting) { @@ -61,7 +61,7 @@ public static CompatTextColor parse(String string) { } public static CompatTextColor parseOrThrow(String string) { - return new CompatTextColor(TextColor.parse(string).getOrThrow()); + return new CompatTextColor(TextColor.parseColor(string).getOrThrow()); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java b/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java index 08ee2e869..9a2f82e35 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.text; -import net.minecraft.text.MutableText; -import net.minecraft.text.Style; -import net.minecraft.text.Text; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.util.TextUtil; import org.jetbrains.annotations.Nullable; public class TextComponent { - private Text text; + private Component text; public TextComponent() { this(TextUtil.empty()); } - public TextComponent(Text text) { + public TextComponent(Component text) { this.text = text; } @@ -22,16 +22,16 @@ public TextComponent(String string) { this(TextUtil.literal(string)); } - public Text getText() { + public Component getText() { return text; } - public void setText(Text text) { + public void setText(Component text) { this.text = text; } - public MutableText asMutableText() { - return (MutableText) text; + public MutableComponent asMutableText() { + return (MutableComponent) text; } public VariableTextComponent asVariableTextComponent() { @@ -39,8 +39,8 @@ public VariableTextComponent asVariableTextComponent() { } @Nullable - public MutableText asMutableTextOrNull() { - if (text instanceof MutableText) { + public MutableComponent asMutableTextOrNull() { + if (text instanceof MutableComponent) { return asMutableText(); } return null; @@ -92,8 +92,8 @@ public Style getStyle() { } public TextComponent setStyle(Style style) { - if (text instanceof MutableText) - TextUtil.setStyle((MutableText) text, style); + if (text instanceof MutableComponent) + TextUtil.setStyle((MutableComponent) text, style); return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java b/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java index 85836c4f8..a38ad0d7d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.text; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.ChatFormatting; import java.util.ArrayList; import java.util.Arrays; @@ -12,7 +12,7 @@ public class TextConverter { - public static MutableText convert(String string) { + public static MutableComponent convert(String string) { return convert(string, false); } @@ -23,10 +23,10 @@ public static MutableText convert(String string) { * @param translatable boolean * @return MutableText */ - public static MutableText convert(String text, boolean translatable) { + public static MutableComponent convert(String text, boolean translatable) { String[] splits = split(text); - MutableText result = Text.literal(""); - Formatting[] currentFormatting = {}; + MutableComponent result = Component.literal(""); + ChatFormatting[] currentFormatting = {}; for (String part : splits) { // Section @@ -34,24 +34,24 @@ public static MutableText convert(String text, boolean translatable) { char code = part.charAt(1); // Reset if (code == 'r') { - currentFormatting = new Formatting[]{}; + currentFormatting = new ChatFormatting[]{}; continue; } - Formatting format = Formatting.byCode(code); + ChatFormatting format = ChatFormatting.getByCode(code); if (format == null) continue; // Bold, Italic, Underline, Strikethrough, Obfuscated if (code >= 'k' && code <= 'o') { - ArrayList list = new ArrayList<>(Arrays.asList(currentFormatting)); + ArrayList list = new ArrayList<>(Arrays.asList(currentFormatting)); list.add(format); - currentFormatting = list.toArray(new Formatting[0]); + currentFormatting = list.toArray(new ChatFormatting[0]); continue; } // Color - currentFormatting = new Formatting[]{format}; + currentFormatting = new ChatFormatting[]{format}; continue; } @@ -59,32 +59,32 @@ public static MutableText convert(String text, boolean translatable) { if (translatable) { Pattern pattern = Pattern.compile("\\{(.+?)\\}"); Matcher matcher = pattern.matcher(part); - MutableText tempText = Text.literal(""); + MutableComponent tempText = Component.literal(""); int lastIndex = 0; while (matcher.find()) { // {translatable key} より前の文字列を追加 if (matcher.start() > lastIndex) { - tempText.append(Text.literal(part.substring(lastIndex, matcher.start())).formatted(currentFormatting)); + tempText.append(Component.literal(part.substring(lastIndex, matcher.start())).withStyle(currentFormatting)); } // {translatable key} を追加 String key = matcher.group(1); - tempText.append(Text.translatable(key).formatted(currentFormatting)); + tempText.append(Component.translatable(key).withStyle(currentFormatting)); lastIndex = matcher.end(); } // 最後の文字列を追加 if (lastIndex < part.length()) { - tempText.append(Text.literal(part.substring(lastIndex)).formatted(currentFormatting)); + tempText.append(Component.literal(part.substring(lastIndex)).withStyle(currentFormatting)); } result.append(tempText); continue; } - result.append(Text.literal(part).formatted(currentFormatting)); + result.append(Component.literal(part).withStyle(currentFormatting)); } return result; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java index 9e89cd1eb..c3948bc5b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.api.tile; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.core.HolderLookup; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; @@ -36,12 +36,12 @@ public CompatBlockEntity(BlockEntityType type, TileCreateEvent event) { @Nullable @Override @Deprecated - public Packet toUpdatePacket() { + public Packet getUpdatePacket() { switch (getUpdatePacketType().name) { case "BLOCK_ENTITY_UPDATE_S2C": - return BlockEntityUpdateS2CPacket.create(this); + return ClientboundBlockEntityDataPacket.create(this); } - return super.toUpdatePacket(); + return super.getUpdatePacket(); } public UpdatePacketType getUpdatePacketType() { @@ -56,13 +56,13 @@ public void readNbt(ReadNbtArgs args) { } - public NbtCompound toInitialChunkDataNbt(CompatRegistryLookup registryLookup) { - return super.toInitialChunkDataNbt(registryLookup.getRegistryLookup()); + public CompoundTag toInitialChunkDataNbt(CompatRegistryLookup registryLookup) { + return super.getUpdateTag(registryLookup.getRegistryLookup()); } @Deprecated @Override - public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries) { + public CompoundTag getUpdateTag(HolderLookup.Provider registries) { return toInitialChunkDataNbt(new CompatRegistryLookup(registries)); } @@ -72,7 +72,7 @@ public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registrie * @deprecated Use {@link #writeNbt(WriteNbtArgs)} instead */ @Deprecated - public void writeNbtOverride(NbtCompound nbt) { + public void writeNbtOverride(CompoundTag nbt) { //super.writeNbt(nbt, wrapperLookupCache); } @@ -80,35 +80,35 @@ public void writeNbtOverride(NbtCompound nbt) { * @deprecated Use {@link #readNbt(ReadNbtArgs)} instead */ @Deprecated - public void readNbtOverride(NbtCompound nbt) { + public void readNbtOverride(CompoundTag nbt) { //super.readNbt(nbt, wrapperLookupCache); } @Deprecated - private RegistryWrapper.WrapperLookup wrapperLookupCache; + private HolderLookup.Provider wrapperLookupCache; // ---- @Override - protected void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = NbtUtil.create(); - writeNbt(nbt, this.callGetWorld().getRegistryManager()); - writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.callGetWorld().getRegistryManager()))); + protected void saveAdditional(ValueOutput view) { + super.saveAdditional(view); + CompoundTag nbt = NbtUtil.create(); + writeNbt(nbt, this.callGetWorld().registryAccess()); + writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.callGetWorld().registryAccess()))); NbtDataConverter.nbt2writeData(nbt, view); } @Override - protected void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readNbt(nbt, view.getRegistries()); - readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.getRegistries()))); + protected void loadAdditional(ValueInput view) { + super.loadAdditional(view); + CompoundTag nbt = NbtDataConverter.data2nbt(view); + readNbt(nbt, view.lookup()); + readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.lookup()))); } @Deprecated - public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + public void writeNbt(CompoundTag nbt, HolderLookup.Provider registryLookup) { // deprecated wrapperLookupCache = registryLookup; writeNbtOverride(nbt); @@ -116,7 +116,7 @@ public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLook } @Deprecated - public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + public void readNbt(CompoundTag nbt, HolderLookup.Provider registryLookup) { // deprecated wrapperLookupCache = registryLookup; readNbtOverride(nbt); @@ -124,30 +124,30 @@ public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLooku } public boolean isClient() { - if (getWorld() == null) + if (getLevel() == null) return false; - return WorldUtil.isClient(getWorld()); + return WorldUtil.isClient(getLevel()); } @Deprecated @Override - public @Nullable World getWorld() { + public @Nullable Level getLevel() { return callGetWorld(); } @Deprecated @Override - public BlockPos getPos() { + public BlockPos getBlockPos() { return callGetPos(); } - public World callGetWorld() { - return super.getWorld(); + public Level callGetWorld() { + return super.getLevel(); } public BlockPos callGetPos() { - return super.getPos(); + return super.getBlockPos(); } public BlockState callGetBlockState() { @@ -159,10 +159,10 @@ public BlockState callGetCachedState() { } public boolean hasServerWorld() { - return callGetWorld() instanceof ServerWorld; + return callGetWorld() instanceof ServerLevel; } - public ServerWorld getServerWorld() { + public ServerLevel getServerWorld() { return BlockEntityUtil.getServerWorld(this); } @@ -172,12 +172,12 @@ public void callMarkDirty() { @Deprecated @Override - public void markRemoved() { + public void setRemoved() { markRemovedOverride(); } public void markRemovedOverride() { - super.markRemoved(); + super.setRemoved(); } public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java index 8b4b3d914..bb3e44f3a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.tile; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.core.HolderLookup; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.core.BlockPos; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; @@ -32,12 +32,12 @@ public CompatChestBlockEntity(BlockEntityType type, TileCreateEvent event) { @Nullable @Override @Deprecated - public Packet toUpdatePacket() { + public Packet getUpdatePacket() { switch (getUpdatePacketType().name) { case "BLOCK_ENTITY_UPDATE_S2C": - return BlockEntityUpdateS2CPacket.create(this); + return ClientboundBlockEntityDataPacket.create(this); } - return super.toUpdatePacket(); + return super.getUpdatePacket(); } public UpdatePacketType getUpdatePacketType() { @@ -59,7 +59,7 @@ public void readNbt(ReadNbtArgs args) { * @deprecated Use {@link #writeNbt(WriteNbtArgs)} instead */ @Deprecated - public void writeNbtOverride(NbtCompound nbt) { + public void writeNbtOverride(CompoundTag nbt) { } @@ -67,34 +67,34 @@ public void writeNbtOverride(NbtCompound nbt) { * @deprecated Use {@link #readNbt(ReadNbtArgs)} instead */ @Deprecated - public void readNbtOverride(NbtCompound nbt) { + public void readNbtOverride(CompoundTag nbt) { } @Deprecated - private RegistryWrapper.WrapperLookup wrapperLookupCache; + private HolderLookup.Provider wrapperLookupCache; // ---- @Override - protected void writeData(WriteView view) { - super.writeData(view); - NbtCompound nbt = NbtUtil.create(); - writeNbt(nbt, this.getWorld().getRegistryManager()); - writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.getWorld().getRegistryManager()))); + protected void saveAdditional(ValueOutput view) { + super.saveAdditional(view); + CompoundTag nbt = NbtUtil.create(); + writeNbt(nbt, this.getLevel().registryAccess()); + writeNbt(new WriteNbtArgs(nbt, view, new CompatRegistryLookup(this.getLevel().registryAccess()))); NbtDataConverter.nbt2writeData(nbt, view); } @Override - protected void readData(ReadView view) { - super.readData(view); - NbtCompound nbt = NbtDataConverter.data2nbt(view); - readNbt(nbt, view.getRegistries()); - readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.getRegistries()))); + protected void loadAdditional(ValueInput view) { + super.loadAdditional(view); + CompoundTag nbt = NbtDataConverter.data2nbt(view); + readNbt(nbt, view.lookup()); + readNbt(new ReadNbtArgs(nbt, view, new CompatRegistryLookup(view.lookup()))); } @Deprecated - public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + public void writeNbt(CompoundTag nbt, HolderLookup.Provider registryLookup) { // deprecated wrapperLookupCache = registryLookup; writeNbtOverride(nbt); @@ -102,7 +102,7 @@ public void writeNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLook } @Deprecated - public void readNbt(NbtCompound nbt, RegistryWrapper.WrapperLookup registryLookup) { + public void readNbt(CompoundTag nbt, HolderLookup.Provider registryLookup) { // deprecated wrapperLookupCache = registryLookup; readNbtOverride(nbt); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java index 01ea4f2e2..e236968b9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.tile; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import net.pitan76.mcpitanlib.api.world.ExtendWorld; @@ -19,8 +19,8 @@ public ExtendBlockEntity(BlockEntityType type, TileCreateEvent event) { } @Override - public void setWorld(World world) { - super.setWorld(world); + public void setLevel(Level world) { + super.setLevel(world); this.world = new ExtendWorld(world); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java index 8bce6ee96..05a80b100 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.tile; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.tile.TileTickEvent; public interface ExtendBlockEntityTicker extends BlockEntityTicker { @Override - default void tick(World world, BlockPos pos, BlockState state, T blockEntity) { + default void tick(Level world, BlockPos pos, BlockState state, T blockEntity) { tick(new TileTickEvent<>(world, pos, state, blockEntity)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java index 991878670..4ce375ada 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java @@ -3,7 +3,7 @@ import org.jetbrains.annotations.Nullable; @Deprecated -public interface RenderDataBlockEntity extends RenderDataBlockEntity { +public interface RenderDataBlockEntity { @Nullable Object getCompatRenderData(); @@ -11,11 +11,4 @@ public interface RenderDataBlockEntity extends RenderDataBlockEntity { default boolean hasCompatRenderData() { return getCompatRenderData() != null; } - - default Object getRenderData() { - if (this instanceof net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) { - return ((net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) this).getCompatRenderData(); - } - return null; - } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java index af90ff0c0..0b308d60f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.tile.v2; import com.mojang.datafixers.types.Type; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; import java.util.ArrayList; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java index f239e8608..2e4117f13 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.nbt.NbtCompound; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.nbt.CompoundTag; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; @@ -93,11 +93,11 @@ default boolean canExtract(FluidWrapper wrapper, long amount) { return canExtract(wrapper.get(), amount); } - default void writeNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + default void writeNbt(CompoundTag nbt, CompatRegistryLookup registryLookup) { writeNbt(new WriteNbtArgs(nbt, registryLookup)); } - default void readNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + default void readNbt(CompoundTag nbt, CompatRegistryLookup registryLookup) { readNbt(new WriteNbtArgs(nbt, registryLookup)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java index cc78339a4..85fa7d87b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.Fluids; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.Fluids; import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; public interface IFluidVariant { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java index 66aca0fe8..7b8a0e2e4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.recipe.Ingredient; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java index 6d04e40df..9db5a8e30 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java @@ -1,49 +1,49 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.TypedEntityData; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.component.TypedEntityData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; public class BlockEntityDataUtil { - public static NbtCompound getBlockEntityNbt(ItemStack stack) { + public static CompoundTag getBlockEntityNbt(ItemStack stack) { if (!hasBlockEntityNbt(stack)) return NbtUtil.create(); - TypedEntityData> data = stack.get(DataComponentTypes.BLOCK_ENTITY_DATA); - NbtCompound nbt = data.copyNbtWithoutId(); + TypedEntityData> data = stack.get(DataComponents.BLOCK_ENTITY_DATA); + CompoundTag nbt = data.copyTagWithoutId(); - String id = BlockEntityTypeUtil.toCompatID(data.getType()).toString(); + String id = BlockEntityTypeUtil.toCompatID(data.type()).toString(); NbtUtil.putString(nbt, "id", id); return nbt; } - public static void setBlockEntityNbt(ItemStack stack, NbtCompound nbt) { + public static void setBlockEntityNbt(ItemStack stack, CompoundTag nbt) { if (!nbt.contains("id")) return; BlockEntityType type = BlockEntityTypeUtil.fromId(CompatIdentifier.of(NbtUtil.getString(nbt, "id"))); - stack.set(DataComponentTypes.BLOCK_ENTITY_DATA, TypedEntityData.create(type, nbt)); + stack.set(DataComponents.BLOCK_ENTITY_DATA, TypedEntityData.of(type, nbt)); } public static boolean hasBlockEntityNbt(ItemStack stack) { - return stack.get(DataComponentTypes.BLOCK_ENTITY_DATA) != null; + return stack.get(DataComponents.BLOCK_ENTITY_DATA) != null; } public static void readCompatBlockEntityNbtFromStack(ItemStack stack, CompatBlockEntity blockEntity) { - NbtCompound nbt = getBlockEntityNbt(stack); + CompoundTag nbt = getBlockEntityNbt(stack); blockEntity.readNbt(new ReadNbtArgs(nbt, RegistryLookupUtil.getRegistryLookup(blockEntity))); } public static void writeCompatBlockEntityNbtToStack(ItemStack stack, CompatBlockEntity blockEntity) { - NbtCompound nbt = getBlockEntityNbt(stack); + CompoundTag nbt = getBlockEntityNbt(stack); blockEntity.writeNbt(new WriteNbtArgs(nbt, RegistryLookupUtil.getRegistryLookup(blockEntity))); NbtUtil.putString(nbt, "id", BlockEntityTypeUtil.toCompatID(blockEntity.getType()).toString()); setBlockEntityNbt(stack, nbt); } public static void removeBlockEntityNbt(ItemStack stack) { - stack.remove(DataComponentTypes.BLOCK_ENTITY_DATA); + stack.remove(DataComponents.BLOCK_ENTITY_DATA); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java index da3ed3705..210387be5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.registry.Registries; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; public class BlockEntityTypeUtil { public static Identifier toID(BlockEntityType entityType) { - return Registries.BLOCK_ENTITY_TYPE.getId(entityType); + return BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(entityType); } public static BlockEntityType fromId(Identifier identifier) { - return Registries.BLOCK_ENTITY_TYPE.get(identifier); + return BuiltInRegistries.BLOCK_ENTITY_TYPE.getValue(identifier); } public static boolean isExist(Identifier identifier) { - return Registries.BLOCK_ENTITY_TYPE.containsId(identifier); + return BuiltInRegistries.BLOCK_ENTITY_TYPE.containsKey(identifier); } public static CompatIdentifier toCompatID(BlockEntityType entityType) { @@ -30,10 +30,10 @@ public static boolean isExist(CompatIdentifier identifier) { } public static int getRawId(BlockEntityType type) { - return Registries.BLOCK_ENTITY_TYPE.getRawId(type); + return BuiltInRegistries.BLOCK_ENTITY_TYPE.getId(type); } public static BlockEntityType fromIndex(int index) { - return Registries.BLOCK_ENTITY_TYPE.get(index); + return BuiltInRegistries.BLOCK_ENTITY_TYPE.byId(index); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java index 2bcea11b6..d2e645cb2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java @@ -1,54 +1,54 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.util.ProblemReporter; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; import org.jetbrains.annotations.Nullable; public class BlockEntityUtil { - public static BlockEntity getBlockEntity(World world, BlockPos pos) { + public static BlockEntity getBlockEntity(Level world, BlockPos pos) { return WorldUtil.getBlockEntity(world, pos); } - public static NbtCompound getBlockEntityNbt(@Nullable World world, BlockEntity blockEntity) { + public static CompoundTag getBlockEntityNbt(@Nullable Level world, BlockEntity blockEntity) { if (world == null) world = getWorld(blockEntity); if (world == null) return NbtUtil.create(); - return blockEntity.createNbt(world.getRegistryManager()); + return blockEntity.saveWithoutMetadata(world.registryAccess()); } - public static NbtCompound getBlockEntityNbt(BlockEntity blockEntity) { + public static CompoundTag getBlockEntityNbt(BlockEntity blockEntity) { return getBlockEntityNbt(null, blockEntity); } - public static World getWorld(BlockEntity blockEntity) { - return blockEntity.getWorld(); + public static Level getWorld(BlockEntity blockEntity) { + return blockEntity.getLevel(); } public static boolean hasWorld(BlockEntity blockEntity) { - return blockEntity.hasWorld(); + return blockEntity.hasLevel(); } public static BlockPos getPos(BlockEntity blockEntity) { - return blockEntity.getPos(); + return blockEntity.getBlockPos(); } public static BlockState getCachedState(BlockEntity blockEntity) { - return blockEntity.getCachedState(); + return blockEntity.getBlockState(); } public static BlockState getBlockState(BlockEntity blockEntity) { @@ -60,53 +60,53 @@ public static Block getBlock(BlockEntity blockEntity) { } public static void markRemoved(BlockEntity blockEntity) { - blockEntity.markRemoved(); + blockEntity.setRemoved(); } public static void markDirty(BlockEntity blockEntity) { - blockEntity.markDirty(); + blockEntity.setChanged(); } public static BlockEntityType getType(BlockEntity blockEntity) { return blockEntity.getType(); } - public static void readNbt(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { - ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); - blockEntity.readComponentlessData(view); + public static void readNbt(BlockEntity blockEntity, CompoundTag nbt, CompatRegistryLookup registryLookup) { + ValueInput view = NbtDataConverter.nbt2readData(nbt, registryLookup); + blockEntity.loadCustomOnly(view); } - public static void writeNbt(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { - NbtWriteView view = NbtWriteView.create(ErrorReporter.EMPTY); - blockEntity.writeComponentlessData(view); + public static void writeNbt(BlockEntity blockEntity, CompoundTag nbt, CompatRegistryLookup registryLookup) { + TagValueOutput view = TagValueOutput.createWithoutContext(ProblemReporter.DISCARDING); + blockEntity.saveCustomOnly(view); NbtDataConverter.data2nbt(view, nbt); } - public static void read(BlockEntity blockEntity, NbtCompound nbt, CompatRegistryLookup registryLookup) { - ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); - blockEntity.read(view); + public static void read(BlockEntity blockEntity, CompoundTag nbt, CompatRegistryLookup registryLookup) { + ValueInput view = NbtDataConverter.nbt2readData(nbt, registryLookup); + blockEntity.loadWithComponents(view); } - public static NbtCompound createNbt(BlockEntity blockEntity, CompatRegistryLookup registryLookup) { - return blockEntity.createNbt(registryLookup.getRegistryLookup()); + public static CompoundTag createNbt(BlockEntity blockEntity, CompatRegistryLookup registryLookup) { + return blockEntity.saveWithoutMetadata(registryLookup.getRegistryLookup()); } public static void setStackNbt(BlockEntity blockEntity, ItemStack stack, CompatRegistryLookup registryLookup) { - blockEntity.readComponents(stack); + blockEntity.applyComponentsFromItemStack(stack); } - public static ServerWorld getServerWorld(BlockEntity blockEntity) { - return (ServerWorld) getWorld(blockEntity); + public static ServerLevel getServerWorld(BlockEntity blockEntity) { + return (ServerLevel) getWorld(blockEntity); } public static void writeToStack(ItemStack stack, BlockEntity blockEntity, CompatRegistryLookup registryLookup) { - NbtCompound nbt = blockEntity.createComponentlessNbt(registryLookup.getRegistryLookup()); + CompoundTag nbt = blockEntity.saveCustomOnly(registryLookup.getRegistryLookup()); if (!NbtUtil.has(nbt, "id")) NbtUtil.putString(nbt, "id", BlockEntityTypeUtil.toID(BlockEntityUtil.getType(blockEntity)).toString()); BlockEntityDataUtil.setBlockEntityNbt(stack, nbt); - blockEntity.createComponentMap().forEach(stack::set); + blockEntity.collectComponents().forEach(stack::set); } public static boolean isRemoved(BlockEntity blockEntity) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java index d0e81a1d4..eae78e112 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.Property; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.block.WireOrientation; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.item.ItemStack; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.redstone.Orientation; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; import net.pitan76.mcpitanlib.api.util.block.BlockHitResultUtil; @@ -34,11 +34,11 @@ public static boolean isAir(BlockState state) { } public static boolean isOpaque(BlockState state) { - return state.isOpaque(); + return state.canOcclude(); } - public static BlockSoundGroup getSoundGroup(BlockState state) { - return state.getSoundGroup(); + public static SoundType getSoundGroup(BlockState state) { + return state.getSoundType(); } public static CompatBlockSoundGroup getCompatSoundGroup(BlockState state) { @@ -46,48 +46,48 @@ public static CompatBlockSoundGroup getCompatSoundGroup(BlockState state) { } public static BlockState getDefaultState(Block block) { - return block.getDefaultState(); + return block.defaultBlockState(); } - public static StateManager getStateManager(Block block) { - return block.getStateManager(); + public static StateDefinition getStateManager(Block block) { + return block.getStateDefinition(); } public static , V extends T> BlockState with(BlockState state, Property property, V value) { - return state.with(property, value); + return state.setValue(property, value); } - public static void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { - WireOrientation wireOrientation = WireOrientation.of(pos.up() == fromPos ? Direction.UP : Direction.DOWN, pos.north() == fromPos ? Direction.NORTH : Direction.SOUTH, pos.east() == fromPos ? WireOrientation.SideBias.RIGHT : WireOrientation.SideBias.LEFT); + public static void neighborUpdate(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { + Orientation wireOrientation = Orientation.of(pos.above() == fromPos ? Direction.UP : Direction.DOWN, pos.north() == fromPos ? Direction.NORTH : Direction.SOUTH, pos.east() == fromPos ? Orientation.SideBias.RIGHT : Orientation.SideBias.LEFT); - state.neighborUpdate(world, pos, block, wireOrientation, notify); + state.handleNeighborChanged(world, pos, block, wireOrientation, notify); } - public static void updateNeighbors(BlockState state, WorldAccess world, BlockPos pos, int flags) { - state.updateNeighbors(world, pos, flags); + public static void updateNeighbors(BlockState state, LevelAccessor world, BlockPos pos, int flags) { + state.updateNeighbourShapes(world, pos, flags); } public static boolean hasRandomTicks(BlockState state) { - return state.hasRandomTicks(); + return state.isRandomlyTicking(); } - public static void randomTick(BlockState state, ServerWorld world, BlockPos pos) { + public static void randomTick(BlockState state, ServerLevel world, BlockPos pos) { state.randomTick(world, pos, world.random); } - public static CompatActionResult onUse(BlockState state, World world, Player player, BlockHitResult hitResult) { - return CompatActionResult.create(state.onUse(world, player.getEntity(), hitResult)); + public static CompatActionResult onUse(BlockState state, Level world, Player player, BlockHitResult hitResult) { + return CompatActionResult.create(state.useWithoutItem(world, player.getEntity(), hitResult)); } - public static CompatActionResult onUse(BlockState state, World world, Player player, Direction dir, BlockPos blockPos) { + public static CompatActionResult onUse(BlockState state, Level world, Player player, Direction dir, BlockPos blockPos) { return onUse(state, world, player, BlockHitResultUtil.create(player.getPos(), dir, blockPos)); } - public static CompatActionResult onUseWithItem(BlockState state, ItemStack stack, World world, PlayerEntity player, Hand hand, BlockHitResult hit) { - return CompatActionResult.create(state.onUseWithItem(stack, world, player, hand, hit)); + public static CompatActionResult onUseWithItem(BlockState state, ItemStack stack, Level world, Player player, InteractionHand hand, BlockHitResult hit) { + return CompatActionResult.create(state.useItemOn(stack, world, player, hand, hit)); } - public static CompatActionResult onUseWithItem_actionResult(BlockState state, ItemStack stack, World world, PlayerEntity player, Hand hand, BlockHitResult hit) { + public static CompatActionResult onUseWithItem_actionResult(BlockState state, ItemStack stack, Level world, Player player, InteractionHand hand, BlockHitResult hit) { return onUseWithItem(state, stack, world, player, hand, hit); } @@ -96,10 +96,10 @@ public static FluidState getFluidState(BlockState state) { } public static Fluid getFluid(BlockState state) { - return getFluidState(state).getFluid(); + return getFluidState(state).getType(); } - public static BlockState rotate(BlockState state, BlockRotation rotation) { + public static BlockState rotate(BlockState state, Rotation rotation) { return state.rotate(rotation); } @@ -111,24 +111,24 @@ public static net.pitan76.mcpitanlib.midohra.block.BlockState getDefaultState(Bl return block.getDefaultState(); } - public static float getHardness(BlockState state, BlockView world, BlockPos pos) { - return state.getHardness(world, pos); + public static float getHardness(BlockState state, BlockGetter world, BlockPos pos) { + return state.getDestroySpeed(world, pos); } - public static float getHardness(BlockState state, World world, BlockPos pos) { - return state.getHardness(world, pos); + public static float getHardness(BlockState state, Level world, BlockPos pos) { + return state.getDestroySpeed(world, pos); } public static int getLuminance(BlockState state) { - return state.getLuminance(); + return state.getLightEmission(); } public static int getOpacity(BlockState state) { - return state.getOpacity(); + return state.getLightBlock(); } - public static int getComparatorOutput(BlockState state, World world, BlockPos pos) { - return state.getComparatorOutput(world, pos, Direction.NORTH); + public static int getComparatorOutput(BlockState state, Level world, BlockPos pos) { + return state.getAnalogOutputSignal(world, pos, Direction.NORTH); } public static float getHardness(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.BlockView world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { @@ -147,8 +147,8 @@ public static int getComparatorOutput(net.pitan76.mcpitanlib.midohra.block.Block return getComparatorOutput(state.toMinecraft(), world.getRaw(), pos.toMinecraft()); } - public static boolean canPlaceAt(BlockState state, BlockPos pos, World world) { - return state.canPlaceAt(world, pos); + public static boolean canPlaceAt(BlockState state, BlockPos pos, Level world) { + return state.canSurvive(world, pos); } public static boolean canPlaceAt(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.world.World world) { @@ -159,7 +159,7 @@ public static boolean hasRandomTicks(net.pitan76.mcpitanlib.midohra.block.BlockS return hasRandomTicks(state.toMinecraft()); } - public static void randomTick(net.pitan76.mcpitanlib.midohra.block.BlockState state, ServerWorld world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + public static void randomTick(net.pitan76.mcpitanlib.midohra.block.BlockState state, ServerLevel world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { randomTick(state.toMinecraft(), world, pos.toMinecraft()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java index 6472e028d..63af9b0f3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; import net.pitan76.mcpitanlib.api.tag.MineableToolTags; @@ -51,7 +51,7 @@ public static boolean isIn(Block block, TagKey tagKey) { * @param level Level * @return Block settings */ - public static AbstractBlock.Settings breakByTool(AbstractBlock.Settings settings, MineableToolTags toolTags, int level) { + public static BlockBehaviour.Properties breakByTool(BlockBehaviour.Properties settings, MineableToolTags toolTags, int level) { return BlockUtilV1.breakByTool(settings, toolTags, level); } @@ -60,7 +60,7 @@ public static AbstractBlock.Settings breakByTool(AbstractBlock.Settings settings * @param settings Block settings * @return Block settings */ - public static AbstractBlock.Settings dropsNothing(AbstractBlock.Settings settings) { + public static BlockBehaviour.Properties dropsNothing(BlockBehaviour.Properties settings) { return BlockUtilV1.dropsNothing(settings); } /** @@ -68,7 +68,7 @@ public static AbstractBlock.Settings dropsNothing(AbstractBlock.Settings setting * @param settings Block settings * @return Block settings */ - public static AbstractBlock.Settings requiresTool(AbstractBlock.Settings settings) { + public static BlockBehaviour.Properties requiresTool(BlockBehaviour.Properties settings) { return BlockUtilV1.requiresTool(settings); } @@ -140,7 +140,7 @@ public static List getAllBlocks() { * @return Block created from Block.Settings. */ @Deprecated - public static Block of(AbstractBlock.Settings settings) { + public static Block of(BlockBehaviour.Properties settings) { return BlockUtilV1.of(settings); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java index a95953baf..fe68c971e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; public class BlockViewUtil { - public static BlockState getBlockState(BlockView blockView, BlockPos pos) { + public static BlockState getBlockState(BlockGetter blockView, BlockPos pos) { return blockView.getBlockState(pos); } - public static BlockEntity getBlockEntity(BlockView blockView, BlockPos pos) { + public static BlockEntity getBlockEntity(BlockGetter blockView, BlockPos pos) { return blockView.getBlockEntity(pos); } - public static boolean hasBlockEntity(BlockView blockView, BlockPos pos) { + public static boolean hasBlockEntity(BlockGetter blockView, BlockPos pos) { return getBlockEntity(blockView, pos) != null; } - public static boolean isAir(BlockView blockView, BlockPos pos) { + public static boolean isAir(BlockGetter blockView, BlockPos pos) { return getBlockState(blockView, pos).isAir(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java index 8173c9737..7e0be00ad 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java @@ -2,23 +2,23 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.permission.LeveledPermissionPredicate; -import net.minecraft.command.permission.PermissionLevel; +import net.minecraft.server.permissions.LevelBasedPermissionSet; +import net.minecraft.server.permissions.PermissionLevel; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.commands.Commands; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.server.level.ServerLevel; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.core.command.CommandResult; public class CommandManagerUtil { - public static CommandManager getCommandManager(MinecraftServer server) { - return server.getCommandManager(); + public static Commands getCommandManager(MinecraftServer server) { + return server.getCommands(); } public static CommandResult execute(MinecraftServer server, String command) { - CommandDispatcher dispatcher = getCommandManager(server).getDispatcher(); - ServerCommandSource source = server.getCommandSource(); + CommandDispatcher dispatcher = getCommandManager(server).getDispatcher(); + CommandSourceStack source = server.createCommandSourceStack(); if (command.startsWith("/")) { command = command.substring(1); @@ -43,8 +43,8 @@ public static CommandResult execute(MinecraftServer server, String command) { return cr; } - public static CommandResult execute(ServerCommandSource source, String command) { - CommandDispatcher dispatcher = source.getServer().getCommandManager().getDispatcher(); + public static CommandResult execute(CommandSourceStack source, String command) { + CommandDispatcher dispatcher = source.getServer().getCommands().getDispatcher(); if (command.startsWith("/")) { command = command.substring(1); @@ -73,15 +73,15 @@ public static CommandResult execute(Player player, String command) { return execute(getCommandSource(player), command); } - public static ServerCommandSource getCommandSource(MinecraftServer server) { - return server.getCommandSource(); + public static CommandSourceStack getCommandSource(MinecraftServer server) { + return server.createCommandSourceStack(); } - public static ServerCommandSource getCommandSource(Player player) { - return player.getEntity().getCommandSource((ServerWorld) player.getWorld()); + public static CommandSourceStack getCommandSource(Player player) { + return player.getEntity().createCommandSourceStackForNameResolution((ServerLevel) player.getWorld()); } - public static ServerCommandSource withLevel(ServerCommandSource source, int level) { - return source.withPermissions(LeveledPermissionPredicate.fromLevel(PermissionLevel.fromLevel(level))); + public static CommandSourceStack withLevel(CommandSourceStack source, int level) { + return source.withPermission(LevelBasedPermissionSet.forLevel(PermissionLevel.byId(level))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java index 8ba934d53..eb5acdab2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java @@ -2,21 +2,21 @@ import com.mojang.brigadier.arguments.*; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.block.Block; -import net.minecraft.command.argument.BlockStateArgumentType; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.ItemStackArgumentType; -import net.minecraft.entity.Entity; -import net.minecraft.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.commands.arguments.blocks.BlockStateArgument; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.item.ItemArgument; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; public class CommandUtil { public static Item getItemArgument(String name, ServerCommandEvent e) { - return ItemStackArgumentType.getItemStackArgument(e.getContext(), name).getItem(); + return ItemArgument.getItem(e.getContext(), name).getItem(); } public static Block getBlockArgument(String name, ServerCommandEvent e) { - return BlockStateArgumentType.getBlockState(e.getContext(), name).getBlockState().getBlock(); + return BlockStateArgument.getBlock(e.getContext(), name).getState().getBlock(); } public static Integer getIntegerArgument(String name, ServerCommandEvent e) { @@ -45,7 +45,7 @@ public static String getStringArgument(String name, ServerCommandEvent e) { public static Entity getEntityArgument(String name, ServerCommandEvent e) { try { - return EntityArgumentType.getEntity(e.getContext(), name); + return EntityArgument.getEntity(e.getContext(), name); } catch (CommandSyntaxException ex) { return null; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java index c17a5d707..1ff24b45f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java @@ -1,29 +1,29 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.util.ActionResult; +import net.minecraft.world.InteractionResult; import net.pitan76.mcpitanlib.api.event.result.EventResult; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import java.util.Optional; public class CompatActionResult { - public static final CompatActionResult SUCCESS = new CompatActionResult(ActionResult.SUCCESS, EventResult.success()); - public static final CompatActionResult PASS = new CompatActionResult(ActionResult.PASS, EventResult.pass()); - public static final CompatActionResult FAIL = new CompatActionResult(ActionResult.FAIL, EventResult.fail()); - public static final CompatActionResult CONSUME = new CompatActionResult(ActionResult.CONSUME, EventResult.success()); - public static final CompatActionResult PASS_TO_DEFAULT_BLOCK_ACTION = new CompatActionResult(ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION, EventResult.pass()); - public static final CompatActionResult SUCCESS_SERVER = new CompatActionResult(ActionResult.SUCCESS_SERVER, EventResult.success()); - public static final CompatActionResult STOP = new CompatActionResult(ActionResult.FAIL, EventResult.stop()); - - private final ActionResult actionResult; + public static final CompatActionResult SUCCESS = new CompatActionResult(InteractionResult.SUCCESS, EventResult.success()); + public static final CompatActionResult PASS = new CompatActionResult(InteractionResult.PASS, EventResult.pass()); + public static final CompatActionResult FAIL = new CompatActionResult(InteractionResult.FAIL, EventResult.fail()); + public static final CompatActionResult CONSUME = new CompatActionResult(InteractionResult.CONSUME, EventResult.success()); + public static final CompatActionResult PASS_TO_DEFAULT_BLOCK_ACTION = new CompatActionResult(InteractionResult.TRY_WITH_EMPTY_HAND, EventResult.pass()); + public static final CompatActionResult SUCCESS_SERVER = new CompatActionResult(InteractionResult.SUCCESS_SERVER, EventResult.success()); + public static final CompatActionResult STOP = new CompatActionResult(InteractionResult.FAIL, EventResult.stop()); + + private final InteractionResult actionResult; private final EventResult eventResult; - protected CompatActionResult(ActionResult actionResult, EventResult eventResult) { + protected CompatActionResult(InteractionResult actionResult, EventResult eventResult) { this.actionResult = actionResult; this.eventResult = eventResult; } - public ActionResult toActionResult() { + public InteractionResult toActionResult() { return actionResult; } @@ -35,30 +35,30 @@ public Optional getNewMidohraHandStack() { return getNewHandStack().map(ItemStack::of); } - public Optional getNewHandStack() { - if (!(actionResult instanceof ActionResult.Success)) return Optional.empty(); + public Optional getNewHandStack() { + if (!(actionResult instanceof InteractionResult.Success)) return Optional.empty(); - ActionResult.Success success = (ActionResult.Success) actionResult; - return Optional.ofNullable(success.getNewHandStack()); + InteractionResult.Success success = (InteractionResult.Success) actionResult; + return Optional.ofNullable(success.heldItemTransformedTo()); } - public static CompatActionResult of(ActionResult result) { - if (result == ActionResult.SUCCESS) + public static CompatActionResult of(InteractionResult result) { + if (result == InteractionResult.SUCCESS) return SUCCESS; - if (result == ActionResult.PASS) + if (result == InteractionResult.PASS) return PASS; - if (result == ActionResult.FAIL) + if (result == InteractionResult.FAIL) return FAIL; - if (result == ActionResult.CONSUME) + if (result == InteractionResult.CONSUME) return CONSUME; - if (result == ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION) + if (result == InteractionResult.TRY_WITH_EMPTY_HAND) return PASS_TO_DEFAULT_BLOCK_ACTION; - if (result == ActionResult.SUCCESS_SERVER) + if (result == InteractionResult.SUCCESS_SERVER) return SUCCESS_SERVER; return PASS; @@ -81,20 +81,20 @@ public static CompatActionResult of(EventResult result) { } @Deprecated - public static CompatActionResult create(ActionResult result, EventResult eventResult) { + public static CompatActionResult create(InteractionResult result, EventResult eventResult) { return new CompatActionResult(result, eventResult); } /** - * @deprecated Use {@link #of(ActionResult)} instead. + * @deprecated Use {@link #of(InteractionResult)} instead. */ @Deprecated - public static CompatActionResult create(ActionResult result) { + public static CompatActionResult create(InteractionResult result) { return of(result); } @Deprecated - public static CompatActionResult create2(ActionResult result) { + public static CompatActionResult create2(InteractionResult result) { return create(result, EventResult.stop()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java index e11866da2..04535b375 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.util.Formatting; -import net.minecraft.util.Rarity; +import net.minecraft.ChatFormatting; +import net.minecraft.world.item.Rarity; public class CompatRarity implements CompatStringIdentifiable { private final Rarity rarity; @@ -24,8 +24,8 @@ public Rarity get() { return rarity; } - public Formatting getFormatting() { - return rarity.getFormatting(); + public ChatFormatting getFormatting() { + return rarity.color(); } public String getName() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java index 2fb01f76e..c284c39d6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.StringRepresentable; -public interface CompatStringIdentifiable extends StringIdentifiable { +public interface CompatStringIdentifiable extends StringRepresentable { @Deprecated @Override - default String asString() { + default String getSerializedName() { return asString_compat(); } String asString_compat(); - default StringIdentifiable get() { + default StringRepresentable get() { return this; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java index bf3119a80..5f285a0a2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java @@ -1,27 +1,27 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.resources.Identifier; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; public class CompatibleRecipeEntryUtil { - public static CompatibleRecipeEntry createShapelessRecipe(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + public static CompatibleRecipeEntry createShapelessRecipe(Identifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, NonNullList input) { return new CompatibleRecipeEntry(id, group, category, RecipeUtil.createShapelessRecipe(id, group, category, output, input)); } - public static CompatibleRecipeEntry createShapelessRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + public static CompatibleRecipeEntry createShapelessRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, NonNullList input) { return createShapelessRecipe(id.toMinecraft(), group, category, output, input); } - public static RecipeEntry createShapelessRecipeM(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + public static RecipeEntry createShapelessRecipeM(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, NonNullList input) { return RecipeEntry.of(RecipeUtil.createShapelessRecipe(id.toMinecraft(), group, category, output, input), id); } - public static CompatRecipe createShapelessAsCompatRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { + public static CompatRecipe createShapelessAsCompatRecipe(CompatIdentifier id, String group, RecipeUtil.CompatibilityCraftingRecipeCategory category, ItemStack output, NonNullList input) { return new CompatRecipe(RecipeUtil.createShapelessRecipe(id.toMinecraft(), group, category, output, input), id.toMinecraft()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java index 96507c718..3abf38884 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.NbtComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.component.CustomData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; import java.util.Set; @@ -16,7 +16,7 @@ public class CustomDataUtil { * @param stack ItemStack * @return NBT */ - public static NbtCompound getOrCreateNbt(ItemStack stack) { + public static CompoundTag getOrCreateNbt(ItemStack stack) { if (!hasNbt(stack)) { return NbtUtil.create(); } @@ -29,8 +29,8 @@ public static NbtCompound getOrCreateNbt(ItemStack stack) { * @param stack ItemStack * @param nbt NBT */ - public static void setNbt(ItemStack stack, NbtCompound nbt) { - stack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(nbt)); + public static void setNbt(ItemStack stack, CompoundTag nbt) { + stack.set(DataComponents.CUSTOM_DATA, CustomData.of(nbt)); } /** @@ -39,7 +39,7 @@ public static void setNbt(ItemStack stack, NbtCompound nbt) { * @return NBTが存在するかどうか */ public static boolean hasNbt(ItemStack stack) { - return stack.get(DataComponentTypes.CUSTOM_DATA) != null; + return stack.get(DataComponents.CUSTOM_DATA) != null; } /** @@ -47,11 +47,11 @@ public static boolean hasNbt(ItemStack stack) { * @param stack ItemStack * @return NBT */ - public static NbtCompound getNbt(ItemStack stack) { - if (stack.get(DataComponentTypes.CUSTOM_DATA) == null) + public static CompoundTag getNbt(ItemStack stack) { + if (stack.get(DataComponents.CUSTOM_DATA) == null) return NbtUtil.create(); - return stack.get(DataComponentTypes.CUSTOM_DATA).copyNbt(); + return stack.get(DataComponents.CUSTOM_DATA).copyTag(); } /** @@ -60,8 +60,8 @@ public static NbtCompound getNbt(ItemStack stack) { * @param key キー * @param value 値 */ - public static void put(ItemStack stack, String key, NbtCompound value) { - NbtCompound nbt = getOrCreateNbt(stack); + public static void put(ItemStack stack, String key, CompoundTag value) { + CompoundTag nbt = getOrCreateNbt(stack); NbtUtil.put(nbt, key, value); setNbt(stack, nbt); } @@ -72,8 +72,8 @@ public static void put(ItemStack stack, String key, NbtCompound value) { * @param key キー * @return 値 */ - public static NbtCompound get(ItemStack stack, String key) { - NbtCompound nbt = getNbt(stack); + public static CompoundTag get(ItemStack stack, String key) { + CompoundTag nbt = getNbt(stack); return nbt.getCompoundOrEmpty(key); } @@ -83,7 +83,7 @@ public static NbtCompound get(ItemStack stack, String key) { * @param key キー */ public static void remove(ItemStack stack, String key) { - NbtCompound nbt = getNbt(stack); + CompoundTag nbt = getNbt(stack); nbt.remove(key); setNbt(stack, nbt); } @@ -98,7 +98,7 @@ public static boolean has(ItemStack stack, String key) { if (!hasNbt(stack)) return false; - NbtCompound nbt = getNbt(stack); + CompoundTag nbt = getNbt(stack); return nbt.contains(key); } @@ -110,7 +110,7 @@ public static boolean has(ItemStack stack, String key) { * @param 値 */ public static T get(ItemStack stack, String key, Class clazz) { - NbtCompound nbt = getNbt(stack); + CompoundTag nbt = getNbt(stack); return NbtUtil.get(nbt, key, clazz); } @@ -121,7 +121,7 @@ public static T get(ItemStack stack, String key, Class clazz) { * @param value 値 */ public static void set(ItemStack stack, String key, T value) { - NbtCompound nbt = getOrCreateNbt(stack); + CompoundTag nbt = getOrCreateNbt(stack); NbtUtil.set(nbt, key, value); setNbt(stack, nbt); } @@ -132,7 +132,7 @@ public static void set(ItemStack stack, String key, T value) { * @return キーの一覧 */ public static Set getKeys(ItemStack stack) { - NbtCompound nbt = getNbt(stack); + CompoundTag nbt = getNbt(stack); return NbtUtil.getKeys(nbt); } @@ -170,6 +170,6 @@ public static void fix_oldNbt(ItemStack stack, String[] keys) { * @param stack ItemStack */ public static void remove(ItemStack stack) { - stack.remove(DataComponentTypes.CUSTOM_DATA); + stack.remove(DataComponents.CUSTOM_DATA); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java index b5733480d..29997850b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.damagesource.DamageSource; import net.pitan76.mcpitanlib.api.entity.Player; public class DamageSourceUtil { public static DamageSource thrownProjectile(Entity projectile, Entity attacker, Entity source) { - return source.getDamageSources().thrown(projectile, attacker); + return source.damageSources().thrown(projectile, attacker); } public static DamageSource thrownProjectile(Entity projectile, Entity attacker) { @@ -15,7 +15,7 @@ public static DamageSource thrownProjectile(Entity projectile, Entity attacker) } public static DamageSource playerAttack(Player attacker, Entity source) { - return source.getDamageSources().playerAttack(attacker.getPlayerEntity()); + return source.damageSources().playerAttack(attacker.getPlayerEntity()); } public static DamageSource playerAttack(Player attacker) { @@ -23,7 +23,7 @@ public static DamageSource playerAttack(Player attacker) { } public static DamageSource mobAttack(LivingEntity attacker, Entity source) { - return source.getDamageSources().mobAttack(attacker); + return source.damageSources().mobAttack(attacker); } public static DamageSource mobAttack(LivingEntity attacker) { @@ -31,7 +31,7 @@ public static DamageSource mobAttack(LivingEntity attacker) { } public static DamageSource mobProjectile(Entity projectile, LivingEntity attacker, Entity source) { - return source.getDamageSources().mobProjectile(projectile, attacker); + return source.damageSources().mobProjectile(projectile, attacker); } public static DamageSource mobProjectile(Entity projectile, LivingEntity attacker) { @@ -39,6 +39,6 @@ public static DamageSource mobProjectile(Entity projectile, LivingEntity attacke } public static DamageSource fall(Entity source) { - return source.getDamageSources().fall(); + return source.damageSources().fall(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java index 94224ccec..20d967ee6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.ItemEnchantmentsComponent; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.enchantment.ItemEnchantments; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.ItemStack; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; import org.jetbrains.annotations.Nullable; @@ -19,7 +19,7 @@ public class EnchantmentUtil { public static CompatEnchantment getEnchantment(Identifier identifier) { - RegistryKey registryKey = RegistryKey.of(RegistryKeys.ENCHANTMENT, identifier); + ResourceKey registryKey = ResourceKey.create(Registries.ENCHANTMENT, identifier); return new CompatEnchantment(registryKey); } @@ -27,7 +27,7 @@ public static Identifier getId(CompatEnchantment enchantment) { return enchantment.getId(); } - public static int getLevel(CompatEnchantment enchantment, ItemStack stack, @Nullable World world) { + public static int getLevel(CompatEnchantment enchantment, ItemStack stack, @Nullable Level world) { return enchantment.getLevel(stack, world); } @@ -43,19 +43,19 @@ public static CompatIdentifier getCompatId(CompatEnchantment enchantment) { public static List getEnchantments(ItemStack stack) { List enchantments = new ArrayList<>(); - EnchantmentHelper.getEnchantments(stack).getEnchantments().forEach((enchantment) -> { - if (enchantment.getKey().isPresent()) - enchantments.add(new CompatEnchantment(enchantment.getKey().get())); + EnchantmentHelper.getEnchantmentsForCrafting(stack).keySet().forEach((enchantment) -> { + if (enchantment.unwrapKey().isPresent()) + enchantments.add(new CompatEnchantment(enchantment.unwrapKey().get())); }); return enchantments; } public static boolean hasEnchantment(ItemStack stack) { - return EnchantmentHelper.hasEnchantments(stack); + return EnchantmentHelper.hasAnyEnchantments(stack); } - public static Map getEnchantment(ItemStack stack, @Nullable World world) { + public static Map getEnchantment(ItemStack stack, @Nullable Level world) { Map enchantments = new HashMap<>(); List enchantmentList = getEnchantments(stack); @@ -66,17 +66,17 @@ public static Map getEnchantment(ItemStack stack, @N return enchantments; } - public static void setEnchantment(ItemStack stack, Map enchantments, @Nullable World world) { - ItemEnchantmentsComponent.Builder builder = new ItemEnchantmentsComponent.Builder(ItemEnchantmentsComponent.DEFAULT); + public static void setEnchantment(ItemStack stack, Map enchantments, @Nullable Level world) { + ItemEnchantments.Mutable builder = new ItemEnchantments.Mutable(ItemEnchantments.EMPTY); enchantments.forEach((compatEnchantment, integer) -> { - builder.add(compatEnchantment.getEntry(world), integer); + builder.upgrade(compatEnchantment.getEntry(world), integer); }); - EnchantmentHelper.set(stack, builder.build()); + EnchantmentHelper.setEnchantments(stack, builder.toImmutable()); } public static void removeEnchantment(ItemStack stack) { - stack.remove(DataComponentTypes.ENCHANTMENTS); + stack.remove(DataComponents.ENCHANTMENTS); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java index 8fc1f79ac..78a1af270 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.entity.EntityType; -import net.minecraft.registry.Registries; -import net.minecraft.text.Text; +import net.minecraft.world.entity.EntityType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; public class EntityTypeUtil { public static Identifier toID(EntityType entityType) { - return Registries.ENTITY_TYPE.getId(entityType); + return BuiltInRegistries.ENTITY_TYPE.getKey(entityType); } public static EntityType fromId(Identifier identifier) { - return Registries.ENTITY_TYPE.get(identifier); + return BuiltInRegistries.ENTITY_TYPE.getValue(identifier); } public static boolean isExist(Identifier identifier) { - return Registries.ENTITY_TYPE.containsId(identifier); + return BuiltInRegistries.ENTITY_TYPE.containsKey(identifier); } public static CompatIdentifier toCompatID(EntityType entityType) { @@ -31,18 +31,18 @@ public static boolean isExist(CompatIdentifier identifier) { } public static int getRawId(EntityType type) { - return Registries.ENTITY_TYPE.getRawId(type); + return BuiltInRegistries.ENTITY_TYPE.getId(type); } public static EntityType fromIndex(int index) { - return Registries.ENTITY_TYPE.get(index); + return BuiltInRegistries.ENTITY_TYPE.byId(index); } - public static Text getName(EntityType entityType) { - return entityType.getName(); + public static Component getName(EntityType entityType) { + return entityType.getDescription(); } public static String getTranslationKey(EntityType entityType) { - return entityType.getTranslationKey(); + return entityType.getDescriptionId(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java index 8872d9f4a..58aaba7e7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.network.packet.s2c.play.PositionFlag; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.text.Text; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Relative; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; @@ -16,28 +16,28 @@ import java.util.UUID; public class EntityUtil { - public static World getWorld(Entity entity) { - return entity.getEntityWorld(); + public static Level getWorld(Entity entity) { + return entity.level(); } public static boolean damage(Entity target, DamageSource damageSource, float amount) { - return target.damage((ServerWorld) target.getEntityWorld(), damageSource, amount); + return target.hurtServer((ServerLevel) target.level(), damageSource, amount); } public static boolean damageWithThrownProjectile(Entity target, float damageAmount, Entity projectile, Entity attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.thrownProjectile(projectile, attacker), damageAmount); + return target.hurtServer((ServerLevel) target.level(), DamageSourceUtil.thrownProjectile(projectile, attacker), damageAmount); } public static boolean damageWithMobProjectile(Entity target, float damageAmount, Entity projectile, LivingEntity attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.mobProjectile(projectile, attacker), damageAmount); + return target.hurtServer((ServerLevel) target.level(), DamageSourceUtil.mobProjectile(projectile, attacker), damageAmount); } public static boolean damageWithMobAttack(Entity target, float damageAmount, Entity source, LivingEntity attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.mobAttack(attacker, source), damageAmount); + return target.hurtServer((ServerLevel) target.level(), DamageSourceUtil.mobAttack(attacker, source), damageAmount); } public static boolean damageWithPlayerAttack(Entity target, float damageAmount, Entity source, Player attacker) { - return target.damage((ServerWorld) target.getEntityWorld(), DamageSourceUtil.playerAttack(attacker, source), damageAmount); + return target.hurtServer((ServerLevel) target.level(), DamageSourceUtil.playerAttack(attacker, source), damageAmount); } public static void discard(Entity entity) { @@ -45,18 +45,18 @@ public static void discard(Entity entity) { } public static void kill(Entity entity) { - if (entity.getEntityWorld() instanceof ServerWorld) + if (entity.level() instanceof ServerLevel) return; - entity.kill((ServerWorld) entity.getEntityWorld()); + entity.kill((ServerLevel) entity.level()); } public static void setVelocity(Entity entity, double x, double y, double z) { - entity.setVelocity(x, y, z); + entity.setDeltaMovement(x, y, z); } - public static Vec3d getVelocity(Entity entity) { - return entity.getVelocity(); + public static Vec3 getVelocity(Entity entity) { + return entity.getDeltaMovement(); } public static void setNoGravity(Entity entity, boolean noGravity) { @@ -64,7 +64,7 @@ public static void setNoGravity(Entity entity, boolean noGravity) { } public static boolean hasNoGravity(Entity entity) { - return entity.hasNoGravity(); + return entity.isNoGravity(); } public static void setInvulnerable(Entity entity, boolean invulnerable) { @@ -84,19 +84,19 @@ public static boolean isSilent(Entity entity) { } public static void setGlowing(Entity entity, boolean glowing) { - entity.setGlowing(glowing); + entity.setGlowingTag(glowing); } public static boolean isGlowing(Entity entity) { - return entity.isGlowing(); + return entity.isCurrentlyGlowing(); } public static void setFire(Entity entity, int seconds) { - entity.setOnFireFor(seconds); + entity.igniteForSeconds(seconds); } public static void extinguish(Entity entity) { - entity.extinguish(); + entity.clearFire(); } public static boolean isOnFire(Entity entity) { @@ -112,11 +112,11 @@ public static boolean isInvisible(Entity entity) { } public static void setSneaking(Entity entity, boolean sneaking) { - entity.setSneaking(sneaking); + entity.setShiftKeyDown(sneaking); } public static boolean isSneaking(Entity entity) { - return entity.isSneaking(); + return entity.isShiftKeyDown(); } public static void setSprinting(Entity entity, boolean sprinting) { @@ -136,7 +136,7 @@ public static boolean isSwimming(Entity entity) { } public static void detach(Entity entity) { - entity.detach(); + entity.unRide(); } public static void attach(Entity entity, Entity vehicle) { @@ -148,7 +148,7 @@ public static void detachFromVehicle(Entity entity) { } public static boolean isRiding(Entity entity) { - return entity.hasVehicle(); + return entity.isPassenger(); } public static Entity getVehicle(Entity entity) { @@ -159,12 +159,12 @@ public static void setVehicle(Entity entity, Entity vehicle) { entity.startRiding(vehicle, true, true); } - public static void applyRotation(Entity entity, BlockRotation rotation) { - entity.applyRotation(rotation); + public static void applyRotation(Entity entity, Rotation rotation) { + entity.rotate(rotation); } - public static void setVelocity(Entity entity, Vec3d velocity) { - entity.setVelocity(velocity); + public static void setVelocity(Entity entity, Vec3 velocity) { + entity.setDeltaMovement(velocity); } public static void setFallDistance(Entity entity, double fallDistance) { @@ -176,39 +176,39 @@ public static double getFallDistance(Entity entity) { } public static void setVelocityModified(Entity entity, boolean velocityModified) { - entity.velocityDirty = velocityModified; + entity.needsSync = velocityModified; } public static boolean isVelocityModified(Entity entity) { - return entity.velocityDirty; + return entity.needsSync; } public static float getYaw(Entity entity) { - return entity.getYaw(); + return entity.getYRot(); } public static float getPitch(Entity entity) { - return entity.getPitch(); + return entity.getXRot(); } public static void setYaw(Entity entity, float yaw) { - entity.setYaw(yaw); + entity.setYRot(yaw); } public static void setPitch(Entity entity, float pitch) { - entity.setPitch(pitch); + entity.setXRot(pitch); } public static float getSpeed(Entity entity) { - return entity.speed; + return entity.flyDist; } public static void setSpeed(Entity entity, float speed) { - entity.speed = speed; + entity.flyDist = speed; } public static boolean isOnGround(Entity entity) { - return entity.isOnGround(); + return entity.onGround(); } public static void setOnGround(Entity entity, boolean onGround) { @@ -220,30 +220,30 @@ public static boolean isAlive(Entity entity) { } public static UUID getUuid(Entity entity) { - return entity.getUuid(); + return entity.getUUID(); } public static String getUuidString(Entity entity) { - return entity.getUuidAsString(); + return entity.getStringUUID(); } public static void setUuid(Entity entity, UUID uuid) { - entity.setUuid(uuid); + entity.setUUID(uuid); } - public static Text getName(Entity entity) { + public static Component getName(Entity entity) { return entity.getName(); } - public static Text getDisplayName(Entity entity) { + public static Component getDisplayName(Entity entity) { return entity.getDisplayName(); } - public static void setCustomName(Entity entity, Text customName) { + public static void setCustomName(Entity entity, Component customName) { entity.setCustomName(customName); } - public static Text getCustomName(Entity entity) { + public static Component getCustomName(Entity entity) { return entity.getCustomName(); } @@ -279,12 +279,12 @@ public static void setCustomName(Entity entity, String customName) { entity.setCustomName(TextUtil.literal(customName)); } - public static Vec3d getRotationVector(Entity entity) { - return entity.getRotationVector(); + public static Vec3 getRotationVector(Entity entity) { + return entity.getLookAngle(); } - public static Vec3d getPos(Entity entity) { - return entity.getEntityPos(); + public static Vec3 getPos(Entity entity) { + return entity.position(); } public static Vector3d getPosM(Entity entity) { @@ -292,15 +292,15 @@ public static Vector3d getPosM(Entity entity) { } public static void setPos(Entity entity, double x, double y, double z) { - entity.setPos(x, y, z); + entity.setPosRaw(x, y, z); } public static void addVelocity(Entity entity, double x, double y, double z) { - entity.addVelocity(x, y, z); + entity.push(x, y, z); } - public static void addVelocity(Entity entity, Vec3d velocity) { - entity.addVelocity(velocity); + public static void addVelocity(Entity entity, Vec3 velocity) { + entity.push(velocity); } public static void addVelocity(Entity entity, Vector3d velocity) { @@ -308,7 +308,7 @@ public static void addVelocity(Entity entity, Vector3d velocity) { } public static void setVelocity(Entity entity, Vector3d velocity) { - entity.setVelocity(velocity.toMinecraft()); + entity.setDeltaMovement(velocity.toMinecraft()); } public static void setPos(Entity entity, BlockPos pos) { @@ -319,31 +319,31 @@ public static void setPos(Entity entity, Vector3d pos) { setPos(entity, pos.getX(), pos.getY(), pos.getZ()); } - public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - entity.teleport(world, x, y, z, PositionFlag.VALUES, yaw, pitch, resetCamera); + public static void teleport(Entity entity, ServerLevel world, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + entity.teleportTo(world, x, y, z, Relative.ALL, yaw, pitch, resetCamera); } - public static void teleport(Entity entity, ServerWorld world, double x, double y, double z, float yaw, float pitch) { + public static void teleport(Entity entity, ServerLevel world, double x, double y, double z, float yaw, float pitch) { teleport(entity, world, x, y, z, yaw, pitch, true); } - public static void teleport(Entity entity, ServerWorld world, double x, double y, double z) { - teleport(entity, world, x, y, z, entity.getYaw(), entity.getPitch(), true); + public static void teleport(Entity entity, ServerLevel world, double x, double y, double z) { + teleport(entity, world, x, y, z, entity.getYRot(), entity.getXRot(), true); } - public static void teleport(Entity entity, ServerWorld world, Vector3d pos) { + public static void teleport(Entity entity, ServerLevel world, Vector3d pos) { teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); } - public static void teleport(Entity entity, ServerWorld world, BlockPos pos) { + public static void teleport(Entity entity, ServerLevel world, BlockPos pos) { teleport(entity, world, pos.getX(), pos.getY(), pos.getZ()); } public static void teleport(Entity entity, double x, double y, double z) { - if (!(entity.getEntityWorld() instanceof ServerWorld)) + if (!(entity.level() instanceof ServerLevel)) return; - teleport(entity, (ServerWorld) entity.getEntityWorld(), x, y, z, entity.getYaw(), entity.getPitch()); + teleport(entity, (ServerLevel) entity.level(), x, y, z, entity.getYRot(), entity.getXRot()); } public static void teleport(Entity entity, Vector3d pos) { @@ -354,11 +354,11 @@ public static void teleport(Entity entity, BlockPos pos) { teleport(entity, pos.getX(), pos.getY(), pos.getZ()); } - public static void teleport(Entity entity, ServerWorld world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { + public static void teleport(Entity entity, ServerLevel world, Vector3d pos, float yaw, float pitch, boolean resetCamera) { teleport(entity, world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); } - public static void teleport(Entity entity, ServerWorld raw, BlockPos pos, float yaw, float pitch, boolean resetCamera) { + public static void teleport(Entity entity, ServerLevel raw, BlockPos pos, float yaw, float pitch, boolean resetCamera) { teleport(entity, raw, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java index 175bd2ba2..98229d799 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.item.ToolMaterial; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.tags.ItemTags; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; import net.pitan76.mcpitanlib.api.item.CompatibleArmorMaterial; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java index 5b2a4a017..6beb87ca6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.structure.rule.RuleTest; -import net.minecraft.structure.rule.TagMatchRuleTest; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.Feature; -import net.minecraft.world.gen.feature.OreFeatureConfig; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; +import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.feature.Feature; +import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import java.util.ArrayList; import java.util.List; @@ -20,7 +20,7 @@ public class FeatureConfigUtil { * @param oreFeatureConfig The ore feature config * @return The new ConfiguredFeature */ - public static ConfiguredFeature createConfiguredFeature(OreFeatureConfig oreFeatureConfig) { + public static ConfiguredFeature createConfiguredFeature(OreConfiguration oreFeatureConfig) { return new ConfiguredFeature<>(Feature.ORE, oreFeatureConfig); } @@ -31,8 +31,8 @@ public class FeatureConfigUtil { * @param size The size * @return The new OreFeatureConfig */ - public static OreFeatureConfig createOreFeatureConfig(RuleTest test, BlockState state, int size) { - return new OreFeatureConfig(test, state, size); + public static OreConfiguration createOreFeatureConfig(RuleTest test, BlockState state, int size) { + return new OreConfiguration(test, state, size); } /** @@ -42,8 +42,8 @@ public static OreFeatureConfig createOreFeatureConfig(RuleTest test, BlockState * @param size The size * @return The new OreFeatureConfig */ - public static OreFeatureConfig createOreFeatureConfig(RuleTest test, Block block, int size) { - return createOreFeatureConfig(test, block.getDefaultState(), size); + public static OreConfiguration createOreFeatureConfig(RuleTest test, Block block, int size) { + return createOreFeatureConfig(test, block.defaultBlockState(), size); } /** @@ -52,8 +52,8 @@ public static OreFeatureConfig createOreFeatureConfig(RuleTest test, Block block * @param size The size * @return The new OreFeatureConfig */ - public static OreFeatureConfig createOreFeatureConfig(List targets, int size) { - return new OreFeatureConfig(targets, size); + public static OreConfiguration createOreFeatureConfig(List targets, int size) { + return new OreConfiguration(targets, size); } /** @@ -62,9 +62,9 @@ public static OreFeatureConfig createOreFeatureConfig(List targetMap, int size) { - List targets = new ArrayList<>(); - targetMap.forEach((ruleTest, blockState) -> targets.add(OreFeatureConfig.createTarget(ruleTest, blockState))); + public static OreConfiguration createOreFeatureConfig(Map targetMap, int size) { + List targets = new ArrayList<>(); + targetMap.forEach((ruleTest, blockState) -> targets.add(OreConfiguration.target(ruleTest, blockState))); return createOreFeatureConfig(targets, size); } @@ -74,8 +74,8 @@ public static OreFeatureConfig createOreFeatureConfig(Map * @param size The size * @return The new OreFeatureConfig */ - public static OreFeatureConfig createStoneOreFeatureConfig(BlockState state, int size) { - RuleTest ruleTest = new TagMatchRuleTest(BlockTags.BASE_STONE_OVERWORLD); + public static OreConfiguration createStoneOreFeatureConfig(BlockState state, int size) { + RuleTest ruleTest = new TagMatchTest(BlockTags.BASE_STONE_OVERWORLD); return createOreFeatureConfig(ruleTest, state, size); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java index 848547d07..91cd0fc43 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.BlockState; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.registry.tag.FluidTags; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.tags.FluidTags; import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.world.World; public class FluidStateUtil { public static boolean isWater(FluidState state) { - return state.isIn(FluidTags.WATER); + return state.is(FluidTags.WATER); } public static boolean isLava(FluidState state) { - return state.isIn(FluidTags.LAVA); + return state.is(FluidTags.LAVA); } @Deprecated @@ -23,11 +23,11 @@ public static FluidState getFluidState(BlockState state) { } public static FluidState getDefaultState(Fluid state) { - return state.getDefaultState(); + return state.defaultFluidState(); } public static Fluid getFluid(FluidState state) { - return state.getFluid(); + return state.getType(); } public static FluidWrapper getFluidWrapper(FluidState state) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java index 11814995c..891edd8ce 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.fluid.FlowableFluid; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; +import net.minecraft.world.level.material.FlowingFluid; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.item.Item; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; -import net.minecraft.world.WorldView; +import net.minecraft.world.level.LevelReader; public class FluidUtil { public static Identifier toID(Fluid fluid) { - return Registries.FLUID.getId(fluid); + return BuiltInRegistries.FLUID.getKey(fluid); } public static Fluid fromId(Identifier identifier) { - return Registries.FLUID.get(identifier); + return BuiltInRegistries.FLUID.getValue(identifier); } public static Fluid fromId(CompatIdentifier identifier) { @@ -23,15 +23,15 @@ public static Fluid fromId(CompatIdentifier identifier) { } public static int getRawId(Fluid fluid) { - return Registries.FLUID.getRawId(fluid); + return BuiltInRegistries.FLUID.getId(fluid); } public static Fluid fromIndex(int index) { - return Registries.FLUID.get(index); + return BuiltInRegistries.FLUID.byId(index); } public static boolean isExist(CompatIdentifier id) { - return Registries.FLUID.containsId(id.toMinecraft()); + return BuiltInRegistries.FLUID.containsKey(id.toMinecraft()); } public static CompatIdentifier toCompatId(Fluid fluid) { @@ -42,11 +42,11 @@ public static Fluid fromCompatId(CompatIdentifier id) { return fromId(id.toMinecraft()); } - public static FlowableFluid water() { + public static FlowingFluid water() { return Fluids.WATER; } - public static FlowableFluid lava() { + public static FlowingFluid lava() { return Fluids.LAVA; } @@ -54,11 +54,11 @@ public static Fluid empty() { return Fluids.EMPTY; } - public static FlowableFluid flowingWater() { + public static FlowingFluid flowingWater() { return Fluids.FLOWING_WATER; } - public static FlowableFluid flowingLava() { + public static FlowingFluid flowingLava() { return Fluids.FLOWING_LAVA; } @@ -67,18 +67,18 @@ public static boolean isStill(Fluid fluid) { } public static boolean isStill(FluidState state) { - return state.isStill(); + return state.isSource(); } - public static FluidState getStill(FlowableFluid fluid, boolean falling) { - return fluid.getStill(falling); + public static FluidState getStill(FlowingFluid fluid, boolean falling) { + return fluid.getSource(falling); } - public static FluidState getFlowing(FlowableFluid fluid, int level, boolean falling) { + public static FluidState getFlowing(FlowingFluid fluid, int level, boolean falling) { return fluid.getFlowing(level, falling); } - public static FluidState getStill(FlowableFluid fluid) { + public static FluidState getStill(FlowingFluid fluid) { return getStill(fluid, false); } @@ -94,16 +94,16 @@ public static boolean isFlowing(Fluid fluid) { return fluid == flowingWater() || fluid == flowingLava(); } - public static int getTickRate(Fluid fluid, WorldView world) { - return fluid.getTickRate(world); + public static int getTickRate(Fluid fluid, LevelReader world) { + return fluid.getTickDelay(world); } public static FluidState getDefaultState(Fluid fluid) { - return fluid.getDefaultState(); + return fluid.defaultFluidState(); } public static Item getBucketItem(Fluid fluid) { - return fluid.getBucketItem(); + return fluid.getBucket(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java index 8690b4db9..d52a7bd0a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java @@ -1,31 +1,31 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.util.Hand; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.InteractionHand; public class HandUtil { - public static Hand getOppositeHand(Hand hand) { - return hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND; + public static InteractionHand getOppositeHand(InteractionHand hand) { + return hand == InteractionHand.MAIN_HAND ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND; } - public static EquipmentSlot getEquipmentSlot(Hand hand) { - return hand == Hand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; + public static EquipmentSlot getEquipmentSlot(InteractionHand hand) { + return hand == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND; } - public static Hand getHand(EquipmentSlot slot) { - return slot == EquipmentSlot.MAINHAND ? Hand.MAIN_HAND : Hand.OFF_HAND; + public static InteractionHand getHand(EquipmentSlot slot) { + return slot == EquipmentSlot.MAINHAND ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; } - public static Hand getHand(boolean mainHand) { - return mainHand ? Hand.MAIN_HAND : Hand.OFF_HAND; + public static InteractionHand getHand(boolean mainHand) { + return mainHand ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; } - public static boolean isMainHand(Hand hand) { - return hand == Hand.MAIN_HAND; + public static boolean isMainHand(InteractionHand hand) { + return hand == InteractionHand.MAIN_HAND; } - public static boolean isOffHand(Hand hand) { - return hand == Hand.OFF_HAND; + public static boolean isOffHand(InteractionHand hand) { + return hand == InteractionHand.OFF_HAND; } public static boolean isMainHand(EquipmentSlot slot) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java index f4448af6d..c1220e74d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java @@ -4,11 +4,11 @@ public class IdentifierUtil { public static Identifier id(String id) { - return Identifier.of(id); + return Identifier.parse(id); } public static Identifier id(String namespace, String path) { - return Identifier.of(namespace, path); + return Identifier.fromNamespaceAndPath(namespace, path); } public static String toString(Identifier identifier) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java index 97c39bcd3..968edb6a9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java @@ -2,15 +2,15 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.registry.Registries; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.entry.RegistryEntryList; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; import net.minecraft.resources.Identifier; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.core.NonNullList; import java.util.ArrayList; import java.util.Arrays; @@ -20,14 +20,14 @@ public class IngredientUtil { public static Ingredient fromTagByIdentifier(Identifier id) { List items = ItemUtil.getItems(id); - List> entryList = new ArrayList<>(); + List> entryList = new ArrayList<>(); for (Item item : items) { - entryList.add(Registries.ITEM.getEntry(item)); + entryList.add(BuiltInRegistries.ITEM.wrapAsHolder(item)); } - RegistryEntryList entryList2 = RegistryEntryList.of(entryList); + HolderSet entryList2 = HolderSet.direct(entryList); - return Ingredient.ofTag(entryList2); + return Ingredient.of(entryList2); } public static Ingredient fromTagByString(String id) { @@ -41,7 +41,7 @@ public static Ingredient fromTagByIdentifier(CompatIdentifier id) { public static List getItems(Ingredient ingredient) { List items = new ArrayList<>(); - for (RegistryEntry entry : ingredient.getMatchingItems().toList()) { + for (Holder entry : ingredient.items().toList()) { items.add(entry.value()); } @@ -75,20 +75,20 @@ public static Ingredient empty() { return null; } - public static Ingredient ofItems(ItemConvertible... items) { - return Ingredient.ofItems(items); + public static Ingredient ofItems(ItemLike... items) { + return Ingredient.of(items); } - public static DefaultedList buildInput(Object[] input) { - DefaultedList list = DefaultedList.of(); + public static NonNullList buildInput(Object[] input) { + NonNullList list = NonNullList.create(); for (Object obj : input) { if (obj instanceof Ingredient) { list.add((Ingredient) obj); continue; } - if (obj instanceof ItemConvertible) { - list.add(ofItems((ItemConvertible) obj)); + if (obj instanceof ItemLike) { + list.add(ofItems((ItemLike) obj)); } } return list; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java index ec99294b9..42b203eda 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.BlockState; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; import net.pitan76.mcpitanlib.api.event.item.ItemUseOnBlockEvent; @@ -22,8 +22,8 @@ public static StackActionResult useItem(Item item, ItemUseEvent event) { return StackActionResult.create(result, event.getStack()); } - public static CompatActionResult useItemOnBlock(Item item, ItemUsageContext context) { - return CompatActionResult.create(item.useOnBlock(context)); + public static CompatActionResult useItemOnBlock(Item item, UseOnContext context) { + return CompatActionResult.create(item.useOn(context)); } public static CompatActionResult useItemOnBlock(Item item, ItemUseOnBlockEvent event) { @@ -31,26 +31,26 @@ public static CompatActionResult useItemOnBlock(Item item, ItemUseOnBlockEvent e } public static CompatActionResult useItemOnEntity(Item item, ItemUseOnEntityEvent event) { - return CompatActionResult.create(item.useOnEntity(event.getStack(), event.getUser().getEntity(), event.getEntity(), event.getHand())); + return CompatActionResult.create(item.interactLivingEntity(event.getStack(), event.getUser().getEntity(), event.getEntity(), event.getHand())); } public static CompatUseAction getUseAction(Item item, UseActionArgs args) { - return CompatUseAction.of(item.getUseAction(args.stack)); + return CompatUseAction.of(item.getUseAnimation(args.stack)); } public static CompatUseAction getUseAction(Item item, ItemStack stack) { - return CompatUseAction.of(item.getUseAction(stack)); + return CompatUseAction.of(item.getUseAnimation(stack)); } - public static CompatActionResult useBlock(BlockState state, World world, Player player, BlockHitResult hitResult) { + public static CompatActionResult useBlock(BlockState state, Level world, Player player, BlockHitResult hitResult) { return BlockStateUtil.onUse(state, world, player, hitResult); } - public static CompatActionResult useBlock(BlockState state, World world, Player player, Direction dir, BlockPos blockPos) { + public static CompatActionResult useBlock(BlockState state, Level world, Player player, Direction dir, BlockPos blockPos) { return BlockStateUtil.onUse(state, world, player, dir, blockPos); } - public static boolean onStoppingUsing(Item item, ItemStack stack, World world, Player player, int remainingUseTicks) { - return item.onStoppedUsing(stack, world, player.getEntity(), remainingUseTicks); + public static boolean onStoppingUsing(Item item, ItemStack stack, Level world, Player player, int remainingUseTicks) { + return item.releaseUsing(stack, world, player.getEntity(), remainingUseTicks); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java index 8ff9c3eff..ac6674b4a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.world.World; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.util.ProblemReporter; +import net.minecraft.core.NonNullList; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; @@ -20,11 +20,11 @@ import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; public class InventoryUtil { - public static boolean insertItem(ItemStack insertStack, DefaultedList inventory) { + public static boolean insertItem(ItemStack insertStack, NonNullList inventory) { return insertItem(insertStack, inventory, false); } - public static boolean insertItem(ItemStack insertStack, DefaultedList inventory, boolean test) { + public static boolean insertItem(ItemStack insertStack, NonNullList inventory, boolean test) { boolean isInserted = false; for (int i = 0; i < inventory.size(); i++) { ItemStack stack = inventory.get(i); @@ -34,7 +34,7 @@ public static boolean insertItem(ItemStack insertStack, DefaultedList break; } else if (canMergeItems(stack, insertStack)) { int j = insertStack.getCount(); - if (!test) stack.increment(j); + if (!test) stack.grow(j); isInserted = j > 0; break; } @@ -44,26 +44,26 @@ public static boolean insertItem(ItemStack insertStack, DefaultedList } public static boolean canMergeItems(ItemStack first, ItemStack second) { - if (!first.isOf(second.getItem())) { + if (!first.is(second.getItem())) { return false; } - if (first.getDamage() != second.getDamage()) { + if (first.getDamageValue() != second.getDamageValue()) { return false; } - if (first.getCount() + second.getCount() > first.getMaxCount()) { + if (first.getCount() + second.getCount() > first.getMaxStackSize()) { return false; } return ItemStackUtil.areNbtOrComponentEqual(first, second); } - public static NbtCompound writeNbt(NbtRWArgs args, NbtCompound nbt, DefaultedList stacks, boolean setIfEmpty) { + public static CompoundTag writeNbt(NbtRWArgs args, CompoundTag nbt, NonNullList stacks, boolean setIfEmpty) { boolean nbtNull = nbt == null; if (args instanceof WriteNbtArgs) { WriteNbtArgs writeNbtArgs = (WriteNbtArgs) args; - if (writeNbtArgs.view == null) writeNbtArgs.view = NbtWriteView.create(ErrorReporter.EMPTY); + if (writeNbtArgs.view == null) writeNbtArgs.view = TagValueOutput.createWithoutContext(ProblemReporter.DISCARDING); - Inventories.writeData(writeNbtArgs.view, stacks, setIfEmpty); + ContainerHelper.saveAllItems(writeNbtArgs.view, stacks, setIfEmpty); if (!nbtNull) NbtUtil.put(nbt, "Items", NbtListUtil.create()); // dummy list to compat with old mod @@ -71,8 +71,8 @@ public static NbtCompound writeNbt(NbtRWArgs args, NbtCompound nbt, DefaultedLis return nbt; } - WriteView view = NbtDataConverter.nbt2writeData(nbt, args.registryLookup); - Inventories.writeData(view, stacks, setIfEmpty); + ValueOutput view = NbtDataConverter.nbt2writeData(nbt, args.registryLookup); + ContainerHelper.saveAllItems(view, stacks, setIfEmpty); if (!nbtNull) NbtUtil.put(nbt, "Items", NbtListUtil.create()); // dummy list to compat with old mod @@ -80,40 +80,40 @@ public static NbtCompound writeNbt(NbtRWArgs args, NbtCompound nbt, DefaultedLis return nbt; } - public static void readNbt(NbtRWArgs args, NbtCompound nbt, DefaultedList stacks) { + public static void readNbt(NbtRWArgs args, CompoundTag nbt, NonNullList stacks) { if (args instanceof ReadNbtArgs) { ReadNbtArgs readNbtArgs = (ReadNbtArgs) args; if (readNbtArgs.view == null) return; - Inventories.readData(readNbtArgs.view, stacks); + ContainerHelper.loadAllItems(readNbtArgs.view, stacks); return; } - ReadView view = NbtDataConverter.nbt2readData(nbt, args.registryLookup); - Inventories.readData(view, stacks); + ValueInput view = NbtDataConverter.nbt2readData(nbt, args.registryLookup); + ContainerHelper.loadAllItems(view, stacks); } - public static NbtCompound writeNbt(NbtRWArgs args, DefaultedList stacks, boolean setIfEmpty) { + public static CompoundTag writeNbt(NbtRWArgs args, NonNullList stacks, boolean setIfEmpty) { return writeNbt(args, args.getNbt(), stacks, setIfEmpty); } - public static NbtCompound writeNbt(NbtRWArgs args, DefaultedList stacks) { + public static CompoundTag writeNbt(NbtRWArgs args, NonNullList stacks) { return writeNbt(args, stacks, true); } - public static void readNbt(NbtRWArgs args, DefaultedList stacks) { + public static void readNbt(NbtRWArgs args, NonNullList stacks) { readNbt(args, args.getNbt(), stacks); } - public static void readNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks) { - ReadView view = NbtDataConverter.nbt2readData(nbt, registryLookup); - Inventories.readData(view, stacks); + public static void readNbt(CompatRegistryLookup registryLookup, CompoundTag nbt, NonNullList stacks) { + ValueInput view = NbtDataConverter.nbt2readData(nbt, registryLookup); + ContainerHelper.loadAllItems(view, stacks); } - public static NbtCompound writeNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks, boolean setIfEmpty) { + public static CompoundTag writeNbt(CompatRegistryLookup registryLookup, CompoundTag nbt, NonNullList stacks, boolean setIfEmpty) { NbtUtil.put(nbt, "Items", NbtListUtil.create()); - WriteView view = NbtDataConverter.nbt2writeData(nbt, registryLookup); - Inventories.writeData(view, stacks, setIfEmpty); + ValueOutput view = NbtDataConverter.nbt2writeData(nbt, registryLookup); + ContainerHelper.saveAllItems(view, stacks, setIfEmpty); NbtDataConverter.data2nbt(view, nbt); @@ -122,81 +122,81 @@ public static NbtCompound writeNbt(CompatRegistryLookup registryLookup, NbtCompo return nbt; } - public static NbtCompound writeNbt(CompatRegistryLookup registryLookup, NbtCompound nbt, DefaultedList stacks) { + public static CompoundTag writeNbt(CompatRegistryLookup registryLookup, CompoundTag nbt, NonNullList stacks) { return writeNbt(registryLookup, nbt, stacks, true); } // deprecated /** - * @deprecated Use {@link #writeNbt(NbtRWArgs, DefaultedList)} instead + * @deprecated Use {@link #writeNbt(NbtRWArgs, NonNullList)} instead */ @Deprecated - public static NbtCompound writeNbt(World world, NbtCompound nbt, DefaultedList stacks) { + public static CompoundTag writeNbt(Level world, CompoundTag nbt, NonNullList stacks) { return writeNbt(world, nbt, true, stacks); } /** - * @deprecated Use {@link #writeNbt(NbtRWArgs, DefaultedList, boolean)} instead + * @deprecated Use {@link #writeNbt(NbtRWArgs, NonNullList, boolean)} instead */ @Deprecated - public static NbtCompound writeNbt(World world, NbtCompound nbt, boolean setIfEmpty, DefaultedList stacks) { + public static CompoundTag writeNbt(Level world, CompoundTag nbt, boolean setIfEmpty, NonNullList stacks) { return writeNbt(new NbtRWArgs(nbt), stacks, setIfEmpty); } /** - * @deprecated Use {@link #readNbt(NbtRWArgs, DefaultedList)} instead + * @deprecated Use {@link #readNbt(NbtRWArgs, NonNullList)} instead */ @Deprecated - public static void readNbt(World world, NbtCompound nbt, DefaultedList stacks) { + public static void readNbt(Level world, CompoundTag nbt, NonNullList stacks) { readNbt(new ReadNbtArgs(nbt), stacks); } // ---- - public static SimpleInventory createSimpleInventory(int size) { - return new SimpleInventory(size); + public static SimpleContainer createSimpleInventory(int size) { + return new SimpleContainer(size); } - public static void copyToInv(DefaultedList from, Inventory to) { + public static void copyToInv(NonNullList from, Container to) { for (int i = 0; i < from.size(); i++) { - to.setStack(i, from.get(i)); + to.setItem(i, from.get(i)); } } - public static void copyToList(Inventory from, DefaultedList to) { - for (int i = 0; i < from.size(); i++) { - to.set(i, from.getStack(i)); + public static void copyToList(Container from, NonNullList to) { + for (int i = 0; i < from.getContainerSize(); i++) { + to.set(i, from.getItem(i)); } } - public static int getSize(Inventory inventory) { - return inventory.size(); + public static int getSize(Container inventory) { + return inventory.getContainerSize(); } - public static ItemStack getStack(Inventory inventory, int slot) { - return inventory.getStack(slot); + public static ItemStack getStack(Container inventory, int slot) { + return inventory.getItem(slot); } - public static void setStack(Inventory inventory, int slot, ItemStack stack) { - inventory.setStack(slot, stack); + public static void setStack(Container inventory, int slot, ItemStack stack) { + inventory.setItem(slot, stack); } - public static boolean isEmpty(Inventory inventory) { + public static boolean isEmpty(Container inventory) { return inventory.isEmpty(); } - public static ItemStack removeStack(Inventory inventory, int slot) { - return inventory.removeStack(slot); + public static ItemStack removeStack(Container inventory, int slot) { + return inventory.removeItemNoUpdate(slot); } - public static ItemStack removeStack(Inventory inventory, int slot, int amount) { - return inventory.removeStack(slot, amount); + public static ItemStack removeStack(Container inventory, int slot, int amount) { + return inventory.removeItem(slot, amount); } - public static void clear(Inventory inventory) { - inventory.clear(); + public static void clear(Container inventory) { + inventory.clearContent(); } - public static void markDirty(Inventory inventory) { - inventory.markDirty(); + public static void markDirty(Container inventory) { + inventory.setChanged(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java index 4e592d9b3..1d5674830 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java @@ -2,16 +2,16 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DataResult; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; import net.minecraft.nbt.NbtOps; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.world.World; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; @@ -30,7 +30,7 @@ public static ItemStack copyWithCount(ItemStack stack, int count) { } public static boolean areItemsEqual(ItemStack left, ItemStack right) { - return ItemStack.areItemsEqual(left, right); + return ItemStack.isSameItem(left, right); } @Deprecated @@ -63,7 +63,7 @@ public static boolean hasNbtOrComponent(ItemStack stack) { * @param nbt NbtCompound * @return ItemStack */ - public static ItemStack fromNbt(World world, NbtCompound nbt) { + public static ItemStack fromNbt(Level world, CompoundTag nbt) { return fromNbt(new ReadNbtArgs(nbt)); } @@ -73,15 +73,15 @@ public static ItemStack fromNbt(World world, NbtCompound nbt) { * @return ItemStack */ public static ItemStack fromNbt(NbtRWArgs args) { - DataResult> result = ItemStack.CODEC.decode(NbtOps.INSTANCE, args.nbt); + DataResult> result = ItemStack.CODEC.decode(NbtOps.INSTANCE, args.nbt); if (result.error().isPresent()) return ItemStack.EMPTY; - Pair pair = result.result().orElseThrow(); + Pair pair = result.result().orElseThrow(); return pair.getFirst(); } public static ItemStack getDefaultStack(Item item) { - return item.getDefaultStack(); + return item.getDefaultInstance(); } public static int getMaxDamage(ItemStack stack) { @@ -93,11 +93,11 @@ public static int getMaxDamage(Item item) { } public static int getDamage(ItemStack stack) { - return stack.getDamage(); + return stack.getDamageValue(); } public static void setDamage(ItemStack stack, int damage) { - stack.setDamage(damage); + stack.setDamageValue(damage); } public static int getCount(ItemStack stack) { @@ -109,27 +109,27 @@ public static void setCount(ItemStack stack, int count) { } public static void decrementCount(ItemStack stack, int count) { - stack.decrement(count); + stack.shrink(count); } public static void incrementCount(ItemStack stack, int count) { - stack.increment(count); + stack.grow(count); } - public static void damage(ItemStack stack, int amount, ServerPlayerEntity entity, Runnable breakCallback) { - stack.damage(amount, entity.getEntityWorld(), entity, (item) -> breakCallback.run()); + public static void damage(ItemStack stack, int amount, ServerPlayer entity, Runnable breakCallback) { + stack.hurtAndBreak(amount, entity.level(), entity, (item) -> breakCallback.run()); } public static void damage(ItemStack stack, int amount, LivingEntity entity, EquipmentSlot slot) { - stack.damage(amount, entity, slot); + stack.hurtAndBreak(amount, entity, slot); } - public static void damage(ItemStack stack, int amount, ServerPlayerEntity entity) { - stack.damage(amount, entity.getEntityWorld(), entity, (item) -> entity.sendEquipmentBreakStatus(item, EquipmentSlot.MAINHAND)); + public static void damage(ItemStack stack, int amount, ServerPlayer entity) { + stack.hurtAndBreak(amount, entity.level(), entity, (item) -> entity.onEquippedItemBroken(item, EquipmentSlot.MAINHAND)); } public static void damage(ItemStack stack, int amount, Player entity) { - Optional player = entity.getServerPlayer(); + Optional player = entity.getServerPlayer(); if (player.isEmpty()) return; damage(stack, amount, player.get()); @@ -149,12 +149,12 @@ public static ItemStack create(Item item, int count) { return new ItemStack(item, count); } - public static ItemStack create(ItemConvertible item) { + public static ItemStack create(ItemLike item) { if (item == null) return empty(); return new ItemStack(item); } - public static ItemStack create(ItemConvertible item, int count) { + public static ItemStack create(ItemLike item, int count) { if (item == null) return empty(); return new ItemStack(item, count); } @@ -169,7 +169,7 @@ public static boolean isEnchantable(ItemStack stack) { } public static boolean isDamageable(ItemStack stack) { - return stack.isDamageable(); + return stack.isDamageableItem(); } public static boolean isBreak(ItemStack stack) { @@ -184,7 +184,7 @@ public static ItemWrapper getItemWrapper(ItemStack stack) { } public static int getMaxCount(ItemStack stack) { - return stack.getMaxCount(); + return stack.getMaxStackSize(); } public static Item getItem(ItemStack stack) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java index 6d67532f7..3c37ceeab 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.item.CompatibleItemSettings; import net.pitan76.mcpitanlib.api.tag.TagKey; @@ -125,7 +125,7 @@ public static boolean isExist(CompatIdentifier identifier) { * @return BlockItem created from Block and Item.Settings. */ @Deprecated - public static BlockItem ofBlock(Block block, Item.Settings settings) { + public static BlockItem ofBlock(Block block, Item.Properties settings) { return ItemUtilV1.ofBlock(block, settings); } @@ -145,7 +145,7 @@ public static BlockItem ofBlock(Block block, CompatibleItemSettings settings) { * @return Item created from Item.Settings. */ @Deprecated - public static Item of(Item.Settings settings) { + public static Item of(Item.Properties settings) { return ItemUtilV1.of(settings); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java b/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java index 00967c3cb..6d7a5b0b2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.client.ClientUtil; public class Logger { @@ -107,7 +107,7 @@ public void log_onClientTick(int tick, String message, boolean isDebug) { log(message, isDebug); } - public void log_onWorldTick(int tick, String message, World world, boolean isDebug) { + public void log_onWorldTick(int tick, String message, Level world, boolean isDebug) { long time = WorldUtil.getTime(world); if (time % tick != 0) return; @@ -127,7 +127,7 @@ public void log_onClientTick(int tick, String message) { log_onClientTick(tick, message, false); } - public void log_onWorldTick(int tick, String message, World world) { + public void log_onWorldTick(int tick, String message, Level world) { log_onWorldTick(tick, message, world, false); } @@ -150,7 +150,7 @@ public void log_onClientTick(String message, boolean isDebug) { * @param world world * @param isDebug if true, log as debug */ - public void log_onWorldTick(String message, World world, boolean isDebug) { + public void log_onWorldTick(String message, Level world, boolean isDebug) { log_onWorldTick(60, message, world, isDebug); } @@ -176,7 +176,7 @@ public void log_onClientTick(String message) { * @param message log message * @param world world */ - public void log_onWorldTick(String message, World world) { + public void log_onWorldTick(String message, Level world) { log_onWorldTick(message, world, false); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java index 7ec6e5315..3446553b3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java @@ -10,7 +10,7 @@ public static int getProtocolVersion() { } public static String getGameVersion() { - return ClientUtil.getClient().getGameVersion(); + return ClientUtil.getClient().getLaunchedVersion(); } public static boolean isSupportedComponent() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java index 2cb21eb12..bfa65c6b9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.util.math.RotationAxis; +import com.mojang.math.Axis; import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; import org.joml.Quaternionf; @@ -21,12 +21,12 @@ public static Quaternionf getRotationDegrees(RotationAxisType type, float deg) { public static class RotationAxisType { - public static RotationAxisType POSITIVE_X = new RotationAxisType(RotationAxis.POSITIVE_X); - public static RotationAxisType POSITIVE_Y = new RotationAxisType(RotationAxis.POSITIVE_Y); - public static RotationAxisType POSITIVE_Z = new RotationAxisType(RotationAxis.POSITIVE_Z); + public static RotationAxisType POSITIVE_X = new RotationAxisType(Axis.XP); + public static RotationAxisType POSITIVE_Y = new RotationAxisType(Axis.YP); + public static RotationAxisType POSITIVE_Z = new RotationAxisType(Axis.ZP); - protected final RotationAxis axis; - protected RotationAxisType(RotationAxis axis) { + protected final Axis axis; + protected RotationAxisType(Axis axis) { this.axis = axis; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java index 0a95c4ffe..7d43ea14e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java @@ -2,12 +2,22 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DataResult; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.nbt.ByteTag; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.DoubleTag; +import net.minecraft.nbt.FloatTag; +import net.minecraft.nbt.IntTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.LongTag; +import net.minecraft.nbt.ShortTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.nbt.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.Vec3; +import net.minecraft.core.Vec3i; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.util.math.PosUtil; import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; @@ -23,8 +33,8 @@ public class NbtUtil { * 新しいNbtCompoundを作成する。 * @return NbtCompound */ - public static NbtCompound create() { - return new NbtCompound(); + public static CompoundTag create() { + return new CompoundTag(); } /** @@ -33,7 +43,7 @@ public static NbtCompound create() { * @param key キー * @param value 値 */ - public static void put(NbtCompound nbt, String key, NbtCompound value) { + public static void put(CompoundTag nbt, String key, CompoundTag value) { nbt.put(key, value); } @@ -43,7 +53,7 @@ public static void put(NbtCompound nbt, String key, NbtCompound value) { * @param key キー * @param value 値 */ - public static void put(NbtCompound nbt, String key, NbtElement value) { + public static void put(CompoundTag nbt, String key, Tag value) { nbt.put(key, value); } @@ -53,7 +63,7 @@ public static void put(NbtCompound nbt, String key, NbtElement value) { * @param key キー * @return 値 */ - public static NbtCompound get(NbtCompound nbt, String key) { + public static CompoundTag get(CompoundTag nbt, String key) { return nbt.getCompoundOrEmpty(key); } @@ -62,7 +72,7 @@ public static NbtCompound get(NbtCompound nbt, String key) { * @param nbt NbtCompound * @param key キー */ - public static void remove(NbtCompound nbt, String key) { + public static void remove(CompoundTag nbt, String key) { nbt.remove(key); } @@ -72,7 +82,7 @@ public static void remove(NbtCompound nbt, String key) { * @param key キー * @return 値が存在するかどうか */ - public static boolean has(NbtCompound nbt, String key) { + public static boolean has(CompoundTag nbt, String key) { return nbt.contains(key); } @@ -83,36 +93,36 @@ public static boolean has(NbtCompound nbt, String key) { * @param clazz クラス * @param 値 */ - public static T get(NbtCompound nbt, String key, Class clazz) { + public static T get(CompoundTag nbt, String key, Class clazz) { if (clazz == Integer.class) { - return (T) Integer.valueOf(nbt.getInt(key, 0)); + return (T) Integer.valueOf(nbt.getIntOr(key, 0)); } if (clazz == String.class) { return (T) nbt.getString(key).orElse(""); } if (clazz == Boolean.class) { - return (T) Boolean.valueOf(nbt.getBoolean(key, false)); + return (T) Boolean.valueOf(nbt.getBooleanOr(key, false)); } if (clazz == Float.class) { - return (T) Float.valueOf(nbt.getFloat(key, 0f)); + return (T) Float.valueOf(nbt.getFloatOr(key, 0f)); } if (clazz == Double.class) { - return (T) Double.valueOf(nbt.getDouble(key, 0d)); + return (T) Double.valueOf(nbt.getDoubleOr(key, 0d)); } if (clazz == Long.class) { - return (T) Long.valueOf(nbt.getLong(key, 0l)); + return (T) Long.valueOf(nbt.getLongOr(key, 0l)); } - if (clazz == NbtCompound.class) { + if (clazz == CompoundTag.class) { return (T) nbt.getCompoundOrEmpty(key); } - if (clazz == NbtList.class) { + if (clazz == ListTag.class) { return (T) nbt.get(key); } if (clazz == Byte.class) { - return (T) Byte.valueOf(nbt.getByte(key, (byte) 0)); + return (T) Byte.valueOf(nbt.getByteOr(key, (byte) 0)); } if (clazz == Short.class) { - return (T) Short.valueOf(nbt.getShort(key, (short) 0)); + return (T) Short.valueOf(nbt.getShortOr(key, (short) 0)); } if (clazz == UUID.class) { return (T) UUID.fromString(nbt.getString(key).orElse("")); @@ -126,7 +136,7 @@ public static T get(NbtCompound nbt, String key, Class clazz) { * @param key キー * @param value 値 */ - public static void set(NbtCompound nbt, String key, T value) { + public static void set(CompoundTag nbt, String key, T value) { if (value instanceof Integer) { nbt.putInt(key, (Integer) value); return; @@ -151,12 +161,12 @@ public static void set(NbtCompound nbt, String key, T value) { nbt.putLong(key, (Long) value); return; } - if (value instanceof NbtCompound) { - nbt.put(key, (NbtCompound) value); + if (value instanceof CompoundTag) { + nbt.put(key, (CompoundTag) value); return; } - if (value instanceof NbtList) { - nbt.put(key, (NbtList) value); + if (value instanceof ListTag) { + nbt.put(key, (ListTag) value); return; } if (value instanceof Byte) { @@ -178,23 +188,23 @@ public static void set(NbtCompound nbt, String key, T value) { * @param nbt NbtCompound * @return キーの一覧 */ - public static Set getKeys(NbtCompound nbt) { - return nbt.getKeys(); + public static Set getKeys(CompoundTag nbt) { + return nbt.keySet(); } /** * NbtListを取得する。 * @return NbtList */ - public static NbtList getList(NbtCompound nbt, String key) { - return (NbtList) nbt.get(key); + public static ListTag getList(CompoundTag nbt, String key) { + return (ListTag) nbt.get(key); } /** * NbtListを取得する。 * @return NbtList */ - public static NbtList getList(NbtCompound nbt, String key, int type) { + public static ListTag getList(CompoundTag nbt, String key, int type) { return nbt.getListOrEmpty(key); } @@ -202,7 +212,7 @@ public static NbtList getList(NbtCompound nbt, String key, int type) { * NbtCompoundのリストを取得する。 * @return NbtList */ - public static NbtList getNbtCompoundList(NbtCompound nbt, String key) { + public static ListTag getNbtCompoundList(CompoundTag nbt, String key) { return nbt.getListOrEmpty(key); } @@ -210,97 +220,97 @@ public static NbtList getNbtCompoundList(NbtCompound nbt, String key) { * NbtCompoundをコピーする。 * @return NbtCompound */ - public static NbtCompound copy(NbtCompound nbt) { + public static CompoundTag copy(CompoundTag nbt) { return nbt.copy(); } // Helper methods - public static void putInt(NbtCompound nbt, String key, int value) { + public static void putInt(CompoundTag nbt, String key, int value) { set(nbt, key, value); } - public static int getInt(NbtCompound nbt, String key) { + public static int getInt(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, Integer.class); return 0; } - public static void putString(NbtCompound nbt, String key, String value) { + public static void putString(CompoundTag nbt, String key, String value) { set(nbt, key, value); } - public static String getString(NbtCompound nbt, String key) { + public static String getString(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, String.class); return ""; } - public static void putBoolean(NbtCompound nbt, String key, boolean value) { + public static void putBoolean(CompoundTag nbt, String key, boolean value) { set(nbt, key, value); } - public static boolean getBoolean(NbtCompound nbt, String key) { + public static boolean getBoolean(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, Boolean.class); return false; } - public static void putFloat(NbtCompound nbt, String key, float value) { + public static void putFloat(CompoundTag nbt, String key, float value) { set(nbt, key, value); } - public static float getFloat(NbtCompound nbt, String key) { + public static float getFloat(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, Float.class); return 0; } - public static void putDouble(NbtCompound nbt, String key, double value) { + public static void putDouble(CompoundTag nbt, String key, double value) { set(nbt, key, value); } - public static double getDouble(NbtCompound nbt, String key) { + public static double getDouble(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, Double.class); return 0; } - public static void putLong(NbtCompound nbt, String key, long value) { + public static void putLong(CompoundTag nbt, String key, long value) { set(nbt, key, value); } - public static long getLong(NbtCompound nbt, String key) { + public static long getLong(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, Long.class); return 0; } - public static void putByte(NbtCompound nbt, String key, byte value) { + public static void putByte(CompoundTag nbt, String key, byte value) { set(nbt, key, value); } - public static byte getByte(NbtCompound nbt, String key) { + public static byte getByte(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, Byte.class); return 0; } - public static void putShort(NbtCompound nbt, String key, short value) { + public static void putShort(CompoundTag nbt, String key, short value) { set(nbt, key, value); } - public static short getShort(NbtCompound nbt, String key) { + public static short getShort(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, Short.class); return 0; } - public static void putUuid(NbtCompound nbt, String key, UUID value) { + public static void putUuid(CompoundTag nbt, String key, UUID value) { set(nbt, key, value); } - public static UUID getUuid(NbtCompound nbt, String key) { + public static UUID getUuid(CompoundTag nbt, String key) { if (has(nbt, key)) return get(nbt, key, UUID.class); return null; @@ -318,8 +328,8 @@ public static UUID getUuid(NbtCompound nbt, String key) { * @param key キー * @param pos BlockPos */ - public static void setBlockPos(NbtCompound nbt, String key, BlockPos pos) { - NbtCompound posNbt = create(); + public static void setBlockPos(CompoundTag nbt, String key, BlockPos pos) { + CompoundTag posNbt = create(); putInt(posNbt, "x", pos.getX()); putInt(posNbt, "y", pos.getY()); putInt(posNbt, "z", pos.getZ()); @@ -333,67 +343,67 @@ public static void setBlockPos(NbtCompound nbt, String key, BlockPos pos) { * @param key キー * @return BlockPos */ - public static BlockPos getBlockPos(NbtCompound nbt, String key) { - NbtCompound posNbt = get(nbt, key); + public static BlockPos getBlockPos(CompoundTag nbt, String key) { + CompoundTag posNbt = get(nbt, key); return PosUtil.flooredBlockPos(getInt(posNbt, "x"), getInt(posNbt, "y"), getInt(posNbt, "z")); } - public static void putVec3i(NbtCompound nbt, String key, Vec3i vec3i) { - NbtCompound vec3iNbt = create(); + public static void putVec3i(CompoundTag nbt, String key, Vec3i vec3i) { + CompoundTag vec3iNbt = create(); putInt(vec3iNbt, "x", vec3i.getX()); putInt(vec3iNbt, "y", vec3i.getY()); putInt(vec3iNbt, "z", vec3i.getZ()); put(nbt, key, vec3iNbt); } - public static Vec3i getVec3i(NbtCompound nbt, String key) { - NbtCompound vec3iNbt = get(nbt, key); + public static Vec3i getVec3i(CompoundTag nbt, String key) { + CompoundTag vec3iNbt = get(nbt, key); return Vec3iUtil.create(getInt(vec3iNbt, "x"), getInt(vec3iNbt, "y"), getInt(vec3iNbt, "z")); } - public static void putVec3d(NbtCompound nbt, String key, Vec3d vec3d) { - NbtCompound vec3dNbt = create(); - putDouble(vec3dNbt, "x", vec3d.getX()); - putDouble(vec3dNbt, "y", vec3d.getY()); - putDouble(vec3dNbt, "z", vec3d.getZ()); + public static void putVec3d(CompoundTag nbt, String key, Vec3 vec3d) { + CompoundTag vec3dNbt = create(); + putDouble(vec3dNbt, "x", vec3d.x()); + putDouble(vec3dNbt, "y", vec3d.y()); + putDouble(vec3dNbt, "z", vec3d.z()); put(nbt, key, vec3dNbt); } - public static Vec3d getVec3d(NbtCompound nbt, String key) { - NbtCompound vec3dNbt = get(nbt, key); + public static Vec3 getVec3d(CompoundTag nbt, String key) { + CompoundTag vec3dNbt = get(nbt, key); return Vec3dUtil.create(getDouble(vec3dNbt, "x"), getDouble(vec3dNbt, "y"), getDouble(vec3dNbt, "z")); } - public static void putItemStack(NbtCompound nbt, String key, ItemStack stack, CompatRegistryLookup registryLookup) { - DataResult dataResult = ItemStack.CODEC.encodeStart(NbtOps.INSTANCE, stack); + public static void putItemStack(CompoundTag nbt, String key, ItemStack stack, CompatRegistryLookup registryLookup) { + DataResult dataResult = ItemStack.CODEC.encodeStart(NbtOps.INSTANCE, stack); put(nbt, key, dataResult.getOrThrow()); } - public static Optional getItemStack(NbtCompound nbt, String key, CompatRegistryLookup registryLookup) { - NbtElement stackNbt = get(nbt, key); - DataResult> dataResult = ItemStack.CODEC.decode(NbtOps.INSTANCE, stackNbt); + public static Optional getItemStack(CompoundTag nbt, String key, CompatRegistryLookup registryLookup) { + Tag stackNbt = get(nbt, key); + DataResult> dataResult = ItemStack.CODEC.decode(NbtOps.INSTANCE, stackNbt); if (dataResult.error().isPresent()) return Optional.empty(); - Pair pair = dataResult.getOrThrow(); + Pair pair = dataResult.getOrThrow(); return Optional.ofNullable(pair.getFirst()); } - public static void putSimpleItemStack(NbtCompound nbt, String key, ItemStack stack) { - NbtCompound stackNbt = create(); + public static void putSimpleItemStack(CompoundTag nbt, String key, ItemStack stack) { + CompoundTag stackNbt = create(); putString(stackNbt, "id", ItemUtil.toID(stack.getItem()).toString()); putByte(stackNbt, "Count", (byte) ItemStackUtil.getCount(stack)); - NbtCompound tagNbt = create(); - NbtCompound componentsNbt = create(); + CompoundTag tagNbt = create(); + CompoundTag componentsNbt = create(); put(componentsNbt, "minecraft:custom_data", CustomDataUtil.getOrCreateNbt(stack)); put(tagNbt, "components", componentsNbt); put(stackNbt, "tag", tagNbt); put(nbt, key, stackNbt); } - public static Optional getSimpleItemStack(NbtCompound nbt, String key) { + public static Optional getSimpleItemStack(CompoundTag nbt, String key) { if (!has(nbt, key)) return Optional.empty(); - NbtCompound stackNbt = get(nbt, key); + CompoundTag stackNbt = get(nbt, key); if (!has(stackNbt, "id") || !has(stackNbt, "Count")) return Optional.empty(); Item item = ItemUtil.fromId(CompatIdentifier.of(getString(stackNbt, "id"))); @@ -402,9 +412,9 @@ public static Optional getSimpleItemStack(NbtCompound nbt, String key ItemStack stack = ItemStackUtil.create(item, count); if (has(stackNbt, "tag")) { - NbtCompound tagNbt = get(stackNbt, "tag"); + CompoundTag tagNbt = get(stackNbt, "tag"); if (has(tagNbt, "components")) { - NbtCompound componentsNbt = get(tagNbt, "components"); + CompoundTag componentsNbt = get(tagNbt, "components"); if (has(componentsNbt, "minecraft:custom_data")) { CustomDataUtil.setNbt(stack, get(componentsNbt, "minecraft:custom_data")); } @@ -414,147 +424,147 @@ public static Optional getSimpleItemStack(NbtCompound nbt, String key return Optional.of(stack); } - public static NbtList createNbtList() { - return new NbtList(); + public static ListTag createNbtList() { + return new ListTag(); } - public static int getIntOrDefault(NbtCompound nbt, String key, int defaultValue) { + public static int getIntOrDefault(CompoundTag nbt, String key, int defaultValue) { if (has(nbt, key)) return getInt(nbt, key); return defaultValue; } - public static String getStringOrDefault(NbtCompound nbt, String key, String defaultValue) { + public static String getStringOrDefault(CompoundTag nbt, String key, String defaultValue) { if (has(nbt, key)) return getString(nbt, key); return defaultValue; } - public static boolean getBooleanOrDefault(NbtCompound nbt, String key, boolean defaultValue) { + public static boolean getBooleanOrDefault(CompoundTag nbt, String key, boolean defaultValue) { if (has(nbt, key)) return getBoolean(nbt, key); return defaultValue; } - public static float getFloatOrDefault(NbtCompound nbt, String key, float defaultValue) { + public static float getFloatOrDefault(CompoundTag nbt, String key, float defaultValue) { if (has(nbt, key)) return getFloat(nbt, key); return defaultValue; } - public static double getDoubleOrDefault(NbtCompound nbt, String key, double defaultValue) { + public static double getDoubleOrDefault(CompoundTag nbt, String key, double defaultValue) { if (has(nbt, key)) return getDouble(nbt, key); return defaultValue; } - public static long getLongOrDefault(NbtCompound nbt, String key, long defaultValue) { + public static long getLongOrDefault(CompoundTag nbt, String key, long defaultValue) { if (has(nbt, key)) return getLong(nbt, key); return defaultValue; } - public static byte getByteOrDefault(NbtCompound nbt, String key, byte defaultValue) { + public static byte getByteOrDefault(CompoundTag nbt, String key, byte defaultValue) { if (has(nbt, key)) return getByte(nbt, key); return defaultValue; } - public static short getShortOrDefault(NbtCompound nbt, String key, short defaultValue) { + public static short getShortOrDefault(CompoundTag nbt, String key, short defaultValue) { if (has(nbt, key)) return getShort(nbt, key); return defaultValue; } - public static UUID getUuidOrDefault(NbtCompound nbt, String key, UUID defaultValue) { + public static UUID getUuidOrDefault(CompoundTag nbt, String key, UUID defaultValue) { if (has(nbt, key)) return getUuid(nbt, key); return defaultValue; } - public static NbtElement getElement(NbtCompound nbt, String key) { + public static Tag getElement(CompoundTag nbt, String key) { return nbt.get(key); } - public static void putElement(NbtCompound nbt, String key, NbtElement element) { + public static void putElement(CompoundTag nbt, String key, Tag element) { nbt.put(key, element); } - public static void setBlockPosDirect(NbtCompound nbt, BlockPos pos) { + public static void setBlockPosDirect(CompoundTag nbt, BlockPos pos) { putInt(nbt, "x", pos.getX()); putInt(nbt, "y", pos.getY()); putInt(nbt, "z", pos.getZ()); } - public static BlockPos getBlockPosDirect(NbtCompound nbt) { + public static BlockPos getBlockPosDirect(CompoundTag nbt) { return PosUtil.flooredBlockPos(getInt(nbt, "x"), getInt(nbt, "y"), getInt(nbt, "z")); } - public static void setVec3iDirect(NbtCompound nbt, Vec3i vec3i) { + public static void setVec3iDirect(CompoundTag nbt, Vec3i vec3i) { putInt(nbt, "x", vec3i.getX()); putInt(nbt, "y", vec3i.getY()); putInt(nbt, "z", vec3i.getZ()); } - public static Vec3i getVec3iDirect(NbtCompound nbt) { + public static Vec3i getVec3iDirect(CompoundTag nbt) { return Vec3iUtil.create(getInt(nbt, "x"), getInt(nbt, "y"), getInt(nbt, "z")); } - public static void setVec3dDirect(NbtCompound nbt, Vec3d vec3d) { - putDouble(nbt, "x", vec3d.getX()); - putDouble(nbt, "y", vec3d.getY()); - putDouble(nbt, "z", vec3d.getZ()); + public static void setVec3dDirect(CompoundTag nbt, Vec3 vec3d) { + putDouble(nbt, "x", vec3d.x()); + putDouble(nbt, "y", vec3d.y()); + putDouble(nbt, "z", vec3d.z()); } - public static Vec3d getVec3dDirect(NbtCompound nbt) { + public static Vec3 getVec3dDirect(CompoundTag nbt) { return Vec3dUtil.create(getDouble(nbt, "x"), getDouble(nbt, "y"), getDouble(nbt, "z")); } - public static void setVec3iDirect(NbtCompound nbt, int x, int y, int z) { + public static void setVec3iDirect(CompoundTag nbt, int x, int y, int z) { putInt(nbt, "x", x); putInt(nbt, "y", y); putInt(nbt, "z", z); } - public static void setVec3dDirect(NbtCompound nbt, double x, double y, double z) { + public static void setVec3dDirect(CompoundTag nbt, double x, double y, double z) { putDouble(nbt, "x", x); putDouble(nbt, "y", y); putDouble(nbt, "z", z); } - public static String asString(NbtElement nbt) { + public static String asString(Tag nbt) { return nbt.asString().orElse(""); } - public static NbtString createString(String string) { - return NbtString.of(string); + public static StringTag createString(String string) { + return StringTag.valueOf(string); } - public static NbtInt createInt(int value) { - return NbtInt.of(value); + public static IntTag createInt(int value) { + return IntTag.valueOf(value); } - public static NbtFloat createFloat(float value) { - return NbtFloat.of(value); + public static FloatTag createFloat(float value) { + return FloatTag.valueOf(value); } - public static NbtDouble createDouble(double value) { - return NbtDouble.of(value); + public static DoubleTag createDouble(double value) { + return DoubleTag.valueOf(value); } - public static NbtLong createLong(long value) { - return NbtLong.of(value); + public static LongTag createLong(long value) { + return LongTag.valueOf(value); } - public static NbtByte createByte(byte value) { - return NbtByte.of(value); + public static ByteTag createByte(byte value) { + return ByteTag.valueOf(value); } - public static NbtShort createShort(short value) { - return NbtShort.of(value); + public static ShortTag createShort(short value) { + return ShortTag.valueOf(value); } - public static void copyFrom(NbtCompound source, NbtCompound target) { - target.copyFrom(source); + public static void copyFrom(CompoundTag source, CompoundTag target) { + target.merge(source); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java index bcfa9d246..ab77baa79 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleType; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; import net.pitan76.mcpitanlib.api.util.particle.effect.ItemStackParticleEffectUtil; public class ParticleEffectUtil { public static ItemStackParticleEffectUtil itemStack = new ItemStackParticleEffectUtil(); - public static ParticleType getType(ParticleEffect effect) { + public static ParticleType getType(ParticleOptions effect) { return effect.getType(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java index 9ba2c4abf..8bd088d55 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util; import com.mojang.serialization.Codec; -import net.minecraft.datafixer.DataFixTypes; -import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.datafix.DataFixTypes; +import net.minecraft.nbt.CompoundTag; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.PersistentState; -import net.minecraft.world.PersistentStateManager; -import net.minecraft.world.PersistentStateType; -import net.minecraft.world.World; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.saveddata.SavedData; +import net.minecraft.world.level.storage.DimensionDataStorage; +import net.minecraft.world.level.saveddata.SavedDataType; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.world.CompatiblePersistentState; @@ -17,8 +17,8 @@ import java.util.function.Supplier; public class PersistentStateUtil { - public static T getOrCreate(PersistentStateManager manager, String id, Supplier supplier, Function function) { - Codec codec = NbtCompound.CODEC.xmap( + public static T getOrCreate(DimensionDataStorage manager, String id, Supplier supplier, Function function) { + Codec codec = CompoundTag.CODEC.xmap( // NBT -> PersistentState (nbt) -> { T state = supplier.get(); @@ -31,25 +31,25 @@ public static T getOrCreate(PersistentStateManager m // PersistentState -> NBT (state) -> { if (state instanceof CompatiblePersistentState) - return ((CompatiblePersistentState) state).writeNbt(new WriteNbtArgs(new NbtCompound())); + return ((CompatiblePersistentState) state).writeNbt(new WriteNbtArgs(new CompoundTag())); return NbtUtil.create(); } ); - PersistentStateType type = new PersistentStateType<>(id, supplier, codec, DataFixTypes.LEVEL); - return manager.getOrCreate(type); + SavedDataType type = new SavedDataType<>(id, supplier, codec, DataFixTypes.LEVEL); + return manager.computeIfAbsent(type); } - public static PersistentStateManager getManagerFromServer(MinecraftServer server) { - return server.getWorld(World.OVERWORLD).getPersistentStateManager(); + public static DimensionDataStorage getManagerFromServer(MinecraftServer server) { + return server.getLevel(Level.OVERWORLD).getDataStorage(); } - public static PersistentStateManager getManagerFromWorld(ServerWorld world) { - return world.getPersistentStateManager(); + public static DimensionDataStorage getManagerFromWorld(ServerLevel world) { + return world.getDataStorage(); } - public static void markDirty(PersistentState state) { - state.markDirty(); + public static void markDirty(SavedData state) { + state.setDirty(); } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java index 228e4eedd..cfe8a7ab4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java @@ -1,38 +1,38 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.world.gen.YOffset; -import net.minecraft.world.gen.feature.ConfiguredFeature; -import net.minecraft.world.gen.feature.PlacedFeature; -import net.minecraft.world.gen.placementmodifier.CountPlacementModifier; -import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier; -import net.minecraft.world.gen.placementmodifier.PlacementModifier; -import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier; +import net.minecraft.core.Holder; +import net.minecraft.world.level.levelgen.VerticalAnchor; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import net.minecraft.world.level.levelgen.placement.CountPlacement; +import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; +import net.minecraft.world.level.levelgen.placement.PlacementModifier; +import net.minecraft.world.level.levelgen.placement.InSquarePlacement; import java.util.List; public class PlacedFutureUtil { public static PlacedFeature create(ConfiguredFeature configuredFeature, List placementModifiers) { - return new PlacedFeature(RegistryEntry.of(configuredFeature), placementModifiers); + return new PlacedFeature(Holder.direct(configuredFeature), placementModifiers); } - public static List createPlacementModifiers(CountPlacementModifier countPlacementModifier, SquarePlacementModifier squarePlacementModifier, HeightRangePlacementModifier heightRangePlacementModifier) { + public static List createPlacementModifiers(CountPlacement countPlacementModifier, InSquarePlacement squarePlacementModifier, HeightRangePlacement heightRangePlacementModifier) { return List.of(countPlacementModifier, squarePlacementModifier, heightRangePlacementModifier); } public static List createPlacementModifiers(int chunkCount, int top, int bottom) { return createPlacementModifiers( -CountPlacementModifier.of(chunkCount), - SquarePlacementModifier.of(), - HeightRangePlacementModifier.uniform(YOffset.fixed(bottom), YOffset.fixed(top)) +CountPlacement.of(chunkCount), + InSquarePlacement.spread(), + HeightRangePlacement.uniform(VerticalAnchor.absolute(bottom), VerticalAnchor.absolute(top)) ); } public static List createPlacementModifiers(int chunkCount, int top) { return createPlacementModifiers( - CountPlacementModifier.of(chunkCount), - SquarePlacementModifier.of(), - HeightRangePlacementModifier.uniform(YOffset.getBottom(), YOffset.fixed(top)) + CountPlacement.of(chunkCount), + InSquarePlacement.spread(), + HeightRangePlacement.uniform(VerticalAnchor.bottom(), VerticalAnchor.absolute(top)) ); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java index ae2e7ecc5..7fd5e9ea3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.player.Player; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.PlayerManager; -import net.minecraft.world.World; +import net.minecraft.server.players.PlayerList; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import java.util.ArrayList; @@ -56,9 +56,9 @@ public static List getPlayers(MinecraftServer server) { * @param world World * @return List */ - public static List getPlayers(World world) { + public static List getPlayers(Level world) { List players = new ArrayList<>(); - for (PlayerEntity p : world.getPlayers()) { + for (Player p : world.players()) { players.add(new Player(p)); } return players; @@ -70,7 +70,7 @@ public static List getPlayers(World world) { * @param uuid UUID * @return Player */ - public static Player getPlayerByUUID(World world, UUID uuid) { + public static Player getPlayerByUUID(Level world, UUID uuid) { return PlayerUtil.getPlayerByUUID(world, uuid); } @@ -80,28 +80,28 @@ public static Player getPlayerByUUID(World world, UUID uuid) { * @param name String * @return Player */ - public static Player getPlayerByName(World world, String name) { + public static Player getPlayerByName(Level world, String name) { return PlayerUtil.getPlayerByName(world, name); } - public static PlayerManager getPlayerManager(MinecraftServer server) { + public static PlayerList getPlayerManager(MinecraftServer server) { return ServerUtil.getPlayerManager(server); } - public static PlayerManager getPlayerManager(World world) { + public static PlayerList getPlayerManager(Level world) { return getPlayerManager(world.getServer()); } - public static boolean hasPlayerByUUID(PlayerManager playerManager, UUID uuid) { + public static boolean hasPlayerByUUID(PlayerList playerManager, UUID uuid) { return playerManager.getPlayer(uuid) != null; } - public static boolean hasPlayerByName(PlayerManager playerManager, String name) { - return playerManager.getPlayer(name) != null; + public static boolean hasPlayerByName(PlayerList playerManager, String name) { + return playerManager.getPlayerByName(name) != null; } - public static boolean hasPlayerByIP(PlayerManager playerManager, String ip) { - return !playerManager.getPlayersByIp(ip).isEmpty(); + public static boolean hasPlayerByIP(PlayerList playerManager, String ip) { + return !playerManager.getPlayersWithAddress(ip).isEmpty(); } public static boolean hasPlayerByUUID(MinecraftServer server, UUID uuid) { @@ -116,15 +116,15 @@ public static boolean hasPlayerByIP(MinecraftServer server, String ip) { return hasPlayerByIP(getPlayerManager(server), ip); } - public static boolean hasPlayerByUUID(World world, UUID uuid) { + public static boolean hasPlayerByUUID(Level world, UUID uuid) { return hasPlayerByUUID(getPlayerManager(world), uuid); } - public static boolean hasPlayerByName(World world, String name) { + public static boolean hasPlayerByName(Level world, String name) { return hasPlayerByName(getPlayerManager(world), name); } - public static boolean hasPlayerByIP(World world, String ip) { + public static boolean hasPlayerByIP(Level world, String ip) { return hasPlayerByIP(getPlayerManager(world), ip); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java index 90f67e846..7afaf6848 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.player.Player; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import java.util.ArrayList; @@ -13,16 +13,16 @@ public class PlayerUtil { public static Player getPlayerByUUID(MinecraftServer server, UUID uuid) { - return new Player(server.getPlayerManager().getPlayer(uuid)); + return new Player(server.getPlayerList().getPlayer(uuid)); } public static Player getPlayerByName(MinecraftServer server, String name) { - return new Player(server.getPlayerManager().getPlayer(name)); + return new Player(server.getPlayerList().getPlayerByName(name)); } public static List getPlayersByIP(MinecraftServer server, String ip) { List players = new ArrayList<>(); - for (PlayerEntity p: server.getPlayerManager().getPlayersByIp(ip)) { + for (Player p: server.getPlayerList().getPlayersWithAddress(ip)) { players.add(new Player(p)); } return players; @@ -30,41 +30,41 @@ public static List getPlayersByIP(MinecraftServer server, String ip) { public static List getPlayers(MinecraftServer server) { List players = new ArrayList<>(); - for (PlayerEntity p : server.getPlayerManager().getPlayerList()) { + for (Player p : server.getPlayerList().getPlayers()) { players.add(new Player(p)); } return players; } - public static Player getPlayerByUUID(World world, UUID uuid) { + public static Player getPlayerByUUID(Level world, UUID uuid) { return getPlayerByUUID(world.getServer(), uuid); } - public static Player getPlayerByName(World world, String name) { + public static Player getPlayerByName(Level world, String name) { return getPlayerByName(world.getServer(), name); } public static boolean isExistByUUID(MinecraftServer server, UUID uuid) { - return server.getPlayerManager().getPlayer(uuid) != null; + return server.getPlayerList().getPlayer(uuid) != null; } - public static boolean isExistByUUID(World world, UUID uuid) { + public static boolean isExistByUUID(Level world, UUID uuid) { return isExistByUUID(world.getServer(), uuid); } public static boolean isExistByName(MinecraftServer server, String name) { - return server.getPlayerManager().getPlayer(name) != null; + return server.getPlayerList().getPlayerByName(name) != null; } - public static boolean isExistByName(World world, String name) { + public static boolean isExistByName(Level world, String name) { return isExistByName(world.getServer(), name); } public static boolean isExistByIP(MinecraftServer server, String ip) { - return !server.getPlayerManager().getPlayersByIp(ip).isEmpty(); + return !server.getPlayerList().getPlayersWithAddress(ip).isEmpty(); } - public static boolean isExistByIP(World world, String ip) { + public static boolean isExistByIP(Level world, String ip) { return isExistByIP(world.getServer(), ip); } @@ -84,7 +84,7 @@ public static BlockPos getBlockPos(Player player) { return player.getBlockPos(); } - public static World getWorld(Player player) { + public static Level getWorld(Player player) { return player.getWorld(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java index a97c8dc53..e5ad44042 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java @@ -1,38 +1,43 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.BlockState; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.block.enums.StairShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Half; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.block.state.properties.StairsShape; import net.minecraft.state.property.*; -import net.minecraft.util.StringIdentifiable; -import net.minecraft.util.math.Direction; +import net.minecraft.util.StringRepresentable; +import net.minecraft.core.Direction; import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; import net.pitan76.mcpitanlib.api.state.property.CompatProperties; import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; public class PropertyUtil { public static BooleanProperty createBooleanProperty(String name) { - return BooleanProperty.of(name); + return BooleanProperty.create(name); } public static DirectionProperty createDirectionProperty(String name) { return DirectionProperty.of(name); } - public static IntProperty createIntProperty(String name, int min, int max) { - return IntProperty.of(name, min, max); + public static IntegerProperty createIntProperty(String name, int min, int max) { + return IntegerProperty.create(name, min, max); } - public static & StringIdentifiable> EnumProperty createEnumProperty(String name, Class type) { - return EnumProperty.of(name, type); + public static & StringRepresentable> EnumProperty createEnumProperty(String name, Class type) { + return EnumProperty.create(name, type); } public static BlockState with(BlockState state, BooleanProperty property, boolean value) { - return state.with(property, value); + return state.setValue(property, value); } - public static BlockState with(BlockState state, IntProperty property, int value) { - return state.with(property, value); + public static BlockState with(BlockState state, IntegerProperty property, int value) { + return state.setValue(property, value); } public static BlockState with(BlockState state, DirectionProperty property, Direction value) { @@ -40,11 +45,11 @@ public static BlockState with(BlockState state, DirectionProperty property, Dire } public static boolean get(BlockState state, BooleanProperty property) { - return state.get(property); + return state.getValue(property); } - public static int get(BlockState state, IntProperty property) { - return state.get(property); + public static int get(BlockState state, IntegerProperty property) { + return state.getValue(property); } public static Direction get(BlockState state, DirectionProperty property) { @@ -64,11 +69,11 @@ public static Direction getHorizontalFacing(BlockState state) { } public static int getPower(BlockState state) { - return state.get(power()); + return state.getValue(power()); } public static boolean isPowered(BlockState state) { - return state.get(powered()); + return state.getValue(powered()); } public static void append(AppendPropertiesArgs args, Property... properties) { @@ -91,12 +96,12 @@ public static void appendPowered(AppendPropertiesArgs args) { args.addProperty(powered()); } - public static IntProperty power() { - return Properties.POWER; + public static IntegerProperty power() { + return BlockStateProperties.POWER; } public static BooleanProperty powered() { - return Properties.POWERED; + return BlockStateProperties.POWERED; } public static DirectionProperty facing() { @@ -108,54 +113,54 @@ public static DirectionProperty horizontalFacing() { } public static EnumProperty axis() { - return Properties.AXIS; + return BlockStateProperties.AXIS; } - public static EnumProperty blockHalf() { - return Properties.BLOCK_HALF; + public static EnumProperty blockHalf() { + return BlockStateProperties.HALF; } - public static EnumProperty stairShape() { - return Properties.STAIR_SHAPE; + public static EnumProperty stairShape() { + return BlockStateProperties.STAIRS_SHAPE; } public static BooleanProperty lit() { - return Properties.LIT; + return BlockStateProperties.LIT; } public static BooleanProperty waterlogged() { - return Properties.WATERLOGGED; + return BlockStateProperties.WATERLOGGED; } public static BooleanProperty attached() { - return Properties.ATTACHED; + return BlockStateProperties.ATTACHED; } public static BooleanProperty hanging() { - return Properties.HANGING; + return BlockStateProperties.HANGING; } public static BooleanProperty bottom() { - return Properties.BOTTOM; + return BlockStateProperties.BOTTOM; } public static BooleanProperty conditional() { - return Properties.CONDITIONAL; + return BlockStateProperties.CONDITIONAL; } public static BooleanProperty inWall() { - return Properties.IN_WALL; + return BlockStateProperties.IN_WALL; } public static BooleanProperty open() { - return Properties.OPEN; + return BlockStateProperties.OPEN; } public static BooleanProperty occupied() { - return Properties.OCCUPIED; + return BlockStateProperties.OCCUPIED; } public static boolean contains(BlockState state, Property property) { - return state.contains(property); + return state.hasProperty(property); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java index b507e75ee..e2f2c7fab 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.world.World; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.CompatEntity; import net.pitan76.mcpitanlib.api.event.item.ItemAppendTooltipEvent; import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; @@ -11,30 +11,30 @@ public class RegistryLookupUtil { public static CompatRegistryLookup getRegistryLookup(ItemAppendTooltipEvent e) { - return new CompatRegistryLookup(e.context.getRegistryLookup()); + return new CompatRegistryLookup(e.context.registries()); } public static CompatRegistryLookup getRegistryLookup(CompatEntity entity) { - return new CompatRegistryLookup(entity.getRegistryManager()); + return new CompatRegistryLookup(entity.registryAccess()); } public static CompatRegistryLookup getRegistryLookup(Entity entity) { - return new CompatRegistryLookup(entity.getRegistryManager()); + return new CompatRegistryLookup(entity.registryAccess()); } public static CompatRegistryLookup getRegistryLookup(CompatBlockEntity entity) { - return new CompatRegistryLookup(entity.getWorld().getRegistryManager()); + return new CompatRegistryLookup(entity.getLevel().registryAccess()); } public static CompatRegistryLookup getRegistryLookup(BlockEntity entity) { - return new CompatRegistryLookup(entity.getWorld().getRegistryManager()); + return new CompatRegistryLookup(entity.getLevel().registryAccess()); } public static CompatRegistryLookup getRegistryLookup(NbtRWArgs args) { return args.getRegistryLookup(); } - public static CompatRegistryLookup getRegistryLookup(World world) { - return new CompatRegistryLookup(world.getRegistryManager()); + public static CompatRegistryLookup getRegistryLookup(Level world) { + return new CompatRegistryLookup(world.registryAccess()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java index 95d896201..7af8ae74e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.resource.Resource; -import net.minecraft.resource.ResourceManager; +import net.minecraft.server.packs.resources.Resource; +import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.resources.Identifier; import java.io.IOException; @@ -14,11 +14,11 @@ public static Resource getResource(ResourceManager resourceManager, Identifier i } public static InputStream getInputStream(Resource resource) throws IOException { - return resource.getInputStream(); + return resource.open(); } public static Map findResources(ResourceManager resourceManager, String startingPath, String endingPath) throws IOException { - return resourceManager.findResources(startingPath, s -> s.toString().endsWith(endingPath)); + return resourceManager.listResources(startingPath, s -> s.toString().endsWith(endingPath)); } public static void close(Resource resource) throws IOException { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java index 7ce969235..efad49f24 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java @@ -2,53 +2,53 @@ import dev.architectury.registry.menu.ExtendedMenuProvider; import dev.architectury.registry.menu.MenuRegistry; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.registry.Registries; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.slot.Slot; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.core.NonNullList; import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public class ScreenHandlerUtil { - public static DefaultedList getSlots(ScreenHandler screenHandler) { + public static NonNullList getSlots(AbstractContainerMenu screenHandler) { return screenHandler.slots; } - public static Slot getSlot(ScreenHandler screenHandler, int index) { + public static Slot getSlot(AbstractContainerMenu screenHandler, int index) { return screenHandler.getSlot(index); } - public static List> getAllScreenHandlerTypes() { - List> screenHandlerTypes = new ArrayList<>(); - for (ScreenHandlerType screenHandler : Registries.SCREEN_HANDLER) { + public static List> getAllScreenHandlerTypes() { + List> screenHandlerTypes = new ArrayList<>(); + for (MenuType screenHandler : BuiltInRegistries.MENU) { screenHandlerTypes.add(screenHandler); } return screenHandlerTypes; } - public static void openExtendedMenu(ServerPlayerEntity player, NamedScreenHandlerFactory provider, Consumer bufWriter) { + public static void openExtendedMenu(ServerPlayer player, MenuProvider provider, Consumer bufWriter) { MenuRegistry.openExtendedMenu(player, provider, bufWriter); } - public static void openExtendedMenu(ServerPlayerEntity player, ExtendedMenuProvider provider) { + public static void openExtendedMenu(ServerPlayer player, ExtendedMenuProvider provider) { MenuRegistry.openExtendedMenu(player, provider); } - public static void openMenu(ServerPlayerEntity player, NamedScreenHandlerFactory provider) { + public static void openMenu(ServerPlayer player, MenuProvider provider) { MenuRegistry.openMenu(player, provider); } - public static int getRawId(ScreenHandlerType type) { - return Registries.SCREEN_HANDLER.getRawId(type); + public static int getRawId(MenuType type) { + return BuiltInRegistries.MENU.getId(type); } - public static ScreenHandlerType fromIndex(int index) { - return Registries.SCREEN_HANDLER.get(index); + public static MenuType fromIndex(int index) { + return BuiltInRegistries.MENU.byId(index); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java index 6718b610d..542d32c95 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java @@ -1,25 +1,25 @@ package net.pitan76.mcpitanlib.api.util; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.PlayerManager; -import net.minecraft.world.World; +import net.minecraft.server.players.PlayerList; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; public class ServerUtil { - public static MinecraftServer getServer(World world) { + public static MinecraftServer getServer(Level world) { return world.getServer(); } public static String getIP(MinecraftServer server) { - return server.getServerIp(); + return server.getLocalIp(); } public static int getPort(MinecraftServer server) { - return server.getServerPort(); + return server.getPort(); } public static String getMotd(MinecraftServer server) { - return server.getServerMotd(); + return server.getMotd(); } public static String getServerModName(MinecraftServer server) { @@ -27,15 +27,15 @@ public static String getServerModName(MinecraftServer server) { } public static int getMaxPlayerCount(MinecraftServer server) { - return server.getMaxPlayerCount(); + return server.getMaxPlayers(); } public static int getCurrentPlayerCount(MinecraftServer server) { - return server.getCurrentPlayerCount(); + return server.getPlayerCount(); } public static boolean isOnlineMode(MinecraftServer server) { - return server.isOnlineMode(); + return server.usesAuthentication(); } public static boolean isServerRunning(MinecraftServer server) { @@ -43,15 +43,15 @@ public static boolean isServerRunning(MinecraftServer server) { } public static boolean isServerDedicated(MinecraftServer server) { - return server.isDedicated(); + return server.isDedicatedServer(); } public static boolean isSingleplayer(MinecraftServer server) { return server.isSingleplayer(); } - public static PlayerManager getPlayerManager(MinecraftServer server) { - return server.getPlayerManager(); + public static PlayerList getPlayerManager(MinecraftServer server) { + return server.getPlayerList(); } public static MinecraftServer getServer(Player player) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java index 9176cee25..5bc9b8139 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java @@ -1,35 +1,35 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.NonNullList; public class SimpleInventoryUtil { - public static DefaultedList getHeldStacks(SimpleInventory inventory) { - return inventory.getHeldStacks(); + public static NonNullList getHeldStacks(SimpleContainer inventory) { + return inventory.getItems(); } - public static SimpleInventory create(int size) { + public static SimpleContainer create(int size) { return InventoryUtil.createSimpleInventory(size); } - public static ItemStack getStack(SimpleInventory inventory, int slot) { - return inventory.getStack(slot); + public static ItemStack getStack(SimpleContainer inventory, int slot) { + return inventory.getItem(slot); } - public static void setStack(SimpleInventory inventory, int slot, ItemStack stack) { - inventory.setStack(slot, stack); + public static void setStack(SimpleContainer inventory, int slot, ItemStack stack) { + inventory.setItem(slot, stack); } - public static void clear(SimpleInventory inventory) { - inventory.clear(); + public static void clear(SimpleContainer inventory) { + inventory.clearContent(); } - public static int size(SimpleInventory inventory) { - return inventory.size(); + public static int size(SimpleContainer inventory) { + return inventory.getContainerSize(); } - public static boolean isEmpty(SimpleInventory inventory) { + public static boolean isEmpty(SimpleContainer inventory) { return inventory.isEmpty(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java index 018aad006..fd795b119 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java @@ -1,44 +1,44 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.Slot; import net.pitan76.mcpitanlib.api.entity.Player; public class SlotUtil { public static void setStack(Slot slot, ItemStack stack) { - slot.setStack(stack); + slot.setByPlayer(stack); } public static ItemStack getStack(Slot slot) { - return slot.getStack(); + return slot.getItem(); } public static void takeStack(Slot slot, int amount) { - slot.takeStack(amount); + slot.remove(amount); } public static boolean hasStack(Slot slot) { - return slot.hasStack(); + return slot.hasItem(); } public static void markDirty(Slot slot) { - slot.markDirty(); + slot.setChanged(); } public static boolean canInsert(Slot slot, ItemStack stack) { - return slot.canInsert(stack); + return slot.mayPlace(stack); } public static boolean canTakeItems(Slot slot) { - return slot.canTakeItems(null); + return slot.mayPickup(null); } public static void onTakeItem(Slot slot, Player player, ItemStack stack) { - slot.onTakeItem(player.getEntity(), stack); + slot.onTake(player.getEntity(), stack); } - public static Inventory getInventory(Slot slot) { - return slot.inventory; + public static Container getInventory(Slot slot) { + return slot.container; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java index 2087e6994..051afa730 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.registry.Registries; -import net.minecraft.sound.SoundEvent; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import java.util.ArrayList; @@ -10,11 +10,11 @@ public class SoundEventUtil { public static Identifier getId(SoundEvent soundEvent) { - return soundEvent.id(); + return soundEvent.location(); } public static SoundEvent getSoundEvent(Identifier id) { - return SoundEvent.of(id); + return SoundEvent.createVariableRangeEvent(id); } public static CompatIdentifier getCompatId(SoundEvent soundEvent) { @@ -26,10 +26,10 @@ public static SoundEvent getSoundEvent(CompatIdentifier id) { } public static List getAllSoundEvents() { - return Registries.SOUND_EVENT.stream().collect(Collectors.toList()); + return BuiltInRegistries.SOUND_EVENT.stream().collect(Collectors.toList()); } public static List getAllSoundEventIds() { - return new ArrayList<>(Registries.SOUND_EVENT.getIds()); + return new ArrayList<>(BuiltInRegistries.SOUND_EVENT.keySet()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java index 7519d7e99..2c9f276b3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.InteractionResult; import net.pitan76.mcpitanlib.api.event.result.EventResult; import java.util.Optional; @@ -10,7 +10,7 @@ public class StackActionResult extends CompatActionResult { private final ItemStack stack; private final CompatActionResult compatActionResult; - public StackActionResult(ActionResult actionResult, EventResult eventResult, ItemStack stack) { + public StackActionResult(InteractionResult actionResult, EventResult eventResult, ItemStack stack) { this(new CompatActionResult(actionResult, eventResult), stack); } @@ -21,7 +21,7 @@ public StackActionResult(CompatActionResult actionResult, ItemStack stack) { } @Override - public ActionResult toActionResult() { + public InteractionResult toActionResult() { return compatActionResult.toActionResult(); } @@ -62,26 +62,26 @@ public static StackActionResult create(CompatActionResult compatActionResult) { return new StackActionResult(compatActionResult, null); } - public static StackActionResult create(ActionResult actionResult, EventResult eventResult, ItemStack stack) { + public static StackActionResult create(InteractionResult actionResult, EventResult eventResult, ItemStack stack) { return new StackActionResult(actionResult, eventResult, stack); } - public static StackActionResult create(ActionResult actionResult, ItemStack stack) { + public static StackActionResult create(InteractionResult actionResult, ItemStack stack) { return new StackActionResult(actionResult, null, stack); } public static StackActionResult success(ItemStack stack) { - CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.SUCCESS.withNewHandStack(stack)); + CompatActionResult compatActionResult = CompatActionResult.create(InteractionResult.SUCCESS.heldItemTransformedTo(stack)); return create(compatActionResult, stack); } public static StackActionResult successServer(ItemStack stack) { - CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.SUCCESS_SERVER.withNewHandStack(stack)); + CompatActionResult compatActionResult = CompatActionResult.create(InteractionResult.SUCCESS_SERVER.heldItemTransformedTo(stack)); return create(compatActionResult, stack); } public static StackActionResult consume(ItemStack stack) { - CompatActionResult compatActionResult = CompatActionResult.create(ActionResult.CONSUME.withNewHandStack(stack)); + CompatActionResult compatActionResult = CompatActionResult.create(InteractionResult.CONSUME.heldItemTransformedTo(stack)); return create(compatActionResult, stack); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java index a51ef0e36..dd80d1c9b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.util; import com.google.common.collect.ImmutableList; -import net.minecraft.state.State; -import net.minecraft.state.StateManager; +import net.minecraft.world.level.block.state.StateHolder; +import net.minecraft.world.level.block.state.StateDefinition; public class StateManagerUtil { - public static > S getDefaultState(StateManager manager) { - return manager.getDefaultState(); + public static > S getDefaultState(StateDefinition manager) { + return manager.any(); } - public > ImmutableList getStates(StateManager manager) { - return manager.getStates(); + public > ImmutableList getStates(StateDefinition manager) { + return manager.getPossibleStates(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java index e484d1bd1..f6c728337 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; public class StatusEffectUtil { public static CompatStatusEffect getStatusEffect(Identifier identifier) { - RegistryKey registryKey = RegistryKey.of(RegistryKeys.STATUS_EFFECT, identifier); + ResourceKey registryKey = ResourceKey.create(Registries.MOB_EFFECT, identifier); return new CompatStatusEffect(registryKey); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java index 6959d1fca..39e591ae2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.text.ClickEvent; -import net.minecraft.text.HoverEvent; -import net.minecraft.text.Style; -import net.minecraft.text.StyleSpriteSource; -import net.minecraft.util.Formatting; +import net.minecraft.network.chat.ClickEvent; +import net.minecraft.network.chat.HoverEvent; +import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.FontDescription; +import net.minecraft.ChatFormatting; public class StyleUtil { public static Style emptyStyle() { @@ -24,7 +24,7 @@ public static Style withItalic(Style style, boolean italic) { } public static Style withUnderline(Style style, boolean underline) { - return style.withUnderline(underline); + return style.withUnderlined(underline); } public static Style withStrikethrough(Style style, boolean strikethrough) { @@ -48,14 +48,14 @@ public static Style withHoverEvent(Style style, HoverEvent hoverEvent) { } public static Style withFont(Style style, CompatIdentifier font) { - return style.withFont(new StyleSpriteSource.Font(font.toMinecraft())); + return style.withFont(new FontDescription.Resource(font.toMinecraft())); } - public static Style withFormatting(Style style, Formatting formatting) { - return style.withFormatting(formatting); + public static Style withFormatting(Style style, ChatFormatting formatting) { + return style.applyFormat(formatting); } - public static Style withExclusiveFormatting(Style style, Formatting formatting) { - return style.withExclusiveFormatting(formatting); + public static Style withExclusiveFormatting(Style style, ChatFormatting formatting) { + return style.applyLegacyFormat(formatting); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java index 388da58de..12ee2e0b3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java @@ -1,72 +1,72 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.text.MutableText; -import net.minecraft.text.Style; -import net.minecraft.text.Text; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.text.TextConverter; public class TextUtil { - public static MutableText literal(String string) { - return Text.literal(string); + public static MutableComponent literal(String string) { + return Component.literal(string); } - public static MutableText translatable(String key) { - return Text.translatable(key); + public static MutableComponent translatable(String key) { + return Component.translatable(key); } - public static MutableText translatable(String key, Object... args) { - return Text.translatable(key, args); + public static MutableComponent translatable(String key, Object... args) { + return Component.translatable(key, args); } - public static MutableText empty() { + public static MutableComponent empty() { return literal(""); } - public static MutableText keybind(String string) { - return Text.keybind(string); + public static MutableComponent keybind(String string) { + return Component.keybind(string); } - public static String txt2str(Text text) { + public static String txt2str(Component text) { return text.getString(); } - public static MutableText setStyle(MutableText text, Style style) { + public static MutableComponent setStyle(MutableComponent text, Style style) { return text.setStyle(style); } - public static Style getStyle(MutableText text) { + public static Style getStyle(MutableComponent text) { return text.getStyle(); } - public static MutableText withColor(MutableText text, int color) { + public static MutableComponent withColor(MutableComponent text, int color) { return setStyle(text, StyleUtil.withColor(text.getStyle(), color)); } - public static MutableText withBold(MutableText text, boolean bold) { + public static MutableComponent withBold(MutableComponent text, boolean bold) { return setStyle(text, StyleUtil.withBold(text.getStyle(), bold)); } - public static MutableText append(MutableText text, Text sibling) { + public static MutableComponent append(MutableComponent text, Component sibling) { return text.append(sibling); } - public static MutableText append(MutableText text, String string) { + public static MutableComponent append(MutableComponent text, String string) { return text.append(string); } - public static MutableText of(String string) { + public static MutableComponent of(String string) { return literal(string); } - public static MutableText convert(String text) { + public static MutableComponent convert(String text) { return TextConverter.convert(text, false); } - public static MutableText convertWithTranslatable(String text) { + public static MutableComponent convertWithTranslatable(String text) { return TextConverter.convert(text, true); } - public static boolean contains(Text text, Text text1) { + public static boolean contains(Component text, Component text1) { return text.contains(text1); } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java index eaf08acdb..a855dee29 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; import net.pitan76.mcpitanlib.api.timer.MinecraftServerTimerAccess; import net.pitan76.mcpitanlib.api.timer.ServerWorldTimerAccess; import java.util.function.Supplier; public class TimerUtil { - public static void addTimer(ServerWorld world, long ticksUntilSomething, Supplier supplier) { + public static void addTimer(ServerLevel world, long ticksUntilSomething, Supplier supplier) { ((ServerWorldTimerAccess) world).mcpitanlib$addTimer(ticksUntilSomething, supplier); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java index 87571de96..3ec18e2b3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.recipe.Ingredient; +import net.minecraft.world.item.crafting.Ingredient; import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; public class ToolMaterialUtil { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java index f68dd0bfb..92e04fa64 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java @@ -1,43 +1,43 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.phys.shapes.Shapes; public class VoxelShapeUtil { - public static VoxelShape union(VoxelShape shape,VoxelShape... shapes) { - return VoxelShapes.union(shape, shapes); + public static VoxelShape union(VoxelShape shape, VoxelShape... shapes) { + return Shapes.or(shape, shapes); } public static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) { - return VoxelShapes.cuboid(x1, y1, z1, x2, y2, z2); + return Shapes.box(x1, y1, z1, x2, y2, z2); } public static VoxelShape cuboid(double x, double y, double z, double size) { - return VoxelShapes.cuboid(x, y, z, x + size, y + size, z + size); + return Shapes.box(x, y, z, x + size, y + size, z + size); } public static VoxelShape cuboid(double size) { - return VoxelShapes.cuboid(0, 0, 0, size, size, size); + return Shapes.box(0, 0, 0, size, size, size); } public static VoxelShape centeredCuboid(double x, double y, double z, double size) { - return VoxelShapes.cuboid(x - size / 2, y - size / 2, z - size / 2, x + size / 2, y + size / 2, z + size / 2); + return Shapes.box(x - size / 2, y - size / 2, z - size / 2, x + size / 2, y + size / 2, z + size / 2); } public static VoxelShape empty() { - return VoxelShapes.empty(); + return Shapes.empty(); } public static VoxelShape fullCube() { - return VoxelShapes.fullCube(); + return Shapes.block(); } public static VoxelShape blockCuboid(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - return VoxelShapes.cuboid(minX / 16.0, minY / 16.0, minZ / 16.0, maxX / 16.0, maxY / 16.0, maxZ / 16.0); + return Shapes.box(minX / 16.0, minY / 16.0, minZ / 16.0, maxX / 16.0, maxY / 16.0, maxZ / 16.0); } - public static Box getBoundingBox(VoxelShape shape) { - return shape.getBoundingBox(); + public static AABB getBoundingBox(VoxelShape shape) { + return shape.bounds(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java index 183a6e34f..7e6eac9b2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java @@ -1,37 +1,37 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; public class WorldRandomUtil { - public static int nextInt(World world) { + public static int nextInt(Level world) { return world.getRandom().nextInt(); } - public static int nextInt(World world, int bound) { + public static int nextInt(Level world, int bound) { return world.getRandom().nextInt(bound); } - public static long nextLong(World world) { + public static long nextLong(Level world) { return world.getRandom().nextLong(); } - public static double nextDouble(World world) { + public static double nextDouble(Level world) { return world.getRandom().nextDouble(); } - public static double nextGaussian(World world) { + public static double nextGaussian(Level world) { return world.getRandom().nextGaussian(); } - public static float nextFloat(World world) { + public static float nextFloat(Level world) { return world.getRandom().nextFloat(); } - public static int nextBetween(World world, int min, int max) { - return world.getRandom().nextBetween(min, max); + public static int nextBetween(Level world, int min, int max) { + return world.getRandom().nextIntBetweenInclusive(min, max); } - public static int nextBetweenExclusive(World world, int min, int max) { - return world.getRandom().nextBetweenExclusive(min, max); + public static int nextBetweenExclusive(Level world, int min, int max) { + return world.getRandom().nextInt(min, max); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java index c23143fee..cfef68661 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java @@ -1,30 +1,35 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ExperienceOrb; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.entity.*; -import net.minecraft.entity.mob.Monster; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.predicate.entity.EntityPredicates; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.entity.monster.Enemy; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; @@ -41,336 +46,336 @@ import java.util.function.Predicate; public class WorldUtil { - public static boolean hasSkyLight(World world) { - return world.getDimension().hasSkyLight(); + public static boolean hasSkyLight(Level world) { + return world.dimensionType().hasSkyLight(); } - public static boolean isThundering(World world) { + public static boolean isThundering(Level world) { return world.isThundering(); } - public static boolean isRaining(World world) { + public static boolean isRaining(Level world) { return world.isRaining(); } - public static boolean isNight(World world) { - return world.isNight(); + public static boolean isNight(Level world) { + return world.isDarkOutside(); } - public static boolean isDay(World world) { - return world.isDay(); + public static boolean isDay(Level world) { + return world.isBrightOutside(); } - public static boolean isSkyVisible(World world, BlockPos pos) { - return world.isSkyVisible(pos); + public static boolean isSkyVisible(Level world, BlockPos pos) { + return world.canSeeSky(pos); } - public static boolean isClient(World world) { - return world.isClient(); + public static boolean isClient(Level world) { + return world.isClientSide(); } - public static void scheduleBlockTick(World world, BlockPos pos, Block block, int delay) { - world.scheduleBlockTick(pos, block, delay); + public static void scheduleBlockTick(Level world, BlockPos pos, Block block, int delay) { + world.scheduleTick(pos, block, delay); } - public static void scheduleFluidTick(World world, BlockPos pos, Fluid fluid, int delay) { - world.scheduleFluidTick(pos, fluid, delay); + public static void scheduleFluidTick(Level world, BlockPos pos, Fluid fluid, int delay) { + world.scheduleTick(pos, fluid, delay); } - public static boolean isServer(World world) { + public static boolean isServer(Level world) { return !isClient(world); } - public static void spawnStack(World world, BlockPos pos, ItemStack stack) { + public static void spawnStack(Level world, BlockPos pos, ItemStack stack) { spawnEntity(world, new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), stack)); } - public static void spawnExperienceOrb(World world, Vec3d pos, int amount) { - if (world instanceof ServerWorld) - ExperienceOrbEntity.spawn((ServerWorld) world, pos, amount); + public static void spawnExperienceOrb(Level world, Vec3 pos, int amount) { + if (world instanceof ServerLevel) + ExperienceOrb.award((ServerLevel) world, pos, amount); } - public static void spawnExperienceOrb(World world, BlockPos pos, int amount) { - spawnExperienceOrb(world, pos.toCenterPos(), amount); + public static void spawnExperienceOrb(Level world, BlockPos pos, int amount) { + spawnExperienceOrb(world, pos.getCenter(), amount); } - public static void spawnEntity(World world, Entity entity) { - world.spawnEntity(entity); + public static void spawnEntity(Level world, Entity entity) { + world.addFreshEntity(entity); } - public static void playSound(World world, @Nullable Player player, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { - PlayerEntity entity = player == null ? null : player.getEntity(); + public static void playSound(Level world, @Nullable Player player, BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { + Player entity = player == null ? null : player.getEntity(); world.playSound(entity, pos, sound, category, volume, pitch); } - public static void playSound(World world, @Nullable Player player, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { + public static void playSound(Level world, @Nullable Player player, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { playSound(world, player, pos, sound.get(), category.get(), volume, pitch); } - public static void playSound(World world, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { + public static void playSound(Level world, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch) { playSound(world, null, pos, sound.get(), category.get(), volume, pitch); } - public static void playSound(World world, double x, double y, double z, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, boolean useDistance) { - world.playSoundClient(x, y, z, sound.get(), category.get(), volume, pitch, useDistance); + public static void playSound(Level world, double x, double y, double z, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, boolean useDistance) { + world.playLocalSound(x, y, z, sound.get(), category.get(), volume, pitch, useDistance); } - public static void sendEntityStatus(World world, Entity entity, byte status) { - world.sendEntityStatus(entity, status); + public static void sendEntityStatus(Level world, Entity entity, byte status) { + world.broadcastEntityEvent(entity, status); } - public static BlockPos getSpawnPos(World world) { - return world.getSpawnPoint().getPos(); + public static BlockPos getSpawnPos(Level world) { + return world.getRespawnData().pos(); } - public static Optional getServer(World world) { + public static Optional getServer(Level world) { if (isClient(world)) return Optional.empty(); return Optional.ofNullable(world.getServer()); } - public static ServerWorld getWorld(World world, Identifier worldId) { + public static ServerLevel getWorld(Level world, Identifier worldId) { Optional server = getServer(world); return server.map(minecraftServer -> getWorld(minecraftServer, worldId)).orElse(null); } - public static Optional getWorld(World world, CompatIdentifier worldId) { + public static Optional getWorld(Level world, CompatIdentifier worldId) { return Optional.ofNullable(getWorld(world, worldId.toMinecraft())); } - public static ServerWorld getOverworld(MinecraftServer server) { - return server.getWorld(World.OVERWORLD); + public static ServerLevel getOverworld(MinecraftServer server) { + return server.getLevel(Level.OVERWORLD); } - public static ServerWorld getNether(MinecraftServer server) { - return server.getWorld(World.NETHER); + public static ServerLevel getNether(MinecraftServer server) { + return server.getLevel(Level.NETHER); } - public static ServerWorld getEnd(MinecraftServer server) { - return server.getWorld(World.END); + public static ServerLevel getEnd(MinecraftServer server) { + return server.getLevel(Level.END); } - public static ServerWorld getWorld(MinecraftServer server, Identifier worldId) { - return server.getWorld(RegistryKey.of(RegistryKeys.WORLD, worldId)); + public static ServerLevel getWorld(MinecraftServer server, Identifier worldId) { + return server.getLevel(ResourceKey.create(Registries.DIMENSION, worldId)); } - public static ServerWorld getWorld(MinecraftServer server, CompatIdentifier worldId) { + public static ServerLevel getWorld(MinecraftServer server, CompatIdentifier worldId) { return getWorld(server, worldId.toMinecraft()); } - public static Identifier getWorldId(World world) { - return world.getRegistryKey().getValue(); + public static Identifier getWorldId(Level world) { + return world.dimension().identifier(); } - public static CompatIdentifier getCompatWorldId(World world) { + public static CompatIdentifier getCompatWorldId(Level world) { return CompatIdentifier.fromMinecraft(getWorldId(world)); } - public static boolean equals(World world, World world2) { + public static boolean equals(Level world, Level world2) { return Objects.equals(getWorldId(world), getWorldId(world2)); } @Deprecated - public static void addTicket(ServerWorld world, net.minecraft.server.world.ChunkTicketType type, ChunkPos pos, int radius, T argument) { - world.getChunkManager().addTicket(type, pos, radius); + public static void addTicket(ServerLevel world, net.minecraft.server.level.TicketType type, ChunkPos pos, int radius, T argument) { + world.getChunkSource().addTicketWithRadius(type, pos, radius); } @Deprecated - public static void removeTicket(ServerWorld world, net.minecraft.server.world.ChunkTicketType type, ChunkPos pos, int radius, T argument) { - world.getChunkManager().removeTicket(type, pos, radius); + public static void removeTicket(ServerLevel world, net.minecraft.server.level.TicketType type, ChunkPos pos, int radius, T argument) { + world.getChunkSource().removeTicketWithRadius(type, pos, radius); } - public static void addTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { + public static void addTicket(ServerLevel world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { addTicket(world, type.getRaw(), pos, radius, argument); } - public static void removeTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { + public static void removeTicket(ServerLevel world, ChunkTicketType type, ChunkPos pos, int radius, T argument) { removeTicket(world, type.getRaw(), pos, radius, argument); } - public static void addTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius) { - world.getChunkManager().addTicket(type.getRaw(), pos, radius); + public static void addTicket(ServerLevel world, ChunkTicketType type, ChunkPos pos, int radius) { + world.getChunkSource().addTicketWithRadius(type.getRaw(), pos, radius); } - public static void removeTicket(ServerWorld world, ChunkTicketType type, ChunkPos pos, int radius) { - world.getChunkManager().removeTicket(type.getRaw(), pos, radius); + public static void removeTicket(ServerLevel world, ChunkTicketType type, ChunkPos pos, int radius) { + world.getChunkSource().removeTicketWithRadius(type.getRaw(), pos, radius); } - public static boolean isReceivingRedstonePower(World world, BlockPos pos) { - return world.isReceivingRedstonePower(pos); + public static boolean isReceivingRedstonePower(Level world, BlockPos pos) { + return world.hasNeighborSignal(pos); } - public static int getBottomY(World world) { - return world.getBottomY(); + public static int getBottomY(Level world) { + return world.getMinY(); } - public static int getTopY(World world) { - return world.getTopYInclusive(); + public static int getTopY(Level world) { + return world.getMaxY(); } - public static int getDimensionHeight(World world) { - return world.getDimension().height(); + public static int getDimensionHeight(Level world) { + return world.dimensionType().height(); } - public static BlockEntity getBlockEntity(World world, BlockPos pos) { + public static BlockEntity getBlockEntity(Level world, BlockPos pos) { return world.getBlockEntity(pos); } - public static boolean hasBlockEntity(World world, BlockPos pos) { + public static boolean hasBlockEntity(Level world, BlockPos pos) { return getBlockEntity(world, pos) != null; } - public static BlockState getBlockState(World world, BlockPos pos) { + public static BlockState getBlockState(Level world, BlockPos pos) { return world.getBlockState(pos); } - public static FluidState getFluidState(World world, BlockPos pos) { + public static FluidState getFluidState(Level world, BlockPos pos) { return world.getFluidState(pos); } - public static boolean hasFluidState(World world, BlockPos pos) { + public static boolean hasFluidState(Level world, BlockPos pos) { return ! getFluidState(world, pos).isEmpty(); } - public static boolean isAir(World world, BlockPos pos) { + public static boolean isAir(Level world, BlockPos pos) { return getBlockState(world, pos).isAir(); } - public static boolean setBlockState(World world, BlockPos pos, BlockState state, int flags) { - return world.setBlockState(pos, state, flags); + public static boolean setBlockState(Level world, BlockPos pos, BlockState state, int flags) { + return world.setBlock(pos, state, flags); } - public static boolean setBlockState(World world, BlockPos pos, BlockState state) { + public static boolean setBlockState(Level world, BlockPos pos, BlockState state) { return setBlockState(world, pos, state, 3); } - public static boolean setBlockState(World world, BlockPos pos, Block block, int flags) { - return setBlockState(world, pos, block.getDefaultState(), flags); + public static boolean setBlockState(Level world, BlockPos pos, Block block, int flags) { + return setBlockState(world, pos, block.defaultBlockState(), flags); } - public static boolean setBlockState(World world, BlockPos pos, Block block) { + public static boolean setBlockState(Level world, BlockPos pos, Block block) { return setBlockState(world, pos, block, 3); } - public static boolean breakBlock(World world, BlockPos pos, boolean drop) { - return world.breakBlock(pos, drop); + public static boolean breakBlock(Level world, BlockPos pos, boolean drop) { + return world.destroyBlock(pos, drop); } - public static boolean breakBlock(World world, BlockPos pos) { + public static boolean breakBlock(Level world, BlockPos pos) { return breakBlock(world, pos, true); } - public static boolean breakBlock(World world, BlockPos pos, boolean drop, @Nullable Player player) { + public static boolean breakBlock(Level world, BlockPos pos, boolean drop, @Nullable Player player) { if (player == null) - return world.breakBlock(pos, drop, null); + return world.destroyBlock(pos, drop, null); - return world.breakBlock(pos, drop, player.getPlayerEntity()); + return world.destroyBlock(pos, drop, player.getPlayerEntity()); } - public static boolean breakBlock(World world, BlockPos pos, @Nullable Player player) { + public static boolean breakBlock(Level world, BlockPos pos, @Nullable Player player) { return breakBlock(world, pos, true, player); } - public static void removeBlockEntity(World world, BlockPos pos) { + public static void removeBlockEntity(Level world, BlockPos pos) { world.removeBlockEntity(pos); } - public static boolean removeBlock(World world, BlockPos pos, boolean move) { + public static boolean removeBlock(Level world, BlockPos pos, boolean move) { return world.removeBlock(pos, move); } - public static void addParticle(World world, ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - world.addParticleClient(parameters, x, y, z, velocityX, velocityY, velocityZ); + public static void addParticle(Level world, ParticleOptions parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + world.addParticle(parameters, x, y, z, velocityX, velocityY, velocityZ); } - public static boolean canSetBlock(World world, BlockPos pos) { - return world.canPlace(Blocks.STONE.getDefaultState(), pos, ShapeContext.absent()); + public static boolean canSetBlock(Level world, BlockPos pos) { + return world.isUnobstructed(Blocks.STONE.defaultBlockState(), pos, CollisionContext.empty()); } - public static void updateComparators(World world, BlockPos pos, Block block) { - world.updateComparators(pos, block); + public static void updateComparators(Level world, BlockPos pos, Block block) { + world.updateNeighbourForOutputSignal(pos, block); } - public static List getPlayers(World world) { + public static List getPlayers(Level world) { List players = new ArrayList<>(); - for (PlayerEntity player : world.getPlayers()) { + for (Player player : world.players()) { players.add(new Player(player)); } return players; } - public static Player getPlayer(World world, UUID uuid) { - return new Player(world.getPlayerByUuid(uuid)); + public static Player getPlayer(Level world, UUID uuid) { + return new Player(world.getPlayerByUUID(uuid)); } - public static CompatRandom getRandom(World world) { + public static CompatRandom getRandom(Level world) { return new CompatRandom(world.getRandom()); } - public static long getTime(World world) { - return world.getTime(); + public static long getTime(Level world) { + return world.getGameTime(); } - public static List getEntitiesByType(World world, EntityType filter, Box box, Predicate predicate) { - return world.getEntitiesByType(filter, box, predicate); + public static List getEntitiesByType(Level world, EntityType filter, AABB box, Predicate predicate) { + return world.getEntities(filter, box, predicate); } - public static List getEntitiesByClass(World world, Class entityClass, Box box, Predicate predicate) { - return world.getEntitiesByClass(entityClass, box, predicate); + public static List getEntitiesByClass(Level world, Class entityClass, AABB box, Predicate predicate) { + return world.getEntitiesOfClass(entityClass, box, predicate); } - public static void spawnParticles(World world, ParticleEffect parameters, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { + public static void spawnParticles(Level world, ParticleOptions parameters, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { if (!isServer(world)) return; - ((ServerWorld) world).spawnParticles(parameters, x, y, z, count, velocityX, velocityY, velocityZ, speed); + ((ServerLevel) world).sendParticles(parameters, x, y, z, count, velocityX, velocityY, velocityZ, speed); } - public static void updateListeners(World world, BlockPos pos, BlockState oldState, BlockState newState, int flags) { - world.updateListeners(pos, oldState, newState, flags); + public static void updateListeners(Level world, BlockPos pos, BlockState oldState, BlockState newState, int flags) { + world.sendBlockUpdated(pos, oldState, newState, flags); } - public static net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState(World world, BlockPos pos) { + public static net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState(Level world, BlockPos pos) { return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState(world, pos)); } - public static boolean setBlockState(World world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { + public static boolean setBlockState(Level world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { return setBlockState(world, pos, state.toMinecraft(), flags); } - public static boolean setBlockState(World world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { + public static boolean setBlockState(Level world, BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { return setBlockState(world, pos, state, 3); } - public static boolean setBlockState(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { + public static boolean setBlockState(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state, int flags) { return setBlockState(world, pos.toMinecraft(), state.toMinecraft(), flags); } - public static boolean setBlockState(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { + public static boolean setBlockState(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, net.pitan76.mcpitanlib.midohra.block.BlockState state) { return setBlockState(world, pos, state, 3); } - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop) { + public static boolean breakBlock(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop) { return breakBlock(world, pos.toMinecraft(), drop); } - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + public static boolean breakBlock(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { return breakBlock(world, pos, true); } - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop, @Nullable Player player) { + public static boolean breakBlock(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean drop, @Nullable Player player) { return breakBlock(world, pos.toMinecraft(), drop, player); } - public static boolean breakBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, @Nullable Player player) { + public static boolean breakBlock(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, @Nullable Player player) { return breakBlock(world, pos, true, player); } - public static void removeBlockEntity(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + public static void removeBlockEntity(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { removeBlockEntity(world, pos.toMinecraft()); } - public static boolean removeBlock(World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean move) { + public static boolean removeBlock(Level world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, boolean move) { return removeBlock(world, pos.toMinecraft(), move); } @@ -378,12 +383,12 @@ public static void playSound(net.pitan76.mcpitanlib.midohra.world.World world, @ playSound(world.getRaw(), player, pos.toMinecraft(), sound, category, volume, pitch); } - public static void dropStackOnBlock(World world, BlockPos pos, ItemStack stack) { - Block.dropStack(world, pos, stack); + public static void dropStackOnBlock(Level world, BlockPos pos, ItemStack stack) { + Block.popResource(world, pos, stack); } - public static float getSkyAngle(World world, float tickDelta) { - long timeOfDay = world.getTimeOfDay(); + public static float getSkyAngle(Level world, float tickDelta) { + long timeOfDay = world.getDayTime(); float f = ((float)(timeOfDay % 24000L) + tickDelta) / 24000.0F - 0.25F; if (f < 0.0F) { f += 1.0F; @@ -394,89 +399,89 @@ public static float getSkyAngle(World world, float tickDelta) { return f; } - public static Block getBlock(World world, BlockPos pos) { + public static Block getBlock(Level world, BlockPos pos) { return getBlockState(world, pos).getBlock(); } - public static BlockWrapper getBlockWrapper(World world, BlockPos pos) { + public static BlockWrapper getBlockWrapper(Level world, BlockPos pos) { return BlockWrapper.of(getBlock(world, pos)); } - public static List getEntitiesByType(World world, EntityType filter, Box box) { - return getEntitiesByType(world, filter, box, EntityPredicates.VALID_ENTITY); + public static List getEntitiesByType(Level world, EntityType filter, AABB box) { + return getEntitiesByType(world, filter, box, EntitySelector.ENTITY_STILL_ALIVE); } - public static List getEntitiesByType(World world, EntityTypeWrapper filter, Box box, Predicate predicate) { + public static List getEntitiesByType(Level world, EntityTypeWrapper filter, AABB box, Predicate predicate) { return getEntitiesByType(world, (EntityType) filter.get(), box, predicate); } - public static List getEntitiesByType(World world, EntityTypeWrapper filter, Box box) { + public static List getEntitiesByType(Level world, EntityTypeWrapper filter, AABB box) { return getEntitiesByType(world, filter.get(), box); } public static CompatIdentifier getOverworldId() { - return CompatIdentifier.fromMinecraft(World.OVERWORLD.getValue()); + return CompatIdentifier.fromMinecraft(Level.OVERWORLD.identifier()); } public static CompatIdentifier getNetherId() { - return CompatIdentifier.fromMinecraft(World.NETHER.getValue()); + return CompatIdentifier.fromMinecraft(Level.NETHER.identifier()); } public static CompatIdentifier getEndId() { - return CompatIdentifier.fromMinecraft(World.END.getValue()); + return CompatIdentifier.fromMinecraft(Level.END.identifier()); } - public static long getTimeOfDay(World world) { - return world.getTimeOfDay(); + public static long getTimeOfDay(Level world) { + return world.getDayTime(); } - public static List getEntitiesByClass(World world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box) { - return getEntitiesByClass(world, entityClass, box, EntityPredicates.VALID_ENTITY); + public static List getEntitiesByClass(Level world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + return getEntitiesByClass(world, entityClass, box, EntitySelector.ENTITY_STILL_ALIVE); } - public static List getEntitiesByClass(World world, Class entityClass, Box box) { - return getEntitiesByClass(world, entityClass, box, EntityPredicates.VALID_ENTITY); + public static List getEntitiesByClass(Level world, Class entityClass, AABB box) { + return getEntitiesByClass(world, entityClass, box, EntitySelector.ENTITY_STILL_ALIVE); } - public static List getEntitiesByClass(World world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + public static List getEntitiesByClass(Level world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { return getEntitiesByClass(world, entityClass, box.toMinecraft(), predicate); } - public static List getEntitiesByClass(World world, Class entityClass, Vector3d center, double radius, Predicate predicate) { - Box box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); + public static List getEntitiesByClass(Level world, Class entityClass, Vector3d center, double radius, Predicate predicate) { + AABB box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); return getEntitiesByClass(world, entityClass, box, predicate); } - public static List getEntitiesByClass(World world, Class entityClass, Vector3d center, double radius) { - return getEntitiesByClass(world, entityClass, center, radius, EntityPredicates.VALID_ENTITY); + public static List getEntitiesByClass(Level world, Class entityClass, Vector3d center, double radius) { + return getEntitiesByClass(world, entityClass, center, radius, EntitySelector.ENTITY_STILL_ALIVE); } - public static List getMonsters(World world, Box box) { - return world.getEntitiesByClass(LivingEntity.class, box, entity -> entity instanceof Monster); + public static List getMonsters(Level world, AABB box) { + return world.getEntitiesOfClass(LivingEntity.class, box, entity -> entity instanceof Enemy); } - public static List getMonsters(World world, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + public static List getMonsters(Level world, net.pitan76.mcpitanlib.midohra.util.math.Box box) { return getMonsters(world, box.toMinecraft()); } - public static List getMonsters(World world, Vector3d center, double radius) { - Box box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); + public static List getMonsters(Level world, Vector3d center, double radius) { + AABB box = BoxUtil.createBox(center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.z + radius); return getMonsters(world, box); } - public static List getEntitiesByType(World world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + public static List getEntitiesByType(Level world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box) { return getEntitiesByType(world, filter, box.toMinecraft()); } - public static List getEntitiesByType(World world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + public static List getEntitiesByType(Level world, EntityTypeWrapper filter, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { return getEntitiesByType(world, filter, box.toMinecraft(), predicate); } /** * ParticleType is a ParticleEffect only. */ - public static void addParticle(World world, CompatParticleType parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - if (parameters.getRaw() instanceof ParticleEffect) - addParticle(world, (ParticleEffect) parameters.getRaw(), x, y, z, velocityX, velocityY, velocityZ); + public static void addParticle(Level world, CompatParticleType parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + if (parameters.getRaw() instanceof ParticleOptions) + addParticle(world, (ParticleOptions) parameters.getRaw(), x, y, z, velocityX, velocityY, velocityZ); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java index 4c42a10e8..52cbeeba7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.util.block; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.Vec3; public class BlockHitResultUtil { - public static BlockHitResult create(Vec3d pos, Direction direction, BlockPos blockPos, boolean insideBlock) { + public static BlockHitResult create(Vec3 pos, Direction direction, BlockPos blockPos, boolean insideBlock) { return new BlockHitResult(pos, direction, blockPos, insideBlock); } - public static BlockHitResult create(Vec3d pos, Direction direction, BlockPos blockPos) { + public static BlockHitResult create(Vec3 pos, Direction direction, BlockPos blockPos) { return new BlockHitResult(pos, direction, blockPos, false); } - public static Vec3d getPos(BlockHitResult blockHitResult) { - return blockHitResult.getPos(); + public static Vec3 getPos(BlockHitResult blockHitResult) { + return blockHitResult.getLocation(); } public static Direction getSide(BlockHitResult blockHitResult) { - return blockHitResult.getSide(); + return blockHitResult.getDirection(); } public static BlockPos getBlockPos(BlockHitResult blockHitResult) { @@ -28,6 +28,6 @@ public static BlockPos getBlockPos(BlockHitResult blockHitResult) { } public static boolean isInsideBlock(BlockHitResult blockHitResult) { - return blockHitResult.isInsideBlock(); + return blockHitResult.isInside(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java index 4f1eae397..be1667a5e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util.block; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; import net.pitan76.mcpitanlib.api.tag.TagKey; import net.pitan76.mcpitanlib.api.text.TextComponent; @@ -222,7 +222,7 @@ public static TextComponent getName(Block block) { * @return Translation key of the block. */ public static String getTranslationKey(Block block) { - return block.getTranslationKey(); + return block.getDescriptionId(); } public static Block fromItem(Item item) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java index 20199a63e..c2a1f7fca 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.util.block.entity; -import net.minecraft.block.entity.AbstractFurnaceBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.AbstractCookingRecipe; -import net.minecraft.recipe.input.SingleStackRecipeInput; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.AbstractCookingRecipe; +import net.minecraft.world.item.crafting.SingleRecipeInput; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.recipe.MatchGetter; import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; import net.pitan76.mcpitanlib.api.util.WorldUtil; @@ -14,31 +14,31 @@ public class FurnaceUtil { public static int getDefaultCookTime() { - return AbstractFurnaceBlockEntity.DEFAULT_COOK_TIME; + return AbstractFurnaceBlockEntity.BURN_TIME_STANDARD; } - public static boolean canUseAsFuel(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, World world) { + public static boolean canUseAsFuel(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, Level world) { return canUseAsFuel(stack.toMinecraft(), world); } - public static boolean canUseAsFuel(ItemStack stack, World world) { - return world.getFuelRegistry().isFuel(stack); + public static boolean canUseAsFuel(ItemStack stack, Level world) { + return world.fuelValues().isFuel(stack); } - public static void tick(World world, BlockPos pos, AbstractFurnaceBlockEntity blockEntity) { - AbstractFurnaceBlockEntity.tick((ServerWorld) world, pos, WorldUtil.getBlockState(world, pos), blockEntity); + public static void tick(Level world, BlockPos pos, AbstractFurnaceBlockEntity blockEntity) { + AbstractFurnaceBlockEntity.serverTick((ServerLevel) world, pos, WorldUtil.getBlockState(world, pos), blockEntity); } - public static int getCookTime(World world, AbstractFurnaceBlockEntity furnace, MatchGetter matchGetter) { - return getCookTime(world, furnace.getStack(0), matchGetter); + public static int getCookTime(Level world, AbstractFurnaceBlockEntity furnace, MatchGetter matchGetter) { + return getCookTime(world, furnace.getItem(0), matchGetter); } - public static int getCookTime(World world, ItemStack stack, MatchGetter matchGetter) { - CompatRecipeInput input = (CompatRecipeInput) SingleStackRecipeInputUtil.create(stack); + public static int getCookTime(Level world, ItemStack stack, MatchGetter matchGetter) { + CompatRecipeInput input = (CompatRecipeInput) SingleStackRecipeInputUtil.create(stack); matchGetter.getFirstMatch(input, world); return matchGetter.getFirstMatch(input, world).map( - (recipe) -> (recipe.getRecipe()).getCookingTime()).orElse(200); + (recipe) -> (recipe.getRecipe()).cookingTime()).orElse(200); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java index 66a89f319..5d32eaf37 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util.client; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; public class BlockEntityRendererUtil { - public static BlockEntityRendererFactory.Context convert(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { - return new BlockEntityRendererFactory.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getItemRenderer(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer(), ctx.getSpriteHolder(), ctx.getPlayerSkinRenderCache()); + public static BlockEntityRendererProvider.Context convert(CompatRegistryClient2.BlockEntityRendererFactory.Context ctx) { + return new BlockEntityRendererProvider.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getItemRenderer(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer(), ctx.getSpriteHolder(), ctx.getPlayerSkinRenderCache()); } - public static CompatRegistryClient.BlockEntityRendererFactory.Context convert(BlockEntityRendererFactory.Context ctx) { - return new CompatRegistryClient.BlockEntityRendererFactory.Context(ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache()); + public static CompatRegistryClient2.BlockEntityRendererFactory.Context convert(BlockEntityRendererProvider.Context ctx) { + return new CompatRegistryClient2.BlockEntityRendererFactory.Context(ctx.blockEntityRenderDispatcher(), ctx.blockRenderDispatcher(), ctx.itemModelResolver(), ctx.itemRenderer(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.materials(), ctx.playerSkinRenderCache()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java index 9b807f0ea..0fdec8579 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.util.client; import com.mojang.authlib.GameProfile; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.Mouse; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.texture.TextureManager; -import net.minecraft.client.util.Window; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.resource.ResourceManager; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.profiler.Profiler; +import net.minecraft.client.Minecraft; +import net.minecraft.client.MouseHandler; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import com.mojang.blaze3d.platform.Window; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.world.phys.HitResult; +import net.minecraft.util.profiling.ProfilerFiller; import net.pitan76.mcpitanlib.api.client.option.GameOptionsWrapper; import net.pitan76.mcpitanlib.api.entity.Player; @@ -27,23 +27,23 @@ public static void setScreen(Screen screen) { } public static Screen getScreen() { - return getClient().currentScreen; + return getClient().screen; } public static Player getPlayer() { return new Player(getClientPlayer()); } - public static ClientPlayerEntity getClientPlayer() { + public static LocalPlayer getClientPlayer() { return getClient().player; } - public static MinecraftClient getClient() { - return MinecraftClient.getInstance(); + public static Minecraft getClient() { + return Minecraft.getInstance(); } - public static TextRenderer getTextRenderer() { - return getClient().textRenderer; + public static Font getTextRenderer() { + return getClient().font; } public static ItemRenderer getItemRenderer() { @@ -58,8 +58,8 @@ public static TextureManager getTextureManager() { return getClient().getTextureManager(); } - public static ClientWorld getWorld() { - return getClient().world; + public static ClientLevel getWorld() { + return getClient().level; } public static GameRenderer getGameRenderer() { @@ -67,27 +67,27 @@ public static GameRenderer getGameRenderer() { } public static Optional getTime() { - if (getClient().world == null) return Optional.empty(); - return Optional.of(getClient().world.getTime()); + if (getClient().level == null) return Optional.empty(); + return Optional.of(getClient().level.getGameTime()); } public static long getRenderTime() { - return getClient().getRenderTime(); + return getClient().getFrameTimeNs(); } public static HitResult getTarget() { - return getClient().crosshairTarget; + return getClient().hitResult; } - public static WorldRenderer getWorldRenderer() { - return getClient().worldRenderer; + public static LevelRenderer getWorldRenderer() { + return getClient().levelRenderer; } public static File getRunDirectory() { - return getClient().runDirectory; + return getClient().gameDirectory; } - public static Profiler getProfiler() { + public static ProfilerFiller getProfiler() { return null; } @@ -99,12 +99,12 @@ public static Window getWindow() { return getClient().getWindow(); } - public static Mouse getMouse() { - return getClient().mouse; + public static MouseHandler getMouse() { + return getClient().mouseHandler; } public static boolean isInSingleplayer() { - return getClient().isInSingleplayer(); + return getClient().isLocalServer(); } public static boolean isPaused() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java index 89ce635d4..e45c07d23 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.util.client; -import net.minecraft.client.resource.language.I18n; -import net.minecraft.client.resource.language.LanguageManager; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.client.resources.language.LanguageManager; import net.pitan76.mcpitanlib.midohra.resource.ResourceManager; public class LanguageUtil { public static boolean hasTranslation(String key) { - return I18n.hasTranslation(key); + return I18n.exists(key); } public static String translate(String key) { - return I18n.translate(key); + return I18n.get(key); } public static String translate(String key, Object... args) { - return I18n.translate(key, args); + return I18n.get(key, args); } public static String translateWithFallback(String key, String fallback) { - return I18n.hasTranslation(key) ? I18n.translate(key) : fallback; + return I18n.exists(key) ? I18n.get(key) : fallback; } public static String translateWithFallback(String key, String fallback, Object... args) { - return I18n.hasTranslation(key) ? I18n.translate(key, args) : fallback; + return I18n.exists(key) ? I18n.get(key, args) : fallback; } public static LanguageManager getLanguageManager() { @@ -30,15 +30,15 @@ public static LanguageManager getLanguageManager() { } public static String getLanguage() { - return getLanguageManager().getLanguage(); + return getLanguageManager().getSelected(); } public static void setLanguage(String language) { - getLanguageManager().setLanguage(language); + getLanguageManager().setSelected(language); } - public static void reload(net.minecraft.resource.ResourceManager resourceManager) { - getLanguageManager().reload(resourceManager); + public static void reload(net.minecraft.server.packs.resources.ResourceManager resourceManager) { + getLanguageManager().onResourceManagerReload(resourceManager); } public static void reload(ResourceManager resourceManager) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java index 52a5d0a56..1d14db8b6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java @@ -1,32 +1,32 @@ package net.pitan76.mcpitanlib.api.util.client; -import net.minecraft.client.util.math.MatrixStack; +import com.mojang.blaze3d.vertex.PoseStack; import net.pitan76.mcpitanlib.api.util.MathUtil; import static net.pitan76.mcpitanlib.api.util.MathUtil.getRotationDegrees; public class MatrixStackUtil { - public static void multiply(MatrixStack matrixStack, MathUtil.RotationAxisType type, float deg) { - matrixStack.multiply(getRotationDegrees(type, deg)); + public static void multiply(PoseStack matrixStack, MathUtil.RotationAxisType type, float deg) { + matrixStack.mulPose(getRotationDegrees(type, deg)); } - public static void push(MatrixStack matrices) { - matrices.push(); + public static void push(PoseStack matrices) { + matrices.pushPose(); } - public static void pop(MatrixStack matrices) { - matrices.pop(); + public static void pop(PoseStack matrices) { + matrices.popPose(); } - public static void translate(MatrixStack matrices, double x, double y, double z) { + public static void translate(PoseStack matrices, double x, double y, double z) { matrices.translate(x, y, z); } - public static void scale(MatrixStack matrices, float x, float y, float z) { + public static void scale(PoseStack matrices, float x, float y, float z) { matrices.scale(x, y, z); } - public static MatrixStack.Entry peek(MatrixStack matrices) { - return matrices.peek(); + public static PoseStack.Pose peek(PoseStack matrices) { + return matrices.last(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java index 898acde1d..8bfe79623 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java @@ -1,46 +1,46 @@ package net.pitan76.mcpitanlib.api.util.client; -import net.minecraft.client.Mouse; +import net.minecraft.client.MouseHandler; public class MouseUtil { - public static Mouse getMouse() { + public static MouseHandler getMouse() { return ClientUtil.getMouse(); } public static double getMouseX() { - return getMouse().getX(); + return getMouse().xpos(); } public static double getMouseY() { - return getMouse().getY(); + return getMouse().ypos(); } public static boolean isCursorLocked() { - return getMouse().isCursorLocked(); + return getMouse().isMouseGrabbed(); } public static void lockCursor() { - getMouse().lockCursor(); + getMouse().grabMouse(); } public static void unlockCursor() { - getMouse().unlockCursor(); + getMouse().releaseMouse(); } public static void tick() { - getMouse().tick(); + getMouse().handleAccumulatedMovement(); } public static boolean wasLeftButtonClicked() { - return getMouse().wasLeftButtonClicked(); + return getMouse().isLeftPressed(); } public static boolean wasRightButtonClicked() { - return getMouse().wasRightButtonClicked(); + return getMouse().isRightPressed(); } public static boolean wasMiddleButtonClicked() { - return getMouse().wasMiddleButtonClicked(); + return getMouse().isMiddlePressed(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java index 9f359afa0..a37d480ef 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java @@ -2,14 +2,14 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.screen.ScreenTexts; -import net.minecraft.text.OrderedText; -import net.minecraft.text.Text; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.renderer.RenderPipelines; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.util.FormattedCharSequence; +import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; import net.pitan76.mcpitanlib.api.client.gui.widget.RedrawableTexturedButtonWidget; @@ -43,87 +43,87 @@ public static void setRepeatEvents(boolean isRepeatEvents) { public static void setPassEvents(Screen screen, boolean isPassEvents) { } - public static ButtonWidget createButtonWidget(int x, int y, int width, int height, Text message, ButtonWidget.PressAction onPress) { + public static Button createButtonWidget(int x, int y, int width, int height, Component message, Button.OnPress onPress) { return createButtonWidget(x, y, width, height, message, onPress, null); } - public static ButtonWidget createButtonWidget(int x, int y, int width, int height, Text message, ButtonWidget.PressAction onPress, @Nullable ButtonWidget.NarrationSupplier tooltipSupplier) { - ButtonWidget.Builder builder = ButtonWidget.builder(message, onPress).dimensions(x, y, width , height); + public static Button createButtonWidget(int x, int y, int width, int height, Component message, Button.OnPress onPress, @Nullable Button.CreateNarration tooltipSupplier) { + Button.Builder builder = Button.builder(message, onPress).bounds(x, y, width , height); if (tooltipSupplier != null) - builder.narrationSupplier(tooltipSupplier); + builder.createNarration(tooltipSupplier); return builder.build(); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, Button.OnPress pressAction) { return createTexturedButtonWidget(x, y, width, height, u, v, height, texture, pressAction); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, Button.OnPress pressAction) { return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction) { return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, Texts.empty()); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction, Component message) { return new CompatibleTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, ButtonWidget.PressAction pressAction) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, Identifier texture, Button.OnPress pressAction) { return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, height, texture, pressAction); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, ButtonWidget.PressAction pressAction) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, Button.OnPress pressAction) { return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, 256, 256, pressAction); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction) { return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, Texts.empty()); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction, Component message) { return new RedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, message); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, Button.OnPress pressAction) { return createTexturedButtonWidget(x, y, width, height, u, v, height, texture.toMinecraft(), pressAction); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, Button.OnPress pressAction) { return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction) { return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); } - public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + public static CompatibleTexturedButtonWidget createTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction, Component message) { return createTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, message); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, CompatIdentifier texture, Button.OnPress pressAction) { return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, texture.toMinecraft(), pressAction); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, ButtonWidget.PressAction pressAction) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, Button.OnPress pressAction) { return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), pressAction); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction) { return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction); } - public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, ButtonWidget.PressAction pressAction, Text message) { + public static RedrawableTexturedButtonWidget createRedrawableTexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, CompatIdentifier texture, int textureWidth, int textureHeight, Button.OnPress pressAction, Component message) { return createRedrawableTexturedButtonWidget(x, y, width, height, u, v, hoveredVOffset, texture.toMinecraft(), textureWidth, textureHeight, pressAction, message); } public static class Texts { - public static Text empty() { - return ScreenTexts.EMPTY; + public static Component empty() { + return CommonComponents.EMPTY; } } @@ -136,31 +136,31 @@ public static class ClickableWidgetUtil extends net.pitan76.mcpitanlib.api.util. } public static class RendererUtil { - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, Text text, int x, int y, int color) { - drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); + public static int drawText(Font renderer, DrawObjectDM drawObjectDM, Component text, int x, int y, int color) { + drawObjectDM.getContext().drawString(renderer, text, x, y, fixColor(color), false); return -1; } - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, String text, int x, int y, int color) { - drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); + public static int drawText(Font renderer, DrawObjectDM drawObjectDM, String text, int x, int y, int color) { + drawObjectDM.getContext().drawString(renderer, text, x, y, fixColor(color), false); return -1; } - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, OrderedText text, int x, int y, int color) { - drawObjectDM.getContext().drawText(renderer, text, x, y, fixColor(color), false); + public static int drawText(Font renderer, DrawObjectDM drawObjectDM, FormattedCharSequence text, int x, int y, int color) { + drawObjectDM.getContext().drawString(renderer, text, x, y, fixColor(color), false); return -1; } public static void drawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { - drawObjectDM.getContext().drawTexture(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, textureWidth, textureHeight); + drawObjectDM.getContext().blit(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, textureWidth, textureHeight); } public static void drawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, float u, float v, int width, int height) { - drawObjectDM.getContext().drawTexture(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, 256, 256); + drawObjectDM.getContext().blit(RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, 256, 256); } - public static TextRenderer getTextRenderer() { - return MinecraftClient.getInstance().textRenderer; + public static Font getTextRenderer() { + return Minecraft.getInstance().font; } public static void drawTexture(DrawObjectDM drawObjectDM, CompatIdentifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { @@ -171,24 +171,24 @@ public static void drawTexture(DrawObjectDM drawObjectDM, CompatIdentifier textu drawTexture(drawObjectDM, texture.toMinecraft(), x, y, u, v, width, height); } - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y, int color) { + public static int drawText(Font renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y, int color) { return drawText(renderer, drawObjectDM, text.getText(), x, y, color); } - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, Text text, int x, int y) { + public static int drawText(Font renderer, DrawObjectDM drawObjectDM, Component text, int x, int y) { return drawText(renderer, drawObjectDM, text, x, y, -12566464); } - public static int drawText(TextRenderer renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { + public static int drawText(Font renderer, DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { return drawText(renderer, drawObjectDM, text, x, y, -12566464); } - public static void drawTooltip(DrawObjectDM drawObjectDM, TextRenderer textRenderer, Text text, int x, int y) { - drawObjectDM.getContext().drawTooltip(textRenderer, text, x, y); + public static void drawTooltip(DrawObjectDM drawObjectDM, Font textRenderer, Component text, int x, int y) { + drawObjectDM.getContext().setTooltipForNextFrame(textRenderer, text, x, y); } - public static void drawTooltip(DrawObjectDM drawObjectDM, TextRenderer textRenderer, List texts, int x, int y) { - drawObjectDM.getContext().drawTooltip(textRenderer, texts, x, y); + public static void drawTooltip(DrawObjectDM drawObjectDM, Font textRenderer, List texts, int x, int y) { + drawObjectDM.getContext().setComponentTooltipForNextFrame(textRenderer, texts, x, y); } public static void drawBorder(DrawObjectDM drawObjectDM, int x, int y, int width, int height, int color) { @@ -196,21 +196,21 @@ public static void drawBorder(DrawObjectDM drawObjectDM, int x, int y, int width //drawObjectDM.getContext().drawBorder(x, y, width, height, color); } - public static void drawTooltip(DrawObjectDM drawObjectDM, Text text, int x, int y) { - drawObjectDM.getContext().drawTooltip(getTextRenderer(), text, x, y); + public static void drawTooltip(DrawObjectDM drawObjectDM, Component text, int x, int y) { + drawObjectDM.getContext().setTooltipForNextFrame(getTextRenderer(), text, x, y); } public static void drawTooltip(DrawObjectDM drawObjectDM, TextComponent text, int x, int y) { drawTooltip(drawObjectDM, text.getText(), x, y); } - public static void drawTooltip(DrawObjectDM drawObjectDM, List texts, int x, int y) { - drawObjectDM.getContext().drawTooltip(getTextRenderer(), texts, x, y); + public static void drawTooltip(DrawObjectDM drawObjectDM, List texts, int x, int y) { + drawObjectDM.getContext().setComponentTooltipForNextFrame(getTextRenderer(), texts, x, y); } } - public static int getWidth(Text text) { - return RendererUtil.getTextRenderer().getWidth(text); + public static int getWidth(Component text) { + return RendererUtil.getTextRenderer().width(text); } // RGBからARGBに変換する (1.21.6からは透明になるため) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java index a57e74910..cb892b5ed 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.client; -import net.minecraft.client.util.Window; +import com.mojang.blaze3d.platform.Window; public class WindowUtil { @@ -9,19 +9,19 @@ public static Window getWindow() { } public static int getWindowScaledWidth() { - return getWindow().getScaledWidth(); + return getWindow().getGuiScaledWidth(); } public static int getWindowScaledHeight() { - return getWindow().getScaledHeight(); + return getWindow().getGuiScaledHeight(); } public static int getWindowWidth() { - return getWindow().getWidth(); + return getWindow().getScreenWidth(); } public static int getWindowHeight() { - return getWindow().getHeight(); + return getWindow().getScreenHeight(); } public static int getWindowX() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java index d6567bf1f..c46a05630 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.client.render; -import net.minecraft.item.ItemDisplayContext; +import net.minecraft.world.item.ItemDisplayContext; import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; public class CompatItemDisplayContext implements CompatStringIdentifiable { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java index 3a7e8b59f..bd6527436 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.util.client.render; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.item.ItemModelManager; -import net.minecraft.client.render.item.ItemRenderState; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.item.ItemModelResolver; +import net.minecraft.client.renderer.item.ItemStackRenderState; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; /** @@ -14,23 +14,23 @@ public class CompatItemRenderUtil { /** * Renders an ItemStack in FIXED transform mode. */ - public static void renderItemFixed(ItemStack stack, BlockEntityRenderEvent e, World world) { + public static void renderItemFixed(ItemStack stack, BlockEntityRenderEvent e, Level world) { renderItem(stack, CompatItemDisplayContext.FIXED, e, world); } /** * Renders an ItemStack */ - public static void renderItem(ItemStack stack, CompatItemDisplayContext displayContext, BlockEntityRenderEvent e, World world) { - ItemModelManager manager = e.ctx != null ? e.ctx.getItemModelManager() : MinecraftClient.getInstance().getItemModelManager(); + public static void renderItem(ItemStack stack, CompatItemDisplayContext displayContext, BlockEntityRenderEvent e, Level world) { + ItemModelResolver manager = e.ctx != null ? e.ctx.getItemModelManager() : Minecraft.getInstance().getItemModelResolver(); - ItemRenderState state = new ItemRenderState(); - manager.clearAndUpdate(state, stack, displayContext.getContext(), world, null, 0); + ItemStackRenderState state = new ItemStackRenderState(); + manager.updateForTopItem(state, stack, displayContext.getContext(), world, null, 0); int light = e.getLight(); if (light == 0) light = 0xF000F0; // full-bright fallback if not populated by MCPitanLib int overlay = e.getOverlay(); - state.render(e.matrices, e.getQueue(), light, overlay, 0); + state.submit(e.matrices, e.getQueue(), light, overlay, 0); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java index 6121672b7..62eca1ad8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java @@ -1,35 +1,35 @@ package net.pitan76.mcpitanlib.api.util.client.render; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.renderer.texture.OverlayTexture; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.blaze3d.vertex.PoseStack; import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; import org.joml.Matrix3f; import org.joml.Matrix4f; public class VertexConsumerUtil { public static VertexConsumer vertex(VertexConsumer vertexConsumer, float x, float y, float z) { - return vertexConsumer.vertex(x, y, z); + return vertexConsumer.addVertex(x, y, z); } - public static VertexConsumer vertex(VertexConsumer vertexConsumer, MatrixStack stack, float x, float y, float z) { - return vertexConsumer.vertex(stack.peek(), x, y, z); + public static VertexConsumer vertex(VertexConsumer vertexConsumer, PoseStack stack, float x, float y, float z) { + return vertexConsumer.addVertex(stack.last(), x, y, z); } public static VertexConsumer normal(VertexConsumer vertexConsumer, float x, float y, float z) { - return vertexConsumer.normal(x, y, z); + return vertexConsumer.setNormal(x, y, z); } public static VertexConsumer color(VertexConsumer vertexConsumer, float red, float green, float blue, float alpha) { - return vertexConsumer.color(red, green, blue, alpha); + return vertexConsumer.setColor(red, green, blue, alpha); } public static VertexConsumer color(VertexConsumer vertexConsumer, int red, int green, int blue, int alpha) { - return vertexConsumer.color(red, green, blue, alpha); + return vertexConsumer.setColor(red, green, blue, alpha); } public static VertexConsumer colorARGB(VertexConsumer vertexConsumer, int argb) { - return vertexConsumer.color(argb); + return vertexConsumer.setColor(argb); } public static VertexConsumer colorRGB(VertexConsumer vertexConsumer, int rgb) { @@ -37,15 +37,15 @@ public static VertexConsumer colorRGB(VertexConsumer vertexConsumer, int rgb) { } public static VertexConsumer light(VertexConsumer vertexConsumer, int light) { - return vertexConsumer.light(light); + return vertexConsumer.setLight(light); } public static VertexConsumer overlay(VertexConsumer vertexConsumer, int overlay) { - return vertexConsumer.overlay(overlay); + return vertexConsumer.setOverlay(overlay); } public static VertexConsumer overlayDefaultUV(VertexConsumer vertexConsumer) { - return vertexConsumer.overlay(OverlayTexture.DEFAULT_UV); + return vertexConsumer.setOverlay(OverlayTexture.NO_OVERLAY); } public static DrawObjectMV vertex(DrawObjectMV drawObject, float x, float y, float z) { @@ -94,24 +94,24 @@ public static DrawObjectMV overlayDefaultUV(DrawObjectMV drawObject) { } public static VertexConsumer texture(VertexConsumer vertexConsumer, float u, float v) { - return vertexConsumer.texture(u, v); + return vertexConsumer.setUv(u, v); } public static VertexConsumer vertex(VertexConsumer vertexConsumer, Matrix4f matrix4f, float x, float y, float z) { - return vertexConsumer.vertex(matrix4f, x, y, z); + return vertexConsumer.addVertex(matrix4f, x, y, z); } - public static VertexConsumer normal(VertexConsumer vertexConsumer, MatrixStack stack, float x, float y, float z) { - return vertexConsumer.normal(stack.peek(), x, y, z); + public static VertexConsumer normal(VertexConsumer vertexConsumer, PoseStack stack, float x, float y, float z) { + return vertexConsumer.setNormal(stack.last(), x, y, z); } public static VertexConsumer next(VertexConsumer vertexConsumer) { return vertexConsumer; } - public static void renderQuad(VertexConsumer vertexConsumer, MatrixStack stack, Matrix4f matrix4f, Matrix3f matrix3f, - float x1, float y1, float z1, float x2, float y2, float z2, - float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + public static void renderQuad(VertexConsumer vertexConsumer, PoseStack stack, Matrix4f matrix4f, Matrix3f matrix3f, + float x1, float y1, float z1, float x2, float y2, float z2, + float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { float[][] vertexes = new float[4][3]; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java index 8744b12e6..1f24c7b9f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util.client.render; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexRendering; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Box; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.ShapeRenderer; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.world.phys.AABB; import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; import org.joml.Matrix3f; import org.joml.Matrix4f; @@ -11,8 +11,8 @@ import java.util.Optional; public class VertexRenderingUtil { - public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { - MatrixStack.Entry entry = matrices.peek(); + public static void drawBox(PoseStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + PoseStack.Pose entry = matrices.last(); drawLine(buffer, entry, minX, minY, minZ, maxX, minY, minZ, red, green, blue, alpha); drawLine(buffer, entry, minX, minY, maxZ, maxX, minY, maxZ, red, green, blue, alpha); @@ -30,8 +30,8 @@ public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double m drawLine(buffer, entry, maxX, maxY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); } - public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha, float xAxisRed, float yAxisGreen, float zAxisBlue) { - MatrixStack.Entry entry = matrices.peek(); + public static void drawBox(PoseStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha, float xAxisRed, float yAxisGreen, float zAxisBlue) { + PoseStack.Pose entry = matrices.last(); drawLine(buffer, entry, minX, minY, minZ, maxX, minY, minZ, xAxisRed, green, blue, alpha); drawLine(buffer, entry, minX, minY, maxZ, maxX, minY, maxZ, xAxisRed, green, blue, alpha); @@ -49,9 +49,9 @@ public static void drawBox(MatrixStack matrices, VertexConsumer buffer, double m drawLine(buffer, entry, maxX, maxY, minZ, maxX, maxY, maxZ, red, green, zAxisBlue, alpha); } - public static void drawFilledBox(MatrixStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { - MatrixStack.Entry entry = matrices.peek(); - Matrix4f positionMatrix = entry.getPositionMatrix(); + public static void drawFilledBox(PoseStack matrices, VertexConsumer buffer, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, float red, float green, float blue, float alpha) { + PoseStack.Pose entry = matrices.last(); + Matrix4f positionMatrix = entry.pose(); drawQuad(buffer, positionMatrix, minX, minY, minZ, maxX, minY, minZ, maxX, minY, maxZ, minX, minY, maxZ, red, green, blue, alpha); drawQuad(buffer, positionMatrix, minX, maxY, minZ, minX, maxY, maxZ, maxX, maxY, maxZ, maxX, maxY, minZ, red, green, blue, alpha); @@ -73,7 +73,7 @@ public static void drawFilledBox(DrawObjectMV drawObject, double minX, double mi drawFilledBox(drawObject.getStack(), drawObject.getBuffer(), minX, minY, minZ, maxX, maxY, maxZ, red, green, blue, alpha); } - public static void renderQuad(VertexConsumer vertexConsumer, MatrixStack stack, Matrix4f matrix4f, Matrix3f matrix3f, float x1, float y1, float z1, float x2, float y2, float z2, float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { + public static void renderQuad(VertexConsumer vertexConsumer, PoseStack stack, Matrix4f matrix4f, Matrix3f matrix3f, float x1, float y1, float z1, float x2, float y2, float z2, float normalX, float normalY, float normalZ, int r, int g, int b, int alpha, int u, int v, int overlay, int light) { VertexConsumerUtil.renderQuad(vertexConsumer, stack, matrix4f, matrix3f, x1, y1, z1, x2, y2, z2, normalX, normalY, normalZ, r, g, b, alpha, u, v, overlay, light); } @@ -83,14 +83,14 @@ public static void renderQuad(DrawObjectMV drawObject, float x1, float y1, float // TODO: all version impl private static void drawQuad(VertexConsumer buffer, Matrix4f matrix, double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3, double x4, double y4, double z4, float red, float green, float blue, float alpha) { - VertexConsumerUtil.vertex(buffer, matrix, (float)x1, (float)y1, (float)z1).color(red, green, blue, alpha); - VertexConsumerUtil.vertex(buffer, matrix, (float)x2, (float)y2, (float)z2).color(red, green, blue, alpha); - VertexConsumerUtil.vertex(buffer, matrix, (float)x3, (float)y3, (float)z3).color(red, green, blue, alpha); - VertexConsumerUtil.vertex(buffer, matrix, (float)x4, (float)y4, (float)z4).color(red, green, blue, alpha); + VertexConsumerUtil.vertex(buffer, matrix, (float)x1, (float)y1, (float)z1).setColor(red, green, blue, alpha); + VertexConsumerUtil.vertex(buffer, matrix, (float)x2, (float)y2, (float)z2).setColor(red, green, blue, alpha); + VertexConsumerUtil.vertex(buffer, matrix, (float)x3, (float)y3, (float)z3).setColor(red, green, blue, alpha); + VertexConsumerUtil.vertex(buffer, matrix, (float)x4, (float)y4, (float)z4).setColor(red, green, blue, alpha); } // TODO: all version impl - private static void drawLine(VertexConsumer consumer, MatrixStack.Entry entry, double x1, double y1, double z1, double x2, double y2, double z2, float red, float green, float blue, float alpha) { + private static void drawLine(VertexConsumer consumer, PoseStack.Pose entry, double x1, double y1, double z1, double x2, double y2, double z2, float red, float green, float blue, float alpha) { float dx = (float)(x2 - x1); float dy = (float)(y2 - y1); float dz = (float)(z2 - z1); @@ -99,16 +99,16 @@ private static void drawLine(VertexConsumer consumer, MatrixStack.Entry entry, d float ny = len == 0.0f ? 1.0f : dy / len; float nz = len == 0.0f ? 0.0f : dz / len; - VertexConsumerUtil.vertex(consumer, entry.getPositionMatrix(), (float)x1, (float)y1, (float)z1); + VertexConsumerUtil.vertex(consumer, entry.pose(), (float)x1, (float)y1, (float)z1); VertexConsumerUtil.color(consumer, red, green, blue, alpha); VertexConsumerUtil.normal(consumer, nx, ny, nz); - consumer.lineWidth(2.0f); // + consumer.setLineWidth(2.0f); // VertexConsumerUtil.next(consumer); - VertexConsumerUtil.vertex(consumer, entry.getPositionMatrix(), (float)x2, (float)y2, (float)z2); + VertexConsumerUtil.vertex(consumer, entry.pose(), (float)x2, (float)y2, (float)z2); VertexConsumerUtil.color(consumer, red, green, blue, alpha); VertexConsumerUtil.normal(consumer, nx, ny, nz); - consumer.lineWidth(2.0f); // + consumer.setLineWidth(2.0f); // VertexConsumerUtil.next(consumer); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java index 8160f8ba9..fb0b87078 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.util.client.render; -import net.minecraft.client.render.WorldRenderer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; public class WorldRendererUtil { - public static int getLightmapCoordinates(World world, BlockPos pos) { - return WorldRenderer.getLightmapCoordinates(world, pos); + public static int getLightmapCoordinates(Level world, BlockPos pos) { + return LevelRenderer.getLightColor(world, pos); } public static int getLightmapCoordinates(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java index ac619fbdd..df710314b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util.client.v2; -import net.minecraft.client.gui.Element; -import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.components.events.GuiEventListener; +import net.minecraft.client.gui.screens.Screen; public class ScreenUtil extends net.pitan76.mcpitanlib.api.util.client.ScreenUtil { @@ -9,7 +9,7 @@ public static void setFocus(Screen screen, boolean focus) { screen.setFocused(focus); } - public static void setFocus(Screen screen, Element element) { + public static void setFocus(Screen screen, GuiEventListener element) { screen.setFocused(element); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java index 7182eb723..f9f69e04f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.util.client.widget; -import net.minecraft.client.gui.widget.ClickableWidget; +import net.minecraft.client.gui.components.AbstractWidget; import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; public class ClickableWidgetUtil { - public static void render(ClickableWidget widget, RenderArgs args) { + public static void render(AbstractWidget widget, RenderArgs args) { widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java index 78f8ec4af..a669aae21 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java @@ -1,79 +1,79 @@ package net.pitan76.mcpitanlib.api.util.client.widget; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.input.CharInput; -import net.minecraft.client.input.KeyInput; -import net.minecraft.text.Text; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.input.CharacterEvent; +import net.minecraft.client.input.KeyEvent; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; import net.pitan76.mcpitanlib.api.util.TextUtil; public class TextFieldUtil { - public static void setFocused(TextFieldWidget widget, boolean focused) { + public static void setFocused(EditBox widget, boolean focused) { widget.setFocused(focused); } - public static void render(TextFieldWidget widget, RenderArgs args) { + public static void render(EditBox widget, RenderArgs args) { widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } - public static void setEditable(TextFieldWidget widget, boolean editable) { + public static void setEditable(EditBox widget, boolean editable) { widget.setEditable(editable); } - public static void setMaxLength(TextFieldWidget widget, int maxLength) { + public static void setMaxLength(EditBox widget, int maxLength) { widget.setMaxLength(maxLength); } - public static void setSuggestion(TextFieldWidget widget, String suggestion) { + public static void setSuggestion(EditBox widget, String suggestion) { widget.setSuggestion(suggestion); } - public static void setText(TextFieldWidget widget, String text) { - widget.setText(text); + public static void setText(EditBox widget, String text) { + widget.setValue(text); } - public static String getText(TextFieldWidget widget) { - return widget.getText(); + public static String getText(EditBox widget) { + return widget.getValue(); } - public static void setDrawsBackground(TextFieldWidget widget, boolean drawsBackground) { - widget.setDrawsBackground(drawsBackground); + public static void setDrawsBackground(EditBox widget, boolean drawsBackground) { + widget.setBordered(drawsBackground); } - public static void setFocusUnlocked(TextFieldWidget widget, boolean focusUnlocked) { - widget.setFocusUnlocked(focusUnlocked); + public static void setFocusUnlocked(EditBox widget, boolean focusUnlocked) { + widget.setCanLoseFocus(focusUnlocked); } - public static boolean isFocused(TextFieldWidget widget) { + public static boolean isFocused(EditBox widget) { return widget.isFocused(); } - public static boolean keyPressed(TextFieldWidget widget, int keyCode, int scanCode, int modifiers) { - return widget.keyPressed(new KeyInput(keyCode, scanCode, modifiers)); + public static boolean keyPressed(EditBox widget, int keyCode, int scanCode, int modifiers) { + return widget.keyPressed(new KeyEvent(keyCode, scanCode, modifiers)); } - public static boolean keyReleased(TextFieldWidget widget, int keyCode, int scanCode, int modifiers) { - return widget.keyReleased(new KeyInput(keyCode, scanCode, modifiers)); + public static boolean keyReleased(EditBox widget, int keyCode, int scanCode, int modifiers) { + return widget.keyReleased(new KeyEvent(keyCode, scanCode, modifiers)); } - public static boolean charTyped(TextFieldWidget widget, char chr, int modifiers) { - return widget.charTyped(new CharInput(chr, modifiers)); + public static boolean charTyped(EditBox widget, char chr, int modifiers) { + return widget.charTyped(new CharacterEvent(chr, modifiers)); } - public static TextFieldWidget create(TextRenderer renderer, int x, int y, int width, int height, Text text) { - return new TextFieldWidget(renderer, x, y, width, height, text); + public static EditBox create(Font renderer, int x, int y, int width, int height, Component text) { + return new EditBox(renderer, x, y, width, height, text); } - public static TextFieldWidget create(TextRenderer renderer, int width, int height, Text text) { - return new TextFieldWidget(renderer, width, height, text); + public static EditBox create(Font renderer, int width, int height, Component text) { + return new EditBox(renderer, width, height, text); } - public static TextFieldWidget create(TextRenderer renderer, int x, int y, int width, int height) { - return new TextFieldWidget(renderer, x, y, width, height, TextUtil.empty()); + public static EditBox create(Font renderer, int x, int y, int width, int height) { + return new EditBox(renderer, x, y, width, height, TextUtil.empty()); } - public static TextFieldWidget create(TextRenderer renderer, int width, int height) { - return new TextFieldWidget(renderer, width, height, TextUtil.empty()); + public static EditBox create(Font renderer, int width, int height) { + return new EditBox(renderer, width, height, TextUtil.empty()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java index 432caf05f..bb5e38f31 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util.collection; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.util.inventory.ClippedInventory; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import org.jetbrains.annotations.NotNull; @@ -41,13 +41,13 @@ public int size() { } @Override - public Inventory toInventory() { + public Container toInventory() { return ClippedInventory.of(list.toInventory(), start, end); } @Override - public DefaultedList defaultedList() { - DefaultedList clippedList = DefaultedList.ofSize(size(), ItemStackUtil.empty()); + public NonNullList defaultedList() { + NonNullList clippedList = NonNullList.withSize(size(), ItemStackUtil.empty()); for (int i = 0; i < size(); i++) clippedList.set(i, get(i)); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java index 5db1133ae..d032f3939 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.util.collection; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.core.NonNullList; public class DefaultedListUtil { - public static DefaultedList of() { - return DefaultedList.of(); + public static NonNullList of() { + return NonNullList.create(); } - public static DefaultedList ofSize(int size, E defaultElement) { - return DefaultedList.ofSize(size, defaultElement); + public static NonNullList ofSize(int size, E defaultElement) { + return NonNullList.withSize(size, defaultElement); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java index 3bf041152..e049ac557 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util.collection; import com.google.common.collect.Lists; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import org.apache.commons.lang3.Validate; @@ -14,7 +14,7 @@ import java.util.Arrays; import java.util.List; -public class ItemStackList extends DefaultedList { +public class ItemStackList extends NonNullList { public ItemStackList(List delegate, @Nullable ItemStack initialElement) { super(delegate, initialElement); @@ -39,32 +39,32 @@ public static ItemStackList copyOf(ItemStack defaultStack, ItemStack... stacks) return new ItemStackList(Arrays.asList(stacks), defaultStack); } - public static Inventory toInventory(DefaultedList list) { + public static Container toInventory(NonNullList list) { return IInventory.of(list); } - public static DefaultedList toDefaultedList(Inventory inventory) { - DefaultedList list = DefaultedList.ofSize(inventory.size(), ItemStackUtil.empty()); - for (int i = 0; i < inventory.size(); i++) { - list.set(i, inventory.getStack(i)); + public static NonNullList toDefaultedList(Container inventory) { + NonNullList list = NonNullList.withSize(inventory.getContainerSize(), ItemStackUtil.empty()); + for (int i = 0; i < inventory.getContainerSize(); i++) { + list.set(i, inventory.getItem(i)); } return list; } - public static ItemStackList fromInventory(Inventory inventory) { + public static ItemStackList fromInventory(Container inventory) { return new ItemStackList(toDefaultedList(inventory), ItemStackUtil.empty()); } - public Inventory toInventory() { + public Container toInventory() { return toInventory(this); } - public DefaultedList defaultedList() { + public NonNullList defaultedList() { return this; } - public static ItemStackList of(DefaultedList defaultedList) { + public static ItemStackList of(NonNullList defaultedList) { ItemStackList stacks = ItemStackList.ofSize(defaultedList.size()); for (int i = 0; i < defaultedList.size(); i++) { stacks.set(i , defaultedList.get(i)); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java index bb113ce46..947765b0f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.color; -import net.minecraft.block.MapColor; +import net.minecraft.world.level.material.MapColor; public class CompatBrightness { private final MapColor.Brightness brightness; @@ -31,7 +31,7 @@ public int getId() { } public int getBrightness() { - return get().brightness; + return get().modifier; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java index e6e397126..68ce038a5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.color; -import net.minecraft.util.DyeColor; +import net.minecraft.world.item.DyeColor; import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; public class CompatDyeColor implements CompatStringIdentifiable { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java index 08c7084cc..905491fdb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java @@ -1,52 +1,52 @@ package net.pitan76.mcpitanlib.api.util.color; -import net.minecraft.block.MapColor; +import net.minecraft.world.level.material.MapColor; public class CompatMapColor { private final MapColor color; - public static final CompatMapColor CLEAR = of(MapColor.CLEAR); - public static final CompatMapColor PALE_GREEN = of(MapColor.PALE_GREEN); - public static final CompatMapColor PALE_YELLOW = of(MapColor.PALE_YELLOW); - public static final CompatMapColor WHITE_GRAY = of(MapColor.WHITE_GRAY); - public static final CompatMapColor BRIGHT_RED = of(MapColor.BRIGHT_RED); - public static final CompatMapColor PALE_PURPLE = of(MapColor.PALE_PURPLE); - public static final CompatMapColor IRON_GRAY = of(MapColor.IRON_GRAY); - public static final CompatMapColor DARK_GREEN = of(MapColor.DARK_GREEN); - public static final CompatMapColor WHITE = of(MapColor.WHITE); - public static final CompatMapColor LIGHT_BLUE_GRAY = of(MapColor.LIGHT_BLUE_GRAY); - public static final CompatMapColor DIRT_BROWN = of(MapColor.DIRT_BROWN); - public static final CompatMapColor STONE_GRAY = of(MapColor.STONE_GRAY); - public static final CompatMapColor WATER_BLUE = of(MapColor.WATER_BLUE); - public static final CompatMapColor OAK_TAN = of(MapColor.OAK_TAN); - public static final CompatMapColor OFF_WHITE = of(MapColor.OFF_WHITE); - public static final CompatMapColor ORANGE = of(MapColor.ORANGE); - public static final CompatMapColor MAGENTA = of(MapColor.MAGENTA); - public static final CompatMapColor LIGHT_BLUE = of(MapColor.LIGHT_BLUE); - public static final CompatMapColor YELLOW = of(MapColor.YELLOW); - public static final CompatMapColor LIME = of(MapColor.LIME); - public static final CompatMapColor PINK = of(MapColor.PINK); - public static final CompatMapColor GRAY = of(MapColor.GRAY); - public static final CompatMapColor LIGHT_GRAY = of(MapColor.LIGHT_GRAY); - public static final CompatMapColor CYAN = of(MapColor.CYAN); - public static final CompatMapColor PURPLE = of(MapColor.PURPLE); - public static final CompatMapColor BLUE = of(MapColor.BLUE); - public static final CompatMapColor BROWN = of(MapColor.BROWN); - public static final CompatMapColor GREEN = of(MapColor.GREEN); - public static final CompatMapColor RED = of(MapColor.RED); - public static final CompatMapColor BLACK = of(MapColor.BLACK); + public static final CompatMapColor CLEAR = of(MapColor.NONE); + public static final CompatMapColor PALE_GREEN = of(MapColor.GRASS); + public static final CompatMapColor PALE_YELLOW = of(MapColor.SAND); + public static final CompatMapColor WHITE_GRAY = of(MapColor.WOOL); + public static final CompatMapColor BRIGHT_RED = of(MapColor.FIRE); + public static final CompatMapColor PALE_PURPLE = of(MapColor.ICE); + public static final CompatMapColor IRON_GRAY = of(MapColor.METAL); + public static final CompatMapColor DARK_GREEN = of(MapColor.PLANT); + public static final CompatMapColor WHITE = of(MapColor.SNOW); + public static final CompatMapColor LIGHT_BLUE_GRAY = of(MapColor.CLAY); + public static final CompatMapColor DIRT_BROWN = of(MapColor.DIRT); + public static final CompatMapColor STONE_GRAY = of(MapColor.STONE); + public static final CompatMapColor WATER_BLUE = of(MapColor.WATER); + public static final CompatMapColor OAK_TAN = of(MapColor.WOOD); + public static final CompatMapColor OFF_WHITE = of(MapColor.QUARTZ); + public static final CompatMapColor ORANGE = of(MapColor.COLOR_ORANGE); + public static final CompatMapColor MAGENTA = of(MapColor.COLOR_MAGENTA); + public static final CompatMapColor LIGHT_BLUE = of(MapColor.COLOR_LIGHT_BLUE); + public static final CompatMapColor YELLOW = of(MapColor.COLOR_YELLOW); + public static final CompatMapColor LIME = of(MapColor.COLOR_LIGHT_GREEN); + public static final CompatMapColor PINK = of(MapColor.COLOR_PINK); + public static final CompatMapColor GRAY = of(MapColor.COLOR_GRAY); + public static final CompatMapColor LIGHT_GRAY = of(MapColor.COLOR_LIGHT_GRAY); + public static final CompatMapColor CYAN = of(MapColor.COLOR_CYAN); + public static final CompatMapColor PURPLE = of(MapColor.COLOR_PURPLE); + public static final CompatMapColor BLUE = of(MapColor.COLOR_BLUE); + public static final CompatMapColor BROWN = of(MapColor.COLOR_BROWN); + public static final CompatMapColor GREEN = of(MapColor.COLOR_GREEN); + public static final CompatMapColor RED = of(MapColor.COLOR_RED); + public static final CompatMapColor BLACK = of(MapColor.COLOR_BLACK); public static final CompatMapColor GOLD = of(MapColor.GOLD); - public static final CompatMapColor DIAMOND_BLUE = of(MapColor.DIAMOND_BLUE); - public static final CompatMapColor LAPIS_BLUE = of(MapColor.LAPIS_BLUE); - public static final CompatMapColor EMERALD_GREEN = of(MapColor.EMERALD_GREEN); - public static final CompatMapColor SPRUCE_BROWN = of(MapColor.SPRUCE_BROWN); - public static final CompatMapColor DARK_RED = of(MapColor.DARK_RED); + public static final CompatMapColor DIAMOND_BLUE = of(MapColor.DIAMOND); + public static final CompatMapColor LAPIS_BLUE = of(MapColor.LAPIS); + public static final CompatMapColor EMERALD_GREEN = of(MapColor.EMERALD); + public static final CompatMapColor SPRUCE_BROWN = of(MapColor.PODZOL); + public static final CompatMapColor DARK_RED = of(MapColor.NETHER); public static final CompatMapColor TERRACOTTA_WHITE = of(MapColor.TERRACOTTA_WHITE); public static final CompatMapColor TERRACOTTA_ORANGE = of(MapColor.TERRACOTTA_ORANGE); public static final CompatMapColor TERRACOTTA_MAGENTA = of(MapColor.TERRACOTTA_MAGENTA); public static final CompatMapColor TERRACOTTA_LIGHT_BLUE = of(MapColor.TERRACOTTA_LIGHT_BLUE); public static final CompatMapColor TERRACOTTA_YELLOW = of(MapColor.TERRACOTTA_YELLOW); - public static final CompatMapColor TERRACOTTA_LIME = of(MapColor.TERRACOTTA_LIME); + public static final CompatMapColor TERRACOTTA_LIME = of(MapColor.TERRACOTTA_LIGHT_GREEN); public static final CompatMapColor TERRACOTTA_PINK = of(MapColor.TERRACOTTA_PINK); public static final CompatMapColor TERRACOTTA_GRAY = of(MapColor.TERRACOTTA_GRAY); public static final CompatMapColor TERRACOTTA_LIGHT_GRAY = of(MapColor.TERRACOTTA_LIGHT_GRAY); @@ -57,16 +57,16 @@ public class CompatMapColor { public static final CompatMapColor TERRACOTTA_GREEN = of(MapColor.TERRACOTTA_GREEN); public static final CompatMapColor TERRACOTTA_RED = of(MapColor.TERRACOTTA_RED); public static final CompatMapColor TERRACOTTA_BLACK = of(MapColor.TERRACOTTA_BLACK); - public static final CompatMapColor DULL_RED = of(MapColor.DULL_RED); - public static final CompatMapColor DULL_PINK = of(MapColor.DULL_PINK); - public static final CompatMapColor DARK_CRIMSON = of(MapColor.DARK_CRIMSON); - public static final CompatMapColor TEAL = of(MapColor.TEAL); - public static final CompatMapColor DARK_AQUA = of(MapColor.DARK_AQUA); - public static final CompatMapColor DARK_DULL_PINK = of(MapColor.DARK_DULL_PINK); - public static final CompatMapColor BRIGHT_TEAL = of(MapColor.BRIGHT_TEAL); - public static final CompatMapColor DEEPSLATE_GRAY = of(MapColor.DEEPSLATE_GRAY); - public static final CompatMapColor RAW_IRON_PINK = of(MapColor.RAW_IRON_PINK); - public static final CompatMapColor LICHEN_GREEN = of(MapColor.LICHEN_GREEN); + public static final CompatMapColor DULL_RED = of(MapColor.CRIMSON_NYLIUM); + public static final CompatMapColor DULL_PINK = of(MapColor.CRIMSON_STEM); + public static final CompatMapColor DARK_CRIMSON = of(MapColor.CRIMSON_HYPHAE); + public static final CompatMapColor TEAL = of(MapColor.WARPED_NYLIUM); + public static final CompatMapColor DARK_AQUA = of(MapColor.WARPED_STEM); + public static final CompatMapColor DARK_DULL_PINK = of(MapColor.WARPED_HYPHAE); + public static final CompatMapColor BRIGHT_TEAL = of(MapColor.WARPED_WART_BLOCK); + public static final CompatMapColor DEEPSLATE_GRAY = of(MapColor.DEEPSLATE); + public static final CompatMapColor RAW_IRON_PINK = of(MapColor.RAW_IRON); + public static final CompatMapColor LICHEN_GREEN = of(MapColor.GLOW_LICHEN); public CompatMapColor(MapColor color) { this.color = color; @@ -85,10 +85,10 @@ public int getId() { } public int getRgb() { - return color.color; + return color.col; } public int getRenderColor(CompatBrightness brightness) { - return color.getRenderColor(brightness.get()); + return color.calculateARGBColor(brightness.get()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java index 2fb569972..740e0d0c0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util.debug; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.Container; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.util.ItemUtil; import net.pitan76.mcpitanlib.api.util.PlatformUtil; @@ -20,7 +20,7 @@ public static void print(ItemStack stack) { System.out.println(getString(stack)); } - public static void print(Inventory inventory) { + public static void print(Container inventory) { if (!dev) return; System.out.println(getString(inventory)); } @@ -29,7 +29,7 @@ public static String getString(Item item) { StringBuilder sb = new StringBuilder(); sb.append("Item: {").append("\n"); - sb.append(" Name: ").append(item.getTranslationKey()).append("\n"); + sb.append(" Name: ").append(item.getDescriptionId()).append("\n"); sb.append(" Id: ").append(ItemUtil.toCompatID(item)).append("\n"); sb.append("}\n"); @@ -49,12 +49,12 @@ public static String getString(ItemStack stack) { return sb.toString(); } - public static String getString(Inventory inventory) { + public static String getString(Container inventory) { StringBuilder sb = new StringBuilder(); sb.append("Inventory: {").append("\n"); - for (int i = 0; i < inventory.size(); i++) { - ItemStack stack = inventory.getStack(i); + for (int i = 0; i < inventory.getContainerSize(); i++) { + ItemStack stack = inventory.getItem(i); if (stack.isEmpty()) continue; sb.append(" Slot ").append(i).append(": {").append("\n"); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java index e12d3910f..bfd6780e1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.projectile.ArrowEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.world.World; +import net.minecraft.world.entity.projectile.arrow.Arrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import org.jetbrains.annotations.Nullable; public class ArrowEntityUtil { - public static ArrowEntity create(World world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { - return new ArrowEntity(world, x, y, z, stack, shotFrom); + public static Arrow create(Level world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { + return new Arrow(world, x, y, z, stack, shotFrom); } - public static ArrowEntity create(World world, double x, double y, double z, ItemStack stack) { + public static Arrow create(Level world, double x, double y, double z, ItemStack stack) { return create(world, x, y, z, stack, null); } - public static ArrowEntity create(World world, double x, double y, double z) { + public static Arrow create(Level world, double x, double y, double z) { return create(world, x, y, z, ItemStackUtil.getDefaultStack(Items.ARROW)); } - public static void setVelocity(ArrowEntity arrow, double x, double y, double z, float velocity, float divergence) { - arrow.setVelocity(x, y, z, velocity, divergence); + public static void setVelocity(Arrow arrow, double x, double y, double z, float velocity, float divergence) { + arrow.shoot(x, y, z, velocity, divergence); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java index 5686c1bee..99898aefd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.ItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; import net.pitan76.mcpitanlib.midohra.util.math.Vector3i; @@ -14,49 +14,49 @@ import java.util.List; public class ItemEntityUtil { - public static ItemEntity create(World world, double x, double y, double z, ItemStack stack) { + public static ItemEntity create(Level world, double x, double y, double z, ItemStack stack) { return new ItemEntity(world, x, y, z, stack); } - public static ItemEntity create(World world, BlockPos pos, ItemStack stack) { + public static ItemEntity create(Level world, BlockPos pos, ItemStack stack) { return create(world, pos.getX(), pos.getY(), pos.getZ(), stack); } - public static ItemEntity create(World world, Vec3d pos, ItemStack stack) { + public static ItemEntity create(Level world, Vec3 pos, ItemStack stack) { return create(world, pos.x, pos.y, pos.z, stack); } - public static ItemEntity create(World world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) { + public static ItemEntity create(Level world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) { ItemEntity itemEntity = create(world, x, y, z, stack); setVelocity(itemEntity, velocityX, velocityY, velocityZ); return itemEntity; } public static void setVelocity(ItemEntity itemEntity, double velocityX, double velocityY, double velocityZ) { - itemEntity.setVelocity(velocityX, velocityY, velocityZ); + itemEntity.setDeltaMovement(velocityX, velocityY, velocityZ); } - public static void setVelocity(ItemEntity itemEntity, Vec3d vec3d) { - itemEntity.setVelocity(vec3d); + public static void setVelocity(ItemEntity itemEntity, Vec3 vec3d) { + itemEntity.setDeltaMovement(vec3d); } public static void setPickupDelay(ItemEntity itemEntity, int pickupDelay) { - itemEntity.setPickupDelay(pickupDelay); + itemEntity.setPickUpDelay(pickupDelay); } public static void setToDefaultPickupDelay(ItemEntity itemEntity) { - itemEntity.setToDefaultPickupDelay(); + itemEntity.setDefaultPickUpDelay(); } public static ItemStack getStack(ItemEntity entity) { - return entity.getStack(); + return entity.getItem(); } - public static List getEntities(World world, Box box) { + public static List getEntities(Level world, AABB box) { return WorldUtil.getEntitiesByType(world, EntityType.ITEM, box); } - public static ItemEntity createWithSpawn(World world, ItemStack stack, double x, double y, double z) { + public static ItemEntity createWithSpawn(Level world, ItemStack stack, double x, double y, double z) { ItemEntity itemEntity = create(world, x, y, z, stack); setToDefaultPickupDelay(itemEntity); setVelocity(itemEntity, 0.0D, 0.0D, 0.0D); @@ -64,15 +64,15 @@ public static ItemEntity createWithSpawn(World world, ItemStack stack, double x, return itemEntity; } - public static ItemEntity createWithSpawn(World world, ItemStack stack, BlockPos pos) { + public static ItemEntity createWithSpawn(Level world, ItemStack stack, BlockPos pos) { return createWithSpawn(world, stack, pos.getX(), pos.getY(), pos.getZ()); } - public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3d pos) { + public static ItemEntity createWithSpawn(Level world, ItemStack stack, Vector3d pos) { return createWithSpawn(world, stack, pos.x, pos.y, pos.z); } - public static ItemEntity createWithSpawn(World world, ItemStack stack, Vector3i pos) { + public static ItemEntity createWithSpawn(Level world, ItemStack stack, Vector3i pos) { return createWithSpawn(world, stack, pos.toCenter()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java index 9e74fc58f..267fbdea0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; import net.pitan76.mcpitanlib.api.util.EntityUtil; @@ -14,21 +14,21 @@ public class LivingEntityUtil extends EntityUtil { public static void addStatusEffect(LivingEntity entity, CompatStatusEffectInstance effect) { - entity.addStatusEffect(effect.getInstance()); + entity.addEffect(effect.getInstance()); } public static void removeStatusEffect(LivingEntity entity, CompatStatusEffectInstance effect) { - entity.removeStatusEffect(effect.getInstance().getEffectType()); + entity.removeEffect(effect.getInstance().getEffect()); } - public static void removeStatusEffect(LivingEntity entity, CompatStatusEffect effect, World world) { - entity.removeStatusEffect(effect.getEntry(world)); + public static void removeStatusEffect(LivingEntity entity, CompatStatusEffect effect, Level world) { + entity.removeEffect(effect.getEntry(world)); } public static List getStatusEffects(LivingEntity entity) { List compatEffects = new ArrayList<>(); - for (StatusEffectInstance effect : entity.getStatusEffects()) { + for (MobEffectInstance effect : entity.getActiveEffects()) { compatEffects.add(new CompatStatusEffectInstance(effect)); } @@ -48,10 +48,10 @@ public static float getMaxHealth(LivingEntity entity) { } public static ItemStack getEquippedStack(LivingEntity entity, EquipmentSlot slot) { - return entity.getEquippedStack(slot); + return entity.getItemBySlot(slot); } public static void setEquippedStack(LivingEntity entity, EquipmentSlot slot, ItemStack stack) { - entity.equipStack(slot, stack); + entity.setItemSlot(slot, stack); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java index 806215177..f99f5c6a8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.projectile.ProjectileEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.projectile.Projectile; public class ProjectileEntityUtil { - public static void setVelocity(ProjectileEntity projectileEntity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { - projectileEntity.setVelocity(shooter, pitch, yaw, roll, speed, divergence); + public static void setVelocity(Projectile projectileEntity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { + projectileEntity.shootFromRotation(shooter, pitch, yaw, roll, speed, divergence); } - public static void setVelocity(ProjectileEntity projectileEntity, double x, double y, double z, float power, float uncertainty) { - projectileEntity.setVelocity(x, y, z, power, uncertainty); + public static void setVelocity(Projectile projectileEntity, double x, double y, double z, float power, float uncertainty) { + projectileEntity.shoot(x, y, z, power, uncertainty); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java index 1f4a155dc..11688df99 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.ServerLevel; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; @@ -10,31 +10,31 @@ import java.util.Optional; public class ServerPlayerUtil { - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - return serverPlayerEntity.teleport(serverWorld, x, y, z, Collections.emptySet(), yaw, pitch, resetCamera); + public static boolean teleport(ServerPlayer serverPlayerEntity, ServerLevel serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + return serverPlayerEntity.teleportTo(serverWorld, x, y, z, Collections.emptySet(), yaw, pitch, resetCamera); } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { + public static boolean teleport(ServerPlayer serverPlayerEntity, ServerLevel serverWorld, double x, double y, double z, float yaw, float pitch) { return teleport(serverPlayerEntity, serverWorld, x, y, z, yaw, pitch, true); } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, ServerWorld serverWorld, double x, double y, double z) { - return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYaw(), serverPlayerEntity.getPitch()); + public static boolean teleport(ServerPlayer serverPlayerEntity, ServerLevel serverWorld, double x, double y, double z) { + return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYRot(), serverPlayerEntity.getXRot()); } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { + public static boolean teleport(ServerPlayer serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { return teleport(serverPlayerEntity, serverWorld.getRaw(), x, y, z, yaw, pitch, resetCamera); } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { + public static boolean teleport(ServerPlayer serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch) { return teleport(serverPlayerEntity, serverWorld, x, y, z, yaw, pitch, false); } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z) { - return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYaw(), serverPlayerEntity.getPitch()); + public static boolean teleport(ServerPlayer serverPlayerEntity, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z) { + return teleport(serverPlayerEntity, serverWorld, x, y, z, serverPlayerEntity.getYRot(), serverPlayerEntity.getXRot()); } public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.world.ServerWorld serverWorld, double x, double y, double z, float yaw, float pitch, boolean resetCamera) { - Optional optionalServerPlayer = player.getServerPlayer(); + Optional optionalServerPlayer = player.getServerPlayer(); if (!optionalServerPlayer.isPresent()) return false; return teleport(optionalServerPlayer.get(), serverWorld, x, y, z, yaw, pitch, resetCamera); @@ -48,16 +48,16 @@ public static boolean teleport(Player player, net.pitan76.mcpitanlib.midohra.wor return teleport(player, serverWorld, x, y, z, player.getYaw(), player.getPitch()); } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, double x, double y, double z, boolean particleEffects) { - return serverPlayerEntity.teleport(x, y, z, particleEffects); + public static boolean teleport(ServerPlayer serverPlayerEntity, double x, double y, double z, boolean particleEffects) { + return serverPlayerEntity.randomTeleport(x, y, z, particleEffects); } - public static boolean teleport(ServerPlayerEntity serverPlayerEntity, double x, double y, double z) { + public static boolean teleport(ServerPlayer serverPlayerEntity, double x, double y, double z) { return teleport(serverPlayerEntity, x, y, z, false); } public static boolean teleport(Player player, double x, double y, double z, boolean particleEffects) { - Optional optionalServerPlayer = player.getServerPlayer(); + Optional optionalServerPlayer = player.getServerPlayer(); if (!optionalServerPlayer.isPresent()) return false; return teleport(optionalServerPlayer.get(), x, y, z, particleEffects); @@ -67,34 +67,34 @@ public static boolean teleport(Player player, double x, double y, double z) { return teleport(player, x, y, z, false); } - public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { + public static void playSound(ServerPlayer serverPlayerEntity, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { playSound(serverPlayerEntity, soundEvent, volume, pitch); } - public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent, float volume, float pitch) { + public static void playSound(ServerPlayer serverPlayerEntity, CompatSoundEvent soundEvent, float volume, float pitch) { serverPlayerEntity.playSound(soundEvent.get(), volume, pitch); } - public static void playSound(ServerPlayerEntity serverPlayerEntity, CompatSoundEvent soundEvent) { - serverPlayerEntity.playSound(soundEvent.get()); + public static void playSound(ServerPlayer serverPlayerEntity, CompatSoundEvent soundEvent) { + serverPlayerEntity.makeSound(soundEvent.get()); } public static void playSound(Player player, CompatSoundEvent soundEvent, CompatSoundCategory category, float volume, float pitch) { - Optional optionalServerPlayer = player.getServerPlayer(); + Optional optionalServerPlayer = player.getServerPlayer(); if (!optionalServerPlayer.isPresent()) return; playSound(optionalServerPlayer.get(), soundEvent, category, volume, pitch); } public static void playSound(Player player, CompatSoundEvent soundEvent, float volume, float pitch) { - Optional optionalServerPlayer = player.getServerPlayer(); + Optional optionalServerPlayer = player.getServerPlayer(); if (!optionalServerPlayer.isPresent()) return; playSound(optionalServerPlayer.get(), soundEvent, volume, pitch); } public static void playSound(Player player, CompatSoundEvent soundEvent) { - Optional optionalServerPlayer = player.getServerPlayer(); + Optional optionalServerPlayer = player.getServerPlayer(); if (!optionalServerPlayer.isPresent()) return; playSound(optionalServerPlayer.get(), soundEvent); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java index 38f484a37..478f38f0e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java @@ -1,29 +1,29 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.projectile.SmallFireballEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.world.entity.projectile.hurtingprojectile.SmallFireball; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.math.Vec3dUtil; public class SmallFireballEntityUtil { - public static SmallFireballEntity create(World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { - return new SmallFireballEntity(world, x, y, z, Vec3dUtil.create(velocityX, velocityY, velocityZ)); + public static SmallFireball create(Level world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + return new SmallFireball(world, x, y, z, Vec3dUtil.create(velocityX, velocityY, velocityZ)); } - public static SmallFireballEntity create(World world, double x, double y, double z, Vec3d velocity) { - return new SmallFireballEntity(world, x, y, z, velocity); + public static SmallFireball create(Level world, double x, double y, double z, Vec3 velocity) { + return new SmallFireball(world, x, y, z, velocity); } - public static void setVelocity(SmallFireballEntity entity, double x, double y, double z, float velocity, float divergence) { - entity.setVelocity(x, y, z, velocity, divergence); + public static void setVelocity(SmallFireball entity, double x, double y, double z, float velocity, float divergence) { + entity.shoot(x, y, z, velocity, divergence); } - public static void setItem(SmallFireballEntity entity, ItemStack stack) { + public static void setItem(SmallFireball entity, ItemStack stack) { entity.setItem(stack); } - public static ItemStack getItem(SmallFireballEntity entity) { - return entity.getStack(); + public static ItemStack getItem(SmallFireball entity) { + return entity.getItem(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java index 9d5fd3085..4330719e1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.projectile.thrown.SnowballEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.entity.projectile.throwableitemprojectile.Snowball; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; public class SnowballEntityUtil { - public static SnowballEntity create(World world, double x, double y, double z) { - return new SnowballEntity(world, x, y, z, ItemStackUtil.empty()); + public static Snowball create(Level world, double x, double y, double z) { + return new Snowball(world, x, y, z, ItemStackUtil.empty()); } - public static SnowballEntity create(World world, double x, double y, double z, ItemStack stack) { - return new SnowballEntity(world, x, y, z, stack); + public static Snowball create(Level world, double x, double y, double z, ItemStack stack) { + return new Snowball(world, x, y, z, stack); } - public static void setVelocity(SnowballEntity entity, double x, double y, double z, float velocity, float divergence) { - entity.setVelocity(x, y, z, velocity, divergence); + public static void setVelocity(Snowball entity, double x, double y, double z, float velocity, float divergence) { + entity.shoot(x, y, z, velocity, divergence); } - public static void setItem(SnowballEntity entity, ItemStack stack) { + public static void setItem(Snowball entity, ItemStack stack) { entity.setItem(stack); } - public static ItemStack getItem(SnowballEntity entity) { - return entity.getStack(); + public static ItemStack getItem(Snowball entity) { + return entity.getItem(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java index 2f83e9548..c4f48e089 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.projectile.SpectralArrowEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.world.World; +import net.minecraft.world.entity.projectile.arrow.SpectralArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import org.jetbrains.annotations.Nullable; public class SpectralArrowEntityUtil { - public static SpectralArrowEntity create(World world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { - return new SpectralArrowEntity(world, x, y, z, stack, shotFrom); + public static SpectralArrow create(Level world, double x, double y, double z, ItemStack stack, @Nullable ItemStack shotFrom) { + return new SpectralArrow(world, x, y, z, stack, shotFrom); } - public static SpectralArrowEntity create(World world, double x, double y, double z, ItemStack stack) { + public static SpectralArrow create(Level world, double x, double y, double z, ItemStack stack) { return create(world, x, y, z, stack, null); } - public static SpectralArrowEntity create(World world, double x, double y, double z) { + public static SpectralArrow create(Level world, double x, double y, double z) { return create(world, x, y, z, ItemStackUtil.getDefaultStack(Items.ARROW)); } - public static void setVelocity(SpectralArrowEntity arrow, double x, double y, double z, float velocity, float divergence) { - arrow.setVelocity(x, y, z, velocity, divergence); + public static void setVelocity(SpectralArrow arrow, double x, double y, double z, float velocity, float divergence) { + arrow.shoot(x, y, z, velocity, divergence); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java index 73dfb6cc4..26f35b016 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.projectile.thrown.ThrownItemEntity; -import net.minecraft.item.ItemStack; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.projectile.throwableitemprojectile.ThrowableItemProjectile; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.entity.CompatThrownItemEntity; public class ThrownItemEntityUtil { - public static ItemStack getItem(ThrownItemEntity entity) { - return entity.getStack(); + public static ItemStack getItem(ThrowableItemProjectile entity) { + return entity.getItem(); } - public static void setItem(ThrownItemEntity entity, ItemStack stack) { + public static void setItem(ThrowableItemProjectile entity, ItemStack stack) { entity.setItem(stack); } - public static ItemStack getStack(ThrownItemEntity entity) { - return entity.getStack(); + public static ItemStack getStack(ThrowableItemProjectile entity) { + return entity.getItem(); } - public static void setVelocity(ThrownItemEntity entity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { + public static void setVelocity(ThrowableItemProjectile entity, Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) { ProjectileEntityUtil.setVelocity(entity, shooter, pitch, yaw, roll, speed, divergence); } @@ -26,7 +26,7 @@ public static void setVelocity(CompatThrownItemEntity entity, Entity shooter, fl ProjectileEntityUtil.setVelocity(entity, shooter, pitch, yaw, roll, speed, divergence); } - public static void setVelocity(ThrownItemEntity entity, double x, double y, double z, float power, float uncertainty) { + public static void setVelocity(ThrowableItemProjectile entity, double x, double y, double z, float power, float uncertainty) { ProjectileEntityUtil.setVelocity(entity, x, y, z, power, uncertainty); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java b/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java index f721d32a5..001d34b99 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.event; -import net.minecraft.block.Block; +import net.minecraft.world.level.block.Block; import net.pitan76.mcpitanlib.api.event.block.BlockBreakEvent; import net.pitan76.mcpitanlib.api.event.block.BlockPlacedEvent; import net.pitan76.mcpitanlib.api.event.block.ItemScattererUtil; @@ -8,11 +8,11 @@ public class BlockEventGenerator { public static void onPlaced(Block block, BlockPlacedEvent e) { - block.onPlaced(e.world, e.pos, e.state, e.placer, e.stack); + block.setPlacedBy(e.world, e.pos, e.state, e.placer, e.stack); } public static void onBreak(Block block, BlockBreakEvent e) { - block.onBreak(e.world, e.pos, e.state, e.getPlayerEntity()); + block.playerWillDestroy(e.world, e.pos, e.state, e.getPlayerEntity()); } public static void onStateReplaced(Block block, StateReplacedEvent e) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java b/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java index 8983bd5d4..81f428665 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.event; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.event.item.ItemUseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java index 49bcbc196..0a309ddb1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java @@ -1,46 +1,46 @@ package net.pitan76.mcpitanlib.api.util.inventory; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -public class ClippedInventory implements Inventory, ICompatInventory { +public class ClippedInventory implements Container, ICompatInventory { - private final Inventory inventory; + private final Container inventory; private final int start; private final int end; - public static ClippedInventory of(Inventory inventory, int start, int end) { - if (start < 0 || end > inventory.size() || start >= end) { + public static ClippedInventory of(Container inventory, int start, int end) { + if (start < 0 || end > inventory.getContainerSize() || start >= end) { throw new IllegalArgumentException("Invalid start or end indices for clipping inventory."); } return new ClippedInventory(inventory, start, end); } - public static ClippedInventory of(Inventory inventory) { - return of(inventory, 0, inventory.size()); + public static ClippedInventory of(Container inventory) { + return of(inventory, 0, inventory.getContainerSize()); } - public static ClippedInventory of(Inventory inventory, int start) { - return of(inventory, start, inventory.size()); + public static ClippedInventory of(Container inventory, int start) { + return of(inventory, start, inventory.getContainerSize()); } - public ClippedInventory(Inventory inventory, int start, int end) { + public ClippedInventory(Container inventory, int start, int end) { this.inventory = inventory; this.start = start; this.end = end; } @Override - public int size() { + public int getContainerSize() { return end - start; } @Override public boolean isEmpty() { for (int i = start; i < end; i++) { - if (!inventory.getStack(i).isEmpty()) { + if (!inventory.getItem(i).isEmpty()) { return false; } } @@ -48,44 +48,44 @@ public boolean isEmpty() { } @Override - public ItemStack getStack(int slot) { - return inventory.getStack(start + slot); + public ItemStack getItem(int slot) { + return inventory.getItem(start + slot); } @Override - public ItemStack removeStack(int slot, int amount) { - return inventory.removeStack(start + slot, amount); + public ItemStack removeItem(int slot, int amount) { + return inventory.removeItem(start + slot, amount); } @Override - public ItemStack removeStack(int slot) { - return inventory.removeStack(start + slot); + public ItemStack removeItemNoUpdate(int slot) { + return inventory.removeItemNoUpdate(start + slot); } @Override - public void setStack(int slot, ItemStack stack) { - inventory.setStack(start + slot, stack); + public void setItem(int slot, ItemStack stack) { + inventory.setItem(start + slot, stack); } @Override - public void markDirty() { - inventory.markDirty(); + public void setChanged() { + inventory.setChanged(); } @Override - public boolean canPlayerUse(PlayerEntity player) { - return inventory.canPlayerUse(player); + public boolean stillValid(Player player) { + return inventory.stillValid(player); } @Override - public void clear() { + public void clearContent() { for (int i = start; i < end; i++) { - inventory.setStack(i, ItemStackUtil.empty()); + inventory.setItem(i, ItemStackUtil.empty()); } } @Override - public int getMaxCountPerStack() { - return inventory.getMaxCountPerStack(); + public int getMaxStackSize() { + return inventory.getMaxStackSize(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java index 6fc2623d0..fd25ba9b9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.util.inventory; -import net.minecraft.entity.ContainerUser; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.entity.ContainerUser; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.entity.CompatContainerUser; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; @@ -17,54 +17,54 @@ import java.util.List; -public class CompatInventory extends SimpleInventory { +public class CompatInventory extends SimpleContainer { public CompatInventory(int size) { super(size); } @Override - public void setStack(int slot, ItemStack stack) { - super.setStack(slot, stack); + public void setItem(int slot, ItemStack stack) { + super.setItem(slot, stack); } /** * super method of setStack(slot, stack) */ public final void superSetStack(int slot, ItemStack stack) { - super.setStack(slot, stack); + super.setItem(slot, stack); } /** * super method of removeStack(slot, amount) */ public final ItemStack superRemoveStack(int slot, int amount) { - return super.removeStack(slot, amount); + return super.removeItem(slot, amount); } @Override - public ItemStack removeStack(int slot, int amount) { + public ItemStack removeItem(int slot, int amount) { return callRemoveStack(slot, amount); } public ItemStack callRemoveStack(int slot, int amount) { - return super.removeStack(slot, amount); + return super.removeItem(slot, amount); } @Override - public ItemStack removeStack(int slot) { - return super.removeStack(slot); + public ItemStack removeItemNoUpdate(int slot) { + return super.removeItemNoUpdate(slot); } @Override - public ItemStack removeItem(Item item, int count) { - return super.removeItem(item, count); + public ItemStack removeItemType(Item item, int count) { + return super.removeItemType(item, count); } @Deprecated @Override - public void onOpen(ContainerUser user) { - if (user instanceof PlayerEntity) { - onOpen(new Player((PlayerEntity) user)); + public void startOpen(ContainerUser user) { + if (user instanceof Player) { + onOpen(new Player((Player) user)); return; } @@ -74,9 +74,9 @@ public void onOpen(ContainerUser user) { @Deprecated @Override - public void onClose(ContainerUser user) { - if (user instanceof PlayerEntity) { - onClose(new Player((PlayerEntity) user)); + public void stopOpen(ContainerUser user) { + if (user instanceof Player) { + onClose(new Player((Player) user)); return; } @@ -95,13 +95,13 @@ public void onClose(ContainerUser user) { @Deprecated @Override - public boolean canPlayerUse(PlayerEntity player) { + public boolean stillValid(Player player) { return canPlayerUse(new Player(player)); } @Deprecated @Override - public boolean canInsert(ItemStack stack) { + public boolean canAddItem(ItemStack stack) { return canInsert(new CanInsertArgs(stack)); } @@ -114,11 +114,11 @@ public void onClose(Player player) { } public void onOpen(CompatContainerUser user) { - super.onOpen(user.getRaw()); + super.startOpen(user.getRaw()); } public void onClose(CompatContainerUser user) { - super.onClose(user.getRaw()); + super.stopOpen(user.getRaw()); } public NbtList toNbtList(CompatRegistryLookup registries) { @@ -140,27 +140,27 @@ public boolean canPlayerUse(Player player) { } public boolean canInsert(CanInsertArgs args) { - return super.canInsert(args.getMcStack()); + return super.canAddItem(args.getMcStack()); } @Deprecated @Override - public List clearToList() { + public List removeAllItems() { return callClearToList(); } public List callClearToList() { - return super.clearToList(); + return super.removeAllItems(); } @Deprecated @Override - public DefaultedList getHeldStacks() { + public NonNullList getItems() { return callGetHeldStacks(); } - public DefaultedList callGetHeldStacks() { - return super.getHeldStacks(); + public NonNullList callGetHeldStacks() { + return super.getItems(); } public ItemStackList callGetHeldStacksAsItemStackList() { @@ -169,22 +169,22 @@ public ItemStackList callGetHeldStacksAsItemStackList() { @Deprecated @Override - public ItemStack getStack(int slot) { + public ItemStack getItem(int slot) { return callGetStack(slot); } public ItemStack callGetStack(int slot) { - return super.getStack(slot); + return super.getItem(slot); } @Deprecated @Override - public int size() { + public int getContainerSize() { return getSize(); } public int getSize() { - return super.size(); + return super.getContainerSize(); } @Deprecated @@ -199,31 +199,31 @@ public boolean callIsEmpty() { @Deprecated @Override - public boolean canTransferTo(Inventory hopperInventory, int slot, ItemStack stack) { + public boolean canTakeItem(Container hopperInventory, int slot, ItemStack stack) { return callCanTransferTo(hopperInventory, slot, stack); } - public boolean callCanTransferTo(Inventory hopperInventory, int slot, ItemStack stack) { - return super.canTransferTo(hopperInventory, slot, stack); + public boolean callCanTransferTo(Container hopperInventory, int slot, ItemStack stack) { + return super.canTakeItem(hopperInventory, slot, stack); } @Deprecated @Override - public ItemStack addStack(ItemStack stack) { + public ItemStack addItem(ItemStack stack) { return callAddStack(stack); } public ItemStack callAddStack(ItemStack stack) { - return super.addStack(stack); + return super.addItem(stack); } @Deprecated @Override - public int getMaxCountPerStack() { + public int getMaxStackSize() { return callGetMaxCountPerStack(); } public int callGetMaxCountPerStack() { - return super.getMaxCountPerStack(); + return super.getMaxStackSize(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java index 9f9ab0730..a46122524 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.api.util.inventory; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.entity.Player; public class CompatPlayerInventory { - public PlayerInventory inv; + public Inventory inv; - public CompatPlayerInventory(PlayerInventory inv) { + public CompatPlayerInventory(Inventory inv) { this.inv = inv; } @@ -28,14 +28,14 @@ public void dropAllItems() { } public void offerOrDrop(ItemStack stack) { - inv.offerOrDrop(stack); + inv.placeItemBackInInventory(stack); } public void offerOrDrop(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { offerOrDrop(stack.toMinecraft()); } - public PlayerInventory getRaw() { + public Inventory getRaw() { return inv; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java index b4be9a037..0dde151dc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util.inventory; -import net.minecraft.screen.ScreenHandler; +import net.minecraft.world.inventory.AbstractContainerMenu; -public class ContainerInventory extends CompatInventory { +public class ContainerInventory extends CompatInventory { public final T screenHandler; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java index b33afd6be..7ada44471 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.util.inventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.entity.Player; -public interface ICompatInventory extends Inventory { +public interface ICompatInventory extends Container { default void callSetStack(int slot, ItemStack stack) { - setStack(slot, stack); + setItem(slot, stack); } default ItemStack callGetStack(int slot) { - return getStack(slot); + return getItem(slot); } default int callSize() { - return size(); + return getContainerSize(); } default boolean callIsEmpty() { @@ -22,39 +22,39 @@ default boolean callIsEmpty() { } default ItemStack callRemoveStack(int slot, int amount) { - return removeStack(slot, amount); + return removeItem(slot, amount); } default ItemStack callRemoveStack(int slot) { - return removeStack(slot); + return removeItemNoUpdate(slot); } default void callClear() { - clear(); + clearContent(); } default void callMarkDirty() { - markDirty(); + setChanged(); } - default boolean callCanPlayerUse(net.minecraft.entity.player.PlayerEntity player) { - return canPlayerUse(player); + default boolean callCanPlayerUse(net.minecraft.world.entity.player.Player player) { + return stillValid(player); } default boolean canPlayerUse(Player player) { - return canPlayerUse(player.getEntity()); + return stillValid(player.getEntity()); } default void callSetStack(int slot, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { - setStack(slot, stack.toMinecraft()); + setItem(slot, stack.toMinecraft()); } default net.pitan76.mcpitanlib.midohra.item.ItemStack callGetStackAsMidohra(int slot) { - return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(slot)); + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getItem(slot)); } default int callGetMaxCountPerStack() { - return getMaxCountPerStack(); + return getMaxStackSize(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java index e3a4b61df..0e739ff14 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java @@ -1,47 +1,47 @@ package net.pitan76.mcpitanlib.api.util.inventory; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.entity.Player; public class PlayerInventoryUtil { - public static Player getPlayer(PlayerInventory playerInventory) { + public static Player getPlayer(Inventory playerInventory) { return new Player(playerInventory.player); } - public static int getSelectedSlot(PlayerInventory playerInventory) { + public static int getSelectedSlot(Inventory playerInventory) { return playerInventory.getSelectedSlot(); } - public static void setSelectedSlot(PlayerInventory playerInventory, int slot) { + public static void setSelectedSlot(Inventory playerInventory, int slot) { playerInventory.setSelectedSlot(slot); } - public static void dropAllItems(PlayerInventory inv) { + public static void dropAllItems(Inventory inv) { inv.dropAll(); } - public static DefaultedList getMain(PlayerInventory inv) { - return inv.getMainStacks(); + public static NonNullList getMain(Inventory inv) { + return inv.getNonEquipmentItems(); } - public static DefaultedList getArmor(PlayerInventory inv) { - DefaultedList stacks = DefaultedList.ofSize(4, ItemStack.EMPTY); - stacks.set(0, inv.getStack(36)); - stacks.set(1, inv.getStack(37)); - stacks.set(2, inv.getStack(38)); - stacks.set(3, inv.getStack(39)); + public static NonNullList getArmor(Inventory inv) { + NonNullList stacks = NonNullList.withSize(4, ItemStack.EMPTY); + stacks.set(0, inv.getItem(36)); + stacks.set(1, inv.getItem(37)); + stacks.set(2, inv.getItem(38)); + stacks.set(3, inv.getItem(39)); return stacks; } - public static DefaultedList getOffHand(PlayerInventory inv) { - DefaultedList stacks = DefaultedList.ofSize(1, ItemStack.EMPTY); - stacks.set(0, inv.getStack(PlayerInventory.OFF_HAND_SLOT)); + public static NonNullList getOffHand(Inventory inv) { + NonNullList stacks = NonNullList.withSize(1, ItemStack.EMPTY); + stacks.set(0, inv.getItem(Inventory.SLOT_OFFHAND)); return stacks; } - public static ItemStack getMainHandStack(PlayerInventory inv) { - return inv.player.getMainHandStack(); + public static ItemStack getMainHandStack(Inventory inv) { + return inv.player.getMainHandItem(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java index aeb15f5e9..b6271d19a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java @@ -9,7 +9,7 @@ public CanInsertArgs(ItemStack stack) { this.stack = stack; } - public CanInsertArgs(net.minecraft.item.ItemStack stack) { + public CanInsertArgs(net.minecraft.world.item.ItemStack stack) { this(ItemStack.of(stack)); } @@ -17,7 +17,7 @@ public ItemStack getStack() { return stack; } - public net.minecraft.item.ItemStack getMcStack() { + public net.minecraft.world.item.ItemStack getMcStack() { return stack.toMinecraft(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java index 4024ce047..4d396dc50 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.util.item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.core.registry.FuelRegistry; public class FuelUtil { - public static int getTime(World world, ItemStack stack) { + public static int getTime(Level world, ItemStack stack) { return FuelRegistry.get(world, stack); } - public static boolean isFuel(World world, ItemStack stack) { + public static boolean isFuel(Level world, ItemStack stack) { return FuelRegistry.isFuel(world, stack); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java index ffd8f7617..b3a599a2e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.util.item; -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.Registries; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class ItemGroupUtil { - public static Identifier toID(ItemGroup itemGroup) { - return Registries.ITEM_GROUP.getId(itemGroup); + public static Identifier toID(CreativeModeTab itemGroup) { + return BuiltInRegistries.CREATIVE_MODE_TAB.getKey(itemGroup); } - public static ItemGroup fromId(Identifier identifier) { - return Registries.ITEM_GROUP.get(identifier); + public static CreativeModeTab fromId(Identifier identifier) { + return BuiltInRegistries.CREATIVE_MODE_TAB.getValue(identifier); } public static boolean isExist(Identifier identifier) { - return Registries.ITEM_GROUP.containsId(identifier); + return BuiltInRegistries.CREATIVE_MODE_TAB.containsKey(identifier); } - public static CompatIdentifier toCompatID(ItemGroup itemGroup) { + public static CompatIdentifier toCompatID(CreativeModeTab itemGroup) { return CompatIdentifier.fromMinecraft(toID(itemGroup)); } - public static ItemGroup fromId(CompatIdentifier identifier) { + public static CreativeModeTab fromId(CompatIdentifier identifier) { return fromId(identifier.toMinecraft()); } @@ -30,11 +30,11 @@ public static boolean isExist(CompatIdentifier identifier) { return isExist(identifier.toMinecraft()); } - public static int getRawId(ItemGroup itemGroup) { - return Registries.ITEM_GROUP.getRawId(itemGroup); + public static int getRawId(CreativeModeTab itemGroup) { + return BuiltInRegistries.CREATIVE_MODE_TAB.getId(itemGroup); } - public static ItemGroup fromIndex(int index) { - return Registries.ITEM_GROUP.get(index); + public static CreativeModeTab fromIndex(int index) { + return BuiltInRegistries.CREATIVE_MODE_TAB.byId(index); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java index 2d8c17de6..753d8b4e9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util.item; -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; import net.pitan76.mcpitanlib.api.tag.TagKey; import net.pitan76.mcpitanlib.api.text.TextComponent; @@ -246,7 +246,7 @@ public static TextComponent getName(Item item) { * @return Translation key of the item. */ public static String getTranslationKey(Item item) { - return item.getTranslationKey(); + return item.getDescriptionId(); } public static boolean hasRecipeRemainder(Item item) { @@ -258,6 +258,6 @@ public static Item getRecipeRemainder(Item item) { } public static ItemStack getRecipeRemainderStack(Item item) { - return item.getRecipeRemainder(); + return item.getCraftingRemainder(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java index 6f19c06bd..8f353a8f0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java @@ -1,19 +1,19 @@ package net.pitan76.mcpitanlib.api.util.math; -import net.minecraft.util.BlockRotation; +import net.minecraft.world.level.block.Rotation; import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; public class BlockRotations { - public static BlockRotation NONE = BlockRotation.NONE; - public static BlockRotation CLOCKWISE_90 = BlockRotation.CLOCKWISE_90; - public static BlockRotation CLOCKWISE_180 = BlockRotation.CLOCKWISE_180; - public static BlockRotation COUNTERCLOCKWISE_90 = BlockRotation.COUNTERCLOCKWISE_90; + public static Rotation NONE = Rotation.NONE; + public static Rotation CLOCKWISE_90 = Rotation.CLOCKWISE_90; + public static Rotation CLOCKWISE_180 = Rotation.CLOCKWISE_180; + public static Rotation COUNTERCLOCKWISE_90 = Rotation.COUNTERCLOCKWISE_90; - public static BlockRotation rotate(BlockRotation rotation, BlockRotation rotation2) { - return rotation.rotate(rotation2); + public static Rotation rotate(Rotation rotation, Rotation rotation2) { + return rotation.getRotated(rotation2); } - public static BlockRotation random(CompatRandom random) { - return BlockRotation.random(random.getMcRandom()); + public static Rotation random(CompatRandom random) { + return Rotation.getRandom(random.getMcRandom()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java index 8bf031508..148375778 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java @@ -1,54 +1,54 @@ package net.pitan76.mcpitanlib.api.util.math; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.AABB; public class BoxUtil { - public static Box createBox(double x1, double y1, double z1, double x2, double y2, double z2) { - return new Box(x1, y1, z1, x2, y2, z2); + public static AABB createBox(double x1, double y1, double z1, double x2, double y2, double z2) { + return new AABB(x1, y1, z1, x2, y2, z2); } - public static Box createBox(double x, double y, double z, double size) { - return new Box(x, y, z, x + size, y + size, z + size); + public static AABB createBox(double x, double y, double z, double size) { + return new AABB(x, y, z, x + size, y + size, z + size); } - public static Box createBox(double size) { - return new Box(0, 0, 0, size, size, size); + public static AABB createBox(double size) { + return new AABB(0, 0, 0, size, size, size); } - public static Box createBox(double x1, double y1, double z1, double x2, double y2, double z2, double size) { - return new Box(x1, y1, z1, x2 + size, y2 + size, z2 + size); + public static AABB createBox(double x1, double y1, double z1, double x2, double y2, double z2, double size) { + return new AABB(x1, y1, z1, x2 + size, y2 + size, z2 + size); } - public static Box createBox(BlockPos pos) { - return new Box(pos); + public static AABB createBox(BlockPos pos) { + return new AABB(pos); } - public static Box createBox(BlockPos pos1, BlockPos pos2) { - return new Box(pos1.toCenterPos(), pos2.toCenterPos()); + public static AABB createBox(BlockPos pos1, BlockPos pos2) { + return new AABB(pos1.getCenter(), pos2.getCenter()); } - public static Box createBox(BlockPos pos, int size) { - return createBox(pos, pos.add(size, size, size)); + public static AABB createBox(BlockPos pos, int size) { + return createBox(pos, pos.offset(size, size, size)); } - public static Box createBox(BlockPos pos, int sizeX, int sizeY, int sizeZ) { - return createBox(pos, pos.add(sizeX, sizeY, sizeZ)); + public static AABB createBox(BlockPos pos, int sizeX, int sizeY, int sizeZ) { + return createBox(pos, pos.offset(sizeX, sizeY, sizeZ)); } - public static Box createBoxCenter(BlockPos pos, int size) { - return createBox(pos.add(-size, -size, -size), pos.add(size, size, size)); + public static AABB createBoxCenter(BlockPos pos, int size) { + return createBox(pos.offset(-size, -size, -size), pos.offset(size, size, size)); } - public static Box expand(Box box, double x, double y, double z) { - return new Box(box.minX - x, box.minY - y, box.minZ - z, box.maxX + x, box.maxY + y, box.maxZ + z); + public static AABB expand(AABB box, double x, double y, double z) { + return new AABB(box.minX - x, box.minY - y, box.minZ - z, box.maxX + x, box.maxY + y, box.maxZ + z); } - public static Box expand(Box box, double size) { + public static AABB expand(AABB box, double size) { return expand(box, size, size, size); } - public static Box union(Box box1, Box box2) { - return box1.union(box2); + public static AABB union(AABB box1, AABB box2) { + return box1.minmax(box2); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java index 08ac22244..33d3c7149 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.math; -import net.minecraft.util.math.Direction; +import net.minecraft.core.Direction; public class DirectionUtil { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java index 3a3468921..a2b163d06 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java @@ -1,18 +1,23 @@ package net.pitan76.mcpitanlib.api.util.math; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Position; +import net.minecraft.core.Vec3i; import net.minecraft.util.math.*; +import net.minecraft.world.phys.Vec3; public class PosUtil { public static BlockPos flooredBlockPos(double x, double y, double z) { - return BlockPos.ofFloored(x, y, z); + return BlockPos.containing(x, y, z); } public static BlockPos flooredBlockPos(Position pos) { - return BlockPos.ofFloored(pos); + return BlockPos.containing(pos); } - public static BlockPos flooredBlockPos(Vec3d pos) { - return BlockPos.ofFloored(pos); + public static BlockPos flooredBlockPos(Vec3 pos) { + return BlockPos.containing(pos); } public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos midohraBlockPos(int x, int y, int z) { @@ -27,27 +32,27 @@ public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos flooredMidohraBl } public static double getSquaredDistance(BlockPos pos1, BlockPos pos2) { - return pos1.getSquaredDistance(pos2); + return pos1.distSqr(pos2); } public static double getSquaredDistance(BlockPos pos1, double x, double y, double z) { - return pos1.getSquaredDistance(x, y, z); + return pos1.distToLowCornerSqr(x, y, z); } public static Iterable iterate(BlockPos start, BlockPos end) { - return BlockPos.iterate(start, end); + return BlockPos.betweenClosed(start, end); } public static BlockPos[] getNeighborPoses(BlockPos pos) { - return new BlockPos[]{pos.north(), pos.south(), pos.east(), pos.west(), pos.up(), pos.down()}; + return new BlockPos[]{pos.north(), pos.south(), pos.east(), pos.west(), pos.above(), pos.below()}; } public static BlockPos up(BlockPos pos) { - return pos.up(); + return pos.above(); } public static BlockPos down(BlockPos pos) { - return pos.down(); + return pos.below(); } public static BlockPos north(BlockPos pos) { @@ -67,7 +72,7 @@ public static BlockPos west(BlockPos pos) { } public static BlockPos add(BlockPos pos, int x, int y, int z) { - return pos.add(x, y, z); + return pos.offset(x, y, z); } public static BlockPos sub(BlockPos pos, int x, int y, int z) { @@ -91,23 +96,23 @@ public static int z(BlockPos pos) { } public static BlockPos offset(BlockPos pos, Direction direction) { - return pos.offset(direction); + return pos.relative(direction); } public static BlockPos offset(BlockPos pos, Direction direction, int n) { - return pos.offset(direction, n); + return pos.relative(direction, n); } public static BlockPos offset(BlockPos pos, net.pitan76.mcpitanlib.midohra.util.math.Direction direction) { - return pos.offset(direction.toMinecraft()); + return pos.relative(direction.toMinecraft()); } public static BlockPos offset(BlockPos pos, net.pitan76.mcpitanlib.midohra.util.math.Direction direction, int n) { - return pos.offset(direction.toMinecraft(), n); + return pos.relative(direction.toMinecraft(), n); } public static BlockPos toImmutable(BlockPos pos) { - return pos.toImmutable(); + return pos.immutable(); } public static long asLong(BlockPos pos) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java index f239b0a40..d456301b6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java @@ -1,69 +1,69 @@ package net.pitan76.mcpitanlib.api.util.math; -import net.minecraft.util.math.Vec3d; +import net.minecraft.world.phys.Vec3; public class Vec3dUtil { - public static Vec3d create(double x, double y, double z) { - return new Vec3d(x, y, z); + public static Vec3 create(double x, double y, double z) { + return new Vec3(x, y, z); } - public static Vec3d add(Vec3d a, Vec3d b) { + public static Vec3 add(Vec3 a, Vec3 b) { return a.add(b); } - public static Vec3d subtract(Vec3d a, Vec3d b) { + public static Vec3 subtract(Vec3 a, Vec3 b) { return a.subtract(b); } - public static Vec3d multiply(Vec3d a, double b) { - return a.multiply(b); + public static Vec3 multiply(Vec3 a, double b) { + return a.scale(b); } - public static Vec3d divide(Vec3d a, double b) { - return a.multiply(1.0D / b); + public static Vec3 divide(Vec3 a, double b) { + return a.scale(1.0D / b); } - public static double dot(Vec3d a, Vec3d b) { - return a.dotProduct(b); + public static double dot(Vec3 a, Vec3 b) { + return a.dot(b); } - public static Vec3d cross(Vec3d a, Vec3d b) { - return a.crossProduct(b); + public static Vec3 cross(Vec3 a, Vec3 b) { + return a.cross(b); } - public static Vec3d normalize(Vec3d a) { + public static Vec3 normalize(Vec3 a) { return a.normalize(); } - public static Vec3d rotateX(Vec3d a, float angle) { - return a.rotateX(angle); + public static Vec3 rotateX(Vec3 a, float angle) { + return a.xRot(angle); } - public static Vec3d rotateY(Vec3d a, float angle) { - return a.rotateY(angle); + public static Vec3 rotateY(Vec3 a, float angle) { + return a.yRot(angle); } - public static Vec3d rotateZ(Vec3d a, float angle) { - return a.rotateZ(angle); + public static Vec3 rotateZ(Vec3 a, float angle) { + return a.zRot(angle); } - public static Vec3d add(Vec3d a, double x, double y, double z) { + public static Vec3 add(Vec3 a, double x, double y, double z) { return a.add(x, y, z); } - public static Vec3d subtract(Vec3d a, double x, double y, double z) { + public static Vec3 subtract(Vec3 a, double x, double y, double z) { return a.subtract(x, y, z); } - public static Vec3d multiply(Vec3d a, double x, double y, double z) { + public static Vec3 multiply(Vec3 a, double x, double y, double z) { return a.multiply(x, y, z); } - public static double distanceTo(Vec3d a, Vec3d b) { + public static double distanceTo(Vec3 a, Vec3 b) { return a.distanceTo(b); } - public static Vec3d ofCenter(double x, double y, double z) { - return new Vec3d(x + 0.5, y + 0.5, z + 0.5); + public static Vec3 ofCenter(double x, double y, double z) { + return new Vec3(x + 0.5, y + 0.5, z + 0.5); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java index 4def019b0..fdfc48af9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.math; -import net.minecraft.util.math.Vec3i; +import net.minecraft.core.Vec3i; public class Vec3iUtil { public static Vec3i create(int x, int y, int z) { @@ -8,7 +8,7 @@ public static Vec3i create(int x, int y, int z) { } public static Vec3i add(Vec3i a, Vec3i b) { - return a.add(b); + return a.offset(b); } public static Vec3i subtract(Vec3i a, Vec3i b) { @@ -20,14 +20,14 @@ public static Vec3i multiply(Vec3i a, int b) { } public static Vec3i cross(Vec3i a, Vec3i b) { - return a.crossProduct(b); + return a.cross(b); } public static Vec3i add(Vec3i a, int x, int y, int z) { - return a.add(x, y, z); + return a.offset(x, y, z); } public static Vec3i subtract(Vec3i a, int x, int y, int z) { - return a.add(-x, -y, -z); + return a.offset(-x, -y, -z); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java index 93cd723d5..0b1c167e4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java @@ -2,24 +2,24 @@ public class CompatRandom { private java.util.Random javaRandom; - private net.minecraft.util.math.random.Random mcRandom; + private net.minecraft.util.RandomSource mcRandom; public CompatRandom(java.util.Random javaRandom) { this.javaRandom = javaRandom; } - public CompatRandom(net.minecraft.util.math.random.Random mcRandom) { + public CompatRandom(net.minecraft.util.RandomSource mcRandom) { this.mcRandom = mcRandom; } @Deprecated public CompatRandom() { - this.mcRandom = net.minecraft.util.math.random.Random.create(); + this.mcRandom = net.minecraft.util.RandomSource.create(); } @Deprecated public CompatRandom(long seed) { - this.mcRandom = net.minecraft.util.math.random.Random.create(seed); + this.mcRandom = net.minecraft.util.RandomSource.create(seed); } public static CompatRandom of(long seed) { @@ -44,7 +44,7 @@ public void skip(int count) { javaRandom.nextInt(); } } else { - mcRandom.skip(count); + mcRandom.consumeCount(count); } } @@ -52,7 +52,7 @@ public void split() { if (javaRandom != null) { javaRandom.nextInt(); } else { - mcRandom.split(); + mcRandom.fork(); } } @@ -134,7 +134,7 @@ public java.util.Random getJavaRandom() { } @Deprecated - public net.minecraft.util.math.random.Random getMcRandom() { + public net.minecraft.util.RandomSource getMcRandom() { return mcRandom; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java index 56646127c..40a9f6274 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.util.nbt; -import net.minecraft.inventory.Inventories; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; public class InvRWUtil { - public static void putInv(WriteNbtArgs args, DefaultedList stacks) { - Inventories.writeData(args.view, stacks); + public static void putInv(WriteNbtArgs args, NonNullList stacks) { + ContainerHelper.saveAllItems(args.view, stacks); } - public static void getInv(ReadNbtArgs args, DefaultedList stacks) { - Inventories.readData(args.view, stacks); + public static void getInv(ReadNbtArgs args, NonNullList stacks) { + ContainerHelper.loadAllItems(args.view, stacks); } public static void putInv(WriteNbtArgs args, ItemStackList stacks) { - putInv(args, (DefaultedList) stacks); + putInv(args, (NonNullList) stacks); } public static void getInv(ReadNbtArgs args, ItemStackList stacks) { - getInv(args, (DefaultedList) stacks); + getInv(args, (NonNullList) stacks); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java index a8f2c17e7..7d2f7411d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java @@ -1,88 +1,88 @@ package net.pitan76.mcpitanlib.api.util.nbt; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.NbtList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.nbt.ListTag; import net.pitan76.mcpitanlib.api.util.NbtUtil; import java.util.Optional; import java.util.stream.Stream; public class NbtListUtil { - public static NbtList create() { + public static ListTag create() { return NbtUtil.createNbtList(); } - public static NbtList copy(NbtList list) { + public static ListTag copy(ListTag list) { return list.copy(); } - public static Stream stream(NbtList list) { + public static Stream stream(ListTag list) { return list.stream(); } - public static Optional getStringOptional(NbtList list, int index) { + public static Optional getStringOptional(ListTag list, int index) { return list.getString(index); } - public static NbtElement get(NbtList list, int index) { + public static Tag get(ListTag list, int index) { return list.get(index); } - public static NbtElement getOrDefault(NbtList list, int index, NbtElement defaultValue) { - NbtElement nbt = get(list, index); + public static Tag getOrDefault(ListTag list, int index, Tag defaultValue) { + Tag nbt = get(list, index); return nbt == null ? defaultValue : nbt; } - public static void set(NbtList list, int index, NbtElement value) { + public static void set(ListTag list, int index, Tag value) { list.set(index, value); } - public static void add(NbtList list, NbtElement value) { + public static void add(ListTag list, Tag value) { list.add(value); } - public static void set(NbtList list, int index, String value) { + public static void set(ListTag list, int index, String value) { set(list, index, NbtUtil.createString(value)); } - public static boolean has(NbtList list, NbtElement value) { + public static boolean has(ListTag list, Tag value) { return list.contains(value); } - public static int size(NbtList list) { + public static int size(ListTag list) { return list.size(); } - public static void remove(NbtList list, int index) { + public static void remove(ListTag list, int index) { list.remove(index); } - public static void clear(NbtList list) { + public static void clear(ListTag list) { list.clear(); } - public static boolean isEmpty(NbtList list) { + public static boolean isEmpty(ListTag list) { return list.isEmpty(); } - public static String getString(NbtList list, int index) { + public static String getString(ListTag list, int index) { return getStringOptional(list, index).orElse(""); } - public static void setString(NbtList list, int index, String value) { + public static void setString(ListTag list, int index, String value) { list.set(index, NbtUtil.createString(value)); } - public static void addString(NbtList list, String value) { + public static void addString(ListTag list, String value) { list.add(NbtUtil.createString(value)); } - public static NbtList getList(NbtList list, int index) { + public static ListTag getList(ListTag list, int index) { return list.getList(index).orElse(create()); } - public static NbtCompound getCompound(NbtList list, int index) { + public static CompoundTag getCompound(ListTag list, int index) { return list.getCompound(index).orElse(NbtUtil.create()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java index 17c119629..cd28a9219 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.nbt; -import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.CompoundTag; import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; @@ -13,7 +13,7 @@ public static void putBoolean(WriteNbtArgs args, String key, boolean value) { } public static boolean getBoolean(ReadNbtArgs args, String key) { - return args.view.getBoolean(key, false); + return args.view.getBooleanOr(key, false); } public static void putByte(WriteNbtArgs args, String key, byte value) { @@ -21,7 +21,7 @@ public static void putByte(WriteNbtArgs args, String key, byte value) { } public static byte getByte(ReadNbtArgs args, String key) { - return args.view.getByte(key, (byte) 0); + return args.view.getByteOr(key, (byte) 0); } public static void putInt(WriteNbtArgs args, String key, int value) { @@ -29,7 +29,7 @@ public static void putInt(WriteNbtArgs args, String key, int value) { } public static int getInt(ReadNbtArgs args, String key) { - return args.view.getInt(key, 0); + return args.view.getIntOr(key, 0); } public static void putLong(WriteNbtArgs args, String key, long value) { @@ -37,7 +37,7 @@ public static void putLong(WriteNbtArgs args, String key, long value) { } public static long getLong(ReadNbtArgs args, String key) { - return args.view.getLong(key, 0L); + return args.view.getLongOr(key, 0L); } public static void putShort(WriteNbtArgs args, String key, short value) { @@ -45,7 +45,7 @@ public static void putShort(WriteNbtArgs args, String key, short value) { } public static short getShort(ReadNbtArgs args, String key) { - return (short) args.view.getShort(key, (short) 0); + return (short) args.view.getShortOr(key, (short) 0); } public static void putFloat(WriteNbtArgs args, String key, float value) { @@ -53,7 +53,7 @@ public static void putFloat(WriteNbtArgs args, String key, float value) { } public static float getFloat(ReadNbtArgs args, String key) { - return args.view.getFloat(key, 0.0f); + return args.view.getFloatOr(key, 0.0f); } public static void putDouble(WriteNbtArgs args, String key, double value) { @@ -61,7 +61,7 @@ public static void putDouble(WriteNbtArgs args, String key, double value) { } public static double getDouble(ReadNbtArgs args, String key) { - return args.view.getDouble(key, 0.0); + return args.view.getDoubleOr(key, 0.0); } public static void putString(WriteNbtArgs args, String key, String value) { @@ -69,7 +69,7 @@ public static void putString(WriteNbtArgs args, String key, String value) { } public static String getString(ReadNbtArgs args, String key) { - return args.view.getString(key, ""); + return args.view.getStringOr(key, ""); } public static void putIntArray(WriteNbtArgs args, String key, int[] value) { @@ -77,43 +77,43 @@ public static void putIntArray(WriteNbtArgs args, String key, int[] value) { } public static int[] getIntArray(ReadNbtArgs args, String key) { - return args.view.getOptionalIntArray(key).orElse(new int[0]); + return args.view.getIntArray(key).orElse(new int[0]); } public static boolean getBooleanOrDefault(ReadNbtArgs args, String key, boolean defaultValue) { - return args.view.getBoolean(key, defaultValue); + return args.view.getBooleanOr(key, defaultValue); } public static byte getByteOrDefault(ReadNbtArgs args, String key, byte defaultValue) { - return args.view.getByte(key, defaultValue); + return args.view.getByteOr(key, defaultValue); } public static int getIntOrDefault(ReadNbtArgs args, String key, int defaultValue) { - return args.view.getInt(key, defaultValue); + return args.view.getIntOr(key, defaultValue); } public static long getLongOrDefault(ReadNbtArgs args, String key, long defaultValue) { - return args.view.getLong(key, defaultValue); + return args.view.getLongOr(key, defaultValue); } public static short getShortOrDefault(ReadNbtArgs args, String key, short defaultValue) { - return (short) args.view.getShort(key, defaultValue); + return (short) args.view.getShortOr(key, defaultValue); } public static float getFloatOrDefault(ReadNbtArgs args, String key, float defaultValue) { - return args.view.getFloat(key, defaultValue); + return args.view.getFloatOr(key, defaultValue); } public static double getDoubleOrDefault(ReadNbtArgs args, String key, double defaultValue) { - return args.view.getDouble(key, defaultValue); + return args.view.getDoubleOr(key, defaultValue); } public static String getStringOrDefault(ReadNbtArgs args, String key, String defaultValue) { - return args.view.getString(key, defaultValue); + return args.view.getStringOr(key, defaultValue); } public static int[] getIntArrayOrDefault(ReadNbtArgs args, String key, int[] defaultValue) { - return args.view.getOptionalIntArray(key).orElse(defaultValue); + return args.view.getIntArray(key).orElse(defaultValue); } public static boolean isEmpty(NbtRWArgs args) { @@ -131,11 +131,11 @@ public static NbtRWArgs get(ReadNbtArgs args, String key) { return new NbtRWArgs(getCompound(args, key)); } - public static void putCompound(WriteNbtArgs args, String key, NbtCompound other) { - args.view.put(key, NbtCompound.CODEC, other); + public static void putCompound(WriteNbtArgs args, String key, CompoundTag other) { + args.view.store(key, CompoundTag.CODEC, other); } - public static NbtCompound getCompound(ReadNbtArgs args, String key) { - return args.view.read(key, NbtCompound.CODEC).orElse(NbtUtil.create()); + public static CompoundTag getCompound(ReadNbtArgs args, String key) { + return args.view.read(key, CompoundTag.CODEC).orElse(NbtUtil.create()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java index 702a6e97b..191836d18 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.util.nbt.v2; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.util.ErrorReporter; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; +import net.minecraft.world.item.ItemStack; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.util.ProblemReporter; +import net.minecraft.world.phys.Vec3; +import net.minecraft.core.Vec3i; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; @@ -29,8 +29,8 @@ public static void getInv(ReadNbtArgs args, ItemStackList stacks) { } public static WriteNbtArgs create(CompatRegistryLookup registryLookup) { - NbtWriteView view = _view(registryLookup); - return new WriteNbtArgs(view.getNbt(), view, registryLookup); + TagValueOutput view = _view(registryLookup); + return new WriteNbtArgs(view.buildResult(), view, registryLookup); } public static WriteNbtArgs create() { @@ -38,23 +38,23 @@ public static WriteNbtArgs create() { } public static void put(WriteNbtArgs parent, WriteNbtArgs child, String key) { - if (child.view instanceof NbtWriteView childView) - parent.view.put(key, NbtCompound.CODEC, childView.getNbt()); + if (child.view instanceof TagValueOutput childView) + parent.view.store(key, CompoundTag.CODEC, childView.buildResult()); } public static WriteNbtArgs putWithCreate(WriteNbtArgs parent, String key) { - NbtWriteView subView = _view(parent.registryLookup); - parent.view.put(key, NbtCompound.CODEC, subView.getNbt()); - return new WriteNbtArgs(subView.getNbt(), subView, parent.registryLookup); + TagValueOutput subView = _view(parent.registryLookup); + parent.view.store(key, CompoundTag.CODEC, subView.buildResult()); + return new WriteNbtArgs(subView.buildResult(), subView, parent.registryLookup); } public static ReadNbtArgs get(ReadNbtArgs parent, String key) { - ReadView view = parent.view.getReadView(key); + ValueInput view = parent.view.childOrEmpty(key); return new ReadNbtArgs(null, view, parent.registryLookup); } public static ReadNbtArgs getOrDefault(ReadNbtArgs parent, String key, ReadNbtArgs defaultValue) { - Optional view = parent.view.getOptionalReadView(key); + Optional view = parent.view.child(key); return view.map(readView -> new ReadNbtArgs(null, readView, parent.registryLookup)).orElse(defaultValue); } @@ -80,7 +80,7 @@ public static Vec3i getPos3i(ReadNbtArgs args, String key) { return Vec3iUtil.create(x, y, z); } - public static Vec3d getPos3d(ReadNbtArgs args, String key) { + public static Vec3 getPos3d(ReadNbtArgs args, String key) { ReadNbtArgs args2 = get(args, key); double x = getDouble(args2, "x"); double y = getDouble(args2, "y"); @@ -100,11 +100,11 @@ public static BlockPos getBlockPos(ReadNbtArgs args, String key) { return BlockPos.of(x, y, z); } - public static void putBlockPos(WriteNbtArgs args, String key, net.minecraft.util.math.BlockPos pos) { + public static void putBlockPos(WriteNbtArgs args, String key, net.minecraft.core.BlockPos pos) { putPos3i(args, key, PosUtil.x(pos), PosUtil.y(pos), PosUtil.z(pos)); } - public static net.minecraft.util.math.BlockPos getBlockPosV(ReadNbtArgs args, String key) { + public static net.minecraft.core.BlockPos getBlockPosV(ReadNbtArgs args, String key) { ReadNbtArgs args2 = get(args, key); int x = getInt(args2, "x"); int y = getInt(args2, "y"); @@ -112,12 +112,12 @@ public static net.minecraft.util.math.BlockPos getBlockPosV(ReadNbtArgs args, St return PosUtil.flooredBlockPos(x, y, z); } - private static NbtWriteView _view(CompatRegistryLookup registryLookup) { - return NbtWriteView.create(ErrorReporter.EMPTY, registryLookup.getRegistryLookup()); + private static TagValueOutput _view(CompatRegistryLookup registryLookup) { + return TagValueOutput.createWithContext(ProblemReporter.DISCARDING, registryLookup.getRegistryLookup()); } public static void putItemStack(WriteNbtArgs args, String key, ItemStack stack) { - args.view.put(key, ItemStack.CODEC, stack); + args.view.store(key, ItemStack.CODEC, stack); } public static Optional getItemStack(ReadNbtArgs args, String key) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java index 8393a6178..49469c5ad 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.util.particle; -import net.minecraft.particle.ParticleType; -import net.minecraft.registry.Registries; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -21,11 +21,11 @@ public ParticleType getRaw() { } public boolean shouldAlwaysSpawn() { - return particleType.shouldAlwaysSpawn(); + return particleType.getOverrideLimiter(); } public Identifier getId() { - return Registries.PARTICLE_TYPE.getId(particleType); + return BuiltInRegistries.PARTICLE_TYPE.getKey(particleType); } public CompatIdentifier getCompatId() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java index 5562d9bda..5caf230da 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.api.util.particle; +import net.minecraft.core.particles.ParticleTypes; import net.minecraft.particle.*; public class CompatParticleTypes { @@ -109,8 +110,8 @@ public class CompatParticleTypes { public static final CompatParticleType SHRIEK = new CompatParticleType(ParticleTypes.SHRIEK); public static final CompatParticleType EGG_CRACK = new CompatParticleType(ParticleTypes.EGG_CRACK); public static final CompatParticleType DUST_PLUME = new CompatParticleType(ParticleTypes.DUST_PLUME); - public static final CompatParticleType TRIAL_SPAWNER_DETECTION = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTION); - public static final CompatParticleType TRIAL_SPAWNER_DETECTION_OMINOUS = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTION_OMINOUS); + public static final CompatParticleType TRIAL_SPAWNER_DETECTION = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER); + public static final CompatParticleType TRIAL_SPAWNER_DETECTION_OMINOUS = new CompatParticleType(ParticleTypes.TRIAL_SPAWNER_DETECTED_PLAYER_OMINOUS); public static final CompatParticleType VAULT_CONNECTION = new CompatParticleType(ParticleTypes.VAULT_CONNECTION); public static final CompatParticleType DUST_PILLAR = new CompatParticleType(ParticleTypes.DUST_PILLAR); public static final CompatParticleType OMINOUS_SPAWNING = new CompatParticleType(ParticleTypes.OMINOUS_SPAWNING); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java index 9eab41f4d..6c18712fe 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util.particle.effect; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ItemStackParticleEffect; -import net.minecraft.particle.ParticleType; -import net.minecraft.particle.ParticleTypes; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.particles.ItemParticleOption; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.core.particles.ParticleTypes; // Use: ParticleEffectUtil public class ItemStackParticleEffectUtil { @@ -12,11 +12,11 @@ public ItemStackParticleEffectUtil() { // Empty constructor } - public ItemStackParticleEffect create(ParticleType type, ItemStack stack) { - return new ItemStackParticleEffect(type, stack); + public ItemParticleOption create(ParticleType type, ItemStack stack) { + return new ItemParticleOption(type, stack); } - public ItemStackParticleEffect createTypedItem(ItemStack stack) { - return new ItemStackParticleEffect(ParticleTypes.ITEM, stack); + public ItemParticleOption createTypedItem(ItemStack stack) { + return new ItemParticleOption(ParticleTypes.ITEM, stack); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java index 2c6844f07..60b2838fc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util.recipe; import it.unimi.dsi.fastutil.ints.IntList; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeMatcher; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.entity.player.StackedContents; import net.pitan76.mcpitanlib.api.recipe.CompatibleRecipeEntry; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import net.pitan76.mcpitanlib.api.util.ItemUtil; @@ -17,27 +17,27 @@ public static int getItemId(ItemStack stack) { return ItemUtil.getRawId(stack.getItem()); } - public static boolean match(RecipeMatcher matcher, CompatibleRecipeEntry entry, IntList output) { + public static boolean match(StackedContents matcher, CompatibleRecipeEntry entry, IntList output) { return match(matcher, entry.getRecipe(), output); } - public static boolean match(RecipeMatcher matcher, CompatibleRecipeEntry entry, IntList output, int multiplier) { + public static boolean match(StackedContents matcher, CompatibleRecipeEntry entry, IntList output, int multiplier) { return match(matcher, entry.getRecipe(), output, multiplier); } @Deprecated - public static boolean match(RecipeMatcher matcher, Recipe recipe, IntList output) { + public static boolean match(StackedContents matcher, Recipe recipe, IntList output) { return false; //return matcher.match(recipe, output); } @Deprecated - public static boolean match(RecipeMatcher matcher, Recipe recipe, IntList output, int multiplier) { + public static boolean match(StackedContents matcher, Recipe recipe, IntList output, int multiplier) { return false; //return matcher.match(recipe, output, multiplier); } - public static void clear(RecipeMatcher matcher) { + public static void clear(StackedContents matcher) { matcher.clear(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java index dc6430e2b..d4c7ed609 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.util.recipe; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.RecipeType; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.world.World; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.recipe.v3.CompatRecipe; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; @@ -15,39 +15,39 @@ import java.util.List; public class RecipeUtil { - public static Collection> getMCRecipes(World world) { + public static Collection> getMCRecipes(Level world) { Collection> recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { + for (net.minecraft.world.item.crafting.RecipeHolder entry : getMCRecipeEntries(world)) { recipes.add(entry.value()); } return recipes; } - public static Collection> getMCRecipeEntries(World world) { - if (world.getRecipeManager() instanceof ServerRecipeManager) { - return ((ServerRecipeManager) world.getRecipeManager()).values(); + public static Collection> getMCRecipeEntries(Level world) { + if (world.recipeAccess() instanceof RecipeManager) { + return ((RecipeManager) world.recipeAccess()).getRecipes(); } // Client is not supported... TODO: Implement client support for 1.21.3~ return new ArrayList<>(); } - public static Collection getRecipes(World world) { + public static Collection getRecipes(Level world) { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { + for (net.minecraft.world.item.crafting.RecipeHolder entry : getMCRecipeEntries(world)) { recipes.add(new CompatRecipe(entry)); } return recipes; } - public static Collection getRecipesByType(World world, RecipeType type) { + public static Collection getRecipesByType(Level world, RecipeType type) { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world)) { + for (net.minecraft.world.item.crafting.RecipeHolder entry : getMCRecipeEntries(world)) { if (entry.value().getType() == type) { recipes.add(new CompatRecipe(entry)); } @@ -68,8 +68,8 @@ public static Collection getRecipesByType(net.pitan76.mcpitanlib.m public static Collection getRecipeEntries(net.pitan76.mcpitanlib.midohra.world.World world) { List entries = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world.getRaw())) { - entries.add(RecipeEntry.of(entry.value(), CompatIdentifier.fromMinecraft(entry.id().getValue()))); + for (net.minecraft.world.item.crafting.RecipeHolder entry : getMCRecipeEntries(world.getRaw())) { + entries.add(RecipeEntry.of(entry.value(), CompatIdentifier.fromMinecraft(entry.id().identifier()))); } return entries; @@ -79,8 +79,8 @@ public static Collection getCraftingRecipes(net.pitan76.mcpitanl List recipes = new ArrayList<>(); for (CompatRecipe recipe : getRecipesByType(world, net.pitan76.mcpitanlib.midohra.recipe.RecipeType.CRAFTING)) { - if (recipe.getRecipe() instanceof net.minecraft.recipe.CraftingRecipe) { - recipes.add(CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) recipe.getRecipe())); + if (recipe.getRecipe() instanceof net.minecraft.world.item.crafting.CraftingRecipe) { + recipes.add(CraftingRecipe.of((net.minecraft.world.item.crafting.CraftingRecipe) recipe.getRecipe())); } } @@ -90,9 +90,9 @@ public static Collection getCraftingRecipes(net.pitan76.mcpitanl public static Collection getCraftingRecipeEntries(net.pitan76.mcpitanlib.midohra.world.World world) { List entries = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry entry : getMCRecipeEntries(world.getRaw())) { - if (entry.value() instanceof net.minecraft.recipe.CraftingRecipe) { - entries.add(CraftingRecipeEntry.of((net.minecraft.recipe.CraftingRecipe) entry.value(), CompatIdentifier.fromMinecraft(entry.id().getValue()))); + for (net.minecraft.world.item.crafting.RecipeHolder entry : getMCRecipeEntries(world.getRaw())) { + if (entry.value() instanceof net.minecraft.world.item.crafting.CraftingRecipe) { + entries.add(CraftingRecipeEntry.of((net.minecraft.world.item.crafting.CraftingRecipe) entry.value(), CompatIdentifier.fromMinecraft(entry.id().identifier()))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java index 694e4c3b1..f5c8a5774 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util.recipe.input; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.RecipeFinder; -import net.minecraft.recipe.input.CraftingRecipeInput; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.player.StackedItemContents; +import net.minecraft.world.item.crafting.CraftingInput; import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; @@ -10,27 +10,27 @@ import java.util.Optional; public class CraftingRecipeInputUtil { - public static Optional get(CompatRecipeInput input) { - if (input.getInput() instanceof CraftingRecipeInput) { - return Optional.of((CraftingRecipeInput) input.getInput()); + public static Optional get(CompatRecipeInput input) { + if (input.getInput() instanceof CraftingInput) { + return Optional.of((CraftingInput) input.getInput()); } return Optional.empty(); } - public static CompatRecipeInput create(CraftingRecipeInput input) { + public static CompatRecipeInput create(CraftingInput input) { return new CompatRecipeInput<>(input); } public static CompatRecipeInput create(int width, int height, List stacks) { - return new CompatRecipeInput<>(CraftingRecipeInput.create(width, height, stacks)); + return new CompatRecipeInput<>(CraftingInput.of(width, height, stacks)); } - public static ItemStack getStack(CraftingRecipeInput input, int x, int y) { - return input.getStackInSlot(x, y); + public static ItemStack getStack(CraftingInput input, int x, int y) { + return input.getItem(x, y); } public static ItemStack getStack(CompatRecipeInput input, int x, int y) { - Optional recipeInput = get(input); + Optional recipeInput = get(input); if (!recipeInput.isPresent()) return ItemStackUtil.empty(); return getStack(recipeInput.get(), x, y); @@ -40,56 +40,56 @@ public static net.pitan76.mcpitanlib.midohra.item.ItemStack getMidohraStack(Comp return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack(input, x, y)); } - public static RecipeFinder getRecipeMatcher(CraftingRecipeInput input) { - return input.getRecipeMatcher(); + public static StackedItemContents getRecipeMatcher(CraftingInput input) { + return input.stackedContents(); } - public static RecipeFinder getRecipeMatcher(CompatRecipeInput input) { - Optional recipeInput = get(input); + public static StackedItemContents getRecipeMatcher(CompatRecipeInput input) { + Optional recipeInput = get(input); if (!recipeInput.isPresent()) return null; return getRecipeMatcher(recipeInput.get()); } - public static List getStacks(CraftingRecipeInput input) { - return input.getStacks(); + public static List getStacks(CraftingInput input) { + return input.items(); } public static List getStacks(CompatRecipeInput input) { - Optional recipeInput = get(input); + Optional recipeInput = get(input); if (!recipeInput.isPresent()) return null; return getStacks(recipeInput.get()); } - public static int getWidth(CraftingRecipeInput input) { - return input.getWidth(); + public static int getWidth(CraftingInput input) { + return input.width(); } public static int getWidth(CompatRecipeInput input) { - Optional recipeInput = get(input); + Optional recipeInput = get(input); if (!recipeInput.isPresent()) return -1; return getWidth(recipeInput.get()); } - public static int getHeight(CraftingRecipeInput input) { - return input.getHeight(); + public static int getHeight(CraftingInput input) { + return input.height(); } public static int getHeight(CompatRecipeInput input) { - Optional recipeInput = get(input); + Optional recipeInput = get(input); if (!recipeInput.isPresent()) return -1; return getHeight(recipeInput.get()); } - public static int getStackCount(CraftingRecipeInput input) { - return input.getStackCount(); + public static int getStackCount(CraftingInput input) { + return input.ingredientCount(); } public static int getStackCount(CompatRecipeInput input) { - Optional recipeInput = get(input); + Optional recipeInput = get(input); if (!recipeInput.isPresent()) return -1; return getStackCount(recipeInput.get()); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java index daf08816f..8abc5c8a2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java @@ -1,32 +1,32 @@ package net.pitan76.mcpitanlib.api.util.recipe.input; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.input.SingleStackRecipeInput; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.SingleRecipeInput; import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import java.util.Optional; public class SingleStackRecipeInputUtil { - public static Optional get(CompatRecipeInput input) { - if (input.getInput() instanceof SingleStackRecipeInput) { - return Optional.of((SingleStackRecipeInput) input.getInput()); + public static Optional get(CompatRecipeInput input) { + if (input.getInput() instanceof SingleRecipeInput) { + return Optional.of((SingleRecipeInput) input.getInput()); } return Optional.empty(); } - public static CompatRecipeInput create(SingleStackRecipeInput input) { + public static CompatRecipeInput create(SingleRecipeInput input) { return new CompatRecipeInput<>(input); } public static CompatRecipeInput create(ItemStack stack) { - return new CompatRecipeInput<>(new SingleStackRecipeInput(stack)); + return new CompatRecipeInput<>(new SingleRecipeInput(stack)); } public static ItemStack getStack(CompatRecipeInput input) { - Optional recipeInput = get(input); + Optional recipeInput = get(input); if (!recipeInput.isPresent()) return ItemStackUtil.empty(); - return recipeInput.get().getStackInSlot(0); + return recipeInput.get().getItem(0); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java index fbc99fb76..6a8fecb53 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java @@ -1,28 +1,28 @@ package net.pitan76.mcpitanlib.api.util.screen; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; import org.jetbrains.annotations.Nullable; import java.util.Set; public class ScreenHandlerUtil { - public static int calcComparatorOutput(@Nullable Inventory inventory) { - return ScreenHandler.calculateComparatorOutput(inventory); + public static int calcComparatorOutput(@Nullable Container inventory) { + return AbstractContainerMenu.getRedstoneSignalFromContainer(inventory); } public static int calcComparatorOutput(@Nullable BlockEntity blockEntity) { - return ScreenHandler.calculateComparatorOutput(blockEntity); + return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(blockEntity); } public static int calculateStackSize(Set slots, int mode, ItemStack stack) { - return ScreenHandler.calculateStackSize(slots, mode, stack); + return AbstractContainerMenu.getQuickCraftPlaceCount(slots, mode, stack); } public static boolean canInsertItemIntoSlot(@Nullable Slot slot, ItemStack stack, boolean allowOverflow) { - return ScreenHandler.canInsertItemIntoSlot(slot, stack, allowOverflow); + return AbstractContainerMenu.canItemQuickReplace(slot, stack, allowOverflow); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java index b60360435..055265991 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util.v1; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.registry.Registries; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.block.CompatibleBlockSettings; import net.pitan76.mcpitanlib.api.tag.MineableToolTags; @@ -12,7 +12,7 @@ public class BlockUtilV1 { public static Block block(Identifier id) { - return Registries.BLOCK.get(id); + return BuiltInRegistries.BLOCK.getValue(id); } /** @@ -22,40 +22,40 @@ public static Block block(Identifier id) { * @param level * @return */ - public static AbstractBlock.Settings breakByTool(AbstractBlock.Settings settings, MineableToolTags toolTags, int level) { + public static BlockBehaviour.Properties breakByTool(BlockBehaviour.Properties settings, MineableToolTags toolTags, int level) { return settings; } - public static AbstractBlock.Settings dropsNothing(AbstractBlock.Settings settings) { - return settings.dropsNothing(); + public static BlockBehaviour.Properties dropsNothing(BlockBehaviour.Properties settings) { + return settings.noLootTable(); } - public static AbstractBlock.Settings requiresTool(AbstractBlock.Settings settings) { - return settings.requiresTool(); + public static BlockBehaviour.Properties requiresTool(BlockBehaviour.Properties settings) { + return settings.requiresCorrectToolForDrops(); } public static boolean isExist(Identifier identifier) { - return Registries.BLOCK.containsId(identifier); + return BuiltInRegistries.BLOCK.containsKey(identifier); } public static Identifier toID(Block block) { - return Registries.BLOCK.getId(block); + return BuiltInRegistries.BLOCK.getKey(block); } public static Block fromId(Identifier identifier) { - return Registries.BLOCK.get(identifier); + return BuiltInRegistries.BLOCK.getValue(identifier); } public static List getAllBlocks() { List blocks = new ArrayList<>(); - for (Block block : Registries.BLOCK) { + for (Block block : BuiltInRegistries.BLOCK) { blocks.add(block); } return blocks; } @Deprecated - public static Block of(AbstractBlock.Settings settings) { + public static Block of(BlockBehaviour.Properties settings) { return new Block(settings); } @@ -64,10 +64,10 @@ public static Block of(CompatibleBlockSettings settings) { } public static int getRawId(Block block) { - return Registries.BLOCK.getRawId(block); + return BuiltInRegistries.BLOCK.getId(block); } public static Block fromIndex(int index) { - return Registries.BLOCK.get(index); + return BuiltInRegistries.BLOCK.byId(index); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java index 282a1f9fa..01516edd8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.util.v1; -import net.minecraft.block.Block; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.block.BlockItemByExtendBlock1215; import net.pitan76.mcpitanlib.api.block.ExtendBlock; @@ -17,7 +17,7 @@ public class ItemUtilV1 { public static Item item(Identifier id) { - return Registries.ITEM.get(id); + return BuiltInRegistries.ITEM.getValue(id); } public static boolean isEqual(Item item, Item item2) { @@ -25,7 +25,7 @@ public static boolean isEqual(Item item, Item item2) { } public static boolean isOf(ItemStack stack, Item item) { - return stack.isOf(item); + return stack.is(item); } public static boolean isIn(ItemStack stack, TagKey tagKey) { @@ -33,23 +33,23 @@ public static boolean isIn(ItemStack stack, TagKey tagKey) { } public static boolean isIn(Item item, TagKey tagKey) { - if (item.getRegistryEntry().isIn(tagKey.getTagKey())) return true; + if (item.builtInRegistryHolder().is(tagKey.getTagKey())) return true; return tagKey.isOf(item); } public static boolean isExist(Identifier identifier) { - return Registries.ITEM.containsId(identifier); + return BuiltInRegistries.ITEM.containsKey(identifier); } public static Identifier toID(Item item) { - return Registries.ITEM.getId(item); + return BuiltInRegistries.ITEM.getKey(item); } public static Item fromId(Identifier identifier) { - return Registries.ITEM.get(identifier); + return BuiltInRegistries.ITEM.getValue(identifier); } @Deprecated - public static BlockItem ofBlock(Block block, Item.Settings settings) { + public static BlockItem ofBlock(Block block, Item.Properties settings) { if (block instanceof ExtendBlock) { return new BlockItemByExtendBlock1215((ExtendBlock) block, settings); } @@ -66,7 +66,7 @@ public static BlockItem ofBlock(Block block, CompatibleItemSettings settings) { } @Deprecated - public static Item of(Item.Settings settings) { + public static Item of(Item.Properties settings) { return new Item(settings); } @@ -76,17 +76,17 @@ public static Item of(CompatibleItemSettings settings) { public static List getAllItems() { List items = new ArrayList<>(); - for (Item item : Registries.ITEM) { + for (Item item : BuiltInRegistries.ITEM) { items.add(item); } return items; } public static int getRawId(Item item) { - return Registries.ITEM.getRawId(item); + return BuiltInRegistries.ITEM.getId(item); } public static Item fromIndex(int index) { - return Registries.ITEM.get(index); + return BuiltInRegistries.ITEM.byId(index); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java index fcb1dd469..96a98a4ce 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.util.v2; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.tag.TagKey; import net.pitan76.mcpitanlib.api.util.BlockUtil; @@ -19,7 +19,7 @@ public class BlockUtilV2 { * @return If the block is in the tag. */ public static boolean isIn(Block block, TagKey tagKey) { - if (block.getRegistryEntry().isIn(tagKey.getTagKey())) return true; + if (block.builtInRegistryHolder().is(tagKey.getTagKey())) return true; return tagKey.isOf(block); } @@ -116,7 +116,7 @@ public static boolean isBlockInTag(Block block, String id) { } public static Block fromItem(Item item) { - return Block.getBlockFromItem(item); + return Block.byItem(item); } public static Block fromItem(ItemStack stack) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java index c24eb0df9..e9f16a236 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.api.util.v2; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.TextUtil; public class CustomNameUtil { - public static void setCustomName(ItemStack stack, Text name) { - stack.set(DataComponentTypes.CUSTOM_NAME, name); + public static void setCustomName(ItemStack stack, Component name) { + stack.set(DataComponents.CUSTOM_NAME, name); } public static void setCustomName(ItemStack stack, String name) { @@ -28,8 +28,8 @@ public static void setCustomName(ItemStack stack, TextComponent name) { setCustomName(stack, name.getText()); } - public static Text getCustomName(ItemStack stack) { - return stack.get(DataComponentTypes.CUSTOM_NAME); + public static Component getCustomName(ItemStack stack) { + return stack.get(DataComponents.CUSTOM_NAME); } public static String getCustomNameAsString(ItemStack stack) { @@ -41,10 +41,10 @@ public static TextComponent getCustomNameAsTextComponent(ItemStack stack) { } public static boolean hasCustomName(ItemStack stack) { - return stack.contains(DataComponentTypes.CUSTOM_NAME); + return stack.has(DataComponents.CUSTOM_NAME); } public static void removeCustomName(ItemStack stack) { - stack.remove(DataComponentTypes.CUSTOM_NAME); + stack.remove(DataComponents.CUSTOM_NAME); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java index d3252452d..562b64a9f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.v2; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.tag.TagKey; import net.pitan76.mcpitanlib.api.util.IdentifierUtil; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java index 436192e5d..fb6210a05 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.util.world; -import net.minecraft.server.world.ServerChunkManager; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.World; +import net.minecraft.server.level.ServerChunkCache; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; public class ChunkManagerUtil { - public static void markForUpdate(ServerChunkManager manager, BlockPos pos) { + public static void markForUpdate(ServerChunkCache manager, BlockPos pos) { markForUpdate(manager, pos.toRaw()); } - public static void markForUpdate(ServerChunkManager manager, net.minecraft.util.math.BlockPos pos) { - manager.markForUpdate(pos); + public static void markForUpdate(ServerChunkCache manager, net.minecraft.core.BlockPos pos) { + manager.blockChanged(pos); } - public static void markForUpdate(ServerWorld world, net.minecraft.util.math.BlockPos pos) { + public static void markForUpdate(ServerLevel world, net.minecraft.core.BlockPos pos) { markForUpdate(ServerWorldUtil.getChunkManager(world), pos); } - public static void markForUpdate(World world, net.minecraft.util.math.BlockPos pos) { - if (!(world instanceof ServerWorld)) return; - markForUpdate((ServerWorld) world, pos); + public static void markForUpdate(Level world, net.minecraft.core.BlockPos pos) { + if (!(world instanceof ServerLevel)) return; + markForUpdate((ServerLevel) world, pos); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java index 6e1b2166b..728f343a4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util.world; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.server.world.ServerChunkManager; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.server.level.ServerChunkCache; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.core.BlockPos; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import org.jetbrains.annotations.Nullable; @@ -16,29 +16,29 @@ import java.util.List; public class ServerWorldUtil { - public static void spawnParticles(ServerWorld world, ParticleEffect particle, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { - world.spawnParticles(particle, x, y, z, count, velocityX, velocityY, velocityZ, speed); + public static void spawnParticles(ServerLevel world, ParticleOptions particle, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { + world.sendParticles(particle, x, y, z, count, velocityX, velocityY, velocityZ, speed); } - public static void spawnParticles(ServerWorld world, Player player, ParticleEffect particle, boolean force, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { + public static void spawnParticles(ServerLevel world, Player player, ParticleOptions particle, boolean force, double x, double y, double z, int count, double velocityX, double velocityY, double velocityZ, double speed) { if (player.isServer()) { - world.spawnParticles(player.getServerPlayer().get(), particle, force, false, x, y, z, count, velocityX, velocityY, velocityZ, speed); + world.sendParticles(player.getServerPlayer().get(), particle, force, false, x, y, z, count, velocityX, velocityY, velocityZ, speed); } } - public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity) { - return Block.getDroppedStacks(state, world, pos, blockEntity); + public static List getDroppedStacksOnBlock(BlockState state, ServerLevel world, BlockPos pos, @Nullable BlockEntity blockEntity) { + return Block.getDrops(state, world, pos, blockEntity); } - public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntityWrapper blockEntity) { + public static List getDroppedStacksOnBlock(BlockState state, ServerLevel world, BlockPos pos, @Nullable BlockEntityWrapper blockEntity) { return getDroppedStacksOnBlock(state, world, pos, blockEntity.get()); } - public static List getDroppedStacksOnBlock(BlockState state, ServerWorld world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack stack) { - return Block.getDroppedStacks(state, world, pos, blockEntity, entity, stack); + public static List getDroppedStacksOnBlock(BlockState state, ServerLevel world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack stack) { + return Block.getDrops(state, world, pos, blockEntity, entity, stack); } - public static ServerChunkManager getChunkManager(ServerWorld world) { - return world.getChunkManager(); + public static ServerChunkCache getChunkManager(ServerLevel world) { + return world.getChunkSource(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java index 22ad43e5f..166af0cba 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.util.world; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.entity.Entity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; public class TickerUtil { - public static void tick(T blockEntity, World world, BlockPos pos, BlockState state) { + public static void tick(T blockEntity, Level world, BlockPos pos, BlockState state) { if (isTicker(blockEntity)) ((BlockEntityTicker) blockEntity).tick(world, pos, state, blockEntity); } - public static void tick(T blockEntity, World world, BlockPos pos) { + public static void tick(T blockEntity, Level world, BlockPos pos) { tick(blockEntity, world, pos, WorldUtil.getBlockState(world, pos)); } public static void tick(T blockEntity) { - tick(blockEntity, blockEntity.getWorld(), blockEntity.getPos()); + tick(blockEntity, blockEntity.getLevel(), blockEntity.getBlockPos()); } public static void tick(T entity) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java index 6bf8142a5..383d36e84 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java @@ -1,52 +1,52 @@ package net.pitan76.mcpitanlib.api.util.world; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.material.Fluid; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldAccess; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.LevelAccessor; public class WorldAccessUtil extends WorldViewUtil { - public static void scheduleBlockTick(WorldAccess world, BlockPos pos, Block block, int delay) { - world.scheduleBlockTick(pos, block, delay); + public static void scheduleBlockTick(LevelAccessor world, BlockPos pos, Block block, int delay) { + world.scheduleTick(pos, block, delay); } - public static void scheduleFluidTick(WorldAccess world, BlockPos pos, Fluid fluid, int delay) { - world.scheduleFluidTick(pos, fluid, delay); + public static void scheduleFluidTick(LevelAccessor world, BlockPos pos, Fluid fluid, int delay) { + world.scheduleTick(pos, fluid, delay); } - public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state, int flags) { - return world.setBlockState(pos, state, flags); + public static boolean setBlockState(LevelAccessor world, BlockPos pos, BlockState state, int flags) { + return world.setBlock(pos, state, flags); } - public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { - return world.setBlockState(pos, state, flags, maxUpdateDepth); + public static boolean setBlockState(LevelAccessor world, BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { + return world.setBlock(pos, state, flags, maxUpdateDepth); } - public static boolean setBlockState(WorldAccess world, BlockPos pos, BlockState state) { + public static boolean setBlockState(LevelAccessor world, BlockPos pos, BlockState state) { return setBlockState(world, pos, state, 3); } - public static BlockState getBlockState(WorldAccess world, BlockPos pos) { + public static BlockState getBlockState(LevelAccessor world, BlockPos pos) { return world.getBlockState(pos); } - public static boolean breakBlock(WorldAccess world, BlockPos pos, boolean drop) { - return world.breakBlock(pos, drop); + public static boolean breakBlock(LevelAccessor world, BlockPos pos, boolean drop) { + return world.destroyBlock(pos, drop); } - public static boolean breakBlock(WorldAccess world, BlockPos pos, boolean drop, Entity entity) { - return world.breakBlock(pos, drop, entity); + public static boolean breakBlock(LevelAccessor world, BlockPos pos, boolean drop, Entity entity) { + return world.destroyBlock(pos, drop, entity); } - public static boolean removeBlock(WorldAccess world, BlockPos pos, boolean move) { + public static boolean removeBlock(LevelAccessor world, BlockPos pos, boolean move) { return world.removeBlock(pos, move); } - public static MinecraftServer getServer(WorldAccess world) { + public static MinecraftServer getServer(LevelAccessor world) { return world.getServer(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java index 72dec4165..05952462e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java @@ -1,19 +1,19 @@ package net.pitan76.mcpitanlib.api.util.world; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.tags.FluidTags; +import net.minecraft.core.BlockPos; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.dimension.DimensionType; import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; import java.util.List; @@ -22,83 +22,83 @@ public class WorldViewUtil { - public static boolean isClient(WorldView world) { - return world.isClient(); + public static boolean isClient(LevelReader world) { + return world.isClientSide(); } - public static BlockState getBlockState(WorldView world, BlockPos pos) { + public static BlockState getBlockState(LevelReader world, BlockPos pos) { return world.getBlockState(pos); } - public static Block getBlock(WorldView world, BlockPos pos) { + public static Block getBlock(LevelReader world, BlockPos pos) { return getBlockState(world, pos).getBlock(); } - public static BlockEntity getBlockEntity(WorldView world, BlockPos pos) { + public static BlockEntity getBlockEntity(LevelReader world, BlockPos pos) { return world.getBlockEntity(pos); } - public static Optional getBlockEntity(WorldView world, BlockPos pos, BlockEntityType type) { + public static Optional getBlockEntity(LevelReader world, BlockPos pos, BlockEntityType type) { return world.getBlockEntity(pos, type); } - public static FluidState getFluidState(WorldView world, BlockPos pos) { + public static FluidState getFluidState(LevelReader world, BlockPos pos) { return getBlockState(world, pos).getFluidState(); } - public static Fluid getFluid(WorldView world, BlockPos pos) { - return getFluidState(world, pos).getFluid(); + public static Fluid getFluid(LevelReader world, BlockPos pos) { + return getFluidState(world, pos).getType(); } - public static int getBottomY(WorldView world) { - return world.getBottomY(); + public static int getBottomY(LevelReader world) { + return world.getMinY(); } - public static int getTopY(WorldView world) { - return world.getTopYInclusive(); + public static int getTopY(LevelReader world) { + return world.getMaxY(); } - public static boolean isChunkLoaded(WorldView world, BlockPos pos) { - return world.isChunkLoaded(pos); + public static boolean isChunkLoaded(LevelReader world, BlockPos pos) { + return world.hasChunkAt(pos); } - public static boolean isRegionLoaded(WorldView world, BlockPos min, BlockPos max) { - return world.isRegionLoaded(min, max); + public static boolean isRegionLoaded(LevelReader world, BlockPos min, BlockPos max) { + return world.hasChunksAt(min, max); } - public static DimensionType getDimensionType(WorldView world) { - return world.getDimension(); + public static DimensionType getDimensionType(LevelReader world) { + return world.dimensionType(); } - public static boolean isAirBlock(WorldView world, BlockPos pos) { + public static boolean isAirBlock(LevelReader world, BlockPos pos) { return getBlockState(world, pos).isAir(); } - public static boolean isOpaqueBlock(WorldView world, BlockPos pos) { - return getBlockState(world, pos).isOpaque(); + public static boolean isOpaqueBlock(LevelReader world, BlockPos pos) { + return getBlockState(world, pos).canOcclude(); } - public static boolean isWater(WorldView world, BlockPos pos) { - return getFluidState(world, pos).isIn(FluidTags.WATER); + public static boolean isWater(LevelReader world, BlockPos pos) { + return getFluidState(world, pos).is(FluidTags.WATER); } - public static List getEntitiesByClass(WorldAccess world, Class entityClass, Box box, Predicate predicate) { - return world.getEntitiesByClass(entityClass, box, predicate); + public static List getEntitiesByClass(LevelAccessor world, Class entityClass, AABB box, Predicate predicate) { + return world.getEntitiesOfClass(entityClass, box, predicate); } - public static List getEntitiesByClass(WorldAccess world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + public static List getEntitiesByClass(LevelAccessor world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { return getEntitiesByClass(world, entityClass, box.toMinecraft(), predicate); } - public static List getEntitiesByType(WorldAccess world, EntityType entityType, Box box, Predicate predicate) { - return world.getEntitiesByType(entityType, box, predicate); + public static List getEntitiesByType(LevelAccessor world, EntityType entityType, AABB box, Predicate predicate) { + return world.getEntities(entityType, box, predicate); } - public static List getEntitiesByType(WorldAccess world, EntityType entityType, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { + public static List getEntitiesByType(LevelAccessor world, EntityType entityType, net.pitan76.mcpitanlib.midohra.util.math.Box box, Predicate predicate) { return getEntitiesByType(world, entityType, box.toMinecraft(), predicate); } - public static List getEntitiesByType(WorldAccess world, EntityTypeWrapper entityType, Box box, Predicate predicate) { + public static List getEntitiesByType(LevelAccessor world, EntityTypeWrapper entityType, AABB box, Predicate predicate) { return getEntitiesByType(world, entityType.get(), box, predicate); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java b/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java index 9f8bdd766..b48fc0320 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.api.world; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.world.PersistentState; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.saveddata.SavedData; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -public abstract class CompatiblePersistentState extends PersistentState { +public abstract class CompatiblePersistentState extends SavedData { // 1.16 public CompatiblePersistentState(String key) { super(); @@ -17,22 +17,22 @@ public CompatiblePersistentState() { // 1.16 @Deprecated - public void readNbt(NbtCompound tag) { + public void readNbt(CompoundTag tag) { readNbt(new ReadNbtArgs(tag)); } public abstract void readNbt(ReadNbtArgs args); - public abstract NbtCompound writeNbt(WriteNbtArgs args); + public abstract CompoundTag writeNbt(WriteNbtArgs args); @Deprecated @Override - public void markDirty() { + public void setDirty() { callMarkDirty(); } public void callMarkDirty() { - super.markDirty(); + super.setDirty(); } @Deprecated diff --git a/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java b/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java index 865a2694f..6371fa909 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.world; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.util.WorldUtil; public class ExtendWorld { - public World world; - public ExtendWorld(World world) { + public Level world; + public ExtendWorld(Level world) { this.world = world; } @@ -42,7 +42,7 @@ public boolean isServer() { return WorldUtil.isServer(world); } - public World getMinecraftWorld() { + public Level getMinecraftWorld() { return world; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java b/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java index c93a48bcd..f67c68268 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.core.command; -import net.minecraft.server.command.ServerCommandSource; +import net.minecraft.commands.CommandSourceStack; public class CommandResult { private boolean isSuccess = false; private String message = ""; private int result = 0; private ErrorType errorType = ErrorType.NONE; - private ServerCommandSource source; + private CommandSourceStack source; public CommandResult() { @@ -50,11 +50,11 @@ public ErrorType getErrorType() { return errorType; } - public void setSource(ServerCommandSource source) { + public void setSource(CommandSourceStack source) { this.source = source; } - public ServerCommandSource getSource() { + public CommandSourceStack getSource() { return source; } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java b/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java index ccf22d47d..f9a095d99 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.core.mc1216; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.storage.NbtReadView; -import net.minecraft.storage.NbtWriteView; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ErrorReporter; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.util.ProblemReporter; import net.pitan76.mcpitanlib.api.nbt.NbtTypeBytes; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.util.NbtUtil; @@ -16,15 +16,15 @@ import java.util.Optional; public class NbtDataConverter { - public static void nbt2writeData(NbtCompound nbt, WriteView view) { + public static void nbt2writeData(CompoundTag nbt, ValueOutput view) { if (nbt == null || view == null) return; - List keys = new ArrayList<>(nbt.getKeys()); + List keys = new ArrayList<>(nbt.keySet()); for (String key : keys) { - NbtElement value = nbt.get(key); + Tag value = nbt.get(key); if (value == null) continue; - byte type = value.getType(); + byte type = value.getId(); view.putByte("__nbttype_" + key + "__", type); switch (type) { @@ -87,13 +87,13 @@ public static void nbt2writeData(NbtCompound nbt, WriteView view) { view.putIntArray(key, longIntArray); break; case NbtTypeBytes.COMPOUND: - Optional optionalCompound = value.asCompound(); + Optional optionalCompound = value.asCompound(); if (optionalCompound.isEmpty()) continue; - NbtCompound nbt2 = optionalCompound.get(); + CompoundTag nbt2 = optionalCompound.get(); //System.out.println("NbtDataConverter nbt(" + key + "): " + nbt2); - view.put(key, NbtCompound.CODEC, nbt2); + view.store(key, CompoundTag.CODEC, nbt2); break; } } @@ -101,60 +101,60 @@ public static void nbt2writeData(NbtCompound nbt, WriteView view) { view.putString("__all_keys__", String.join(",", keys)); } - public static void data2nbt(ReadView view, NbtCompound nbt) { + public static void data2nbt(ValueInput view, CompoundTag nbt) { if (view == null || nbt == null) return; // ReadViewだとgetKeys()がないので__all_keys__からキーを取得する - String keysStr = view.getString("__all_keys__", ""); + String keysStr = view.getStringOr("__all_keys__", ""); if (keysStr.isEmpty()) return; String[] keys = keysStr.split(","); for (String key : keys) { if (key == null || key.isEmpty()) continue; - byte type = view.getByte("__nbttype_" + key + "__", (byte) -1); + byte type = view.getByteOr("__nbttype_" + key + "__", (byte) -1); if (type == -1) continue; switch (type) { case NbtTypeBytes.BYTE: - nbt.putByte(key, view.getByte(key, (byte) 0)); + nbt.putByte(key, view.getByteOr(key, (byte) 0)); break; case NbtTypeBytes.SHORT: - nbt.putShort(key, (short) view.getShort(key, (short) 0)); + nbt.putShort(key, (short) view.getShortOr(key, (short) 0)); break; case NbtTypeBytes.INT: - nbt.putInt(key, view.getInt(key, 0)); + nbt.putInt(key, view.getIntOr(key, 0)); break; case NbtTypeBytes.LONG: - nbt.putLong(key, view.getLong(key, 0)); + nbt.putLong(key, view.getLongOr(key, 0)); break; case NbtTypeBytes.FLOAT: - nbt.putFloat(key, view.getFloat(key, 0)); + nbt.putFloat(key, view.getFloatOr(key, 0)); break; case NbtTypeBytes.DOUBLE: - nbt.putDouble(key, view.getDouble(key, 0)); + nbt.putDouble(key, view.getDoubleOr(key, 0)); break; case NbtTypeBytes.STRING: - nbt.putString(key, view.getString(key, "")); + nbt.putString(key, view.getStringOr(key, "")); break; case NbtTypeBytes.BYTE_ARRAY: - int[] intArray = view.getOptionalIntArray(key).get(); + int[] intArray = view.getIntArray(key).get(); byte[] byteArray = new byte[intArray.length]; for (int i = 0; i < intArray.length; i++) byteArray[i] = (byte) intArray[i]; nbt.putByteArray(key, byteArray); break; case NbtTypeBytes.INT_ARRAY: - nbt.putIntArray(key, view.getOptionalIntArray(key).get()); + nbt.putIntArray(key, view.getIntArray(key).get()); break; case NbtTypeBytes.LONG_ARRAY: - int[] longIntArray = view.getOptionalIntArray(key).get(); + int[] longIntArray = view.getIntArray(key).get(); long[] longArray = new long[longIntArray.length]; for (int i = 0; i < longIntArray.length; i++) longArray[i] = longIntArray[i] & 0xFFFFFFFFL; nbt.putLongArray(key, longArray); break; case NbtTypeBytes.COMPOUND: - NbtCompound nbt2 = view.read(key, NbtCompound.CODEC).get(); + CompoundTag nbt2 = view.read(key, CompoundTag.CODEC).get(); nbt.put(key, nbt2); break; default: @@ -164,34 +164,34 @@ public static void data2nbt(ReadView view, NbtCompound nbt) { } } - public static void data2nbt(WriteView view, NbtCompound nbt) { + public static void data2nbt(ValueOutput view, CompoundTag nbt) { if (view == null || nbt == null) return; - if (view instanceof NbtWriteView) { + if (view instanceof TagValueOutput) { //System.out.println("data2nbt(): " + ((NbtWriteView) view).getNbt()); - NbtUtil.copyFrom(((NbtWriteView) view).getNbt(), nbt); + NbtUtil.copyFrom(((TagValueOutput) view).buildResult(), nbt); } } - public static WriteView nbt2writeData(NbtCompound nbt, CompatRegistryLookup registryLookup) { - WriteView view = NbtWriteView.create(ErrorReporter.EMPTY); + public static ValueOutput nbt2writeData(CompoundTag nbt, CompatRegistryLookup registryLookup) { + ValueOutput view = TagValueOutput.createWithoutContext(ProblemReporter.DISCARDING); nbt2writeData(nbt, view); return view; } - public static ReadView nbt2readData(NbtCompound nbt, CompatRegistryLookup registryLookup) { + public static ValueInput nbt2readData(CompoundTag nbt, CompatRegistryLookup registryLookup) { if (nbt == null) nbt = NbtUtil.create(); - return NbtReadView.create(ErrorReporter.EMPTY, registryLookup.getRegistryLookup(), nbt); + return TagValueInput.create(ProblemReporter.DISCARDING, registryLookup.getRegistryLookup(), nbt); } - public static NbtCompound data2nbt(ReadView view) { - NbtCompound nbt = new NbtCompound(); + public static CompoundTag data2nbt(ValueInput view) { + CompoundTag nbt = new CompoundTag(); data2nbt(view, nbt); return nbt; } - public static NbtCompound data2nbt(WriteView view) { - NbtCompound nbt = new NbtCompound(); + public static CompoundTag data2nbt(ValueOutput view) { + CompoundTag nbt = new CompoundTag(); data2nbt(view, nbt); return nbt; } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java b/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java index da8cfdbe5..891659e48 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java @@ -1,31 +1,32 @@ package net.pitan76.mcpitanlib.core.network; import io.netty.buffer.ByteBufUtil; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.network.packet.CustomPayload; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type; import net.minecraft.resources.Identifier; import java.util.HashMap; import java.util.Map; -public class BufPayload implements CustomPayload { +public class BufPayload implements CustomPacketPayload { - public final Id ID; + public final Type ID; - public BufPayload(byte[] data, Id id) { + public BufPayload(byte[] data, Type id) { this.data = data; this.ID = id; createCodec(id); } - public BufPayload(PacketByteBuf buf, Id id) { + public BufPayload(FriendlyByteBuf buf, Type id) { this(ByteBufUtil.getBytes(buf), id); } - public BufPayload(PacketByteBuf buf, Identifier id) { + public BufPayload(FriendlyByteBuf buf, Identifier id) { this(ByteBufUtil.getBytes(buf), id(id)); } @@ -35,33 +36,33 @@ public byte[] getData() { return data; } - private static final Map, PacketCodec> CODEC_CACHE = new HashMap<>(); + private static final Map, StreamCodec> CODEC_CACHE = new HashMap<>(); - public static PacketCodec getCodec(Id id) { + public static StreamCodec getCodec(Type id) { if (CODEC_CACHE.containsKey(id)) return CODEC_CACHE.get(id); return createCodec(id); } - private static PacketCodec createCodec(Id id) { - PacketCodec codec = PacketCodecs.BYTE_ARRAY.xmap((data) -> new BufPayload(data, id), BufPayload::getData).cast(); + private static StreamCodec createCodec(Type id) { + StreamCodec codec = ByteBufCodecs.BYTE_ARRAY.map((data) -> new BufPayload(data, id), BufPayload::getData).cast(); CODEC_CACHE.put(id, codec); return codec; } @Override - public Id getId() { + public Type type() { return ID; } - public static Id id(Identifier id) { - if (CODEC_CACHE.isEmpty()) return new Id<>(id); + public static Type id(Identifier id) { + if (CODEC_CACHE.isEmpty()) return new Type<>(id); - for (Id key : CODEC_CACHE.keySet()) { + for (Type key : CODEC_CACHE.keySet()) { if (key.id().equals(id)) return key; } - return new Id<>(id); + return new Type<>(id); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java b/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java index 00902072b..34c7420d8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.core.player; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.entity.Player; public class ItemCooldown { @@ -14,7 +14,7 @@ public ItemCooldown(Player player) { public boolean isCoolingDown(Item item) { for (ItemStack stack : player.getMain()) { if (stack.getItem() == item) { - return player.getItemCooldownManager().isCoolingDown(stack); + return player.getItemCooldownManager().isOnCooldown(stack); } } @@ -24,7 +24,7 @@ public boolean isCoolingDown(Item item) { public void set(Item item, int duration) { for (ItemStack stack : player.getMain()) { if (stack.getItem() == item) { - player.getItemCooldownManager().set(stack, duration); + player.getItemCooldownManager().addCooldown(stack, duration); } } } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java index c3a3fade1..f43e44e4f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.core.registry; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; public class FuelRegistry { private FuelRegistry() { } - public static void register(int time, ItemConvertible... item) { + public static void register(int time, ItemLike... item) { dev.architectury.registry.fuel.FuelRegistry.register(time, item); } @@ -18,11 +18,11 @@ public static int get(ItemStack stack) { return 0; } - public static int get(World world, ItemStack stack) { - return world.getFuelRegistry().getFuelTicks(stack); + public static int get(Level world, ItemStack stack) { + return world.fuelValues().burnDuration(stack); } - public static boolean isFuel(World world, ItemStack stack) { - return world.getFuelRegistry().isFuel(stack); + public static boolean isFuel(Level world, ItemStack stack) { + return world.fuelValues().isFuel(stack); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java index 8d7214af0..74020ede8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java @@ -4,17 +4,17 @@ import dev.architectury.registry.registries.Registrar; import dev.architectury.registry.registries.RegistrarManager; import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.fluid.Fluid; -import net.minecraft.item.Item; -import net.minecraft.particle.ParticleType; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.item.Item; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; import java.util.function.Supplier; @@ -26,26 +26,26 @@ public class MCPLRegistry { public Registrar ITEMS; public Registrar BLOCKS; - public Registrar> SCREEN_HANDLER_TYPE; + public Registrar> SCREEN_HANDLER_TYPE; public Registrar> BLOCK_ENTITY_TYPE; public Registrar> ENTITY_TYPE; public Registrar SOUND_EVENT; public Registrar FLUID; public Registrar> PARTICLE_TYPE; - public Registrar STATUS_EFFECT; + public Registrar STATUS_EFFECT; public MCPLRegistry(String MOD_ID) { REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(MOD_ID)); - ITEMS = REGISTRIES.get().get(RegistryKeys.ITEM); - BLOCKS = REGISTRIES.get().get(RegistryKeys.BLOCK); - SCREEN_HANDLER_TYPE = REGISTRIES.get().get(RegistryKeys.SCREEN_HANDLER); - BLOCK_ENTITY_TYPE = REGISTRIES.get().get(RegistryKeys.BLOCK_ENTITY_TYPE); - ENTITY_TYPE = REGISTRIES.get().get(RegistryKeys.ENTITY_TYPE); - SOUND_EVENT = REGISTRIES.get().get(RegistryKeys.SOUND_EVENT); - FLUID = REGISTRIES.get().get(RegistryKeys.FLUID); - PARTICLE_TYPE = REGISTRIES.get().get(RegistryKeys.PARTICLE_TYPE); - STATUS_EFFECT = REGISTRIES.get().get(RegistryKeys.STATUS_EFFECT); + ITEMS = REGISTRIES.get().get(Registries.ITEM); + BLOCKS = REGISTRIES.get().get(Registries.BLOCK); + SCREEN_HANDLER_TYPE = REGISTRIES.get().get(Registries.MENU); + BLOCK_ENTITY_TYPE = REGISTRIES.get().get(Registries.BLOCK_ENTITY_TYPE); + ENTITY_TYPE = REGISTRIES.get().get(Registries.ENTITY_TYPE); + SOUND_EVENT = REGISTRIES.get().get(Registries.SOUND_EVENT); + FLUID = REGISTRIES.get().get(Registries.FLUID); + PARTICLE_TYPE = REGISTRIES.get().get(Registries.PARTICLE_TYPE); + STATUS_EFFECT = REGISTRIES.get().get(Registries.MOB_EFFECT); } public RegistrySupplier registryItem(Identifier id, Supplier supplier) { @@ -56,7 +56,7 @@ public RegistrySupplier registryBlock(Identifier id, Supplier supp return BLOCKS.register(id, supplier); } - public RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { + public RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { return SCREEN_HANDLER_TYPE.register(id, supplier); } @@ -85,7 +85,7 @@ public RegistrySupplier registryEnchantment(Identifier id, Supplier //return ENCHANTMENT.register(id, supplier); } - public RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { + public RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { return STATUS_EFFECT.register(id, supplier); } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java index c40c48718..6b851be33 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java @@ -2,8 +2,8 @@ import dev.architectury.registry.registries.DeferredRegister; import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.item.ItemGroup; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; @@ -14,29 +14,29 @@ @Deprecated public class MCPLRegistry1_20 { @Deprecated - public static final Map> REGISTRY_SUPPLIER_ITEM_GROUP_CACHE = new HashMap<>(); + public static final Map> REGISTRY_SUPPLIER_ITEM_GROUP_CACHE = new HashMap<>(); private final MCPLRegistry mcplr; - protected DeferredRegister ITEM_GROUP; + protected DeferredRegister ITEM_GROUP; public MCPLRegistry1_20(MCPLRegistry mcplr, String MOD_ID) { this.mcplr = mcplr; - ITEM_GROUP = DeferredRegister.create(MOD_ID, RegistryKeys.ITEM_GROUP); + ITEM_GROUP = DeferredRegister.create(MOD_ID, Registries.CREATIVE_MODE_TAB); } public void register() { ITEM_GROUP.register(); } - public RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { - RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); + public RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { + RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); return itemGroup; } - public RegistrySupplier registryItemGroup(Identifier id, CreativeTabBuilder builder) { - RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); + public RegistrySupplier registryItemGroup(Identifier id, CreativeTabBuilder builder) { + RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); return itemGroup; } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java index e642dc485..e9a3dcd79 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java @@ -2,8 +2,8 @@ import dev.architectury.registry.registries.DeferredRegister; import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.component.ComponentType; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; @@ -12,15 +12,15 @@ @Deprecated public class MCPLRegistry1_21 { - public final DeferredRegister> DATA_COMPONENT_TYPE; - public final DeferredRegister TICKET_TYPE; + public final DeferredRegister> DATA_COMPONENT_TYPE; + public final DeferredRegister TICKET_TYPE; private final MCPLRegistry mcplr; public MCPLRegistry1_21(MCPLRegistry mcplr, String MOD_ID) { this.mcplr = mcplr; - DATA_COMPONENT_TYPE = DeferredRegister.create(MOD_ID, RegistryKeys.DATA_COMPONENT_TYPE); - TICKET_TYPE = DeferredRegister.create(MOD_ID, RegistryKeys.TICKET_TYPE); + DATA_COMPONENT_TYPE = DeferredRegister.create(MOD_ID, Registries.DATA_COMPONENT_TYPE); + TICKET_TYPE = DeferredRegister.create(MOD_ID, Registries.TICKET_TYPE); } public void register() { @@ -28,12 +28,12 @@ public void register() { TICKET_TYPE.register(); } - public RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { + public RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { return DATA_COMPONENT_TYPE.register(id, supplier); } public Supplier> registryChunkTicketType(Identifier id, Supplier> supplier) { - RegistrySupplier ticketType = TICKET_TYPE.register(id, () -> supplier.get().getRaw()); + RegistrySupplier ticketType = TICKET_TYPE.register(id, () -> supplier.get().getRaw()); return () -> ChunkTicketType.of(ticketType.get()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java b/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java index a5a70af11..dce1d8b65 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java @@ -2,9 +2,9 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import net.pitan76.mcpitanlib.api.block.CompatStairsBlock; import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; @@ -41,11 +41,11 @@ public MapCodec getCodec() { return codec; } - public static RecordCodecBuilder createSettingsCodec() { - return AbstractBlock.Settings.CODEC.fieldOf("properties").forGetter(AbstractBlock::getSettings); + public static RecordCodecBuilder createSettingsCodec() { + return BlockBehaviour.Properties.CODEC.fieldOf("properties").forGetter(BlockBehaviour::properties); } - public static CompatMapCodec createCodec(Function blockFromSettings) { + public static CompatMapCodec createCodec(Function blockFromSettings) { return of(RecordCodecBuilder.mapCodec((instance) -> instance.group(createSettingsCodec()).apply(instance, blockFromSettings))); } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java b/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java index 12d5880b6..4a26ab39c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java @@ -2,8 +2,8 @@ import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import net.pitan76.mcpitanlib.api.block.CompatChestBlock; import net.pitan76.mcpitanlib.api.block.CompatPillarBlock; import net.pitan76.mcpitanlib.api.block.CompatSlabBlock; diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java index c928bb1f1..51352c74c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java @@ -2,11 +2,11 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.MenuAccess; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; @@ -18,29 +18,29 @@ import java.util.function.Supplier; public class GuiRegistry { - public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder.Factory factory) { + public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder.Factory factory) { return register(registry, id, new SimpleScreenHandlerTypeBuilder<>(factory)); } - public static Supplier> register(CompatRegistryV2 registry, CompatIdentifier id, ScreenHandlerType type) { + public static Supplier> register(CompatRegistryV2 registry, CompatIdentifier id, MenuType type) { return registry.registerScreenHandlerTypeSavingGenerics(id, () -> type); } @Environment(EnvType.CLIENT) - public static > void register(String id, ScreenHandlerType type, CompatRegistryClient.ScreenFactory factory) { - CompatRegistryClient.registerScreen(id, type, factory); + public static > void register(String id, MenuType type, CompatRegistryClient2.ScreenFactory factory) { + CompatRegistryClient2.registerScreen(id, type, factory); } @Environment(EnvType.CLIENT) - public static void registerSimpleContainerGui(String id, ScreenHandlerType type) { - CompatRegistryClient.registerScreen(id, type, SimpleContainerGuiScreen::new); + public static void registerSimpleContainerGui(String id, MenuType type) { + CompatRegistryClient2.registerScreen(id, type, SimpleContainerGuiScreen::new); } - public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { + public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { return registry.registerScreenHandlerType(id, builder); } - public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { + public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { return registry.registerScreenHandlerType(id, builder); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java index f6e88a29e..7c23e584d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.guilib.api.block.entity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java index dfa884739..cdb5c4868 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.guilib.api.block.entity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.text.Text; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; @@ -31,10 +31,10 @@ public ExtendedBlockEntityWithContainer(BlockEntityType type, TileCreateEvent public void tick(TileTickEvent e) { if (isClient()) return; - List players = WorldUtil.getPlayers(Objects.requireNonNull(getWorld())); + List players = WorldUtil.getPlayers(Objects.requireNonNull(getLevel())); for (Player player : players) { if (player.hasNetworkHandler() && player.getCurrentScreenHandler() instanceof ExtendedBlockEntityContainerGui && ((ExtendedBlockEntityContainerGui) player.getCurrentScreenHandler()).blockEntity == this ) { - PacketByteBuf buf = PacketByteUtil.create(); + FriendlyByteBuf buf = PacketByteUtil.create(); sync(player, buf); ServerNetworking.send(player, SYNC_GUI_WITH_TILE, buf); } @@ -42,18 +42,18 @@ public void tick(TileTickEvent e) { } @Override - public Text getDisplayName(DisplayNameArgs args) { - if (getCachedState() == null) + public Component getDisplayName(DisplayNameArgs args) { + if (getBlockState() == null) return TextUtil.of("unknown"); - return getCachedState().getBlock().getName(); + return getBlockState().getBlock().getName(); } @Override public void writeExtraData(ExtraDataArgs args) { - PacketByteUtil.writeBlockPos(args.buf, getPos()); + PacketByteUtil.writeBlockPos(args.buf, getBlockPos()); sync(args.getCompatPlayer(), args.buf); } - public abstract void sync(Player player, PacketByteBuf buf); + public abstract void sync(Player player, FriendlyByteBuf buf); } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java index 54445322c..e83ae3b09 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.guilib.api.container; -import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; public abstract class BlockEntityContainerGui extends ContainerGui implements ISimpleScreenInfo { - protected BlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + protected BlockEntityContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java index 04dcc52b3..82d4d223b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.guilib.api.container; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; @@ -14,13 +14,13 @@ public abstract class ContainerGui extends SimpleScreenHandler implements IScreenInfo { - private final List INVENTORIES = new ArrayList<>(); + private final List INVENTORIES = new ArrayList<>(); - protected ContainerGui(ScreenHandlerType type, int syncId) { + protected ContainerGui(MenuType type, int syncId) { super(type, syncId); } - protected ContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + protected ContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } @@ -31,8 +31,8 @@ public boolean canUse(Player player) { @Override protected Slot addSlot(Slot slot) { - if (slot.inventory instanceof Inventory && !INVENTORIES.contains(slot.inventory)) - INVENTORIES.add(slot.inventory); + if (slot.container instanceof Container && !INVENTORIES.contains(slot.container)) + INVENTORIES.add(slot.container); return super.addSlot(slot); } @@ -44,7 +44,7 @@ protected Slot addSlot(Slot slot) { public int playerHotbarY = 142; @Override - protected List addPlayerMainInventorySlots(PlayerInventory inventory, int x, int y) { + protected List addPlayerMainInventorySlots(Inventory inventory, int x, int y) { playerMainInventoryX = x; playerMainInventoryY = y; @@ -52,7 +52,7 @@ protected List addPlayerMainInventorySlots(PlayerInventory inventory, int } @Override - protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int y) { + protected List addPlayerHotbarSlots(Inventory inventory, int x, int y) { playerHotbarX = x; playerHotbarY = y; @@ -61,6 +61,6 @@ protected List addPlayerHotbarSlots(PlayerInventory inventory, int x, int @Override public void close(Player player) { - INVENTORIES.forEach((inv -> inv.onClose(player.getEntity()))); + INVENTORIES.forEach((inv -> inv.stopOpen(player.getEntity()))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java index 496c046c6..49d648d8f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.guilib.api.container; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; @@ -15,13 +15,13 @@ public abstract class ExtendedBlockEntityContainerGui type, CreateMenuEvent e, PacketByteBuf buf) { + public ExtendedBlockEntityContainerGui(MenuType type, CreateMenuEvent e, FriendlyByteBuf buf) { this(type, e); if (buf == null) return; Player player = e.getPlayer(); - World world = player.getWorld(); + Level world = player.getWorld(); BlockPos pos = buf.readBlockPos(); BlockEntity blockEntity = WorldUtil.getBlockEntity(world, pos); @@ -31,9 +31,9 @@ public ExtendedBlockEntityContainerGui(ScreenHandlerType type, CreateMenuEven receiveSync(buf); } - protected ExtendedBlockEntityContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + protected ExtendedBlockEntityContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } - public abstract void receiveSync(PacketByteBuf buf); + public abstract void receiveSync(FriendlyByteBuf buf); } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java index 46e5fb903..93cef2eeb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.guilib.api.container; -import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; public abstract class SimpleContainerGui extends ContainerGui implements ISimpleScreenInfo { - protected SimpleContainerGui(ScreenHandlerType type, int syncId) { + protected SimpleContainerGui(MenuType type, int syncId) { super(type, syncId); } - protected SimpleContainerGui(ScreenHandlerType type, CreateMenuEvent e) { + protected SimpleContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java index 0c23c9e94..fd9a2ce3a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.guilib.api.render; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.Slot; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; @@ -13,15 +13,15 @@ public static void drawSlot(DrawObjectDM drawObjectDM, Slot slot, int x, int y) RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x + slot.x - 1, y + slot.y - 1, 0, 0, 18, 18); } - public static void drawSlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { + public static void drawSlots(DrawObjectDM drawObjectDM, AbstractContainerMenu handler, int x, int y) { ScreenHandlerUtil.getSlots(handler).forEach((slot) -> drawSlot(drawObjectDM, slot, x, y)); } - public static void drawPlayerMainInventorySlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { + public static void drawPlayerMainInventorySlots(DrawObjectDM drawObjectDM, AbstractContainerMenu handler, int x, int y) { RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x, y, 0, 32, 162, 54); } - public static void drawPlayerHotbarSlots(DrawObjectDM drawObjectDM, ScreenHandler handler, int x, int y) { + public static void drawPlayerHotbarSlots(DrawObjectDM drawObjectDM, AbstractContainerMenu handler, int x, int y) { RendererUtil.drawTexture(drawObjectDM, GuiTextures.GUI_PARTS, x, y, 0, 90, 162, 18); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java index 70b6158eb..a724eedc2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.guilib.api.screen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; @@ -13,7 +13,7 @@ import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; public class ContainerGuiScreen extends CompatInventoryScreen { - public ContainerGuiScreen(T handler, PlayerInventory inventory, Text title) { + public ContainerGuiScreen(T handler, Inventory inventory, Component title) { super(handler, inventory, title); setBackgroundWidth(handler.getScreenBackgroundWidth()); setBackgroundHeight(handler.getScreenBackgroundHeight()); @@ -50,7 +50,7 @@ public void drawBackgroundOverride(DrawBackgroundArgs args) { @Override protected void drawForegroundOverride(DrawForegroundArgs args) { if (!handler.hasMainInventory && !containPlayerInventoryInBackground()) { - drawText(args.drawObjectDM, title, titleX, titleY); + drawText(args.drawObjectDM, title, titleLabelX, titleLabelY); return; } @@ -77,7 +77,7 @@ public boolean containPlayerInventoryInBackground() { @Override public void drawSlots(DrawObjectDM drawObjectDM) { ScreenHandlerUtil.getSlots(handler).forEach((slot) -> { - if (slot.inventory instanceof PlayerInventory || containPlayerInventoryInBackground()) + if (slot.container instanceof Inventory || containPlayerInventoryInBackground()) return; SlotRenderer.drawSlot(drawObjectDM, slot, x, y); diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java index 3ac5ebed4..eaf6812f3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.guilib.api.screen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; public class SimpleContainerGuiScreen extends ContainerGuiScreen { - public SimpleContainerGuiScreen(SimpleContainerGui handler, PlayerInventory inventory, Text title) { + public SimpleContainerGuiScreen(SimpleContainerGui handler, Inventory inventory, Component title) { super(handler, inventory, title); } diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java b/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java index f1ce318d4..2919a2a07 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.guilib.test; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.guilib.api.container.ContainerGui; public class TestContainer extends ContainerGui { - public TestContainer(ScreenHandlerType type, int syncId) { + public TestContainer(MenuType type, int syncId) { super(type, syncId); } - public TestContainer(int i, PlayerInventory inventory) { + public TestContainer(int i, Inventory inventory) { this(null, i); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java b/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java index ba5f4535e..5bf5c3a8b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.midohra; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.CreativeModeTab; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; @@ -27,7 +27,7 @@ public static ItemWrapper of(Item item) { return ItemWrapper.of(item); } - public static ItemGroupWrapper of(ItemGroup itemGroup) { + public static ItemGroupWrapper of(CreativeModeTab itemGroup) { return ItemGroupWrapper.of(itemGroup); } public static BlockWrapper of(Block block) { @@ -46,55 +46,55 @@ public static BlockEntityWrapper of(BlockEntity blockEntity) { return BlockEntityWrapper.of(blockEntity); } - public static FluidWrapper of(net.minecraft.fluid.Fluid fluid) { + public static FluidWrapper of(net.minecraft.world.level.material.Fluid fluid) { return FluidWrapper.of(fluid); } - public static BlockState of(net.minecraft.block.BlockState state) { + public static BlockState of(net.minecraft.world.level.block.state.BlockState state) { return BlockState.of(state); } - public static NbtElement of(net.minecraft.nbt.NbtElement nbt) { + public static NbtElement of(net.minecraft.nbt.Tag nbt) { return NbtElement.of(nbt); } - public static NbtCompound of(net.minecraft.nbt.NbtCompound nbt) { + public static NbtCompound of(net.minecraft.nbt.CompoundTag nbt) { return NbtCompound.of(nbt); } - public static NbtList of(net.minecraft.nbt.NbtList nbt) { + public static NbtList of(net.minecraft.nbt.ListTag nbt) { return NbtList.of(nbt); } - public static BlockPos of(net.minecraft.util.math.BlockPos pos) { + public static BlockPos of(net.minecraft.core.BlockPos pos) { return BlockPos.of(pos); } - public static Direction of(net.minecraft.util.math.Direction direction) { + public static Direction of(net.minecraft.core.Direction direction) { return Direction.of(direction); } - public static World of(net.minecraft.world.World world) { + public static World of(net.minecraft.world.level.Level world) { return World.of(world); } - public static WorldView of(net.minecraft.world.WorldView world) { + public static WorldView of(net.minecraft.world.level.LevelReader world) { return WorldView.of(world); } - public static WorldAccess of(net.minecraft.world.WorldAccess world) { + public static WorldAccess of(net.minecraft.world.level.LevelAccessor world) { return WorldAccess.of(world); } - public static BlockView of(net.minecraft.world.BlockView world) { + public static BlockView of(net.minecraft.world.level.BlockGetter world) { return BlockView.of(world); } - public static IWorldView asWV(net.minecraft.world.WorldView world) { + public static IWorldView asWV(net.minecraft.world.level.LevelReader world) { return of(world); } - public static IWorldView asWV(net.minecraft.world.BlockView world) { + public static IWorldView asWV(net.minecraft.world.level.BlockGetter world) { return of(world); } @@ -102,7 +102,7 @@ public static Item raw(ItemWrapper item) { return item.get(); } - public static ItemGroup raw(ItemGroupWrapper itemGroup) { + public static CreativeModeTab raw(ItemGroupWrapper itemGroup) { return itemGroup.get(); } @@ -114,47 +114,47 @@ public static BlockEntity raw(BlockEntityWrapper blockEntity) { return blockEntity.get(); } - public static net.minecraft.fluid.Fluid raw(FluidWrapper fluid) { + public static net.minecraft.world.level.material.Fluid raw(FluidWrapper fluid) { return fluid.get(); } - public static net.minecraft.block.BlockState raw(BlockState state) { + public static net.minecraft.world.level.block.state.BlockState raw(BlockState state) { return state.toMinecraft(); } - public static net.minecraft.nbt.NbtElement raw(NbtElement nbt) { + public static net.minecraft.nbt.Tag raw(NbtElement nbt) { return nbt.toMinecraft(); } - public static net.minecraft.nbt.NbtCompound raw(NbtCompound nbt) { + public static net.minecraft.nbt.CompoundTag raw(NbtCompound nbt) { return nbt.toMinecraft(); } - public static net.minecraft.nbt.NbtList raw(NbtList nbt) { + public static net.minecraft.nbt.ListTag raw(NbtList nbt) { return nbt.toMinecraft(); } - public static net.minecraft.util.math.BlockPos raw(BlockPos pos) { + public static net.minecraft.core.BlockPos raw(BlockPos pos) { return pos.toMinecraft(); } - public static net.minecraft.util.math.Direction raw(Direction direction) { + public static net.minecraft.core.Direction raw(Direction direction) { return direction.toMinecraft(); } - public static net.minecraft.world.World raw(World world) { + public static net.minecraft.world.level.Level raw(World world) { return world.toMinecraft(); } - public static net.minecraft.world.WorldView raw(WorldView world) { + public static net.minecraft.world.level.LevelReader raw(WorldView world) { return world.toMinecraft(); } - public static net.minecraft.world.WorldAccess raw(WorldAccess world) { + public static net.minecraft.world.level.LevelAccessor raw(WorldAccess world) { return world.toMinecraft(); } - public static net.minecraft.world.BlockView raw(BlockView world) { + public static net.minecraft.world.level.BlockGetter raw(BlockView world) { return world.toMinecraft(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java index 20af1535a..fe1b8f495 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.block; -import net.minecraft.state.property.Property; +import net.minecraft.world.level.block.state.properties.Property; import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; import net.pitan76.mcpitanlib.api.state.property.IProperty; @@ -10,21 +10,21 @@ import net.pitan76.mcpitanlib.midohra.world.World; public class BlockState { - private final net.minecraft.block.BlockState state; + private final net.minecraft.world.level.block.state.BlockState state; private BlockWrapper blockWrapper; - protected BlockState(net.minecraft.block.BlockState state) { + protected BlockState(net.minecraft.world.level.block.state.BlockState state) { this.state = state; } - public static BlockState of(net.minecraft.block.BlockState state) { + public static BlockState of(net.minecraft.world.level.block.state.BlockState state) { return new BlockState(state); } - public static BlockState of(net.minecraft.block.Block block) { + public static BlockState of(net.minecraft.world.level.block.Block block) { if (block == null) - return of((net.minecraft.block.BlockState) null); + return of((net.minecraft.world.level.block.state.BlockState) null); return of(BlockStateUtil.getDefaultState(block)); } @@ -56,12 +56,12 @@ public String getName() { return getBlock().getName(); } - public net.minecraft.block.BlockState toMinecraft() { + public net.minecraft.world.level.block.state.BlockState toMinecraft() { return state; } public , V extends T> BlockState with(Property property, V value) { - return of(toMinecraft().with(property, value)); + return of(toMinecraft().setValue(property, value)); } public , V extends T> BlockState with(IProperty property, V value) { @@ -85,7 +85,7 @@ public BlockState cycle(DirectionProperty property) { } public > T get(Property property) { - return toMinecraft().get(property); + return toMinecraft().getValue(property); } public > T get(IProperty property) { @@ -97,7 +97,7 @@ public net.pitan76.mcpitanlib.midohra.util.math.Direction get(DirectionProperty } public > boolean contains(Property property) { - return toMinecraft().contains(property); + return toMinecraft().hasProperty(property); } public > boolean contains(IProperty property) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java index d54771d9e..ec5330103 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -10,17 +10,17 @@ import java.util.Optional; public class BlockWrapper { - private final net.minecraft.block.Block block; + private final net.minecraft.world.level.block.Block block; protected BlockWrapper() { this.block = null; } - protected BlockWrapper(net.minecraft.block.Block block) { + protected BlockWrapper(net.minecraft.world.level.block.Block block) { this.block = block; } - public static BlockWrapper of(net.minecraft.block.Block block) { + public static BlockWrapper of(net.minecraft.world.level.block.Block block) { return new BlockWrapper(block); } @@ -55,11 +55,11 @@ public boolean isEmpty() { } @Nullable - public net.minecraft.block.Block get() { + public net.minecraft.world.level.block.Block get() { return block; } - public net.minecraft.block.Block gerOrDefault(net.minecraft.block.Block defaultItem) { + public net.minecraft.world.level.block.Block gerOrDefault(net.minecraft.world.level.block.Block defaultItem) { return isEmpty() ? defaultItem : get(); } @@ -117,7 +117,7 @@ public static BlockWrapper of(String namespace, String path) { } public static BlockWrapper of(CompatBlock block) { - return of((net.minecraft.block.Block) block); + return of((net.minecraft.world.level.block.Block) block); } public Optional toCompatBlock() { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java index 4841d1b52..693ffa8cf 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java @@ -1,771 +1,771 @@ package net.pitan76.mcpitanlib.midohra.block; public class Blocks { - public static BlockWrapper AIR = of(net.minecraft.block.Blocks.AIR); - public static BlockWrapper STONE = of(net.minecraft.block.Blocks.STONE); - public static BlockWrapper GRANITE = of(net.minecraft.block.Blocks.GRANITE); - public static BlockWrapper POLISHED_GRANITE = of(net.minecraft.block.Blocks.POLISHED_GRANITE); - public static BlockWrapper DIORITE = of(net.minecraft.block.Blocks.DIORITE); - public static BlockWrapper POLISHED_DIORITE = of(net.minecraft.block.Blocks.POLISHED_DIORITE); - public static BlockWrapper ANDESITE = of(net.minecraft.block.Blocks.ANDESITE); - public static BlockWrapper POLISHED_ANDESITE = of(net.minecraft.block.Blocks.POLISHED_ANDESITE); - public static BlockWrapper GRASS_BLOCK = of(net.minecraft.block.Blocks.GRASS_BLOCK); - public static BlockWrapper DIRT = of(net.minecraft.block.Blocks.DIRT); - public static BlockWrapper COARSE_DIRT = of(net.minecraft.block.Blocks.COARSE_DIRT); - public static BlockWrapper PODZOL = of(net.minecraft.block.Blocks.PODZOL); - public static BlockWrapper COBBLESTONE = of(net.minecraft.block.Blocks.COBBLESTONE); - public static BlockWrapper OAK_PLANKS = of(net.minecraft.block.Blocks.OAK_PLANKS); - public static BlockWrapper SPRUCE_PLANKS = of(net.minecraft.block.Blocks.SPRUCE_PLANKS); - public static BlockWrapper BIRCH_PLANKS = of(net.minecraft.block.Blocks.BIRCH_PLANKS); - public static BlockWrapper JUNGLE_PLANKS = of(net.minecraft.block.Blocks.JUNGLE_PLANKS); - public static BlockWrapper ACACIA_PLANKS = of(net.minecraft.block.Blocks.ACACIA_PLANKS); - public static BlockWrapper DARK_OAK_PLANKS = of(net.minecraft.block.Blocks.DARK_OAK_PLANKS); - public static BlockWrapper OAK_SAPLING = of(net.minecraft.block.Blocks.OAK_SAPLING); - public static BlockWrapper SPRUCE_SAPLING = of(net.minecraft.block.Blocks.SPRUCE_SAPLING); - public static BlockWrapper BIRCH_SAPLING = of(net.minecraft.block.Blocks.BIRCH_SAPLING); - public static BlockWrapper JUNGLE_SAPLING = of(net.minecraft.block.Blocks.JUNGLE_SAPLING); - public static BlockWrapper ACACIA_SAPLING = of(net.minecraft.block.Blocks.ACACIA_SAPLING); - public static BlockWrapper DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.DARK_OAK_SAPLING); - public static BlockWrapper BEDROCK = of(net.minecraft.block.Blocks.BEDROCK); - public static BlockWrapper WATER = of(net.minecraft.block.Blocks.WATER); - public static BlockWrapper LAVA = of(net.minecraft.block.Blocks.LAVA); - public static BlockWrapper SAND = of(net.minecraft.block.Blocks.SAND); - public static BlockWrapper RED_SAND = of(net.minecraft.block.Blocks.RED_SAND); - public static BlockWrapper GRAVEL = of(net.minecraft.block.Blocks.GRAVEL); - public static BlockWrapper GOLD_ORE = of(net.minecraft.block.Blocks.GOLD_ORE); - public static BlockWrapper IRON_ORE = of(net.minecraft.block.Blocks.IRON_ORE); - public static BlockWrapper COAL_ORE = of(net.minecraft.block.Blocks.COAL_ORE); - public static BlockWrapper NETHER_GOLD_ORE = of(net.minecraft.block.Blocks.NETHER_GOLD_ORE); - public static BlockWrapper OAK_LOG = of(net.minecraft.block.Blocks.OAK_LOG); - public static BlockWrapper SPRUCE_LOG = of(net.minecraft.block.Blocks.SPRUCE_LOG); - public static BlockWrapper BIRCH_LOG = of(net.minecraft.block.Blocks.BIRCH_LOG); - public static BlockWrapper JUNGLE_LOG = of(net.minecraft.block.Blocks.JUNGLE_LOG); - public static BlockWrapper ACACIA_LOG = of(net.minecraft.block.Blocks.ACACIA_LOG); - public static BlockWrapper DARK_OAK_LOG = of(net.minecraft.block.Blocks.DARK_OAK_LOG); - public static BlockWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_LOG); - public static BlockWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_LOG); - public static BlockWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_LOG); - public static BlockWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_LOG); - public static BlockWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_LOG); - public static BlockWrapper STRIPPED_OAK_LOG = of(net.minecraft.block.Blocks.STRIPPED_OAK_LOG); - public static BlockWrapper OAK_WOOD = of(net.minecraft.block.Blocks.OAK_WOOD); - public static BlockWrapper SPRUCE_WOOD = of(net.minecraft.block.Blocks.SPRUCE_WOOD); - public static BlockWrapper BIRCH_WOOD = of(net.minecraft.block.Blocks.BIRCH_WOOD); - public static BlockWrapper JUNGLE_WOOD = of(net.minecraft.block.Blocks.JUNGLE_WOOD); - public static BlockWrapper ACACIA_WOOD = of(net.minecraft.block.Blocks.ACACIA_WOOD); - public static BlockWrapper DARK_OAK_WOOD = of(net.minecraft.block.Blocks.DARK_OAK_WOOD); - public static BlockWrapper STRIPPED_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_OAK_WOOD); - public static BlockWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_SPRUCE_WOOD); - public static BlockWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.block.Blocks.STRIPPED_BIRCH_WOOD); - public static BlockWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.block.Blocks.STRIPPED_JUNGLE_WOOD); - public static BlockWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.block.Blocks.STRIPPED_ACACIA_WOOD); - public static BlockWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.block.Blocks.STRIPPED_DARK_OAK_WOOD); - public static BlockWrapper OAK_LEAVES = of(net.minecraft.block.Blocks.OAK_LEAVES); - public static BlockWrapper SPRUCE_LEAVES = of(net.minecraft.block.Blocks.SPRUCE_LEAVES); - public static BlockWrapper BIRCH_LEAVES = of(net.minecraft.block.Blocks.BIRCH_LEAVES); - public static BlockWrapper JUNGLE_LEAVES = of(net.minecraft.block.Blocks.JUNGLE_LEAVES); - public static BlockWrapper ACACIA_LEAVES = of(net.minecraft.block.Blocks.ACACIA_LEAVES); - public static BlockWrapper DARK_OAK_LEAVES = of(net.minecraft.block.Blocks.DARK_OAK_LEAVES); - public static BlockWrapper SPONGE = of(net.minecraft.block.Blocks.SPONGE); - public static BlockWrapper WET_SPONGE = of(net.minecraft.block.Blocks.WET_SPONGE); - public static BlockWrapper GLASS = of(net.minecraft.block.Blocks.GLASS); - public static BlockWrapper LAPIS_ORE = of(net.minecraft.block.Blocks.LAPIS_ORE); - public static BlockWrapper LAPIS_BLOCK = of(net.minecraft.block.Blocks.LAPIS_BLOCK); - public static BlockWrapper DISPENSER = of(net.minecraft.block.Blocks.DISPENSER); - public static BlockWrapper SANDSTONE = of(net.minecraft.block.Blocks.SANDSTONE); - public static BlockWrapper CHISELED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_SANDSTONE); - public static BlockWrapper CUT_SANDSTONE = of(net.minecraft.block.Blocks.CUT_SANDSTONE); - public static BlockWrapper NOTE_BLOCK = of(net.minecraft.block.Blocks.NOTE_BLOCK); - public static BlockWrapper WHITE_BED = of(net.minecraft.block.Blocks.WHITE_BED); - public static BlockWrapper ORANGE_BED = of(net.minecraft.block.Blocks.ORANGE_BED); - public static BlockWrapper MAGENTA_BED = of(net.minecraft.block.Blocks.MAGENTA_BED); - public static BlockWrapper LIGHT_BLUE_BED = of(net.minecraft.block.Blocks.LIGHT_BLUE_BED); - public static BlockWrapper YELLOW_BED = of(net.minecraft.block.Blocks.YELLOW_BED); - public static BlockWrapper LIME_BED = of(net.minecraft.block.Blocks.LIME_BED); - public static BlockWrapper PINK_BED = of(net.minecraft.block.Blocks.PINK_BED); - public static BlockWrapper GRAY_BED = of(net.minecraft.block.Blocks.GRAY_BED); - public static BlockWrapper LIGHT_GRAY_BED = of(net.minecraft.block.Blocks.LIGHT_GRAY_BED); - public static BlockWrapper CYAN_BED = of(net.minecraft.block.Blocks.CYAN_BED); - public static BlockWrapper PURPLE_BED = of(net.minecraft.block.Blocks.PURPLE_BED); - public static BlockWrapper BLUE_BED = of(net.minecraft.block.Blocks.BLUE_BED); - public static BlockWrapper BROWN_BED = of(net.minecraft.block.Blocks.BROWN_BED); - public static BlockWrapper GREEN_BED = of(net.minecraft.block.Blocks.GREEN_BED); - public static BlockWrapper RED_BED = of(net.minecraft.block.Blocks.RED_BED); - public static BlockWrapper BLACK_BED = of(net.minecraft.block.Blocks.BLACK_BED); - public static BlockWrapper POWERED_RAIL = of(net.minecraft.block.Blocks.POWERED_RAIL); - public static BlockWrapper DETECTOR_RAIL = of(net.minecraft.block.Blocks.DETECTOR_RAIL); - public static BlockWrapper STICKY_PISTON = of(net.minecraft.block.Blocks.STICKY_PISTON); - public static BlockWrapper COBWEB = of(net.minecraft.block.Blocks.COBWEB); - public static BlockWrapper GRASS = of(net.minecraft.block.Blocks.SHORT_GRASS); - public static BlockWrapper FERN = of(net.minecraft.block.Blocks.FERN); - public static BlockWrapper DEAD_BUSH = of(net.minecraft.block.Blocks.DEAD_BUSH); - public static BlockWrapper SEAGRASS = of(net.minecraft.block.Blocks.SEAGRASS); - public static BlockWrapper TALL_SEAGRASS = of(net.minecraft.block.Blocks.TALL_SEAGRASS); - public static BlockWrapper PISTON = of(net.minecraft.block.Blocks.PISTON); - public static BlockWrapper PISTON_HEAD = of(net.minecraft.block.Blocks.PISTON_HEAD); - public static BlockWrapper WHITE_WOOL = of(net.minecraft.block.Blocks.WHITE_WOOL); - public static BlockWrapper ORANGE_WOOL = of(net.minecraft.block.Blocks.ORANGE_WOOL); - public static BlockWrapper MAGENTA_WOOL = of(net.minecraft.block.Blocks.MAGENTA_WOOL); - public static BlockWrapper LIGHT_BLUE_WOOL = of(net.minecraft.block.Blocks.LIGHT_BLUE_WOOL); - public static BlockWrapper YELLOW_WOOL = of(net.minecraft.block.Blocks.YELLOW_WOOL); - public static BlockWrapper LIME_WOOL = of(net.minecraft.block.Blocks.LIME_WOOL); - public static BlockWrapper PINK_WOOL = of(net.minecraft.block.Blocks.PINK_WOOL); - public static BlockWrapper GRAY_WOOL = of(net.minecraft.block.Blocks.GRAY_WOOL); - public static BlockWrapper LIGHT_GRAY_WOOL = of(net.minecraft.block.Blocks.LIGHT_GRAY_WOOL); - public static BlockWrapper CYAN_WOOL = of(net.minecraft.block.Blocks.CYAN_WOOL); - public static BlockWrapper PURPLE_WOOL = of(net.minecraft.block.Blocks.PURPLE_WOOL); - public static BlockWrapper BLUE_WOOL = of(net.minecraft.block.Blocks.BLUE_WOOL); - public static BlockWrapper BROWN_WOOL = of(net.minecraft.block.Blocks.BROWN_WOOL); - public static BlockWrapper GREEN_WOOL = of(net.minecraft.block.Blocks.GREEN_WOOL); - public static BlockWrapper RED_WOOL = of(net.minecraft.block.Blocks.RED_WOOL); - public static BlockWrapper BLACK_WOOL = of(net.minecraft.block.Blocks.BLACK_WOOL); - public static BlockWrapper MOVING_PISTON = of(net.minecraft.block.Blocks.MOVING_PISTON); - public static BlockWrapper DANDELION = of(net.minecraft.block.Blocks.DANDELION); - public static BlockWrapper POPPY = of(net.minecraft.block.Blocks.POPPY); - public static BlockWrapper BLUE_ORCHID = of(net.minecraft.block.Blocks.BLUE_ORCHID); - public static BlockWrapper ALLIUM = of(net.minecraft.block.Blocks.ALLIUM); - public static BlockWrapper AZURE_BLUET = of(net.minecraft.block.Blocks.AZURE_BLUET); - public static BlockWrapper RED_TULIP = of(net.minecraft.block.Blocks.RED_TULIP); - public static BlockWrapper ORANGE_TULIP = of(net.minecraft.block.Blocks.ORANGE_TULIP); - public static BlockWrapper WHITE_TULIP = of(net.minecraft.block.Blocks.WHITE_TULIP); - public static BlockWrapper PINK_TULIP = of(net.minecraft.block.Blocks.PINK_TULIP); - public static BlockWrapper OXEYE_DAISY = of(net.minecraft.block.Blocks.OXEYE_DAISY); - public static BlockWrapper CORNFLOWER = of(net.minecraft.block.Blocks.CORNFLOWER); - public static BlockWrapper WITHER_ROSE = of(net.minecraft.block.Blocks.WITHER_ROSE); - public static BlockWrapper LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.LILY_OF_THE_VALLEY); - public static BlockWrapper BROWN_MUSHROOM = of(net.minecraft.block.Blocks.BROWN_MUSHROOM); - public static BlockWrapper RED_MUSHROOM = of(net.minecraft.block.Blocks.RED_MUSHROOM); - public static BlockWrapper GOLD_BLOCK = of(net.minecraft.block.Blocks.GOLD_BLOCK); - public static BlockWrapper IRON_BLOCK = of(net.minecraft.block.Blocks.IRON_BLOCK); - public static BlockWrapper BRICKS = of(net.minecraft.block.Blocks.BRICKS); - public static BlockWrapper TNT = of(net.minecraft.block.Blocks.TNT); - public static BlockWrapper BOOKSHELF = of(net.minecraft.block.Blocks.BOOKSHELF); - public static BlockWrapper MOSSY_COBBLESTONE = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE); - public static BlockWrapper OBSIDIAN = of(net.minecraft.block.Blocks.OBSIDIAN); - public static BlockWrapper TORCH = of(net.minecraft.block.Blocks.TORCH); - public static BlockWrapper WALL_TORCH = of(net.minecraft.block.Blocks.WALL_TORCH); - public static BlockWrapper FIRE = of(net.minecraft.block.Blocks.FIRE); - public static BlockWrapper SOUL_FIRE = of(net.minecraft.block.Blocks.SOUL_FIRE); - public static BlockWrapper SPAWNER = of(net.minecraft.block.Blocks.SPAWNER); - public static BlockWrapper OAK_STAIRS = of(net.minecraft.block.Blocks.OAK_STAIRS); - public static BlockWrapper CHEST = of(net.minecraft.block.Blocks.CHEST); - public static BlockWrapper REDSTONE_WIRE = of(net.minecraft.block.Blocks.REDSTONE_WIRE); - public static BlockWrapper DIAMOND_ORE = of(net.minecraft.block.Blocks.DIAMOND_ORE); - public static BlockWrapper DIAMOND_BLOCK = of(net.minecraft.block.Blocks.DIAMOND_BLOCK); - public static BlockWrapper CRAFTING_TABLE = of(net.minecraft.block.Blocks.CRAFTING_TABLE); - public static BlockWrapper WHEAT = of(net.minecraft.block.Blocks.WHEAT); - public static BlockWrapper FARMLAND = of(net.minecraft.block.Blocks.FARMLAND); - public static BlockWrapper FURNACE = of(net.minecraft.block.Blocks.FURNACE); - public static BlockWrapper OAK_SIGN = of(net.minecraft.block.Blocks.OAK_SIGN); - public static BlockWrapper SPRUCE_SIGN = of(net.minecraft.block.Blocks.SPRUCE_SIGN); - public static BlockWrapper BIRCH_SIGN = of(net.minecraft.block.Blocks.BIRCH_SIGN); - public static BlockWrapper ACACIA_SIGN = of(net.minecraft.block.Blocks.ACACIA_SIGN); - public static BlockWrapper JUNGLE_SIGN = of(net.minecraft.block.Blocks.JUNGLE_SIGN); - public static BlockWrapper DARK_OAK_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_SIGN); - public static BlockWrapper OAK_DOOR = of(net.minecraft.block.Blocks.OAK_DOOR); - public static BlockWrapper LADDER = of(net.minecraft.block.Blocks.LADDER); - public static BlockWrapper RAIL = of(net.minecraft.block.Blocks.RAIL); - public static BlockWrapper COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.COBBLESTONE_STAIRS); - public static BlockWrapper OAK_WALL_SIGN = of(net.minecraft.block.Blocks.OAK_WALL_SIGN); - public static BlockWrapper SPRUCE_WALL_SIGN = of(net.minecraft.block.Blocks.SPRUCE_WALL_SIGN); - public static BlockWrapper BIRCH_WALL_SIGN = of(net.minecraft.block.Blocks.BIRCH_WALL_SIGN); - public static BlockWrapper ACACIA_WALL_SIGN = of(net.minecraft.block.Blocks.ACACIA_WALL_SIGN); - public static BlockWrapper JUNGLE_WALL_SIGN = of(net.minecraft.block.Blocks.JUNGLE_WALL_SIGN); - public static BlockWrapper DARK_OAK_WALL_SIGN = of(net.minecraft.block.Blocks.DARK_OAK_WALL_SIGN); - public static BlockWrapper LEVER = of(net.minecraft.block.Blocks.LEVER); - public static BlockWrapper STONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.STONE_PRESSURE_PLATE); - public static BlockWrapper IRON_DOOR = of(net.minecraft.block.Blocks.IRON_DOOR); - public static BlockWrapper OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.OAK_PRESSURE_PLATE); - public static BlockWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.SPRUCE_PRESSURE_PLATE); - public static BlockWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.block.Blocks.BIRCH_PRESSURE_PLATE); - public static BlockWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.JUNGLE_PRESSURE_PLATE); - public static BlockWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.block.Blocks.ACACIA_PRESSURE_PLATE); - public static BlockWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.block.Blocks.DARK_OAK_PRESSURE_PLATE); - public static BlockWrapper REDSTONE_ORE = of(net.minecraft.block.Blocks.REDSTONE_ORE); - public static BlockWrapper REDSTONE_TORCH = of(net.minecraft.block.Blocks.REDSTONE_TORCH); - public static BlockWrapper REDSTONE_WALL_TORCH = of(net.minecraft.block.Blocks.REDSTONE_WALL_TORCH); - public static BlockWrapper STONE_BUTTON = of(net.minecraft.block.Blocks.STONE_BUTTON); - public static BlockWrapper SNOW = of(net.minecraft.block.Blocks.SNOW); - public static BlockWrapper ICE = of(net.minecraft.block.Blocks.ICE); - public static BlockWrapper SNOW_BLOCK = of(net.minecraft.block.Blocks.SNOW_BLOCK); - public static BlockWrapper CACTUS = of(net.minecraft.block.Blocks.CACTUS); - public static BlockWrapper CLAY = of(net.minecraft.block.Blocks.CLAY); - public static BlockWrapper SUGAR_CANE = of(net.minecraft.block.Blocks.SUGAR_CANE); - public static BlockWrapper JUKEBOX = of(net.minecraft.block.Blocks.JUKEBOX); - public static BlockWrapper OAK_FENCE = of(net.minecraft.block.Blocks.OAK_FENCE); - public static BlockWrapper PUMPKIN = of(net.minecraft.block.Blocks.PUMPKIN); - public static BlockWrapper NETHERRACK = of(net.minecraft.block.Blocks.NETHERRACK); - public static BlockWrapper SOUL_SAND = of(net.minecraft.block.Blocks.SOUL_SAND); - public static BlockWrapper SOUL_SOIL = of(net.minecraft.block.Blocks.SOUL_SOIL); - public static BlockWrapper BASALT = of(net.minecraft.block.Blocks.BASALT); - public static BlockWrapper POLISHED_BASALT = of(net.minecraft.block.Blocks.POLISHED_BASALT); - public static BlockWrapper SOUL_TORCH = of(net.minecraft.block.Blocks.SOUL_TORCH); - public static BlockWrapper SOUL_WALL_TORCH = of(net.minecraft.block.Blocks.SOUL_WALL_TORCH); - public static BlockWrapper GLOWSTONE = of(net.minecraft.block.Blocks.GLOWSTONE); - public static BlockWrapper NETHER_PORTAL = of(net.minecraft.block.Blocks.NETHER_PORTAL); - public static BlockWrapper CARVED_PUMPKIN = of(net.minecraft.block.Blocks.CARVED_PUMPKIN); - public static BlockWrapper JACK_O_LANTERN = of(net.minecraft.block.Blocks.JACK_O_LANTERN); - public static BlockWrapper CAKE = of(net.minecraft.block.Blocks.CAKE); - public static BlockWrapper REPEATER = of(net.minecraft.block.Blocks.REPEATER); - public static BlockWrapper WHITE_STAINED_GLASS = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS); - public static BlockWrapper ORANGE_STAINED_GLASS = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS); - public static BlockWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS); - public static BlockWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS); - public static BlockWrapper YELLOW_STAINED_GLASS = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS); - public static BlockWrapper LIME_STAINED_GLASS = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS); - public static BlockWrapper PINK_STAINED_GLASS = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS); - public static BlockWrapper GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS); - public static BlockWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS); - public static BlockWrapper CYAN_STAINED_GLASS = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS); - public static BlockWrapper PURPLE_STAINED_GLASS = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS); - public static BlockWrapper BLUE_STAINED_GLASS = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS); - public static BlockWrapper BROWN_STAINED_GLASS = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS); - public static BlockWrapper GREEN_STAINED_GLASS = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS); - public static BlockWrapper RED_STAINED_GLASS = of(net.minecraft.block.Blocks.RED_STAINED_GLASS); - public static BlockWrapper BLACK_STAINED_GLASS = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS); - public static BlockWrapper OAK_TRAPDOOR = of(net.minecraft.block.Blocks.OAK_TRAPDOOR); - public static BlockWrapper SPRUCE_TRAPDOOR = of(net.minecraft.block.Blocks.SPRUCE_TRAPDOOR); - public static BlockWrapper BIRCH_TRAPDOOR = of(net.minecraft.block.Blocks.BIRCH_TRAPDOOR); - public static BlockWrapper JUNGLE_TRAPDOOR = of(net.minecraft.block.Blocks.JUNGLE_TRAPDOOR); - public static BlockWrapper ACACIA_TRAPDOOR = of(net.minecraft.block.Blocks.ACACIA_TRAPDOOR); - public static BlockWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.block.Blocks.DARK_OAK_TRAPDOOR); - public static BlockWrapper STONE_BRICKS = of(net.minecraft.block.Blocks.STONE_BRICKS); - public static BlockWrapper MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICKS); - public static BlockWrapper CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_STONE_BRICKS); - public static BlockWrapper CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.CHISELED_STONE_BRICKS); - public static BlockWrapper INFESTED_STONE = of(net.minecraft.block.Blocks.INFESTED_STONE); - public static BlockWrapper INFESTED_COBBLESTONE = of(net.minecraft.block.Blocks.INFESTED_COBBLESTONE); - public static BlockWrapper INFESTED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_STONE_BRICKS); - public static BlockWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_MOSSY_STONE_BRICKS); - public static BlockWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CRACKED_STONE_BRICKS); - public static BlockWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.block.Blocks.INFESTED_CHISELED_STONE_BRICKS); - public static BlockWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.BROWN_MUSHROOM_BLOCK); - public static BlockWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.block.Blocks.RED_MUSHROOM_BLOCK); - public static BlockWrapper MUSHROOM_STEM = of(net.minecraft.block.Blocks.MUSHROOM_STEM); - public static BlockWrapper IRON_BARS = of(net.minecraft.block.Blocks.IRON_BARS); - public static BlockWrapper CHAIN = of(net.minecraft.block.Blocks.IRON_CHAIN); - public static BlockWrapper GLASS_PANE = of(net.minecraft.block.Blocks.GLASS_PANE); - public static BlockWrapper MELON = of(net.minecraft.block.Blocks.MELON); - public static BlockWrapper ATTACHED_PUMPKIN_STEM = of(net.minecraft.block.Blocks.ATTACHED_PUMPKIN_STEM); - public static BlockWrapper ATTACHED_MELON_STEM = of(net.minecraft.block.Blocks.ATTACHED_MELON_STEM); - public static BlockWrapper PUMPKIN_STEM = of(net.minecraft.block.Blocks.PUMPKIN_STEM); - public static BlockWrapper MELON_STEM = of(net.minecraft.block.Blocks.MELON_STEM); - public static BlockWrapper VINE = of(net.minecraft.block.Blocks.VINE); - public static BlockWrapper OAK_FENCE_GATE = of(net.minecraft.block.Blocks.OAK_FENCE_GATE); - public static BlockWrapper BRICK_STAIRS = of(net.minecraft.block.Blocks.BRICK_STAIRS); - public static BlockWrapper STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.STONE_BRICK_STAIRS); - public static BlockWrapper MYCELIUM = of(net.minecraft.block.Blocks.MYCELIUM); - public static BlockWrapper LILY_PAD = of(net.minecraft.block.Blocks.LILY_PAD); - public static BlockWrapper NETHER_BRICKS = of(net.minecraft.block.Blocks.NETHER_BRICKS); - public static BlockWrapper NETHER_BRICK_FENCE = of(net.minecraft.block.Blocks.NETHER_BRICK_FENCE); - public static BlockWrapper NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.NETHER_BRICK_STAIRS); - public static BlockWrapper NETHER_WART = of(net.minecraft.block.Blocks.NETHER_WART); - public static BlockWrapper ENCHANTING_TABLE = of(net.minecraft.block.Blocks.ENCHANTING_TABLE); - public static BlockWrapper BREWING_STAND = of(net.minecraft.block.Blocks.BREWING_STAND); - public static BlockWrapper CAULDRON = of(net.minecraft.block.Blocks.CAULDRON); - public static BlockWrapper END_PORTAL = of(net.minecraft.block.Blocks.END_PORTAL); - public static BlockWrapper END_PORTAL_FRAME = of(net.minecraft.block.Blocks.END_PORTAL_FRAME); - public static BlockWrapper END_STONE = of(net.minecraft.block.Blocks.END_STONE); - public static BlockWrapper DRAGON_EGG = of(net.minecraft.block.Blocks.DRAGON_EGG); - public static BlockWrapper REDSTONE_LAMP = of(net.minecraft.block.Blocks.REDSTONE_LAMP); - public static BlockWrapper COCOA = of(net.minecraft.block.Blocks.COCOA); - public static BlockWrapper SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SANDSTONE_STAIRS); - public static BlockWrapper EMERALD_ORE = of(net.minecraft.block.Blocks.EMERALD_ORE); - public static BlockWrapper ENDER_CHEST = of(net.minecraft.block.Blocks.ENDER_CHEST); - public static BlockWrapper TRIPWIRE_HOOK = of(net.minecraft.block.Blocks.TRIPWIRE_HOOK); - public static BlockWrapper TRIPWIRE = of(net.minecraft.block.Blocks.TRIPWIRE); - public static BlockWrapper EMERALD_BLOCK = of(net.minecraft.block.Blocks.EMERALD_BLOCK); - public static BlockWrapper SPRUCE_STAIRS = of(net.minecraft.block.Blocks.SPRUCE_STAIRS); - public static BlockWrapper BIRCH_STAIRS = of(net.minecraft.block.Blocks.BIRCH_STAIRS); - public static BlockWrapper JUNGLE_STAIRS = of(net.minecraft.block.Blocks.JUNGLE_STAIRS); - public static BlockWrapper COMMAND_BLOCK = of(net.minecraft.block.Blocks.COMMAND_BLOCK); - public static BlockWrapper BEACON = of(net.minecraft.block.Blocks.BEACON); - public static BlockWrapper COBBLESTONE_WALL = of(net.minecraft.block.Blocks.COBBLESTONE_WALL); - public static BlockWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_WALL); - public static BlockWrapper FLOWER_POT = of(net.minecraft.block.Blocks.FLOWER_POT); - public static BlockWrapper POTTED_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_OAK_SAPLING); - public static BlockWrapper POTTED_SPRUCE_SAPLING = of(net.minecraft.block.Blocks.POTTED_SPRUCE_SAPLING); - public static BlockWrapper POTTED_BIRCH_SAPLING = of(net.minecraft.block.Blocks.POTTED_BIRCH_SAPLING); - public static BlockWrapper POTTED_JUNGLE_SAPLING = of(net.minecraft.block.Blocks.POTTED_JUNGLE_SAPLING); - public static BlockWrapper POTTED_ACACIA_SAPLING = of(net.minecraft.block.Blocks.POTTED_ACACIA_SAPLING); - public static BlockWrapper POTTED_DARK_OAK_SAPLING = of(net.minecraft.block.Blocks.POTTED_DARK_OAK_SAPLING); - public static BlockWrapper POTTED_FERN = of(net.minecraft.block.Blocks.POTTED_FERN); - public static BlockWrapper POTTED_DANDELION = of(net.minecraft.block.Blocks.POTTED_DANDELION); - public static BlockWrapper POTTED_POPPY = of(net.minecraft.block.Blocks.POTTED_POPPY); - public static BlockWrapper POTTED_BLUE_ORCHID = of(net.minecraft.block.Blocks.POTTED_BLUE_ORCHID); - public static BlockWrapper POTTED_ALLIUM = of(net.minecraft.block.Blocks.POTTED_ALLIUM); - public static BlockWrapper POTTED_AZURE_BLUET = of(net.minecraft.block.Blocks.POTTED_AZURE_BLUET); - public static BlockWrapper POTTED_RED_TULIP = of(net.minecraft.block.Blocks.POTTED_RED_TULIP); - public static BlockWrapper POTTED_ORANGE_TULIP = of(net.minecraft.block.Blocks.POTTED_ORANGE_TULIP); - public static BlockWrapper POTTED_WHITE_TULIP = of(net.minecraft.block.Blocks.POTTED_WHITE_TULIP); - public static BlockWrapper POTTED_PINK_TULIP = of(net.minecraft.block.Blocks.POTTED_PINK_TULIP); - public static BlockWrapper POTTED_OXEYE_DAISY = of(net.minecraft.block.Blocks.POTTED_OXEYE_DAISY); - public static BlockWrapper POTTED_CORNFLOWER = of(net.minecraft.block.Blocks.POTTED_CORNFLOWER); - public static BlockWrapper POTTED_LILY_OF_THE_VALLEY = of(net.minecraft.block.Blocks.POTTED_LILY_OF_THE_VALLEY); - public static BlockWrapper POTTED_WITHER_ROSE = of(net.minecraft.block.Blocks.POTTED_WITHER_ROSE); - public static BlockWrapper POTTED_RED_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_RED_MUSHROOM); - public static BlockWrapper POTTED_BROWN_MUSHROOM = of(net.minecraft.block.Blocks.POTTED_BROWN_MUSHROOM); - public static BlockWrapper POTTED_DEAD_BUSH = of(net.minecraft.block.Blocks.POTTED_DEAD_BUSH); - public static BlockWrapper POTTED_CACTUS = of(net.minecraft.block.Blocks.POTTED_CACTUS); - public static BlockWrapper CARROTS = of(net.minecraft.block.Blocks.CARROTS); - public static BlockWrapper POTATOES = of(net.minecraft.block.Blocks.POTATOES); - public static BlockWrapper OAK_BUTTON = of(net.minecraft.block.Blocks.OAK_BUTTON); - public static BlockWrapper SPRUCE_BUTTON = of(net.minecraft.block.Blocks.SPRUCE_BUTTON); - public static BlockWrapper BIRCH_BUTTON = of(net.minecraft.block.Blocks.BIRCH_BUTTON); - public static BlockWrapper JUNGLE_BUTTON = of(net.minecraft.block.Blocks.JUNGLE_BUTTON); - public static BlockWrapper ACACIA_BUTTON = of(net.minecraft.block.Blocks.ACACIA_BUTTON); - public static BlockWrapper DARK_OAK_BUTTON = of(net.minecraft.block.Blocks.DARK_OAK_BUTTON); - public static BlockWrapper SKELETON_SKULL = of(net.minecraft.block.Blocks.SKELETON_SKULL); - public static BlockWrapper SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.SKELETON_WALL_SKULL); - public static BlockWrapper WITHER_SKELETON_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_SKULL); - public static BlockWrapper WITHER_SKELETON_WALL_SKULL = of(net.minecraft.block.Blocks.WITHER_SKELETON_WALL_SKULL); - public static BlockWrapper ZOMBIE_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_HEAD); - public static BlockWrapper ZOMBIE_WALL_HEAD = of(net.minecraft.block.Blocks.ZOMBIE_WALL_HEAD); - public static BlockWrapper PLAYER_HEAD = of(net.minecraft.block.Blocks.PLAYER_HEAD); - public static BlockWrapper PLAYER_WALL_HEAD = of(net.minecraft.block.Blocks.PLAYER_WALL_HEAD); - public static BlockWrapper CREEPER_HEAD = of(net.minecraft.block.Blocks.CREEPER_HEAD); - public static BlockWrapper CREEPER_WALL_HEAD = of(net.minecraft.block.Blocks.CREEPER_WALL_HEAD); - public static BlockWrapper DRAGON_HEAD = of(net.minecraft.block.Blocks.DRAGON_HEAD); - public static BlockWrapper DRAGON_WALL_HEAD = of(net.minecraft.block.Blocks.DRAGON_WALL_HEAD); - public static BlockWrapper ANVIL = of(net.minecraft.block.Blocks.ANVIL); - public static BlockWrapper CHIPPED_ANVIL = of(net.minecraft.block.Blocks.CHIPPED_ANVIL); - public static BlockWrapper DAMAGED_ANVIL = of(net.minecraft.block.Blocks.DAMAGED_ANVIL); - public static BlockWrapper TRAPPED_CHEST = of(net.minecraft.block.Blocks.TRAPPED_CHEST); - public static BlockWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE); - public static BlockWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE); - public static BlockWrapper COMPARATOR = of(net.minecraft.block.Blocks.COMPARATOR); - public static BlockWrapper DAYLIGHT_DETECTOR = of(net.minecraft.block.Blocks.DAYLIGHT_DETECTOR); - public static BlockWrapper REDSTONE_BLOCK = of(net.minecraft.block.Blocks.REDSTONE_BLOCK); - public static BlockWrapper NETHER_QUARTZ_ORE = of(net.minecraft.block.Blocks.NETHER_QUARTZ_ORE); - public static BlockWrapper HOPPER = of(net.minecraft.block.Blocks.HOPPER); - public static BlockWrapper QUARTZ_BLOCK = of(net.minecraft.block.Blocks.QUARTZ_BLOCK); - public static BlockWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.block.Blocks.CHISELED_QUARTZ_BLOCK); - public static BlockWrapper QUARTZ_PILLAR = of(net.minecraft.block.Blocks.QUARTZ_PILLAR); - public static BlockWrapper QUARTZ_STAIRS = of(net.minecraft.block.Blocks.QUARTZ_STAIRS); - public static BlockWrapper ACTIVATOR_RAIL = of(net.minecraft.block.Blocks.ACTIVATOR_RAIL); - public static BlockWrapper DROPPER = of(net.minecraft.block.Blocks.DROPPER); - public static BlockWrapper WHITE_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_TERRACOTTA); - public static BlockWrapper ORANGE_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_TERRACOTTA); - public static BlockWrapper MAGENTA_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_TERRACOTTA); - public static BlockWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_TERRACOTTA); - public static BlockWrapper YELLOW_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_TERRACOTTA); - public static BlockWrapper LIME_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_TERRACOTTA); - public static BlockWrapper PINK_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_TERRACOTTA); - public static BlockWrapper GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_TERRACOTTA); - public static BlockWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_TERRACOTTA); - public static BlockWrapper CYAN_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_TERRACOTTA); - public static BlockWrapper PURPLE_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_TERRACOTTA); - public static BlockWrapper BLUE_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_TERRACOTTA); - public static BlockWrapper BROWN_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_TERRACOTTA); - public static BlockWrapper GREEN_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_TERRACOTTA); - public static BlockWrapper RED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_TERRACOTTA); - public static BlockWrapper BLACK_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_TERRACOTTA); - public static BlockWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.WHITE_STAINED_GLASS_PANE); - public static BlockWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.ORANGE_STAINED_GLASS_PANE); - public static BlockWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.MAGENTA_STAINED_GLASS_PANE); - public static BlockWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_BLUE_STAINED_GLASS_PANE); - public static BlockWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.YELLOW_STAINED_GLASS_PANE); - public static BlockWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIME_STAINED_GLASS_PANE); - public static BlockWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PINK_STAINED_GLASS_PANE); - public static BlockWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GRAY_STAINED_GLASS_PANE); - public static BlockWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.LIGHT_GRAY_STAINED_GLASS_PANE); - public static BlockWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.CYAN_STAINED_GLASS_PANE); - public static BlockWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.PURPLE_STAINED_GLASS_PANE); - public static BlockWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLUE_STAINED_GLASS_PANE); - public static BlockWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BROWN_STAINED_GLASS_PANE); - public static BlockWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.GREEN_STAINED_GLASS_PANE); - public static BlockWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.RED_STAINED_GLASS_PANE); - public static BlockWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.block.Blocks.BLACK_STAINED_GLASS_PANE); - public static BlockWrapper ACACIA_STAIRS = of(net.minecraft.block.Blocks.ACACIA_STAIRS); - public static BlockWrapper DARK_OAK_STAIRS = of(net.minecraft.block.Blocks.DARK_OAK_STAIRS); - public static BlockWrapper SLIME_BLOCK = of(net.minecraft.block.Blocks.SLIME_BLOCK); - public static BlockWrapper BARRIER = of(net.minecraft.block.Blocks.BARRIER); - public static BlockWrapper IRON_TRAPDOOR = of(net.minecraft.block.Blocks.IRON_TRAPDOOR); - public static BlockWrapper PRISMARINE = of(net.minecraft.block.Blocks.PRISMARINE); - public static BlockWrapper PRISMARINE_BRICKS = of(net.minecraft.block.Blocks.PRISMARINE_BRICKS); - public static BlockWrapper DARK_PRISMARINE = of(net.minecraft.block.Blocks.DARK_PRISMARINE); - public static BlockWrapper PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_STAIRS); - public static BlockWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_STAIRS); - public static BlockWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.block.Blocks.DARK_PRISMARINE_STAIRS); - public static BlockWrapper PRISMARINE_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_SLAB); - public static BlockWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.block.Blocks.PRISMARINE_BRICK_SLAB); - public static BlockWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.block.Blocks.DARK_PRISMARINE_SLAB); - public static BlockWrapper SEA_LANTERN = of(net.minecraft.block.Blocks.SEA_LANTERN); - public static BlockWrapper HAY_BLOCK = of(net.minecraft.block.Blocks.HAY_BLOCK); - public static BlockWrapper WHITE_CARPET = of(net.minecraft.block.Blocks.WHITE_CARPET); - public static BlockWrapper ORANGE_CARPET = of(net.minecraft.block.Blocks.ORANGE_CARPET); - public static BlockWrapper MAGENTA_CARPET = of(net.minecraft.block.Blocks.MAGENTA_CARPET); - public static BlockWrapper LIGHT_BLUE_CARPET = of(net.minecraft.block.Blocks.LIGHT_BLUE_CARPET); - public static BlockWrapper YELLOW_CARPET = of(net.minecraft.block.Blocks.YELLOW_CARPET); - public static BlockWrapper LIME_CARPET = of(net.minecraft.block.Blocks.LIME_CARPET); - public static BlockWrapper PINK_CARPET = of(net.minecraft.block.Blocks.PINK_CARPET); - public static BlockWrapper GRAY_CARPET = of(net.minecraft.block.Blocks.GRAY_CARPET); - public static BlockWrapper LIGHT_GRAY_CARPET = of(net.minecraft.block.Blocks.LIGHT_GRAY_CARPET); - public static BlockWrapper CYAN_CARPET = of(net.minecraft.block.Blocks.CYAN_CARPET); - public static BlockWrapper PURPLE_CARPET = of(net.minecraft.block.Blocks.PURPLE_CARPET); - public static BlockWrapper BLUE_CARPET = of(net.minecraft.block.Blocks.BLUE_CARPET); - public static BlockWrapper BROWN_CARPET = of(net.minecraft.block.Blocks.BROWN_CARPET); - public static BlockWrapper GREEN_CARPET = of(net.minecraft.block.Blocks.GREEN_CARPET); - public static BlockWrapper RED_CARPET = of(net.minecraft.block.Blocks.RED_CARPET); - public static BlockWrapper BLACK_CARPET = of(net.minecraft.block.Blocks.BLACK_CARPET); - public static BlockWrapper TERRACOTTA = of(net.minecraft.block.Blocks.TERRACOTTA); - public static BlockWrapper COAL_BLOCK = of(net.minecraft.block.Blocks.COAL_BLOCK); - public static BlockWrapper PACKED_ICE = of(net.minecraft.block.Blocks.PACKED_ICE); - public static BlockWrapper SUNFLOWER = of(net.minecraft.block.Blocks.SUNFLOWER); - public static BlockWrapper LILAC = of(net.minecraft.block.Blocks.LILAC); - public static BlockWrapper ROSE_BUSH = of(net.minecraft.block.Blocks.ROSE_BUSH); - public static BlockWrapper PEONY = of(net.minecraft.block.Blocks.PEONY); - public static BlockWrapper TALL_GRASS = of(net.minecraft.block.Blocks.TALL_GRASS); - public static BlockWrapper LARGE_FERN = of(net.minecraft.block.Blocks.LARGE_FERN); - public static BlockWrapper WHITE_BANNER = of(net.minecraft.block.Blocks.WHITE_BANNER); - public static BlockWrapper ORANGE_BANNER = of(net.minecraft.block.Blocks.ORANGE_BANNER); - public static BlockWrapper MAGENTA_BANNER = of(net.minecraft.block.Blocks.MAGENTA_BANNER); - public static BlockWrapper LIGHT_BLUE_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_BANNER); - public static BlockWrapper YELLOW_BANNER = of(net.minecraft.block.Blocks.YELLOW_BANNER); - public static BlockWrapper LIME_BANNER = of(net.minecraft.block.Blocks.LIME_BANNER); - public static BlockWrapper PINK_BANNER = of(net.minecraft.block.Blocks.PINK_BANNER); - public static BlockWrapper GRAY_BANNER = of(net.minecraft.block.Blocks.GRAY_BANNER); - public static BlockWrapper LIGHT_GRAY_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_BANNER); - public static BlockWrapper CYAN_BANNER = of(net.minecraft.block.Blocks.CYAN_BANNER); - public static BlockWrapper PURPLE_BANNER = of(net.minecraft.block.Blocks.PURPLE_BANNER); - public static BlockWrapper BLUE_BANNER = of(net.minecraft.block.Blocks.BLUE_BANNER); - public static BlockWrapper BROWN_BANNER = of(net.minecraft.block.Blocks.BROWN_BANNER); - public static BlockWrapper GREEN_BANNER = of(net.minecraft.block.Blocks.GREEN_BANNER); - public static BlockWrapper RED_BANNER = of(net.minecraft.block.Blocks.RED_BANNER); - public static BlockWrapper BLACK_BANNER = of(net.minecraft.block.Blocks.BLACK_BANNER); - public static BlockWrapper WHITE_WALL_BANNER = of(net.minecraft.block.Blocks.WHITE_WALL_BANNER); - public static BlockWrapper ORANGE_WALL_BANNER = of(net.minecraft.block.Blocks.ORANGE_WALL_BANNER); - public static BlockWrapper MAGENTA_WALL_BANNER = of(net.minecraft.block.Blocks.MAGENTA_WALL_BANNER); - public static BlockWrapper LIGHT_BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_BLUE_WALL_BANNER); - public static BlockWrapper YELLOW_WALL_BANNER = of(net.minecraft.block.Blocks.YELLOW_WALL_BANNER); - public static BlockWrapper LIME_WALL_BANNER = of(net.minecraft.block.Blocks.LIME_WALL_BANNER); - public static BlockWrapper PINK_WALL_BANNER = of(net.minecraft.block.Blocks.PINK_WALL_BANNER); - public static BlockWrapper GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.GRAY_WALL_BANNER); - public static BlockWrapper LIGHT_GRAY_WALL_BANNER = of(net.minecraft.block.Blocks.LIGHT_GRAY_WALL_BANNER); - public static BlockWrapper CYAN_WALL_BANNER = of(net.minecraft.block.Blocks.CYAN_WALL_BANNER); - public static BlockWrapper PURPLE_WALL_BANNER = of(net.minecraft.block.Blocks.PURPLE_WALL_BANNER); - public static BlockWrapper BLUE_WALL_BANNER = of(net.minecraft.block.Blocks.BLUE_WALL_BANNER); - public static BlockWrapper BROWN_WALL_BANNER = of(net.minecraft.block.Blocks.BROWN_WALL_BANNER); - public static BlockWrapper GREEN_WALL_BANNER = of(net.minecraft.block.Blocks.GREEN_WALL_BANNER); - public static BlockWrapper RED_WALL_BANNER = of(net.minecraft.block.Blocks.RED_WALL_BANNER); - public static BlockWrapper BLACK_WALL_BANNER = of(net.minecraft.block.Blocks.BLACK_WALL_BANNER); - public static BlockWrapper RED_SANDSTONE = of(net.minecraft.block.Blocks.RED_SANDSTONE); - public static BlockWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.block.Blocks.CHISELED_RED_SANDSTONE); - public static BlockWrapper CUT_RED_SANDSTONE = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE); - public static BlockWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.RED_SANDSTONE_STAIRS); - public static BlockWrapper OAK_SLAB = of(net.minecraft.block.Blocks.OAK_SLAB); - public static BlockWrapper SPRUCE_SLAB = of(net.minecraft.block.Blocks.SPRUCE_SLAB); - public static BlockWrapper BIRCH_SLAB = of(net.minecraft.block.Blocks.BIRCH_SLAB); - public static BlockWrapper JUNGLE_SLAB = of(net.minecraft.block.Blocks.JUNGLE_SLAB); - public static BlockWrapper ACACIA_SLAB = of(net.minecraft.block.Blocks.ACACIA_SLAB); - public static BlockWrapper DARK_OAK_SLAB = of(net.minecraft.block.Blocks.DARK_OAK_SLAB); - public static BlockWrapper STONE_SLAB = of(net.minecraft.block.Blocks.STONE_SLAB); - public static BlockWrapper SMOOTH_STONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_STONE_SLAB); - public static BlockWrapper SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SANDSTONE_SLAB); - public static BlockWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_SANDSTONE_SLAB); - public static BlockWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.block.Blocks.PETRIFIED_OAK_SLAB); - public static BlockWrapper COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.COBBLESTONE_SLAB); - public static BlockWrapper BRICK_SLAB = of(net.minecraft.block.Blocks.BRICK_SLAB); - public static BlockWrapper STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.STONE_BRICK_SLAB); - public static BlockWrapper NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.NETHER_BRICK_SLAB); - public static BlockWrapper QUARTZ_SLAB = of(net.minecraft.block.Blocks.QUARTZ_SLAB); - public static BlockWrapper RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.RED_SANDSTONE_SLAB); - public static BlockWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.CUT_RED_SANDSTONE_SLAB); - public static BlockWrapper PURPUR_SLAB = of(net.minecraft.block.Blocks.PURPUR_SLAB); - public static BlockWrapper SMOOTH_STONE = of(net.minecraft.block.Blocks.SMOOTH_STONE); - public static BlockWrapper SMOOTH_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE); - public static BlockWrapper SMOOTH_QUARTZ = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ); - public static BlockWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE); - public static BlockWrapper SPRUCE_FENCE_GATE = of(net.minecraft.block.Blocks.SPRUCE_FENCE_GATE); - public static BlockWrapper BIRCH_FENCE_GATE = of(net.minecraft.block.Blocks.BIRCH_FENCE_GATE); - public static BlockWrapper JUNGLE_FENCE_GATE = of(net.minecraft.block.Blocks.JUNGLE_FENCE_GATE); - public static BlockWrapper ACACIA_FENCE_GATE = of(net.minecraft.block.Blocks.ACACIA_FENCE_GATE); - public static BlockWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE_GATE); - public static BlockWrapper SPRUCE_FENCE = of(net.minecraft.block.Blocks.SPRUCE_FENCE); - public static BlockWrapper BIRCH_FENCE = of(net.minecraft.block.Blocks.BIRCH_FENCE); - public static BlockWrapper JUNGLE_FENCE = of(net.minecraft.block.Blocks.JUNGLE_FENCE); - public static BlockWrapper ACACIA_FENCE = of(net.minecraft.block.Blocks.ACACIA_FENCE); - public static BlockWrapper DARK_OAK_FENCE = of(net.minecraft.block.Blocks.DARK_OAK_FENCE); - public static BlockWrapper SPRUCE_DOOR = of(net.minecraft.block.Blocks.SPRUCE_DOOR); - public static BlockWrapper BIRCH_DOOR = of(net.minecraft.block.Blocks.BIRCH_DOOR); - public static BlockWrapper JUNGLE_DOOR = of(net.minecraft.block.Blocks.JUNGLE_DOOR); - public static BlockWrapper ACACIA_DOOR = of(net.minecraft.block.Blocks.ACACIA_DOOR); - public static BlockWrapper DARK_OAK_DOOR = of(net.minecraft.block.Blocks.DARK_OAK_DOOR); - public static BlockWrapper END_ROD = of(net.minecraft.block.Blocks.END_ROD); - public static BlockWrapper CHORUS_PLANT = of(net.minecraft.block.Blocks.CHORUS_PLANT); - public static BlockWrapper CHORUS_FLOWER = of(net.minecraft.block.Blocks.CHORUS_FLOWER); - public static BlockWrapper PURPUR_BLOCK = of(net.minecraft.block.Blocks.PURPUR_BLOCK); - public static BlockWrapper PURPUR_PILLAR = of(net.minecraft.block.Blocks.PURPUR_PILLAR); - public static BlockWrapper PURPUR_STAIRS = of(net.minecraft.block.Blocks.PURPUR_STAIRS); - public static BlockWrapper END_STONE_BRICKS = of(net.minecraft.block.Blocks.END_STONE_BRICKS); - public static BlockWrapper BEETROOTS = of(net.minecraft.block.Blocks.BEETROOTS); - public static BlockWrapper GRASS_PATH = of(net.minecraft.block.Blocks.DIRT_PATH); - public static BlockWrapper END_GATEWAY = of(net.minecraft.block.Blocks.END_GATEWAY); - public static BlockWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.block.Blocks.REPEATING_COMMAND_BLOCK); - public static BlockWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.block.Blocks.CHAIN_COMMAND_BLOCK); - public static BlockWrapper FROSTED_ICE = of(net.minecraft.block.Blocks.FROSTED_ICE); - public static BlockWrapper MAGMA_BLOCK = of(net.minecraft.block.Blocks.MAGMA_BLOCK); - public static BlockWrapper NETHER_WART_BLOCK = of(net.minecraft.block.Blocks.NETHER_WART_BLOCK); - public static BlockWrapper RED_NETHER_BRICKS = of(net.minecraft.block.Blocks.RED_NETHER_BRICKS); - public static BlockWrapper BONE_BLOCK = of(net.minecraft.block.Blocks.BONE_BLOCK); - public static BlockWrapper STRUCTURE_VOID = of(net.minecraft.block.Blocks.STRUCTURE_VOID); - public static BlockWrapper OBSERVER = of(net.minecraft.block.Blocks.OBSERVER); - public static BlockWrapper SHULKER_BOX = of(net.minecraft.block.Blocks.SHULKER_BOX); - public static BlockWrapper WHITE_SHULKER_BOX = of(net.minecraft.block.Blocks.WHITE_SHULKER_BOX); - public static BlockWrapper ORANGE_SHULKER_BOX = of(net.minecraft.block.Blocks.ORANGE_SHULKER_BOX); - public static BlockWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.block.Blocks.MAGENTA_SHULKER_BOX); - public static BlockWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_BLUE_SHULKER_BOX); - public static BlockWrapper YELLOW_SHULKER_BOX = of(net.minecraft.block.Blocks.YELLOW_SHULKER_BOX); - public static BlockWrapper LIME_SHULKER_BOX = of(net.minecraft.block.Blocks.LIME_SHULKER_BOX); - public static BlockWrapper PINK_SHULKER_BOX = of(net.minecraft.block.Blocks.PINK_SHULKER_BOX); - public static BlockWrapper GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.GRAY_SHULKER_BOX); - public static BlockWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.block.Blocks.LIGHT_GRAY_SHULKER_BOX); - public static BlockWrapper CYAN_SHULKER_BOX = of(net.minecraft.block.Blocks.CYAN_SHULKER_BOX); - public static BlockWrapper PURPLE_SHULKER_BOX = of(net.minecraft.block.Blocks.PURPLE_SHULKER_BOX); - public static BlockWrapper BLUE_SHULKER_BOX = of(net.minecraft.block.Blocks.BLUE_SHULKER_BOX); - public static BlockWrapper BROWN_SHULKER_BOX = of(net.minecraft.block.Blocks.BROWN_SHULKER_BOX); - public static BlockWrapper GREEN_SHULKER_BOX = of(net.minecraft.block.Blocks.GREEN_SHULKER_BOX); - public static BlockWrapper RED_SHULKER_BOX = of(net.minecraft.block.Blocks.RED_SHULKER_BOX); - public static BlockWrapper BLACK_SHULKER_BOX = of(net.minecraft.block.Blocks.BLACK_SHULKER_BOX); - public static BlockWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.WHITE_GLAZED_TERRACOTTA); - public static BlockWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.ORANGE_GLAZED_TERRACOTTA); - public static BlockWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.MAGENTA_GLAZED_TERRACOTTA); - public static BlockWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA); - public static BlockWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.YELLOW_GLAZED_TERRACOTTA); - public static BlockWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIME_GLAZED_TERRACOTTA); - public static BlockWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PINK_GLAZED_TERRACOTTA); - public static BlockWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GRAY_GLAZED_TERRACOTTA); - public static BlockWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA); - public static BlockWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.CYAN_GLAZED_TERRACOTTA); - public static BlockWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.PURPLE_GLAZED_TERRACOTTA); - public static BlockWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLUE_GLAZED_TERRACOTTA); - public static BlockWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BROWN_GLAZED_TERRACOTTA); - public static BlockWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.GREEN_GLAZED_TERRACOTTA); - public static BlockWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.RED_GLAZED_TERRACOTTA); - public static BlockWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.block.Blocks.BLACK_GLAZED_TERRACOTTA); - public static BlockWrapper WHITE_CONCRETE = of(net.minecraft.block.Blocks.WHITE_CONCRETE); - public static BlockWrapper ORANGE_CONCRETE = of(net.minecraft.block.Blocks.ORANGE_CONCRETE); - public static BlockWrapper MAGENTA_CONCRETE = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE); - public static BlockWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE); - public static BlockWrapper YELLOW_CONCRETE = of(net.minecraft.block.Blocks.YELLOW_CONCRETE); - public static BlockWrapper LIME_CONCRETE = of(net.minecraft.block.Blocks.LIME_CONCRETE); - public static BlockWrapper PINK_CONCRETE = of(net.minecraft.block.Blocks.PINK_CONCRETE); - public static BlockWrapper GRAY_CONCRETE = of(net.minecraft.block.Blocks.GRAY_CONCRETE); - public static BlockWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE); - public static BlockWrapper CYAN_CONCRETE = of(net.minecraft.block.Blocks.CYAN_CONCRETE); - public static BlockWrapper PURPLE_CONCRETE = of(net.minecraft.block.Blocks.PURPLE_CONCRETE); - public static BlockWrapper BLUE_CONCRETE = of(net.minecraft.block.Blocks.BLUE_CONCRETE); - public static BlockWrapper BROWN_CONCRETE = of(net.minecraft.block.Blocks.BROWN_CONCRETE); - public static BlockWrapper GREEN_CONCRETE = of(net.minecraft.block.Blocks.GREEN_CONCRETE); - public static BlockWrapper RED_CONCRETE = of(net.minecraft.block.Blocks.RED_CONCRETE); - public static BlockWrapper BLACK_CONCRETE = of(net.minecraft.block.Blocks.BLACK_CONCRETE); - public static BlockWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.WHITE_CONCRETE_POWDER); - public static BlockWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.ORANGE_CONCRETE_POWDER); - public static BlockWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.block.Blocks.MAGENTA_CONCRETE_POWDER); - public static BlockWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_BLUE_CONCRETE_POWDER); - public static BlockWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.block.Blocks.YELLOW_CONCRETE_POWDER); - public static BlockWrapper LIME_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIME_CONCRETE_POWDER); - public static BlockWrapper PINK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PINK_CONCRETE_POWDER); - public static BlockWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GRAY_CONCRETE_POWDER); - public static BlockWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.block.Blocks.LIGHT_GRAY_CONCRETE_POWDER); - public static BlockWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.CYAN_CONCRETE_POWDER); - public static BlockWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.PURPLE_CONCRETE_POWDER); - public static BlockWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLUE_CONCRETE_POWDER); - public static BlockWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BROWN_CONCRETE_POWDER); - public static BlockWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.block.Blocks.GREEN_CONCRETE_POWDER); - public static BlockWrapper RED_CONCRETE_POWDER = of(net.minecraft.block.Blocks.RED_CONCRETE_POWDER); - public static BlockWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.block.Blocks.BLACK_CONCRETE_POWDER); - public static BlockWrapper KELP = of(net.minecraft.block.Blocks.KELP); - public static BlockWrapper KELP_PLANT = of(net.minecraft.block.Blocks.KELP_PLANT); - public static BlockWrapper DRIED_KELP_BLOCK = of(net.minecraft.block.Blocks.DRIED_KELP_BLOCK); - public static BlockWrapper TURTLE_EGG = of(net.minecraft.block.Blocks.TURTLE_EGG); - public static BlockWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_BLOCK); - public static BlockWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_BLOCK); - public static BlockWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_BLOCK); - public static BlockWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_BLOCK); - public static BlockWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_BLOCK); - public static BlockWrapper TUBE_CORAL_BLOCK = of(net.minecraft.block.Blocks.TUBE_CORAL_BLOCK); - public static BlockWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.block.Blocks.BRAIN_CORAL_BLOCK); - public static BlockWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.block.Blocks.BUBBLE_CORAL_BLOCK); - public static BlockWrapper FIRE_CORAL_BLOCK = of(net.minecraft.block.Blocks.FIRE_CORAL_BLOCK); - public static BlockWrapper HORN_CORAL_BLOCK = of(net.minecraft.block.Blocks.HORN_CORAL_BLOCK); - public static BlockWrapper DEAD_TUBE_CORAL = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL); - public static BlockWrapper DEAD_BRAIN_CORAL = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL); - public static BlockWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL); - public static BlockWrapper DEAD_FIRE_CORAL = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL); - public static BlockWrapper DEAD_HORN_CORAL = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL); - public static BlockWrapper TUBE_CORAL = of(net.minecraft.block.Blocks.TUBE_CORAL); - public static BlockWrapper BRAIN_CORAL = of(net.minecraft.block.Blocks.BRAIN_CORAL); - public static BlockWrapper BUBBLE_CORAL = of(net.minecraft.block.Blocks.BUBBLE_CORAL); - public static BlockWrapper FIRE_CORAL = of(net.minecraft.block.Blocks.FIRE_CORAL); - public static BlockWrapper HORN_CORAL = of(net.minecraft.block.Blocks.HORN_CORAL); - public static BlockWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_FAN); - public static BlockWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_FAN); - public static BlockWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_FAN); - public static BlockWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_FAN); - public static BlockWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_FAN); - public static BlockWrapper TUBE_CORAL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_FAN); - public static BlockWrapper BRAIN_CORAL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_FAN); - public static BlockWrapper BUBBLE_CORAL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_FAN); - public static BlockWrapper FIRE_CORAL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_FAN); - public static BlockWrapper HORN_CORAL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_FAN); - public static BlockWrapper DEAD_TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_TUBE_CORAL_WALL_FAN); - public static BlockWrapper DEAD_BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BRAIN_CORAL_WALL_FAN); - public static BlockWrapper DEAD_BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_BUBBLE_CORAL_WALL_FAN); - public static BlockWrapper DEAD_FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_FIRE_CORAL_WALL_FAN); - public static BlockWrapper DEAD_HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.DEAD_HORN_CORAL_WALL_FAN); - public static BlockWrapper TUBE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.TUBE_CORAL_WALL_FAN); - public static BlockWrapper BRAIN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BRAIN_CORAL_WALL_FAN); - public static BlockWrapper BUBBLE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.BUBBLE_CORAL_WALL_FAN); - public static BlockWrapper FIRE_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.FIRE_CORAL_WALL_FAN); - public static BlockWrapper HORN_CORAL_WALL_FAN = of(net.minecraft.block.Blocks.HORN_CORAL_WALL_FAN); - public static BlockWrapper SEA_PICKLE = of(net.minecraft.block.Blocks.SEA_PICKLE); - public static BlockWrapper BLUE_ICE = of(net.minecraft.block.Blocks.BLUE_ICE); - public static BlockWrapper CONDUIT = of(net.minecraft.block.Blocks.CONDUIT); - public static BlockWrapper BAMBOO_SAPLING = of(net.minecraft.block.Blocks.BAMBOO_SAPLING); - public static BlockWrapper BAMBOO = of(net.minecraft.block.Blocks.BAMBOO); - public static BlockWrapper POTTED_BAMBOO = of(net.minecraft.block.Blocks.POTTED_BAMBOO); - public static BlockWrapper VOID_AIR = of(net.minecraft.block.Blocks.VOID_AIR); - public static BlockWrapper CAVE_AIR = of(net.minecraft.block.Blocks.CAVE_AIR); - public static BlockWrapper BUBBLE_COLUMN = of(net.minecraft.block.Blocks.BUBBLE_COLUMN); - public static BlockWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_GRANITE_STAIRS); - public static BlockWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_STAIRS); - public static BlockWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_STAIRS); - public static BlockWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_DIORITE_STAIRS); - public static BlockWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_STAIRS); - public static BlockWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.END_STONE_BRICK_STAIRS); - public static BlockWrapper STONE_STAIRS = of(net.minecraft.block.Blocks.STONE_STAIRS); - public static BlockWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_STAIRS); - public static BlockWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_STAIRS); - public static BlockWrapper GRANITE_STAIRS = of(net.minecraft.block.Blocks.GRANITE_STAIRS); - public static BlockWrapper ANDESITE_STAIRS = of(net.minecraft.block.Blocks.ANDESITE_STAIRS); - public static BlockWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_STAIRS); - public static BlockWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_STAIRS); - public static BlockWrapper DIORITE_STAIRS = of(net.minecraft.block.Blocks.DIORITE_STAIRS); - public static BlockWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_GRANITE_SLAB); - public static BlockWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_RED_SANDSTONE_SLAB); - public static BlockWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_SLAB); - public static BlockWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_DIORITE_SLAB); - public static BlockWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.block.Blocks.MOSSY_COBBLESTONE_SLAB); - public static BlockWrapper END_STONE_BRICK_SLAB = of(net.minecraft.block.Blocks.END_STONE_BRICK_SLAB); - public static BlockWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.block.Blocks.SMOOTH_SANDSTONE_SLAB); - public static BlockWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.block.Blocks.SMOOTH_QUARTZ_SLAB); - public static BlockWrapper GRANITE_SLAB = of(net.minecraft.block.Blocks.GRANITE_SLAB); - public static BlockWrapper ANDESITE_SLAB = of(net.minecraft.block.Blocks.ANDESITE_SLAB); - public static BlockWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_SLAB); - public static BlockWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.block.Blocks.POLISHED_ANDESITE_SLAB); - public static BlockWrapper DIORITE_SLAB = of(net.minecraft.block.Blocks.DIORITE_SLAB); - public static BlockWrapper BRICK_WALL = of(net.minecraft.block.Blocks.BRICK_WALL); - public static BlockWrapper PRISMARINE_WALL = of(net.minecraft.block.Blocks.PRISMARINE_WALL); - public static BlockWrapper RED_SANDSTONE_WALL = of(net.minecraft.block.Blocks.RED_SANDSTONE_WALL); - public static BlockWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.MOSSY_STONE_BRICK_WALL); - public static BlockWrapper GRANITE_WALL = of(net.minecraft.block.Blocks.GRANITE_WALL); - public static BlockWrapper STONE_BRICK_WALL = of(net.minecraft.block.Blocks.STONE_BRICK_WALL); - public static BlockWrapper NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.NETHER_BRICK_WALL); - public static BlockWrapper ANDESITE_WALL = of(net.minecraft.block.Blocks.ANDESITE_WALL); - public static BlockWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.block.Blocks.RED_NETHER_BRICK_WALL); - public static BlockWrapper SANDSTONE_WALL = of(net.minecraft.block.Blocks.SANDSTONE_WALL); - public static BlockWrapper END_STONE_BRICK_WALL = of(net.minecraft.block.Blocks.END_STONE_BRICK_WALL); - public static BlockWrapper DIORITE_WALL = of(net.minecraft.block.Blocks.DIORITE_WALL); - public static BlockWrapper SCAFFOLDING = of(net.minecraft.block.Blocks.SCAFFOLDING); - public static BlockWrapper LOOM = of(net.minecraft.block.Blocks.LOOM); - public static BlockWrapper BARREL = of(net.minecraft.block.Blocks.BARREL); - public static BlockWrapper SMOKER = of(net.minecraft.block.Blocks.SMOKER); - public static BlockWrapper BLAST_FURNACE = of(net.minecraft.block.Blocks.BLAST_FURNACE); - public static BlockWrapper CARTOGRAPHY_TABLE = of(net.minecraft.block.Blocks.CARTOGRAPHY_TABLE); - public static BlockWrapper FLETCHING_TABLE = of(net.minecraft.block.Blocks.FLETCHING_TABLE); - public static BlockWrapper GRINDSTONE = of(net.minecraft.block.Blocks.GRINDSTONE); - public static BlockWrapper LECTERN = of(net.minecraft.block.Blocks.LECTERN); - public static BlockWrapper SMITHING_TABLE = of(net.minecraft.block.Blocks.SMITHING_TABLE); - public static BlockWrapper STONECUTTER = of(net.minecraft.block.Blocks.STONECUTTER); - public static BlockWrapper BELL = of(net.minecraft.block.Blocks.BELL); - public static BlockWrapper LANTERN = of(net.minecraft.block.Blocks.LANTERN); - public static BlockWrapper SOUL_LANTERN = of(net.minecraft.block.Blocks.SOUL_LANTERN); - public static BlockWrapper CAMPFIRE = of(net.minecraft.block.Blocks.CAMPFIRE); - public static BlockWrapper SOUL_CAMPFIRE = of(net.minecraft.block.Blocks.SOUL_CAMPFIRE); - public static BlockWrapper SWEET_BERRY_BUSH = of(net.minecraft.block.Blocks.SWEET_BERRY_BUSH); - public static BlockWrapper WARPED_STEM = of(net.minecraft.block.Blocks.WARPED_STEM); - public static BlockWrapper STRIPPED_WARPED_STEM = of(net.minecraft.block.Blocks.STRIPPED_WARPED_STEM); - public static BlockWrapper WARPED_HYPHAE = of(net.minecraft.block.Blocks.WARPED_HYPHAE); - public static BlockWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_WARPED_HYPHAE); - public static BlockWrapper WARPED_NYLIUM = of(net.minecraft.block.Blocks.WARPED_NYLIUM); - public static BlockWrapper WARPED_FUNGUS = of(net.minecraft.block.Blocks.WARPED_FUNGUS); - public static BlockWrapper WARPED_WART_BLOCK = of(net.minecraft.block.Blocks.WARPED_WART_BLOCK); - public static BlockWrapper WARPED_ROOTS = of(net.minecraft.block.Blocks.WARPED_ROOTS); - public static BlockWrapper NETHER_SPROUTS = of(net.minecraft.block.Blocks.NETHER_SPROUTS); - public static BlockWrapper CRIMSON_STEM = of(net.minecraft.block.Blocks.CRIMSON_STEM); - public static BlockWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_STEM); - public static BlockWrapper CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.CRIMSON_HYPHAE); - public static BlockWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.block.Blocks.STRIPPED_CRIMSON_HYPHAE); - public static BlockWrapper CRIMSON_NYLIUM = of(net.minecraft.block.Blocks.CRIMSON_NYLIUM); - public static BlockWrapper CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.CRIMSON_FUNGUS); - public static BlockWrapper SHROOMLIGHT = of(net.minecraft.block.Blocks.SHROOMLIGHT); - public static BlockWrapper WEEPING_VINES = of(net.minecraft.block.Blocks.WEEPING_VINES); - public static BlockWrapper WEEPING_VINES_PLANT = of(net.minecraft.block.Blocks.WEEPING_VINES_PLANT); - public static BlockWrapper TWISTING_VINES = of(net.minecraft.block.Blocks.TWISTING_VINES); - public static BlockWrapper TWISTING_VINES_PLANT = of(net.minecraft.block.Blocks.TWISTING_VINES_PLANT); - public static BlockWrapper CRIMSON_ROOTS = of(net.minecraft.block.Blocks.CRIMSON_ROOTS); - public static BlockWrapper CRIMSON_PLANKS = of(net.minecraft.block.Blocks.CRIMSON_PLANKS); - public static BlockWrapper WARPED_PLANKS = of(net.minecraft.block.Blocks.WARPED_PLANKS); - public static BlockWrapper CRIMSON_SLAB = of(net.minecraft.block.Blocks.CRIMSON_SLAB); - public static BlockWrapper WARPED_SLAB = of(net.minecraft.block.Blocks.WARPED_SLAB); - public static BlockWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.block.Blocks.CRIMSON_PRESSURE_PLATE); - public static BlockWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.block.Blocks.WARPED_PRESSURE_PLATE); - public static BlockWrapper CRIMSON_FENCE = of(net.minecraft.block.Blocks.CRIMSON_FENCE); - public static BlockWrapper WARPED_FENCE = of(net.minecraft.block.Blocks.WARPED_FENCE); - public static BlockWrapper CRIMSON_TRAPDOOR = of(net.minecraft.block.Blocks.CRIMSON_TRAPDOOR); - public static BlockWrapper WARPED_TRAPDOOR = of(net.minecraft.block.Blocks.WARPED_TRAPDOOR); - public static BlockWrapper CRIMSON_FENCE_GATE = of(net.minecraft.block.Blocks.CRIMSON_FENCE_GATE); - public static BlockWrapper WARPED_FENCE_GATE = of(net.minecraft.block.Blocks.WARPED_FENCE_GATE); - public static BlockWrapper CRIMSON_STAIRS = of(net.minecraft.block.Blocks.CRIMSON_STAIRS); - public static BlockWrapper WARPED_STAIRS = of(net.minecraft.block.Blocks.WARPED_STAIRS); - public static BlockWrapper CRIMSON_BUTTON = of(net.minecraft.block.Blocks.CRIMSON_BUTTON); - public static BlockWrapper WARPED_BUTTON = of(net.minecraft.block.Blocks.WARPED_BUTTON); - public static BlockWrapper CRIMSON_DOOR = of(net.minecraft.block.Blocks.CRIMSON_DOOR); - public static BlockWrapper WARPED_DOOR = of(net.minecraft.block.Blocks.WARPED_DOOR); - public static BlockWrapper CRIMSON_SIGN = of(net.minecraft.block.Blocks.CRIMSON_SIGN); - public static BlockWrapper WARPED_SIGN = of(net.minecraft.block.Blocks.WARPED_SIGN); - public static BlockWrapper CRIMSON_WALL_SIGN = of(net.minecraft.block.Blocks.CRIMSON_WALL_SIGN); - public static BlockWrapper WARPED_WALL_SIGN = of(net.minecraft.block.Blocks.WARPED_WALL_SIGN); - public static BlockWrapper STRUCTURE_BLOCK = of(net.minecraft.block.Blocks.STRUCTURE_BLOCK); - public static BlockWrapper JIGSAW = of(net.minecraft.block.Blocks.JIGSAW); - public static BlockWrapper COMPOSTER = of(net.minecraft.block.Blocks.COMPOSTER); - public static BlockWrapper TARGET = of(net.minecraft.block.Blocks.TARGET); - public static BlockWrapper BEE_NEST = of(net.minecraft.block.Blocks.BEE_NEST); - public static BlockWrapper BEEHIVE = of(net.minecraft.block.Blocks.BEEHIVE); - public static BlockWrapper HONEY_BLOCK = of(net.minecraft.block.Blocks.HONEY_BLOCK); - public static BlockWrapper HONEYCOMB_BLOCK = of(net.minecraft.block.Blocks.HONEYCOMB_BLOCK); - public static BlockWrapper NETHERITE_BLOCK = of(net.minecraft.block.Blocks.NETHERITE_BLOCK); - public static BlockWrapper ANCIENT_DEBRIS = of(net.minecraft.block.Blocks.ANCIENT_DEBRIS); - public static BlockWrapper CRYING_OBSIDIAN = of(net.minecraft.block.Blocks.CRYING_OBSIDIAN); - public static BlockWrapper RESPAWN_ANCHOR = of(net.minecraft.block.Blocks.RESPAWN_ANCHOR); - public static BlockWrapper POTTED_CRIMSON_FUNGUS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_FUNGUS); - public static BlockWrapper POTTED_WARPED_FUNGUS = of(net.minecraft.block.Blocks.POTTED_WARPED_FUNGUS); - public static BlockWrapper POTTED_CRIMSON_ROOTS = of(net.minecraft.block.Blocks.POTTED_CRIMSON_ROOTS); - public static BlockWrapper POTTED_WARPED_ROOTS = of(net.minecraft.block.Blocks.POTTED_WARPED_ROOTS); - public static BlockWrapper LODESTONE = of(net.minecraft.block.Blocks.LODESTONE); - public static BlockWrapper BLACKSTONE = of(net.minecraft.block.Blocks.BLACKSTONE); - public static BlockWrapper BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.BLACKSTONE_STAIRS); - public static BlockWrapper BLACKSTONE_WALL = of(net.minecraft.block.Blocks.BLACKSTONE_WALL); - public static BlockWrapper BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.BLACKSTONE_SLAB); - public static BlockWrapper POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE); - public static BlockWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICKS); - public static BlockWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.block.Blocks.CRACKED_POLISHED_BLACKSTONE_BRICKS); - public static BlockWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.block.Blocks.CHISELED_POLISHED_BLACKSTONE); - public static BlockWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_SLAB); - public static BlockWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS); - public static BlockWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BRICK_WALL); - public static BlockWrapper GILDED_BLACKSTONE = of(net.minecraft.block.Blocks.GILDED_BLACKSTONE); - public static BlockWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_STAIRS); - public static BlockWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_SLAB); - public static BlockWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_PRESSURE_PLATE); - public static BlockWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_BUTTON); - public static BlockWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.block.Blocks.POLISHED_BLACKSTONE_WALL); - public static BlockWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CHISELED_NETHER_BRICKS); - public static BlockWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.block.Blocks.CRACKED_NETHER_BRICKS); - public static BlockWrapper QUARTZ_BRICKS = of(net.minecraft.block.Blocks.QUARTZ_BRICKS); + public static BlockWrapper AIR = of(net.minecraft.world.level.block.Blocks.AIR); + public static BlockWrapper STONE = of(net.minecraft.world.level.block.Blocks.STONE); + public static BlockWrapper GRANITE = of(net.minecraft.world.level.block.Blocks.GRANITE); + public static BlockWrapper POLISHED_GRANITE = of(net.minecraft.world.level.block.Blocks.POLISHED_GRANITE); + public static BlockWrapper DIORITE = of(net.minecraft.world.level.block.Blocks.DIORITE); + public static BlockWrapper POLISHED_DIORITE = of(net.minecraft.world.level.block.Blocks.POLISHED_DIORITE); + public static BlockWrapper ANDESITE = of(net.minecraft.world.level.block.Blocks.ANDESITE); + public static BlockWrapper POLISHED_ANDESITE = of(net.minecraft.world.level.block.Blocks.POLISHED_ANDESITE); + public static BlockWrapper GRASS_BLOCK = of(net.minecraft.world.level.block.Blocks.GRASS_BLOCK); + public static BlockWrapper DIRT = of(net.minecraft.world.level.block.Blocks.DIRT); + public static BlockWrapper COARSE_DIRT = of(net.minecraft.world.level.block.Blocks.COARSE_DIRT); + public static BlockWrapper PODZOL = of(net.minecraft.world.level.block.Blocks.PODZOL); + public static BlockWrapper COBBLESTONE = of(net.minecraft.world.level.block.Blocks.COBBLESTONE); + public static BlockWrapper OAK_PLANKS = of(net.minecraft.world.level.block.Blocks.OAK_PLANKS); + public static BlockWrapper SPRUCE_PLANKS = of(net.minecraft.world.level.block.Blocks.SPRUCE_PLANKS); + public static BlockWrapper BIRCH_PLANKS = of(net.minecraft.world.level.block.Blocks.BIRCH_PLANKS); + public static BlockWrapper JUNGLE_PLANKS = of(net.minecraft.world.level.block.Blocks.JUNGLE_PLANKS); + public static BlockWrapper ACACIA_PLANKS = of(net.minecraft.world.level.block.Blocks.ACACIA_PLANKS); + public static BlockWrapper DARK_OAK_PLANKS = of(net.minecraft.world.level.block.Blocks.DARK_OAK_PLANKS); + public static BlockWrapper OAK_SAPLING = of(net.minecraft.world.level.block.Blocks.OAK_SAPLING); + public static BlockWrapper SPRUCE_SAPLING = of(net.minecraft.world.level.block.Blocks.SPRUCE_SAPLING); + public static BlockWrapper BIRCH_SAPLING = of(net.minecraft.world.level.block.Blocks.BIRCH_SAPLING); + public static BlockWrapper JUNGLE_SAPLING = of(net.minecraft.world.level.block.Blocks.JUNGLE_SAPLING); + public static BlockWrapper ACACIA_SAPLING = of(net.minecraft.world.level.block.Blocks.ACACIA_SAPLING); + public static BlockWrapper DARK_OAK_SAPLING = of(net.minecraft.world.level.block.Blocks.DARK_OAK_SAPLING); + public static BlockWrapper BEDROCK = of(net.minecraft.world.level.block.Blocks.BEDROCK); + public static BlockWrapper WATER = of(net.minecraft.world.level.block.Blocks.WATER); + public static BlockWrapper LAVA = of(net.minecraft.world.level.block.Blocks.LAVA); + public static BlockWrapper SAND = of(net.minecraft.world.level.block.Blocks.SAND); + public static BlockWrapper RED_SAND = of(net.minecraft.world.level.block.Blocks.RED_SAND); + public static BlockWrapper GRAVEL = of(net.minecraft.world.level.block.Blocks.GRAVEL); + public static BlockWrapper GOLD_ORE = of(net.minecraft.world.level.block.Blocks.GOLD_ORE); + public static BlockWrapper IRON_ORE = of(net.minecraft.world.level.block.Blocks.IRON_ORE); + public static BlockWrapper COAL_ORE = of(net.minecraft.world.level.block.Blocks.COAL_ORE); + public static BlockWrapper NETHER_GOLD_ORE = of(net.minecraft.world.level.block.Blocks.NETHER_GOLD_ORE); + public static BlockWrapper OAK_LOG = of(net.minecraft.world.level.block.Blocks.OAK_LOG); + public static BlockWrapper SPRUCE_LOG = of(net.minecraft.world.level.block.Blocks.SPRUCE_LOG); + public static BlockWrapper BIRCH_LOG = of(net.minecraft.world.level.block.Blocks.BIRCH_LOG); + public static BlockWrapper JUNGLE_LOG = of(net.minecraft.world.level.block.Blocks.JUNGLE_LOG); + public static BlockWrapper ACACIA_LOG = of(net.minecraft.world.level.block.Blocks.ACACIA_LOG); + public static BlockWrapper DARK_OAK_LOG = of(net.minecraft.world.level.block.Blocks.DARK_OAK_LOG); + public static BlockWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.world.level.block.Blocks.STRIPPED_SPRUCE_LOG); + public static BlockWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.world.level.block.Blocks.STRIPPED_BIRCH_LOG); + public static BlockWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.world.level.block.Blocks.STRIPPED_JUNGLE_LOG); + public static BlockWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.world.level.block.Blocks.STRIPPED_ACACIA_LOG); + public static BlockWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.world.level.block.Blocks.STRIPPED_DARK_OAK_LOG); + public static BlockWrapper STRIPPED_OAK_LOG = of(net.minecraft.world.level.block.Blocks.STRIPPED_OAK_LOG); + public static BlockWrapper OAK_WOOD = of(net.minecraft.world.level.block.Blocks.OAK_WOOD); + public static BlockWrapper SPRUCE_WOOD = of(net.minecraft.world.level.block.Blocks.SPRUCE_WOOD); + public static BlockWrapper BIRCH_WOOD = of(net.minecraft.world.level.block.Blocks.BIRCH_WOOD); + public static BlockWrapper JUNGLE_WOOD = of(net.minecraft.world.level.block.Blocks.JUNGLE_WOOD); + public static BlockWrapper ACACIA_WOOD = of(net.minecraft.world.level.block.Blocks.ACACIA_WOOD); + public static BlockWrapper DARK_OAK_WOOD = of(net.minecraft.world.level.block.Blocks.DARK_OAK_WOOD); + public static BlockWrapper STRIPPED_OAK_WOOD = of(net.minecraft.world.level.block.Blocks.STRIPPED_OAK_WOOD); + public static BlockWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.world.level.block.Blocks.STRIPPED_SPRUCE_WOOD); + public static BlockWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.world.level.block.Blocks.STRIPPED_BIRCH_WOOD); + public static BlockWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.world.level.block.Blocks.STRIPPED_JUNGLE_WOOD); + public static BlockWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.world.level.block.Blocks.STRIPPED_ACACIA_WOOD); + public static BlockWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.world.level.block.Blocks.STRIPPED_DARK_OAK_WOOD); + public static BlockWrapper OAK_LEAVES = of(net.minecraft.world.level.block.Blocks.OAK_LEAVES); + public static BlockWrapper SPRUCE_LEAVES = of(net.minecraft.world.level.block.Blocks.SPRUCE_LEAVES); + public static BlockWrapper BIRCH_LEAVES = of(net.minecraft.world.level.block.Blocks.BIRCH_LEAVES); + public static BlockWrapper JUNGLE_LEAVES = of(net.minecraft.world.level.block.Blocks.JUNGLE_LEAVES); + public static BlockWrapper ACACIA_LEAVES = of(net.minecraft.world.level.block.Blocks.ACACIA_LEAVES); + public static BlockWrapper DARK_OAK_LEAVES = of(net.minecraft.world.level.block.Blocks.DARK_OAK_LEAVES); + public static BlockWrapper SPONGE = of(net.minecraft.world.level.block.Blocks.SPONGE); + public static BlockWrapper WET_SPONGE = of(net.minecraft.world.level.block.Blocks.WET_SPONGE); + public static BlockWrapper GLASS = of(net.minecraft.world.level.block.Blocks.GLASS); + public static BlockWrapper LAPIS_ORE = of(net.minecraft.world.level.block.Blocks.LAPIS_ORE); + public static BlockWrapper LAPIS_BLOCK = of(net.minecraft.world.level.block.Blocks.LAPIS_BLOCK); + public static BlockWrapper DISPENSER = of(net.minecraft.world.level.block.Blocks.DISPENSER); + public static BlockWrapper SANDSTONE = of(net.minecraft.world.level.block.Blocks.SANDSTONE); + public static BlockWrapper CHISELED_SANDSTONE = of(net.minecraft.world.level.block.Blocks.CHISELED_SANDSTONE); + public static BlockWrapper CUT_SANDSTONE = of(net.minecraft.world.level.block.Blocks.CUT_SANDSTONE); + public static BlockWrapper NOTE_BLOCK = of(net.minecraft.world.level.block.Blocks.NOTE_BLOCK); + public static BlockWrapper WHITE_BED = of(net.minecraft.world.level.block.Blocks.WHITE_BED); + public static BlockWrapper ORANGE_BED = of(net.minecraft.world.level.block.Blocks.ORANGE_BED); + public static BlockWrapper MAGENTA_BED = of(net.minecraft.world.level.block.Blocks.MAGENTA_BED); + public static BlockWrapper LIGHT_BLUE_BED = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_BED); + public static BlockWrapper YELLOW_BED = of(net.minecraft.world.level.block.Blocks.YELLOW_BED); + public static BlockWrapper LIME_BED = of(net.minecraft.world.level.block.Blocks.LIME_BED); + public static BlockWrapper PINK_BED = of(net.minecraft.world.level.block.Blocks.PINK_BED); + public static BlockWrapper GRAY_BED = of(net.minecraft.world.level.block.Blocks.GRAY_BED); + public static BlockWrapper LIGHT_GRAY_BED = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_BED); + public static BlockWrapper CYAN_BED = of(net.minecraft.world.level.block.Blocks.CYAN_BED); + public static BlockWrapper PURPLE_BED = of(net.minecraft.world.level.block.Blocks.PURPLE_BED); + public static BlockWrapper BLUE_BED = of(net.minecraft.world.level.block.Blocks.BLUE_BED); + public static BlockWrapper BROWN_BED = of(net.minecraft.world.level.block.Blocks.BROWN_BED); + public static BlockWrapper GREEN_BED = of(net.minecraft.world.level.block.Blocks.GREEN_BED); + public static BlockWrapper RED_BED = of(net.minecraft.world.level.block.Blocks.RED_BED); + public static BlockWrapper BLACK_BED = of(net.minecraft.world.level.block.Blocks.BLACK_BED); + public static BlockWrapper POWERED_RAIL = of(net.minecraft.world.level.block.Blocks.POWERED_RAIL); + public static BlockWrapper DETECTOR_RAIL = of(net.minecraft.world.level.block.Blocks.DETECTOR_RAIL); + public static BlockWrapper STICKY_PISTON = of(net.minecraft.world.level.block.Blocks.STICKY_PISTON); + public static BlockWrapper COBWEB = of(net.minecraft.world.level.block.Blocks.COBWEB); + public static BlockWrapper GRASS = of(net.minecraft.world.level.block.Blocks.SHORT_GRASS); + public static BlockWrapper FERN = of(net.minecraft.world.level.block.Blocks.FERN); + public static BlockWrapper DEAD_BUSH = of(net.minecraft.world.level.block.Blocks.DEAD_BUSH); + public static BlockWrapper SEAGRASS = of(net.minecraft.world.level.block.Blocks.SEAGRASS); + public static BlockWrapper TALL_SEAGRASS = of(net.minecraft.world.level.block.Blocks.TALL_SEAGRASS); + public static BlockWrapper PISTON = of(net.minecraft.world.level.block.Blocks.PISTON); + public static BlockWrapper PISTON_HEAD = of(net.minecraft.world.level.block.Blocks.PISTON_HEAD); + public static BlockWrapper WHITE_WOOL = of(net.minecraft.world.level.block.Blocks.WHITE_WOOL); + public static BlockWrapper ORANGE_WOOL = of(net.minecraft.world.level.block.Blocks.ORANGE_WOOL); + public static BlockWrapper MAGENTA_WOOL = of(net.minecraft.world.level.block.Blocks.MAGENTA_WOOL); + public static BlockWrapper LIGHT_BLUE_WOOL = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_WOOL); + public static BlockWrapper YELLOW_WOOL = of(net.minecraft.world.level.block.Blocks.YELLOW_WOOL); + public static BlockWrapper LIME_WOOL = of(net.minecraft.world.level.block.Blocks.LIME_WOOL); + public static BlockWrapper PINK_WOOL = of(net.minecraft.world.level.block.Blocks.PINK_WOOL); + public static BlockWrapper GRAY_WOOL = of(net.minecraft.world.level.block.Blocks.GRAY_WOOL); + public static BlockWrapper LIGHT_GRAY_WOOL = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_WOOL); + public static BlockWrapper CYAN_WOOL = of(net.minecraft.world.level.block.Blocks.CYAN_WOOL); + public static BlockWrapper PURPLE_WOOL = of(net.minecraft.world.level.block.Blocks.PURPLE_WOOL); + public static BlockWrapper BLUE_WOOL = of(net.minecraft.world.level.block.Blocks.BLUE_WOOL); + public static BlockWrapper BROWN_WOOL = of(net.minecraft.world.level.block.Blocks.BROWN_WOOL); + public static BlockWrapper GREEN_WOOL = of(net.minecraft.world.level.block.Blocks.GREEN_WOOL); + public static BlockWrapper RED_WOOL = of(net.minecraft.world.level.block.Blocks.RED_WOOL); + public static BlockWrapper BLACK_WOOL = of(net.minecraft.world.level.block.Blocks.BLACK_WOOL); + public static BlockWrapper MOVING_PISTON = of(net.minecraft.world.level.block.Blocks.MOVING_PISTON); + public static BlockWrapper DANDELION = of(net.minecraft.world.level.block.Blocks.DANDELION); + public static BlockWrapper POPPY = of(net.minecraft.world.level.block.Blocks.POPPY); + public static BlockWrapper BLUE_ORCHID = of(net.minecraft.world.level.block.Blocks.BLUE_ORCHID); + public static BlockWrapper ALLIUM = of(net.minecraft.world.level.block.Blocks.ALLIUM); + public static BlockWrapper AZURE_BLUET = of(net.minecraft.world.level.block.Blocks.AZURE_BLUET); + public static BlockWrapper RED_TULIP = of(net.minecraft.world.level.block.Blocks.RED_TULIP); + public static BlockWrapper ORANGE_TULIP = of(net.minecraft.world.level.block.Blocks.ORANGE_TULIP); + public static BlockWrapper WHITE_TULIP = of(net.minecraft.world.level.block.Blocks.WHITE_TULIP); + public static BlockWrapper PINK_TULIP = of(net.minecraft.world.level.block.Blocks.PINK_TULIP); + public static BlockWrapper OXEYE_DAISY = of(net.minecraft.world.level.block.Blocks.OXEYE_DAISY); + public static BlockWrapper CORNFLOWER = of(net.minecraft.world.level.block.Blocks.CORNFLOWER); + public static BlockWrapper WITHER_ROSE = of(net.minecraft.world.level.block.Blocks.WITHER_ROSE); + public static BlockWrapper LILY_OF_THE_VALLEY = of(net.minecraft.world.level.block.Blocks.LILY_OF_THE_VALLEY); + public static BlockWrapper BROWN_MUSHROOM = of(net.minecraft.world.level.block.Blocks.BROWN_MUSHROOM); + public static BlockWrapper RED_MUSHROOM = of(net.minecraft.world.level.block.Blocks.RED_MUSHROOM); + public static BlockWrapper GOLD_BLOCK = of(net.minecraft.world.level.block.Blocks.GOLD_BLOCK); + public static BlockWrapper IRON_BLOCK = of(net.minecraft.world.level.block.Blocks.IRON_BLOCK); + public static BlockWrapper BRICKS = of(net.minecraft.world.level.block.Blocks.BRICKS); + public static BlockWrapper TNT = of(net.minecraft.world.level.block.Blocks.TNT); + public static BlockWrapper BOOKSHELF = of(net.minecraft.world.level.block.Blocks.BOOKSHELF); + public static BlockWrapper MOSSY_COBBLESTONE = of(net.minecraft.world.level.block.Blocks.MOSSY_COBBLESTONE); + public static BlockWrapper OBSIDIAN = of(net.minecraft.world.level.block.Blocks.OBSIDIAN); + public static BlockWrapper TORCH = of(net.minecraft.world.level.block.Blocks.TORCH); + public static BlockWrapper WALL_TORCH = of(net.minecraft.world.level.block.Blocks.WALL_TORCH); + public static BlockWrapper FIRE = of(net.minecraft.world.level.block.Blocks.FIRE); + public static BlockWrapper SOUL_FIRE = of(net.minecraft.world.level.block.Blocks.SOUL_FIRE); + public static BlockWrapper SPAWNER = of(net.minecraft.world.level.block.Blocks.SPAWNER); + public static BlockWrapper OAK_STAIRS = of(net.minecraft.world.level.block.Blocks.OAK_STAIRS); + public static BlockWrapper CHEST = of(net.minecraft.world.level.block.Blocks.CHEST); + public static BlockWrapper REDSTONE_WIRE = of(net.minecraft.world.level.block.Blocks.REDSTONE_WIRE); + public static BlockWrapper DIAMOND_ORE = of(net.minecraft.world.level.block.Blocks.DIAMOND_ORE); + public static BlockWrapper DIAMOND_BLOCK = of(net.minecraft.world.level.block.Blocks.DIAMOND_BLOCK); + public static BlockWrapper CRAFTING_TABLE = of(net.minecraft.world.level.block.Blocks.CRAFTING_TABLE); + public static BlockWrapper WHEAT = of(net.minecraft.world.level.block.Blocks.WHEAT); + public static BlockWrapper FARMLAND = of(net.minecraft.world.level.block.Blocks.FARMLAND); + public static BlockWrapper FURNACE = of(net.minecraft.world.level.block.Blocks.FURNACE); + public static BlockWrapper OAK_SIGN = of(net.minecraft.world.level.block.Blocks.OAK_SIGN); + public static BlockWrapper SPRUCE_SIGN = of(net.minecraft.world.level.block.Blocks.SPRUCE_SIGN); + public static BlockWrapper BIRCH_SIGN = of(net.minecraft.world.level.block.Blocks.BIRCH_SIGN); + public static BlockWrapper ACACIA_SIGN = of(net.minecraft.world.level.block.Blocks.ACACIA_SIGN); + public static BlockWrapper JUNGLE_SIGN = of(net.minecraft.world.level.block.Blocks.JUNGLE_SIGN); + public static BlockWrapper DARK_OAK_SIGN = of(net.minecraft.world.level.block.Blocks.DARK_OAK_SIGN); + public static BlockWrapper OAK_DOOR = of(net.minecraft.world.level.block.Blocks.OAK_DOOR); + public static BlockWrapper LADDER = of(net.minecraft.world.level.block.Blocks.LADDER); + public static BlockWrapper RAIL = of(net.minecraft.world.level.block.Blocks.RAIL); + public static BlockWrapper COBBLESTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.COBBLESTONE_STAIRS); + public static BlockWrapper OAK_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.OAK_WALL_SIGN); + public static BlockWrapper SPRUCE_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.SPRUCE_WALL_SIGN); + public static BlockWrapper BIRCH_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.BIRCH_WALL_SIGN); + public static BlockWrapper ACACIA_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.ACACIA_WALL_SIGN); + public static BlockWrapper JUNGLE_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.JUNGLE_WALL_SIGN); + public static BlockWrapper DARK_OAK_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.DARK_OAK_WALL_SIGN); + public static BlockWrapper LEVER = of(net.minecraft.world.level.block.Blocks.LEVER); + public static BlockWrapper STONE_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.STONE_PRESSURE_PLATE); + public static BlockWrapper IRON_DOOR = of(net.minecraft.world.level.block.Blocks.IRON_DOOR); + public static BlockWrapper OAK_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.OAK_PRESSURE_PLATE); + public static BlockWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.SPRUCE_PRESSURE_PLATE); + public static BlockWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.BIRCH_PRESSURE_PLATE); + public static BlockWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.JUNGLE_PRESSURE_PLATE); + public static BlockWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.ACACIA_PRESSURE_PLATE); + public static BlockWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.DARK_OAK_PRESSURE_PLATE); + public static BlockWrapper REDSTONE_ORE = of(net.minecraft.world.level.block.Blocks.REDSTONE_ORE); + public static BlockWrapper REDSTONE_TORCH = of(net.minecraft.world.level.block.Blocks.REDSTONE_TORCH); + public static BlockWrapper REDSTONE_WALL_TORCH = of(net.minecraft.world.level.block.Blocks.REDSTONE_WALL_TORCH); + public static BlockWrapper STONE_BUTTON = of(net.minecraft.world.level.block.Blocks.STONE_BUTTON); + public static BlockWrapper SNOW = of(net.minecraft.world.level.block.Blocks.SNOW); + public static BlockWrapper ICE = of(net.minecraft.world.level.block.Blocks.ICE); + public static BlockWrapper SNOW_BLOCK = of(net.minecraft.world.level.block.Blocks.SNOW_BLOCK); + public static BlockWrapper CACTUS = of(net.minecraft.world.level.block.Blocks.CACTUS); + public static BlockWrapper CLAY = of(net.minecraft.world.level.block.Blocks.CLAY); + public static BlockWrapper SUGAR_CANE = of(net.minecraft.world.level.block.Blocks.SUGAR_CANE); + public static BlockWrapper JUKEBOX = of(net.minecraft.world.level.block.Blocks.JUKEBOX); + public static BlockWrapper OAK_FENCE = of(net.minecraft.world.level.block.Blocks.OAK_FENCE); + public static BlockWrapper PUMPKIN = of(net.minecraft.world.level.block.Blocks.PUMPKIN); + public static BlockWrapper NETHERRACK = of(net.minecraft.world.level.block.Blocks.NETHERRACK); + public static BlockWrapper SOUL_SAND = of(net.minecraft.world.level.block.Blocks.SOUL_SAND); + public static BlockWrapper SOUL_SOIL = of(net.minecraft.world.level.block.Blocks.SOUL_SOIL); + public static BlockWrapper BASALT = of(net.minecraft.world.level.block.Blocks.BASALT); + public static BlockWrapper POLISHED_BASALT = of(net.minecraft.world.level.block.Blocks.POLISHED_BASALT); + public static BlockWrapper SOUL_TORCH = of(net.minecraft.world.level.block.Blocks.SOUL_TORCH); + public static BlockWrapper SOUL_WALL_TORCH = of(net.minecraft.world.level.block.Blocks.SOUL_WALL_TORCH); + public static BlockWrapper GLOWSTONE = of(net.minecraft.world.level.block.Blocks.GLOWSTONE); + public static BlockWrapper NETHER_PORTAL = of(net.minecraft.world.level.block.Blocks.NETHER_PORTAL); + public static BlockWrapper CARVED_PUMPKIN = of(net.minecraft.world.level.block.Blocks.CARVED_PUMPKIN); + public static BlockWrapper JACK_O_LANTERN = of(net.minecraft.world.level.block.Blocks.JACK_O_LANTERN); + public static BlockWrapper CAKE = of(net.minecraft.world.level.block.Blocks.CAKE); + public static BlockWrapper REPEATER = of(net.minecraft.world.level.block.Blocks.REPEATER); + public static BlockWrapper WHITE_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.WHITE_STAINED_GLASS); + public static BlockWrapper ORANGE_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.ORANGE_STAINED_GLASS); + public static BlockWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.MAGENTA_STAINED_GLASS); + public static BlockWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_STAINED_GLASS); + public static BlockWrapper YELLOW_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.YELLOW_STAINED_GLASS); + public static BlockWrapper LIME_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.LIME_STAINED_GLASS); + public static BlockWrapper PINK_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.PINK_STAINED_GLASS); + public static BlockWrapper GRAY_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.GRAY_STAINED_GLASS); + public static BlockWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_STAINED_GLASS); + public static BlockWrapper CYAN_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.CYAN_STAINED_GLASS); + public static BlockWrapper PURPLE_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.PURPLE_STAINED_GLASS); + public static BlockWrapper BLUE_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.BLUE_STAINED_GLASS); + public static BlockWrapper BROWN_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.BROWN_STAINED_GLASS); + public static BlockWrapper GREEN_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.GREEN_STAINED_GLASS); + public static BlockWrapper RED_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.RED_STAINED_GLASS); + public static BlockWrapper BLACK_STAINED_GLASS = of(net.minecraft.world.level.block.Blocks.BLACK_STAINED_GLASS); + public static BlockWrapper OAK_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.OAK_TRAPDOOR); + public static BlockWrapper SPRUCE_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.SPRUCE_TRAPDOOR); + public static BlockWrapper BIRCH_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.BIRCH_TRAPDOOR); + public static BlockWrapper JUNGLE_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.JUNGLE_TRAPDOOR); + public static BlockWrapper ACACIA_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.ACACIA_TRAPDOOR); + public static BlockWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.DARK_OAK_TRAPDOOR); + public static BlockWrapper STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.STONE_BRICKS); + public static BlockWrapper MOSSY_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.MOSSY_STONE_BRICKS); + public static BlockWrapper CRACKED_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.CRACKED_STONE_BRICKS); + public static BlockWrapper CHISELED_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.CHISELED_STONE_BRICKS); + public static BlockWrapper INFESTED_STONE = of(net.minecraft.world.level.block.Blocks.INFESTED_STONE); + public static BlockWrapper INFESTED_COBBLESTONE = of(net.minecraft.world.level.block.Blocks.INFESTED_COBBLESTONE); + public static BlockWrapper INFESTED_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.INFESTED_STONE_BRICKS); + public static BlockWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.INFESTED_MOSSY_STONE_BRICKS); + public static BlockWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.INFESTED_CRACKED_STONE_BRICKS); + public static BlockWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.INFESTED_CHISELED_STONE_BRICKS); + public static BlockWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.world.level.block.Blocks.BROWN_MUSHROOM_BLOCK); + public static BlockWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.world.level.block.Blocks.RED_MUSHROOM_BLOCK); + public static BlockWrapper MUSHROOM_STEM = of(net.minecraft.world.level.block.Blocks.MUSHROOM_STEM); + public static BlockWrapper IRON_BARS = of(net.minecraft.world.level.block.Blocks.IRON_BARS); + public static BlockWrapper CHAIN = of(net.minecraft.world.level.block.Blocks.IRON_CHAIN); + public static BlockWrapper GLASS_PANE = of(net.minecraft.world.level.block.Blocks.GLASS_PANE); + public static BlockWrapper MELON = of(net.minecraft.world.level.block.Blocks.MELON); + public static BlockWrapper ATTACHED_PUMPKIN_STEM = of(net.minecraft.world.level.block.Blocks.ATTACHED_PUMPKIN_STEM); + public static BlockWrapper ATTACHED_MELON_STEM = of(net.minecraft.world.level.block.Blocks.ATTACHED_MELON_STEM); + public static BlockWrapper PUMPKIN_STEM = of(net.minecraft.world.level.block.Blocks.PUMPKIN_STEM); + public static BlockWrapper MELON_STEM = of(net.minecraft.world.level.block.Blocks.MELON_STEM); + public static BlockWrapper VINE = of(net.minecraft.world.level.block.Blocks.VINE); + public static BlockWrapper OAK_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.OAK_FENCE_GATE); + public static BlockWrapper BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.BRICK_STAIRS); + public static BlockWrapper STONE_BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.STONE_BRICK_STAIRS); + public static BlockWrapper MYCELIUM = of(net.minecraft.world.level.block.Blocks.MYCELIUM); + public static BlockWrapper LILY_PAD = of(net.minecraft.world.level.block.Blocks.LILY_PAD); + public static BlockWrapper NETHER_BRICKS = of(net.minecraft.world.level.block.Blocks.NETHER_BRICKS); + public static BlockWrapper NETHER_BRICK_FENCE = of(net.minecraft.world.level.block.Blocks.NETHER_BRICK_FENCE); + public static BlockWrapper NETHER_BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.NETHER_BRICK_STAIRS); + public static BlockWrapper NETHER_WART = of(net.minecraft.world.level.block.Blocks.NETHER_WART); + public static BlockWrapper ENCHANTING_TABLE = of(net.minecraft.world.level.block.Blocks.ENCHANTING_TABLE); + public static BlockWrapper BREWING_STAND = of(net.minecraft.world.level.block.Blocks.BREWING_STAND); + public static BlockWrapper CAULDRON = of(net.minecraft.world.level.block.Blocks.CAULDRON); + public static BlockWrapper END_PORTAL = of(net.minecraft.world.level.block.Blocks.END_PORTAL); + public static BlockWrapper END_PORTAL_FRAME = of(net.minecraft.world.level.block.Blocks.END_PORTAL_FRAME); + public static BlockWrapper END_STONE = of(net.minecraft.world.level.block.Blocks.END_STONE); + public static BlockWrapper DRAGON_EGG = of(net.minecraft.world.level.block.Blocks.DRAGON_EGG); + public static BlockWrapper REDSTONE_LAMP = of(net.minecraft.world.level.block.Blocks.REDSTONE_LAMP); + public static BlockWrapper COCOA = of(net.minecraft.world.level.block.Blocks.COCOA); + public static BlockWrapper SANDSTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.SANDSTONE_STAIRS); + public static BlockWrapper EMERALD_ORE = of(net.minecraft.world.level.block.Blocks.EMERALD_ORE); + public static BlockWrapper ENDER_CHEST = of(net.minecraft.world.level.block.Blocks.ENDER_CHEST); + public static BlockWrapper TRIPWIRE_HOOK = of(net.minecraft.world.level.block.Blocks.TRIPWIRE_HOOK); + public static BlockWrapper TRIPWIRE = of(net.minecraft.world.level.block.Blocks.TRIPWIRE); + public static BlockWrapper EMERALD_BLOCK = of(net.minecraft.world.level.block.Blocks.EMERALD_BLOCK); + public static BlockWrapper SPRUCE_STAIRS = of(net.minecraft.world.level.block.Blocks.SPRUCE_STAIRS); + public static BlockWrapper BIRCH_STAIRS = of(net.minecraft.world.level.block.Blocks.BIRCH_STAIRS); + public static BlockWrapper JUNGLE_STAIRS = of(net.minecraft.world.level.block.Blocks.JUNGLE_STAIRS); + public static BlockWrapper COMMAND_BLOCK = of(net.minecraft.world.level.block.Blocks.COMMAND_BLOCK); + public static BlockWrapper BEACON = of(net.minecraft.world.level.block.Blocks.BEACON); + public static BlockWrapper COBBLESTONE_WALL = of(net.minecraft.world.level.block.Blocks.COBBLESTONE_WALL); + public static BlockWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.world.level.block.Blocks.MOSSY_COBBLESTONE_WALL); + public static BlockWrapper FLOWER_POT = of(net.minecraft.world.level.block.Blocks.FLOWER_POT); + public static BlockWrapper POTTED_OAK_SAPLING = of(net.minecraft.world.level.block.Blocks.POTTED_OAK_SAPLING); + public static BlockWrapper POTTED_SPRUCE_SAPLING = of(net.minecraft.world.level.block.Blocks.POTTED_SPRUCE_SAPLING); + public static BlockWrapper POTTED_BIRCH_SAPLING = of(net.minecraft.world.level.block.Blocks.POTTED_BIRCH_SAPLING); + public static BlockWrapper POTTED_JUNGLE_SAPLING = of(net.minecraft.world.level.block.Blocks.POTTED_JUNGLE_SAPLING); + public static BlockWrapper POTTED_ACACIA_SAPLING = of(net.minecraft.world.level.block.Blocks.POTTED_ACACIA_SAPLING); + public static BlockWrapper POTTED_DARK_OAK_SAPLING = of(net.minecraft.world.level.block.Blocks.POTTED_DARK_OAK_SAPLING); + public static BlockWrapper POTTED_FERN = of(net.minecraft.world.level.block.Blocks.POTTED_FERN); + public static BlockWrapper POTTED_DANDELION = of(net.minecraft.world.level.block.Blocks.POTTED_DANDELION); + public static BlockWrapper POTTED_POPPY = of(net.minecraft.world.level.block.Blocks.POTTED_POPPY); + public static BlockWrapper POTTED_BLUE_ORCHID = of(net.minecraft.world.level.block.Blocks.POTTED_BLUE_ORCHID); + public static BlockWrapper POTTED_ALLIUM = of(net.minecraft.world.level.block.Blocks.POTTED_ALLIUM); + public static BlockWrapper POTTED_AZURE_BLUET = of(net.minecraft.world.level.block.Blocks.POTTED_AZURE_BLUET); + public static BlockWrapper POTTED_RED_TULIP = of(net.minecraft.world.level.block.Blocks.POTTED_RED_TULIP); + public static BlockWrapper POTTED_ORANGE_TULIP = of(net.minecraft.world.level.block.Blocks.POTTED_ORANGE_TULIP); + public static BlockWrapper POTTED_WHITE_TULIP = of(net.minecraft.world.level.block.Blocks.POTTED_WHITE_TULIP); + public static BlockWrapper POTTED_PINK_TULIP = of(net.minecraft.world.level.block.Blocks.POTTED_PINK_TULIP); + public static BlockWrapper POTTED_OXEYE_DAISY = of(net.minecraft.world.level.block.Blocks.POTTED_OXEYE_DAISY); + public static BlockWrapper POTTED_CORNFLOWER = of(net.minecraft.world.level.block.Blocks.POTTED_CORNFLOWER); + public static BlockWrapper POTTED_LILY_OF_THE_VALLEY = of(net.minecraft.world.level.block.Blocks.POTTED_LILY_OF_THE_VALLEY); + public static BlockWrapper POTTED_WITHER_ROSE = of(net.minecraft.world.level.block.Blocks.POTTED_WITHER_ROSE); + public static BlockWrapper POTTED_RED_MUSHROOM = of(net.minecraft.world.level.block.Blocks.POTTED_RED_MUSHROOM); + public static BlockWrapper POTTED_BROWN_MUSHROOM = of(net.minecraft.world.level.block.Blocks.POTTED_BROWN_MUSHROOM); + public static BlockWrapper POTTED_DEAD_BUSH = of(net.minecraft.world.level.block.Blocks.POTTED_DEAD_BUSH); + public static BlockWrapper POTTED_CACTUS = of(net.minecraft.world.level.block.Blocks.POTTED_CACTUS); + public static BlockWrapper CARROTS = of(net.minecraft.world.level.block.Blocks.CARROTS); + public static BlockWrapper POTATOES = of(net.minecraft.world.level.block.Blocks.POTATOES); + public static BlockWrapper OAK_BUTTON = of(net.minecraft.world.level.block.Blocks.OAK_BUTTON); + public static BlockWrapper SPRUCE_BUTTON = of(net.minecraft.world.level.block.Blocks.SPRUCE_BUTTON); + public static BlockWrapper BIRCH_BUTTON = of(net.minecraft.world.level.block.Blocks.BIRCH_BUTTON); + public static BlockWrapper JUNGLE_BUTTON = of(net.minecraft.world.level.block.Blocks.JUNGLE_BUTTON); + public static BlockWrapper ACACIA_BUTTON = of(net.minecraft.world.level.block.Blocks.ACACIA_BUTTON); + public static BlockWrapper DARK_OAK_BUTTON = of(net.minecraft.world.level.block.Blocks.DARK_OAK_BUTTON); + public static BlockWrapper SKELETON_SKULL = of(net.minecraft.world.level.block.Blocks.SKELETON_SKULL); + public static BlockWrapper SKELETON_WALL_SKULL = of(net.minecraft.world.level.block.Blocks.SKELETON_WALL_SKULL); + public static BlockWrapper WITHER_SKELETON_SKULL = of(net.minecraft.world.level.block.Blocks.WITHER_SKELETON_SKULL); + public static BlockWrapper WITHER_SKELETON_WALL_SKULL = of(net.minecraft.world.level.block.Blocks.WITHER_SKELETON_WALL_SKULL); + public static BlockWrapper ZOMBIE_HEAD = of(net.minecraft.world.level.block.Blocks.ZOMBIE_HEAD); + public static BlockWrapper ZOMBIE_WALL_HEAD = of(net.minecraft.world.level.block.Blocks.ZOMBIE_WALL_HEAD); + public static BlockWrapper PLAYER_HEAD = of(net.minecraft.world.level.block.Blocks.PLAYER_HEAD); + public static BlockWrapper PLAYER_WALL_HEAD = of(net.minecraft.world.level.block.Blocks.PLAYER_WALL_HEAD); + public static BlockWrapper CREEPER_HEAD = of(net.minecraft.world.level.block.Blocks.CREEPER_HEAD); + public static BlockWrapper CREEPER_WALL_HEAD = of(net.minecraft.world.level.block.Blocks.CREEPER_WALL_HEAD); + public static BlockWrapper DRAGON_HEAD = of(net.minecraft.world.level.block.Blocks.DRAGON_HEAD); + public static BlockWrapper DRAGON_WALL_HEAD = of(net.minecraft.world.level.block.Blocks.DRAGON_WALL_HEAD); + public static BlockWrapper ANVIL = of(net.minecraft.world.level.block.Blocks.ANVIL); + public static BlockWrapper CHIPPED_ANVIL = of(net.minecraft.world.level.block.Blocks.CHIPPED_ANVIL); + public static BlockWrapper DAMAGED_ANVIL = of(net.minecraft.world.level.block.Blocks.DAMAGED_ANVIL); + public static BlockWrapper TRAPPED_CHEST = of(net.minecraft.world.level.block.Blocks.TRAPPED_CHEST); + public static BlockWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE); + public static BlockWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE); + public static BlockWrapper COMPARATOR = of(net.minecraft.world.level.block.Blocks.COMPARATOR); + public static BlockWrapper DAYLIGHT_DETECTOR = of(net.minecraft.world.level.block.Blocks.DAYLIGHT_DETECTOR); + public static BlockWrapper REDSTONE_BLOCK = of(net.minecraft.world.level.block.Blocks.REDSTONE_BLOCK); + public static BlockWrapper NETHER_QUARTZ_ORE = of(net.minecraft.world.level.block.Blocks.NETHER_QUARTZ_ORE); + public static BlockWrapper HOPPER = of(net.minecraft.world.level.block.Blocks.HOPPER); + public static BlockWrapper QUARTZ_BLOCK = of(net.minecraft.world.level.block.Blocks.QUARTZ_BLOCK); + public static BlockWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.world.level.block.Blocks.CHISELED_QUARTZ_BLOCK); + public static BlockWrapper QUARTZ_PILLAR = of(net.minecraft.world.level.block.Blocks.QUARTZ_PILLAR); + public static BlockWrapper QUARTZ_STAIRS = of(net.minecraft.world.level.block.Blocks.QUARTZ_STAIRS); + public static BlockWrapper ACTIVATOR_RAIL = of(net.minecraft.world.level.block.Blocks.ACTIVATOR_RAIL); + public static BlockWrapper DROPPER = of(net.minecraft.world.level.block.Blocks.DROPPER); + public static BlockWrapper WHITE_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.WHITE_TERRACOTTA); + public static BlockWrapper ORANGE_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.ORANGE_TERRACOTTA); + public static BlockWrapper MAGENTA_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.MAGENTA_TERRACOTTA); + public static BlockWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_TERRACOTTA); + public static BlockWrapper YELLOW_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.YELLOW_TERRACOTTA); + public static BlockWrapper LIME_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.LIME_TERRACOTTA); + public static BlockWrapper PINK_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.PINK_TERRACOTTA); + public static BlockWrapper GRAY_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.GRAY_TERRACOTTA); + public static BlockWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_TERRACOTTA); + public static BlockWrapper CYAN_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.CYAN_TERRACOTTA); + public static BlockWrapper PURPLE_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.PURPLE_TERRACOTTA); + public static BlockWrapper BLUE_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.BLUE_TERRACOTTA); + public static BlockWrapper BROWN_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.BROWN_TERRACOTTA); + public static BlockWrapper GREEN_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.GREEN_TERRACOTTA); + public static BlockWrapper RED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.RED_TERRACOTTA); + public static BlockWrapper BLACK_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.BLACK_TERRACOTTA); + public static BlockWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.WHITE_STAINED_GLASS_PANE); + public static BlockWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.ORANGE_STAINED_GLASS_PANE); + public static BlockWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.MAGENTA_STAINED_GLASS_PANE); + public static BlockWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_STAINED_GLASS_PANE); + public static BlockWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.YELLOW_STAINED_GLASS_PANE); + public static BlockWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.LIME_STAINED_GLASS_PANE); + public static BlockWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.PINK_STAINED_GLASS_PANE); + public static BlockWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.GRAY_STAINED_GLASS_PANE); + public static BlockWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_STAINED_GLASS_PANE); + public static BlockWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.CYAN_STAINED_GLASS_PANE); + public static BlockWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.PURPLE_STAINED_GLASS_PANE); + public static BlockWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.BLUE_STAINED_GLASS_PANE); + public static BlockWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.BROWN_STAINED_GLASS_PANE); + public static BlockWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.GREEN_STAINED_GLASS_PANE); + public static BlockWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.RED_STAINED_GLASS_PANE); + public static BlockWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.world.level.block.Blocks.BLACK_STAINED_GLASS_PANE); + public static BlockWrapper ACACIA_STAIRS = of(net.minecraft.world.level.block.Blocks.ACACIA_STAIRS); + public static BlockWrapper DARK_OAK_STAIRS = of(net.minecraft.world.level.block.Blocks.DARK_OAK_STAIRS); + public static BlockWrapper SLIME_BLOCK = of(net.minecraft.world.level.block.Blocks.SLIME_BLOCK); + public static BlockWrapper BARRIER = of(net.minecraft.world.level.block.Blocks.BARRIER); + public static BlockWrapper IRON_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.IRON_TRAPDOOR); + public static BlockWrapper PRISMARINE = of(net.minecraft.world.level.block.Blocks.PRISMARINE); + public static BlockWrapper PRISMARINE_BRICKS = of(net.minecraft.world.level.block.Blocks.PRISMARINE_BRICKS); + public static BlockWrapper DARK_PRISMARINE = of(net.minecraft.world.level.block.Blocks.DARK_PRISMARINE); + public static BlockWrapper PRISMARINE_STAIRS = of(net.minecraft.world.level.block.Blocks.PRISMARINE_STAIRS); + public static BlockWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.PRISMARINE_BRICK_STAIRS); + public static BlockWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.world.level.block.Blocks.DARK_PRISMARINE_STAIRS); + public static BlockWrapper PRISMARINE_SLAB = of(net.minecraft.world.level.block.Blocks.PRISMARINE_SLAB); + public static BlockWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.PRISMARINE_BRICK_SLAB); + public static BlockWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.world.level.block.Blocks.DARK_PRISMARINE_SLAB); + public static BlockWrapper SEA_LANTERN = of(net.minecraft.world.level.block.Blocks.SEA_LANTERN); + public static BlockWrapper HAY_BLOCK = of(net.minecraft.world.level.block.Blocks.HAY_BLOCK); + public static BlockWrapper WHITE_CARPET = of(net.minecraft.world.level.block.Blocks.WHITE_CARPET); + public static BlockWrapper ORANGE_CARPET = of(net.minecraft.world.level.block.Blocks.ORANGE_CARPET); + public static BlockWrapper MAGENTA_CARPET = of(net.minecraft.world.level.block.Blocks.MAGENTA_CARPET); + public static BlockWrapper LIGHT_BLUE_CARPET = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_CARPET); + public static BlockWrapper YELLOW_CARPET = of(net.minecraft.world.level.block.Blocks.YELLOW_CARPET); + public static BlockWrapper LIME_CARPET = of(net.minecraft.world.level.block.Blocks.LIME_CARPET); + public static BlockWrapper PINK_CARPET = of(net.minecraft.world.level.block.Blocks.PINK_CARPET); + public static BlockWrapper GRAY_CARPET = of(net.minecraft.world.level.block.Blocks.GRAY_CARPET); + public static BlockWrapper LIGHT_GRAY_CARPET = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_CARPET); + public static BlockWrapper CYAN_CARPET = of(net.minecraft.world.level.block.Blocks.CYAN_CARPET); + public static BlockWrapper PURPLE_CARPET = of(net.minecraft.world.level.block.Blocks.PURPLE_CARPET); + public static BlockWrapper BLUE_CARPET = of(net.minecraft.world.level.block.Blocks.BLUE_CARPET); + public static BlockWrapper BROWN_CARPET = of(net.minecraft.world.level.block.Blocks.BROWN_CARPET); + public static BlockWrapper GREEN_CARPET = of(net.minecraft.world.level.block.Blocks.GREEN_CARPET); + public static BlockWrapper RED_CARPET = of(net.minecraft.world.level.block.Blocks.RED_CARPET); + public static BlockWrapper BLACK_CARPET = of(net.minecraft.world.level.block.Blocks.BLACK_CARPET); + public static BlockWrapper TERRACOTTA = of(net.minecraft.world.level.block.Blocks.TERRACOTTA); + public static BlockWrapper COAL_BLOCK = of(net.minecraft.world.level.block.Blocks.COAL_BLOCK); + public static BlockWrapper PACKED_ICE = of(net.minecraft.world.level.block.Blocks.PACKED_ICE); + public static BlockWrapper SUNFLOWER = of(net.minecraft.world.level.block.Blocks.SUNFLOWER); + public static BlockWrapper LILAC = of(net.minecraft.world.level.block.Blocks.LILAC); + public static BlockWrapper ROSE_BUSH = of(net.minecraft.world.level.block.Blocks.ROSE_BUSH); + public static BlockWrapper PEONY = of(net.minecraft.world.level.block.Blocks.PEONY); + public static BlockWrapper TALL_GRASS = of(net.minecraft.world.level.block.Blocks.TALL_GRASS); + public static BlockWrapper LARGE_FERN = of(net.minecraft.world.level.block.Blocks.LARGE_FERN); + public static BlockWrapper WHITE_BANNER = of(net.minecraft.world.level.block.Blocks.WHITE_BANNER); + public static BlockWrapper ORANGE_BANNER = of(net.minecraft.world.level.block.Blocks.ORANGE_BANNER); + public static BlockWrapper MAGENTA_BANNER = of(net.minecraft.world.level.block.Blocks.MAGENTA_BANNER); + public static BlockWrapper LIGHT_BLUE_BANNER = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_BANNER); + public static BlockWrapper YELLOW_BANNER = of(net.minecraft.world.level.block.Blocks.YELLOW_BANNER); + public static BlockWrapper LIME_BANNER = of(net.minecraft.world.level.block.Blocks.LIME_BANNER); + public static BlockWrapper PINK_BANNER = of(net.minecraft.world.level.block.Blocks.PINK_BANNER); + public static BlockWrapper GRAY_BANNER = of(net.minecraft.world.level.block.Blocks.GRAY_BANNER); + public static BlockWrapper LIGHT_GRAY_BANNER = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_BANNER); + public static BlockWrapper CYAN_BANNER = of(net.minecraft.world.level.block.Blocks.CYAN_BANNER); + public static BlockWrapper PURPLE_BANNER = of(net.minecraft.world.level.block.Blocks.PURPLE_BANNER); + public static BlockWrapper BLUE_BANNER = of(net.minecraft.world.level.block.Blocks.BLUE_BANNER); + public static BlockWrapper BROWN_BANNER = of(net.minecraft.world.level.block.Blocks.BROWN_BANNER); + public static BlockWrapper GREEN_BANNER = of(net.minecraft.world.level.block.Blocks.GREEN_BANNER); + public static BlockWrapper RED_BANNER = of(net.minecraft.world.level.block.Blocks.RED_BANNER); + public static BlockWrapper BLACK_BANNER = of(net.minecraft.world.level.block.Blocks.BLACK_BANNER); + public static BlockWrapper WHITE_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.WHITE_WALL_BANNER); + public static BlockWrapper ORANGE_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.ORANGE_WALL_BANNER); + public static BlockWrapper MAGENTA_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.MAGENTA_WALL_BANNER); + public static BlockWrapper LIGHT_BLUE_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_WALL_BANNER); + public static BlockWrapper YELLOW_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.YELLOW_WALL_BANNER); + public static BlockWrapper LIME_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.LIME_WALL_BANNER); + public static BlockWrapper PINK_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.PINK_WALL_BANNER); + public static BlockWrapper GRAY_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.GRAY_WALL_BANNER); + public static BlockWrapper LIGHT_GRAY_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_WALL_BANNER); + public static BlockWrapper CYAN_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.CYAN_WALL_BANNER); + public static BlockWrapper PURPLE_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.PURPLE_WALL_BANNER); + public static BlockWrapper BLUE_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.BLUE_WALL_BANNER); + public static BlockWrapper BROWN_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.BROWN_WALL_BANNER); + public static BlockWrapper GREEN_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.GREEN_WALL_BANNER); + public static BlockWrapper RED_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.RED_WALL_BANNER); + public static BlockWrapper BLACK_WALL_BANNER = of(net.minecraft.world.level.block.Blocks.BLACK_WALL_BANNER); + public static BlockWrapper RED_SANDSTONE = of(net.minecraft.world.level.block.Blocks.RED_SANDSTONE); + public static BlockWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.world.level.block.Blocks.CHISELED_RED_SANDSTONE); + public static BlockWrapper CUT_RED_SANDSTONE = of(net.minecraft.world.level.block.Blocks.CUT_RED_SANDSTONE); + public static BlockWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.RED_SANDSTONE_STAIRS); + public static BlockWrapper OAK_SLAB = of(net.minecraft.world.level.block.Blocks.OAK_SLAB); + public static BlockWrapper SPRUCE_SLAB = of(net.minecraft.world.level.block.Blocks.SPRUCE_SLAB); + public static BlockWrapper BIRCH_SLAB = of(net.minecraft.world.level.block.Blocks.BIRCH_SLAB); + public static BlockWrapper JUNGLE_SLAB = of(net.minecraft.world.level.block.Blocks.JUNGLE_SLAB); + public static BlockWrapper ACACIA_SLAB = of(net.minecraft.world.level.block.Blocks.ACACIA_SLAB); + public static BlockWrapper DARK_OAK_SLAB = of(net.minecraft.world.level.block.Blocks.DARK_OAK_SLAB); + public static BlockWrapper STONE_SLAB = of(net.minecraft.world.level.block.Blocks.STONE_SLAB); + public static BlockWrapper SMOOTH_STONE_SLAB = of(net.minecraft.world.level.block.Blocks.SMOOTH_STONE_SLAB); + public static BlockWrapper SANDSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.SANDSTONE_SLAB); + public static BlockWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.CUT_SANDSTONE_SLAB); + public static BlockWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.world.level.block.Blocks.PETRIFIED_OAK_SLAB); + public static BlockWrapper COBBLESTONE_SLAB = of(net.minecraft.world.level.block.Blocks.COBBLESTONE_SLAB); + public static BlockWrapper BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.BRICK_SLAB); + public static BlockWrapper STONE_BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.STONE_BRICK_SLAB); + public static BlockWrapper NETHER_BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.NETHER_BRICK_SLAB); + public static BlockWrapper QUARTZ_SLAB = of(net.minecraft.world.level.block.Blocks.QUARTZ_SLAB); + public static BlockWrapper RED_SANDSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.RED_SANDSTONE_SLAB); + public static BlockWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.CUT_RED_SANDSTONE_SLAB); + public static BlockWrapper PURPUR_SLAB = of(net.minecraft.world.level.block.Blocks.PURPUR_SLAB); + public static BlockWrapper SMOOTH_STONE = of(net.minecraft.world.level.block.Blocks.SMOOTH_STONE); + public static BlockWrapper SMOOTH_SANDSTONE = of(net.minecraft.world.level.block.Blocks.SMOOTH_SANDSTONE); + public static BlockWrapper SMOOTH_QUARTZ = of(net.minecraft.world.level.block.Blocks.SMOOTH_QUARTZ); + public static BlockWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.world.level.block.Blocks.SMOOTH_RED_SANDSTONE); + public static BlockWrapper SPRUCE_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.SPRUCE_FENCE_GATE); + public static BlockWrapper BIRCH_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.BIRCH_FENCE_GATE); + public static BlockWrapper JUNGLE_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.JUNGLE_FENCE_GATE); + public static BlockWrapper ACACIA_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.ACACIA_FENCE_GATE); + public static BlockWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.DARK_OAK_FENCE_GATE); + public static BlockWrapper SPRUCE_FENCE = of(net.minecraft.world.level.block.Blocks.SPRUCE_FENCE); + public static BlockWrapper BIRCH_FENCE = of(net.minecraft.world.level.block.Blocks.BIRCH_FENCE); + public static BlockWrapper JUNGLE_FENCE = of(net.minecraft.world.level.block.Blocks.JUNGLE_FENCE); + public static BlockWrapper ACACIA_FENCE = of(net.minecraft.world.level.block.Blocks.ACACIA_FENCE); + public static BlockWrapper DARK_OAK_FENCE = of(net.minecraft.world.level.block.Blocks.DARK_OAK_FENCE); + public static BlockWrapper SPRUCE_DOOR = of(net.minecraft.world.level.block.Blocks.SPRUCE_DOOR); + public static BlockWrapper BIRCH_DOOR = of(net.minecraft.world.level.block.Blocks.BIRCH_DOOR); + public static BlockWrapper JUNGLE_DOOR = of(net.minecraft.world.level.block.Blocks.JUNGLE_DOOR); + public static BlockWrapper ACACIA_DOOR = of(net.minecraft.world.level.block.Blocks.ACACIA_DOOR); + public static BlockWrapper DARK_OAK_DOOR = of(net.minecraft.world.level.block.Blocks.DARK_OAK_DOOR); + public static BlockWrapper END_ROD = of(net.minecraft.world.level.block.Blocks.END_ROD); + public static BlockWrapper CHORUS_PLANT = of(net.minecraft.world.level.block.Blocks.CHORUS_PLANT); + public static BlockWrapper CHORUS_FLOWER = of(net.minecraft.world.level.block.Blocks.CHORUS_FLOWER); + public static BlockWrapper PURPUR_BLOCK = of(net.minecraft.world.level.block.Blocks.PURPUR_BLOCK); + public static BlockWrapper PURPUR_PILLAR = of(net.minecraft.world.level.block.Blocks.PURPUR_PILLAR); + public static BlockWrapper PURPUR_STAIRS = of(net.minecraft.world.level.block.Blocks.PURPUR_STAIRS); + public static BlockWrapper END_STONE_BRICKS = of(net.minecraft.world.level.block.Blocks.END_STONE_BRICKS); + public static BlockWrapper BEETROOTS = of(net.minecraft.world.level.block.Blocks.BEETROOTS); + public static BlockWrapper GRASS_PATH = of(net.minecraft.world.level.block.Blocks.DIRT_PATH); + public static BlockWrapper END_GATEWAY = of(net.minecraft.world.level.block.Blocks.END_GATEWAY); + public static BlockWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.world.level.block.Blocks.REPEATING_COMMAND_BLOCK); + public static BlockWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.world.level.block.Blocks.CHAIN_COMMAND_BLOCK); + public static BlockWrapper FROSTED_ICE = of(net.minecraft.world.level.block.Blocks.FROSTED_ICE); + public static BlockWrapper MAGMA_BLOCK = of(net.minecraft.world.level.block.Blocks.MAGMA_BLOCK); + public static BlockWrapper NETHER_WART_BLOCK = of(net.minecraft.world.level.block.Blocks.NETHER_WART_BLOCK); + public static BlockWrapper RED_NETHER_BRICKS = of(net.minecraft.world.level.block.Blocks.RED_NETHER_BRICKS); + public static BlockWrapper BONE_BLOCK = of(net.minecraft.world.level.block.Blocks.BONE_BLOCK); + public static BlockWrapper STRUCTURE_VOID = of(net.minecraft.world.level.block.Blocks.STRUCTURE_VOID); + public static BlockWrapper OBSERVER = of(net.minecraft.world.level.block.Blocks.OBSERVER); + public static BlockWrapper SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.SHULKER_BOX); + public static BlockWrapper WHITE_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.WHITE_SHULKER_BOX); + public static BlockWrapper ORANGE_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.ORANGE_SHULKER_BOX); + public static BlockWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.MAGENTA_SHULKER_BOX); + public static BlockWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_SHULKER_BOX); + public static BlockWrapper YELLOW_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.YELLOW_SHULKER_BOX); + public static BlockWrapper LIME_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.LIME_SHULKER_BOX); + public static BlockWrapper PINK_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.PINK_SHULKER_BOX); + public static BlockWrapper GRAY_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.GRAY_SHULKER_BOX); + public static BlockWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_SHULKER_BOX); + public static BlockWrapper CYAN_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.CYAN_SHULKER_BOX); + public static BlockWrapper PURPLE_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.PURPLE_SHULKER_BOX); + public static BlockWrapper BLUE_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.BLUE_SHULKER_BOX); + public static BlockWrapper BROWN_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.BROWN_SHULKER_BOX); + public static BlockWrapper GREEN_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.GREEN_SHULKER_BOX); + public static BlockWrapper RED_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.RED_SHULKER_BOX); + public static BlockWrapper BLACK_SHULKER_BOX = of(net.minecraft.world.level.block.Blocks.BLACK_SHULKER_BOX); + public static BlockWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.WHITE_GLAZED_TERRACOTTA); + public static BlockWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.ORANGE_GLAZED_TERRACOTTA); + public static BlockWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.MAGENTA_GLAZED_TERRACOTTA); + public static BlockWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA); + public static BlockWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.YELLOW_GLAZED_TERRACOTTA); + public static BlockWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.LIME_GLAZED_TERRACOTTA); + public static BlockWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.PINK_GLAZED_TERRACOTTA); + public static BlockWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.GRAY_GLAZED_TERRACOTTA); + public static BlockWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA); + public static BlockWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.CYAN_GLAZED_TERRACOTTA); + public static BlockWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.PURPLE_GLAZED_TERRACOTTA); + public static BlockWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.BLUE_GLAZED_TERRACOTTA); + public static BlockWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.BROWN_GLAZED_TERRACOTTA); + public static BlockWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.GREEN_GLAZED_TERRACOTTA); + public static BlockWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.RED_GLAZED_TERRACOTTA); + public static BlockWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.world.level.block.Blocks.BLACK_GLAZED_TERRACOTTA); + public static BlockWrapper WHITE_CONCRETE = of(net.minecraft.world.level.block.Blocks.WHITE_CONCRETE); + public static BlockWrapper ORANGE_CONCRETE = of(net.minecraft.world.level.block.Blocks.ORANGE_CONCRETE); + public static BlockWrapper MAGENTA_CONCRETE = of(net.minecraft.world.level.block.Blocks.MAGENTA_CONCRETE); + public static BlockWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_CONCRETE); + public static BlockWrapper YELLOW_CONCRETE = of(net.minecraft.world.level.block.Blocks.YELLOW_CONCRETE); + public static BlockWrapper LIME_CONCRETE = of(net.minecraft.world.level.block.Blocks.LIME_CONCRETE); + public static BlockWrapper PINK_CONCRETE = of(net.minecraft.world.level.block.Blocks.PINK_CONCRETE); + public static BlockWrapper GRAY_CONCRETE = of(net.minecraft.world.level.block.Blocks.GRAY_CONCRETE); + public static BlockWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_CONCRETE); + public static BlockWrapper CYAN_CONCRETE = of(net.minecraft.world.level.block.Blocks.CYAN_CONCRETE); + public static BlockWrapper PURPLE_CONCRETE = of(net.minecraft.world.level.block.Blocks.PURPLE_CONCRETE); + public static BlockWrapper BLUE_CONCRETE = of(net.minecraft.world.level.block.Blocks.BLUE_CONCRETE); + public static BlockWrapper BROWN_CONCRETE = of(net.minecraft.world.level.block.Blocks.BROWN_CONCRETE); + public static BlockWrapper GREEN_CONCRETE = of(net.minecraft.world.level.block.Blocks.GREEN_CONCRETE); + public static BlockWrapper RED_CONCRETE = of(net.minecraft.world.level.block.Blocks.RED_CONCRETE); + public static BlockWrapper BLACK_CONCRETE = of(net.minecraft.world.level.block.Blocks.BLACK_CONCRETE); + public static BlockWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.WHITE_CONCRETE_POWDER); + public static BlockWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.ORANGE_CONCRETE_POWDER); + public static BlockWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.MAGENTA_CONCRETE_POWDER); + public static BlockWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.LIGHT_BLUE_CONCRETE_POWDER); + public static BlockWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.YELLOW_CONCRETE_POWDER); + public static BlockWrapper LIME_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.LIME_CONCRETE_POWDER); + public static BlockWrapper PINK_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.PINK_CONCRETE_POWDER); + public static BlockWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.GRAY_CONCRETE_POWDER); + public static BlockWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.LIGHT_GRAY_CONCRETE_POWDER); + public static BlockWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.CYAN_CONCRETE_POWDER); + public static BlockWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.PURPLE_CONCRETE_POWDER); + public static BlockWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.BLUE_CONCRETE_POWDER); + public static BlockWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.BROWN_CONCRETE_POWDER); + public static BlockWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.GREEN_CONCRETE_POWDER); + public static BlockWrapper RED_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.RED_CONCRETE_POWDER); + public static BlockWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.world.level.block.Blocks.BLACK_CONCRETE_POWDER); + public static BlockWrapper KELP = of(net.minecraft.world.level.block.Blocks.KELP); + public static BlockWrapper KELP_PLANT = of(net.minecraft.world.level.block.Blocks.KELP_PLANT); + public static BlockWrapper DRIED_KELP_BLOCK = of(net.minecraft.world.level.block.Blocks.DRIED_KELP_BLOCK); + public static BlockWrapper TURTLE_EGG = of(net.minecraft.world.level.block.Blocks.TURTLE_EGG); + public static BlockWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.DEAD_TUBE_CORAL_BLOCK); + public static BlockWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.DEAD_BRAIN_CORAL_BLOCK); + public static BlockWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.DEAD_BUBBLE_CORAL_BLOCK); + public static BlockWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.DEAD_FIRE_CORAL_BLOCK); + public static BlockWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.DEAD_HORN_CORAL_BLOCK); + public static BlockWrapper TUBE_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.TUBE_CORAL_BLOCK); + public static BlockWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.BRAIN_CORAL_BLOCK); + public static BlockWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.BUBBLE_CORAL_BLOCK); + public static BlockWrapper FIRE_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.FIRE_CORAL_BLOCK); + public static BlockWrapper HORN_CORAL_BLOCK = of(net.minecraft.world.level.block.Blocks.HORN_CORAL_BLOCK); + public static BlockWrapper DEAD_TUBE_CORAL = of(net.minecraft.world.level.block.Blocks.DEAD_TUBE_CORAL); + public static BlockWrapper DEAD_BRAIN_CORAL = of(net.minecraft.world.level.block.Blocks.DEAD_BRAIN_CORAL); + public static BlockWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.world.level.block.Blocks.DEAD_BUBBLE_CORAL); + public static BlockWrapper DEAD_FIRE_CORAL = of(net.minecraft.world.level.block.Blocks.DEAD_FIRE_CORAL); + public static BlockWrapper DEAD_HORN_CORAL = of(net.minecraft.world.level.block.Blocks.DEAD_HORN_CORAL); + public static BlockWrapper TUBE_CORAL = of(net.minecraft.world.level.block.Blocks.TUBE_CORAL); + public static BlockWrapper BRAIN_CORAL = of(net.minecraft.world.level.block.Blocks.BRAIN_CORAL); + public static BlockWrapper BUBBLE_CORAL = of(net.minecraft.world.level.block.Blocks.BUBBLE_CORAL); + public static BlockWrapper FIRE_CORAL = of(net.minecraft.world.level.block.Blocks.FIRE_CORAL); + public static BlockWrapper HORN_CORAL = of(net.minecraft.world.level.block.Blocks.HORN_CORAL); + public static BlockWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_TUBE_CORAL_FAN); + public static BlockWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_BRAIN_CORAL_FAN); + public static BlockWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_BUBBLE_CORAL_FAN); + public static BlockWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_FIRE_CORAL_FAN); + public static BlockWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_HORN_CORAL_FAN); + public static BlockWrapper TUBE_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.TUBE_CORAL_FAN); + public static BlockWrapper BRAIN_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.BRAIN_CORAL_FAN); + public static BlockWrapper BUBBLE_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.BUBBLE_CORAL_FAN); + public static BlockWrapper FIRE_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.FIRE_CORAL_FAN); + public static BlockWrapper HORN_CORAL_FAN = of(net.minecraft.world.level.block.Blocks.HORN_CORAL_FAN); + public static BlockWrapper DEAD_TUBE_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_TUBE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_BRAIN_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_BRAIN_CORAL_WALL_FAN); + public static BlockWrapper DEAD_BUBBLE_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_BUBBLE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_FIRE_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_FIRE_CORAL_WALL_FAN); + public static BlockWrapper DEAD_HORN_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.DEAD_HORN_CORAL_WALL_FAN); + public static BlockWrapper TUBE_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.TUBE_CORAL_WALL_FAN); + public static BlockWrapper BRAIN_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.BRAIN_CORAL_WALL_FAN); + public static BlockWrapper BUBBLE_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.BUBBLE_CORAL_WALL_FAN); + public static BlockWrapper FIRE_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.FIRE_CORAL_WALL_FAN); + public static BlockWrapper HORN_CORAL_WALL_FAN = of(net.minecraft.world.level.block.Blocks.HORN_CORAL_WALL_FAN); + public static BlockWrapper SEA_PICKLE = of(net.minecraft.world.level.block.Blocks.SEA_PICKLE); + public static BlockWrapper BLUE_ICE = of(net.minecraft.world.level.block.Blocks.BLUE_ICE); + public static BlockWrapper CONDUIT = of(net.minecraft.world.level.block.Blocks.CONDUIT); + public static BlockWrapper BAMBOO_SAPLING = of(net.minecraft.world.level.block.Blocks.BAMBOO_SAPLING); + public static BlockWrapper BAMBOO = of(net.minecraft.world.level.block.Blocks.BAMBOO); + public static BlockWrapper POTTED_BAMBOO = of(net.minecraft.world.level.block.Blocks.POTTED_BAMBOO); + public static BlockWrapper VOID_AIR = of(net.minecraft.world.level.block.Blocks.VOID_AIR); + public static BlockWrapper CAVE_AIR = of(net.minecraft.world.level.block.Blocks.CAVE_AIR); + public static BlockWrapper BUBBLE_COLUMN = of(net.minecraft.world.level.block.Blocks.BUBBLE_COLUMN); + public static BlockWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.world.level.block.Blocks.POLISHED_GRANITE_STAIRS); + public static BlockWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.SMOOTH_RED_SANDSTONE_STAIRS); + public static BlockWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.MOSSY_STONE_BRICK_STAIRS); + public static BlockWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.world.level.block.Blocks.POLISHED_DIORITE_STAIRS); + public static BlockWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.MOSSY_COBBLESTONE_STAIRS); + public static BlockWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.END_STONE_BRICK_STAIRS); + public static BlockWrapper STONE_STAIRS = of(net.minecraft.world.level.block.Blocks.STONE_STAIRS); + public static BlockWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.SMOOTH_SANDSTONE_STAIRS); + public static BlockWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.world.level.block.Blocks.SMOOTH_QUARTZ_STAIRS); + public static BlockWrapper GRANITE_STAIRS = of(net.minecraft.world.level.block.Blocks.GRANITE_STAIRS); + public static BlockWrapper ANDESITE_STAIRS = of(net.minecraft.world.level.block.Blocks.ANDESITE_STAIRS); + public static BlockWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.RED_NETHER_BRICK_STAIRS); + public static BlockWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.world.level.block.Blocks.POLISHED_ANDESITE_STAIRS); + public static BlockWrapper DIORITE_STAIRS = of(net.minecraft.world.level.block.Blocks.DIORITE_STAIRS); + public static BlockWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.world.level.block.Blocks.POLISHED_GRANITE_SLAB); + public static BlockWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.SMOOTH_RED_SANDSTONE_SLAB); + public static BlockWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.MOSSY_STONE_BRICK_SLAB); + public static BlockWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.world.level.block.Blocks.POLISHED_DIORITE_SLAB); + public static BlockWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.world.level.block.Blocks.MOSSY_COBBLESTONE_SLAB); + public static BlockWrapper END_STONE_BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.END_STONE_BRICK_SLAB); + public static BlockWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.SMOOTH_SANDSTONE_SLAB); + public static BlockWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.world.level.block.Blocks.SMOOTH_QUARTZ_SLAB); + public static BlockWrapper GRANITE_SLAB = of(net.minecraft.world.level.block.Blocks.GRANITE_SLAB); + public static BlockWrapper ANDESITE_SLAB = of(net.minecraft.world.level.block.Blocks.ANDESITE_SLAB); + public static BlockWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.RED_NETHER_BRICK_SLAB); + public static BlockWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.world.level.block.Blocks.POLISHED_ANDESITE_SLAB); + public static BlockWrapper DIORITE_SLAB = of(net.minecraft.world.level.block.Blocks.DIORITE_SLAB); + public static BlockWrapper BRICK_WALL = of(net.minecraft.world.level.block.Blocks.BRICK_WALL); + public static BlockWrapper PRISMARINE_WALL = of(net.minecraft.world.level.block.Blocks.PRISMARINE_WALL); + public static BlockWrapper RED_SANDSTONE_WALL = of(net.minecraft.world.level.block.Blocks.RED_SANDSTONE_WALL); + public static BlockWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.world.level.block.Blocks.MOSSY_STONE_BRICK_WALL); + public static BlockWrapper GRANITE_WALL = of(net.minecraft.world.level.block.Blocks.GRANITE_WALL); + public static BlockWrapper STONE_BRICK_WALL = of(net.minecraft.world.level.block.Blocks.STONE_BRICK_WALL); + public static BlockWrapper NETHER_BRICK_WALL = of(net.minecraft.world.level.block.Blocks.NETHER_BRICK_WALL); + public static BlockWrapper ANDESITE_WALL = of(net.minecraft.world.level.block.Blocks.ANDESITE_WALL); + public static BlockWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.world.level.block.Blocks.RED_NETHER_BRICK_WALL); + public static BlockWrapper SANDSTONE_WALL = of(net.minecraft.world.level.block.Blocks.SANDSTONE_WALL); + public static BlockWrapper END_STONE_BRICK_WALL = of(net.minecraft.world.level.block.Blocks.END_STONE_BRICK_WALL); + public static BlockWrapper DIORITE_WALL = of(net.minecraft.world.level.block.Blocks.DIORITE_WALL); + public static BlockWrapper SCAFFOLDING = of(net.minecraft.world.level.block.Blocks.SCAFFOLDING); + public static BlockWrapper LOOM = of(net.minecraft.world.level.block.Blocks.LOOM); + public static BlockWrapper BARREL = of(net.minecraft.world.level.block.Blocks.BARREL); + public static BlockWrapper SMOKER = of(net.minecraft.world.level.block.Blocks.SMOKER); + public static BlockWrapper BLAST_FURNACE = of(net.minecraft.world.level.block.Blocks.BLAST_FURNACE); + public static BlockWrapper CARTOGRAPHY_TABLE = of(net.minecraft.world.level.block.Blocks.CARTOGRAPHY_TABLE); + public static BlockWrapper FLETCHING_TABLE = of(net.minecraft.world.level.block.Blocks.FLETCHING_TABLE); + public static BlockWrapper GRINDSTONE = of(net.minecraft.world.level.block.Blocks.GRINDSTONE); + public static BlockWrapper LECTERN = of(net.minecraft.world.level.block.Blocks.LECTERN); + public static BlockWrapper SMITHING_TABLE = of(net.minecraft.world.level.block.Blocks.SMITHING_TABLE); + public static BlockWrapper STONECUTTER = of(net.minecraft.world.level.block.Blocks.STONECUTTER); + public static BlockWrapper BELL = of(net.minecraft.world.level.block.Blocks.BELL); + public static BlockWrapper LANTERN = of(net.minecraft.world.level.block.Blocks.LANTERN); + public static BlockWrapper SOUL_LANTERN = of(net.minecraft.world.level.block.Blocks.SOUL_LANTERN); + public static BlockWrapper CAMPFIRE = of(net.minecraft.world.level.block.Blocks.CAMPFIRE); + public static BlockWrapper SOUL_CAMPFIRE = of(net.minecraft.world.level.block.Blocks.SOUL_CAMPFIRE); + public static BlockWrapper SWEET_BERRY_BUSH = of(net.minecraft.world.level.block.Blocks.SWEET_BERRY_BUSH); + public static BlockWrapper WARPED_STEM = of(net.minecraft.world.level.block.Blocks.WARPED_STEM); + public static BlockWrapper STRIPPED_WARPED_STEM = of(net.minecraft.world.level.block.Blocks.STRIPPED_WARPED_STEM); + public static BlockWrapper WARPED_HYPHAE = of(net.minecraft.world.level.block.Blocks.WARPED_HYPHAE); + public static BlockWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.world.level.block.Blocks.STRIPPED_WARPED_HYPHAE); + public static BlockWrapper WARPED_NYLIUM = of(net.minecraft.world.level.block.Blocks.WARPED_NYLIUM); + public static BlockWrapper WARPED_FUNGUS = of(net.minecraft.world.level.block.Blocks.WARPED_FUNGUS); + public static BlockWrapper WARPED_WART_BLOCK = of(net.minecraft.world.level.block.Blocks.WARPED_WART_BLOCK); + public static BlockWrapper WARPED_ROOTS = of(net.minecraft.world.level.block.Blocks.WARPED_ROOTS); + public static BlockWrapper NETHER_SPROUTS = of(net.minecraft.world.level.block.Blocks.NETHER_SPROUTS); + public static BlockWrapper CRIMSON_STEM = of(net.minecraft.world.level.block.Blocks.CRIMSON_STEM); + public static BlockWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.world.level.block.Blocks.STRIPPED_CRIMSON_STEM); + public static BlockWrapper CRIMSON_HYPHAE = of(net.minecraft.world.level.block.Blocks.CRIMSON_HYPHAE); + public static BlockWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.world.level.block.Blocks.STRIPPED_CRIMSON_HYPHAE); + public static BlockWrapper CRIMSON_NYLIUM = of(net.minecraft.world.level.block.Blocks.CRIMSON_NYLIUM); + public static BlockWrapper CRIMSON_FUNGUS = of(net.minecraft.world.level.block.Blocks.CRIMSON_FUNGUS); + public static BlockWrapper SHROOMLIGHT = of(net.minecraft.world.level.block.Blocks.SHROOMLIGHT); + public static BlockWrapper WEEPING_VINES = of(net.minecraft.world.level.block.Blocks.WEEPING_VINES); + public static BlockWrapper WEEPING_VINES_PLANT = of(net.minecraft.world.level.block.Blocks.WEEPING_VINES_PLANT); + public static BlockWrapper TWISTING_VINES = of(net.minecraft.world.level.block.Blocks.TWISTING_VINES); + public static BlockWrapper TWISTING_VINES_PLANT = of(net.minecraft.world.level.block.Blocks.TWISTING_VINES_PLANT); + public static BlockWrapper CRIMSON_ROOTS = of(net.minecraft.world.level.block.Blocks.CRIMSON_ROOTS); + public static BlockWrapper CRIMSON_PLANKS = of(net.minecraft.world.level.block.Blocks.CRIMSON_PLANKS); + public static BlockWrapper WARPED_PLANKS = of(net.minecraft.world.level.block.Blocks.WARPED_PLANKS); + public static BlockWrapper CRIMSON_SLAB = of(net.minecraft.world.level.block.Blocks.CRIMSON_SLAB); + public static BlockWrapper WARPED_SLAB = of(net.minecraft.world.level.block.Blocks.WARPED_SLAB); + public static BlockWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.CRIMSON_PRESSURE_PLATE); + public static BlockWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.WARPED_PRESSURE_PLATE); + public static BlockWrapper CRIMSON_FENCE = of(net.minecraft.world.level.block.Blocks.CRIMSON_FENCE); + public static BlockWrapper WARPED_FENCE = of(net.minecraft.world.level.block.Blocks.WARPED_FENCE); + public static BlockWrapper CRIMSON_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.CRIMSON_TRAPDOOR); + public static BlockWrapper WARPED_TRAPDOOR = of(net.minecraft.world.level.block.Blocks.WARPED_TRAPDOOR); + public static BlockWrapper CRIMSON_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.CRIMSON_FENCE_GATE); + public static BlockWrapper WARPED_FENCE_GATE = of(net.minecraft.world.level.block.Blocks.WARPED_FENCE_GATE); + public static BlockWrapper CRIMSON_STAIRS = of(net.minecraft.world.level.block.Blocks.CRIMSON_STAIRS); + public static BlockWrapper WARPED_STAIRS = of(net.minecraft.world.level.block.Blocks.WARPED_STAIRS); + public static BlockWrapper CRIMSON_BUTTON = of(net.minecraft.world.level.block.Blocks.CRIMSON_BUTTON); + public static BlockWrapper WARPED_BUTTON = of(net.minecraft.world.level.block.Blocks.WARPED_BUTTON); + public static BlockWrapper CRIMSON_DOOR = of(net.minecraft.world.level.block.Blocks.CRIMSON_DOOR); + public static BlockWrapper WARPED_DOOR = of(net.minecraft.world.level.block.Blocks.WARPED_DOOR); + public static BlockWrapper CRIMSON_SIGN = of(net.minecraft.world.level.block.Blocks.CRIMSON_SIGN); + public static BlockWrapper WARPED_SIGN = of(net.minecraft.world.level.block.Blocks.WARPED_SIGN); + public static BlockWrapper CRIMSON_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.CRIMSON_WALL_SIGN); + public static BlockWrapper WARPED_WALL_SIGN = of(net.minecraft.world.level.block.Blocks.WARPED_WALL_SIGN); + public static BlockWrapper STRUCTURE_BLOCK = of(net.minecraft.world.level.block.Blocks.STRUCTURE_BLOCK); + public static BlockWrapper JIGSAW = of(net.minecraft.world.level.block.Blocks.JIGSAW); + public static BlockWrapper COMPOSTER = of(net.minecraft.world.level.block.Blocks.COMPOSTER); + public static BlockWrapper TARGET = of(net.minecraft.world.level.block.Blocks.TARGET); + public static BlockWrapper BEE_NEST = of(net.minecraft.world.level.block.Blocks.BEE_NEST); + public static BlockWrapper BEEHIVE = of(net.minecraft.world.level.block.Blocks.BEEHIVE); + public static BlockWrapper HONEY_BLOCK = of(net.minecraft.world.level.block.Blocks.HONEY_BLOCK); + public static BlockWrapper HONEYCOMB_BLOCK = of(net.minecraft.world.level.block.Blocks.HONEYCOMB_BLOCK); + public static BlockWrapper NETHERITE_BLOCK = of(net.minecraft.world.level.block.Blocks.NETHERITE_BLOCK); + public static BlockWrapper ANCIENT_DEBRIS = of(net.minecraft.world.level.block.Blocks.ANCIENT_DEBRIS); + public static BlockWrapper CRYING_OBSIDIAN = of(net.minecraft.world.level.block.Blocks.CRYING_OBSIDIAN); + public static BlockWrapper RESPAWN_ANCHOR = of(net.minecraft.world.level.block.Blocks.RESPAWN_ANCHOR); + public static BlockWrapper POTTED_CRIMSON_FUNGUS = of(net.minecraft.world.level.block.Blocks.POTTED_CRIMSON_FUNGUS); + public static BlockWrapper POTTED_WARPED_FUNGUS = of(net.minecraft.world.level.block.Blocks.POTTED_WARPED_FUNGUS); + public static BlockWrapper POTTED_CRIMSON_ROOTS = of(net.minecraft.world.level.block.Blocks.POTTED_CRIMSON_ROOTS); + public static BlockWrapper POTTED_WARPED_ROOTS = of(net.minecraft.world.level.block.Blocks.POTTED_WARPED_ROOTS); + public static BlockWrapper LODESTONE = of(net.minecraft.world.level.block.Blocks.LODESTONE); + public static BlockWrapper BLACKSTONE = of(net.minecraft.world.level.block.Blocks.BLACKSTONE); + public static BlockWrapper BLACKSTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.BLACKSTONE_STAIRS); + public static BlockWrapper BLACKSTONE_WALL = of(net.minecraft.world.level.block.Blocks.BLACKSTONE_WALL); + public static BlockWrapper BLACKSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.BLACKSTONE_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_BRICKS); + public static BlockWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.world.level.block.Blocks.CRACKED_POLISHED_BLACKSTONE_BRICKS); + public static BlockWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.world.level.block.Blocks.CHISELED_POLISHED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_BRICK_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_BRICK_STAIRS); + public static BlockWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_BRICK_WALL); + public static BlockWrapper GILDED_BLACKSTONE = of(net.minecraft.world.level.block.Blocks.GILDED_BLACKSTONE); + public static BlockWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_STAIRS); + public static BlockWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_SLAB); + public static BlockWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_PRESSURE_PLATE); + public static BlockWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_BUTTON); + public static BlockWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.world.level.block.Blocks.POLISHED_BLACKSTONE_WALL); + public static BlockWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.world.level.block.Blocks.CHISELED_NETHER_BRICKS); + public static BlockWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.world.level.block.Blocks.CRACKED_NETHER_BRICKS); + public static BlockWrapper QUARTZ_BRICKS = of(net.minecraft.world.level.block.Blocks.QUARTZ_BRICKS); - public static BlockWrapper of(net.minecraft.block.Block block) { + public static BlockWrapper of(net.minecraft.world.level.block.Block block) { return BlockWrapper.of(block); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java index ba604f61b..0b001d093 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.block; -import net.minecraft.block.Block; +import net.minecraft.world.level.block.Block; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import java.util.function.Supplier; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java index 0a066a984..8d56a2c48 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java @@ -6,7 +6,7 @@ import net.pitan76.mcpitanlib.midohra.world.BlockView; public class BlockEntityTypeWrapper { - private final net.minecraft.block.entity.BlockEntityType type; + private final net.minecraft.world.level.block.entity.BlockEntityType type; public static final BlockEntityTypeWrapper EMPTY = new BlockEntityTypeWrapper(); @@ -14,11 +14,11 @@ protected BlockEntityTypeWrapper() { this.type = null; } - protected BlockEntityTypeWrapper(net.minecraft.block.entity.BlockEntityType blockEntity) { + protected BlockEntityTypeWrapper(net.minecraft.world.level.block.entity.BlockEntityType blockEntity) { this.type = blockEntity; } - public static BlockEntityTypeWrapper of(net.minecraft.block.entity.BlockEntityType blockEntity) { + public static BlockEntityTypeWrapper of(net.minecraft.world.level.block.entity.BlockEntityType blockEntity) { return new BlockEntityTypeWrapper(blockEntity); } @@ -26,7 +26,7 @@ public static BlockEntityTypeWrapper of() { return EMPTY; } - public net.minecraft.block.entity.BlockEntityType get() { + public net.minecraft.world.level.block.entity.BlockEntityType get() { return type; } @@ -39,20 +39,20 @@ public boolean isPresent() { } public boolean supports(BlockState state) { - return isPresent() && get().supports(state.toMinecraft()); + return isPresent() && get().isValid(state.toMinecraft()); } public BlockEntityWrapper getBlockEntity(BlockView world, BlockPos pos) { if (isEmpty()) return BlockEntityWrapper.EMPTY; - return SupplierBlockEntityWrapper.of(get().get(world.getRaw(), pos.toMinecraft())); + return SupplierBlockEntityWrapper.of(get().getBlockEntity(world.getRaw(), pos.toMinecraft())); } public BlockEntityWrapper createBlockEntity(TileCreateEvent e) { if (isEmpty()) return BlockEntityWrapper.EMPTY; - return SupplierBlockEntityWrapper.of(get().instantiate(e.getBlockPos(), e.getBlockState())); + return SupplierBlockEntityWrapper.of(get().create(e.getBlockPos(), e.getBlockState())); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java index 7b3ac02d8..c72014696 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java @@ -14,7 +14,7 @@ import java.util.Optional; public class BlockEntityWrapper { - private final net.minecraft.block.entity.BlockEntity blockEntity; + private final net.minecraft.world.level.block.entity.BlockEntity blockEntity; public static final BlockEntityWrapper EMPTY = new BlockEntityWrapper(null); @@ -22,11 +22,11 @@ protected BlockEntityWrapper() { this.blockEntity = null; } - protected BlockEntityWrapper(net.minecraft.block.entity.BlockEntity blockEntity) { + protected BlockEntityWrapper(net.minecraft.world.level.block.entity.BlockEntity blockEntity) { this.blockEntity = blockEntity; } - public static BlockEntityWrapper of(net.minecraft.block.entity.BlockEntity blockEntity) { + public static BlockEntityWrapper of(net.minecraft.world.level.block.entity.BlockEntity blockEntity) { return new BlockEntityWrapper(blockEntity); } @@ -34,12 +34,12 @@ public static BlockEntityWrapper of() { return EMPTY; } - public net.minecraft.block.entity.BlockEntity get() { + public net.minecraft.world.level.block.entity.BlockEntity get() { return blockEntity; } public BlockPos getPos() { - return BlockPos.of(get().getPos()); + return BlockPos.of(get().getBlockPos()); } public boolean isPresent() { @@ -113,7 +113,7 @@ public boolean equals(Object obj) { } public static BlockEntityWrapper of(BlockPos pos, World world) { - net.minecraft.block.entity.BlockEntity blockEntity = BlockEntityUtil.getBlockEntity(world.toMinecraft(), pos.toMinecraft()); + net.minecraft.world.level.block.entity.BlockEntity blockEntity = BlockEntityUtil.getBlockEntity(world.toMinecraft(), pos.toMinecraft()); return of(blockEntity); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java index c8f5b38cf..eb2670d5b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.block.entity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntityType; public class RewritableBlockEntityTypeWrapper extends BlockEntityTypeWrapper { private BlockEntityType type; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java index c0ea96ed4..0ee931c72 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.block.entity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import java.util.function.Supplier; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java index 202a0d31a..2c97dfdd0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.block.entity; -import net.minecraft.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import java.util.function.Supplier; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java index 87e288635..a8103a2c1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.client.render; -import net.minecraft.client.render.Camera; +import net.minecraft.client.Camera; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; @@ -39,22 +39,22 @@ public boolean isEmpty() { public Vector3d getCameraPos() { if (isEmpty()) return Vector3d.zero(); - return Vector3d.of(camera.getCameraPos()); + return Vector3d.of(camera.position()); } public BlockPos getBlockPos() { if (isEmpty()) return BlockPos.of(0, 0, 0); - return BlockPos.of(camera.getBlockPos()); + return BlockPos.of(camera.blockPosition()); } public float getYaw() { if (isEmpty()) return 0f; - return camera.getYaw(); + return camera.yRot(); } public float getPitch() { if (isEmpty()) return 0f; - return camera.getPitch(); + return camera.xRot(); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java index b4fd2b700..106de9917 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java @@ -1,24 +1,24 @@ package net.pitan76.mcpitanlib.midohra.component.item; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.ItemStack; +import net.minecraft.network.chat.Component; -public class CustomNameComponentType extends ItemComponentType { +public class CustomNameComponentType extends ItemComponentType { public CustomNameComponentType() { - super(DataComponentTypes.CUSTOM_NAME); + super(DataComponents.CUSTOM_NAME); } @Override - public void put(ItemStack stack, Text value) { - stack.set(DataComponentTypes.CUSTOM_NAME, value); + public void put(ItemStack stack, Component value) { + stack.set(DataComponents.CUSTOM_NAME, value); } @Override - public Text get(ItemStack stack) { - if (!has(stack)) return Text.empty(); - return stack.get(DataComponentTypes.CUSTOM_NAME); + public Component get(ItemStack stack) { + if (!has(stack)) return Component.empty(); + return stack.get(DataComponents.CUSTOM_NAME); } public String getAsString(ItemStack stack) { @@ -26,6 +26,6 @@ public String getAsString(ItemStack stack) { } public void put(ItemStack stack, String name) { - put(stack, Text.literal(name)); + put(stack, Component.literal(name)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java index e45e00eef..d09355e29 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java @@ -1,13 +1,13 @@ package net.pitan76.mcpitanlib.midohra.component.item; -import net.minecraft.component.ComponentType; -import net.minecraft.item.ItemStack; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.world.item.ItemStack; public abstract class ItemComponentType { - private final ComponentType type; + private final DataComponentType type; - protected ItemComponentType(ComponentType type) { + protected ItemComponentType(DataComponentType type) { this.type = type; } @@ -16,7 +16,7 @@ protected ItemComponentType(ComponentType type) { public abstract T get(ItemStack stack); public boolean has(ItemStack stack) { - return stack.contains(type); + return stack.has(type); } public void putOrDefault(ItemStack stack, T value, T defaultValue) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java index 2fb1ef26e..1f0dccfde 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java @@ -1,19 +1,19 @@ package net.pitan76.mcpitanlib.midohra.component.item; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Rarity; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Rarity; import net.pitan76.mcpitanlib.api.util.CompatRarity; public class RarityComponentType extends ItemComponentType { public RarityComponentType() { - super(DataComponentTypes.RARITY); + super(DataComponents.RARITY); } @Override public void put(ItemStack stack, Rarity value) { - stack.set(DataComponentTypes.RARITY, value); + stack.set(DataComponents.RARITY, value); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java index 587531855..bdfaa08b6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.easybuilder; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.CommonModInitializer; import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; import net.pitan76.mcpitanlib.api.block.CompatibleMaterial; @@ -49,12 +49,12 @@ public class BlockBuilder { public Consumer onAppendProperties; public BlockState defaultState; public BiConsumer onInit; - public Function onOutlineShape; - public Function onCollisionShape; + public Function onOutlineShape; + public Function onCollisionShape; public Function onRenderType; public Function onPlacementState; public Function onStateForNeighborUpdate; - public Function> onDroppedStacks; + public Function> onDroppedStacks; public BlockBuilder(BlockSettingsBuilder settingsBuilder) { this.settingsBuilder = settingsBuilder; @@ -197,12 +197,12 @@ public BlockBuilder onCollisionShape(Function o return onCollisionShapeRaw(e -> onCollisionShape.apply(e).raw()); } - public BlockBuilder onOutlineShapeRaw(Function onOutlineShape) { + public BlockBuilder onOutlineShapeRaw(Function onOutlineShape) { this.onOutlineShape = onOutlineShape; return this; } - public BlockBuilder onCollisionShapeRaw(Function onCollisionShape) { + public BlockBuilder onCollisionShapeRaw(Function onCollisionShape) { this.onCollisionShape = onCollisionShape; return this; } @@ -230,11 +230,11 @@ public BlockBuilder setCollisionShape(VoxelShape shape) { return onCollisionShape(e -> shape); } - public BlockBuilder setOutlineShape(net.minecraft.util.shape.VoxelShape shape) { + public BlockBuilder setOutlineShape(net.minecraft.world.phys.shapes.VoxelShape shape) { return onOutlineShapeRaw(e -> shape); } - public BlockBuilder setCollisionShape(net.minecraft.util.shape.VoxelShape shape) { + public BlockBuilder setCollisionShape(net.minecraft.world.phys.shapes.VoxelShape shape) { return onCollisionShapeRaw(e -> shape); } @@ -270,7 +270,7 @@ public BlockBuilder addTooltip(TextComponent text) { return this; } - public BlockBuilder onDroppedStacksRaw(Function> onDroppedStacks) { + public BlockBuilder onDroppedStacksRaw(Function> onDroppedStacks) { this.onDroppedStacks = onDroppedStacks; return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java index b85331534..df0003607 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.midohra.easybuilder; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java index 16ce75a16..84b906e79 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.easybuilder; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.CommonModInitializer; import net.pitan76.mcpitanlib.api.block.ExtendBlock; import net.pitan76.mcpitanlib.api.block.v2.BlockSettingsBuilder; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java index c74686013..655fefce3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.easybuilder.built; -import net.minecraft.item.ItemStack; -import net.minecraft.util.shape.VoxelShape; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.shapes.VoxelShape; import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java index 4143b69e7..e397a4e47 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.midohra.easybuilder.built; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.core.BlockPos; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java index 6297eb9c0..095e7190a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.easybuilder.built; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.block.ExtendBlockEntityProvider; import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java index d8a931e3c..c108657c5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.entity; -import net.minecraft.entity.Entity; +import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.EntityTypeUtil; @@ -11,17 +11,17 @@ import java.util.function.Consumer; public class EntityTypeWrapper { - private final net.minecraft.entity.EntityType entityType; + private final net.minecraft.world.entity.EntityType entityType; protected EntityTypeWrapper() { this.entityType = null; } - protected EntityTypeWrapper(net.minecraft.entity.EntityType entityType) { + protected EntityTypeWrapper(net.minecraft.world.entity.EntityType entityType) { this.entityType = entityType; } - public static EntityTypeWrapper of(net.minecraft.entity.EntityType entityType) { + public static EntityTypeWrapper of(net.minecraft.world.entity.EntityType entityType) { return new EntityTypeWrapper(entityType); } @@ -37,7 +37,7 @@ public boolean isEmpty() { return entityType == null; } - public net.minecraft.entity.EntityType get() { + public net.minecraft.world.entity.EntityType get() { return entityType; } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java index a7c65bbfe..5176754df 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java @@ -1,30 +1,30 @@ package net.pitan76.mcpitanlib.midohra.entity; -import net.minecraft.entity.EntityType; +import net.minecraft.world.entity.EntityType; public class EntityTypes { public static final EntityTypeWrapper BOAT = EntityTypeWrapper.of(EntityType.OAK_BOAT); - public static final EntityTypeWrapper ACACIA_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ACACIA_BOAT); - public static final EntityTypeWrapper ACACIA_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ACACIA_CHEST_BOAT); - public static final EntityTypeWrapper BIRCH_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BIRCH_BOAT); - public static final EntityTypeWrapper BIRCH_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BIRCH_CHEST_BOAT); - public static final EntityTypeWrapper DARK_OAK_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DARK_OAK_BOAT); - public static final EntityTypeWrapper DARK_OAK_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DARK_OAK_CHEST_BOAT); - public static final EntityTypeWrapper JUNGLE_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.JUNGLE_BOAT); - public static final EntityTypeWrapper JUNGLE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.JUNGLE_CHEST_BOAT); - public static final EntityTypeWrapper SPRUCE_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SPRUCE_BOAT); - public static final EntityTypeWrapper SPRUCE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SPRUCE_CHEST_BOAT); - public static final EntityTypeWrapper FURNACE_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FURNACE_MINECART); - public static final EntityTypeWrapper HOPPER_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HOPPER_MINECART); - public static final EntityTypeWrapper MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MINECART); - public static final EntityTypeWrapper TNT_MINECART = EntityTypeWrapper.of(net.minecraft.entity.EntityType.TNT_MINECART); + public static final EntityTypeWrapper ACACIA_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ACACIA_BOAT); + public static final EntityTypeWrapper ACACIA_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ACACIA_CHEST_BOAT); + public static final EntityTypeWrapper BIRCH_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.BIRCH_BOAT); + public static final EntityTypeWrapper BIRCH_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.BIRCH_CHEST_BOAT); + public static final EntityTypeWrapper DARK_OAK_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.DARK_OAK_BOAT); + public static final EntityTypeWrapper DARK_OAK_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.DARK_OAK_CHEST_BOAT); + public static final EntityTypeWrapper JUNGLE_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.JUNGLE_BOAT); + public static final EntityTypeWrapper JUNGLE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.JUNGLE_CHEST_BOAT); + public static final EntityTypeWrapper SPRUCE_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.SPRUCE_BOAT); + public static final EntityTypeWrapper SPRUCE_CHEST_BOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.SPRUCE_CHEST_BOAT); + public static final EntityTypeWrapper FURNACE_MINECART = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.FURNACE_MINECART); + public static final EntityTypeWrapper HOPPER_MINECART = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.HOPPER_MINECART); + public static final EntityTypeWrapper MINECART = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.MINECART); + public static final EntityTypeWrapper TNT_MINECART = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.TNT_MINECART); public static final EntityTypeWrapper CHEST_MINECART = EntityTypeWrapper.of(EntityType.CHEST_MINECART); - public static final EntityTypeWrapper HORSE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HORSE); - public static final EntityTypeWrapper LLAMA = EntityTypeWrapper.of(net.minecraft.entity.EntityType.LLAMA); + public static final EntityTypeWrapper HORSE = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.HORSE); + public static final EntityTypeWrapper LLAMA = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.LLAMA); - public static final EntityTypeWrapper ITEM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ITEM); + public static final EntityTypeWrapper ITEM = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ITEM); public static final EntityTypeWrapper ITEM_DISPLAY = EntityTypeWrapper.of(EntityType.ITEM_DISPLAY); - public static final EntityTypeWrapper ITEM_FRAME = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ITEM_FRAME); + public static final EntityTypeWrapper ITEM_FRAME = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ITEM_FRAME); public static final EntityTypeWrapper GLOW_ITEM_FRAME = EntityTypeWrapper.of(EntityType.GLOW_ITEM_FRAME); public static final EntityTypeWrapper EXPERIENCE_BOTTLE = EntityTypeWrapper.of(EntityType.EXPERIENCE_BOTTLE); public static final EntityTypeWrapper EXPERIENCE_ORB = EntityTypeWrapper.of(EntityType.EXPERIENCE_ORB); @@ -35,41 +35,41 @@ public class EntityTypes { public static final EntityTypeWrapper DRAGON_FIREBALL = EntityTypeWrapper.of(EntityType.DRAGON_FIREBALL); public static final EntityTypeWrapper FIREWORK_ROCKET = EntityTypeWrapper.of(EntityType.FIREWORK_ROCKET); - public static final EntityTypeWrapper ALLAY = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ALLAY); - public static final EntityTypeWrapper AXOLOTL = EntityTypeWrapper.of(net.minecraft.entity.EntityType.AXOLOTL); - public static final EntityTypeWrapper BAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BAT); - public static final EntityTypeWrapper BEE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BEE); - public static final EntityTypeWrapper BLAZE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.BLAZE); - public static final EntityTypeWrapper CAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CAT); - public static final EntityTypeWrapper CHICKEN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CHICKEN); - public static final EntityTypeWrapper COD = EntityTypeWrapper.of(net.minecraft.entity.EntityType.COD); - public static final EntityTypeWrapper COW = EntityTypeWrapper.of(net.minecraft.entity.EntityType.COW); - public static final EntityTypeWrapper CREEPER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.CREEPER); - public static final EntityTypeWrapper DOLPHIN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DOLPHIN); - public static final EntityTypeWrapper DONKEY = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DONKEY); - public static final EntityTypeWrapper DROWNED = EntityTypeWrapper.of(net.minecraft.entity.EntityType.DROWNED); - public static final EntityTypeWrapper ELDER_GUARDIAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ELDER_GUARDIAN); - public static final EntityTypeWrapper ENDER_DRAGON = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDER_DRAGON); - public static final EntityTypeWrapper ENDERMAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDERMAN); - public static final EntityTypeWrapper ENDERMITE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ENDERMITE); - public static final EntityTypeWrapper EVOKER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.EVOKER); - public static final EntityTypeWrapper FOX = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FOX); - public static final EntityTypeWrapper FROG = EntityTypeWrapper.of(net.minecraft.entity.EntityType.FROG); - public static final EntityTypeWrapper GHAST = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GHAST); - public static final EntityTypeWrapper GIANT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GIANT); - public static final EntityTypeWrapper GLOW_SQUID = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GLOW_SQUID); - public static final EntityTypeWrapper GOAT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GOAT); - public static final EntityTypeWrapper GUARDIAN = EntityTypeWrapper.of(net.minecraft.entity.EntityType.GUARDIAN); - public static final EntityTypeWrapper HUSK = EntityTypeWrapper.of(net.minecraft.entity.EntityType.HUSK); - public static final EntityTypeWrapper ILLUSIONER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ILLUSIONER); - public static final EntityTypeWrapper IRON_GOLEM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.IRON_GOLEM); - public static final EntityTypeWrapper LLAMA_SPIT = EntityTypeWrapper.of(net.minecraft.entity.EntityType.LLAMA_SPIT); - public static final EntityTypeWrapper MAGMA_CUBE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MAGMA_CUBE); - public static final EntityTypeWrapper MARKER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MARKER); - public static final EntityTypeWrapper MOOSHROOM = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MOOSHROOM); - public static final EntityTypeWrapper MULE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.MULE); - public static final EntityTypeWrapper SKELETON = EntityTypeWrapper.of(net.minecraft.entity.EntityType.SKELETON); - public static final EntityTypeWrapper VILLAGER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.VILLAGER); - public static final EntityTypeWrapper ZOMBIE = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ZOMBIE); - public static final EntityTypeWrapper ZOMBIE_VILLAGER = EntityTypeWrapper.of(net.minecraft.entity.EntityType.ZOMBIE_VILLAGER); + public static final EntityTypeWrapper ALLAY = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ALLAY); + public static final EntityTypeWrapper AXOLOTL = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.AXOLOTL); + public static final EntityTypeWrapper BAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.BAT); + public static final EntityTypeWrapper BEE = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.BEE); + public static final EntityTypeWrapper BLAZE = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.BLAZE); + public static final EntityTypeWrapper CAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.CAT); + public static final EntityTypeWrapper CHICKEN = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.CHICKEN); + public static final EntityTypeWrapper COD = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.COD); + public static final EntityTypeWrapper COW = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.COW); + public static final EntityTypeWrapper CREEPER = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.CREEPER); + public static final EntityTypeWrapper DOLPHIN = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.DOLPHIN); + public static final EntityTypeWrapper DONKEY = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.DONKEY); + public static final EntityTypeWrapper DROWNED = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.DROWNED); + public static final EntityTypeWrapper ELDER_GUARDIAN = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ELDER_GUARDIAN); + public static final EntityTypeWrapper ENDER_DRAGON = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ENDER_DRAGON); + public static final EntityTypeWrapper ENDERMAN = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ENDERMAN); + public static final EntityTypeWrapper ENDERMITE = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ENDERMITE); + public static final EntityTypeWrapper EVOKER = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.EVOKER); + public static final EntityTypeWrapper FOX = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.FOX); + public static final EntityTypeWrapper FROG = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.FROG); + public static final EntityTypeWrapper GHAST = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.GHAST); + public static final EntityTypeWrapper GIANT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.GIANT); + public static final EntityTypeWrapper GLOW_SQUID = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.GLOW_SQUID); + public static final EntityTypeWrapper GOAT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.GOAT); + public static final EntityTypeWrapper GUARDIAN = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.GUARDIAN); + public static final EntityTypeWrapper HUSK = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.HUSK); + public static final EntityTypeWrapper ILLUSIONER = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ILLUSIONER); + public static final EntityTypeWrapper IRON_GOLEM = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.IRON_GOLEM); + public static final EntityTypeWrapper LLAMA_SPIT = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.LLAMA_SPIT); + public static final EntityTypeWrapper MAGMA_CUBE = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.MAGMA_CUBE); + public static final EntityTypeWrapper MARKER = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.MARKER); + public static final EntityTypeWrapper MOOSHROOM = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.MOOSHROOM); + public static final EntityTypeWrapper MULE = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.MULE); + public static final EntityTypeWrapper SKELETON = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.SKELETON); + public static final EntityTypeWrapper VILLAGER = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.VILLAGER); + public static final EntityTypeWrapper ZOMBIE = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ZOMBIE); + public static final EntityTypeWrapper ZOMBIE_VILLAGER = EntityTypeWrapper.of(net.minecraft.world.entity.EntityType.ZOMBIE_VILLAGER); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java index 5a019773e..ff683cacd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.entity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; import net.pitan76.mcpitanlib.api.entity.CompatEntity; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.text.TextComponent; @@ -16,7 +16,7 @@ import java.util.UUID; public class EntityWrapper { - private final net.minecraft.entity.Entity entity; + private final net.minecraft.world.entity.Entity entity; public static final EntityWrapper EMPTY = new EntityWrapper(null); @@ -24,11 +24,11 @@ protected EntityWrapper() { this.entity = null; } - protected EntityWrapper(net.minecraft.entity.Entity entity) { + protected EntityWrapper(net.minecraft.world.entity.Entity entity) { this.entity = entity; } - public static EntityWrapper of(net.minecraft.entity.Entity entity) { + public static EntityWrapper of(net.minecraft.world.entity.Entity entity) { return new EntityWrapper(entity); } @@ -44,7 +44,7 @@ public boolean isEmpty() { return get() == null; } - public net.minecraft.entity.Entity get() { + public net.minecraft.world.entity.Entity get() { return entity; } @@ -105,7 +105,7 @@ public void teleport(ServerWorld world, BlockPos pos) { } public BlockPos getBlockPos() { - return BlockPos.of(get().getBlockPos()); + return BlockPos.of(get().blockPosition()); } public World getWorld() { @@ -310,11 +310,11 @@ public EntityWrapper getRootVehicle() { } public EntityWrapper getPassenger(int index) { - return EntityWrapper.of(get().getPassengerList().get(index)); + return EntityWrapper.of(get().getPassengers().get(index)); } public int getPassengerCount() { - return get().getPassengerList().size(); + return get().getPassengers().size(); } public Class getEntityClass() { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java index 0336723b2..908f4fb71 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java @@ -8,20 +8,20 @@ import net.pitan76.mcpitanlib.midohra.world.World; public class ItemEntityWrapper extends EntityWrapper { - public ItemEntityWrapper(net.minecraft.entity.ItemEntity entity) { + public ItemEntityWrapper(net.minecraft.world.entity.item.ItemEntity entity) { super(entity); } - public static ItemEntityWrapper of(net.minecraft.entity.ItemEntity entity) { + public static ItemEntityWrapper of(net.minecraft.world.entity.item.ItemEntity entity) { return new ItemEntityWrapper(entity); } @Override - public net.minecraft.entity.ItemEntity get() { - return (net.minecraft.entity.ItemEntity) super.get(); + public net.minecraft.world.entity.item.ItemEntity get() { + return (net.minecraft.world.entity.item.ItemEntity) super.get(); } - public net.minecraft.item.ItemStack getStackRaw() { + public net.minecraft.world.item.ItemStack getStackRaw() { return ItemEntityUtil.getStack(get()); } @@ -29,8 +29,8 @@ public ItemStack getStack() { return ItemStack.of(getStackRaw()); } - public void setStack(net.minecraft.item.ItemStack stack) { - get().setStack(stack); + public void setStack(net.minecraft.world.item.ItemStack stack) { + get().setItem(stack); } public void setStack(ItemStack stack) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java index c5fe6a6d3..b15de0e83 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java @@ -1,37 +1,37 @@ package net.pitan76.mcpitanlib.midohra.entity; public class SpawnReason { - private final net.minecraft.entity.SpawnReason raw; + private final net.minecraft.world.entity.EntitySpawnReason raw; - public static final SpawnReason NATURAL = of(net.minecraft.entity.SpawnReason.NATURAL); - public static final SpawnReason CHUNK_GENERATION = of(net.minecraft.entity.SpawnReason.CHUNK_GENERATION); - public static final SpawnReason SPAWNER = of(net.minecraft.entity.SpawnReason.SPAWNER); - public static final SpawnReason STRUCTURE = of(net.minecraft.entity.SpawnReason.STRUCTURE); - public static final SpawnReason BREEDING = of(net.minecraft.entity.SpawnReason.BREEDING); - public static final SpawnReason MOB_SUMMONED = of(net.minecraft.entity.SpawnReason.MOB_SUMMONED); - public static final SpawnReason JOCKEY = of(net.minecraft.entity.SpawnReason.JOCKEY); - public static final SpawnReason EVENT = of(net.minecraft.entity.SpawnReason.EVENT); - public static final SpawnReason CONVERSION = of(net.minecraft.entity.SpawnReason.CONVERSION); - public static final SpawnReason REINFORCEMENT = of(net.minecraft.entity.SpawnReason.REINFORCEMENT); - public static final SpawnReason TRIGGERED = of(net.minecraft.entity.SpawnReason.TRIGGERED); - public static final SpawnReason BUCKET = of(net.minecraft.entity.SpawnReason.BUCKET); - public static final SpawnReason SPAWN_ITEM_USE = of(net.minecraft.entity.SpawnReason.SPAWN_ITEM_USE); - public static final SpawnReason COMMAND = of(net.minecraft.entity.SpawnReason.COMMAND); - public static final SpawnReason DISPENSER = of(net.minecraft.entity.SpawnReason.DISPENSER); - public static final SpawnReason PATROL = of(net.minecraft.entity.SpawnReason.PATROL); - public static final SpawnReason TRIAL_SPAWNER = of(net.minecraft.entity.SpawnReason.TRIAL_SPAWNER); - public static final SpawnReason LOAD = of(net.minecraft.entity.SpawnReason.LOAD); - public static final SpawnReason DIMENSION_TRAVEL = of(net.minecraft.entity.SpawnReason.DIMENSION_TRAVEL); + public static final SpawnReason NATURAL = of(net.minecraft.world.entity.EntitySpawnReason.NATURAL); + public static final SpawnReason CHUNK_GENERATION = of(net.minecraft.world.entity.EntitySpawnReason.CHUNK_GENERATION); + public static final SpawnReason SPAWNER = of(net.minecraft.world.entity.EntitySpawnReason.SPAWNER); + public static final SpawnReason STRUCTURE = of(net.minecraft.world.entity.EntitySpawnReason.STRUCTURE); + public static final SpawnReason BREEDING = of(net.minecraft.world.entity.EntitySpawnReason.BREEDING); + public static final SpawnReason MOB_SUMMONED = of(net.minecraft.world.entity.EntitySpawnReason.MOB_SUMMONED); + public static final SpawnReason JOCKEY = of(net.minecraft.world.entity.EntitySpawnReason.JOCKEY); + public static final SpawnReason EVENT = of(net.minecraft.world.entity.EntitySpawnReason.EVENT); + public static final SpawnReason CONVERSION = of(net.minecraft.world.entity.EntitySpawnReason.CONVERSION); + public static final SpawnReason REINFORCEMENT = of(net.minecraft.world.entity.EntitySpawnReason.REINFORCEMENT); + public static final SpawnReason TRIGGERED = of(net.minecraft.world.entity.EntitySpawnReason.TRIGGERED); + public static final SpawnReason BUCKET = of(net.minecraft.world.entity.EntitySpawnReason.BUCKET); + public static final SpawnReason SPAWN_ITEM_USE = of(net.minecraft.world.entity.EntitySpawnReason.SPAWN_ITEM_USE); + public static final SpawnReason COMMAND = of(net.minecraft.world.entity.EntitySpawnReason.COMMAND); + public static final SpawnReason DISPENSER = of(net.minecraft.world.entity.EntitySpawnReason.DISPENSER); + public static final SpawnReason PATROL = of(net.minecraft.world.entity.EntitySpawnReason.PATROL); + public static final SpawnReason TRIAL_SPAWNER = of(net.minecraft.world.entity.EntitySpawnReason.TRIAL_SPAWNER); + public static final SpawnReason LOAD = of(net.minecraft.world.entity.EntitySpawnReason.LOAD); + public static final SpawnReason DIMENSION_TRAVEL = of(net.minecraft.world.entity.EntitySpawnReason.DIMENSION_TRAVEL); - protected SpawnReason(net.minecraft.entity.SpawnReason raw) { + protected SpawnReason(net.minecraft.world.entity.EntitySpawnReason raw) { this.raw = raw; } - public static SpawnReason of(net.minecraft.entity.SpawnReason raw) { + public static SpawnReason of(net.minecraft.world.entity.EntitySpawnReason raw) { return new SpawnReason(raw); } - public net.minecraft.entity.SpawnReason getRaw() { + public net.minecraft.world.entity.EntitySpawnReason getRaw() { return raw; } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java index 720de5698..2af5cc3e0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.fluid; -import net.minecraft.fluid.FluidState; +import net.minecraft.world.level.material.FluidState; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.FluidStateUtil; import net.pitan76.mcpitanlib.api.util.FluidUtil; @@ -8,17 +8,17 @@ import org.jetbrains.annotations.Nullable; public class FluidWrapper { - private final net.minecraft.fluid.Fluid fluid; + private final net.minecraft.world.level.material.Fluid fluid; protected FluidWrapper() { this.fluid = null; } - protected FluidWrapper(net.minecraft.fluid.Fluid fluid) { + protected FluidWrapper(net.minecraft.world.level.material.Fluid fluid) { this.fluid = fluid; } - public static FluidWrapper of(net.minecraft.fluid.Fluid fluid) { + public static FluidWrapper of(net.minecraft.world.level.material.Fluid fluid) { return new FluidWrapper(fluid); } @@ -53,11 +53,11 @@ public boolean isEmpty() { } @Nullable - public net.minecraft.fluid.Fluid get() { + public net.minecraft.world.level.material.Fluid get() { return fluid; } - public net.minecraft.fluid.Fluid gerOrDefault(net.minecraft.fluid.Fluid defaultFluid) { + public net.minecraft.world.level.material.Fluid gerOrDefault(net.minecraft.world.level.material.Fluid defaultFluid) { return isEmpty() ? defaultFluid : get(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java index 15a200faa..50a525c48 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.midohra.fluid; public class Fluids { - public static final FluidWrapper EMPTY = FluidWrapper.of(net.minecraft.fluid.Fluids.EMPTY); - public static final FluidWrapper WATER = FluidWrapper.of(net.minecraft.fluid.Fluids.WATER); - public static final FluidWrapper LAVA = FluidWrapper.of(net.minecraft.fluid.Fluids.LAVA); - public static final FluidWrapper FLOWING_WATER = FluidWrapper.of(net.minecraft.fluid.Fluids.FLOWING_WATER); - public static final FluidWrapper FLOWING_LAVA = FluidWrapper.of(net.minecraft.fluid.Fluids.FLOWING_LAVA); + public static final FluidWrapper EMPTY = FluidWrapper.of(net.minecraft.world.level.material.Fluids.EMPTY); + public static final FluidWrapper WATER = FluidWrapper.of(net.minecraft.world.level.material.Fluids.WATER); + public static final FluidWrapper LAVA = FluidWrapper.of(net.minecraft.world.level.material.Fluids.LAVA); + public static final FluidWrapper FLOWING_WATER = FluidWrapper.of(net.minecraft.world.level.material.Fluids.FLOWING_WATER); + public static final FluidWrapper FLOWING_LAVA = FluidWrapper.of(net.minecraft.world.level.material.Fluids.FLOWING_LAVA); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java b/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java index 9601ef3d1..de5b84f4e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java @@ -30,6 +30,6 @@ default BlockState with(DirectionProperty property, Direction value) { } default Direction get(DirectionProperty property) { - return Direction.of(get((IProperty) property)); + return Direction.of(get((IProperty) property)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java index 2773aaa7a..887e1938b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java @@ -4,17 +4,17 @@ import net.pitan76.mcpitanlib.api.util.item.ItemGroupUtil; public class ItemGroupWrapper { - private final net.minecraft.item.ItemGroup itemGroup; + private final net.minecraft.world.item.CreativeModeTab itemGroup; protected ItemGroupWrapper() { this.itemGroup = null; } - protected ItemGroupWrapper(net.minecraft.item.ItemGroup itemGroup) { + protected ItemGroupWrapper(net.minecraft.world.item.CreativeModeTab itemGroup) { this.itemGroup = itemGroup; } - public static ItemGroupWrapper of(net.minecraft.item.ItemGroup itemGroup) { + public static ItemGroupWrapper of(net.minecraft.world.item.CreativeModeTab itemGroup) { return new ItemGroupWrapper(itemGroup); } @@ -37,7 +37,7 @@ public boolean isEmpty() { return itemGroup == null; } - public net.minecraft.item.ItemGroup get() { + public net.minecraft.world.item.CreativeModeTab get() { return itemGroup; } @@ -48,7 +48,7 @@ public CompatIdentifier getId() { public ItemStack getIcon() { if (isEmpty()) return ItemStack.EMPTY; - return ItemStack.of(itemGroup.getIcon()); + return ItemStack.of(itemGroup.getIconItem()); } public boolean rawEquals(ItemGroupWrapper other) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java index 7ceefce5a..9647ee005 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java @@ -24,7 +24,7 @@ public class ItemGroups { public static final ItemGroupWrapper DECORATIONS = NATURAL; public static final ItemGroupWrapper MISC = INGREDIENTS; - private static ItemGroupWrapper of(net.minecraft.item.ItemGroup itemGroup) { + private static ItemGroupWrapper of(net.minecraft.world.item.CreativeModeTab itemGroup) { return ItemGroupWrapper.of(itemGroup); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java index 4bf936e58..b48710d53 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.midohra.item; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.text.Text; -import net.minecraft.world.World; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.enchantment.CompatEnchantment; import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; import net.pitan76.mcpitanlib.api.text.TextComponent; @@ -15,25 +15,25 @@ import java.util.Map; public class ItemStack { - private final net.minecraft.item.ItemStack stack; + private final net.minecraft.world.item.ItemStack stack; public static final ItemStack EMPTY = new ItemStack(ItemStackUtil.empty()); - protected ItemStack(net.minecraft.item.ItemStack stack) { + protected ItemStack(net.minecraft.world.item.ItemStack stack) { this.stack = stack; } - public static ItemStack of(net.minecraft.item.ItemStack stack) { + public static ItemStack of(net.minecraft.world.item.ItemStack stack) { if (stack == null || stack.isEmpty()) return EMPTY; return new ItemStack(stack); } - public static ItemStack of(ItemConvertible item) { + public static ItemStack of(ItemLike item) { return new Builder().item(item).build(); } - public static ItemStack of(ItemConvertible item, int count) { + public static ItemStack of(ItemLike item, int count) { return new Builder().item(item).count(count).build(); } @@ -49,11 +49,11 @@ public void setCount(int count) { stack.setCount(count); } - public NbtCompound getCustomNbt() { + public CompoundTag getCustomNbt() { return CustomDataUtil.getNbt(stack); } - public void setCustomNbt(NbtCompound nbt) { + public void setCustomNbt(CompoundTag nbt) { CustomDataUtil.setNbt(stack, nbt); } @@ -81,11 +81,11 @@ public ItemStack copyWithCount(int count) { return new ItemStack(stack.copyWithCount(count)); } - public Map getEnchantments(@Nullable World world) { + public Map getEnchantments(@Nullable Level world) { return EnchantmentUtil.getEnchantment(stack, world); } - public void setEnchantments(Map enchantments, @Nullable World world) { + public void setEnchantments(Map enchantments, @Nullable Level world) { EnchantmentUtil.setEnchantment(stack, enchantments, world); } @@ -97,7 +97,7 @@ public boolean hasLore() { return LoreUtil.hasLore(stack); } - public List getLore() { + public List getLore() { return LoreUtil.getLore(stack); } @@ -105,7 +105,7 @@ public List getLoreAsStringList() { return LoreUtil.getLoreAsStringList(stack); } - public void setLore(List lore) { + public void setLore(List lore) { LoreUtil.setLore(stack, lore); } @@ -118,7 +118,7 @@ public void setLore(String lore) { } @Deprecated - public net.minecraft.item.ItemStack toMinecraft() { + public net.minecraft.world.item.ItemStack toMinecraft() { return stack; } @@ -137,7 +137,7 @@ public static class Builder { protected CompatIdentifier id; protected int count = 1; - protected NbtCompound nbt = NbtUtil.create(); + protected CompoundTag nbt = NbtUtil.create(); public Builder() { @@ -148,7 +148,7 @@ public Builder item(CompatIdentifier id) { return this; } - public Builder item(ItemConvertible item) { + public Builder item(ItemLike item) { this.id = ItemUtil.toCompatID(item.asItem()); return this; } @@ -158,13 +158,13 @@ public Builder count(int count) { return this; } - public Builder nbt(NbtCompound nbt) { + public Builder nbt(CompoundTag nbt) { this.nbt = nbt; return this; } public ItemStack build() { - net.minecraft.item.ItemStack stack = new net.minecraft.item.ItemStack(ItemUtil.fromId(id), count); + net.minecraft.world.item.ItemStack stack = new net.minecraft.world.item.ItemStack(ItemUtil.fromId(id), count); CustomDataUtil.setNbt(stack, nbt); return new ItemStack(stack); diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java index 1476e2b26..3955cee32 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java @@ -11,17 +11,17 @@ import java.util.Optional; public class ItemWrapper { - private final net.minecraft.item.Item item; + private final net.minecraft.world.item.Item item; protected ItemWrapper() { this.item = null; } - protected ItemWrapper(net.minecraft.item.Item item) { + protected ItemWrapper(net.minecraft.world.item.Item item) { this.item = item; } - public static ItemWrapper of(net.minecraft.item.Item item) { + public static ItemWrapper of(net.minecraft.world.item.Item item) { return new ItemWrapper(item); } @@ -56,15 +56,15 @@ public boolean isEmpty() { } public boolean isAir() { - return isEmpty() || get() == net.minecraft.item.Items.AIR; + return isEmpty() || get() == net.minecraft.world.item.Items.AIR; } @Nullable - public net.minecraft.item.Item get() { + public net.minecraft.world.item.Item get() { return item; } - public net.minecraft.item.Item gerOrDefault(net.minecraft.item.Item defaultItem) { + public net.minecraft.world.item.Item gerOrDefault(net.minecraft.world.item.Item defaultItem) { return isEmpty() ? defaultItem : get(); } @@ -99,14 +99,14 @@ public boolean isInTag(CompatIdentifier id) { } public boolean isBlock() { - return !isEmpty() && get() instanceof net.minecraft.item.BlockItem; + return !isEmpty() && get() instanceof net.minecraft.world.item.BlockItem; } public BlockWrapper asBlock() { if (!isBlock()) return BlockWrapper.of(); - return BlockWrapper.of(((net.minecraft.item.BlockItem) get()).getBlock()); + return BlockWrapper.of(((net.minecraft.world.item.BlockItem) get()).getBlock()); } public boolean rawEquals(ItemWrapper item) { @@ -142,7 +142,7 @@ public static ItemWrapper of(String namespace, String path) { } public static ItemWrapper of(CompatItem item) { - return of((net.minecraft.item.Item) item); + return of((net.minecraft.world.item.Item) item); } public Optional toCompatItem() { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java index c79f22ff6..838320040 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java @@ -1,984 +1,984 @@ package net.pitan76.mcpitanlib.midohra.item; public class Items { - public static ItemWrapper AIR = of(net.minecraft.item.Items.AIR); - public static ItemWrapper STONE = of(net.minecraft.item.Items.STONE); - public static ItemWrapper GRANITE = of(net.minecraft.item.Items.GRANITE); - public static ItemWrapper POLISHED_GRANITE = of(net.minecraft.item.Items.POLISHED_GRANITE); - public static ItemWrapper DIORITE = of(net.minecraft.item.Items.DIORITE); - public static ItemWrapper POLISHED_DIORITE = of(net.minecraft.item.Items.POLISHED_DIORITE); - public static ItemWrapper ANDESITE = of(net.minecraft.item.Items.ANDESITE); - public static ItemWrapper POLISHED_ANDESITE = of(net.minecraft.item.Items.POLISHED_ANDESITE); - public static ItemWrapper GRASS_BLOCK = of(net.minecraft.item.Items.GRASS_BLOCK); - public static ItemWrapper DIRT = of(net.minecraft.item.Items.DIRT); - public static ItemWrapper COARSE_DIRT = of(net.minecraft.item.Items.COARSE_DIRT); - public static ItemWrapper PODZOL = of(net.minecraft.item.Items.PODZOL); - public static ItemWrapper CRIMSON_NYLIUM = of(net.minecraft.item.Items.CRIMSON_NYLIUM); - public static ItemWrapper WARPED_NYLIUM = of(net.minecraft.item.Items.WARPED_NYLIUM); - public static ItemWrapper COBBLESTONE = of(net.minecraft.item.Items.COBBLESTONE); - public static ItemWrapper OAK_PLANKS = of(net.minecraft.item.Items.OAK_PLANKS); - public static ItemWrapper SPRUCE_PLANKS = of(net.minecraft.item.Items.SPRUCE_PLANKS); - public static ItemWrapper BIRCH_PLANKS = of(net.minecraft.item.Items.BIRCH_PLANKS); - public static ItemWrapper JUNGLE_PLANKS = of(net.minecraft.item.Items.JUNGLE_PLANKS); - public static ItemWrapper ACACIA_PLANKS = of(net.minecraft.item.Items.ACACIA_PLANKS); - public static ItemWrapper DARK_OAK_PLANKS = of(net.minecraft.item.Items.DARK_OAK_PLANKS); - public static ItemWrapper CRIMSON_PLANKS = of(net.minecraft.item.Items.CRIMSON_PLANKS); - public static ItemWrapper WARPED_PLANKS = of(net.minecraft.item.Items.WARPED_PLANKS); - public static ItemWrapper OAK_SAPLING = of(net.minecraft.item.Items.OAK_SAPLING); - public static ItemWrapper SPRUCE_SAPLING = of(net.minecraft.item.Items.SPRUCE_SAPLING); - public static ItemWrapper BIRCH_SAPLING = of(net.minecraft.item.Items.BIRCH_SAPLING); - public static ItemWrapper JUNGLE_SAPLING = of(net.minecraft.item.Items.JUNGLE_SAPLING); - public static ItemWrapper ACACIA_SAPLING = of(net.minecraft.item.Items.ACACIA_SAPLING); - public static ItemWrapper DARK_OAK_SAPLING = of(net.minecraft.item.Items.DARK_OAK_SAPLING); - public static ItemWrapper BEDROCK = of(net.minecraft.item.Items.BEDROCK); - public static ItemWrapper SAND = of(net.minecraft.item.Items.SAND); - public static ItemWrapper RED_SAND = of(net.minecraft.item.Items.RED_SAND); - public static ItemWrapper GRAVEL = of(net.minecraft.item.Items.GRAVEL); - public static ItemWrapper GOLD_ORE = of(net.minecraft.item.Items.GOLD_ORE); - public static ItemWrapper IRON_ORE = of(net.minecraft.item.Items.IRON_ORE); - public static ItemWrapper COAL_ORE = of(net.minecraft.item.Items.COAL_ORE); - public static ItemWrapper NETHER_GOLD_ORE = of(net.minecraft.item.Items.NETHER_GOLD_ORE); - public static ItemWrapper OAK_LOG = of(net.minecraft.item.Items.OAK_LOG); - public static ItemWrapper SPRUCE_LOG = of(net.minecraft.item.Items.SPRUCE_LOG); - public static ItemWrapper BIRCH_LOG = of(net.minecraft.item.Items.BIRCH_LOG); - public static ItemWrapper JUNGLE_LOG = of(net.minecraft.item.Items.JUNGLE_LOG); - public static ItemWrapper ACACIA_LOG = of(net.minecraft.item.Items.ACACIA_LOG); - public static ItemWrapper DARK_OAK_LOG = of(net.minecraft.item.Items.DARK_OAK_LOG); - public static ItemWrapper CRIMSON_STEM = of(net.minecraft.item.Items.CRIMSON_STEM); - public static ItemWrapper WARPED_STEM = of(net.minecraft.item.Items.WARPED_STEM); - public static ItemWrapper STRIPPED_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_OAK_LOG); - public static ItemWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.item.Items.STRIPPED_SPRUCE_LOG); - public static ItemWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.item.Items.STRIPPED_BIRCH_LOG); - public static ItemWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.item.Items.STRIPPED_JUNGLE_LOG); - public static ItemWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.item.Items.STRIPPED_ACACIA_LOG); - public static ItemWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_LOG); - public static ItemWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.item.Items.STRIPPED_CRIMSON_STEM); - public static ItemWrapper STRIPPED_WARPED_STEM = of(net.minecraft.item.Items.STRIPPED_WARPED_STEM); - public static ItemWrapper STRIPPED_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_OAK_WOOD); - public static ItemWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.item.Items.STRIPPED_SPRUCE_WOOD); - public static ItemWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.item.Items.STRIPPED_BIRCH_WOOD); - public static ItemWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.item.Items.STRIPPED_JUNGLE_WOOD); - public static ItemWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.item.Items.STRIPPED_ACACIA_WOOD); - public static ItemWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.item.Items.STRIPPED_DARK_OAK_WOOD); - public static ItemWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.item.Items.STRIPPED_CRIMSON_HYPHAE); - public static ItemWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.item.Items.STRIPPED_WARPED_HYPHAE); - public static ItemWrapper OAK_WOOD = of(net.minecraft.item.Items.OAK_WOOD); - public static ItemWrapper SPRUCE_WOOD = of(net.minecraft.item.Items.SPRUCE_WOOD); - public static ItemWrapper BIRCH_WOOD = of(net.minecraft.item.Items.BIRCH_WOOD); - public static ItemWrapper JUNGLE_WOOD = of(net.minecraft.item.Items.JUNGLE_WOOD); - public static ItemWrapper ACACIA_WOOD = of(net.minecraft.item.Items.ACACIA_WOOD); - public static ItemWrapper DARK_OAK_WOOD = of(net.minecraft.item.Items.DARK_OAK_WOOD); - public static ItemWrapper CRIMSON_HYPHAE = of(net.minecraft.item.Items.CRIMSON_HYPHAE); - public static ItemWrapper WARPED_HYPHAE = of(net.minecraft.item.Items.WARPED_HYPHAE); - public static ItemWrapper OAK_LEAVES = of(net.minecraft.item.Items.OAK_LEAVES); - public static ItemWrapper SPRUCE_LEAVES = of(net.minecraft.item.Items.SPRUCE_LEAVES); - public static ItemWrapper BIRCH_LEAVES = of(net.minecraft.item.Items.BIRCH_LEAVES); - public static ItemWrapper JUNGLE_LEAVES = of(net.minecraft.item.Items.JUNGLE_LEAVES); - public static ItemWrapper ACACIA_LEAVES = of(net.minecraft.item.Items.ACACIA_LEAVES); - public static ItemWrapper DARK_OAK_LEAVES = of(net.minecraft.item.Items.DARK_OAK_LEAVES); - public static ItemWrapper SPONGE = of(net.minecraft.item.Items.SPONGE); - public static ItemWrapper WET_SPONGE = of(net.minecraft.item.Items.WET_SPONGE); - public static ItemWrapper GLASS = of(net.minecraft.item.Items.GLASS); - public static ItemWrapper LAPIS_ORE = of(net.minecraft.item.Items.LAPIS_ORE); - public static ItemWrapper LAPIS_BLOCK = of(net.minecraft.item.Items.LAPIS_BLOCK); - public static ItemWrapper DISPENSER = of(net.minecraft.item.Items.DISPENSER); - public static ItemWrapper SANDSTONE = of(net.minecraft.item.Items.SANDSTONE); - public static ItemWrapper CHISELED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_SANDSTONE); - public static ItemWrapper CUT_SANDSTONE = of(net.minecraft.item.Items.CUT_SANDSTONE); - public static ItemWrapper NOTE_BLOCK = of(net.minecraft.item.Items.NOTE_BLOCK); - public static ItemWrapper POWERED_RAIL = of(net.minecraft.item.Items.POWERED_RAIL); - public static ItemWrapper DETECTOR_RAIL = of(net.minecraft.item.Items.DETECTOR_RAIL); - public static ItemWrapper STICKY_PISTON = of(net.minecraft.item.Items.STICKY_PISTON); - public static ItemWrapper COBWEB = of(net.minecraft.item.Items.COBWEB); - public static ItemWrapper GRASS = of(net.minecraft.item.Items.SHORT_GRASS); - public static ItemWrapper FERN = of(net.minecraft.item.Items.FERN); - public static ItemWrapper DEAD_BUSH = of(net.minecraft.item.Items.DEAD_BUSH); - public static ItemWrapper SEAGRASS = of(net.minecraft.item.Items.SEAGRASS); - public static ItemWrapper SEA_PICKLE = of(net.minecraft.item.Items.SEA_PICKLE); - public static ItemWrapper PISTON = of(net.minecraft.item.Items.PISTON); - public static ItemWrapper WHITE_WOOL = of(net.minecraft.item.Items.WHITE_WOOL); - public static ItemWrapper ORANGE_WOOL = of(net.minecraft.item.Items.ORANGE_WOOL); - public static ItemWrapper MAGENTA_WOOL = of(net.minecraft.item.Items.MAGENTA_WOOL); - public static ItemWrapper LIGHT_BLUE_WOOL = of(net.minecraft.item.Items.LIGHT_BLUE_WOOL); - public static ItemWrapper YELLOW_WOOL = of(net.minecraft.item.Items.YELLOW_WOOL); - public static ItemWrapper LIME_WOOL = of(net.minecraft.item.Items.LIME_WOOL); - public static ItemWrapper PINK_WOOL = of(net.minecraft.item.Items.PINK_WOOL); - public static ItemWrapper GRAY_WOOL = of(net.minecraft.item.Items.GRAY_WOOL); - public static ItemWrapper LIGHT_GRAY_WOOL = of(net.minecraft.item.Items.LIGHT_GRAY_WOOL); - public static ItemWrapper CYAN_WOOL = of(net.minecraft.item.Items.CYAN_WOOL); - public static ItemWrapper PURPLE_WOOL = of(net.minecraft.item.Items.PURPLE_WOOL); - public static ItemWrapper BLUE_WOOL = of(net.minecraft.item.Items.BLUE_WOOL); - public static ItemWrapper BROWN_WOOL = of(net.minecraft.item.Items.BROWN_WOOL); - public static ItemWrapper GREEN_WOOL = of(net.minecraft.item.Items.GREEN_WOOL); - public static ItemWrapper RED_WOOL = of(net.minecraft.item.Items.RED_WOOL); - public static ItemWrapper BLACK_WOOL = of(net.minecraft.item.Items.BLACK_WOOL); - public static ItemWrapper DANDELION = of(net.minecraft.item.Items.DANDELION); - public static ItemWrapper POPPY = of(net.minecraft.item.Items.POPPY); - public static ItemWrapper BLUE_ORCHID = of(net.minecraft.item.Items.BLUE_ORCHID); - public static ItemWrapper ALLIUM = of(net.minecraft.item.Items.ALLIUM); - public static ItemWrapper AZURE_BLUET = of(net.minecraft.item.Items.AZURE_BLUET); - public static ItemWrapper RED_TULIP = of(net.minecraft.item.Items.RED_TULIP); - public static ItemWrapper ORANGE_TULIP = of(net.minecraft.item.Items.ORANGE_TULIP); - public static ItemWrapper WHITE_TULIP = of(net.minecraft.item.Items.WHITE_TULIP); - public static ItemWrapper PINK_TULIP = of(net.minecraft.item.Items.PINK_TULIP); - public static ItemWrapper OXEYE_DAISY = of(net.minecraft.item.Items.OXEYE_DAISY); - public static ItemWrapper CORNFLOWER = of(net.minecraft.item.Items.CORNFLOWER); - public static ItemWrapper LILY_OF_THE_VALLEY = of(net.minecraft.item.Items.LILY_OF_THE_VALLEY); - public static ItemWrapper WITHER_ROSE = of(net.minecraft.item.Items.WITHER_ROSE); - public static ItemWrapper BROWN_MUSHROOM = of(net.minecraft.item.Items.BROWN_MUSHROOM); - public static ItemWrapper RED_MUSHROOM = of(net.minecraft.item.Items.RED_MUSHROOM); - public static ItemWrapper CRIMSON_FUNGUS = of(net.minecraft.item.Items.CRIMSON_FUNGUS); - public static ItemWrapper WARPED_FUNGUS = of(net.minecraft.item.Items.WARPED_FUNGUS); - public static ItemWrapper CRIMSON_ROOTS = of(net.minecraft.item.Items.CRIMSON_ROOTS); - public static ItemWrapper WARPED_ROOTS = of(net.minecraft.item.Items.WARPED_ROOTS); - public static ItemWrapper NETHER_SPROUTS = of(net.minecraft.item.Items.NETHER_SPROUTS); - public static ItemWrapper WEEPING_VINES = of(net.minecraft.item.Items.WEEPING_VINES); - public static ItemWrapper TWISTING_VINES = of(net.minecraft.item.Items.TWISTING_VINES); - public static ItemWrapper SUGAR_CANE = of(net.minecraft.item.Items.SUGAR_CANE); - public static ItemWrapper KELP = of(net.minecraft.item.Items.KELP); - public static ItemWrapper BAMBOO = of(net.minecraft.item.Items.BAMBOO); - public static ItemWrapper GOLD_BLOCK = of(net.minecraft.item.Items.GOLD_BLOCK); - public static ItemWrapper IRON_BLOCK = of(net.minecraft.item.Items.IRON_BLOCK); - public static ItemWrapper OAK_SLAB = of(net.minecraft.item.Items.OAK_SLAB); - public static ItemWrapper SPRUCE_SLAB = of(net.minecraft.item.Items.SPRUCE_SLAB); - public static ItemWrapper BIRCH_SLAB = of(net.minecraft.item.Items.BIRCH_SLAB); - public static ItemWrapper JUNGLE_SLAB = of(net.minecraft.item.Items.JUNGLE_SLAB); - public static ItemWrapper ACACIA_SLAB = of(net.minecraft.item.Items.ACACIA_SLAB); - public static ItemWrapper DARK_OAK_SLAB = of(net.minecraft.item.Items.DARK_OAK_SLAB); - public static ItemWrapper CRIMSON_SLAB = of(net.minecraft.item.Items.CRIMSON_SLAB); - public static ItemWrapper WARPED_SLAB = of(net.minecraft.item.Items.WARPED_SLAB); - public static ItemWrapper STONE_SLAB = of(net.minecraft.item.Items.STONE_SLAB); - public static ItemWrapper SMOOTH_STONE_SLAB = of(net.minecraft.item.Items.SMOOTH_STONE_SLAB); - public static ItemWrapper SANDSTONE_SLAB = of(net.minecraft.item.Items.SANDSTONE_SLAB); - public static ItemWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_SANDSTONE_SLAB); - public static ItemWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.item.Items.PETRIFIED_OAK_SLAB); - public static ItemWrapper COBBLESTONE_SLAB = of(net.minecraft.item.Items.COBBLESTONE_SLAB); - public static ItemWrapper BRICK_SLAB = of(net.minecraft.item.Items.BRICK_SLAB); - public static ItemWrapper STONE_BRICK_SLAB = of(net.minecraft.item.Items.STONE_BRICK_SLAB); - public static ItemWrapper NETHER_BRICK_SLAB = of(net.minecraft.item.Items.NETHER_BRICK_SLAB); - public static ItemWrapper QUARTZ_SLAB = of(net.minecraft.item.Items.QUARTZ_SLAB); - public static ItemWrapper RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.RED_SANDSTONE_SLAB); - public static ItemWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.CUT_RED_SANDSTONE_SLAB); - public static ItemWrapper PURPUR_SLAB = of(net.minecraft.item.Items.PURPUR_SLAB); - public static ItemWrapper PRISMARINE_SLAB = of(net.minecraft.item.Items.PRISMARINE_SLAB); - public static ItemWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.item.Items.PRISMARINE_BRICK_SLAB); - public static ItemWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.item.Items.DARK_PRISMARINE_SLAB); - public static ItemWrapper SMOOTH_QUARTZ = of(net.minecraft.item.Items.SMOOTH_QUARTZ); - public static ItemWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE); - public static ItemWrapper SMOOTH_SANDSTONE = of(net.minecraft.item.Items.SMOOTH_SANDSTONE); - public static ItemWrapper SMOOTH_STONE = of(net.minecraft.item.Items.SMOOTH_STONE); - public static ItemWrapper BRICKS = of(net.minecraft.item.Items.BRICKS); - public static ItemWrapper TNT = of(net.minecraft.item.Items.TNT); - public static ItemWrapper BOOKSHELF = of(net.minecraft.item.Items.BOOKSHELF); - public static ItemWrapper MOSSY_COBBLESTONE = of(net.minecraft.item.Items.MOSSY_COBBLESTONE); - public static ItemWrapper OBSIDIAN = of(net.minecraft.item.Items.OBSIDIAN); - public static ItemWrapper TORCH = of(net.minecraft.item.Items.TORCH); - public static ItemWrapper END_ROD = of(net.minecraft.item.Items.END_ROD); - public static ItemWrapper CHORUS_PLANT = of(net.minecraft.item.Items.CHORUS_PLANT); - public static ItemWrapper CHORUS_FLOWER = of(net.minecraft.item.Items.CHORUS_FLOWER); - public static ItemWrapper PURPUR_BLOCK = of(net.minecraft.item.Items.PURPUR_BLOCK); - public static ItemWrapper PURPUR_PILLAR = of(net.minecraft.item.Items.PURPUR_PILLAR); - public static ItemWrapper PURPUR_STAIRS = of(net.minecraft.item.Items.PURPUR_STAIRS); - public static ItemWrapper SPAWNER = of(net.minecraft.item.Items.SPAWNER); - public static ItemWrapper OAK_STAIRS = of(net.minecraft.item.Items.OAK_STAIRS); - public static ItemWrapper CHEST = of(net.minecraft.item.Items.CHEST); - public static ItemWrapper DIAMOND_ORE = of(net.minecraft.item.Items.DIAMOND_ORE); - public static ItemWrapper DIAMOND_BLOCK = of(net.minecraft.item.Items.DIAMOND_BLOCK); - public static ItemWrapper CRAFTING_TABLE = of(net.minecraft.item.Items.CRAFTING_TABLE); - public static ItemWrapper FARMLAND = of(net.minecraft.item.Items.FARMLAND); - public static ItemWrapper FURNACE = of(net.minecraft.item.Items.FURNACE); - public static ItemWrapper LADDER = of(net.minecraft.item.Items.LADDER); - public static ItemWrapper RAIL = of(net.minecraft.item.Items.RAIL); - public static ItemWrapper COBBLESTONE_STAIRS = of(net.minecraft.item.Items.COBBLESTONE_STAIRS); - public static ItemWrapper LEVER = of(net.minecraft.item.Items.LEVER); - public static ItemWrapper STONE_PRESSURE_PLATE = of(net.minecraft.item.Items.STONE_PRESSURE_PLATE); - public static ItemWrapper OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.OAK_PRESSURE_PLATE); - public static ItemWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.item.Items.SPRUCE_PRESSURE_PLATE); - public static ItemWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.item.Items.BIRCH_PRESSURE_PLATE); - public static ItemWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.item.Items.JUNGLE_PRESSURE_PLATE); - public static ItemWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.item.Items.ACACIA_PRESSURE_PLATE); - public static ItemWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.item.Items.DARK_OAK_PRESSURE_PLATE); - public static ItemWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.item.Items.CRIMSON_PRESSURE_PLATE); - public static ItemWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.item.Items.WARPED_PRESSURE_PLATE); - public static ItemWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_PRESSURE_PLATE); - public static ItemWrapper REDSTONE_ORE = of(net.minecraft.item.Items.REDSTONE_ORE); - public static ItemWrapper REDSTONE_TORCH = of(net.minecraft.item.Items.REDSTONE_TORCH); - public static ItemWrapper SNOW = of(net.minecraft.item.Items.SNOW); - public static ItemWrapper ICE = of(net.minecraft.item.Items.ICE); - public static ItemWrapper SNOW_BLOCK = of(net.minecraft.item.Items.SNOW_BLOCK); - public static ItemWrapper CACTUS = of(net.minecraft.item.Items.CACTUS); - public static ItemWrapper CLAY = of(net.minecraft.item.Items.CLAY); - public static ItemWrapper JUKEBOX = of(net.minecraft.item.Items.JUKEBOX); - public static ItemWrapper OAK_FENCE = of(net.minecraft.item.Items.OAK_FENCE); - public static ItemWrapper SPRUCE_FENCE = of(net.minecraft.item.Items.SPRUCE_FENCE); - public static ItemWrapper BIRCH_FENCE = of(net.minecraft.item.Items.BIRCH_FENCE); - public static ItemWrapper JUNGLE_FENCE = of(net.minecraft.item.Items.JUNGLE_FENCE); - public static ItemWrapper ACACIA_FENCE = of(net.minecraft.item.Items.ACACIA_FENCE); - public static ItemWrapper DARK_OAK_FENCE = of(net.minecraft.item.Items.DARK_OAK_FENCE); - public static ItemWrapper CRIMSON_FENCE = of(net.minecraft.item.Items.CRIMSON_FENCE); - public static ItemWrapper WARPED_FENCE = of(net.minecraft.item.Items.WARPED_FENCE); - public static ItemWrapper PUMPKIN = of(net.minecraft.item.Items.PUMPKIN); - public static ItemWrapper CARVED_PUMPKIN = of(net.minecraft.item.Items.CARVED_PUMPKIN); - public static ItemWrapper NETHERRACK = of(net.minecraft.item.Items.NETHERRACK); - public static ItemWrapper SOUL_SAND = of(net.minecraft.item.Items.SOUL_SAND); - public static ItemWrapper SOUL_SOIL = of(net.minecraft.item.Items.SOUL_SOIL); - public static ItemWrapper BASALT = of(net.minecraft.item.Items.BASALT); - public static ItemWrapper POLISHED_BASALT = of(net.minecraft.item.Items.POLISHED_BASALT); - public static ItemWrapper SOUL_TORCH = of(net.minecraft.item.Items.SOUL_TORCH); - public static ItemWrapper GLOWSTONE = of(net.minecraft.item.Items.GLOWSTONE); - public static ItemWrapper JACK_O_LANTERN = of(net.minecraft.item.Items.JACK_O_LANTERN); - public static ItemWrapper OAK_TRAPDOOR = of(net.minecraft.item.Items.OAK_TRAPDOOR); - public static ItemWrapper SPRUCE_TRAPDOOR = of(net.minecraft.item.Items.SPRUCE_TRAPDOOR); - public static ItemWrapper BIRCH_TRAPDOOR = of(net.minecraft.item.Items.BIRCH_TRAPDOOR); - public static ItemWrapper JUNGLE_TRAPDOOR = of(net.minecraft.item.Items.JUNGLE_TRAPDOOR); - public static ItemWrapper ACACIA_TRAPDOOR = of(net.minecraft.item.Items.ACACIA_TRAPDOOR); - public static ItemWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.item.Items.DARK_OAK_TRAPDOOR); - public static ItemWrapper CRIMSON_TRAPDOOR = of(net.minecraft.item.Items.CRIMSON_TRAPDOOR); - public static ItemWrapper WARPED_TRAPDOOR = of(net.minecraft.item.Items.WARPED_TRAPDOOR); - public static ItemWrapper INFESTED_STONE = of(net.minecraft.item.Items.INFESTED_STONE); - public static ItemWrapper INFESTED_COBBLESTONE = of(net.minecraft.item.Items.INFESTED_COBBLESTONE); - public static ItemWrapper INFESTED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_STONE_BRICKS); - public static ItemWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_MOSSY_STONE_BRICKS); - public static ItemWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CRACKED_STONE_BRICKS); - public static ItemWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.INFESTED_CHISELED_STONE_BRICKS); - public static ItemWrapper STONE_BRICKS = of(net.minecraft.item.Items.STONE_BRICKS); - public static ItemWrapper MOSSY_STONE_BRICKS = of(net.minecraft.item.Items.MOSSY_STONE_BRICKS); - public static ItemWrapper CRACKED_STONE_BRICKS = of(net.minecraft.item.Items.CRACKED_STONE_BRICKS); - public static ItemWrapper CHISELED_STONE_BRICKS = of(net.minecraft.item.Items.CHISELED_STONE_BRICKS); - public static ItemWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.item.Items.BROWN_MUSHROOM_BLOCK); - public static ItemWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.item.Items.RED_MUSHROOM_BLOCK); - public static ItemWrapper MUSHROOM_STEM = of(net.minecraft.item.Items.MUSHROOM_STEM); - public static ItemWrapper IRON_BARS = of(net.minecraft.item.Items.IRON_BARS); - public static ItemWrapper CHAIN = of(net.minecraft.item.Items.IRON_CHAIN); - public static ItemWrapper GLASS_PANE = of(net.minecraft.item.Items.GLASS_PANE); - public static ItemWrapper MELON = of(net.minecraft.item.Items.MELON); - public static ItemWrapper VINE = of(net.minecraft.item.Items.VINE); - public static ItemWrapper OAK_FENCE_GATE = of(net.minecraft.item.Items.OAK_FENCE_GATE); - public static ItemWrapper SPRUCE_FENCE_GATE = of(net.minecraft.item.Items.SPRUCE_FENCE_GATE); - public static ItemWrapper BIRCH_FENCE_GATE = of(net.minecraft.item.Items.BIRCH_FENCE_GATE); - public static ItemWrapper JUNGLE_FENCE_GATE = of(net.minecraft.item.Items.JUNGLE_FENCE_GATE); - public static ItemWrapper ACACIA_FENCE_GATE = of(net.minecraft.item.Items.ACACIA_FENCE_GATE); - public static ItemWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.item.Items.DARK_OAK_FENCE_GATE); - public static ItemWrapper CRIMSON_FENCE_GATE = of(net.minecraft.item.Items.CRIMSON_FENCE_GATE); - public static ItemWrapper WARPED_FENCE_GATE = of(net.minecraft.item.Items.WARPED_FENCE_GATE); - public static ItemWrapper BRICK_STAIRS = of(net.minecraft.item.Items.BRICK_STAIRS); - public static ItemWrapper STONE_BRICK_STAIRS = of(net.minecraft.item.Items.STONE_BRICK_STAIRS); - public static ItemWrapper MYCELIUM = of(net.minecraft.item.Items.MYCELIUM); - public static ItemWrapper LILY_PAD = of(net.minecraft.item.Items.LILY_PAD); - public static ItemWrapper NETHER_BRICKS = of(net.minecraft.item.Items.NETHER_BRICKS); - public static ItemWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.item.Items.CRACKED_NETHER_BRICKS); - public static ItemWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.item.Items.CHISELED_NETHER_BRICKS); - public static ItemWrapper NETHER_BRICK_FENCE = of(net.minecraft.item.Items.NETHER_BRICK_FENCE); - public static ItemWrapper NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.NETHER_BRICK_STAIRS); - public static ItemWrapper ENCHANTING_TABLE = of(net.minecraft.item.Items.ENCHANTING_TABLE); - public static ItemWrapper END_PORTAL_FRAME = of(net.minecraft.item.Items.END_PORTAL_FRAME); - public static ItemWrapper END_STONE = of(net.minecraft.item.Items.END_STONE); - public static ItemWrapper END_STONE_BRICKS = of(net.minecraft.item.Items.END_STONE_BRICKS); - public static ItemWrapper DRAGON_EGG = of(net.minecraft.item.Items.DRAGON_EGG); - public static ItemWrapper REDSTONE_LAMP = of(net.minecraft.item.Items.REDSTONE_LAMP); - public static ItemWrapper SANDSTONE_STAIRS = of(net.minecraft.item.Items.SANDSTONE_STAIRS); - public static ItemWrapper EMERALD_ORE = of(net.minecraft.item.Items.EMERALD_ORE); - public static ItemWrapper ENDER_CHEST = of(net.minecraft.item.Items.ENDER_CHEST); - public static ItemWrapper TRIPWIRE_HOOK = of(net.minecraft.item.Items.TRIPWIRE_HOOK); - public static ItemWrapper EMERALD_BLOCK = of(net.minecraft.item.Items.EMERALD_BLOCK); - public static ItemWrapper SPRUCE_STAIRS = of(net.minecraft.item.Items.SPRUCE_STAIRS); - public static ItemWrapper BIRCH_STAIRS = of(net.minecraft.item.Items.BIRCH_STAIRS); - public static ItemWrapper JUNGLE_STAIRS = of(net.minecraft.item.Items.JUNGLE_STAIRS); - public static ItemWrapper CRIMSON_STAIRS = of(net.minecraft.item.Items.CRIMSON_STAIRS); - public static ItemWrapper WARPED_STAIRS = of(net.minecraft.item.Items.WARPED_STAIRS); - public static ItemWrapper COMMAND_BLOCK = of(net.minecraft.item.Items.COMMAND_BLOCK); - public static ItemWrapper BEACON = of(net.minecraft.item.Items.BEACON); - public static ItemWrapper COBBLESTONE_WALL = of(net.minecraft.item.Items.COBBLESTONE_WALL); - public static ItemWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_WALL); - public static ItemWrapper BRICK_WALL = of(net.minecraft.item.Items.BRICK_WALL); - public static ItemWrapper PRISMARINE_WALL = of(net.minecraft.item.Items.PRISMARINE_WALL); - public static ItemWrapper RED_SANDSTONE_WALL = of(net.minecraft.item.Items.RED_SANDSTONE_WALL); - public static ItemWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_WALL); - public static ItemWrapper GRANITE_WALL = of(net.minecraft.item.Items.GRANITE_WALL); - public static ItemWrapper STONE_BRICK_WALL = of(net.minecraft.item.Items.STONE_BRICK_WALL); - public static ItemWrapper NETHER_BRICK_WALL = of(net.minecraft.item.Items.NETHER_BRICK_WALL); - public static ItemWrapper ANDESITE_WALL = of(net.minecraft.item.Items.ANDESITE_WALL); - public static ItemWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.item.Items.RED_NETHER_BRICK_WALL); - public static ItemWrapper SANDSTONE_WALL = of(net.minecraft.item.Items.SANDSTONE_WALL); - public static ItemWrapper END_STONE_BRICK_WALL = of(net.minecraft.item.Items.END_STONE_BRICK_WALL); - public static ItemWrapper DIORITE_WALL = of(net.minecraft.item.Items.DIORITE_WALL); - public static ItemWrapper BLACKSTONE_WALL = of(net.minecraft.item.Items.BLACKSTONE_WALL); - public static ItemWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_WALL); - public static ItemWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_WALL); - public static ItemWrapper STONE_BUTTON = of(net.minecraft.item.Items.STONE_BUTTON); - public static ItemWrapper OAK_BUTTON = of(net.minecraft.item.Items.OAK_BUTTON); - public static ItemWrapper SPRUCE_BUTTON = of(net.minecraft.item.Items.SPRUCE_BUTTON); - public static ItemWrapper BIRCH_BUTTON = of(net.minecraft.item.Items.BIRCH_BUTTON); - public static ItemWrapper JUNGLE_BUTTON = of(net.minecraft.item.Items.JUNGLE_BUTTON); - public static ItemWrapper ACACIA_BUTTON = of(net.minecraft.item.Items.ACACIA_BUTTON); - public static ItemWrapper DARK_OAK_BUTTON = of(net.minecraft.item.Items.DARK_OAK_BUTTON); - public static ItemWrapper CRIMSON_BUTTON = of(net.minecraft.item.Items.CRIMSON_BUTTON); - public static ItemWrapper WARPED_BUTTON = of(net.minecraft.item.Items.WARPED_BUTTON); - public static ItemWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BUTTON); - public static ItemWrapper ANVIL = of(net.minecraft.item.Items.ANVIL); - public static ItemWrapper CHIPPED_ANVIL = of(net.minecraft.item.Items.CHIPPED_ANVIL); - public static ItemWrapper DAMAGED_ANVIL = of(net.minecraft.item.Items.DAMAGED_ANVIL); - public static ItemWrapper TRAPPED_CHEST = of(net.minecraft.item.Items.TRAPPED_CHEST); - public static ItemWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.LIGHT_WEIGHTED_PRESSURE_PLATE); - public static ItemWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.item.Items.HEAVY_WEIGHTED_PRESSURE_PLATE); - public static ItemWrapper DAYLIGHT_DETECTOR = of(net.minecraft.item.Items.DAYLIGHT_DETECTOR); - public static ItemWrapper REDSTONE_BLOCK = of(net.minecraft.item.Items.REDSTONE_BLOCK); - public static ItemWrapper NETHER_QUARTZ_ORE = of(net.minecraft.item.Items.NETHER_QUARTZ_ORE); - public static ItemWrapper HOPPER = of(net.minecraft.item.Items.HOPPER); - public static ItemWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.item.Items.CHISELED_QUARTZ_BLOCK); - public static ItemWrapper QUARTZ_BLOCK = of(net.minecraft.item.Items.QUARTZ_BLOCK); - public static ItemWrapper QUARTZ_BRICKS = of(net.minecraft.item.Items.QUARTZ_BRICKS); - public static ItemWrapper QUARTZ_PILLAR = of(net.minecraft.item.Items.QUARTZ_PILLAR); - public static ItemWrapper QUARTZ_STAIRS = of(net.minecraft.item.Items.QUARTZ_STAIRS); - public static ItemWrapper ACTIVATOR_RAIL = of(net.minecraft.item.Items.ACTIVATOR_RAIL); - public static ItemWrapper DROPPER = of(net.minecraft.item.Items.DROPPER); - public static ItemWrapper WHITE_TERRACOTTA = of(net.minecraft.item.Items.WHITE_TERRACOTTA); - public static ItemWrapper ORANGE_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_TERRACOTTA); - public static ItemWrapper MAGENTA_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_TERRACOTTA); - public static ItemWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_TERRACOTTA); - public static ItemWrapper YELLOW_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_TERRACOTTA); - public static ItemWrapper LIME_TERRACOTTA = of(net.minecraft.item.Items.LIME_TERRACOTTA); - public static ItemWrapper PINK_TERRACOTTA = of(net.minecraft.item.Items.PINK_TERRACOTTA); - public static ItemWrapper GRAY_TERRACOTTA = of(net.minecraft.item.Items.GRAY_TERRACOTTA); - public static ItemWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_TERRACOTTA); - public static ItemWrapper CYAN_TERRACOTTA = of(net.minecraft.item.Items.CYAN_TERRACOTTA); - public static ItemWrapper PURPLE_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_TERRACOTTA); - public static ItemWrapper BLUE_TERRACOTTA = of(net.minecraft.item.Items.BLUE_TERRACOTTA); - public static ItemWrapper BROWN_TERRACOTTA = of(net.minecraft.item.Items.BROWN_TERRACOTTA); - public static ItemWrapper GREEN_TERRACOTTA = of(net.minecraft.item.Items.GREEN_TERRACOTTA); - public static ItemWrapper RED_TERRACOTTA = of(net.minecraft.item.Items.RED_TERRACOTTA); - public static ItemWrapper BLACK_TERRACOTTA = of(net.minecraft.item.Items.BLACK_TERRACOTTA); - public static ItemWrapper BARRIER = of(net.minecraft.item.Items.BARRIER); - public static ItemWrapper IRON_TRAPDOOR = of(net.minecraft.item.Items.IRON_TRAPDOOR); - public static ItemWrapper HAY_BLOCK = of(net.minecraft.item.Items.HAY_BLOCK); - public static ItemWrapper WHITE_CARPET = of(net.minecraft.item.Items.WHITE_CARPET); - public static ItemWrapper ORANGE_CARPET = of(net.minecraft.item.Items.ORANGE_CARPET); - public static ItemWrapper MAGENTA_CARPET = of(net.minecraft.item.Items.MAGENTA_CARPET); - public static ItemWrapper LIGHT_BLUE_CARPET = of(net.minecraft.item.Items.LIGHT_BLUE_CARPET); - public static ItemWrapper YELLOW_CARPET = of(net.minecraft.item.Items.YELLOW_CARPET); - public static ItemWrapper LIME_CARPET = of(net.minecraft.item.Items.LIME_CARPET); - public static ItemWrapper PINK_CARPET = of(net.minecraft.item.Items.PINK_CARPET); - public static ItemWrapper GRAY_CARPET = of(net.minecraft.item.Items.GRAY_CARPET); - public static ItemWrapper LIGHT_GRAY_CARPET = of(net.minecraft.item.Items.LIGHT_GRAY_CARPET); - public static ItemWrapper CYAN_CARPET = of(net.minecraft.item.Items.CYAN_CARPET); - public static ItemWrapper PURPLE_CARPET = of(net.minecraft.item.Items.PURPLE_CARPET); - public static ItemWrapper BLUE_CARPET = of(net.minecraft.item.Items.BLUE_CARPET); - public static ItemWrapper BROWN_CARPET = of(net.minecraft.item.Items.BROWN_CARPET); - public static ItemWrapper GREEN_CARPET = of(net.minecraft.item.Items.GREEN_CARPET); - public static ItemWrapper RED_CARPET = of(net.minecraft.item.Items.RED_CARPET); - public static ItemWrapper BLACK_CARPET = of(net.minecraft.item.Items.BLACK_CARPET); - public static ItemWrapper TERRACOTTA = of(net.minecraft.item.Items.TERRACOTTA); - public static ItemWrapper COAL_BLOCK = of(net.minecraft.item.Items.COAL_BLOCK); - public static ItemWrapper PACKED_ICE = of(net.minecraft.item.Items.PACKED_ICE); - public static ItemWrapper ACACIA_STAIRS = of(net.minecraft.item.Items.ACACIA_STAIRS); - public static ItemWrapper DARK_OAK_STAIRS = of(net.minecraft.item.Items.DARK_OAK_STAIRS); - public static ItemWrapper SLIME_BLOCK = of(net.minecraft.item.Items.SLIME_BLOCK); - public static ItemWrapper GRASS_PATH = of(net.minecraft.item.Items.DIRT_PATH); - public static ItemWrapper SUNFLOWER = of(net.minecraft.item.Items.SUNFLOWER); - public static ItemWrapper LILAC = of(net.minecraft.item.Items.LILAC); - public static ItemWrapper ROSE_BUSH = of(net.minecraft.item.Items.ROSE_BUSH); - public static ItemWrapper PEONY = of(net.minecraft.item.Items.PEONY); - public static ItemWrapper TALL_GRASS = of(net.minecraft.item.Items.TALL_GRASS); - public static ItemWrapper LARGE_FERN = of(net.minecraft.item.Items.LARGE_FERN); - public static ItemWrapper WHITE_STAINED_GLASS = of(net.minecraft.item.Items.WHITE_STAINED_GLASS); - public static ItemWrapper ORANGE_STAINED_GLASS = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS); - public static ItemWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS); - public static ItemWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS); - public static ItemWrapper YELLOW_STAINED_GLASS = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS); - public static ItemWrapper LIME_STAINED_GLASS = of(net.minecraft.item.Items.LIME_STAINED_GLASS); - public static ItemWrapper PINK_STAINED_GLASS = of(net.minecraft.item.Items.PINK_STAINED_GLASS); - public static ItemWrapper GRAY_STAINED_GLASS = of(net.minecraft.item.Items.GRAY_STAINED_GLASS); - public static ItemWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS); - public static ItemWrapper CYAN_STAINED_GLASS = of(net.minecraft.item.Items.CYAN_STAINED_GLASS); - public static ItemWrapper PURPLE_STAINED_GLASS = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS); - public static ItemWrapper BLUE_STAINED_GLASS = of(net.minecraft.item.Items.BLUE_STAINED_GLASS); - public static ItemWrapper BROWN_STAINED_GLASS = of(net.minecraft.item.Items.BROWN_STAINED_GLASS); - public static ItemWrapper GREEN_STAINED_GLASS = of(net.minecraft.item.Items.GREEN_STAINED_GLASS); - public static ItemWrapper RED_STAINED_GLASS = of(net.minecraft.item.Items.RED_STAINED_GLASS); - public static ItemWrapper BLACK_STAINED_GLASS = of(net.minecraft.item.Items.BLACK_STAINED_GLASS); - public static ItemWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.WHITE_STAINED_GLASS_PANE); - public static ItemWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.ORANGE_STAINED_GLASS_PANE); - public static ItemWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.item.Items.MAGENTA_STAINED_GLASS_PANE); - public static ItemWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_BLUE_STAINED_GLASS_PANE); - public static ItemWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.item.Items.YELLOW_STAINED_GLASS_PANE); - public static ItemWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIME_STAINED_GLASS_PANE); - public static ItemWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PINK_STAINED_GLASS_PANE); - public static ItemWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GRAY_STAINED_GLASS_PANE); - public static ItemWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.item.Items.LIGHT_GRAY_STAINED_GLASS_PANE); - public static ItemWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.CYAN_STAINED_GLASS_PANE); - public static ItemWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.PURPLE_STAINED_GLASS_PANE); - public static ItemWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLUE_STAINED_GLASS_PANE); - public static ItemWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BROWN_STAINED_GLASS_PANE); - public static ItemWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.item.Items.GREEN_STAINED_GLASS_PANE); - public static ItemWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.item.Items.RED_STAINED_GLASS_PANE); - public static ItemWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.item.Items.BLACK_STAINED_GLASS_PANE); - public static ItemWrapper PRISMARINE = of(net.minecraft.item.Items.PRISMARINE); - public static ItemWrapper PRISMARINE_BRICKS = of(net.minecraft.item.Items.PRISMARINE_BRICKS); - public static ItemWrapper DARK_PRISMARINE = of(net.minecraft.item.Items.DARK_PRISMARINE); - public static ItemWrapper PRISMARINE_STAIRS = of(net.minecraft.item.Items.PRISMARINE_STAIRS); - public static ItemWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.item.Items.PRISMARINE_BRICK_STAIRS); - public static ItemWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.item.Items.DARK_PRISMARINE_STAIRS); - public static ItemWrapper SEA_LANTERN = of(net.minecraft.item.Items.SEA_LANTERN); - public static ItemWrapper RED_SANDSTONE = of(net.minecraft.item.Items.RED_SANDSTONE); - public static ItemWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.item.Items.CHISELED_RED_SANDSTONE); - public static ItemWrapper CUT_RED_SANDSTONE = of(net.minecraft.item.Items.CUT_RED_SANDSTONE); - public static ItemWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.RED_SANDSTONE_STAIRS); - public static ItemWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.item.Items.REPEATING_COMMAND_BLOCK); - public static ItemWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.item.Items.CHAIN_COMMAND_BLOCK); - public static ItemWrapper MAGMA_BLOCK = of(net.minecraft.item.Items.MAGMA_BLOCK); - public static ItemWrapper NETHER_WART_BLOCK = of(net.minecraft.item.Items.NETHER_WART_BLOCK); - public static ItemWrapper WARPED_WART_BLOCK = of(net.minecraft.item.Items.WARPED_WART_BLOCK); - public static ItemWrapper RED_NETHER_BRICKS = of(net.minecraft.item.Items.RED_NETHER_BRICKS); - public static ItemWrapper BONE_BLOCK = of(net.minecraft.item.Items.BONE_BLOCK); - public static ItemWrapper STRUCTURE_VOID = of(net.minecraft.item.Items.STRUCTURE_VOID); - public static ItemWrapper OBSERVER = of(net.minecraft.item.Items.OBSERVER); - public static ItemWrapper SHULKER_BOX = of(net.minecraft.item.Items.SHULKER_BOX); - public static ItemWrapper WHITE_SHULKER_BOX = of(net.minecraft.item.Items.WHITE_SHULKER_BOX); - public static ItemWrapper ORANGE_SHULKER_BOX = of(net.minecraft.item.Items.ORANGE_SHULKER_BOX); - public static ItemWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.item.Items.MAGENTA_SHULKER_BOX); - public static ItemWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_BLUE_SHULKER_BOX); - public static ItemWrapper YELLOW_SHULKER_BOX = of(net.minecraft.item.Items.YELLOW_SHULKER_BOX); - public static ItemWrapper LIME_SHULKER_BOX = of(net.minecraft.item.Items.LIME_SHULKER_BOX); - public static ItemWrapper PINK_SHULKER_BOX = of(net.minecraft.item.Items.PINK_SHULKER_BOX); - public static ItemWrapper GRAY_SHULKER_BOX = of(net.minecraft.item.Items.GRAY_SHULKER_BOX); - public static ItemWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.item.Items.LIGHT_GRAY_SHULKER_BOX); - public static ItemWrapper CYAN_SHULKER_BOX = of(net.minecraft.item.Items.CYAN_SHULKER_BOX); - public static ItemWrapper PURPLE_SHULKER_BOX = of(net.minecraft.item.Items.PURPLE_SHULKER_BOX); - public static ItemWrapper BLUE_SHULKER_BOX = of(net.minecraft.item.Items.BLUE_SHULKER_BOX); - public static ItemWrapper BROWN_SHULKER_BOX = of(net.minecraft.item.Items.BROWN_SHULKER_BOX); - public static ItemWrapper GREEN_SHULKER_BOX = of(net.minecraft.item.Items.GREEN_SHULKER_BOX); - public static ItemWrapper RED_SHULKER_BOX = of(net.minecraft.item.Items.RED_SHULKER_BOX); - public static ItemWrapper BLACK_SHULKER_BOX = of(net.minecraft.item.Items.BLACK_SHULKER_BOX); - public static ItemWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.WHITE_GLAZED_TERRACOTTA); - public static ItemWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.ORANGE_GLAZED_TERRACOTTA); - public static ItemWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.MAGENTA_GLAZED_TERRACOTTA); - public static ItemWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_BLUE_GLAZED_TERRACOTTA); - public static ItemWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.YELLOW_GLAZED_TERRACOTTA); - public static ItemWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIME_GLAZED_TERRACOTTA); - public static ItemWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PINK_GLAZED_TERRACOTTA); - public static ItemWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GRAY_GLAZED_TERRACOTTA); - public static ItemWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.LIGHT_GRAY_GLAZED_TERRACOTTA); - public static ItemWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.CYAN_GLAZED_TERRACOTTA); - public static ItemWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.PURPLE_GLAZED_TERRACOTTA); - public static ItemWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLUE_GLAZED_TERRACOTTA); - public static ItemWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BROWN_GLAZED_TERRACOTTA); - public static ItemWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.GREEN_GLAZED_TERRACOTTA); - public static ItemWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.RED_GLAZED_TERRACOTTA); - public static ItemWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.item.Items.BLACK_GLAZED_TERRACOTTA); - public static ItemWrapper WHITE_CONCRETE = of(net.minecraft.item.Items.WHITE_CONCRETE); - public static ItemWrapper ORANGE_CONCRETE = of(net.minecraft.item.Items.ORANGE_CONCRETE); - public static ItemWrapper MAGENTA_CONCRETE = of(net.minecraft.item.Items.MAGENTA_CONCRETE); - public static ItemWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE); - public static ItemWrapper YELLOW_CONCRETE = of(net.minecraft.item.Items.YELLOW_CONCRETE); - public static ItemWrapper LIME_CONCRETE = of(net.minecraft.item.Items.LIME_CONCRETE); - public static ItemWrapper PINK_CONCRETE = of(net.minecraft.item.Items.PINK_CONCRETE); - public static ItemWrapper GRAY_CONCRETE = of(net.minecraft.item.Items.GRAY_CONCRETE); - public static ItemWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE); - public static ItemWrapper CYAN_CONCRETE = of(net.minecraft.item.Items.CYAN_CONCRETE); - public static ItemWrapper PURPLE_CONCRETE = of(net.minecraft.item.Items.PURPLE_CONCRETE); - public static ItemWrapper BLUE_CONCRETE = of(net.minecraft.item.Items.BLUE_CONCRETE); - public static ItemWrapper BROWN_CONCRETE = of(net.minecraft.item.Items.BROWN_CONCRETE); - public static ItemWrapper GREEN_CONCRETE = of(net.minecraft.item.Items.GREEN_CONCRETE); - public static ItemWrapper RED_CONCRETE = of(net.minecraft.item.Items.RED_CONCRETE); - public static ItemWrapper BLACK_CONCRETE = of(net.minecraft.item.Items.BLACK_CONCRETE); - public static ItemWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.item.Items.WHITE_CONCRETE_POWDER); - public static ItemWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.item.Items.ORANGE_CONCRETE_POWDER); - public static ItemWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.item.Items.MAGENTA_CONCRETE_POWDER); - public static ItemWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_BLUE_CONCRETE_POWDER); - public static ItemWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.item.Items.YELLOW_CONCRETE_POWDER); - public static ItemWrapper LIME_CONCRETE_POWDER = of(net.minecraft.item.Items.LIME_CONCRETE_POWDER); - public static ItemWrapper PINK_CONCRETE_POWDER = of(net.minecraft.item.Items.PINK_CONCRETE_POWDER); - public static ItemWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.GRAY_CONCRETE_POWDER); - public static ItemWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.item.Items.LIGHT_GRAY_CONCRETE_POWDER); - public static ItemWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.item.Items.CYAN_CONCRETE_POWDER); - public static ItemWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.item.Items.PURPLE_CONCRETE_POWDER); - public static ItemWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.item.Items.BLUE_CONCRETE_POWDER); - public static ItemWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.item.Items.BROWN_CONCRETE_POWDER); - public static ItemWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.item.Items.GREEN_CONCRETE_POWDER); - public static ItemWrapper RED_CONCRETE_POWDER = of(net.minecraft.item.Items.RED_CONCRETE_POWDER); - public static ItemWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.item.Items.BLACK_CONCRETE_POWDER); - public static ItemWrapper TURTLE_EGG = of(net.minecraft.item.Items.TURTLE_EGG); - public static ItemWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_BLOCK); - public static ItemWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_BLOCK); - public static ItemWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_BLOCK); - public static ItemWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_BLOCK); - public static ItemWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.item.Items.DEAD_HORN_CORAL_BLOCK); - public static ItemWrapper TUBE_CORAL_BLOCK = of(net.minecraft.item.Items.TUBE_CORAL_BLOCK); - public static ItemWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.item.Items.BRAIN_CORAL_BLOCK); - public static ItemWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.item.Items.BUBBLE_CORAL_BLOCK); - public static ItemWrapper FIRE_CORAL_BLOCK = of(net.minecraft.item.Items.FIRE_CORAL_BLOCK); - public static ItemWrapper HORN_CORAL_BLOCK = of(net.minecraft.item.Items.HORN_CORAL_BLOCK); - public static ItemWrapper TUBE_CORAL = of(net.minecraft.item.Items.TUBE_CORAL); - public static ItemWrapper BRAIN_CORAL = of(net.minecraft.item.Items.BRAIN_CORAL); - public static ItemWrapper BUBBLE_CORAL = of(net.minecraft.item.Items.BUBBLE_CORAL); - public static ItemWrapper FIRE_CORAL = of(net.minecraft.item.Items.FIRE_CORAL); - public static ItemWrapper HORN_CORAL = of(net.minecraft.item.Items.HORN_CORAL); - public static ItemWrapper DEAD_BRAIN_CORAL = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL); - public static ItemWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL); - public static ItemWrapper DEAD_FIRE_CORAL = of(net.minecraft.item.Items.DEAD_FIRE_CORAL); - public static ItemWrapper DEAD_HORN_CORAL = of(net.minecraft.item.Items.DEAD_HORN_CORAL); - public static ItemWrapper DEAD_TUBE_CORAL = of(net.minecraft.item.Items.DEAD_TUBE_CORAL); - public static ItemWrapper TUBE_CORAL_FAN = of(net.minecraft.item.Items.TUBE_CORAL_FAN); - public static ItemWrapper BRAIN_CORAL_FAN = of(net.minecraft.item.Items.BRAIN_CORAL_FAN); - public static ItemWrapper BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.BUBBLE_CORAL_FAN); - public static ItemWrapper FIRE_CORAL_FAN = of(net.minecraft.item.Items.FIRE_CORAL_FAN); - public static ItemWrapper HORN_CORAL_FAN = of(net.minecraft.item.Items.HORN_CORAL_FAN); - public static ItemWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_TUBE_CORAL_FAN); - public static ItemWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BRAIN_CORAL_FAN); - public static ItemWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_BUBBLE_CORAL_FAN); - public static ItemWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.item.Items.DEAD_FIRE_CORAL_FAN); - public static ItemWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.item.Items.DEAD_HORN_CORAL_FAN); - public static ItemWrapper BLUE_ICE = of(net.minecraft.item.Items.BLUE_ICE); - public static ItemWrapper CONDUIT = of(net.minecraft.item.Items.CONDUIT); - public static ItemWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.item.Items.POLISHED_GRANITE_STAIRS); - public static ItemWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_STAIRS); - public static ItemWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_STAIRS); - public static ItemWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.item.Items.POLISHED_DIORITE_STAIRS); - public static ItemWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_STAIRS); - public static ItemWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.item.Items.END_STONE_BRICK_STAIRS); - public static ItemWrapper STONE_STAIRS = of(net.minecraft.item.Items.STONE_STAIRS); - public static ItemWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_STAIRS); - public static ItemWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.item.Items.SMOOTH_QUARTZ_STAIRS); - public static ItemWrapper GRANITE_STAIRS = of(net.minecraft.item.Items.GRANITE_STAIRS); - public static ItemWrapper ANDESITE_STAIRS = of(net.minecraft.item.Items.ANDESITE_STAIRS); - public static ItemWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.item.Items.RED_NETHER_BRICK_STAIRS); - public static ItemWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.item.Items.POLISHED_ANDESITE_STAIRS); - public static ItemWrapper DIORITE_STAIRS = of(net.minecraft.item.Items.DIORITE_STAIRS); - public static ItemWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.item.Items.POLISHED_GRANITE_SLAB); - public static ItemWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_RED_SANDSTONE_SLAB); - public static ItemWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.item.Items.MOSSY_STONE_BRICK_SLAB); - public static ItemWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.item.Items.POLISHED_DIORITE_SLAB); - public static ItemWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.item.Items.MOSSY_COBBLESTONE_SLAB); - public static ItemWrapper END_STONE_BRICK_SLAB = of(net.minecraft.item.Items.END_STONE_BRICK_SLAB); - public static ItemWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.item.Items.SMOOTH_SANDSTONE_SLAB); - public static ItemWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.item.Items.SMOOTH_QUARTZ_SLAB); - public static ItemWrapper GRANITE_SLAB = of(net.minecraft.item.Items.GRANITE_SLAB); - public static ItemWrapper ANDESITE_SLAB = of(net.minecraft.item.Items.ANDESITE_SLAB); - public static ItemWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.item.Items.RED_NETHER_BRICK_SLAB); - public static ItemWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.item.Items.POLISHED_ANDESITE_SLAB); - public static ItemWrapper DIORITE_SLAB = of(net.minecraft.item.Items.DIORITE_SLAB); - public static ItemWrapper SCAFFOLDING = of(net.minecraft.item.Items.SCAFFOLDING); - public static ItemWrapper IRON_DOOR = of(net.minecraft.item.Items.IRON_DOOR); - public static ItemWrapper OAK_DOOR = of(net.minecraft.item.Items.OAK_DOOR); - public static ItemWrapper SPRUCE_DOOR = of(net.minecraft.item.Items.SPRUCE_DOOR); - public static ItemWrapper BIRCH_DOOR = of(net.minecraft.item.Items.BIRCH_DOOR); - public static ItemWrapper JUNGLE_DOOR = of(net.minecraft.item.Items.JUNGLE_DOOR); - public static ItemWrapper ACACIA_DOOR = of(net.minecraft.item.Items.ACACIA_DOOR); - public static ItemWrapper DARK_OAK_DOOR = of(net.minecraft.item.Items.DARK_OAK_DOOR); - public static ItemWrapper CRIMSON_DOOR = of(net.minecraft.item.Items.CRIMSON_DOOR); - public static ItemWrapper WARPED_DOOR = of(net.minecraft.item.Items.WARPED_DOOR); - public static ItemWrapper REPEATER = of(net.minecraft.item.Items.REPEATER); - public static ItemWrapper COMPARATOR = of(net.minecraft.item.Items.COMPARATOR); - public static ItemWrapper STRUCTURE_BLOCK = of(net.minecraft.item.Items.STRUCTURE_BLOCK); - public static ItemWrapper JIGSAW = of(net.minecraft.item.Items.JIGSAW); - public static ItemWrapper TURTLE_HELMET = of(net.minecraft.item.Items.TURTLE_HELMET); - public static ItemWrapper SCUTE = of(net.minecraft.item.Items.TURTLE_SCUTE); - public static ItemWrapper FLINT_AND_STEEL = of(net.minecraft.item.Items.FLINT_AND_STEEL); - public static ItemWrapper APPLE = of(net.minecraft.item.Items.APPLE); - public static ItemWrapper BOW = of(net.minecraft.item.Items.BOW); - public static ItemWrapper ARROW = of(net.minecraft.item.Items.ARROW); - public static ItemWrapper COAL = of(net.minecraft.item.Items.COAL); - public static ItemWrapper CHARCOAL = of(net.minecraft.item.Items.CHARCOAL); - public static ItemWrapper DIAMOND = of(net.minecraft.item.Items.DIAMOND); - public static ItemWrapper IRON_INGOT = of(net.minecraft.item.Items.IRON_INGOT); - public static ItemWrapper GOLD_INGOT = of(net.minecraft.item.Items.GOLD_INGOT); - public static ItemWrapper NETHERITE_INGOT = of(net.minecraft.item.Items.NETHERITE_INGOT); - public static ItemWrapper NETHERITE_SCRAP = of(net.minecraft.item.Items.NETHERITE_SCRAP); - public static ItemWrapper WOODEN_SWORD = of(net.minecraft.item.Items.WOODEN_SWORD); - public static ItemWrapper WOODEN_SHOVEL = of(net.minecraft.item.Items.WOODEN_SHOVEL); - public static ItemWrapper WOODEN_PICKAXE = of(net.minecraft.item.Items.WOODEN_PICKAXE); - public static ItemWrapper WOODEN_AXE = of(net.minecraft.item.Items.WOODEN_AXE); - public static ItemWrapper WOODEN_HOE = of(net.minecraft.item.Items.WOODEN_HOE); - public static ItemWrapper STONE_SWORD = of(net.minecraft.item.Items.STONE_SWORD); - public static ItemWrapper STONE_SHOVEL = of(net.minecraft.item.Items.STONE_SHOVEL); - public static ItemWrapper STONE_PICKAXE = of(net.minecraft.item.Items.STONE_PICKAXE); - public static ItemWrapper STONE_AXE = of(net.minecraft.item.Items.STONE_AXE); - public static ItemWrapper STONE_HOE = of(net.minecraft.item.Items.STONE_HOE); - public static ItemWrapper GOLDEN_SWORD = of(net.minecraft.item.Items.GOLDEN_SWORD); - public static ItemWrapper GOLDEN_SHOVEL = of(net.minecraft.item.Items.GOLDEN_SHOVEL); - public static ItemWrapper GOLDEN_PICKAXE = of(net.minecraft.item.Items.GOLDEN_PICKAXE); - public static ItemWrapper GOLDEN_AXE = of(net.minecraft.item.Items.GOLDEN_AXE); - public static ItemWrapper GOLDEN_HOE = of(net.minecraft.item.Items.GOLDEN_HOE); - public static ItemWrapper IRON_SWORD = of(net.minecraft.item.Items.IRON_SWORD); - public static ItemWrapper IRON_SHOVEL = of(net.minecraft.item.Items.IRON_SHOVEL); - public static ItemWrapper IRON_PICKAXE = of(net.minecraft.item.Items.IRON_PICKAXE); - public static ItemWrapper IRON_AXE = of(net.minecraft.item.Items.IRON_AXE); - public static ItemWrapper IRON_HOE = of(net.minecraft.item.Items.IRON_HOE); - public static ItemWrapper DIAMOND_SWORD = of(net.minecraft.item.Items.DIAMOND_SWORD); - public static ItemWrapper DIAMOND_SHOVEL = of(net.minecraft.item.Items.DIAMOND_SHOVEL); - public static ItemWrapper DIAMOND_PICKAXE = of(net.minecraft.item.Items.DIAMOND_PICKAXE); - public static ItemWrapper DIAMOND_AXE = of(net.minecraft.item.Items.DIAMOND_AXE); - public static ItemWrapper DIAMOND_HOE = of(net.minecraft.item.Items.DIAMOND_HOE); - public static ItemWrapper NETHERITE_SWORD = of(net.minecraft.item.Items.NETHERITE_SWORD); - public static ItemWrapper NETHERITE_SHOVEL = of(net.minecraft.item.Items.NETHERITE_SHOVEL); - public static ItemWrapper NETHERITE_PICKAXE = of(net.minecraft.item.Items.NETHERITE_PICKAXE); - public static ItemWrapper NETHERITE_AXE = of(net.minecraft.item.Items.NETHERITE_AXE); - public static ItemWrapper NETHERITE_HOE = of(net.minecraft.item.Items.NETHERITE_HOE); - public static ItemWrapper STICK = of(net.minecraft.item.Items.STICK); - public static ItemWrapper BOWL = of(net.minecraft.item.Items.BOWL); - public static ItemWrapper MUSHROOM_STEW = of(net.minecraft.item.Items.MUSHROOM_STEW); - public static ItemWrapper STRING = of(net.minecraft.item.Items.STRING); - public static ItemWrapper FEATHER = of(net.minecraft.item.Items.FEATHER); - public static ItemWrapper GUNPOWDER = of(net.minecraft.item.Items.GUNPOWDER); - public static ItemWrapper WHEAT_SEEDS = of(net.minecraft.item.Items.WHEAT_SEEDS); - public static ItemWrapper WHEAT = of(net.minecraft.item.Items.WHEAT); - public static ItemWrapper BREAD = of(net.minecraft.item.Items.BREAD); - public static ItemWrapper LEATHER_HELMET = of(net.minecraft.item.Items.LEATHER_HELMET); - public static ItemWrapper LEATHER_CHESTPLATE = of(net.minecraft.item.Items.LEATHER_CHESTPLATE); - public static ItemWrapper LEATHER_LEGGINGS = of(net.minecraft.item.Items.LEATHER_LEGGINGS); - public static ItemWrapper LEATHER_BOOTS = of(net.minecraft.item.Items.LEATHER_BOOTS); - public static ItemWrapper CHAINMAIL_HELMET = of(net.minecraft.item.Items.CHAINMAIL_HELMET); - public static ItemWrapper CHAINMAIL_CHESTPLATE = of(net.minecraft.item.Items.CHAINMAIL_CHESTPLATE); - public static ItemWrapper CHAINMAIL_LEGGINGS = of(net.minecraft.item.Items.CHAINMAIL_LEGGINGS); - public static ItemWrapper CHAINMAIL_BOOTS = of(net.minecraft.item.Items.CHAINMAIL_BOOTS); - public static ItemWrapper IRON_HELMET = of(net.minecraft.item.Items.IRON_HELMET); - public static ItemWrapper IRON_CHESTPLATE = of(net.minecraft.item.Items.IRON_CHESTPLATE); - public static ItemWrapper IRON_LEGGINGS = of(net.minecraft.item.Items.IRON_LEGGINGS); - public static ItemWrapper IRON_BOOTS = of(net.minecraft.item.Items.IRON_BOOTS); - public static ItemWrapper DIAMOND_HELMET = of(net.minecraft.item.Items.DIAMOND_HELMET); - public static ItemWrapper DIAMOND_CHESTPLATE = of(net.minecraft.item.Items.DIAMOND_CHESTPLATE); - public static ItemWrapper DIAMOND_LEGGINGS = of(net.minecraft.item.Items.DIAMOND_LEGGINGS); - public static ItemWrapper DIAMOND_BOOTS = of(net.minecraft.item.Items.DIAMOND_BOOTS); - public static ItemWrapper GOLDEN_HELMET = of(net.minecraft.item.Items.GOLDEN_HELMET); - public static ItemWrapper GOLDEN_CHESTPLATE = of(net.minecraft.item.Items.GOLDEN_CHESTPLATE); - public static ItemWrapper GOLDEN_LEGGINGS = of(net.minecraft.item.Items.GOLDEN_LEGGINGS); - public static ItemWrapper GOLDEN_BOOTS = of(net.minecraft.item.Items.GOLDEN_BOOTS); - public static ItemWrapper NETHERITE_HELMET = of(net.minecraft.item.Items.NETHERITE_HELMET); - public static ItemWrapper NETHERITE_CHESTPLATE = of(net.minecraft.item.Items.NETHERITE_CHESTPLATE); - public static ItemWrapper NETHERITE_LEGGINGS = of(net.minecraft.item.Items.NETHERITE_LEGGINGS); - public static ItemWrapper NETHERITE_BOOTS = of(net.minecraft.item.Items.NETHERITE_BOOTS); - public static ItemWrapper FLINT = of(net.minecraft.item.Items.FLINT); - public static ItemWrapper PORKCHOP = of(net.minecraft.item.Items.PORKCHOP); - public static ItemWrapper COOKED_PORKCHOP = of(net.minecraft.item.Items.COOKED_PORKCHOP); - public static ItemWrapper PAINTING = of(net.minecraft.item.Items.PAINTING); - public static ItemWrapper GOLDEN_APPLE = of(net.minecraft.item.Items.GOLDEN_APPLE); - public static ItemWrapper ENCHANTED_GOLDEN_APPLE = of(net.minecraft.item.Items.ENCHANTED_GOLDEN_APPLE); - public static ItemWrapper OAK_SIGN = of(net.minecraft.item.Items.OAK_SIGN); - public static ItemWrapper SPRUCE_SIGN = of(net.minecraft.item.Items.SPRUCE_SIGN); - public static ItemWrapper BIRCH_SIGN = of(net.minecraft.item.Items.BIRCH_SIGN); - public static ItemWrapper JUNGLE_SIGN = of(net.minecraft.item.Items.JUNGLE_SIGN); - public static ItemWrapper ACACIA_SIGN = of(net.minecraft.item.Items.ACACIA_SIGN); - public static ItemWrapper DARK_OAK_SIGN = of(net.minecraft.item.Items.DARK_OAK_SIGN); - public static ItemWrapper CRIMSON_SIGN = of(net.minecraft.item.Items.CRIMSON_SIGN); - public static ItemWrapper WARPED_SIGN = of(net.minecraft.item.Items.WARPED_SIGN); - public static ItemWrapper BUCKET = of(net.minecraft.item.Items.BUCKET); - public static ItemWrapper WATER_BUCKET = of(net.minecraft.item.Items.WATER_BUCKET); - public static ItemWrapper LAVA_BUCKET = of(net.minecraft.item.Items.LAVA_BUCKET); - public static ItemWrapper MINECART = of(net.minecraft.item.Items.MINECART); - public static ItemWrapper SADDLE = of(net.minecraft.item.Items.SADDLE); - public static ItemWrapper REDSTONE = of(net.minecraft.item.Items.REDSTONE); - public static ItemWrapper SNOWBALL = of(net.minecraft.item.Items.SNOWBALL); - public static ItemWrapper OAK_BOAT = of(net.minecraft.item.Items.OAK_BOAT); - public static ItemWrapper LEATHER = of(net.minecraft.item.Items.LEATHER); - public static ItemWrapper MILK_BUCKET = of(net.minecraft.item.Items.MILK_BUCKET); - public static ItemWrapper PUFFERFISH_BUCKET = of(net.minecraft.item.Items.PUFFERFISH_BUCKET); - public static ItemWrapper SALMON_BUCKET = of(net.minecraft.item.Items.SALMON_BUCKET); - public static ItemWrapper COD_BUCKET = of(net.minecraft.item.Items.COD_BUCKET); - public static ItemWrapper TROPICAL_FISH_BUCKET = of(net.minecraft.item.Items.TROPICAL_FISH_BUCKET); - public static ItemWrapper BRICK = of(net.minecraft.item.Items.BRICK); - public static ItemWrapper CLAY_BALL = of(net.minecraft.item.Items.CLAY_BALL); - public static ItemWrapper DRIED_KELP_BLOCK = of(net.minecraft.item.Items.DRIED_KELP_BLOCK); - public static ItemWrapper PAPER = of(net.minecraft.item.Items.PAPER); - public static ItemWrapper BOOK = of(net.minecraft.item.Items.BOOK); - public static ItemWrapper SLIME_BALL = of(net.minecraft.item.Items.SLIME_BALL); - public static ItemWrapper CHEST_MINECART = of(net.minecraft.item.Items.CHEST_MINECART); - public static ItemWrapper FURNACE_MINECART = of(net.minecraft.item.Items.FURNACE_MINECART); - public static ItemWrapper EGG = of(net.minecraft.item.Items.EGG); - public static ItemWrapper COMPASS = of(net.minecraft.item.Items.COMPASS); - public static ItemWrapper FISHING_ROD = of(net.minecraft.item.Items.FISHING_ROD); - public static ItemWrapper CLOCK = of(net.minecraft.item.Items.CLOCK); - public static ItemWrapper GLOWSTONE_DUST = of(net.minecraft.item.Items.GLOWSTONE_DUST); - public static ItemWrapper COD = of(net.minecraft.item.Items.COD); - public static ItemWrapper SALMON = of(net.minecraft.item.Items.SALMON); - public static ItemWrapper TROPICAL_FISH = of(net.minecraft.item.Items.TROPICAL_FISH); - public static ItemWrapper PUFFERFISH = of(net.minecraft.item.Items.PUFFERFISH); - public static ItemWrapper COOKED_COD = of(net.minecraft.item.Items.COOKED_COD); - public static ItemWrapper COOKED_SALMON = of(net.minecraft.item.Items.COOKED_SALMON); - public static ItemWrapper INK_SAC = of(net.minecraft.item.Items.INK_SAC); - public static ItemWrapper COCOA_BEANS = of(net.minecraft.item.Items.COCOA_BEANS); - public static ItemWrapper LAPIS_LAZULI = of(net.minecraft.item.Items.LAPIS_LAZULI); - public static ItemWrapper WHITE_DYE = of(net.minecraft.item.Items.WHITE_DYE); - public static ItemWrapper ORANGE_DYE = of(net.minecraft.item.Items.ORANGE_DYE); - public static ItemWrapper MAGENTA_DYE = of(net.minecraft.item.Items.MAGENTA_DYE); - public static ItemWrapper LIGHT_BLUE_DYE = of(net.minecraft.item.Items.LIGHT_BLUE_DYE); - public static ItemWrapper YELLOW_DYE = of(net.minecraft.item.Items.YELLOW_DYE); - public static ItemWrapper LIME_DYE = of(net.minecraft.item.Items.LIME_DYE); - public static ItemWrapper PINK_DYE = of(net.minecraft.item.Items.PINK_DYE); - public static ItemWrapper GRAY_DYE = of(net.minecraft.item.Items.GRAY_DYE); - public static ItemWrapper LIGHT_GRAY_DYE = of(net.minecraft.item.Items.LIGHT_GRAY_DYE); - public static ItemWrapper CYAN_DYE = of(net.minecraft.item.Items.CYAN_DYE); - public static ItemWrapper PURPLE_DYE = of(net.minecraft.item.Items.PURPLE_DYE); - public static ItemWrapper BLUE_DYE = of(net.minecraft.item.Items.BLUE_DYE); - public static ItemWrapper BROWN_DYE = of(net.minecraft.item.Items.BROWN_DYE); - public static ItemWrapper GREEN_DYE = of(net.minecraft.item.Items.GREEN_DYE); - public static ItemWrapper RED_DYE = of(net.minecraft.item.Items.RED_DYE); - public static ItemWrapper BLACK_DYE = of(net.minecraft.item.Items.BLACK_DYE); - public static ItemWrapper BONE_MEAL = of(net.minecraft.item.Items.BONE_MEAL); - public static ItemWrapper BONE = of(net.minecraft.item.Items.BONE); - public static ItemWrapper SUGAR = of(net.minecraft.item.Items.SUGAR); - public static ItemWrapper CAKE = of(net.minecraft.item.Items.CAKE); - public static ItemWrapper WHITE_BED = of(net.minecraft.item.Items.WHITE_BED); - public static ItemWrapper ORANGE_BED = of(net.minecraft.item.Items.ORANGE_BED); - public static ItemWrapper MAGENTA_BED = of(net.minecraft.item.Items.MAGENTA_BED); - public static ItemWrapper LIGHT_BLUE_BED = of(net.minecraft.item.Items.LIGHT_BLUE_BED); - public static ItemWrapper YELLOW_BED = of(net.minecraft.item.Items.YELLOW_BED); - public static ItemWrapper LIME_BED = of(net.minecraft.item.Items.LIME_BED); - public static ItemWrapper PINK_BED = of(net.minecraft.item.Items.PINK_BED); - public static ItemWrapper GRAY_BED = of(net.minecraft.item.Items.GRAY_BED); - public static ItemWrapper LIGHT_GRAY_BED = of(net.minecraft.item.Items.LIGHT_GRAY_BED); - public static ItemWrapper CYAN_BED = of(net.minecraft.item.Items.CYAN_BED); - public static ItemWrapper PURPLE_BED = of(net.minecraft.item.Items.PURPLE_BED); - public static ItemWrapper BLUE_BED = of(net.minecraft.item.Items.BLUE_BED); - public static ItemWrapper BROWN_BED = of(net.minecraft.item.Items.BROWN_BED); - public static ItemWrapper GREEN_BED = of(net.minecraft.item.Items.GREEN_BED); - public static ItemWrapper RED_BED = of(net.minecraft.item.Items.RED_BED); - public static ItemWrapper BLACK_BED = of(net.minecraft.item.Items.BLACK_BED); - public static ItemWrapper COOKIE = of(net.minecraft.item.Items.COOKIE); - public static ItemWrapper FILLED_MAP = of(net.minecraft.item.Items.FILLED_MAP); - public static ItemWrapper SHEARS = of(net.minecraft.item.Items.SHEARS); - public static ItemWrapper MELON_SLICE = of(net.minecraft.item.Items.MELON_SLICE); - public static ItemWrapper DRIED_KELP = of(net.minecraft.item.Items.DRIED_KELP); - public static ItemWrapper PUMPKIN_SEEDS = of(net.minecraft.item.Items.PUMPKIN_SEEDS); - public static ItemWrapper MELON_SEEDS = of(net.minecraft.item.Items.MELON_SEEDS); - public static ItemWrapper BEEF = of(net.minecraft.item.Items.BEEF); - public static ItemWrapper COOKED_BEEF = of(net.minecraft.item.Items.COOKED_BEEF); - public static ItemWrapper CHICKEN = of(net.minecraft.item.Items.CHICKEN); - public static ItemWrapper COOKED_CHICKEN = of(net.minecraft.item.Items.COOKED_CHICKEN); - public static ItemWrapper ROTTEN_FLESH = of(net.minecraft.item.Items.ROTTEN_FLESH); - public static ItemWrapper ENDER_PEARL = of(net.minecraft.item.Items.ENDER_PEARL); - public static ItemWrapper BLAZE_ROD = of(net.minecraft.item.Items.BLAZE_ROD); - public static ItemWrapper GHAST_TEAR = of(net.minecraft.item.Items.GHAST_TEAR); - public static ItemWrapper GOLD_NUGGET = of(net.minecraft.item.Items.GOLD_NUGGET); - public static ItemWrapper NETHER_WART = of(net.minecraft.item.Items.NETHER_WART); - public static ItemWrapper POTION = of(net.minecraft.item.Items.POTION); - public static ItemWrapper GLASS_BOTTLE = of(net.minecraft.item.Items.GLASS_BOTTLE); - public static ItemWrapper SPIDER_EYE = of(net.minecraft.item.Items.SPIDER_EYE); - public static ItemWrapper FERMENTED_SPIDER_EYE = of(net.minecraft.item.Items.FERMENTED_SPIDER_EYE); - public static ItemWrapper BLAZE_POWDER = of(net.minecraft.item.Items.BLAZE_POWDER); - public static ItemWrapper MAGMA_CREAM = of(net.minecraft.item.Items.MAGMA_CREAM); - public static ItemWrapper BREWING_STAND = of(net.minecraft.item.Items.BREWING_STAND); - public static ItemWrapper CAULDRON = of(net.minecraft.item.Items.CAULDRON); - public static ItemWrapper ENDER_EYE = of(net.minecraft.item.Items.ENDER_EYE); - public static ItemWrapper GLISTERING_MELON_SLICE = of(net.minecraft.item.Items.GLISTERING_MELON_SLICE); - public static ItemWrapper BAT_SPAWN_EGG = of(net.minecraft.item.Items.BAT_SPAWN_EGG); - public static ItemWrapper BEE_SPAWN_EGG = of(net.minecraft.item.Items.BEE_SPAWN_EGG); - public static ItemWrapper BLAZE_SPAWN_EGG = of(net.minecraft.item.Items.BLAZE_SPAWN_EGG); - public static ItemWrapper CAT_SPAWN_EGG = of(net.minecraft.item.Items.CAT_SPAWN_EGG); - public static ItemWrapper CAVE_SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.CAVE_SPIDER_SPAWN_EGG); - public static ItemWrapper CHICKEN_SPAWN_EGG = of(net.minecraft.item.Items.CHICKEN_SPAWN_EGG); - public static ItemWrapper COD_SPAWN_EGG = of(net.minecraft.item.Items.COD_SPAWN_EGG); - public static ItemWrapper COW_SPAWN_EGG = of(net.minecraft.item.Items.COW_SPAWN_EGG); - public static ItemWrapper CREEPER_SPAWN_EGG = of(net.minecraft.item.Items.CREEPER_SPAWN_EGG); - public static ItemWrapper DOLPHIN_SPAWN_EGG = of(net.minecraft.item.Items.DOLPHIN_SPAWN_EGG); - public static ItemWrapper DONKEY_SPAWN_EGG = of(net.minecraft.item.Items.DONKEY_SPAWN_EGG); - public static ItemWrapper DROWNED_SPAWN_EGG = of(net.minecraft.item.Items.DROWNED_SPAWN_EGG); - public static ItemWrapper ELDER_GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.ELDER_GUARDIAN_SPAWN_EGG); - public static ItemWrapper ENDERMAN_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMAN_SPAWN_EGG); - public static ItemWrapper ENDERMITE_SPAWN_EGG = of(net.minecraft.item.Items.ENDERMITE_SPAWN_EGG); - public static ItemWrapper EVOKER_SPAWN_EGG = of(net.minecraft.item.Items.EVOKER_SPAWN_EGG); - public static ItemWrapper FOX_SPAWN_EGG = of(net.minecraft.item.Items.FOX_SPAWN_EGG); - public static ItemWrapper GHAST_SPAWN_EGG = of(net.minecraft.item.Items.GHAST_SPAWN_EGG); - public static ItemWrapper GUARDIAN_SPAWN_EGG = of(net.minecraft.item.Items.GUARDIAN_SPAWN_EGG); - public static ItemWrapper HOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.HOGLIN_SPAWN_EGG); - public static ItemWrapper HORSE_SPAWN_EGG = of(net.minecraft.item.Items.HORSE_SPAWN_EGG); - public static ItemWrapper HUSK_SPAWN_EGG = of(net.minecraft.item.Items.HUSK_SPAWN_EGG); - public static ItemWrapper LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.LLAMA_SPAWN_EGG); - public static ItemWrapper MAGMA_CUBE_SPAWN_EGG = of(net.minecraft.item.Items.MAGMA_CUBE_SPAWN_EGG); - public static ItemWrapper MOOSHROOM_SPAWN_EGG = of(net.minecraft.item.Items.MOOSHROOM_SPAWN_EGG); - public static ItemWrapper MULE_SPAWN_EGG = of(net.minecraft.item.Items.MULE_SPAWN_EGG); - public static ItemWrapper OCELOT_SPAWN_EGG = of(net.minecraft.item.Items.OCELOT_SPAWN_EGG); - public static ItemWrapper PANDA_SPAWN_EGG = of(net.minecraft.item.Items.PANDA_SPAWN_EGG); - public static ItemWrapper PARROT_SPAWN_EGG = of(net.minecraft.item.Items.PARROT_SPAWN_EGG); - public static ItemWrapper PHANTOM_SPAWN_EGG = of(net.minecraft.item.Items.PHANTOM_SPAWN_EGG); - public static ItemWrapper PIG_SPAWN_EGG = of(net.minecraft.item.Items.PIG_SPAWN_EGG); - public static ItemWrapper PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_SPAWN_EGG); - public static ItemWrapper PIGLIN_BRUTE_SPAWN_EGG = of(net.minecraft.item.Items.PIGLIN_BRUTE_SPAWN_EGG); - public static ItemWrapper PILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.PILLAGER_SPAWN_EGG); - public static ItemWrapper POLAR_BEAR_SPAWN_EGG = of(net.minecraft.item.Items.POLAR_BEAR_SPAWN_EGG); - public static ItemWrapper PUFFERFISH_SPAWN_EGG = of(net.minecraft.item.Items.PUFFERFISH_SPAWN_EGG); - public static ItemWrapper RABBIT_SPAWN_EGG = of(net.minecraft.item.Items.RABBIT_SPAWN_EGG); - public static ItemWrapper RAVAGER_SPAWN_EGG = of(net.minecraft.item.Items.RAVAGER_SPAWN_EGG); - public static ItemWrapper SALMON_SPAWN_EGG = of(net.minecraft.item.Items.SALMON_SPAWN_EGG); - public static ItemWrapper SHEEP_SPAWN_EGG = of(net.minecraft.item.Items.SHEEP_SPAWN_EGG); - public static ItemWrapper SHULKER_SPAWN_EGG = of(net.minecraft.item.Items.SHULKER_SPAWN_EGG); - public static ItemWrapper SILVERFISH_SPAWN_EGG = of(net.minecraft.item.Items.SILVERFISH_SPAWN_EGG); - public static ItemWrapper SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_SPAWN_EGG); - public static ItemWrapper SKELETON_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.SKELETON_HORSE_SPAWN_EGG); - public static ItemWrapper SLIME_SPAWN_EGG = of(net.minecraft.item.Items.SLIME_SPAWN_EGG); - public static ItemWrapper SPIDER_SPAWN_EGG = of(net.minecraft.item.Items.SPIDER_SPAWN_EGG); - public static ItemWrapper SQUID_SPAWN_EGG = of(net.minecraft.item.Items.SQUID_SPAWN_EGG); - public static ItemWrapper STRAY_SPAWN_EGG = of(net.minecraft.item.Items.STRAY_SPAWN_EGG); - public static ItemWrapper STRIDER_SPAWN_EGG = of(net.minecraft.item.Items.STRIDER_SPAWN_EGG); - public static ItemWrapper TRADER_LLAMA_SPAWN_EGG = of(net.minecraft.item.Items.TRADER_LLAMA_SPAWN_EGG); - public static ItemWrapper TROPICAL_FISH_SPAWN_EGG = of(net.minecraft.item.Items.TROPICAL_FISH_SPAWN_EGG); - public static ItemWrapper TURTLE_SPAWN_EGG = of(net.minecraft.item.Items.TURTLE_SPAWN_EGG); - public static ItemWrapper VEX_SPAWN_EGG = of(net.minecraft.item.Items.VEX_SPAWN_EGG); - public static ItemWrapper VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.VILLAGER_SPAWN_EGG); - public static ItemWrapper VINDICATOR_SPAWN_EGG = of(net.minecraft.item.Items.VINDICATOR_SPAWN_EGG); - public static ItemWrapper WANDERING_TRADER_SPAWN_EGG = of(net.minecraft.item.Items.WANDERING_TRADER_SPAWN_EGG); - public static ItemWrapper WITCH_SPAWN_EGG = of(net.minecraft.item.Items.WITCH_SPAWN_EGG); - public static ItemWrapper WITHER_SKELETON_SPAWN_EGG = of(net.minecraft.item.Items.WITHER_SKELETON_SPAWN_EGG); - public static ItemWrapper WOLF_SPAWN_EGG = of(net.minecraft.item.Items.WOLF_SPAWN_EGG); - public static ItemWrapper ZOGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOGLIN_SPAWN_EGG); - public static ItemWrapper ZOMBIE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_SPAWN_EGG); - public static ItemWrapper ZOMBIE_HORSE_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_HORSE_SPAWN_EGG); - public static ItemWrapper ZOMBIE_VILLAGER_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIE_VILLAGER_SPAWN_EGG); - public static ItemWrapper ZOMBIFIED_PIGLIN_SPAWN_EGG = of(net.minecraft.item.Items.ZOMBIFIED_PIGLIN_SPAWN_EGG); - public static ItemWrapper EXPERIENCE_BOTTLE = of(net.minecraft.item.Items.EXPERIENCE_BOTTLE); - public static ItemWrapper FIRE_CHARGE = of(net.minecraft.item.Items.FIRE_CHARGE); - public static ItemWrapper WRITABLE_BOOK = of(net.minecraft.item.Items.WRITABLE_BOOK); - public static ItemWrapper WRITTEN_BOOK = of(net.minecraft.item.Items.WRITTEN_BOOK); - public static ItemWrapper EMERALD = of(net.minecraft.item.Items.EMERALD); - public static ItemWrapper ITEM_FRAME = of(net.minecraft.item.Items.ITEM_FRAME); - public static ItemWrapper FLOWER_POT = of(net.minecraft.item.Items.FLOWER_POT); - public static ItemWrapper CARROT = of(net.minecraft.item.Items.CARROT); - public static ItemWrapper POTATO = of(net.minecraft.item.Items.POTATO); - public static ItemWrapper BAKED_POTATO = of(net.minecraft.item.Items.BAKED_POTATO); - public static ItemWrapper POISONOUS_POTATO = of(net.minecraft.item.Items.POISONOUS_POTATO); - public static ItemWrapper MAP = of(net.minecraft.item.Items.MAP); - public static ItemWrapper GOLDEN_CARROT = of(net.minecraft.item.Items.GOLDEN_CARROT); - public static ItemWrapper SKELETON_SKULL = of(net.minecraft.item.Items.SKELETON_SKULL); - public static ItemWrapper WITHER_SKELETON_SKULL = of(net.minecraft.item.Items.WITHER_SKELETON_SKULL); - public static ItemWrapper PLAYER_HEAD = of(net.minecraft.item.Items.PLAYER_HEAD); - public static ItemWrapper ZOMBIE_HEAD = of(net.minecraft.item.Items.ZOMBIE_HEAD); - public static ItemWrapper CREEPER_HEAD = of(net.minecraft.item.Items.CREEPER_HEAD); - public static ItemWrapper DRAGON_HEAD = of(net.minecraft.item.Items.DRAGON_HEAD); - public static ItemWrapper CARROT_ON_A_STICK = of(net.minecraft.item.Items.CARROT_ON_A_STICK); - public static ItemWrapper WARPED_FUNGUS_ON_A_STICK = of(net.minecraft.item.Items.WARPED_FUNGUS_ON_A_STICK); - public static ItemWrapper NETHER_STAR = of(net.minecraft.item.Items.NETHER_STAR); - public static ItemWrapper PUMPKIN_PIE = of(net.minecraft.item.Items.PUMPKIN_PIE); - public static ItemWrapper FIREWORK_ROCKET = of(net.minecraft.item.Items.FIREWORK_ROCKET); - public static ItemWrapper FIREWORK_STAR = of(net.minecraft.item.Items.FIREWORK_STAR); - public static ItemWrapper ENCHANTED_BOOK = of(net.minecraft.item.Items.ENCHANTED_BOOK); - public static ItemWrapper NETHER_BRICK = of(net.minecraft.item.Items.NETHER_BRICK); - public static ItemWrapper QUARTZ = of(net.minecraft.item.Items.QUARTZ); - public static ItemWrapper TNT_MINECART = of(net.minecraft.item.Items.TNT_MINECART); - public static ItemWrapper HOPPER_MINECART = of(net.minecraft.item.Items.HOPPER_MINECART); - public static ItemWrapper PRISMARINE_SHARD = of(net.minecraft.item.Items.PRISMARINE_SHARD); - public static ItemWrapper PRISMARINE_CRYSTALS = of(net.minecraft.item.Items.PRISMARINE_CRYSTALS); - public static ItemWrapper RABBIT = of(net.minecraft.item.Items.RABBIT); - public static ItemWrapper COOKED_RABBIT = of(net.minecraft.item.Items.COOKED_RABBIT); - public static ItemWrapper RABBIT_STEW = of(net.minecraft.item.Items.RABBIT_STEW); - public static ItemWrapper RABBIT_FOOT = of(net.minecraft.item.Items.RABBIT_FOOT); - public static ItemWrapper RABBIT_HIDE = of(net.minecraft.item.Items.RABBIT_HIDE); - public static ItemWrapper ARMOR_STAND = of(net.minecraft.item.Items.ARMOR_STAND); - public static ItemWrapper IRON_HORSE_ARMOR = of(net.minecraft.item.Items.IRON_HORSE_ARMOR); - public static ItemWrapper GOLDEN_HORSE_ARMOR = of(net.minecraft.item.Items.GOLDEN_HORSE_ARMOR); - public static ItemWrapper DIAMOND_HORSE_ARMOR = of(net.minecraft.item.Items.DIAMOND_HORSE_ARMOR); - public static ItemWrapper LEATHER_HORSE_ARMOR = of(net.minecraft.item.Items.LEATHER_HORSE_ARMOR); - public static ItemWrapper LEAD = of(net.minecraft.item.Items.LEAD); - public static ItemWrapper NAME_TAG = of(net.minecraft.item.Items.NAME_TAG); - public static ItemWrapper COMMAND_BLOCK_MINECART = of(net.minecraft.item.Items.COMMAND_BLOCK_MINECART); - public static ItemWrapper MUTTON = of(net.minecraft.item.Items.MUTTON); - public static ItemWrapper COOKED_MUTTON = of(net.minecraft.item.Items.COOKED_MUTTON); - public static ItemWrapper WHITE_BANNER = of(net.minecraft.item.Items.WHITE_BANNER); - public static ItemWrapper ORANGE_BANNER = of(net.minecraft.item.Items.ORANGE_BANNER); - public static ItemWrapper MAGENTA_BANNER = of(net.minecraft.item.Items.MAGENTA_BANNER); - public static ItemWrapper LIGHT_BLUE_BANNER = of(net.minecraft.item.Items.LIGHT_BLUE_BANNER); - public static ItemWrapper YELLOW_BANNER = of(net.minecraft.item.Items.YELLOW_BANNER); - public static ItemWrapper LIME_BANNER = of(net.minecraft.item.Items.LIME_BANNER); - public static ItemWrapper PINK_BANNER = of(net.minecraft.item.Items.PINK_BANNER); - public static ItemWrapper GRAY_BANNER = of(net.minecraft.item.Items.GRAY_BANNER); - public static ItemWrapper LIGHT_GRAY_BANNER = of(net.minecraft.item.Items.LIGHT_GRAY_BANNER); - public static ItemWrapper CYAN_BANNER = of(net.minecraft.item.Items.CYAN_BANNER); - public static ItemWrapper PURPLE_BANNER = of(net.minecraft.item.Items.PURPLE_BANNER); - public static ItemWrapper BLUE_BANNER = of(net.minecraft.item.Items.BLUE_BANNER); - public static ItemWrapper BROWN_BANNER = of(net.minecraft.item.Items.BROWN_BANNER); - public static ItemWrapper GREEN_BANNER = of(net.minecraft.item.Items.GREEN_BANNER); - public static ItemWrapper RED_BANNER = of(net.minecraft.item.Items.RED_BANNER); - public static ItemWrapper BLACK_BANNER = of(net.minecraft.item.Items.BLACK_BANNER); - public static ItemWrapper END_CRYSTAL = of(net.minecraft.item.Items.END_CRYSTAL); - public static ItemWrapper CHORUS_FRUIT = of(net.minecraft.item.Items.CHORUS_FRUIT); - public static ItemWrapper POPPED_CHORUS_FRUIT = of(net.minecraft.item.Items.POPPED_CHORUS_FRUIT); - public static ItemWrapper BEETROOT = of(net.minecraft.item.Items.BEETROOT); - public static ItemWrapper BEETROOT_SEEDS = of(net.minecraft.item.Items.BEETROOT_SEEDS); - public static ItemWrapper BEETROOT_SOUP = of(net.minecraft.item.Items.BEETROOT_SOUP); - public static ItemWrapper DRAGON_BREATH = of(net.minecraft.item.Items.DRAGON_BREATH); - public static ItemWrapper SPLASH_POTION = of(net.minecraft.item.Items.SPLASH_POTION); - public static ItemWrapper SPECTRAL_ARROW = of(net.minecraft.item.Items.SPECTRAL_ARROW); - public static ItemWrapper TIPPED_ARROW = of(net.minecraft.item.Items.TIPPED_ARROW); - public static ItemWrapper LINGERING_POTION = of(net.minecraft.item.Items.LINGERING_POTION); - public static ItemWrapper SHIELD = of(net.minecraft.item.Items.SHIELD); - public static ItemWrapper ELYTRA = of(net.minecraft.item.Items.ELYTRA); - public static ItemWrapper SPRUCE_BOAT = of(net.minecraft.item.Items.SPRUCE_BOAT); - public static ItemWrapper BIRCH_BOAT = of(net.minecraft.item.Items.BIRCH_BOAT); - public static ItemWrapper JUNGLE_BOAT = of(net.minecraft.item.Items.JUNGLE_BOAT); - public static ItemWrapper ACACIA_BOAT = of(net.minecraft.item.Items.ACACIA_BOAT); - public static ItemWrapper DARK_OAK_BOAT = of(net.minecraft.item.Items.DARK_OAK_BOAT); - public static ItemWrapper TOTEM_OF_UNDYING = of(net.minecraft.item.Items.TOTEM_OF_UNDYING); - public static ItemWrapper SHULKER_SHELL = of(net.minecraft.item.Items.SHULKER_SHELL); - public static ItemWrapper IRON_NUGGET = of(net.minecraft.item.Items.IRON_NUGGET); - public static ItemWrapper KNOWLEDGE_BOOK = of(net.minecraft.item.Items.KNOWLEDGE_BOOK); - public static ItemWrapper DEBUG_STICK = of(net.minecraft.item.Items.DEBUG_STICK); - public static ItemWrapper MUSIC_DISC_13 = of(net.minecraft.item.Items.MUSIC_DISC_13); - public static ItemWrapper MUSIC_DISC_CAT = of(net.minecraft.item.Items.MUSIC_DISC_CAT); - public static ItemWrapper MUSIC_DISC_BLOCKS = of(net.minecraft.item.Items.MUSIC_DISC_BLOCKS); - public static ItemWrapper MUSIC_DISC_CHIRP = of(net.minecraft.item.Items.MUSIC_DISC_CHIRP); - public static ItemWrapper MUSIC_DISC_FAR = of(net.minecraft.item.Items.MUSIC_DISC_FAR); - public static ItemWrapper MUSIC_DISC_MALL = of(net.minecraft.item.Items.MUSIC_DISC_MALL); - public static ItemWrapper MUSIC_DISC_MELLOHI = of(net.minecraft.item.Items.MUSIC_DISC_MELLOHI); - public static ItemWrapper MUSIC_DISC_STAL = of(net.minecraft.item.Items.MUSIC_DISC_STAL); - public static ItemWrapper MUSIC_DISC_STRAD = of(net.minecraft.item.Items.MUSIC_DISC_STRAD); - public static ItemWrapper MUSIC_DISC_WARD = of(net.minecraft.item.Items.MUSIC_DISC_WARD); - public static ItemWrapper MUSIC_DISC_11 = of(net.minecraft.item.Items.MUSIC_DISC_11); - public static ItemWrapper MUSIC_DISC_WAIT = of(net.minecraft.item.Items.MUSIC_DISC_WAIT); - public static ItemWrapper MUSIC_DISC_PIGSTEP = of(net.minecraft.item.Items.MUSIC_DISC_PIGSTEP); - public static ItemWrapper TRIDENT = of(net.minecraft.item.Items.TRIDENT); - public static ItemWrapper PHANTOM_MEMBRANE = of(net.minecraft.item.Items.PHANTOM_MEMBRANE); - public static ItemWrapper NAUTILUS_SHELL = of(net.minecraft.item.Items.NAUTILUS_SHELL); - public static ItemWrapper HEART_OF_THE_SEA = of(net.minecraft.item.Items.HEART_OF_THE_SEA); - public static ItemWrapper CROSSBOW = of(net.minecraft.item.Items.CROSSBOW); - public static ItemWrapper SUSPICIOUS_STEW = of(net.minecraft.item.Items.SUSPICIOUS_STEW); - public static ItemWrapper LOOM = of(net.minecraft.item.Items.LOOM); - public static ItemWrapper FLOWER_BANNER_PATTERN = of(net.minecraft.item.Items.FLOWER_BANNER_PATTERN); - public static ItemWrapper CREEPER_BANNER_PATTERN = of(net.minecraft.item.Items.CREEPER_BANNER_PATTERN); - public static ItemWrapper SKULL_BANNER_PATTERN = of(net.minecraft.item.Items.SKULL_BANNER_PATTERN); - public static ItemWrapper MOJANG_BANNER_PATTERN = of(net.minecraft.item.Items.MOJANG_BANNER_PATTERN); - public static ItemWrapper GLOBE_BANNER_PATTERN = of(net.minecraft.item.Items.GLOBE_BANNER_PATTERN); - public static ItemWrapper PIGLIN_BANNER_PATTERN = of(net.minecraft.item.Items.PIGLIN_BANNER_PATTERN); - public static ItemWrapper COMPOSTER = of(net.minecraft.item.Items.COMPOSTER); - public static ItemWrapper BARREL = of(net.minecraft.item.Items.BARREL); - public static ItemWrapper SMOKER = of(net.minecraft.item.Items.SMOKER); - public static ItemWrapper BLAST_FURNACE = of(net.minecraft.item.Items.BLAST_FURNACE); - public static ItemWrapper CARTOGRAPHY_TABLE = of(net.minecraft.item.Items.CARTOGRAPHY_TABLE); - public static ItemWrapper FLETCHING_TABLE = of(net.minecraft.item.Items.FLETCHING_TABLE); - public static ItemWrapper GRINDSTONE = of(net.minecraft.item.Items.GRINDSTONE); - public static ItemWrapper LECTERN = of(net.minecraft.item.Items.LECTERN); - public static ItemWrapper SMITHING_TABLE = of(net.minecraft.item.Items.SMITHING_TABLE); - public static ItemWrapper STONECUTTER = of(net.minecraft.item.Items.STONECUTTER); - public static ItemWrapper BELL = of(net.minecraft.item.Items.BELL); - public static ItemWrapper LANTERN = of(net.minecraft.item.Items.LANTERN); - public static ItemWrapper SOUL_LANTERN = of(net.minecraft.item.Items.SOUL_LANTERN); - public static ItemWrapper SWEET_BERRIES = of(net.minecraft.item.Items.SWEET_BERRIES); - public static ItemWrapper CAMPFIRE = of(net.minecraft.item.Items.CAMPFIRE); - public static ItemWrapper SOUL_CAMPFIRE = of(net.minecraft.item.Items.SOUL_CAMPFIRE); - public static ItemWrapper SHROOMLIGHT = of(net.minecraft.item.Items.SHROOMLIGHT); - public static ItemWrapper HONEYCOMB = of(net.minecraft.item.Items.HONEYCOMB); - public static ItemWrapper BEE_NEST = of(net.minecraft.item.Items.BEE_NEST); - public static ItemWrapper BEEHIVE = of(net.minecraft.item.Items.BEEHIVE); - public static ItemWrapper HONEY_BOTTLE = of(net.minecraft.item.Items.HONEY_BOTTLE); - public static ItemWrapper HONEY_BLOCK = of(net.minecraft.item.Items.HONEY_BLOCK); - public static ItemWrapper HONEYCOMB_BLOCK = of(net.minecraft.item.Items.HONEYCOMB_BLOCK); - public static ItemWrapper LODESTONE = of(net.minecraft.item.Items.LODESTONE); - public static ItemWrapper NETHERITE_BLOCK = of(net.minecraft.item.Items.NETHERITE_BLOCK); - public static ItemWrapper ANCIENT_DEBRIS = of(net.minecraft.item.Items.ANCIENT_DEBRIS); - public static ItemWrapper TARGET = of(net.minecraft.item.Items.TARGET); - public static ItemWrapper CRYING_OBSIDIAN = of(net.minecraft.item.Items.CRYING_OBSIDIAN); - public static ItemWrapper BLACKSTONE = of(net.minecraft.item.Items.BLACKSTONE); - public static ItemWrapper BLACKSTONE_SLAB = of(net.minecraft.item.Items.BLACKSTONE_SLAB); - public static ItemWrapper BLACKSTONE_STAIRS = of(net.minecraft.item.Items.BLACKSTONE_STAIRS); - public static ItemWrapper GILDED_BLACKSTONE = of(net.minecraft.item.Items.GILDED_BLACKSTONE); - public static ItemWrapper POLISHED_BLACKSTONE = of(net.minecraft.item.Items.POLISHED_BLACKSTONE); - public static ItemWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_SLAB); - public static ItemWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_STAIRS); - public static ItemWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.item.Items.CHISELED_POLISHED_BLACKSTONE); - public static ItemWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICKS); - public static ItemWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_SLAB); - public static ItemWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.item.Items.POLISHED_BLACKSTONE_BRICK_STAIRS); - public static ItemWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.item.Items.CRACKED_POLISHED_BLACKSTONE_BRICKS); - public static ItemWrapper RESPAWN_ANCHOR = of(net.minecraft.item.Items.RESPAWN_ANCHOR); + public static ItemWrapper AIR = of(net.minecraft.world.item.Items.AIR); + public static ItemWrapper STONE = of(net.minecraft.world.item.Items.STONE); + public static ItemWrapper GRANITE = of(net.minecraft.world.item.Items.GRANITE); + public static ItemWrapper POLISHED_GRANITE = of(net.minecraft.world.item.Items.POLISHED_GRANITE); + public static ItemWrapper DIORITE = of(net.minecraft.world.item.Items.DIORITE); + public static ItemWrapper POLISHED_DIORITE = of(net.minecraft.world.item.Items.POLISHED_DIORITE); + public static ItemWrapper ANDESITE = of(net.minecraft.world.item.Items.ANDESITE); + public static ItemWrapper POLISHED_ANDESITE = of(net.minecraft.world.item.Items.POLISHED_ANDESITE); + public static ItemWrapper GRASS_BLOCK = of(net.minecraft.world.item.Items.GRASS_BLOCK); + public static ItemWrapper DIRT = of(net.minecraft.world.item.Items.DIRT); + public static ItemWrapper COARSE_DIRT = of(net.minecraft.world.item.Items.COARSE_DIRT); + public static ItemWrapper PODZOL = of(net.minecraft.world.item.Items.PODZOL); + public static ItemWrapper CRIMSON_NYLIUM = of(net.minecraft.world.item.Items.CRIMSON_NYLIUM); + public static ItemWrapper WARPED_NYLIUM = of(net.minecraft.world.item.Items.WARPED_NYLIUM); + public static ItemWrapper COBBLESTONE = of(net.minecraft.world.item.Items.COBBLESTONE); + public static ItemWrapper OAK_PLANKS = of(net.minecraft.world.item.Items.OAK_PLANKS); + public static ItemWrapper SPRUCE_PLANKS = of(net.minecraft.world.item.Items.SPRUCE_PLANKS); + public static ItemWrapper BIRCH_PLANKS = of(net.minecraft.world.item.Items.BIRCH_PLANKS); + public static ItemWrapper JUNGLE_PLANKS = of(net.minecraft.world.item.Items.JUNGLE_PLANKS); + public static ItemWrapper ACACIA_PLANKS = of(net.minecraft.world.item.Items.ACACIA_PLANKS); + public static ItemWrapper DARK_OAK_PLANKS = of(net.minecraft.world.item.Items.DARK_OAK_PLANKS); + public static ItemWrapper CRIMSON_PLANKS = of(net.minecraft.world.item.Items.CRIMSON_PLANKS); + public static ItemWrapper WARPED_PLANKS = of(net.minecraft.world.item.Items.WARPED_PLANKS); + public static ItemWrapper OAK_SAPLING = of(net.minecraft.world.item.Items.OAK_SAPLING); + public static ItemWrapper SPRUCE_SAPLING = of(net.minecraft.world.item.Items.SPRUCE_SAPLING); + public static ItemWrapper BIRCH_SAPLING = of(net.minecraft.world.item.Items.BIRCH_SAPLING); + public static ItemWrapper JUNGLE_SAPLING = of(net.minecraft.world.item.Items.JUNGLE_SAPLING); + public static ItemWrapper ACACIA_SAPLING = of(net.minecraft.world.item.Items.ACACIA_SAPLING); + public static ItemWrapper DARK_OAK_SAPLING = of(net.minecraft.world.item.Items.DARK_OAK_SAPLING); + public static ItemWrapper BEDROCK = of(net.minecraft.world.item.Items.BEDROCK); + public static ItemWrapper SAND = of(net.minecraft.world.item.Items.SAND); + public static ItemWrapper RED_SAND = of(net.minecraft.world.item.Items.RED_SAND); + public static ItemWrapper GRAVEL = of(net.minecraft.world.item.Items.GRAVEL); + public static ItemWrapper GOLD_ORE = of(net.minecraft.world.item.Items.GOLD_ORE); + public static ItemWrapper IRON_ORE = of(net.minecraft.world.item.Items.IRON_ORE); + public static ItemWrapper COAL_ORE = of(net.minecraft.world.item.Items.COAL_ORE); + public static ItemWrapper NETHER_GOLD_ORE = of(net.minecraft.world.item.Items.NETHER_GOLD_ORE); + public static ItemWrapper OAK_LOG = of(net.minecraft.world.item.Items.OAK_LOG); + public static ItemWrapper SPRUCE_LOG = of(net.minecraft.world.item.Items.SPRUCE_LOG); + public static ItemWrapper BIRCH_LOG = of(net.minecraft.world.item.Items.BIRCH_LOG); + public static ItemWrapper JUNGLE_LOG = of(net.minecraft.world.item.Items.JUNGLE_LOG); + public static ItemWrapper ACACIA_LOG = of(net.minecraft.world.item.Items.ACACIA_LOG); + public static ItemWrapper DARK_OAK_LOG = of(net.minecraft.world.item.Items.DARK_OAK_LOG); + public static ItemWrapper CRIMSON_STEM = of(net.minecraft.world.item.Items.CRIMSON_STEM); + public static ItemWrapper WARPED_STEM = of(net.minecraft.world.item.Items.WARPED_STEM); + public static ItemWrapper STRIPPED_OAK_LOG = of(net.minecraft.world.item.Items.STRIPPED_OAK_LOG); + public static ItemWrapper STRIPPED_SPRUCE_LOG = of(net.minecraft.world.item.Items.STRIPPED_SPRUCE_LOG); + public static ItemWrapper STRIPPED_BIRCH_LOG = of(net.minecraft.world.item.Items.STRIPPED_BIRCH_LOG); + public static ItemWrapper STRIPPED_JUNGLE_LOG = of(net.minecraft.world.item.Items.STRIPPED_JUNGLE_LOG); + public static ItemWrapper STRIPPED_ACACIA_LOG = of(net.minecraft.world.item.Items.STRIPPED_ACACIA_LOG); + public static ItemWrapper STRIPPED_DARK_OAK_LOG = of(net.minecraft.world.item.Items.STRIPPED_DARK_OAK_LOG); + public static ItemWrapper STRIPPED_CRIMSON_STEM = of(net.minecraft.world.item.Items.STRIPPED_CRIMSON_STEM); + public static ItemWrapper STRIPPED_WARPED_STEM = of(net.minecraft.world.item.Items.STRIPPED_WARPED_STEM); + public static ItemWrapper STRIPPED_OAK_WOOD = of(net.minecraft.world.item.Items.STRIPPED_OAK_WOOD); + public static ItemWrapper STRIPPED_SPRUCE_WOOD = of(net.minecraft.world.item.Items.STRIPPED_SPRUCE_WOOD); + public static ItemWrapper STRIPPED_BIRCH_WOOD = of(net.minecraft.world.item.Items.STRIPPED_BIRCH_WOOD); + public static ItemWrapper STRIPPED_JUNGLE_WOOD = of(net.minecraft.world.item.Items.STRIPPED_JUNGLE_WOOD); + public static ItemWrapper STRIPPED_ACACIA_WOOD = of(net.minecraft.world.item.Items.STRIPPED_ACACIA_WOOD); + public static ItemWrapper STRIPPED_DARK_OAK_WOOD = of(net.minecraft.world.item.Items.STRIPPED_DARK_OAK_WOOD); + public static ItemWrapper STRIPPED_CRIMSON_HYPHAE = of(net.minecraft.world.item.Items.STRIPPED_CRIMSON_HYPHAE); + public static ItemWrapper STRIPPED_WARPED_HYPHAE = of(net.minecraft.world.item.Items.STRIPPED_WARPED_HYPHAE); + public static ItemWrapper OAK_WOOD = of(net.minecraft.world.item.Items.OAK_WOOD); + public static ItemWrapper SPRUCE_WOOD = of(net.minecraft.world.item.Items.SPRUCE_WOOD); + public static ItemWrapper BIRCH_WOOD = of(net.minecraft.world.item.Items.BIRCH_WOOD); + public static ItemWrapper JUNGLE_WOOD = of(net.minecraft.world.item.Items.JUNGLE_WOOD); + public static ItemWrapper ACACIA_WOOD = of(net.minecraft.world.item.Items.ACACIA_WOOD); + public static ItemWrapper DARK_OAK_WOOD = of(net.minecraft.world.item.Items.DARK_OAK_WOOD); + public static ItemWrapper CRIMSON_HYPHAE = of(net.minecraft.world.item.Items.CRIMSON_HYPHAE); + public static ItemWrapper WARPED_HYPHAE = of(net.minecraft.world.item.Items.WARPED_HYPHAE); + public static ItemWrapper OAK_LEAVES = of(net.minecraft.world.item.Items.OAK_LEAVES); + public static ItemWrapper SPRUCE_LEAVES = of(net.minecraft.world.item.Items.SPRUCE_LEAVES); + public static ItemWrapper BIRCH_LEAVES = of(net.minecraft.world.item.Items.BIRCH_LEAVES); + public static ItemWrapper JUNGLE_LEAVES = of(net.minecraft.world.item.Items.JUNGLE_LEAVES); + public static ItemWrapper ACACIA_LEAVES = of(net.minecraft.world.item.Items.ACACIA_LEAVES); + public static ItemWrapper DARK_OAK_LEAVES = of(net.minecraft.world.item.Items.DARK_OAK_LEAVES); + public static ItemWrapper SPONGE = of(net.minecraft.world.item.Items.SPONGE); + public static ItemWrapper WET_SPONGE = of(net.minecraft.world.item.Items.WET_SPONGE); + public static ItemWrapper GLASS = of(net.minecraft.world.item.Items.GLASS); + public static ItemWrapper LAPIS_ORE = of(net.minecraft.world.item.Items.LAPIS_ORE); + public static ItemWrapper LAPIS_BLOCK = of(net.minecraft.world.item.Items.LAPIS_BLOCK); + public static ItemWrapper DISPENSER = of(net.minecraft.world.item.Items.DISPENSER); + public static ItemWrapper SANDSTONE = of(net.minecraft.world.item.Items.SANDSTONE); + public static ItemWrapper CHISELED_SANDSTONE = of(net.minecraft.world.item.Items.CHISELED_SANDSTONE); + public static ItemWrapper CUT_SANDSTONE = of(net.minecraft.world.item.Items.CUT_SANDSTONE); + public static ItemWrapper NOTE_BLOCK = of(net.minecraft.world.item.Items.NOTE_BLOCK); + public static ItemWrapper POWERED_RAIL = of(net.minecraft.world.item.Items.POWERED_RAIL); + public static ItemWrapper DETECTOR_RAIL = of(net.minecraft.world.item.Items.DETECTOR_RAIL); + public static ItemWrapper STICKY_PISTON = of(net.minecraft.world.item.Items.STICKY_PISTON); + public static ItemWrapper COBWEB = of(net.minecraft.world.item.Items.COBWEB); + public static ItemWrapper GRASS = of(net.minecraft.world.item.Items.SHORT_GRASS); + public static ItemWrapper FERN = of(net.minecraft.world.item.Items.FERN); + public static ItemWrapper DEAD_BUSH = of(net.minecraft.world.item.Items.DEAD_BUSH); + public static ItemWrapper SEAGRASS = of(net.minecraft.world.item.Items.SEAGRASS); + public static ItemWrapper SEA_PICKLE = of(net.minecraft.world.item.Items.SEA_PICKLE); + public static ItemWrapper PISTON = of(net.minecraft.world.item.Items.PISTON); + public static ItemWrapper WHITE_WOOL = of(net.minecraft.world.item.Items.WHITE_WOOL); + public static ItemWrapper ORANGE_WOOL = of(net.minecraft.world.item.Items.ORANGE_WOOL); + public static ItemWrapper MAGENTA_WOOL = of(net.minecraft.world.item.Items.MAGENTA_WOOL); + public static ItemWrapper LIGHT_BLUE_WOOL = of(net.minecraft.world.item.Items.LIGHT_BLUE_WOOL); + public static ItemWrapper YELLOW_WOOL = of(net.minecraft.world.item.Items.YELLOW_WOOL); + public static ItemWrapper LIME_WOOL = of(net.minecraft.world.item.Items.LIME_WOOL); + public static ItemWrapper PINK_WOOL = of(net.minecraft.world.item.Items.PINK_WOOL); + public static ItemWrapper GRAY_WOOL = of(net.minecraft.world.item.Items.GRAY_WOOL); + public static ItemWrapper LIGHT_GRAY_WOOL = of(net.minecraft.world.item.Items.LIGHT_GRAY_WOOL); + public static ItemWrapper CYAN_WOOL = of(net.minecraft.world.item.Items.CYAN_WOOL); + public static ItemWrapper PURPLE_WOOL = of(net.minecraft.world.item.Items.PURPLE_WOOL); + public static ItemWrapper BLUE_WOOL = of(net.minecraft.world.item.Items.BLUE_WOOL); + public static ItemWrapper BROWN_WOOL = of(net.minecraft.world.item.Items.BROWN_WOOL); + public static ItemWrapper GREEN_WOOL = of(net.minecraft.world.item.Items.GREEN_WOOL); + public static ItemWrapper RED_WOOL = of(net.minecraft.world.item.Items.RED_WOOL); + public static ItemWrapper BLACK_WOOL = of(net.minecraft.world.item.Items.BLACK_WOOL); + public static ItemWrapper DANDELION = of(net.minecraft.world.item.Items.DANDELION); + public static ItemWrapper POPPY = of(net.minecraft.world.item.Items.POPPY); + public static ItemWrapper BLUE_ORCHID = of(net.minecraft.world.item.Items.BLUE_ORCHID); + public static ItemWrapper ALLIUM = of(net.minecraft.world.item.Items.ALLIUM); + public static ItemWrapper AZURE_BLUET = of(net.minecraft.world.item.Items.AZURE_BLUET); + public static ItemWrapper RED_TULIP = of(net.minecraft.world.item.Items.RED_TULIP); + public static ItemWrapper ORANGE_TULIP = of(net.minecraft.world.item.Items.ORANGE_TULIP); + public static ItemWrapper WHITE_TULIP = of(net.minecraft.world.item.Items.WHITE_TULIP); + public static ItemWrapper PINK_TULIP = of(net.minecraft.world.item.Items.PINK_TULIP); + public static ItemWrapper OXEYE_DAISY = of(net.minecraft.world.item.Items.OXEYE_DAISY); + public static ItemWrapper CORNFLOWER = of(net.minecraft.world.item.Items.CORNFLOWER); + public static ItemWrapper LILY_OF_THE_VALLEY = of(net.minecraft.world.item.Items.LILY_OF_THE_VALLEY); + public static ItemWrapper WITHER_ROSE = of(net.minecraft.world.item.Items.WITHER_ROSE); + public static ItemWrapper BROWN_MUSHROOM = of(net.minecraft.world.item.Items.BROWN_MUSHROOM); + public static ItemWrapper RED_MUSHROOM = of(net.minecraft.world.item.Items.RED_MUSHROOM); + public static ItemWrapper CRIMSON_FUNGUS = of(net.minecraft.world.item.Items.CRIMSON_FUNGUS); + public static ItemWrapper WARPED_FUNGUS = of(net.minecraft.world.item.Items.WARPED_FUNGUS); + public static ItemWrapper CRIMSON_ROOTS = of(net.minecraft.world.item.Items.CRIMSON_ROOTS); + public static ItemWrapper WARPED_ROOTS = of(net.minecraft.world.item.Items.WARPED_ROOTS); + public static ItemWrapper NETHER_SPROUTS = of(net.minecraft.world.item.Items.NETHER_SPROUTS); + public static ItemWrapper WEEPING_VINES = of(net.minecraft.world.item.Items.WEEPING_VINES); + public static ItemWrapper TWISTING_VINES = of(net.minecraft.world.item.Items.TWISTING_VINES); + public static ItemWrapper SUGAR_CANE = of(net.minecraft.world.item.Items.SUGAR_CANE); + public static ItemWrapper KELP = of(net.minecraft.world.item.Items.KELP); + public static ItemWrapper BAMBOO = of(net.minecraft.world.item.Items.BAMBOO); + public static ItemWrapper GOLD_BLOCK = of(net.minecraft.world.item.Items.GOLD_BLOCK); + public static ItemWrapper IRON_BLOCK = of(net.minecraft.world.item.Items.IRON_BLOCK); + public static ItemWrapper OAK_SLAB = of(net.minecraft.world.item.Items.OAK_SLAB); + public static ItemWrapper SPRUCE_SLAB = of(net.minecraft.world.item.Items.SPRUCE_SLAB); + public static ItemWrapper BIRCH_SLAB = of(net.minecraft.world.item.Items.BIRCH_SLAB); + public static ItemWrapper JUNGLE_SLAB = of(net.minecraft.world.item.Items.JUNGLE_SLAB); + public static ItemWrapper ACACIA_SLAB = of(net.minecraft.world.item.Items.ACACIA_SLAB); + public static ItemWrapper DARK_OAK_SLAB = of(net.minecraft.world.item.Items.DARK_OAK_SLAB); + public static ItemWrapper CRIMSON_SLAB = of(net.minecraft.world.item.Items.CRIMSON_SLAB); + public static ItemWrapper WARPED_SLAB = of(net.minecraft.world.item.Items.WARPED_SLAB); + public static ItemWrapper STONE_SLAB = of(net.minecraft.world.item.Items.STONE_SLAB); + public static ItemWrapper SMOOTH_STONE_SLAB = of(net.minecraft.world.item.Items.SMOOTH_STONE_SLAB); + public static ItemWrapper SANDSTONE_SLAB = of(net.minecraft.world.item.Items.SANDSTONE_SLAB); + public static ItemWrapper CUT_SANDSTONE_SLAB = of(net.minecraft.world.item.Items.CUT_STANDSTONE_SLAB); + public static ItemWrapper PETRIFIED_OAK_SLAB = of(net.minecraft.world.item.Items.PETRIFIED_OAK_SLAB); + public static ItemWrapper COBBLESTONE_SLAB = of(net.minecraft.world.item.Items.COBBLESTONE_SLAB); + public static ItemWrapper BRICK_SLAB = of(net.minecraft.world.item.Items.BRICK_SLAB); + public static ItemWrapper STONE_BRICK_SLAB = of(net.minecraft.world.item.Items.STONE_BRICK_SLAB); + public static ItemWrapper NETHER_BRICK_SLAB = of(net.minecraft.world.item.Items.NETHER_BRICK_SLAB); + public static ItemWrapper QUARTZ_SLAB = of(net.minecraft.world.item.Items.QUARTZ_SLAB); + public static ItemWrapper RED_SANDSTONE_SLAB = of(net.minecraft.world.item.Items.RED_SANDSTONE_SLAB); + public static ItemWrapper CUT_RED_SANDSTONE_SLAB = of(net.minecraft.world.item.Items.CUT_RED_SANDSTONE_SLAB); + public static ItemWrapper PURPUR_SLAB = of(net.minecraft.world.item.Items.PURPUR_SLAB); + public static ItemWrapper PRISMARINE_SLAB = of(net.minecraft.world.item.Items.PRISMARINE_SLAB); + public static ItemWrapper PRISMARINE_BRICK_SLAB = of(net.minecraft.world.item.Items.PRISMARINE_BRICK_SLAB); + public static ItemWrapper DARK_PRISMARINE_SLAB = of(net.minecraft.world.item.Items.DARK_PRISMARINE_SLAB); + public static ItemWrapper SMOOTH_QUARTZ = of(net.minecraft.world.item.Items.SMOOTH_QUARTZ); + public static ItemWrapper SMOOTH_RED_SANDSTONE = of(net.minecraft.world.item.Items.SMOOTH_RED_SANDSTONE); + public static ItemWrapper SMOOTH_SANDSTONE = of(net.minecraft.world.item.Items.SMOOTH_SANDSTONE); + public static ItemWrapper SMOOTH_STONE = of(net.minecraft.world.item.Items.SMOOTH_STONE); + public static ItemWrapper BRICKS = of(net.minecraft.world.item.Items.BRICKS); + public static ItemWrapper TNT = of(net.minecraft.world.item.Items.TNT); + public static ItemWrapper BOOKSHELF = of(net.minecraft.world.item.Items.BOOKSHELF); + public static ItemWrapper MOSSY_COBBLESTONE = of(net.minecraft.world.item.Items.MOSSY_COBBLESTONE); + public static ItemWrapper OBSIDIAN = of(net.minecraft.world.item.Items.OBSIDIAN); + public static ItemWrapper TORCH = of(net.minecraft.world.item.Items.TORCH); + public static ItemWrapper END_ROD = of(net.minecraft.world.item.Items.END_ROD); + public static ItemWrapper CHORUS_PLANT = of(net.minecraft.world.item.Items.CHORUS_PLANT); + public static ItemWrapper CHORUS_FLOWER = of(net.minecraft.world.item.Items.CHORUS_FLOWER); + public static ItemWrapper PURPUR_BLOCK = of(net.minecraft.world.item.Items.PURPUR_BLOCK); + public static ItemWrapper PURPUR_PILLAR = of(net.minecraft.world.item.Items.PURPUR_PILLAR); + public static ItemWrapper PURPUR_STAIRS = of(net.minecraft.world.item.Items.PURPUR_STAIRS); + public static ItemWrapper SPAWNER = of(net.minecraft.world.item.Items.SPAWNER); + public static ItemWrapper OAK_STAIRS = of(net.minecraft.world.item.Items.OAK_STAIRS); + public static ItemWrapper CHEST = of(net.minecraft.world.item.Items.CHEST); + public static ItemWrapper DIAMOND_ORE = of(net.minecraft.world.item.Items.DIAMOND_ORE); + public static ItemWrapper DIAMOND_BLOCK = of(net.minecraft.world.item.Items.DIAMOND_BLOCK); + public static ItemWrapper CRAFTING_TABLE = of(net.minecraft.world.item.Items.CRAFTING_TABLE); + public static ItemWrapper FARMLAND = of(net.minecraft.world.item.Items.FARMLAND); + public static ItemWrapper FURNACE = of(net.minecraft.world.item.Items.FURNACE); + public static ItemWrapper LADDER = of(net.minecraft.world.item.Items.LADDER); + public static ItemWrapper RAIL = of(net.minecraft.world.item.Items.RAIL); + public static ItemWrapper COBBLESTONE_STAIRS = of(net.minecraft.world.item.Items.COBBLESTONE_STAIRS); + public static ItemWrapper LEVER = of(net.minecraft.world.item.Items.LEVER); + public static ItemWrapper STONE_PRESSURE_PLATE = of(net.minecraft.world.item.Items.STONE_PRESSURE_PLATE); + public static ItemWrapper OAK_PRESSURE_PLATE = of(net.minecraft.world.item.Items.OAK_PRESSURE_PLATE); + public static ItemWrapper SPRUCE_PRESSURE_PLATE = of(net.minecraft.world.item.Items.SPRUCE_PRESSURE_PLATE); + public static ItemWrapper BIRCH_PRESSURE_PLATE = of(net.minecraft.world.item.Items.BIRCH_PRESSURE_PLATE); + public static ItemWrapper JUNGLE_PRESSURE_PLATE = of(net.minecraft.world.item.Items.JUNGLE_PRESSURE_PLATE); + public static ItemWrapper ACACIA_PRESSURE_PLATE = of(net.minecraft.world.item.Items.ACACIA_PRESSURE_PLATE); + public static ItemWrapper DARK_OAK_PRESSURE_PLATE = of(net.minecraft.world.item.Items.DARK_OAK_PRESSURE_PLATE); + public static ItemWrapper CRIMSON_PRESSURE_PLATE = of(net.minecraft.world.item.Items.CRIMSON_PRESSURE_PLATE); + public static ItemWrapper WARPED_PRESSURE_PLATE = of(net.minecraft.world.item.Items.WARPED_PRESSURE_PLATE); + public static ItemWrapper POLISHED_BLACKSTONE_PRESSURE_PLATE = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_PRESSURE_PLATE); + public static ItemWrapper REDSTONE_ORE = of(net.minecraft.world.item.Items.REDSTONE_ORE); + public static ItemWrapper REDSTONE_TORCH = of(net.minecraft.world.item.Items.REDSTONE_TORCH); + public static ItemWrapper SNOW = of(net.minecraft.world.item.Items.SNOW); + public static ItemWrapper ICE = of(net.minecraft.world.item.Items.ICE); + public static ItemWrapper SNOW_BLOCK = of(net.minecraft.world.item.Items.SNOW_BLOCK); + public static ItemWrapper CACTUS = of(net.minecraft.world.item.Items.CACTUS); + public static ItemWrapper CLAY = of(net.minecraft.world.item.Items.CLAY); + public static ItemWrapper JUKEBOX = of(net.minecraft.world.item.Items.JUKEBOX); + public static ItemWrapper OAK_FENCE = of(net.minecraft.world.item.Items.OAK_FENCE); + public static ItemWrapper SPRUCE_FENCE = of(net.minecraft.world.item.Items.SPRUCE_FENCE); + public static ItemWrapper BIRCH_FENCE = of(net.minecraft.world.item.Items.BIRCH_FENCE); + public static ItemWrapper JUNGLE_FENCE = of(net.minecraft.world.item.Items.JUNGLE_FENCE); + public static ItemWrapper ACACIA_FENCE = of(net.minecraft.world.item.Items.ACACIA_FENCE); + public static ItemWrapper DARK_OAK_FENCE = of(net.minecraft.world.item.Items.DARK_OAK_FENCE); + public static ItemWrapper CRIMSON_FENCE = of(net.minecraft.world.item.Items.CRIMSON_FENCE); + public static ItemWrapper WARPED_FENCE = of(net.minecraft.world.item.Items.WARPED_FENCE); + public static ItemWrapper PUMPKIN = of(net.minecraft.world.item.Items.PUMPKIN); + public static ItemWrapper CARVED_PUMPKIN = of(net.minecraft.world.item.Items.CARVED_PUMPKIN); + public static ItemWrapper NETHERRACK = of(net.minecraft.world.item.Items.NETHERRACK); + public static ItemWrapper SOUL_SAND = of(net.minecraft.world.item.Items.SOUL_SAND); + public static ItemWrapper SOUL_SOIL = of(net.minecraft.world.item.Items.SOUL_SOIL); + public static ItemWrapper BASALT = of(net.minecraft.world.item.Items.BASALT); + public static ItemWrapper POLISHED_BASALT = of(net.minecraft.world.item.Items.POLISHED_BASALT); + public static ItemWrapper SOUL_TORCH = of(net.minecraft.world.item.Items.SOUL_TORCH); + public static ItemWrapper GLOWSTONE = of(net.minecraft.world.item.Items.GLOWSTONE); + public static ItemWrapper JACK_O_LANTERN = of(net.minecraft.world.item.Items.JACK_O_LANTERN); + public static ItemWrapper OAK_TRAPDOOR = of(net.minecraft.world.item.Items.OAK_TRAPDOOR); + public static ItemWrapper SPRUCE_TRAPDOOR = of(net.minecraft.world.item.Items.SPRUCE_TRAPDOOR); + public static ItemWrapper BIRCH_TRAPDOOR = of(net.minecraft.world.item.Items.BIRCH_TRAPDOOR); + public static ItemWrapper JUNGLE_TRAPDOOR = of(net.minecraft.world.item.Items.JUNGLE_TRAPDOOR); + public static ItemWrapper ACACIA_TRAPDOOR = of(net.minecraft.world.item.Items.ACACIA_TRAPDOOR); + public static ItemWrapper DARK_OAK_TRAPDOOR = of(net.minecraft.world.item.Items.DARK_OAK_TRAPDOOR); + public static ItemWrapper CRIMSON_TRAPDOOR = of(net.minecraft.world.item.Items.CRIMSON_TRAPDOOR); + public static ItemWrapper WARPED_TRAPDOOR = of(net.minecraft.world.item.Items.WARPED_TRAPDOOR); + public static ItemWrapper INFESTED_STONE = of(net.minecraft.world.item.Items.INFESTED_STONE); + public static ItemWrapper INFESTED_COBBLESTONE = of(net.minecraft.world.item.Items.INFESTED_COBBLESTONE); + public static ItemWrapper INFESTED_STONE_BRICKS = of(net.minecraft.world.item.Items.INFESTED_STONE_BRICKS); + public static ItemWrapper INFESTED_MOSSY_STONE_BRICKS = of(net.minecraft.world.item.Items.INFESTED_MOSSY_STONE_BRICKS); + public static ItemWrapper INFESTED_CRACKED_STONE_BRICKS = of(net.minecraft.world.item.Items.INFESTED_CRACKED_STONE_BRICKS); + public static ItemWrapper INFESTED_CHISELED_STONE_BRICKS = of(net.minecraft.world.item.Items.INFESTED_CHISELED_STONE_BRICKS); + public static ItemWrapper STONE_BRICKS = of(net.minecraft.world.item.Items.STONE_BRICKS); + public static ItemWrapper MOSSY_STONE_BRICKS = of(net.minecraft.world.item.Items.MOSSY_STONE_BRICKS); + public static ItemWrapper CRACKED_STONE_BRICKS = of(net.minecraft.world.item.Items.CRACKED_STONE_BRICKS); + public static ItemWrapper CHISELED_STONE_BRICKS = of(net.minecraft.world.item.Items.CHISELED_STONE_BRICKS); + public static ItemWrapper BROWN_MUSHROOM_BLOCK = of(net.minecraft.world.item.Items.BROWN_MUSHROOM_BLOCK); + public static ItemWrapper RED_MUSHROOM_BLOCK = of(net.minecraft.world.item.Items.RED_MUSHROOM_BLOCK); + public static ItemWrapper MUSHROOM_STEM = of(net.minecraft.world.item.Items.MUSHROOM_STEM); + public static ItemWrapper IRON_BARS = of(net.minecraft.world.item.Items.IRON_BARS); + public static ItemWrapper CHAIN = of(net.minecraft.world.item.Items.IRON_CHAIN); + public static ItemWrapper GLASS_PANE = of(net.minecraft.world.item.Items.GLASS_PANE); + public static ItemWrapper MELON = of(net.minecraft.world.item.Items.MELON); + public static ItemWrapper VINE = of(net.minecraft.world.item.Items.VINE); + public static ItemWrapper OAK_FENCE_GATE = of(net.minecraft.world.item.Items.OAK_FENCE_GATE); + public static ItemWrapper SPRUCE_FENCE_GATE = of(net.minecraft.world.item.Items.SPRUCE_FENCE_GATE); + public static ItemWrapper BIRCH_FENCE_GATE = of(net.minecraft.world.item.Items.BIRCH_FENCE_GATE); + public static ItemWrapper JUNGLE_FENCE_GATE = of(net.minecraft.world.item.Items.JUNGLE_FENCE_GATE); + public static ItemWrapper ACACIA_FENCE_GATE = of(net.minecraft.world.item.Items.ACACIA_FENCE_GATE); + public static ItemWrapper DARK_OAK_FENCE_GATE = of(net.minecraft.world.item.Items.DARK_OAK_FENCE_GATE); + public static ItemWrapper CRIMSON_FENCE_GATE = of(net.minecraft.world.item.Items.CRIMSON_FENCE_GATE); + public static ItemWrapper WARPED_FENCE_GATE = of(net.minecraft.world.item.Items.WARPED_FENCE_GATE); + public static ItemWrapper BRICK_STAIRS = of(net.minecraft.world.item.Items.BRICK_STAIRS); + public static ItemWrapper STONE_BRICK_STAIRS = of(net.minecraft.world.item.Items.STONE_BRICK_STAIRS); + public static ItemWrapper MYCELIUM = of(net.minecraft.world.item.Items.MYCELIUM); + public static ItemWrapper LILY_PAD = of(net.minecraft.world.item.Items.LILY_PAD); + public static ItemWrapper NETHER_BRICKS = of(net.minecraft.world.item.Items.NETHER_BRICKS); + public static ItemWrapper CRACKED_NETHER_BRICKS = of(net.minecraft.world.item.Items.CRACKED_NETHER_BRICKS); + public static ItemWrapper CHISELED_NETHER_BRICKS = of(net.minecraft.world.item.Items.CHISELED_NETHER_BRICKS); + public static ItemWrapper NETHER_BRICK_FENCE = of(net.minecraft.world.item.Items.NETHER_BRICK_FENCE); + public static ItemWrapper NETHER_BRICK_STAIRS = of(net.minecraft.world.item.Items.NETHER_BRICK_STAIRS); + public static ItemWrapper ENCHANTING_TABLE = of(net.minecraft.world.item.Items.ENCHANTING_TABLE); + public static ItemWrapper END_PORTAL_FRAME = of(net.minecraft.world.item.Items.END_PORTAL_FRAME); + public static ItemWrapper END_STONE = of(net.minecraft.world.item.Items.END_STONE); + public static ItemWrapper END_STONE_BRICKS = of(net.minecraft.world.item.Items.END_STONE_BRICKS); + public static ItemWrapper DRAGON_EGG = of(net.minecraft.world.item.Items.DRAGON_EGG); + public static ItemWrapper REDSTONE_LAMP = of(net.minecraft.world.item.Items.REDSTONE_LAMP); + public static ItemWrapper SANDSTONE_STAIRS = of(net.minecraft.world.item.Items.SANDSTONE_STAIRS); + public static ItemWrapper EMERALD_ORE = of(net.minecraft.world.item.Items.EMERALD_ORE); + public static ItemWrapper ENDER_CHEST = of(net.minecraft.world.item.Items.ENDER_CHEST); + public static ItemWrapper TRIPWIRE_HOOK = of(net.minecraft.world.item.Items.TRIPWIRE_HOOK); + public static ItemWrapper EMERALD_BLOCK = of(net.minecraft.world.item.Items.EMERALD_BLOCK); + public static ItemWrapper SPRUCE_STAIRS = of(net.minecraft.world.item.Items.SPRUCE_STAIRS); + public static ItemWrapper BIRCH_STAIRS = of(net.minecraft.world.item.Items.BIRCH_STAIRS); + public static ItemWrapper JUNGLE_STAIRS = of(net.minecraft.world.item.Items.JUNGLE_STAIRS); + public static ItemWrapper CRIMSON_STAIRS = of(net.minecraft.world.item.Items.CRIMSON_STAIRS); + public static ItemWrapper WARPED_STAIRS = of(net.minecraft.world.item.Items.WARPED_STAIRS); + public static ItemWrapper COMMAND_BLOCK = of(net.minecraft.world.item.Items.COMMAND_BLOCK); + public static ItemWrapper BEACON = of(net.minecraft.world.item.Items.BEACON); + public static ItemWrapper COBBLESTONE_WALL = of(net.minecraft.world.item.Items.COBBLESTONE_WALL); + public static ItemWrapper MOSSY_COBBLESTONE_WALL = of(net.minecraft.world.item.Items.MOSSY_COBBLESTONE_WALL); + public static ItemWrapper BRICK_WALL = of(net.minecraft.world.item.Items.BRICK_WALL); + public static ItemWrapper PRISMARINE_WALL = of(net.minecraft.world.item.Items.PRISMARINE_WALL); + public static ItemWrapper RED_SANDSTONE_WALL = of(net.minecraft.world.item.Items.RED_SANDSTONE_WALL); + public static ItemWrapper MOSSY_STONE_BRICK_WALL = of(net.minecraft.world.item.Items.MOSSY_STONE_BRICK_WALL); + public static ItemWrapper GRANITE_WALL = of(net.minecraft.world.item.Items.GRANITE_WALL); + public static ItemWrapper STONE_BRICK_WALL = of(net.minecraft.world.item.Items.STONE_BRICK_WALL); + public static ItemWrapper NETHER_BRICK_WALL = of(net.minecraft.world.item.Items.NETHER_BRICK_WALL); + public static ItemWrapper ANDESITE_WALL = of(net.minecraft.world.item.Items.ANDESITE_WALL); + public static ItemWrapper RED_NETHER_BRICK_WALL = of(net.minecraft.world.item.Items.RED_NETHER_BRICK_WALL); + public static ItemWrapper SANDSTONE_WALL = of(net.minecraft.world.item.Items.SANDSTONE_WALL); + public static ItemWrapper END_STONE_BRICK_WALL = of(net.minecraft.world.item.Items.END_STONE_BRICK_WALL); + public static ItemWrapper DIORITE_WALL = of(net.minecraft.world.item.Items.DIORITE_WALL); + public static ItemWrapper BLACKSTONE_WALL = of(net.minecraft.world.item.Items.BLACKSTONE_WALL); + public static ItemWrapper POLISHED_BLACKSTONE_WALL = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_WALL); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_WALL = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_BRICK_WALL); + public static ItemWrapper STONE_BUTTON = of(net.minecraft.world.item.Items.STONE_BUTTON); + public static ItemWrapper OAK_BUTTON = of(net.minecraft.world.item.Items.OAK_BUTTON); + public static ItemWrapper SPRUCE_BUTTON = of(net.minecraft.world.item.Items.SPRUCE_BUTTON); + public static ItemWrapper BIRCH_BUTTON = of(net.minecraft.world.item.Items.BIRCH_BUTTON); + public static ItemWrapper JUNGLE_BUTTON = of(net.minecraft.world.item.Items.JUNGLE_BUTTON); + public static ItemWrapper ACACIA_BUTTON = of(net.minecraft.world.item.Items.ACACIA_BUTTON); + public static ItemWrapper DARK_OAK_BUTTON = of(net.minecraft.world.item.Items.DARK_OAK_BUTTON); + public static ItemWrapper CRIMSON_BUTTON = of(net.minecraft.world.item.Items.CRIMSON_BUTTON); + public static ItemWrapper WARPED_BUTTON = of(net.minecraft.world.item.Items.WARPED_BUTTON); + public static ItemWrapper POLISHED_BLACKSTONE_BUTTON = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_BUTTON); + public static ItemWrapper ANVIL = of(net.minecraft.world.item.Items.ANVIL); + public static ItemWrapper CHIPPED_ANVIL = of(net.minecraft.world.item.Items.CHIPPED_ANVIL); + public static ItemWrapper DAMAGED_ANVIL = of(net.minecraft.world.item.Items.DAMAGED_ANVIL); + public static ItemWrapper TRAPPED_CHEST = of(net.minecraft.world.item.Items.TRAPPED_CHEST); + public static ItemWrapper LIGHT_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.world.item.Items.LIGHT_WEIGHTED_PRESSURE_PLATE); + public static ItemWrapper HEAVY_WEIGHTED_PRESSURE_PLATE = of(net.minecraft.world.item.Items.HEAVY_WEIGHTED_PRESSURE_PLATE); + public static ItemWrapper DAYLIGHT_DETECTOR = of(net.minecraft.world.item.Items.DAYLIGHT_DETECTOR); + public static ItemWrapper REDSTONE_BLOCK = of(net.minecraft.world.item.Items.REDSTONE_BLOCK); + public static ItemWrapper NETHER_QUARTZ_ORE = of(net.minecraft.world.item.Items.NETHER_QUARTZ_ORE); + public static ItemWrapper HOPPER = of(net.minecraft.world.item.Items.HOPPER); + public static ItemWrapper CHISELED_QUARTZ_BLOCK = of(net.minecraft.world.item.Items.CHISELED_QUARTZ_BLOCK); + public static ItemWrapper QUARTZ_BLOCK = of(net.minecraft.world.item.Items.QUARTZ_BLOCK); + public static ItemWrapper QUARTZ_BRICKS = of(net.minecraft.world.item.Items.QUARTZ_BRICKS); + public static ItemWrapper QUARTZ_PILLAR = of(net.minecraft.world.item.Items.QUARTZ_PILLAR); + public static ItemWrapper QUARTZ_STAIRS = of(net.minecraft.world.item.Items.QUARTZ_STAIRS); + public static ItemWrapper ACTIVATOR_RAIL = of(net.minecraft.world.item.Items.ACTIVATOR_RAIL); + public static ItemWrapper DROPPER = of(net.minecraft.world.item.Items.DROPPER); + public static ItemWrapper WHITE_TERRACOTTA = of(net.minecraft.world.item.Items.WHITE_TERRACOTTA); + public static ItemWrapper ORANGE_TERRACOTTA = of(net.minecraft.world.item.Items.ORANGE_TERRACOTTA); + public static ItemWrapper MAGENTA_TERRACOTTA = of(net.minecraft.world.item.Items.MAGENTA_TERRACOTTA); + public static ItemWrapper LIGHT_BLUE_TERRACOTTA = of(net.minecraft.world.item.Items.LIGHT_BLUE_TERRACOTTA); + public static ItemWrapper YELLOW_TERRACOTTA = of(net.minecraft.world.item.Items.YELLOW_TERRACOTTA); + public static ItemWrapper LIME_TERRACOTTA = of(net.minecraft.world.item.Items.LIME_TERRACOTTA); + public static ItemWrapper PINK_TERRACOTTA = of(net.minecraft.world.item.Items.PINK_TERRACOTTA); + public static ItemWrapper GRAY_TERRACOTTA = of(net.minecraft.world.item.Items.GRAY_TERRACOTTA); + public static ItemWrapper LIGHT_GRAY_TERRACOTTA = of(net.minecraft.world.item.Items.LIGHT_GRAY_TERRACOTTA); + public static ItemWrapper CYAN_TERRACOTTA = of(net.minecraft.world.item.Items.CYAN_TERRACOTTA); + public static ItemWrapper PURPLE_TERRACOTTA = of(net.minecraft.world.item.Items.PURPLE_TERRACOTTA); + public static ItemWrapper BLUE_TERRACOTTA = of(net.minecraft.world.item.Items.BLUE_TERRACOTTA); + public static ItemWrapper BROWN_TERRACOTTA = of(net.minecraft.world.item.Items.BROWN_TERRACOTTA); + public static ItemWrapper GREEN_TERRACOTTA = of(net.minecraft.world.item.Items.GREEN_TERRACOTTA); + public static ItemWrapper RED_TERRACOTTA = of(net.minecraft.world.item.Items.RED_TERRACOTTA); + public static ItemWrapper BLACK_TERRACOTTA = of(net.minecraft.world.item.Items.BLACK_TERRACOTTA); + public static ItemWrapper BARRIER = of(net.minecraft.world.item.Items.BARRIER); + public static ItemWrapper IRON_TRAPDOOR = of(net.minecraft.world.item.Items.IRON_TRAPDOOR); + public static ItemWrapper HAY_BLOCK = of(net.minecraft.world.item.Items.HAY_BLOCK); + public static ItemWrapper WHITE_CARPET = of(net.minecraft.world.item.Items.WHITE_CARPET); + public static ItemWrapper ORANGE_CARPET = of(net.minecraft.world.item.Items.ORANGE_CARPET); + public static ItemWrapper MAGENTA_CARPET = of(net.minecraft.world.item.Items.MAGENTA_CARPET); + public static ItemWrapper LIGHT_BLUE_CARPET = of(net.minecraft.world.item.Items.LIGHT_BLUE_CARPET); + public static ItemWrapper YELLOW_CARPET = of(net.minecraft.world.item.Items.YELLOW_CARPET); + public static ItemWrapper LIME_CARPET = of(net.minecraft.world.item.Items.LIME_CARPET); + public static ItemWrapper PINK_CARPET = of(net.minecraft.world.item.Items.PINK_CARPET); + public static ItemWrapper GRAY_CARPET = of(net.minecraft.world.item.Items.GRAY_CARPET); + public static ItemWrapper LIGHT_GRAY_CARPET = of(net.minecraft.world.item.Items.LIGHT_GRAY_CARPET); + public static ItemWrapper CYAN_CARPET = of(net.minecraft.world.item.Items.CYAN_CARPET); + public static ItemWrapper PURPLE_CARPET = of(net.minecraft.world.item.Items.PURPLE_CARPET); + public static ItemWrapper BLUE_CARPET = of(net.minecraft.world.item.Items.BLUE_CARPET); + public static ItemWrapper BROWN_CARPET = of(net.minecraft.world.item.Items.BROWN_CARPET); + public static ItemWrapper GREEN_CARPET = of(net.minecraft.world.item.Items.GREEN_CARPET); + public static ItemWrapper RED_CARPET = of(net.minecraft.world.item.Items.RED_CARPET); + public static ItemWrapper BLACK_CARPET = of(net.minecraft.world.item.Items.BLACK_CARPET); + public static ItemWrapper TERRACOTTA = of(net.minecraft.world.item.Items.TERRACOTTA); + public static ItemWrapper COAL_BLOCK = of(net.minecraft.world.item.Items.COAL_BLOCK); + public static ItemWrapper PACKED_ICE = of(net.minecraft.world.item.Items.PACKED_ICE); + public static ItemWrapper ACACIA_STAIRS = of(net.minecraft.world.item.Items.ACACIA_STAIRS); + public static ItemWrapper DARK_OAK_STAIRS = of(net.minecraft.world.item.Items.DARK_OAK_STAIRS); + public static ItemWrapper SLIME_BLOCK = of(net.minecraft.world.item.Items.SLIME_BLOCK); + public static ItemWrapper GRASS_PATH = of(net.minecraft.world.item.Items.DIRT_PATH); + public static ItemWrapper SUNFLOWER = of(net.minecraft.world.item.Items.SUNFLOWER); + public static ItemWrapper LILAC = of(net.minecraft.world.item.Items.LILAC); + public static ItemWrapper ROSE_BUSH = of(net.minecraft.world.item.Items.ROSE_BUSH); + public static ItemWrapper PEONY = of(net.minecraft.world.item.Items.PEONY); + public static ItemWrapper TALL_GRASS = of(net.minecraft.world.item.Items.TALL_GRASS); + public static ItemWrapper LARGE_FERN = of(net.minecraft.world.item.Items.LARGE_FERN); + public static ItemWrapper WHITE_STAINED_GLASS = of(net.minecraft.world.item.Items.WHITE_STAINED_GLASS); + public static ItemWrapper ORANGE_STAINED_GLASS = of(net.minecraft.world.item.Items.ORANGE_STAINED_GLASS); + public static ItemWrapper MAGENTA_STAINED_GLASS = of(net.minecraft.world.item.Items.MAGENTA_STAINED_GLASS); + public static ItemWrapper LIGHT_BLUE_STAINED_GLASS = of(net.minecraft.world.item.Items.LIGHT_BLUE_STAINED_GLASS); + public static ItemWrapper YELLOW_STAINED_GLASS = of(net.minecraft.world.item.Items.YELLOW_STAINED_GLASS); + public static ItemWrapper LIME_STAINED_GLASS = of(net.minecraft.world.item.Items.LIME_STAINED_GLASS); + public static ItemWrapper PINK_STAINED_GLASS = of(net.minecraft.world.item.Items.PINK_STAINED_GLASS); + public static ItemWrapper GRAY_STAINED_GLASS = of(net.minecraft.world.item.Items.GRAY_STAINED_GLASS); + public static ItemWrapper LIGHT_GRAY_STAINED_GLASS = of(net.minecraft.world.item.Items.LIGHT_GRAY_STAINED_GLASS); + public static ItemWrapper CYAN_STAINED_GLASS = of(net.minecraft.world.item.Items.CYAN_STAINED_GLASS); + public static ItemWrapper PURPLE_STAINED_GLASS = of(net.minecraft.world.item.Items.PURPLE_STAINED_GLASS); + public static ItemWrapper BLUE_STAINED_GLASS = of(net.minecraft.world.item.Items.BLUE_STAINED_GLASS); + public static ItemWrapper BROWN_STAINED_GLASS = of(net.minecraft.world.item.Items.BROWN_STAINED_GLASS); + public static ItemWrapper GREEN_STAINED_GLASS = of(net.minecraft.world.item.Items.GREEN_STAINED_GLASS); + public static ItemWrapper RED_STAINED_GLASS = of(net.minecraft.world.item.Items.RED_STAINED_GLASS); + public static ItemWrapper BLACK_STAINED_GLASS = of(net.minecraft.world.item.Items.BLACK_STAINED_GLASS); + public static ItemWrapper WHITE_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.WHITE_STAINED_GLASS_PANE); + public static ItemWrapper ORANGE_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.ORANGE_STAINED_GLASS_PANE); + public static ItemWrapper MAGENTA_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.MAGENTA_STAINED_GLASS_PANE); + public static ItemWrapper LIGHT_BLUE_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.LIGHT_BLUE_STAINED_GLASS_PANE); + public static ItemWrapper YELLOW_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.YELLOW_STAINED_GLASS_PANE); + public static ItemWrapper LIME_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.LIME_STAINED_GLASS_PANE); + public static ItemWrapper PINK_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.PINK_STAINED_GLASS_PANE); + public static ItemWrapper GRAY_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.GRAY_STAINED_GLASS_PANE); + public static ItemWrapper LIGHT_GRAY_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.LIGHT_GRAY_STAINED_GLASS_PANE); + public static ItemWrapper CYAN_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.CYAN_STAINED_GLASS_PANE); + public static ItemWrapper PURPLE_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.PURPLE_STAINED_GLASS_PANE); + public static ItemWrapper BLUE_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.BLUE_STAINED_GLASS_PANE); + public static ItemWrapper BROWN_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.BROWN_STAINED_GLASS_PANE); + public static ItemWrapper GREEN_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.GREEN_STAINED_GLASS_PANE); + public static ItemWrapper RED_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.RED_STAINED_GLASS_PANE); + public static ItemWrapper BLACK_STAINED_GLASS_PANE = of(net.minecraft.world.item.Items.BLACK_STAINED_GLASS_PANE); + public static ItemWrapper PRISMARINE = of(net.minecraft.world.item.Items.PRISMARINE); + public static ItemWrapper PRISMARINE_BRICKS = of(net.minecraft.world.item.Items.PRISMARINE_BRICKS); + public static ItemWrapper DARK_PRISMARINE = of(net.minecraft.world.item.Items.DARK_PRISMARINE); + public static ItemWrapper PRISMARINE_STAIRS = of(net.minecraft.world.item.Items.PRISMARINE_STAIRS); + public static ItemWrapper PRISMARINE_BRICK_STAIRS = of(net.minecraft.world.item.Items.PRISMARINE_BRICK_STAIRS); + public static ItemWrapper DARK_PRISMARINE_STAIRS = of(net.minecraft.world.item.Items.DARK_PRISMARINE_STAIRS); + public static ItemWrapper SEA_LANTERN = of(net.minecraft.world.item.Items.SEA_LANTERN); + public static ItemWrapper RED_SANDSTONE = of(net.minecraft.world.item.Items.RED_SANDSTONE); + public static ItemWrapper CHISELED_RED_SANDSTONE = of(net.minecraft.world.item.Items.CHISELED_RED_SANDSTONE); + public static ItemWrapper CUT_RED_SANDSTONE = of(net.minecraft.world.item.Items.CUT_RED_SANDSTONE); + public static ItemWrapper RED_SANDSTONE_STAIRS = of(net.minecraft.world.item.Items.RED_SANDSTONE_STAIRS); + public static ItemWrapper REPEATING_COMMAND_BLOCK = of(net.minecraft.world.item.Items.REPEATING_COMMAND_BLOCK); + public static ItemWrapper CHAIN_COMMAND_BLOCK = of(net.minecraft.world.item.Items.CHAIN_COMMAND_BLOCK); + public static ItemWrapper MAGMA_BLOCK = of(net.minecraft.world.item.Items.MAGMA_BLOCK); + public static ItemWrapper NETHER_WART_BLOCK = of(net.minecraft.world.item.Items.NETHER_WART_BLOCK); + public static ItemWrapper WARPED_WART_BLOCK = of(net.minecraft.world.item.Items.WARPED_WART_BLOCK); + public static ItemWrapper RED_NETHER_BRICKS = of(net.minecraft.world.item.Items.RED_NETHER_BRICKS); + public static ItemWrapper BONE_BLOCK = of(net.minecraft.world.item.Items.BONE_BLOCK); + public static ItemWrapper STRUCTURE_VOID = of(net.minecraft.world.item.Items.STRUCTURE_VOID); + public static ItemWrapper OBSERVER = of(net.minecraft.world.item.Items.OBSERVER); + public static ItemWrapper SHULKER_BOX = of(net.minecraft.world.item.Items.SHULKER_BOX); + public static ItemWrapper WHITE_SHULKER_BOX = of(net.minecraft.world.item.Items.WHITE_SHULKER_BOX); + public static ItemWrapper ORANGE_SHULKER_BOX = of(net.minecraft.world.item.Items.ORANGE_SHULKER_BOX); + public static ItemWrapper MAGENTA_SHULKER_BOX = of(net.minecraft.world.item.Items.MAGENTA_SHULKER_BOX); + public static ItemWrapper LIGHT_BLUE_SHULKER_BOX = of(net.minecraft.world.item.Items.LIGHT_BLUE_SHULKER_BOX); + public static ItemWrapper YELLOW_SHULKER_BOX = of(net.minecraft.world.item.Items.YELLOW_SHULKER_BOX); + public static ItemWrapper LIME_SHULKER_BOX = of(net.minecraft.world.item.Items.LIME_SHULKER_BOX); + public static ItemWrapper PINK_SHULKER_BOX = of(net.minecraft.world.item.Items.PINK_SHULKER_BOX); + public static ItemWrapper GRAY_SHULKER_BOX = of(net.minecraft.world.item.Items.GRAY_SHULKER_BOX); + public static ItemWrapper LIGHT_GRAY_SHULKER_BOX = of(net.minecraft.world.item.Items.LIGHT_GRAY_SHULKER_BOX); + public static ItemWrapper CYAN_SHULKER_BOX = of(net.minecraft.world.item.Items.CYAN_SHULKER_BOX); + public static ItemWrapper PURPLE_SHULKER_BOX = of(net.minecraft.world.item.Items.PURPLE_SHULKER_BOX); + public static ItemWrapper BLUE_SHULKER_BOX = of(net.minecraft.world.item.Items.BLUE_SHULKER_BOX); + public static ItemWrapper BROWN_SHULKER_BOX = of(net.minecraft.world.item.Items.BROWN_SHULKER_BOX); + public static ItemWrapper GREEN_SHULKER_BOX = of(net.minecraft.world.item.Items.GREEN_SHULKER_BOX); + public static ItemWrapper RED_SHULKER_BOX = of(net.minecraft.world.item.Items.RED_SHULKER_BOX); + public static ItemWrapper BLACK_SHULKER_BOX = of(net.minecraft.world.item.Items.BLACK_SHULKER_BOX); + public static ItemWrapper WHITE_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.WHITE_GLAZED_TERRACOTTA); + public static ItemWrapper ORANGE_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.ORANGE_GLAZED_TERRACOTTA); + public static ItemWrapper MAGENTA_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.MAGENTA_GLAZED_TERRACOTTA); + public static ItemWrapper LIGHT_BLUE_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.LIGHT_BLUE_GLAZED_TERRACOTTA); + public static ItemWrapper YELLOW_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.YELLOW_GLAZED_TERRACOTTA); + public static ItemWrapper LIME_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.LIME_GLAZED_TERRACOTTA); + public static ItemWrapper PINK_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.PINK_GLAZED_TERRACOTTA); + public static ItemWrapper GRAY_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.GRAY_GLAZED_TERRACOTTA); + public static ItemWrapper LIGHT_GRAY_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.LIGHT_GRAY_GLAZED_TERRACOTTA); + public static ItemWrapper CYAN_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.CYAN_GLAZED_TERRACOTTA); + public static ItemWrapper PURPLE_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.PURPLE_GLAZED_TERRACOTTA); + public static ItemWrapper BLUE_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.BLUE_GLAZED_TERRACOTTA); + public static ItemWrapper BROWN_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.BROWN_GLAZED_TERRACOTTA); + public static ItemWrapper GREEN_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.GREEN_GLAZED_TERRACOTTA); + public static ItemWrapper RED_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.RED_GLAZED_TERRACOTTA); + public static ItemWrapper BLACK_GLAZED_TERRACOTTA = of(net.minecraft.world.item.Items.BLACK_GLAZED_TERRACOTTA); + public static ItemWrapper WHITE_CONCRETE = of(net.minecraft.world.item.Items.WHITE_CONCRETE); + public static ItemWrapper ORANGE_CONCRETE = of(net.minecraft.world.item.Items.ORANGE_CONCRETE); + public static ItemWrapper MAGENTA_CONCRETE = of(net.minecraft.world.item.Items.MAGENTA_CONCRETE); + public static ItemWrapper LIGHT_BLUE_CONCRETE = of(net.minecraft.world.item.Items.LIGHT_BLUE_CONCRETE); + public static ItemWrapper YELLOW_CONCRETE = of(net.minecraft.world.item.Items.YELLOW_CONCRETE); + public static ItemWrapper LIME_CONCRETE = of(net.minecraft.world.item.Items.LIME_CONCRETE); + public static ItemWrapper PINK_CONCRETE = of(net.minecraft.world.item.Items.PINK_CONCRETE); + public static ItemWrapper GRAY_CONCRETE = of(net.minecraft.world.item.Items.GRAY_CONCRETE); + public static ItemWrapper LIGHT_GRAY_CONCRETE = of(net.minecraft.world.item.Items.LIGHT_GRAY_CONCRETE); + public static ItemWrapper CYAN_CONCRETE = of(net.minecraft.world.item.Items.CYAN_CONCRETE); + public static ItemWrapper PURPLE_CONCRETE = of(net.minecraft.world.item.Items.PURPLE_CONCRETE); + public static ItemWrapper BLUE_CONCRETE = of(net.minecraft.world.item.Items.BLUE_CONCRETE); + public static ItemWrapper BROWN_CONCRETE = of(net.minecraft.world.item.Items.BROWN_CONCRETE); + public static ItemWrapper GREEN_CONCRETE = of(net.minecraft.world.item.Items.GREEN_CONCRETE); + public static ItemWrapper RED_CONCRETE = of(net.minecraft.world.item.Items.RED_CONCRETE); + public static ItemWrapper BLACK_CONCRETE = of(net.minecraft.world.item.Items.BLACK_CONCRETE); + public static ItemWrapper WHITE_CONCRETE_POWDER = of(net.minecraft.world.item.Items.WHITE_CONCRETE_POWDER); + public static ItemWrapper ORANGE_CONCRETE_POWDER = of(net.minecraft.world.item.Items.ORANGE_CONCRETE_POWDER); + public static ItemWrapper MAGENTA_CONCRETE_POWDER = of(net.minecraft.world.item.Items.MAGENTA_CONCRETE_POWDER); + public static ItemWrapper LIGHT_BLUE_CONCRETE_POWDER = of(net.minecraft.world.item.Items.LIGHT_BLUE_CONCRETE_POWDER); + public static ItemWrapper YELLOW_CONCRETE_POWDER = of(net.minecraft.world.item.Items.YELLOW_CONCRETE_POWDER); + public static ItemWrapper LIME_CONCRETE_POWDER = of(net.minecraft.world.item.Items.LIME_CONCRETE_POWDER); + public static ItemWrapper PINK_CONCRETE_POWDER = of(net.minecraft.world.item.Items.PINK_CONCRETE_POWDER); + public static ItemWrapper GRAY_CONCRETE_POWDER = of(net.minecraft.world.item.Items.GRAY_CONCRETE_POWDER); + public static ItemWrapper LIGHT_GRAY_CONCRETE_POWDER = of(net.minecraft.world.item.Items.LIGHT_GRAY_CONCRETE_POWDER); + public static ItemWrapper CYAN_CONCRETE_POWDER = of(net.minecraft.world.item.Items.CYAN_CONCRETE_POWDER); + public static ItemWrapper PURPLE_CONCRETE_POWDER = of(net.minecraft.world.item.Items.PURPLE_CONCRETE_POWDER); + public static ItemWrapper BLUE_CONCRETE_POWDER = of(net.minecraft.world.item.Items.BLUE_CONCRETE_POWDER); + public static ItemWrapper BROWN_CONCRETE_POWDER = of(net.minecraft.world.item.Items.BROWN_CONCRETE_POWDER); + public static ItemWrapper GREEN_CONCRETE_POWDER = of(net.minecraft.world.item.Items.GREEN_CONCRETE_POWDER); + public static ItemWrapper RED_CONCRETE_POWDER = of(net.minecraft.world.item.Items.RED_CONCRETE_POWDER); + public static ItemWrapper BLACK_CONCRETE_POWDER = of(net.minecraft.world.item.Items.BLACK_CONCRETE_POWDER); + public static ItemWrapper TURTLE_EGG = of(net.minecraft.world.item.Items.TURTLE_EGG); + public static ItemWrapper DEAD_TUBE_CORAL_BLOCK = of(net.minecraft.world.item.Items.DEAD_TUBE_CORAL_BLOCK); + public static ItemWrapper DEAD_BRAIN_CORAL_BLOCK = of(net.minecraft.world.item.Items.DEAD_BRAIN_CORAL_BLOCK); + public static ItemWrapper DEAD_BUBBLE_CORAL_BLOCK = of(net.minecraft.world.item.Items.DEAD_BUBBLE_CORAL_BLOCK); + public static ItemWrapper DEAD_FIRE_CORAL_BLOCK = of(net.minecraft.world.item.Items.DEAD_FIRE_CORAL_BLOCK); + public static ItemWrapper DEAD_HORN_CORAL_BLOCK = of(net.minecraft.world.item.Items.DEAD_HORN_CORAL_BLOCK); + public static ItemWrapper TUBE_CORAL_BLOCK = of(net.minecraft.world.item.Items.TUBE_CORAL_BLOCK); + public static ItemWrapper BRAIN_CORAL_BLOCK = of(net.minecraft.world.item.Items.BRAIN_CORAL_BLOCK); + public static ItemWrapper BUBBLE_CORAL_BLOCK = of(net.minecraft.world.item.Items.BUBBLE_CORAL_BLOCK); + public static ItemWrapper FIRE_CORAL_BLOCK = of(net.minecraft.world.item.Items.FIRE_CORAL_BLOCK); + public static ItemWrapper HORN_CORAL_BLOCK = of(net.minecraft.world.item.Items.HORN_CORAL_BLOCK); + public static ItemWrapper TUBE_CORAL = of(net.minecraft.world.item.Items.TUBE_CORAL); + public static ItemWrapper BRAIN_CORAL = of(net.minecraft.world.item.Items.BRAIN_CORAL); + public static ItemWrapper BUBBLE_CORAL = of(net.minecraft.world.item.Items.BUBBLE_CORAL); + public static ItemWrapper FIRE_CORAL = of(net.minecraft.world.item.Items.FIRE_CORAL); + public static ItemWrapper HORN_CORAL = of(net.minecraft.world.item.Items.HORN_CORAL); + public static ItemWrapper DEAD_BRAIN_CORAL = of(net.minecraft.world.item.Items.DEAD_BRAIN_CORAL); + public static ItemWrapper DEAD_BUBBLE_CORAL = of(net.minecraft.world.item.Items.DEAD_BUBBLE_CORAL); + public static ItemWrapper DEAD_FIRE_CORAL = of(net.minecraft.world.item.Items.DEAD_FIRE_CORAL); + public static ItemWrapper DEAD_HORN_CORAL = of(net.minecraft.world.item.Items.DEAD_HORN_CORAL); + public static ItemWrapper DEAD_TUBE_CORAL = of(net.minecraft.world.item.Items.DEAD_TUBE_CORAL); + public static ItemWrapper TUBE_CORAL_FAN = of(net.minecraft.world.item.Items.TUBE_CORAL_FAN); + public static ItemWrapper BRAIN_CORAL_FAN = of(net.minecraft.world.item.Items.BRAIN_CORAL_FAN); + public static ItemWrapper BUBBLE_CORAL_FAN = of(net.minecraft.world.item.Items.BUBBLE_CORAL_FAN); + public static ItemWrapper FIRE_CORAL_FAN = of(net.minecraft.world.item.Items.FIRE_CORAL_FAN); + public static ItemWrapper HORN_CORAL_FAN = of(net.minecraft.world.item.Items.HORN_CORAL_FAN); + public static ItemWrapper DEAD_TUBE_CORAL_FAN = of(net.minecraft.world.item.Items.DEAD_TUBE_CORAL_FAN); + public static ItemWrapper DEAD_BRAIN_CORAL_FAN = of(net.minecraft.world.item.Items.DEAD_BRAIN_CORAL_FAN); + public static ItemWrapper DEAD_BUBBLE_CORAL_FAN = of(net.minecraft.world.item.Items.DEAD_BUBBLE_CORAL_FAN); + public static ItemWrapper DEAD_FIRE_CORAL_FAN = of(net.minecraft.world.item.Items.DEAD_FIRE_CORAL_FAN); + public static ItemWrapper DEAD_HORN_CORAL_FAN = of(net.minecraft.world.item.Items.DEAD_HORN_CORAL_FAN); + public static ItemWrapper BLUE_ICE = of(net.minecraft.world.item.Items.BLUE_ICE); + public static ItemWrapper CONDUIT = of(net.minecraft.world.item.Items.CONDUIT); + public static ItemWrapper POLISHED_GRANITE_STAIRS = of(net.minecraft.world.item.Items.POLISHED_GRANITE_STAIRS); + public static ItemWrapper SMOOTH_RED_SANDSTONE_STAIRS = of(net.minecraft.world.item.Items.SMOOTH_RED_SANDSTONE_STAIRS); + public static ItemWrapper MOSSY_STONE_BRICK_STAIRS = of(net.minecraft.world.item.Items.MOSSY_STONE_BRICK_STAIRS); + public static ItemWrapper POLISHED_DIORITE_STAIRS = of(net.minecraft.world.item.Items.POLISHED_DIORITE_STAIRS); + public static ItemWrapper MOSSY_COBBLESTONE_STAIRS = of(net.minecraft.world.item.Items.MOSSY_COBBLESTONE_STAIRS); + public static ItemWrapper END_STONE_BRICK_STAIRS = of(net.minecraft.world.item.Items.END_STONE_BRICK_STAIRS); + public static ItemWrapper STONE_STAIRS = of(net.minecraft.world.item.Items.STONE_STAIRS); + public static ItemWrapper SMOOTH_SANDSTONE_STAIRS = of(net.minecraft.world.item.Items.SMOOTH_SANDSTONE_STAIRS); + public static ItemWrapper SMOOTH_QUARTZ_STAIRS = of(net.minecraft.world.item.Items.SMOOTH_QUARTZ_STAIRS); + public static ItemWrapper GRANITE_STAIRS = of(net.minecraft.world.item.Items.GRANITE_STAIRS); + public static ItemWrapper ANDESITE_STAIRS = of(net.minecraft.world.item.Items.ANDESITE_STAIRS); + public static ItemWrapper RED_NETHER_BRICK_STAIRS = of(net.minecraft.world.item.Items.RED_NETHER_BRICK_STAIRS); + public static ItemWrapper POLISHED_ANDESITE_STAIRS = of(net.minecraft.world.item.Items.POLISHED_ANDESITE_STAIRS); + public static ItemWrapper DIORITE_STAIRS = of(net.minecraft.world.item.Items.DIORITE_STAIRS); + public static ItemWrapper POLISHED_GRANITE_SLAB = of(net.minecraft.world.item.Items.POLISHED_GRANITE_SLAB); + public static ItemWrapper SMOOTH_RED_SANDSTONE_SLAB = of(net.minecraft.world.item.Items.SMOOTH_RED_SANDSTONE_SLAB); + public static ItemWrapper MOSSY_STONE_BRICK_SLAB = of(net.minecraft.world.item.Items.MOSSY_STONE_BRICK_SLAB); + public static ItemWrapper POLISHED_DIORITE_SLAB = of(net.minecraft.world.item.Items.POLISHED_DIORITE_SLAB); + public static ItemWrapper MOSSY_COBBLESTONE_SLAB = of(net.minecraft.world.item.Items.MOSSY_COBBLESTONE_SLAB); + public static ItemWrapper END_STONE_BRICK_SLAB = of(net.minecraft.world.item.Items.END_STONE_BRICK_SLAB); + public static ItemWrapper SMOOTH_SANDSTONE_SLAB = of(net.minecraft.world.item.Items.SMOOTH_SANDSTONE_SLAB); + public static ItemWrapper SMOOTH_QUARTZ_SLAB = of(net.minecraft.world.item.Items.SMOOTH_QUARTZ_SLAB); + public static ItemWrapper GRANITE_SLAB = of(net.minecraft.world.item.Items.GRANITE_SLAB); + public static ItemWrapper ANDESITE_SLAB = of(net.minecraft.world.item.Items.ANDESITE_SLAB); + public static ItemWrapper RED_NETHER_BRICK_SLAB = of(net.minecraft.world.item.Items.RED_NETHER_BRICK_SLAB); + public static ItemWrapper POLISHED_ANDESITE_SLAB = of(net.minecraft.world.item.Items.POLISHED_ANDESITE_SLAB); + public static ItemWrapper DIORITE_SLAB = of(net.minecraft.world.item.Items.DIORITE_SLAB); + public static ItemWrapper SCAFFOLDING = of(net.minecraft.world.item.Items.SCAFFOLDING); + public static ItemWrapper IRON_DOOR = of(net.minecraft.world.item.Items.IRON_DOOR); + public static ItemWrapper OAK_DOOR = of(net.minecraft.world.item.Items.OAK_DOOR); + public static ItemWrapper SPRUCE_DOOR = of(net.minecraft.world.item.Items.SPRUCE_DOOR); + public static ItemWrapper BIRCH_DOOR = of(net.minecraft.world.item.Items.BIRCH_DOOR); + public static ItemWrapper JUNGLE_DOOR = of(net.minecraft.world.item.Items.JUNGLE_DOOR); + public static ItemWrapper ACACIA_DOOR = of(net.minecraft.world.item.Items.ACACIA_DOOR); + public static ItemWrapper DARK_OAK_DOOR = of(net.minecraft.world.item.Items.DARK_OAK_DOOR); + public static ItemWrapper CRIMSON_DOOR = of(net.minecraft.world.item.Items.CRIMSON_DOOR); + public static ItemWrapper WARPED_DOOR = of(net.minecraft.world.item.Items.WARPED_DOOR); + public static ItemWrapper REPEATER = of(net.minecraft.world.item.Items.REPEATER); + public static ItemWrapper COMPARATOR = of(net.minecraft.world.item.Items.COMPARATOR); + public static ItemWrapper STRUCTURE_BLOCK = of(net.minecraft.world.item.Items.STRUCTURE_BLOCK); + public static ItemWrapper JIGSAW = of(net.minecraft.world.item.Items.JIGSAW); + public static ItemWrapper TURTLE_HELMET = of(net.minecraft.world.item.Items.TURTLE_HELMET); + public static ItemWrapper SCUTE = of(net.minecraft.world.item.Items.TURTLE_SCUTE); + public static ItemWrapper FLINT_AND_STEEL = of(net.minecraft.world.item.Items.FLINT_AND_STEEL); + public static ItemWrapper APPLE = of(net.minecraft.world.item.Items.APPLE); + public static ItemWrapper BOW = of(net.minecraft.world.item.Items.BOW); + public static ItemWrapper ARROW = of(net.minecraft.world.item.Items.ARROW); + public static ItemWrapper COAL = of(net.minecraft.world.item.Items.COAL); + public static ItemWrapper CHARCOAL = of(net.minecraft.world.item.Items.CHARCOAL); + public static ItemWrapper DIAMOND = of(net.minecraft.world.item.Items.DIAMOND); + public static ItemWrapper IRON_INGOT = of(net.minecraft.world.item.Items.IRON_INGOT); + public static ItemWrapper GOLD_INGOT = of(net.minecraft.world.item.Items.GOLD_INGOT); + public static ItemWrapper NETHERITE_INGOT = of(net.minecraft.world.item.Items.NETHERITE_INGOT); + public static ItemWrapper NETHERITE_SCRAP = of(net.minecraft.world.item.Items.NETHERITE_SCRAP); + public static ItemWrapper WOODEN_SWORD = of(net.minecraft.world.item.Items.WOODEN_SWORD); + public static ItemWrapper WOODEN_SHOVEL = of(net.minecraft.world.item.Items.WOODEN_SHOVEL); + public static ItemWrapper WOODEN_PICKAXE = of(net.minecraft.world.item.Items.WOODEN_PICKAXE); + public static ItemWrapper WOODEN_AXE = of(net.minecraft.world.item.Items.WOODEN_AXE); + public static ItemWrapper WOODEN_HOE = of(net.minecraft.world.item.Items.WOODEN_HOE); + public static ItemWrapper STONE_SWORD = of(net.minecraft.world.item.Items.STONE_SWORD); + public static ItemWrapper STONE_SHOVEL = of(net.minecraft.world.item.Items.STONE_SHOVEL); + public static ItemWrapper STONE_PICKAXE = of(net.minecraft.world.item.Items.STONE_PICKAXE); + public static ItemWrapper STONE_AXE = of(net.minecraft.world.item.Items.STONE_AXE); + public static ItemWrapper STONE_HOE = of(net.minecraft.world.item.Items.STONE_HOE); + public static ItemWrapper GOLDEN_SWORD = of(net.minecraft.world.item.Items.GOLDEN_SWORD); + public static ItemWrapper GOLDEN_SHOVEL = of(net.minecraft.world.item.Items.GOLDEN_SHOVEL); + public static ItemWrapper GOLDEN_PICKAXE = of(net.minecraft.world.item.Items.GOLDEN_PICKAXE); + public static ItemWrapper GOLDEN_AXE = of(net.minecraft.world.item.Items.GOLDEN_AXE); + public static ItemWrapper GOLDEN_HOE = of(net.minecraft.world.item.Items.GOLDEN_HOE); + public static ItemWrapper IRON_SWORD = of(net.minecraft.world.item.Items.IRON_SWORD); + public static ItemWrapper IRON_SHOVEL = of(net.minecraft.world.item.Items.IRON_SHOVEL); + public static ItemWrapper IRON_PICKAXE = of(net.minecraft.world.item.Items.IRON_PICKAXE); + public static ItemWrapper IRON_AXE = of(net.minecraft.world.item.Items.IRON_AXE); + public static ItemWrapper IRON_HOE = of(net.minecraft.world.item.Items.IRON_HOE); + public static ItemWrapper DIAMOND_SWORD = of(net.minecraft.world.item.Items.DIAMOND_SWORD); + public static ItemWrapper DIAMOND_SHOVEL = of(net.minecraft.world.item.Items.DIAMOND_SHOVEL); + public static ItemWrapper DIAMOND_PICKAXE = of(net.minecraft.world.item.Items.DIAMOND_PICKAXE); + public static ItemWrapper DIAMOND_AXE = of(net.minecraft.world.item.Items.DIAMOND_AXE); + public static ItemWrapper DIAMOND_HOE = of(net.minecraft.world.item.Items.DIAMOND_HOE); + public static ItemWrapper NETHERITE_SWORD = of(net.minecraft.world.item.Items.NETHERITE_SWORD); + public static ItemWrapper NETHERITE_SHOVEL = of(net.minecraft.world.item.Items.NETHERITE_SHOVEL); + public static ItemWrapper NETHERITE_PICKAXE = of(net.minecraft.world.item.Items.NETHERITE_PICKAXE); + public static ItemWrapper NETHERITE_AXE = of(net.minecraft.world.item.Items.NETHERITE_AXE); + public static ItemWrapper NETHERITE_HOE = of(net.minecraft.world.item.Items.NETHERITE_HOE); + public static ItemWrapper STICK = of(net.minecraft.world.item.Items.STICK); + public static ItemWrapper BOWL = of(net.minecraft.world.item.Items.BOWL); + public static ItemWrapper MUSHROOM_STEW = of(net.minecraft.world.item.Items.MUSHROOM_STEW); + public static ItemWrapper STRING = of(net.minecraft.world.item.Items.STRING); + public static ItemWrapper FEATHER = of(net.minecraft.world.item.Items.FEATHER); + public static ItemWrapper GUNPOWDER = of(net.minecraft.world.item.Items.GUNPOWDER); + public static ItemWrapper WHEAT_SEEDS = of(net.minecraft.world.item.Items.WHEAT_SEEDS); + public static ItemWrapper WHEAT = of(net.minecraft.world.item.Items.WHEAT); + public static ItemWrapper BREAD = of(net.minecraft.world.item.Items.BREAD); + public static ItemWrapper LEATHER_HELMET = of(net.minecraft.world.item.Items.LEATHER_HELMET); + public static ItemWrapper LEATHER_CHESTPLATE = of(net.minecraft.world.item.Items.LEATHER_CHESTPLATE); + public static ItemWrapper LEATHER_LEGGINGS = of(net.minecraft.world.item.Items.LEATHER_LEGGINGS); + public static ItemWrapper LEATHER_BOOTS = of(net.minecraft.world.item.Items.LEATHER_BOOTS); + public static ItemWrapper CHAINMAIL_HELMET = of(net.minecraft.world.item.Items.CHAINMAIL_HELMET); + public static ItemWrapper CHAINMAIL_CHESTPLATE = of(net.minecraft.world.item.Items.CHAINMAIL_CHESTPLATE); + public static ItemWrapper CHAINMAIL_LEGGINGS = of(net.minecraft.world.item.Items.CHAINMAIL_LEGGINGS); + public static ItemWrapper CHAINMAIL_BOOTS = of(net.minecraft.world.item.Items.CHAINMAIL_BOOTS); + public static ItemWrapper IRON_HELMET = of(net.minecraft.world.item.Items.IRON_HELMET); + public static ItemWrapper IRON_CHESTPLATE = of(net.minecraft.world.item.Items.IRON_CHESTPLATE); + public static ItemWrapper IRON_LEGGINGS = of(net.minecraft.world.item.Items.IRON_LEGGINGS); + public static ItemWrapper IRON_BOOTS = of(net.minecraft.world.item.Items.IRON_BOOTS); + public static ItemWrapper DIAMOND_HELMET = of(net.minecraft.world.item.Items.DIAMOND_HELMET); + public static ItemWrapper DIAMOND_CHESTPLATE = of(net.minecraft.world.item.Items.DIAMOND_CHESTPLATE); + public static ItemWrapper DIAMOND_LEGGINGS = of(net.minecraft.world.item.Items.DIAMOND_LEGGINGS); + public static ItemWrapper DIAMOND_BOOTS = of(net.minecraft.world.item.Items.DIAMOND_BOOTS); + public static ItemWrapper GOLDEN_HELMET = of(net.minecraft.world.item.Items.GOLDEN_HELMET); + public static ItemWrapper GOLDEN_CHESTPLATE = of(net.minecraft.world.item.Items.GOLDEN_CHESTPLATE); + public static ItemWrapper GOLDEN_LEGGINGS = of(net.minecraft.world.item.Items.GOLDEN_LEGGINGS); + public static ItemWrapper GOLDEN_BOOTS = of(net.minecraft.world.item.Items.GOLDEN_BOOTS); + public static ItemWrapper NETHERITE_HELMET = of(net.minecraft.world.item.Items.NETHERITE_HELMET); + public static ItemWrapper NETHERITE_CHESTPLATE = of(net.minecraft.world.item.Items.NETHERITE_CHESTPLATE); + public static ItemWrapper NETHERITE_LEGGINGS = of(net.minecraft.world.item.Items.NETHERITE_LEGGINGS); + public static ItemWrapper NETHERITE_BOOTS = of(net.minecraft.world.item.Items.NETHERITE_BOOTS); + public static ItemWrapper FLINT = of(net.minecraft.world.item.Items.FLINT); + public static ItemWrapper PORKCHOP = of(net.minecraft.world.item.Items.PORKCHOP); + public static ItemWrapper COOKED_PORKCHOP = of(net.minecraft.world.item.Items.COOKED_PORKCHOP); + public static ItemWrapper PAINTING = of(net.minecraft.world.item.Items.PAINTING); + public static ItemWrapper GOLDEN_APPLE = of(net.minecraft.world.item.Items.GOLDEN_APPLE); + public static ItemWrapper ENCHANTED_GOLDEN_APPLE = of(net.minecraft.world.item.Items.ENCHANTED_GOLDEN_APPLE); + public static ItemWrapper OAK_SIGN = of(net.minecraft.world.item.Items.OAK_SIGN); + public static ItemWrapper SPRUCE_SIGN = of(net.minecraft.world.item.Items.SPRUCE_SIGN); + public static ItemWrapper BIRCH_SIGN = of(net.minecraft.world.item.Items.BIRCH_SIGN); + public static ItemWrapper JUNGLE_SIGN = of(net.minecraft.world.item.Items.JUNGLE_SIGN); + public static ItemWrapper ACACIA_SIGN = of(net.minecraft.world.item.Items.ACACIA_SIGN); + public static ItemWrapper DARK_OAK_SIGN = of(net.minecraft.world.item.Items.DARK_OAK_SIGN); + public static ItemWrapper CRIMSON_SIGN = of(net.minecraft.world.item.Items.CRIMSON_SIGN); + public static ItemWrapper WARPED_SIGN = of(net.minecraft.world.item.Items.WARPED_SIGN); + public static ItemWrapper BUCKET = of(net.minecraft.world.item.Items.BUCKET); + public static ItemWrapper WATER_BUCKET = of(net.minecraft.world.item.Items.WATER_BUCKET); + public static ItemWrapper LAVA_BUCKET = of(net.minecraft.world.item.Items.LAVA_BUCKET); + public static ItemWrapper MINECART = of(net.minecraft.world.item.Items.MINECART); + public static ItemWrapper SADDLE = of(net.minecraft.world.item.Items.SADDLE); + public static ItemWrapper REDSTONE = of(net.minecraft.world.item.Items.REDSTONE); + public static ItemWrapper SNOWBALL = of(net.minecraft.world.item.Items.SNOWBALL); + public static ItemWrapper OAK_BOAT = of(net.minecraft.world.item.Items.OAK_BOAT); + public static ItemWrapper LEATHER = of(net.minecraft.world.item.Items.LEATHER); + public static ItemWrapper MILK_BUCKET = of(net.minecraft.world.item.Items.MILK_BUCKET); + public static ItemWrapper PUFFERFISH_BUCKET = of(net.minecraft.world.item.Items.PUFFERFISH_BUCKET); + public static ItemWrapper SALMON_BUCKET = of(net.minecraft.world.item.Items.SALMON_BUCKET); + public static ItemWrapper COD_BUCKET = of(net.minecraft.world.item.Items.COD_BUCKET); + public static ItemWrapper TROPICAL_FISH_BUCKET = of(net.minecraft.world.item.Items.TROPICAL_FISH_BUCKET); + public static ItemWrapper BRICK = of(net.minecraft.world.item.Items.BRICK); + public static ItemWrapper CLAY_BALL = of(net.minecraft.world.item.Items.CLAY_BALL); + public static ItemWrapper DRIED_KELP_BLOCK = of(net.minecraft.world.item.Items.DRIED_KELP_BLOCK); + public static ItemWrapper PAPER = of(net.minecraft.world.item.Items.PAPER); + public static ItemWrapper BOOK = of(net.minecraft.world.item.Items.BOOK); + public static ItemWrapper SLIME_BALL = of(net.minecraft.world.item.Items.SLIME_BALL); + public static ItemWrapper CHEST_MINECART = of(net.minecraft.world.item.Items.CHEST_MINECART); + public static ItemWrapper FURNACE_MINECART = of(net.minecraft.world.item.Items.FURNACE_MINECART); + public static ItemWrapper EGG = of(net.minecraft.world.item.Items.EGG); + public static ItemWrapper COMPASS = of(net.minecraft.world.item.Items.COMPASS); + public static ItemWrapper FISHING_ROD = of(net.minecraft.world.item.Items.FISHING_ROD); + public static ItemWrapper CLOCK = of(net.minecraft.world.item.Items.CLOCK); + public static ItemWrapper GLOWSTONE_DUST = of(net.minecraft.world.item.Items.GLOWSTONE_DUST); + public static ItemWrapper COD = of(net.minecraft.world.item.Items.COD); + public static ItemWrapper SALMON = of(net.minecraft.world.item.Items.SALMON); + public static ItemWrapper TROPICAL_FISH = of(net.minecraft.world.item.Items.TROPICAL_FISH); + public static ItemWrapper PUFFERFISH = of(net.minecraft.world.item.Items.PUFFERFISH); + public static ItemWrapper COOKED_COD = of(net.minecraft.world.item.Items.COOKED_COD); + public static ItemWrapper COOKED_SALMON = of(net.minecraft.world.item.Items.COOKED_SALMON); + public static ItemWrapper INK_SAC = of(net.minecraft.world.item.Items.INK_SAC); + public static ItemWrapper COCOA_BEANS = of(net.minecraft.world.item.Items.COCOA_BEANS); + public static ItemWrapper LAPIS_LAZULI = of(net.minecraft.world.item.Items.LAPIS_LAZULI); + public static ItemWrapper WHITE_DYE = of(net.minecraft.world.item.Items.WHITE_DYE); + public static ItemWrapper ORANGE_DYE = of(net.minecraft.world.item.Items.ORANGE_DYE); + public static ItemWrapper MAGENTA_DYE = of(net.minecraft.world.item.Items.MAGENTA_DYE); + public static ItemWrapper LIGHT_BLUE_DYE = of(net.minecraft.world.item.Items.LIGHT_BLUE_DYE); + public static ItemWrapper YELLOW_DYE = of(net.minecraft.world.item.Items.YELLOW_DYE); + public static ItemWrapper LIME_DYE = of(net.minecraft.world.item.Items.LIME_DYE); + public static ItemWrapper PINK_DYE = of(net.minecraft.world.item.Items.PINK_DYE); + public static ItemWrapper GRAY_DYE = of(net.minecraft.world.item.Items.GRAY_DYE); + public static ItemWrapper LIGHT_GRAY_DYE = of(net.minecraft.world.item.Items.LIGHT_GRAY_DYE); + public static ItemWrapper CYAN_DYE = of(net.minecraft.world.item.Items.CYAN_DYE); + public static ItemWrapper PURPLE_DYE = of(net.minecraft.world.item.Items.PURPLE_DYE); + public static ItemWrapper BLUE_DYE = of(net.minecraft.world.item.Items.BLUE_DYE); + public static ItemWrapper BROWN_DYE = of(net.minecraft.world.item.Items.BROWN_DYE); + public static ItemWrapper GREEN_DYE = of(net.minecraft.world.item.Items.GREEN_DYE); + public static ItemWrapper RED_DYE = of(net.minecraft.world.item.Items.RED_DYE); + public static ItemWrapper BLACK_DYE = of(net.minecraft.world.item.Items.BLACK_DYE); + public static ItemWrapper BONE_MEAL = of(net.minecraft.world.item.Items.BONE_MEAL); + public static ItemWrapper BONE = of(net.minecraft.world.item.Items.BONE); + public static ItemWrapper SUGAR = of(net.minecraft.world.item.Items.SUGAR); + public static ItemWrapper CAKE = of(net.minecraft.world.item.Items.CAKE); + public static ItemWrapper WHITE_BED = of(net.minecraft.world.item.Items.WHITE_BED); + public static ItemWrapper ORANGE_BED = of(net.minecraft.world.item.Items.ORANGE_BED); + public static ItemWrapper MAGENTA_BED = of(net.minecraft.world.item.Items.MAGENTA_BED); + public static ItemWrapper LIGHT_BLUE_BED = of(net.minecraft.world.item.Items.LIGHT_BLUE_BED); + public static ItemWrapper YELLOW_BED = of(net.minecraft.world.item.Items.YELLOW_BED); + public static ItemWrapper LIME_BED = of(net.minecraft.world.item.Items.LIME_BED); + public static ItemWrapper PINK_BED = of(net.minecraft.world.item.Items.PINK_BED); + public static ItemWrapper GRAY_BED = of(net.minecraft.world.item.Items.GRAY_BED); + public static ItemWrapper LIGHT_GRAY_BED = of(net.minecraft.world.item.Items.LIGHT_GRAY_BED); + public static ItemWrapper CYAN_BED = of(net.minecraft.world.item.Items.CYAN_BED); + public static ItemWrapper PURPLE_BED = of(net.minecraft.world.item.Items.PURPLE_BED); + public static ItemWrapper BLUE_BED = of(net.minecraft.world.item.Items.BLUE_BED); + public static ItemWrapper BROWN_BED = of(net.minecraft.world.item.Items.BROWN_BED); + public static ItemWrapper GREEN_BED = of(net.minecraft.world.item.Items.GREEN_BED); + public static ItemWrapper RED_BED = of(net.minecraft.world.item.Items.RED_BED); + public static ItemWrapper BLACK_BED = of(net.minecraft.world.item.Items.BLACK_BED); + public static ItemWrapper COOKIE = of(net.minecraft.world.item.Items.COOKIE); + public static ItemWrapper FILLED_MAP = of(net.minecraft.world.item.Items.FILLED_MAP); + public static ItemWrapper SHEARS = of(net.minecraft.world.item.Items.SHEARS); + public static ItemWrapper MELON_SLICE = of(net.minecraft.world.item.Items.MELON_SLICE); + public static ItemWrapper DRIED_KELP = of(net.minecraft.world.item.Items.DRIED_KELP); + public static ItemWrapper PUMPKIN_SEEDS = of(net.minecraft.world.item.Items.PUMPKIN_SEEDS); + public static ItemWrapper MELON_SEEDS = of(net.minecraft.world.item.Items.MELON_SEEDS); + public static ItemWrapper BEEF = of(net.minecraft.world.item.Items.BEEF); + public static ItemWrapper COOKED_BEEF = of(net.minecraft.world.item.Items.COOKED_BEEF); + public static ItemWrapper CHICKEN = of(net.minecraft.world.item.Items.CHICKEN); + public static ItemWrapper COOKED_CHICKEN = of(net.minecraft.world.item.Items.COOKED_CHICKEN); + public static ItemWrapper ROTTEN_FLESH = of(net.minecraft.world.item.Items.ROTTEN_FLESH); + public static ItemWrapper ENDER_PEARL = of(net.minecraft.world.item.Items.ENDER_PEARL); + public static ItemWrapper BLAZE_ROD = of(net.minecraft.world.item.Items.BLAZE_ROD); + public static ItemWrapper GHAST_TEAR = of(net.minecraft.world.item.Items.GHAST_TEAR); + public static ItemWrapper GOLD_NUGGET = of(net.minecraft.world.item.Items.GOLD_NUGGET); + public static ItemWrapper NETHER_WART = of(net.minecraft.world.item.Items.NETHER_WART); + public static ItemWrapper POTION = of(net.minecraft.world.item.Items.POTION); + public static ItemWrapper GLASS_BOTTLE = of(net.minecraft.world.item.Items.GLASS_BOTTLE); + public static ItemWrapper SPIDER_EYE = of(net.minecraft.world.item.Items.SPIDER_EYE); + public static ItemWrapper FERMENTED_SPIDER_EYE = of(net.minecraft.world.item.Items.FERMENTED_SPIDER_EYE); + public static ItemWrapper BLAZE_POWDER = of(net.minecraft.world.item.Items.BLAZE_POWDER); + public static ItemWrapper MAGMA_CREAM = of(net.minecraft.world.item.Items.MAGMA_CREAM); + public static ItemWrapper BREWING_STAND = of(net.minecraft.world.item.Items.BREWING_STAND); + public static ItemWrapper CAULDRON = of(net.minecraft.world.item.Items.CAULDRON); + public static ItemWrapper ENDER_EYE = of(net.minecraft.world.item.Items.ENDER_EYE); + public static ItemWrapper GLISTERING_MELON_SLICE = of(net.minecraft.world.item.Items.GLISTERING_MELON_SLICE); + public static ItemWrapper BAT_SPAWN_EGG = of(net.minecraft.world.item.Items.BAT_SPAWN_EGG); + public static ItemWrapper BEE_SPAWN_EGG = of(net.minecraft.world.item.Items.BEE_SPAWN_EGG); + public static ItemWrapper BLAZE_SPAWN_EGG = of(net.minecraft.world.item.Items.BLAZE_SPAWN_EGG); + public static ItemWrapper CAT_SPAWN_EGG = of(net.minecraft.world.item.Items.CAT_SPAWN_EGG); + public static ItemWrapper CAVE_SPIDER_SPAWN_EGG = of(net.minecraft.world.item.Items.CAVE_SPIDER_SPAWN_EGG); + public static ItemWrapper CHICKEN_SPAWN_EGG = of(net.minecraft.world.item.Items.CHICKEN_SPAWN_EGG); + public static ItemWrapper COD_SPAWN_EGG = of(net.minecraft.world.item.Items.COD_SPAWN_EGG); + public static ItemWrapper COW_SPAWN_EGG = of(net.minecraft.world.item.Items.COW_SPAWN_EGG); + public static ItemWrapper CREEPER_SPAWN_EGG = of(net.minecraft.world.item.Items.CREEPER_SPAWN_EGG); + public static ItemWrapper DOLPHIN_SPAWN_EGG = of(net.minecraft.world.item.Items.DOLPHIN_SPAWN_EGG); + public static ItemWrapper DONKEY_SPAWN_EGG = of(net.minecraft.world.item.Items.DONKEY_SPAWN_EGG); + public static ItemWrapper DROWNED_SPAWN_EGG = of(net.minecraft.world.item.Items.DROWNED_SPAWN_EGG); + public static ItemWrapper ELDER_GUARDIAN_SPAWN_EGG = of(net.minecraft.world.item.Items.ELDER_GUARDIAN_SPAWN_EGG); + public static ItemWrapper ENDERMAN_SPAWN_EGG = of(net.minecraft.world.item.Items.ENDERMAN_SPAWN_EGG); + public static ItemWrapper ENDERMITE_SPAWN_EGG = of(net.minecraft.world.item.Items.ENDERMITE_SPAWN_EGG); + public static ItemWrapper EVOKER_SPAWN_EGG = of(net.minecraft.world.item.Items.EVOKER_SPAWN_EGG); + public static ItemWrapper FOX_SPAWN_EGG = of(net.minecraft.world.item.Items.FOX_SPAWN_EGG); + public static ItemWrapper GHAST_SPAWN_EGG = of(net.minecraft.world.item.Items.GHAST_SPAWN_EGG); + public static ItemWrapper GUARDIAN_SPAWN_EGG = of(net.minecraft.world.item.Items.GUARDIAN_SPAWN_EGG); + public static ItemWrapper HOGLIN_SPAWN_EGG = of(net.minecraft.world.item.Items.HOGLIN_SPAWN_EGG); + public static ItemWrapper HORSE_SPAWN_EGG = of(net.minecraft.world.item.Items.HORSE_SPAWN_EGG); + public static ItemWrapper HUSK_SPAWN_EGG = of(net.minecraft.world.item.Items.HUSK_SPAWN_EGG); + public static ItemWrapper LLAMA_SPAWN_EGG = of(net.minecraft.world.item.Items.LLAMA_SPAWN_EGG); + public static ItemWrapper MAGMA_CUBE_SPAWN_EGG = of(net.minecraft.world.item.Items.MAGMA_CUBE_SPAWN_EGG); + public static ItemWrapper MOOSHROOM_SPAWN_EGG = of(net.minecraft.world.item.Items.MOOSHROOM_SPAWN_EGG); + public static ItemWrapper MULE_SPAWN_EGG = of(net.minecraft.world.item.Items.MULE_SPAWN_EGG); + public static ItemWrapper OCELOT_SPAWN_EGG = of(net.minecraft.world.item.Items.OCELOT_SPAWN_EGG); + public static ItemWrapper PANDA_SPAWN_EGG = of(net.minecraft.world.item.Items.PANDA_SPAWN_EGG); + public static ItemWrapper PARROT_SPAWN_EGG = of(net.minecraft.world.item.Items.PARROT_SPAWN_EGG); + public static ItemWrapper PHANTOM_SPAWN_EGG = of(net.minecraft.world.item.Items.PHANTOM_SPAWN_EGG); + public static ItemWrapper PIG_SPAWN_EGG = of(net.minecraft.world.item.Items.PIG_SPAWN_EGG); + public static ItemWrapper PIGLIN_SPAWN_EGG = of(net.minecraft.world.item.Items.PIGLIN_SPAWN_EGG); + public static ItemWrapper PIGLIN_BRUTE_SPAWN_EGG = of(net.minecraft.world.item.Items.PIGLIN_BRUTE_SPAWN_EGG); + public static ItemWrapper PILLAGER_SPAWN_EGG = of(net.minecraft.world.item.Items.PILLAGER_SPAWN_EGG); + public static ItemWrapper POLAR_BEAR_SPAWN_EGG = of(net.minecraft.world.item.Items.POLAR_BEAR_SPAWN_EGG); + public static ItemWrapper PUFFERFISH_SPAWN_EGG = of(net.minecraft.world.item.Items.PUFFERFISH_SPAWN_EGG); + public static ItemWrapper RABBIT_SPAWN_EGG = of(net.minecraft.world.item.Items.RABBIT_SPAWN_EGG); + public static ItemWrapper RAVAGER_SPAWN_EGG = of(net.minecraft.world.item.Items.RAVAGER_SPAWN_EGG); + public static ItemWrapper SALMON_SPAWN_EGG = of(net.minecraft.world.item.Items.SALMON_SPAWN_EGG); + public static ItemWrapper SHEEP_SPAWN_EGG = of(net.minecraft.world.item.Items.SHEEP_SPAWN_EGG); + public static ItemWrapper SHULKER_SPAWN_EGG = of(net.minecraft.world.item.Items.SHULKER_SPAWN_EGG); + public static ItemWrapper SILVERFISH_SPAWN_EGG = of(net.minecraft.world.item.Items.SILVERFISH_SPAWN_EGG); + public static ItemWrapper SKELETON_SPAWN_EGG = of(net.minecraft.world.item.Items.SKELETON_SPAWN_EGG); + public static ItemWrapper SKELETON_HORSE_SPAWN_EGG = of(net.minecraft.world.item.Items.SKELETON_HORSE_SPAWN_EGG); + public static ItemWrapper SLIME_SPAWN_EGG = of(net.minecraft.world.item.Items.SLIME_SPAWN_EGG); + public static ItemWrapper SPIDER_SPAWN_EGG = of(net.minecraft.world.item.Items.SPIDER_SPAWN_EGG); + public static ItemWrapper SQUID_SPAWN_EGG = of(net.minecraft.world.item.Items.SQUID_SPAWN_EGG); + public static ItemWrapper STRAY_SPAWN_EGG = of(net.minecraft.world.item.Items.STRAY_SPAWN_EGG); + public static ItemWrapper STRIDER_SPAWN_EGG = of(net.minecraft.world.item.Items.STRIDER_SPAWN_EGG); + public static ItemWrapper TRADER_LLAMA_SPAWN_EGG = of(net.minecraft.world.item.Items.TRADER_LLAMA_SPAWN_EGG); + public static ItemWrapper TROPICAL_FISH_SPAWN_EGG = of(net.minecraft.world.item.Items.TROPICAL_FISH_SPAWN_EGG); + public static ItemWrapper TURTLE_SPAWN_EGG = of(net.minecraft.world.item.Items.TURTLE_SPAWN_EGG); + public static ItemWrapper VEX_SPAWN_EGG = of(net.minecraft.world.item.Items.VEX_SPAWN_EGG); + public static ItemWrapper VILLAGER_SPAWN_EGG = of(net.minecraft.world.item.Items.VILLAGER_SPAWN_EGG); + public static ItemWrapper VINDICATOR_SPAWN_EGG = of(net.minecraft.world.item.Items.VINDICATOR_SPAWN_EGG); + public static ItemWrapper WANDERING_TRADER_SPAWN_EGG = of(net.minecraft.world.item.Items.WANDERING_TRADER_SPAWN_EGG); + public static ItemWrapper WITCH_SPAWN_EGG = of(net.minecraft.world.item.Items.WITCH_SPAWN_EGG); + public static ItemWrapper WITHER_SKELETON_SPAWN_EGG = of(net.minecraft.world.item.Items.WITHER_SKELETON_SPAWN_EGG); + public static ItemWrapper WOLF_SPAWN_EGG = of(net.minecraft.world.item.Items.WOLF_SPAWN_EGG); + public static ItemWrapper ZOGLIN_SPAWN_EGG = of(net.minecraft.world.item.Items.ZOGLIN_SPAWN_EGG); + public static ItemWrapper ZOMBIE_SPAWN_EGG = of(net.minecraft.world.item.Items.ZOMBIE_SPAWN_EGG); + public static ItemWrapper ZOMBIE_HORSE_SPAWN_EGG = of(net.minecraft.world.item.Items.ZOMBIE_HORSE_SPAWN_EGG); + public static ItemWrapper ZOMBIE_VILLAGER_SPAWN_EGG = of(net.minecraft.world.item.Items.ZOMBIE_VILLAGER_SPAWN_EGG); + public static ItemWrapper ZOMBIFIED_PIGLIN_SPAWN_EGG = of(net.minecraft.world.item.Items.ZOMBIFIED_PIGLIN_SPAWN_EGG); + public static ItemWrapper EXPERIENCE_BOTTLE = of(net.minecraft.world.item.Items.EXPERIENCE_BOTTLE); + public static ItemWrapper FIRE_CHARGE = of(net.minecraft.world.item.Items.FIRE_CHARGE); + public static ItemWrapper WRITABLE_BOOK = of(net.minecraft.world.item.Items.WRITABLE_BOOK); + public static ItemWrapper WRITTEN_BOOK = of(net.minecraft.world.item.Items.WRITTEN_BOOK); + public static ItemWrapper EMERALD = of(net.minecraft.world.item.Items.EMERALD); + public static ItemWrapper ITEM_FRAME = of(net.minecraft.world.item.Items.ITEM_FRAME); + public static ItemWrapper FLOWER_POT = of(net.minecraft.world.item.Items.FLOWER_POT); + public static ItemWrapper CARROT = of(net.minecraft.world.item.Items.CARROT); + public static ItemWrapper POTATO = of(net.minecraft.world.item.Items.POTATO); + public static ItemWrapper BAKED_POTATO = of(net.minecraft.world.item.Items.BAKED_POTATO); + public static ItemWrapper POISONOUS_POTATO = of(net.minecraft.world.item.Items.POISONOUS_POTATO); + public static ItemWrapper MAP = of(net.minecraft.world.item.Items.MAP); + public static ItemWrapper GOLDEN_CARROT = of(net.minecraft.world.item.Items.GOLDEN_CARROT); + public static ItemWrapper SKELETON_SKULL = of(net.minecraft.world.item.Items.SKELETON_SKULL); + public static ItemWrapper WITHER_SKELETON_SKULL = of(net.minecraft.world.item.Items.WITHER_SKELETON_SKULL); + public static ItemWrapper PLAYER_HEAD = of(net.minecraft.world.item.Items.PLAYER_HEAD); + public static ItemWrapper ZOMBIE_HEAD = of(net.minecraft.world.item.Items.ZOMBIE_HEAD); + public static ItemWrapper CREEPER_HEAD = of(net.minecraft.world.item.Items.CREEPER_HEAD); + public static ItemWrapper DRAGON_HEAD = of(net.minecraft.world.item.Items.DRAGON_HEAD); + public static ItemWrapper CARROT_ON_A_STICK = of(net.minecraft.world.item.Items.CARROT_ON_A_STICK); + public static ItemWrapper WARPED_FUNGUS_ON_A_STICK = of(net.minecraft.world.item.Items.WARPED_FUNGUS_ON_A_STICK); + public static ItemWrapper NETHER_STAR = of(net.minecraft.world.item.Items.NETHER_STAR); + public static ItemWrapper PUMPKIN_PIE = of(net.minecraft.world.item.Items.PUMPKIN_PIE); + public static ItemWrapper FIREWORK_ROCKET = of(net.minecraft.world.item.Items.FIREWORK_ROCKET); + public static ItemWrapper FIREWORK_STAR = of(net.minecraft.world.item.Items.FIREWORK_STAR); + public static ItemWrapper ENCHANTED_BOOK = of(net.minecraft.world.item.Items.ENCHANTED_BOOK); + public static ItemWrapper NETHER_BRICK = of(net.minecraft.world.item.Items.NETHER_BRICK); + public static ItemWrapper QUARTZ = of(net.minecraft.world.item.Items.QUARTZ); + public static ItemWrapper TNT_MINECART = of(net.minecraft.world.item.Items.TNT_MINECART); + public static ItemWrapper HOPPER_MINECART = of(net.minecraft.world.item.Items.HOPPER_MINECART); + public static ItemWrapper PRISMARINE_SHARD = of(net.minecraft.world.item.Items.PRISMARINE_SHARD); + public static ItemWrapper PRISMARINE_CRYSTALS = of(net.minecraft.world.item.Items.PRISMARINE_CRYSTALS); + public static ItemWrapper RABBIT = of(net.minecraft.world.item.Items.RABBIT); + public static ItemWrapper COOKED_RABBIT = of(net.minecraft.world.item.Items.COOKED_RABBIT); + public static ItemWrapper RABBIT_STEW = of(net.minecraft.world.item.Items.RABBIT_STEW); + public static ItemWrapper RABBIT_FOOT = of(net.minecraft.world.item.Items.RABBIT_FOOT); + public static ItemWrapper RABBIT_HIDE = of(net.minecraft.world.item.Items.RABBIT_HIDE); + public static ItemWrapper ARMOR_STAND = of(net.minecraft.world.item.Items.ARMOR_STAND); + public static ItemWrapper IRON_HORSE_ARMOR = of(net.minecraft.world.item.Items.IRON_HORSE_ARMOR); + public static ItemWrapper GOLDEN_HORSE_ARMOR = of(net.minecraft.world.item.Items.GOLDEN_HORSE_ARMOR); + public static ItemWrapper DIAMOND_HORSE_ARMOR = of(net.minecraft.world.item.Items.DIAMOND_HORSE_ARMOR); + public static ItemWrapper LEATHER_HORSE_ARMOR = of(net.minecraft.world.item.Items.LEATHER_HORSE_ARMOR); + public static ItemWrapper LEAD = of(net.minecraft.world.item.Items.LEAD); + public static ItemWrapper NAME_TAG = of(net.minecraft.world.item.Items.NAME_TAG); + public static ItemWrapper COMMAND_BLOCK_MINECART = of(net.minecraft.world.item.Items.COMMAND_BLOCK_MINECART); + public static ItemWrapper MUTTON = of(net.minecraft.world.item.Items.MUTTON); + public static ItemWrapper COOKED_MUTTON = of(net.minecraft.world.item.Items.COOKED_MUTTON); + public static ItemWrapper WHITE_BANNER = of(net.minecraft.world.item.Items.WHITE_BANNER); + public static ItemWrapper ORANGE_BANNER = of(net.minecraft.world.item.Items.ORANGE_BANNER); + public static ItemWrapper MAGENTA_BANNER = of(net.minecraft.world.item.Items.MAGENTA_BANNER); + public static ItemWrapper LIGHT_BLUE_BANNER = of(net.minecraft.world.item.Items.LIGHT_BLUE_BANNER); + public static ItemWrapper YELLOW_BANNER = of(net.minecraft.world.item.Items.YELLOW_BANNER); + public static ItemWrapper LIME_BANNER = of(net.minecraft.world.item.Items.LIME_BANNER); + public static ItemWrapper PINK_BANNER = of(net.minecraft.world.item.Items.PINK_BANNER); + public static ItemWrapper GRAY_BANNER = of(net.minecraft.world.item.Items.GRAY_BANNER); + public static ItemWrapper LIGHT_GRAY_BANNER = of(net.minecraft.world.item.Items.LIGHT_GRAY_BANNER); + public static ItemWrapper CYAN_BANNER = of(net.minecraft.world.item.Items.CYAN_BANNER); + public static ItemWrapper PURPLE_BANNER = of(net.minecraft.world.item.Items.PURPLE_BANNER); + public static ItemWrapper BLUE_BANNER = of(net.minecraft.world.item.Items.BLUE_BANNER); + public static ItemWrapper BROWN_BANNER = of(net.minecraft.world.item.Items.BROWN_BANNER); + public static ItemWrapper GREEN_BANNER = of(net.minecraft.world.item.Items.GREEN_BANNER); + public static ItemWrapper RED_BANNER = of(net.minecraft.world.item.Items.RED_BANNER); + public static ItemWrapper BLACK_BANNER = of(net.minecraft.world.item.Items.BLACK_BANNER); + public static ItemWrapper END_CRYSTAL = of(net.minecraft.world.item.Items.END_CRYSTAL); + public static ItemWrapper CHORUS_FRUIT = of(net.minecraft.world.item.Items.CHORUS_FRUIT); + public static ItemWrapper POPPED_CHORUS_FRUIT = of(net.minecraft.world.item.Items.POPPED_CHORUS_FRUIT); + public static ItemWrapper BEETROOT = of(net.minecraft.world.item.Items.BEETROOT); + public static ItemWrapper BEETROOT_SEEDS = of(net.minecraft.world.item.Items.BEETROOT_SEEDS); + public static ItemWrapper BEETROOT_SOUP = of(net.minecraft.world.item.Items.BEETROOT_SOUP); + public static ItemWrapper DRAGON_BREATH = of(net.minecraft.world.item.Items.DRAGON_BREATH); + public static ItemWrapper SPLASH_POTION = of(net.minecraft.world.item.Items.SPLASH_POTION); + public static ItemWrapper SPECTRAL_ARROW = of(net.minecraft.world.item.Items.SPECTRAL_ARROW); + public static ItemWrapper TIPPED_ARROW = of(net.minecraft.world.item.Items.TIPPED_ARROW); + public static ItemWrapper LINGERING_POTION = of(net.minecraft.world.item.Items.LINGERING_POTION); + public static ItemWrapper SHIELD = of(net.minecraft.world.item.Items.SHIELD); + public static ItemWrapper ELYTRA = of(net.minecraft.world.item.Items.ELYTRA); + public static ItemWrapper SPRUCE_BOAT = of(net.minecraft.world.item.Items.SPRUCE_BOAT); + public static ItemWrapper BIRCH_BOAT = of(net.minecraft.world.item.Items.BIRCH_BOAT); + public static ItemWrapper JUNGLE_BOAT = of(net.minecraft.world.item.Items.JUNGLE_BOAT); + public static ItemWrapper ACACIA_BOAT = of(net.minecraft.world.item.Items.ACACIA_BOAT); + public static ItemWrapper DARK_OAK_BOAT = of(net.minecraft.world.item.Items.DARK_OAK_BOAT); + public static ItemWrapper TOTEM_OF_UNDYING = of(net.minecraft.world.item.Items.TOTEM_OF_UNDYING); + public static ItemWrapper SHULKER_SHELL = of(net.minecraft.world.item.Items.SHULKER_SHELL); + public static ItemWrapper IRON_NUGGET = of(net.minecraft.world.item.Items.IRON_NUGGET); + public static ItemWrapper KNOWLEDGE_BOOK = of(net.minecraft.world.item.Items.KNOWLEDGE_BOOK); + public static ItemWrapper DEBUG_STICK = of(net.minecraft.world.item.Items.DEBUG_STICK); + public static ItemWrapper MUSIC_DISC_13 = of(net.minecraft.world.item.Items.MUSIC_DISC_13); + public static ItemWrapper MUSIC_DISC_CAT = of(net.minecraft.world.item.Items.MUSIC_DISC_CAT); + public static ItemWrapper MUSIC_DISC_BLOCKS = of(net.minecraft.world.item.Items.MUSIC_DISC_BLOCKS); + public static ItemWrapper MUSIC_DISC_CHIRP = of(net.minecraft.world.item.Items.MUSIC_DISC_CHIRP); + public static ItemWrapper MUSIC_DISC_FAR = of(net.minecraft.world.item.Items.MUSIC_DISC_FAR); + public static ItemWrapper MUSIC_DISC_MALL = of(net.minecraft.world.item.Items.MUSIC_DISC_MALL); + public static ItemWrapper MUSIC_DISC_MELLOHI = of(net.minecraft.world.item.Items.MUSIC_DISC_MELLOHI); + public static ItemWrapper MUSIC_DISC_STAL = of(net.minecraft.world.item.Items.MUSIC_DISC_STAL); + public static ItemWrapper MUSIC_DISC_STRAD = of(net.minecraft.world.item.Items.MUSIC_DISC_STRAD); + public static ItemWrapper MUSIC_DISC_WARD = of(net.minecraft.world.item.Items.MUSIC_DISC_WARD); + public static ItemWrapper MUSIC_DISC_11 = of(net.minecraft.world.item.Items.MUSIC_DISC_11); + public static ItemWrapper MUSIC_DISC_WAIT = of(net.minecraft.world.item.Items.MUSIC_DISC_WAIT); + public static ItemWrapper MUSIC_DISC_PIGSTEP = of(net.minecraft.world.item.Items.MUSIC_DISC_PIGSTEP); + public static ItemWrapper TRIDENT = of(net.minecraft.world.item.Items.TRIDENT); + public static ItemWrapper PHANTOM_MEMBRANE = of(net.minecraft.world.item.Items.PHANTOM_MEMBRANE); + public static ItemWrapper NAUTILUS_SHELL = of(net.minecraft.world.item.Items.NAUTILUS_SHELL); + public static ItemWrapper HEART_OF_THE_SEA = of(net.minecraft.world.item.Items.HEART_OF_THE_SEA); + public static ItemWrapper CROSSBOW = of(net.minecraft.world.item.Items.CROSSBOW); + public static ItemWrapper SUSPICIOUS_STEW = of(net.minecraft.world.item.Items.SUSPICIOUS_STEW); + public static ItemWrapper LOOM = of(net.minecraft.world.item.Items.LOOM); + public static ItemWrapper FLOWER_BANNER_PATTERN = of(net.minecraft.world.item.Items.FLOWER_BANNER_PATTERN); + public static ItemWrapper CREEPER_BANNER_PATTERN = of(net.minecraft.world.item.Items.CREEPER_BANNER_PATTERN); + public static ItemWrapper SKULL_BANNER_PATTERN = of(net.minecraft.world.item.Items.SKULL_BANNER_PATTERN); + public static ItemWrapper MOJANG_BANNER_PATTERN = of(net.minecraft.world.item.Items.MOJANG_BANNER_PATTERN); + public static ItemWrapper GLOBE_BANNER_PATTERN = of(net.minecraft.world.item.Items.GLOBE_BANNER_PATTERN); + public static ItemWrapper PIGLIN_BANNER_PATTERN = of(net.minecraft.world.item.Items.PIGLIN_BANNER_PATTERN); + public static ItemWrapper COMPOSTER = of(net.minecraft.world.item.Items.COMPOSTER); + public static ItemWrapper BARREL = of(net.minecraft.world.item.Items.BARREL); + public static ItemWrapper SMOKER = of(net.minecraft.world.item.Items.SMOKER); + public static ItemWrapper BLAST_FURNACE = of(net.minecraft.world.item.Items.BLAST_FURNACE); + public static ItemWrapper CARTOGRAPHY_TABLE = of(net.minecraft.world.item.Items.CARTOGRAPHY_TABLE); + public static ItemWrapper FLETCHING_TABLE = of(net.minecraft.world.item.Items.FLETCHING_TABLE); + public static ItemWrapper GRINDSTONE = of(net.minecraft.world.item.Items.GRINDSTONE); + public static ItemWrapper LECTERN = of(net.minecraft.world.item.Items.LECTERN); + public static ItemWrapper SMITHING_TABLE = of(net.minecraft.world.item.Items.SMITHING_TABLE); + public static ItemWrapper STONECUTTER = of(net.minecraft.world.item.Items.STONECUTTER); + public static ItemWrapper BELL = of(net.minecraft.world.item.Items.BELL); + public static ItemWrapper LANTERN = of(net.minecraft.world.item.Items.LANTERN); + public static ItemWrapper SOUL_LANTERN = of(net.minecraft.world.item.Items.SOUL_LANTERN); + public static ItemWrapper SWEET_BERRIES = of(net.minecraft.world.item.Items.SWEET_BERRIES); + public static ItemWrapper CAMPFIRE = of(net.minecraft.world.item.Items.CAMPFIRE); + public static ItemWrapper SOUL_CAMPFIRE = of(net.minecraft.world.item.Items.SOUL_CAMPFIRE); + public static ItemWrapper SHROOMLIGHT = of(net.minecraft.world.item.Items.SHROOMLIGHT); + public static ItemWrapper HONEYCOMB = of(net.minecraft.world.item.Items.HONEYCOMB); + public static ItemWrapper BEE_NEST = of(net.minecraft.world.item.Items.BEE_NEST); + public static ItemWrapper BEEHIVE = of(net.minecraft.world.item.Items.BEEHIVE); + public static ItemWrapper HONEY_BOTTLE = of(net.minecraft.world.item.Items.HONEY_BOTTLE); + public static ItemWrapper HONEY_BLOCK = of(net.minecraft.world.item.Items.HONEY_BLOCK); + public static ItemWrapper HONEYCOMB_BLOCK = of(net.minecraft.world.item.Items.HONEYCOMB_BLOCK); + public static ItemWrapper LODESTONE = of(net.minecraft.world.item.Items.LODESTONE); + public static ItemWrapper NETHERITE_BLOCK = of(net.minecraft.world.item.Items.NETHERITE_BLOCK); + public static ItemWrapper ANCIENT_DEBRIS = of(net.minecraft.world.item.Items.ANCIENT_DEBRIS); + public static ItemWrapper TARGET = of(net.minecraft.world.item.Items.TARGET); + public static ItemWrapper CRYING_OBSIDIAN = of(net.minecraft.world.item.Items.CRYING_OBSIDIAN); + public static ItemWrapper BLACKSTONE = of(net.minecraft.world.item.Items.BLACKSTONE); + public static ItemWrapper BLACKSTONE_SLAB = of(net.minecraft.world.item.Items.BLACKSTONE_SLAB); + public static ItemWrapper BLACKSTONE_STAIRS = of(net.minecraft.world.item.Items.BLACKSTONE_STAIRS); + public static ItemWrapper GILDED_BLACKSTONE = of(net.minecraft.world.item.Items.GILDED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE_SLAB = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_SLAB); + public static ItemWrapper POLISHED_BLACKSTONE_STAIRS = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_STAIRS); + public static ItemWrapper CHISELED_POLISHED_BLACKSTONE = of(net.minecraft.world.item.Items.CHISELED_POLISHED_BLACKSTONE); + public static ItemWrapper POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_BRICKS); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_SLAB = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_BRICK_SLAB); + public static ItemWrapper POLISHED_BLACKSTONE_BRICK_STAIRS = of(net.minecraft.world.item.Items.POLISHED_BLACKSTONE_BRICK_STAIRS); + public static ItemWrapper CRACKED_POLISHED_BLACKSTONE_BRICKS = of(net.minecraft.world.item.Items.CRACKED_POLISHED_BLACKSTONE_BRICKS); + public static ItemWrapper RESPAWN_ANCHOR = of(net.minecraft.world.item.Items.RESPAWN_ANCHOR); - public static ItemWrapper of(net.minecraft.item.Item item) { + public static ItemWrapper of(net.minecraft.world.item.Item item) { return ItemWrapper.of(item); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java index c39629242..6563c07f2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.item; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import java.util.function.Supplier; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java index d92a636ac..2a97759ad 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java @@ -3,7 +3,7 @@ public interface ElementConvertible { NbtElement toElement(); - default net.minecraft.nbt.NbtElement toMinecraftNbtElement() { + default net.minecraft.nbt.Tag toMinecraftNbtElement() { return toElement().toMinecraft(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java index 38dff8af8..1d62e90d0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java @@ -9,13 +9,13 @@ @SuppressWarnings("deprecation") public class NbtCompound implements ElementConvertible { - protected final net.minecraft.nbt.NbtCompound nbt; + protected final net.minecraft.nbt.CompoundTag nbt; - protected NbtCompound(net.minecraft.nbt.NbtCompound nbt) { + protected NbtCompound(net.minecraft.nbt.CompoundTag nbt) { this.nbt = nbt; } - public static NbtCompound of(net.minecraft.nbt.NbtCompound nbt) { + public static NbtCompound of(net.minecraft.nbt.CompoundTag nbt) { return new NbtCompound(nbt); } @@ -115,7 +115,7 @@ public void put(String key, NbtCompound compound) { NbtUtil.put(nbt, key, compound.nbt); } - public void put(String key, net.minecraft.nbt.NbtCompound nbt) { + public void put(String key, net.minecraft.nbt.CompoundTag nbt) { NbtUtil.put(this.nbt, key, nbt); } @@ -131,7 +131,7 @@ public NbtElement get(String key) { return NbtElement.of(NbtUtil.getElement(nbt, key)); } - public net.minecraft.nbt.NbtCompound toMinecraft() { + public net.minecraft.nbt.CompoundTag toMinecraft() { return nbt; } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java index b6ba2c5a3..c86394d1c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java @@ -1,15 +1,15 @@ package net.pitan76.mcpitanlib.midohra.nbt; -import net.minecraft.nbt.NbtType; +import net.minecraft.nbt.TagType; public class NbtElement implements ElementConvertible { - protected final net.minecraft.nbt.NbtElement nbt; + protected final net.minecraft.nbt.Tag nbt; - protected NbtElement(net.minecraft.nbt.NbtElement nbt) { + protected NbtElement(net.minecraft.nbt.Tag nbt) { this.nbt = nbt; } - public static NbtElement of(net.minecraft.nbt.NbtElement nbt) { + public static NbtElement of(net.minecraft.nbt.Tag nbt) { return new NbtElement(nbt); } @@ -18,15 +18,15 @@ public NbtElement copy() { } public byte getType() { - return nbt.getType(); + return nbt.getId(); } - public NbtType getNbtType() { - return nbt.getNbtType(); + public TagType getNbtType() { + return nbt.getType(); } public int getSizeInBytes() { - return nbt.getSizeInBytes(); + return nbt.sizeInBytes(); } @Override @@ -34,7 +34,7 @@ public String toString() { return nbt.toString(); } - public net.minecraft.nbt.NbtElement toMinecraft() { + public net.minecraft.nbt.Tag toMinecraft() { return nbt; } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java index 00757eb4c..cfa1403e8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java @@ -5,19 +5,19 @@ @SuppressWarnings("deprecation") public class NbtList extends AbstractList implements ElementConvertible { - protected final net.minecraft.nbt.NbtList nbtList; + protected final net.minecraft.nbt.ListTag nbtList; - protected NbtList(net.minecraft.nbt.NbtList nbtList) { + protected NbtList(net.minecraft.nbt.ListTag nbtList) { this.nbtList = nbtList; } - public static NbtList of(net.minecraft.nbt.NbtList nbtList) { + public static NbtList of(net.minecraft.nbt.ListTag nbtList) { return new NbtList(nbtList); } public static Optional ofOptional(NbtElement nbtElement) { - if (nbtElement.toMinecraft() instanceof net.minecraft.nbt.NbtList) - return Optional.of(new NbtList((net.minecraft.nbt.NbtList) nbtElement.toMinecraft())); + if (nbtElement.toMinecraft() instanceof net.minecraft.nbt.ListTag) + return Optional.of(new NbtList((net.minecraft.nbt.ListTag) nbtElement.toMinecraft())); return Optional.empty(); } @@ -32,7 +32,7 @@ public int size() { } public byte getType() { - return nbtList.getType(); + return nbtList.getId(); } @Override @@ -40,7 +40,7 @@ public NbtElement get(int index) { return NbtElement.of(nbtList.get(index)); } - public boolean add(net.minecraft.nbt.NbtElement nbtElement) { + public boolean add(net.minecraft.nbt.Tag nbtElement) { return nbtList.add(nbtElement); } @@ -49,7 +49,7 @@ public boolean add(NbtElement nbtElement) { return add(nbtElement.toMinecraft()); } - public void add(int index, net.minecraft.nbt.NbtElement nbtElement) { + public void add(int index, net.minecraft.nbt.Tag nbtElement) { nbtList.add(index, nbtElement); } @@ -99,7 +99,7 @@ public String toString() { return nbtList.toString(); } - public net.minecraft.nbt.NbtList toMinecraft() { + public net.minecraft.nbt.ListTag toMinecraft() { return nbtList; } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java index c2c5566fe..8d54a0c66 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.midohra.network; -import net.minecraft.network.PacketByteBuf; +import net.minecraft.network.FriendlyByteBuf; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -public class CompatPacketByteBuf extends PacketByteBuf { - public CompatPacketByteBuf(PacketByteBuf buf) { +public class CompatPacketByteBuf extends FriendlyByteBuf { + public CompatPacketByteBuf(FriendlyByteBuf buf) { super(buf); } @@ -17,11 +17,11 @@ public static CompatPacketByteBuf create() { return new CompatPacketByteBuf(); } - public static CompatPacketByteBuf of(PacketByteBuf buf) { + public static CompatPacketByteBuf of(FriendlyByteBuf buf) { return new CompatPacketByteBuf(buf); } - public PacketByteBuf getRaw() { + public FriendlyByteBuf getRaw() { return this; } @@ -88,21 +88,21 @@ public byte[] readByteArray() { return super.readByteArray(); } - public CompatPacketByteBuf writeString(String string) { - super.writeString(string); + public CompatPacketByteBuf writeUtf(String string) { + super.writeUtf(string); return this; } - public String readString() { - return super.readString(); + public String readUtf() { + return super.readUtf(); } - public CompatPacketByteBuf writeBlockPos(net.minecraft.util.math.BlockPos pos) { + public CompatPacketByteBuf writeBlockPos(net.minecraft.core.BlockPos pos) { super.writeBlockPos(pos); return this; } - public net.minecraft.util.math.BlockPos readBlockPos() { + public net.minecraft.core.BlockPos readBlockPos() { return super.readBlockPos(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java index 65546224f..9f32076a9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.recipe; -import net.minecraft.recipe.book.CraftingRecipeCategory; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; import net.pitan76.mcpitanlib.midohra.item.ItemStack; @@ -9,62 +9,62 @@ import net.pitan76.mcpitanlib.midohra.world.World; public class CraftingRecipe extends Recipe { - private final net.minecraft.recipe.CraftingRecipe recipe; + private final net.minecraft.world.item.crafting.CraftingRecipe recipe; - protected CraftingRecipe(net.minecraft.recipe.CraftingRecipe recipe) { + protected CraftingRecipe(net.minecraft.world.item.crafting.CraftingRecipe recipe) { super(null); this.recipe = recipe; } - public static CraftingRecipe of(net.minecraft.recipe.CraftingRecipe recipe) { + public static CraftingRecipe of(net.minecraft.world.item.crafting.CraftingRecipe recipe) { return new CraftingRecipe(recipe); } - public net.minecraft.recipe.CraftingRecipe getRaw() { + public net.minecraft.world.item.crafting.CraftingRecipe getRaw() { return recipe; } - public net.minecraft.recipe.CraftingRecipe toMinecraft() { + public net.minecraft.world.item.crafting.CraftingRecipe toMinecraft() { return getRaw(); } - public CraftingRecipeCategory getRawCategory() { - return getRaw().getCategory(); + public CraftingBookCategory getRawCategory() { + return getRaw().category(); } public boolean matches(CraftingRecipeInputOrInventory input, World world) { return getRaw().matches(input.getRaw(), world.getRaw()); } - public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, World world) { - return getRaw().craft(input.getRaw(), world.getRaw().getRegistryManager()); + public net.minecraft.world.item.ItemStack craft(CraftingRecipeInputOrInventory input, World world) { + return getRaw().assemble(input.getRaw(), world.getRaw().registryAccess()); } public ItemStack craftMidohra(CraftingRecipeInputOrInventory input, World world) { return ItemStack.of(craft(input, world)); } - public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, CompatRegistryLookup registryLookup) { - return getRaw().craft(input.getRaw(), registryLookup.getRegistryLookup()); + public net.minecraft.world.item.ItemStack craft(CraftingRecipeInputOrInventory input, CompatRegistryLookup registryLookup) { + return getRaw().assemble(input.getRaw(), registryLookup.getRegistryLookup()); } - public net.minecraft.item.ItemStack craft(CraftingRecipeInputOrInventory input, net.minecraft.world.World world) { - return getRaw().craft(input.getRaw(), world.getRegistryManager()); + public net.minecraft.world.item.ItemStack craft(CraftingRecipeInputOrInventory input, net.minecraft.world.level.Level world) { + return getRaw().assemble(input.getRaw(), world.registryAccess()); } - public DefaultedList getRecipeRemaindersDefaultedList(CraftingRecipeInputOrInventory input) { - return getRaw().getRecipeRemainders(input.getRaw()); + public NonNullList getRecipeRemaindersDefaultedList(CraftingRecipeInputOrInventory input) { + return getRaw().getRemainingItems(input.getRaw()); } public ItemStackList getRecipeRemainders(CraftingRecipeInputOrInventory input) { return ItemStackList.of(getRecipeRemaindersDefaultedList(input)); } - public net.minecraft.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, net.minecraft.world.World world) { + public net.minecraft.world.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, net.minecraft.world.level.Level world) { return craft(input, world); } - public net.minecraft.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, World world) { + public net.minecraft.world.item.ItemStack getOutput(CraftingRecipeInputOrInventory input, World world) { return getOutput(input, world.getRaw()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java index 9b72bb7f5..e34a99084 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.recipe; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.IngredientUtil; import net.pitan76.mcpitanlib.midohra.item.ItemStack; @@ -10,22 +10,22 @@ import java.util.List; public class Ingredient { - private final net.minecraft.recipe.Ingredient ingredient; + private final net.minecraft.world.item.crafting.Ingredient ingredient; - protected Ingredient(net.minecraft.recipe.Ingredient ingredient) { + protected Ingredient(net.minecraft.world.item.crafting.Ingredient ingredient) { this.ingredient = ingredient; } - public static Ingredient of(net.minecraft.recipe.Ingredient ingredient) { + public static Ingredient of(net.minecraft.world.item.crafting.Ingredient ingredient) { return new Ingredient(ingredient); } public static Ingredient ofItems(Item... items) { - return of(net.minecraft.recipe.Ingredient.ofItems(items)); + return of(net.minecraft.world.item.crafting.Ingredient.of(items)); } public static Ingredient ofItem(Item items) { - return of(net.minecraft.recipe.Ingredient.ofItem(items)); + return of(net.minecraft.world.item.crafting.Ingredient.of(items)); } public static Ingredient fromTagById(CompatIdentifier id) { @@ -36,15 +36,15 @@ public static Ingredient fromTagByString(String id) { return of(IngredientUtil.fromTagByString(id)); } - public net.minecraft.recipe.Ingredient getRaw() { + public net.minecraft.world.item.crafting.Ingredient getRaw() { return ingredient; } - public net.minecraft.recipe.Ingredient toMinecraft() { + public net.minecraft.world.item.crafting.Ingredient toMinecraft() { return getRaw(); } - public boolean test(net.minecraft.item.ItemStack stack) { + public boolean test(net.minecraft.world.item.ItemStack stack) { return ingredient.test(stack); } @@ -60,11 +60,11 @@ public it.unimi.dsi.fastutil.ints.IntList getMatchingStacksIds() { return IngredientUtil.getMatchingStacksIds(ingredient); } - public List getMatchingStacksAsList() { + public List getMatchingStacksAsList() { return IngredientUtil.getMatchingStacksAsList(ingredient); } - public net.minecraft.item.ItemStack[] getMatchingStacks() { + public net.minecraft.world.item.ItemStack[] getMatchingStacks() { return IngredientUtil.getMatchingStacks(ingredient); } @@ -81,7 +81,7 @@ public List getMatchingItemWrappers() { public List getMatchingStacksAsMidohraList() { List stacks = new ArrayList<>(); - for (net.minecraft.item.ItemStack stack : getMatchingStacksAsList()) { + for (net.minecraft.world.item.ItemStack stack : getMatchingStacksAsList()) { stacks.add(ItemStack.of(stack)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java index f840f157b..f7f04f031 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.midohra.recipe; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.RecipeSerializer; -import net.minecraft.recipe.input.RecipeInput; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.RecipeInput; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.recipe.input.RecipeInputOrInventory; import net.pitan76.mcpitanlib.midohra.recipe.input.TypedRecipeInputOrInventory; @@ -11,33 +11,33 @@ import java.util.List; public class Recipe { - private final net.minecraft.recipe.Recipe recipe; + private final net.minecraft.world.item.crafting.Recipe recipe; - protected Recipe(net.minecraft.recipe.Recipe recipe) { + protected Recipe(net.minecraft.world.item.crafting.Recipe recipe) { this.recipe = recipe; } - public static Recipe of(net.minecraft.recipe.Recipe recipe) { + public static Recipe of(net.minecraft.world.item.crafting.Recipe recipe) { return new Recipe(recipe); } - public static CraftingRecipe of(net.minecraft.recipe.CraftingRecipe recipe) { + public static CraftingRecipe of(net.minecraft.world.item.crafting.CraftingRecipe recipe) { return new CraftingRecipe(recipe); } - public static ShapedRecipe of(net.minecraft.recipe.ShapedRecipe recipe) { + public static ShapedRecipe of(net.minecraft.world.item.crafting.ShapedRecipe recipe) { return new ShapedRecipe(recipe); } - public static ShapelessRecipe of(net.minecraft.recipe.ShapelessRecipe recipe) { + public static ShapelessRecipe of(net.minecraft.world.item.crafting.ShapelessRecipe recipe) { return new ShapelessRecipe(recipe); } - public net.minecraft.recipe.Recipe getRaw() { + public net.minecraft.world.item.crafting.Recipe getRaw() { return recipe; } - public net.minecraft.recipe.Recipe toMinecraft() { + public net.minecraft.world.item.crafting.Recipe toMinecraft() { return getRaw(); } @@ -53,12 +53,12 @@ public boolean matches(RecipeInputOrInventory input, World world) { return false; } - public net.minecraft.item.ItemStack craft(RecipeInputOrInventory input, World world) { + public net.minecraft.world.item.ItemStack craft(RecipeInputOrInventory input, World world) { if (input instanceof TypedRecipeInputOrInventory) { return craft((TypedRecipeInputOrInventory) input, world); } - return net.minecraft.item.ItemStack.EMPTY; + return net.minecraft.world.item.ItemStack.EMPTY; } public ItemStack craftMidohra(RecipeInputOrInventory input, World world) { @@ -66,11 +66,11 @@ public ItemStack craftMidohra(RecipeInputOrInventory input, World world) { } public boolean matches(TypedRecipeInputOrInventory input, World world) { - return ((net.minecraft.recipe.Recipe)getRaw()).matches(input.getRecipeInput(), world.getRaw()); + return ((net.minecraft.world.item.crafting.Recipe)getRaw()).matches(input.getRecipeInput(), world.getRaw()); } - public net.minecraft.item.ItemStack craft(TypedRecipeInputOrInventory input, World world) { - return ((net.minecraft.recipe.Recipe)getRaw()).craft(input.getRecipeInput(), world.getRaw().getRegistryManager()); + public net.minecraft.world.item.ItemStack craft(TypedRecipeInputOrInventory input, World world) { + return ((net.minecraft.world.item.crafting.Recipe)getRaw()).assemble(input.getRecipeInput(), world.getRaw().registryAccess()); } public ItemStack craftMidohra(TypedRecipeInputOrInventory input, World world) { @@ -78,7 +78,7 @@ public ItemStack craftMidohra(TypedRecipeInputOrInventor } public String getGroup() { - return getRaw().getGroup(); + return getRaw().group(); } public RecipeType getType() { @@ -86,6 +86,6 @@ public RecipeType getType() { } public List getInputs() { - return getRaw().getIngredientPlacement().getIngredients(); + return getRaw().placementInfo().ingredients(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java index 5b039fe10..cb1e1dac8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.midohra.recipe; public class RecipeManager { - private final net.minecraft.recipe.RecipeManager recipeManager; + private final net.minecraft.world.item.crafting.RecipeAccess recipeManager; - protected RecipeManager(net.minecraft.recipe.RecipeManager recipeManager) { + protected RecipeManager(net.minecraft.world.item.crafting.RecipeAccess recipeManager) { this.recipeManager = recipeManager; } - public static RecipeManager of(net.minecraft.recipe.RecipeManager recipeManager) { + public static RecipeManager of(net.minecraft.world.item.crafting.RecipeAccess recipeManager) { return new RecipeManager(recipeManager); } - public net.minecraft.recipe.RecipeManager getRaw() { + public net.minecraft.world.item.crafting.RecipeAccess getRaw() { return recipeManager; } - public net.minecraft.recipe.RecipeManager toMinecraft() { + public net.minecraft.world.item.crafting.RecipeAccess toMinecraft() { return getRaw(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java index d8348bab6..0eb0c82ed 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java @@ -1,37 +1,37 @@ package net.pitan76.mcpitanlib.midohra.recipe; -import net.minecraft.registry.Registries; +import net.minecraft.core.registries.BuiltInRegistries; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; public class RecipeType { - private final net.minecraft.recipe.RecipeType recipeType; + private final net.minecraft.world.item.crafting.RecipeType recipeType; - public static final RecipeType CRAFTING = new RecipeType(net.minecraft.recipe.RecipeType.CRAFTING); - public static final RecipeType SMELTING = new RecipeType(net.minecraft.recipe.RecipeType.SMELTING); - public static final RecipeType BLASTING = new RecipeType(net.minecraft.recipe.RecipeType.BLASTING); - public static final RecipeType SMOKING = new RecipeType(net.minecraft.recipe.RecipeType.SMOKING); - public static final RecipeType CAMPFIRE_COOKING = new RecipeType(net.minecraft.recipe.RecipeType.CAMPFIRE_COOKING); - public static final RecipeType STONECUTTING = new RecipeType(net.minecraft.recipe.RecipeType.STONECUTTING); - public static final RecipeType SMITHING = new RecipeType(net.minecraft.recipe.RecipeType.SMITHING); + public static final RecipeType CRAFTING = new RecipeType(net.minecraft.world.item.crafting.RecipeType.CRAFTING); + public static final RecipeType SMELTING = new RecipeType(net.minecraft.world.item.crafting.RecipeType.SMELTING); + public static final RecipeType BLASTING = new RecipeType(net.minecraft.world.item.crafting.RecipeType.BLASTING); + public static final RecipeType SMOKING = new RecipeType(net.minecraft.world.item.crafting.RecipeType.SMOKING); + public static final RecipeType CAMPFIRE_COOKING = new RecipeType(net.minecraft.world.item.crafting.RecipeType.CAMPFIRE_COOKING); + public static final RecipeType STONECUTTING = new RecipeType(net.minecraft.world.item.crafting.RecipeType.STONECUTTING); + public static final RecipeType SMITHING = new RecipeType(net.minecraft.world.item.crafting.RecipeType.SMITHING); - protected RecipeType(net.minecraft.recipe.RecipeType recipeType) { + protected RecipeType(net.minecraft.world.item.crafting.RecipeType recipeType) { this.recipeType = recipeType; } - public static RecipeType of(net.minecraft.recipe.RecipeType recipeType) { - if (recipeType == net.minecraft.recipe.RecipeType.CRAFTING) { + public static RecipeType of(net.minecraft.world.item.crafting.RecipeType recipeType) { + if (recipeType == net.minecraft.world.item.crafting.RecipeType.CRAFTING) { return CRAFTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.SMELTING) { + } else if (recipeType == net.minecraft.world.item.crafting.RecipeType.SMELTING) { return SMELTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.BLASTING) { + } else if (recipeType == net.minecraft.world.item.crafting.RecipeType.BLASTING) { return BLASTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.SMOKING) { + } else if (recipeType == net.minecraft.world.item.crafting.RecipeType.SMOKING) { return SMOKING; - } else if (recipeType == net.minecraft.recipe.RecipeType.CAMPFIRE_COOKING) { + } else if (recipeType == net.minecraft.world.item.crafting.RecipeType.CAMPFIRE_COOKING) { return CAMPFIRE_COOKING; - } else if (recipeType == net.minecraft.recipe.RecipeType.STONECUTTING) { + } else if (recipeType == net.minecraft.world.item.crafting.RecipeType.STONECUTTING) { return STONECUTTING; - } else if (recipeType == net.minecraft.recipe.RecipeType.SMITHING) { + } else if (recipeType == net.minecraft.world.item.crafting.RecipeType.SMITHING) { return SMITHING; } @@ -39,19 +39,19 @@ public static RecipeType of(net.minecraft.recipe.RecipeType recipeType) { } public static RecipeType of(CompatIdentifier id) { - return of(Registries.RECIPE_TYPE.get(id.toMinecraft())); + return of(BuiltInRegistries.RECIPE_TYPE.getValue(id.toMinecraft())); } - public net.minecraft.recipe.RecipeType getRaw() { + public net.minecraft.world.item.crafting.RecipeType getRaw() { return recipeType; } - public net.minecraft.recipe.RecipeType toMinecraft() { + public net.minecraft.world.item.crafting.RecipeType toMinecraft() { return getRaw(); } public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(Registries.RECIPE_TYPE.getId(recipeType)); + return CompatIdentifier.fromMinecraft(BuiltInRegistries.RECIPE_TYPE.getKey(recipeType)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java index 29ebedd43..8c23c4598 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java @@ -11,19 +11,19 @@ import java.util.List; public class ServerRecipeManager extends RecipeManager { - private net.minecraft.recipe.ServerRecipeManager serverRecipeManager; + private net.minecraft.world.item.crafting.RecipeManager serverRecipeManager; - protected ServerRecipeManager(net.minecraft.recipe.ServerRecipeManager serverRecipeManager) { + protected ServerRecipeManager(net.minecraft.world.item.crafting.RecipeManager serverRecipeManager) { super(null); this.serverRecipeManager = serverRecipeManager; } - public static ServerRecipeManager of(net.minecraft.recipe.ServerRecipeManager serverRecipeManager) { + public static ServerRecipeManager of(net.minecraft.world.item.crafting.RecipeManager serverRecipeManager) { return new ServerRecipeManager(serverRecipeManager); } - public static ServerRecipeManager of(net.minecraft.server.world.ServerWorld world) { - return of(world.getRecipeManager()); + public static ServerRecipeManager of(net.minecraft.server.level.ServerLevel world) { + return of(world.recipeAccess()); } public static ServerRecipeManager of(ServerWorld world) { @@ -31,23 +31,23 @@ public static ServerRecipeManager of(ServerWorld world) { } @Override - public net.minecraft.recipe.ServerRecipeManager getRaw() { + public net.minecraft.world.item.crafting.RecipeManager getRaw() { return serverRecipeManager; } @Override - public net.minecraft.recipe.ServerRecipeManager toMinecraft() { + public net.minecraft.world.item.crafting.RecipeManager toMinecraft() { return getRaw(); } @Deprecated - public Collection> getRawRecipes() { - return serverRecipeManager.values(); + public Collection> getRawRecipes() { + return serverRecipeManager.getRecipes(); } public Collection getRecipeEntries() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { recipes.add(RecipeEntry.of(recipe)); } @@ -56,8 +56,8 @@ public Collection getRecipeEntries() { public Collection getCraftingRecipeEntries() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.CraftingRecipe) { + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.CraftingRecipe) { recipes.add(CraftingRecipeEntry.of(recipe)); } } @@ -67,8 +67,8 @@ public Collection getCraftingRecipeEntries() { public Collection getShapelessRecipeEntries() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapelessRecipe) { recipes.add(ShapelessRecipeEntry.of(recipe)); } } @@ -78,8 +78,8 @@ public Collection getShapelessRecipeEntries() { public Collection getShapedRecipeEntries() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapedRecipe) { recipes.add(ShapedRecipeEntry.of(recipe)); } } @@ -89,10 +89,10 @@ public Collection getShapedRecipeEntries() { public Collection getNormalRecipeEntries() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapelessRecipe) { recipes.add(ShapelessRecipeEntry.of(recipe)); - } else if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { + } else if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapedRecipe) { recipes.add(ShapedRecipeEntry.of(recipe)); } } @@ -102,7 +102,7 @@ public Collection getNormalRecipeEntries() { public Collection getRecipes() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { recipes.add(Recipe.of(recipe.value())); } @@ -111,9 +111,9 @@ public Collection getRecipes() { public Collection getCraftingRecipes() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.CraftingRecipe) { - recipes.add(CraftingRecipe.of((net.minecraft.recipe.CraftingRecipe) recipe.value())); + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.CraftingRecipe) { + recipes.add(CraftingRecipe.of((net.minecraft.world.item.crafting.CraftingRecipe) recipe.value())); } } @@ -122,9 +122,9 @@ public Collection getCraftingRecipes() { public Collection getShapelessRecipes() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { - recipes.add(ShapelessRecipe.of((net.minecraft.recipe.ShapelessRecipe) recipe.value())); + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapelessRecipe) { + recipes.add(ShapelessRecipe.of((net.minecraft.world.item.crafting.ShapelessRecipe) recipe.value())); } } @@ -133,9 +133,9 @@ public Collection getShapelessRecipes() { public Collection getShapedRecipes() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { - recipes.add(ShapedRecipe.of((net.minecraft.recipe.ShapedRecipe) recipe.value())); + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapedRecipe) { + recipes.add(ShapedRecipe.of((net.minecraft.world.item.crafting.ShapedRecipe) recipe.value())); } } @@ -144,11 +144,11 @@ public Collection getShapedRecipes() { public Collection getNormalRecipes() { List recipes = new ArrayList<>(); - for (net.minecraft.recipe.RecipeEntry recipe : serverRecipeManager.values()) { - if (recipe.value() instanceof net.minecraft.recipe.ShapelessRecipe) { - recipes.add(ShapelessRecipe.of((net.minecraft.recipe.ShapelessRecipe) recipe.value())); - } else if (recipe.value() instanceof net.minecraft.recipe.ShapedRecipe) { - recipes.add(ShapedRecipe.of((net.minecraft.recipe.ShapedRecipe) recipe.value())); + for (net.minecraft.world.item.crafting.RecipeHolder recipe : serverRecipeManager.getRecipes()) { + if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapelessRecipe) { + recipes.add(ShapelessRecipe.of((net.minecraft.world.item.crafting.ShapelessRecipe) recipe.value())); + } else if (recipe.value() instanceof net.minecraft.world.item.crafting.ShapedRecipe) { + recipes.add(ShapedRecipe.of((net.minecraft.world.item.crafting.ShapedRecipe) recipe.value())); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java index 3d75164fe..3c46a0bce 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java @@ -1,27 +1,27 @@ package net.pitan76.mcpitanlib.midohra.recipe; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; public class ShapedRecipe extends CraftingRecipe { - private final net.minecraft.recipe.ShapedRecipe recipe; + private final net.minecraft.world.item.crafting.ShapedRecipe recipe; - protected ShapedRecipe(net.minecraft.recipe.ShapedRecipe recipe) { + protected ShapedRecipe(net.minecraft.world.item.crafting.ShapedRecipe recipe) { super(null); this.recipe = recipe; } - public static ShapedRecipe of(net.minecraft.recipe.ShapedRecipe recipe) { + public static ShapedRecipe of(net.minecraft.world.item.crafting.ShapedRecipe recipe) { return new ShapedRecipe(recipe); } - public net.minecraft.recipe.ShapedRecipe getRaw() { + public net.minecraft.world.item.crafting.ShapedRecipe getRaw() { return recipe; } - public net.minecraft.recipe.ShapedRecipe toMinecraft() { + public net.minecraft.world.item.crafting.ShapedRecipe toMinecraft() { return getRaw(); } @@ -30,19 +30,19 @@ public boolean matches(CraftingRecipeInputOrInventory input) { } @Deprecated - public net.minecraft.item.ItemStack craft() { - return getRaw().craft(null, null); + public net.minecraft.world.item.ItemStack craft() { + return getRaw().assemble(null, null); } - public net.minecraft.item.ItemStack craft(CompatRegistryLookup registryLookup) { - return getRaw().craft(null, registryLookup.getRegistryLookup()); + public net.minecraft.world.item.ItemStack craft(CompatRegistryLookup registryLookup) { + return getRaw().assemble(null, registryLookup.getRegistryLookup()); } - public net.minecraft.item.ItemStack craft(World world) { - return getRaw().craft(null, world.getRegistryManager()); + public net.minecraft.world.item.ItemStack craft(Level world) { + return getRaw().assemble(null, world.registryAccess()); } - public net.minecraft.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { + public net.minecraft.world.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { return craft(world.getRaw()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java index 26d28b05b..5bb66e652 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java @@ -1,27 +1,27 @@ package net.pitan76.mcpitanlib.midohra.recipe; -import net.minecraft.world.World; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; public class ShapelessRecipe extends CraftingRecipe { - private final net.minecraft.recipe.ShapelessRecipe recipe; + private final net.minecraft.world.item.crafting.ShapelessRecipe recipe; - protected ShapelessRecipe(net.minecraft.recipe.ShapelessRecipe recipe) { + protected ShapelessRecipe(net.minecraft.world.item.crafting.ShapelessRecipe recipe) { super(null); this.recipe = recipe; } - public static ShapelessRecipe of(net.minecraft.recipe.ShapelessRecipe recipe) { + public static ShapelessRecipe of(net.minecraft.world.item.crafting.ShapelessRecipe recipe) { return new ShapelessRecipe(recipe); } - public net.minecraft.recipe.ShapelessRecipe getRaw() { + public net.minecraft.world.item.crafting.ShapelessRecipe getRaw() { return recipe; } - public net.minecraft.recipe.ShapelessRecipe toMinecraft() { + public net.minecraft.world.item.crafting.ShapelessRecipe toMinecraft() { return getRaw(); } @@ -30,19 +30,19 @@ public boolean matches(CraftingRecipeInputOrInventory input) { } @Deprecated - public net.minecraft.item.ItemStack craft() { - return getRaw().craft(null, null); + public net.minecraft.world.item.ItemStack craft() { + return getRaw().assemble(null, null); } - public net.minecraft.item.ItemStack craft(CompatRegistryLookup registryLookup) { - return getRaw().craft(null, registryLookup.getRegistryLookup()); + public net.minecraft.world.item.ItemStack craft(CompatRegistryLookup registryLookup) { + return getRaw().assemble(null, registryLookup.getRegistryLookup()); } - public net.minecraft.item.ItemStack craft(World world) { - return getRaw().craft(null, world.getRegistryManager()); + public net.minecraft.world.item.ItemStack craft(Level world) { + return getRaw().assemble(null, world.registryAccess()); } - public net.minecraft.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { + public net.minecraft.world.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { return craft(world.getRaw()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java index 6dff1c145..748e712a1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java @@ -1,30 +1,30 @@ package net.pitan76.mcpitanlib.midohra.recipe.entry; -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; public class CraftingRecipeEntry extends RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; + private final net.minecraft.world.item.crafting.RecipeHolder recipeEntry; - protected CraftingRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + protected CraftingRecipeEntry(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { super(null); this.recipeEntry = recipeEntry; } - public static CraftingRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { + public static CraftingRecipeEntry _of(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { return new CraftingRecipeEntry(recipeEntry); } - public static CraftingRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); + public static CraftingRecipeEntry of(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { + return _of((net.minecraft.world.item.crafting.RecipeHolder) recipeEntry); } - public static CraftingRecipeEntry of(net.minecraft.recipe.CraftingRecipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + public static CraftingRecipeEntry of(net.minecraft.world.item.crafting.CraftingRecipe recipe, CompatIdentifier id) { + ResourceKey> key = ResourceKey.create(Registries.RECIPE, id.toMinecraft()); + net.minecraft.world.item.crafting.RecipeHolder recipeEntry = new net.minecraft.world.item.crafting.RecipeHolder<>(key, recipe); return of(recipeEntry); } @@ -34,12 +34,12 @@ public static CraftingRecipeEntry of(CraftingRecipe recipe, CompatIdentifier id) } @Override - public net.minecraft.recipe.RecipeEntry getRaw() { + public net.minecraft.world.item.crafting.RecipeHolder getRaw() { return recipeEntry; } @Override - public net.minecraft.recipe.RecipeEntry toMinecraft() { + public net.minecraft.world.item.crafting.RecipeHolder toMinecraft() { return getRaw(); } @@ -49,7 +49,7 @@ public CraftingRecipe getRecipe() { } @Override - public net.minecraft.recipe.CraftingRecipe getRawRecipe() { + public net.minecraft.world.item.crafting.CraftingRecipe getRawRecipe() { return getRaw().value(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java index 9e7814374..598f807dd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.recipe.entry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.pitan76.mcpitanlib.api.recipe.v2.CompatRecipeEntry; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; @@ -9,19 +9,19 @@ import net.pitan76.mcpitanlib.midohra.recipe.RecipeType; public class RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; + private final net.minecraft.world.item.crafting.RecipeHolder recipeEntry; - protected RecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + protected RecipeEntry(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { this.recipeEntry = recipeEntry; } - public static RecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { + public static RecipeEntry of(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { return new RecipeEntry(recipeEntry); } - public static RecipeEntry of(net.minecraft.recipe.Recipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + public static RecipeEntry of(net.minecraft.world.item.crafting.Recipe recipe, CompatIdentifier id) { + ResourceKey> key = ResourceKey.create(Registries.RECIPE, id.toMinecraft()); + net.minecraft.world.item.crafting.RecipeHolder recipeEntry = new net.minecraft.world.item.crafting.RecipeHolder<>(key, recipe); return of(recipeEntry); } @@ -29,7 +29,7 @@ public static RecipeEntry of(Recipe recipe, CompatIdentifier id) { return of(recipe.toMinecraft(), id); } - public static CraftingRecipeEntry of(net.minecraft.recipe.CraftingRecipe recipe, CompatIdentifier id) { + public static CraftingRecipeEntry of(net.minecraft.world.item.crafting.CraftingRecipe recipe, CompatIdentifier id) { return CraftingRecipeEntry.of(recipe, id); } @@ -37,7 +37,7 @@ public static CraftingRecipeEntry of(CraftingRecipe recipe, CompatIdentifier id) return CraftingRecipeEntry.of(recipe, id); } - public static ShapedRecipeEntry of(net.minecraft.recipe.ShapedRecipe recipe, CompatIdentifier id) { + public static ShapedRecipeEntry of(net.minecraft.world.item.crafting.ShapedRecipe recipe, CompatIdentifier id) { return ShapedRecipeEntry.of(recipe, id); } @@ -45,7 +45,7 @@ public static ShapedRecipeEntry of(net.pitan76.mcpitanlib.midohra.recipe.ShapedR return ShapedRecipeEntry.of(recipe, id); } - public static ShapelessRecipeEntry of(net.minecraft.recipe.ShapelessRecipe recipe, CompatIdentifier id) { + public static ShapelessRecipeEntry of(net.minecraft.world.item.crafting.ShapelessRecipe recipe, CompatIdentifier id) { return ShapelessRecipeEntry.of(recipe, id); } @@ -53,23 +53,23 @@ public static ShapelessRecipeEntry of(net.pitan76.mcpitanlib.midohra.recipe.Shap return ShapelessRecipeEntry.of(recipe, id); } - public net.minecraft.recipe.RecipeEntry getRaw() { + public net.minecraft.world.item.crafting.RecipeHolder getRaw() { return recipeEntry; } - public net.minecraft.recipe.RecipeEntry toMinecraft() { + public net.minecraft.world.item.crafting.RecipeHolder toMinecraft() { return getRaw(); } public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(getRaw().id().getValue()); + return CompatIdentifier.fromMinecraft(getRaw().id().identifier()); } public CompatRecipeEntry toCompatRecipeEntry() { return new CompatRecipeEntry(getRaw()); } - public net.minecraft.recipe.Recipe getRawRecipe() { + public net.minecraft.world.item.crafting.Recipe getRawRecipe() { return getRaw().value(); } @@ -81,7 +81,7 @@ public RecipeType getRecipeType() { return RecipeType.of(getRawRecipeType()); } - public net.minecraft.recipe.RecipeType getRawRecipeType() { + public net.minecraft.world.item.crafting.RecipeType getRawRecipeType() { return getRaw().value().getType(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java index 569564a95..31ab60c23 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java @@ -1,30 +1,30 @@ package net.pitan76.mcpitanlib.midohra.recipe.entry; -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.recipe.ShapedRecipe; public class ShapedRecipeEntry extends RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; + private final net.minecraft.world.item.crafting.RecipeHolder recipeEntry; - protected ShapedRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + protected ShapedRecipeEntry(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { super(null); this.recipeEntry = recipeEntry; } - public static ShapedRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { + public static ShapedRecipeEntry _of(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { return new ShapedRecipeEntry(recipeEntry); } - public static ShapedRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); + public static ShapedRecipeEntry of(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { + return _of((net.minecraft.world.item.crafting.RecipeHolder) recipeEntry); } - public static ShapedRecipeEntry of(net.minecraft.recipe.ShapedRecipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + public static ShapedRecipeEntry of(net.minecraft.world.item.crafting.ShapedRecipe recipe, CompatIdentifier id) { + ResourceKey> key = ResourceKey.create(Registries.RECIPE, id.toMinecraft()); + net.minecraft.world.item.crafting.RecipeHolder recipeEntry = new net.minecraft.world.item.crafting.RecipeHolder<>(key, recipe); return of(recipeEntry); } @@ -34,12 +34,12 @@ public static ShapedRecipeEntry of(ShapedRecipe recipe, CompatIdentifier id) { } @Override - public net.minecraft.recipe.RecipeEntry getRaw() { + public net.minecraft.world.item.crafting.RecipeHolder getRaw() { return recipeEntry; } @Override - public net.minecraft.recipe.RecipeEntry toMinecraft() { + public net.minecraft.world.item.crafting.RecipeHolder toMinecraft() { return getRaw(); } @@ -49,7 +49,7 @@ public ShapedRecipe getRecipe() { } @Override - public net.minecraft.recipe.ShapedRecipe getRawRecipe() { + public net.minecraft.world.item.crafting.ShapedRecipe getRawRecipe() { return getRaw().value(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java index 2026084bd..51f459565 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java @@ -1,30 +1,30 @@ package net.pitan76.mcpitanlib.midohra.recipe.entry; -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.resources.ResourceKey; +import net.minecraft.core.registries.Registries; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.recipe.ShapelessRecipe; public class ShapelessRecipeEntry extends RecipeEntry { - private final net.minecraft.recipe.RecipeEntry recipeEntry; + private final net.minecraft.world.item.crafting.RecipeHolder recipeEntry; - protected ShapelessRecipeEntry(net.minecraft.recipe.RecipeEntry recipeEntry) { + protected ShapelessRecipeEntry(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { super(null); this.recipeEntry = recipeEntry; } - public static ShapelessRecipeEntry _of(net.minecraft.recipe.RecipeEntry recipeEntry) { + public static ShapelessRecipeEntry _of(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { return new ShapelessRecipeEntry(recipeEntry); } - public static ShapelessRecipeEntry of(net.minecraft.recipe.RecipeEntry recipeEntry) { - return _of((net.minecraft.recipe.RecipeEntry) recipeEntry); + public static ShapelessRecipeEntry of(net.minecraft.world.item.crafting.RecipeHolder recipeEntry) { + return _of((net.minecraft.world.item.crafting.RecipeHolder) recipeEntry); } - public static ShapelessRecipeEntry of(net.minecraft.recipe.ShapelessRecipe recipe, CompatIdentifier id) { - RegistryKey> key = RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft()); - net.minecraft.recipe.RecipeEntry recipeEntry = new net.minecraft.recipe.RecipeEntry<>(key, recipe); + public static ShapelessRecipeEntry of(net.minecraft.world.item.crafting.ShapelessRecipe recipe, CompatIdentifier id) { + ResourceKey> key = ResourceKey.create(Registries.RECIPE, id.toMinecraft()); + net.minecraft.world.item.crafting.RecipeHolder recipeEntry = new net.minecraft.world.item.crafting.RecipeHolder<>(key, recipe); return of(recipeEntry); } @@ -34,12 +34,12 @@ public static ShapelessRecipeEntry of(ShapelessRecipe recipe, CompatIdentifier i } @Override - public net.minecraft.recipe.RecipeEntry getRaw() { + public net.minecraft.world.item.crafting.RecipeHolder getRaw() { return recipeEntry; } @Override - public net.minecraft.recipe.RecipeEntry toMinecraft() { + public net.minecraft.world.item.crafting.RecipeHolder toMinecraft() { return getRaw(); } @@ -49,7 +49,7 @@ public ShapelessRecipe getRecipe() { } @Override - public net.minecraft.recipe.ShapelessRecipe getRawRecipe() { + public net.minecraft.world.item.crafting.ShapelessRecipe getRawRecipe() { return getRaw().value(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java index 2b65cfda1..cc72d67bf 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java @@ -1,64 +1,64 @@ package net.pitan76.mcpitanlib.midohra.recipe.input; -import net.minecraft.inventory.CraftingInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.recipe.input.CraftingRecipeInput; +import net.minecraft.world.inventory.TransientCraftingContainer; +import net.minecraft.world.Container; +import net.minecraft.world.item.crafting.CraftingInput; import org.jetbrains.annotations.Nullable; public class CraftingRecipeInputOrInventory extends RecipeInputOrInventory { - private final CraftingRecipeInput recipeInput; - private CraftingInventory inventory = null; + private final CraftingInput recipeInput; + private TransientCraftingContainer inventory = null; - public static CraftingRecipeInputOrInventory EMPTY = new CraftingRecipeInputOrInventory(CraftingRecipeInput.EMPTY); + public static CraftingRecipeInputOrInventory EMPTY = new CraftingRecipeInputOrInventory(CraftingInput.EMPTY); - protected CraftingRecipeInputOrInventory(CraftingRecipeInput recipeInput) { + protected CraftingRecipeInputOrInventory(CraftingInput recipeInput) { super(null); this.recipeInput = recipeInput; } - protected CraftingRecipeInputOrInventory(CraftingInventory inventory) { + protected CraftingRecipeInputOrInventory(TransientCraftingContainer inventory) { super(null); - this.recipeInput = inventory.createRecipeInput(); + this.recipeInput = inventory.asCraftInput(); this.inventory = inventory; } - public static CraftingRecipeInputOrInventory of(CraftingRecipeInput recipeInput) { + public static CraftingRecipeInputOrInventory of(CraftingInput recipeInput) { return new CraftingRecipeInputOrInventory(recipeInput); } - public static CraftingRecipeInputOrInventory of(Inventory inventory) { - if (inventory instanceof CraftingRecipeInput) { - return of((CraftingRecipeInput) inventory); + public static CraftingRecipeInputOrInventory of(Container inventory) { + if (inventory instanceof CraftingInput) { + return of((CraftingInput) inventory); } return EMPTY; } - public static CraftingRecipeInputOrInventory of(CraftingInventory inventory) { + public static CraftingRecipeInputOrInventory of(TransientCraftingContainer inventory) { return new CraftingRecipeInputOrInventory(inventory); } @Nullable @Override - public CraftingRecipeInput getRaw() { + public CraftingInput getRaw() { return recipeInput; } @Nullable @Override - public CraftingRecipeInput toMinecraft() { + public CraftingInput toMinecraft() { return getRaw(); } @Nullable @Override - public CraftingRecipeInput getRecipeInput() { + public CraftingInput getRecipeInput() { return getRaw(); } @Nullable @Override - public Inventory getInventory() { + public Container getInventory() { if (inventory != null) return inventory; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java index 71ff3d195..f90bd635d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.recipe.input; -import net.minecraft.inventory.Inventory; -import net.minecraft.recipe.input.RecipeInput; +import net.minecraft.world.Container; +import net.minecraft.world.item.crafting.RecipeInput; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import org.jetbrains.annotations.Nullable; @@ -18,7 +18,7 @@ public static RecipeInputOrInventory of(RecipeInput recipeInput) { return new RecipeInputOrInventory(recipeInput); } - public static RecipeInputOrInventory of(Inventory inventory) { + public static RecipeInputOrInventory of(Container inventory) { if (inventory instanceof RecipeInput) { return of((RecipeInput) inventory); } @@ -42,9 +42,9 @@ public RecipeInput getRecipeInput() { } @Nullable - public Inventory getInventory() { - if (getRaw() instanceof Inventory) { - return (Inventory) getRaw(); + public Container getInventory() { + if (getRaw() instanceof Container) { + return (Container) getRaw(); } return null; @@ -66,10 +66,10 @@ public boolean isEmpty() { return getRaw().isEmpty(); } - public net.minecraft.item.ItemStack getStack(int slot) { - if (isNone()) return net.minecraft.item.ItemStack.EMPTY; + public net.minecraft.world.item.ItemStack getStack(int slot) { + if (isNone()) return net.minecraft.world.item.ItemStack.EMPTY; - return getRaw().getStackInSlot(slot); + return getRaw().getItem(slot); } public ItemStack getMidohraStack(int slot) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java index 66f46d30d..d4cee859f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.recipe.input; -import net.minecraft.inventory.Inventory; -import net.minecraft.recipe.input.RecipeInput; +import net.minecraft.world.Container; +import net.minecraft.world.item.crafting.RecipeInput; import org.jetbrains.annotations.Nullable; public class TypedRecipeInputOrInventory extends RecipeInputOrInventory { @@ -18,7 +18,7 @@ public static TypedRecipeInputOrInventory _of(T recip return new TypedRecipeInputOrInventory<>(recipeInput); } - public static TypedRecipeInputOrInventory of(Inventory inventory) { + public static TypedRecipeInputOrInventory of(Container inventory) { if (inventory instanceof RecipeInput) { return _of((RecipeInput) inventory); } @@ -46,9 +46,9 @@ public T toMinecraft() { @Nullable @Override - public Inventory getInventory() { - if (getRaw() instanceof Inventory) { - return (Inventory) getRaw(); + public Container getInventory() { + if (getRaw() instanceof Container) { + return (Container) getRaw(); } return null; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java index ecfae63c7..6647b30f3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java @@ -11,30 +11,30 @@ import java.nio.charset.StandardCharsets; public class Resource { - private final net.minecraft.resource.Resource resource; + private final net.minecraft.server.packs.resources.Resource resource; - protected Resource(net.minecraft.resource.Resource resource) { + protected Resource(net.minecraft.server.packs.resources.Resource resource) { this.resource = resource; } - public static Resource of(net.minecraft.resource.Resource resource) { + public static Resource of(net.minecraft.server.packs.resources.Resource resource) { return new Resource(resource); } - public net.minecraft.resource.Resource getRaw() { + public net.minecraft.server.packs.resources.Resource getRaw() { return resource; } - public net.minecraft.resource.Resource toMinecraft() { + public net.minecraft.server.packs.resources.Resource toMinecraft() { return getRaw(); } public BufferedReader getReader() throws IOException { - return resource.getReader(); + return resource.openAsReader(); } public String getPackId() { - return resource.getPackId(); + return resource.sourcePackId(); } public InputStream getInputStream() { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java index efc080618..47867b74c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java @@ -2,9 +2,9 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; +import net.minecraft.client.Minecraft; import net.minecraft.resources.Identifier; -import net.minecraft.world.WorldAccess; +import net.minecraft.world.level.LevelAccessor; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.LoggerUtil; import net.pitan76.mcpitanlib.api.util.ResourceUtil; @@ -17,13 +17,13 @@ import java.util.Optional; public class ResourceManager { - private final net.minecraft.resource.ResourceManager resourceManager; + private final net.minecraft.server.packs.resources.ResourceManager resourceManager; - protected ResourceManager(net.minecraft.resource.ResourceManager resourceManager) { + protected ResourceManager(net.minecraft.server.packs.resources.ResourceManager resourceManager) { this.resourceManager = resourceManager; } - public static ResourceManager of(net.minecraft.resource.ResourceManager resourceManager) { + public static ResourceManager of(net.minecraft.server.packs.resources.ResourceManager resourceManager) { return new ResourceManager(resourceManager); } @@ -36,11 +36,11 @@ public static ResourceManager of(MCServer server) { } @Environment(EnvType.CLIENT) - public static ResourceManager of(MinecraftClient client) { + public static ResourceManager of(Minecraft client) { return of(client.getResourceManager()); } - public static ResourceManager of(WorldAccess worldAccess) { + public static ResourceManager of(LevelAccessor worldAccess) { return of(worldAccess.getServer()); } @@ -48,19 +48,19 @@ public static ResourceManager of(net.pitan76.mcpitanlib.midohra.world.WorldAcces return of(worldAccess.getServer()); } - public net.minecraft.resource.ResourceManager getRaw() { + public net.minecraft.server.packs.resources.ResourceManager getRaw() { return resourceManager; } - public net.minecraft.resource.ResourceManager toMinecraft() { + public net.minecraft.server.packs.resources.ResourceManager toMinecraft() { return getRaw(); } public Map findResources(String startPath, String endPath) { Map map = new HashMap<>(); try { - Map rawMap = ResourceUtil.findResources(resourceManager, startPath, endPath); - for (Map.Entry entry : rawMap.entrySet()) { + Map rawMap = ResourceUtil.findResources(resourceManager, startPath, endPath); + for (Map.Entry entry : rawMap.entrySet()) { map.put(CompatIdentifier.fromMinecraft(entry.getKey()), Resource.of(entry.getValue())); } } catch (IOException e) { @@ -72,12 +72,12 @@ public Map findResources(String startPath, String en } public Resource getResource(CompatIdentifier id) { - Optional resource = resourceManager.getResource(id.toMinecraft()); + Optional resource = resourceManager.getResource(id.toMinecraft()); return resource.map(Resource::of).orElse(null); } public List getAllResources(CompatIdentifier id) { - return resourceManager.getAllResources(id.toMinecraft()) + return resourceManager.getResourceStack(id.toMinecraft()) .stream().map(Resource::of).toList(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java index 36efcb21a..8a4331e0b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.midohra.server; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.BannedIpList; -import net.minecraft.server.BannedPlayerList; +import net.minecraft.world.entity.player.Player; +import net.minecraft.server.players.IpBanList; +import net.minecraft.server.players.UserBanList; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.Whitelist; +import net.minecraft.server.players.UserWhiteList; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.TextUtil; @@ -16,18 +16,18 @@ import java.util.UUID; public class PlayerManager { - private final net.minecraft.server.PlayerManager playerManager; + private final net.minecraft.server.players.PlayerList playerManager; - protected PlayerManager(net.minecraft.server.PlayerManager playerManager) { + protected PlayerManager(net.minecraft.server.players.PlayerList playerManager) { this.playerManager = playerManager; } - public static PlayerManager of(net.minecraft.server.PlayerManager playerManager) { + public static PlayerManager of(net.minecraft.server.players.PlayerList playerManager) { return new PlayerManager(playerManager); } public static PlayerManager of(MinecraftServer server) { - return of(server.getPlayerManager()); + return of(server.getPlayerList()); } public static PlayerManager of(MCServer server) { @@ -42,16 +42,16 @@ public static PlayerManager of(World world) { return of(world.getServer()); } - public net.minecraft.server.PlayerManager getRaw() { + public net.minecraft.server.players.PlayerList getRaw() { return playerManager; } - public net.minecraft.server.PlayerManager toMinecraft() { + public net.minecraft.server.players.PlayerList toMinecraft() { return getRaw(); } public void broadcast(TextComponent message, boolean overlay) { - getRaw().broadcast(message.getText(), overlay); + getRaw().broadcastSystemMessage(message.getText(), overlay); } public void broadcast(TextComponent message) { @@ -59,7 +59,7 @@ public void broadcast(TextComponent message) { } public void broadcast(String message, boolean overlay) { - getRaw().broadcast(TextUtil.literal(message), overlay); + getRaw().broadcastSystemMessage(TextUtil.literal(message), overlay); } public void broadcast(String message) { @@ -75,12 +75,12 @@ public Player getPlayerByUUID(UUID uuid) { } public Player getPlayerByName(String name) { - return new Player(getRaw().getPlayer(name)); + return new Player(getRaw().getPlayerByName(name)); } public List getPlayersByIP(String ip) { List players = new ArrayList<>(); - for (net.minecraft.entity.player.PlayerEntity p: getRaw().getPlayersByIp(ip)) { + for (net.minecraft.world.entity.player.Player p: getRaw().getPlayersWithAddress(ip)) { players.add(new Player(p)); } return players; @@ -88,7 +88,7 @@ public List getPlayersByIP(String ip) { public List getPlayers() { List players = new ArrayList<>(); - for (PlayerEntity p : getRaw().getPlayerList()) { + for (Player p : getRaw().getPlayers()) { players.add(new Player(p)); } return players; @@ -99,11 +99,11 @@ public boolean isExistByUUID(UUID uuid) { } public boolean isExistByName(String name) { - return getRaw().getPlayer(name) != null; + return getRaw().getPlayerByName(name) != null; } public boolean isExistByIP(String ip) { - return !getRaw().getPlayersByIp(ip).isEmpty(); + return !getRaw().getPlayersWithAddress(ip).isEmpty(); } public boolean hasPlayerByUUID(UUID uuid) { @@ -111,42 +111,42 @@ public boolean hasPlayerByUUID(UUID uuid) { } public boolean hasPlayerByName(String name) { - return getRaw().getPlayer(name) != null; + return getRaw().getPlayerByName(name) != null; } public boolean hasPlayerByIP(String ip) { - return !getRaw().getPlayersByIp(ip).isEmpty(); + return !getRaw().getPlayersWithAddress(ip).isEmpty(); } public int getCurrentPlayerCount() { - return getRaw().getCurrentPlayerCount(); + return getRaw().getPlayerCount(); } public int getMaxPlayerCount() { - return getRaw().getMaxPlayerCount(); + return getRaw().getMaxPlayers(); } public boolean isWhitelistEnabled() { - return getRaw().isWhitelistEnabled(); + return getRaw().isUsingWhitelist(); } public void setWhitelistEnabled(boolean enabled) { - getRaw().getServer().setUseAllowlist(enabled); + getRaw().getServer().setUsingWhitelist(enabled); } - public Whitelist getWhitelist() { - return getRaw().getWhitelist(); + public UserWhiteList getWhitelist() { + return getRaw().getWhiteList(); } public void reloadWhitelist() { - getRaw().reloadWhitelist(); + getRaw().reloadWhiteList(); } - public BannedIpList getBannedIpList() { - return getRaw().getIpBanList(); + public IpBanList getBannedIpList() { + return getRaw().getIpBans(); } - public BannedPlayerList getBannedPlayerList() { - return getRaw().getUserBanList(); + public UserBanList getBannedPlayerList() { + return getRaw().getBans(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java index 2492fca64..12fc38dbb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java @@ -1,32 +1,32 @@ package net.pitan76.mcpitanlib.midohra.util.hit; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; public class BlockHitResult extends HitResult { - public BlockHitResult(net.minecraft.util.hit.BlockHitResult raw) { + public BlockHitResult(net.minecraft.world.phys.BlockHitResult raw) { super(raw); } - public static BlockHitResult of(net.minecraft.util.hit.BlockHitResult raw) { + public static BlockHitResult of(net.minecraft.world.phys.BlockHitResult raw) { return new BlockHitResult(raw); } @Deprecated - public net.minecraft.util.hit.BlockHitResult getRaw() { - return (net.minecraft.util.hit.BlockHitResult) super.getRaw(); + public net.minecraft.world.phys.BlockHitResult getRaw() { + return (net.minecraft.world.phys.BlockHitResult) super.getRaw(); } - public net.minecraft.util.hit.BlockHitResult withSide(Direction side) { - return getRaw().withSide(side); + public net.minecraft.world.phys.BlockHitResult withSide(Direction side) { + return getRaw().withDirection(side); } - public net.minecraft.util.hit.BlockHitResult withBlockPos(BlockPos blockPos) { - return getRaw().withBlockPos(blockPos); + public net.minecraft.world.phys.BlockHitResult withBlockPos(BlockPos blockPos) { + return getRaw().withPosition(blockPos); } - public net.minecraft.util.hit.BlockHitResult againstWorldBorder() { - return getRaw().againstWorldBorder(); + public net.minecraft.world.phys.BlockHitResult againstWorldBorder() { + return getRaw().hitBorder(); } public BlockPos getBlockPos() { @@ -38,7 +38,7 @@ public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getBlockPosM() { } public Direction getSide() { - return getRaw().getSide(); + return getRaw().getDirection(); } public net.pitan76.mcpitanlib.midohra.util.math.Direction getSideM() { @@ -46,11 +46,11 @@ public net.pitan76.mcpitanlib.midohra.util.math.Direction getSideM() { } public boolean isInsideBlock() { - return getRaw().isInsideBlock(); + return getRaw().isInside(); } public boolean isAgainstWorldBorder() { - return getRaw().isAgainstWorldBorder(); + return getRaw().isWorldBorderHit(); } public HitResultType getType() { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java index 97e521de9..49641cc6e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java @@ -1,33 +1,33 @@ package net.pitan76.mcpitanlib.midohra.util.hit; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.Vec3d; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.Vec3; import java.util.Optional; public class HitResult { - protected final net.minecraft.util.hit.HitResult raw; + protected final net.minecraft.world.phys.HitResult raw; - public HitResult(net.minecraft.util.hit.HitResult raw) { + public HitResult(net.minecraft.world.phys.HitResult raw) { this.raw = raw; } - public static HitResult of(net.minecraft.util.hit.HitResult raw) { + public static HitResult of(net.minecraft.world.phys.HitResult raw) { return new HitResult(raw); } @Deprecated - public net.minecraft.util.hit.HitResult getRaw() { + public net.minecraft.world.phys.HitResult getRaw() { return raw; } @Deprecated - public net.minecraft.util.hit.HitResult.Type getRawType() { + public net.minecraft.world.phys.HitResult.Type getRawType() { return getRaw().getType(); } - public Vec3d getPos() { - return getRaw().getPos(); + public Vec3 getPos() { + return getRaw().getLocation(); } public double getX() { @@ -46,8 +46,8 @@ public HitResultType getType() { return HitResultType.of(this); } - public double squaredDistanceTo(Vec3d point) { - Vec3d hitPos = getPos(); + public double squaredDistanceTo(Vec3 point) { + Vec3 hitPos = getPos(); double dx = hitPos.x - point.x; double dy = hitPos.y - point.y; double dz = hitPos.z - point.z; @@ -55,10 +55,10 @@ public double squaredDistanceTo(Vec3d point) { } public double squaredDistanceTo(Entity entity) { - return getRaw().squaredDistanceTo(entity); + return getRaw().distanceTo(entity); } - public Vec3d pos() { + public Vec3 pos() { return getPos(); } @@ -79,8 +79,8 @@ public Optional asBlockHitResult() { return Optional.of((BlockHitResult) this); } - if (raw instanceof net.minecraft.util.hit.BlockHitResult) { - return Optional.of(BlockHitResult.of((net.minecraft.util.hit.BlockHitResult) raw)); + if (raw instanceof net.minecraft.world.phys.BlockHitResult) { + return Optional.of(BlockHitResult.of((net.minecraft.world.phys.BlockHitResult) raw)); } return Optional.empty(); diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java index 6002f2195..71b989306 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.midohra.util.hit; -import net.minecraft.util.hit.HitResult; +import net.minecraft.world.phys.HitResult; public enum HitResultType { MISS(HitResult.Type.MISS), diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java index 657c37939..915dfcd1e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java @@ -1,22 +1,22 @@ package net.pitan76.mcpitanlib.midohra.util.math; -import net.minecraft.util.math.Vec3i; +import net.minecraft.core.Vec3i; import java.util.Iterator; public class BlockPos { - private final net.minecraft.util.math.BlockPos blockPos; + private final net.minecraft.core.BlockPos blockPos; - protected BlockPos(net.minecraft.util.math.BlockPos blockPos) { + protected BlockPos(net.minecraft.core.BlockPos blockPos) { this.blockPos = blockPos; } - public static BlockPos of(net.minecraft.util.math.BlockPos blockPos) { + public static BlockPos of(net.minecraft.core.BlockPos blockPos) { return new BlockPos(blockPos); } public static BlockPos of(int x, int y, int z) { - return new BlockPos(new net.minecraft.util.math.BlockPos(x, y, z)); + return new BlockPos(new net.minecraft.core.BlockPos(x, y, z)); } public int getX() { @@ -31,20 +31,20 @@ public int getZ() { return blockPos.getZ(); } - public net.minecraft.util.math.BlockPos toMinecraft() { + public net.minecraft.core.BlockPos toMinecraft() { return blockPos; } - public net.minecraft.util.math.BlockPos toRaw() { + public net.minecraft.core.BlockPos toRaw() { return toMinecraft(); } public BlockPos add(int x, int y, int z) { - return new BlockPos(blockPos.add(x, y, z)); + return new BlockPos(blockPos.offset(x, y, z)); } public BlockPos add(BlockPos pos) { - return new BlockPos(blockPos.add(pos.blockPos)); + return new BlockPos(blockPos.offset(pos.blockPos)); } public BlockPos subtract(int x, int y, int z) { @@ -56,11 +56,11 @@ public BlockPos subtract(BlockPos pos) { } public BlockPos up() { - return new BlockPos(blockPos.up()); + return new BlockPos(blockPos.above()); } public BlockPos down() { - return new BlockPos(blockPos.down()); + return new BlockPos(blockPos.below()); } public BlockPos north() { @@ -80,11 +80,11 @@ public BlockPos west() { } public BlockPos offset(Direction direction, int amount) { - return new BlockPos(blockPos.offset(direction.toMinecraft(), amount)); + return new BlockPos(blockPos.relative(direction.toMinecraft(), amount)); } public BlockPos offset(Direction direction) { - return new BlockPos(blockPos.offset(direction.toMinecraft())); + return new BlockPos(blockPos.relative(direction.toMinecraft())); } public ChunkPos toChunkPos() { @@ -106,7 +106,7 @@ public boolean equals(Object obj) { public static Iterable iterate(BlockPos start, BlockPos end) { return () -> new Iterator<>() { - private final Iterator rawIterator = net.minecraft.util.math.BlockPos.iterate(start.toRaw(), end.toRaw()).iterator(); + private final Iterator rawIterator = net.minecraft.core.BlockPos.betweenClosed(start.toRaw(), end.toRaw()).iterator(); @Override public boolean hasNext() { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java index 68e46a035..20afb83bc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java @@ -1,18 +1,18 @@ package net.pitan76.mcpitanlib.midohra.util.math; -import net.minecraft.util.math.Vec3d; +import net.minecraft.world.phys.Vec3; import net.pitan76.mcpitanlib.api.util.math.BoxUtil; public class Box { - protected final net.minecraft.util.math.Box box; + protected final net.minecraft.world.phys.AABB box; @Deprecated - public Box(net.minecraft.util.math.Box box) { + public Box(net.minecraft.world.phys.AABB box) { this.box = box; } @Deprecated - public net.minecraft.util.math.Box toMinecraft() { + public net.minecraft.world.phys.AABB toMinecraft() { return box; } @@ -97,20 +97,20 @@ public double getMaxZ() { } public Vector3d getCenter() { - Vec3d center = box.getCenter(); + Vec3 center = box.getCenter(); return new Vector3d(center.x, center.y, center.z); } public double getLengthX() { - return box.getLengthX(); + return box.getXsize(); } public double getLengthY() { - return box.getLengthY(); + return box.getYsize(); } public double getLengthZ() { - return box.getLengthZ(); + return box.getZsize(); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java index da5a979e7..320522cc0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java @@ -3,41 +3,41 @@ import java.util.stream.Stream; public class ChunkPos { - private final net.minecraft.util.math.ChunkPos pos; + private final net.minecraft.world.level.ChunkPos pos; - protected ChunkPos(net.minecraft.util.math.ChunkPos pos) { + protected ChunkPos(net.minecraft.world.level.ChunkPos pos) { this.pos = pos; } - public static ChunkPos of(net.minecraft.util.math.ChunkPos pos) { + public static ChunkPos of(net.minecraft.world.level.ChunkPos pos) { return new ChunkPos(pos); } public static ChunkPos of(int x, int z) { - return of(new net.minecraft.util.math.ChunkPos(x, z)); + return of(new net.minecraft.world.level.ChunkPos(x, z)); } public static ChunkPos of(BlockPos pos) { - return of(new net.minecraft.util.math.ChunkPos(pos.toMinecraft())); + return of(new net.minecraft.world.level.ChunkPos(pos.toMinecraft())); } public static ChunkPos of(long pos) { - return of(new net.minecraft.util.math.ChunkPos(pos)); + return of(new net.minecraft.world.level.ChunkPos(pos)); } public static ChunkPos fromRegion(int x, int z) { - return of(net.minecraft.util.math.ChunkPos.fromRegion(x, z)); + return of(net.minecraft.world.level.ChunkPos.minFromRegion(x, z)); } public static ChunkPos fromRegionCenter(int x, int z) { - return of(net.minecraft.util.math.ChunkPos.fromRegionCenter(x, z)); + return of(net.minecraft.world.level.ChunkPos.maxFromRegion(x, z)); } - public net.minecraft.util.math.ChunkPos getRaw() { + public net.minecraft.world.level.ChunkPos getRaw() { return pos; } - public net.minecraft.util.math.ChunkPos toMinecraft() { + public net.minecraft.world.level.ChunkPos toMinecraft() { return getRaw(); } @@ -50,35 +50,35 @@ public int getZ() { } public int getOffsetX(int offsetX) { - return getRaw().getOffsetX(offsetX); + return getRaw().getBlockX(offsetX); } public int getOffsetZ(int offsetZ) { - return getRaw().getOffsetZ(offsetZ); + return getRaw().getBlockZ(offsetZ); } public int getStartX() { - return getRaw().getStartX(); + return getRaw().getMinBlockX(); } public int getStartZ() { - return getRaw().getStartZ(); + return getRaw().getMinBlockZ(); } public int getEndX() { - return getRaw().getEndX(); + return getRaw().getMaxBlockX(); } public int getEndZ() { - return getRaw().getEndZ(); + return getRaw().getMaxBlockZ(); } public int getCenterX() { - return getRaw().getCenterX(); + return getRaw().getMiddleBlockX(); } public int getCenterZ() { - return getRaw().getCenterZ(); + return getRaw().getMiddleBlockZ(); } public int getRegionX() { @@ -90,23 +90,23 @@ public int getRegionZ() { } public int getRegionRelativeX() { - return getRaw().getRegionRelativeX(); + return getRaw().getRegionLocalX(); } public int getRegionRelativeZ() { - return getRaw().getRegionRelativeZ(); + return getRaw().getRegionLocalZ(); } public BlockPos getStartPos() { - return BlockPos.of(getRaw().getStartPos()); + return BlockPos.of(getRaw().getWorldPosition()); } public BlockPos getCenterAtY(int y) { - return BlockPos.of(getRaw().getCenterAtY(y)); + return BlockPos.of(getRaw().getMiddleBlockPosition(y)); } public BlockPos getBlockPos(int offsetX, int y, int offsetZ) { - return BlockPos.of(getRaw().getBlockPos(offsetX, y, offsetZ)); + return BlockPos.of(getRaw().getBlockAt(offsetX, y, offsetZ)); } public long toLong() { @@ -129,26 +129,26 @@ public int hashCode() { } public int getChebyshevDistance(ChunkPos pos) { - return getRaw().getChebyshevDistance(pos.getRaw()); + return getRaw().getChessboardDistance(pos.getRaw()); } public int getChebyshevDistance(int x, int z) { - return getRaw().getChebyshevDistance(x, z); + return getRaw().getChessboardDistance(x, z); } public int getSquaredDistance(ChunkPos pos) { - return getRaw().getSquaredDistance(pos.getRaw()); + return getRaw().distanceSquared(pos.getRaw()); } public int getSquaredDistance(long pos) { - return getRaw().getSquaredDistance(pos); + return getRaw().distanceSquared(pos); } public static Stream stream(ChunkPos center, int radius) { - return net.minecraft.util.math.ChunkPos.stream(center.getRaw(), radius).map(ChunkPos::of); + return net.minecraft.world.level.ChunkPos.rangeClosed(center.getRaw(), radius).map(ChunkPos::of); } public static Stream stream(final ChunkPos pos1, final ChunkPos pos2) { - return net.minecraft.util.math.ChunkPos.stream(pos1.getRaw(), pos2.getRaw()).map(ChunkPos::of); + return net.minecraft.world.level.ChunkPos.rangeClosed(pos1.getRaw(), pos2.getRaw()).map(ChunkPos::of); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java index eebc3da6f..a90798a79 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java @@ -2,20 +2,20 @@ public class Direction { - public static final Direction UP = new Direction(net.minecraft.util.math.Direction.UP); - public static final Direction DOWN = new Direction(net.minecraft.util.math.Direction.DOWN); - public static final Direction NORTH = new Direction(net.minecraft.util.math.Direction.NORTH); - public static final Direction SOUTH = new Direction(net.minecraft.util.math.Direction.SOUTH); - public static final Direction EAST = new Direction(net.minecraft.util.math.Direction.EAST); - public static final Direction WEST = new Direction(net.minecraft.util.math.Direction.WEST); + public static final Direction UP = new Direction(net.minecraft.core.Direction.UP); + public static final Direction DOWN = new Direction(net.minecraft.core.Direction.DOWN); + public static final Direction NORTH = new Direction(net.minecraft.core.Direction.NORTH); + public static final Direction SOUTH = new Direction(net.minecraft.core.Direction.SOUTH); + public static final Direction EAST = new Direction(net.minecraft.core.Direction.EAST); + public static final Direction WEST = new Direction(net.minecraft.core.Direction.WEST); - private final net.minecraft.util.math.Direction direction; + private final net.minecraft.core.Direction direction; - protected Direction(net.minecraft.util.math.Direction direction) { + protected Direction(net.minecraft.core.Direction direction) { this.direction = direction; } - public static Direction of(net.minecraft.util.math.Direction direction) { + public static Direction of(net.minecraft.core.Direction direction) { switch (direction) { case UP: return UP; @@ -53,11 +53,11 @@ public Direction getOpposite() { } } - public net.minecraft.util.math.Direction getRaw() { + public net.minecraft.core.Direction getRaw() { return direction; } - public net.minecraft.util.math.Direction toMinecraft() { + public net.minecraft.core.Direction toMinecraft() { return getRaw(); } @@ -70,31 +70,31 @@ public boolean isVertical() { } public boolean isPositive() { - return getRaw().getDirection() == net.minecraft.util.math.Direction.AxisDirection.POSITIVE; + return getRaw().getAxisDirection() == net.minecraft.core.Direction.AxisDirection.POSITIVE; } public boolean isNegative() { - return getRaw().getDirection() == net.minecraft.util.math.Direction.AxisDirection.NEGATIVE; + return getRaw().getAxisDirection() == net.minecraft.core.Direction.AxisDirection.NEGATIVE; } public int getOffsetX() { - return getRaw().getOffsetX(); + return getRaw().getStepX(); } public int getOffsetY() { - return getRaw().getOffsetY(); + return getRaw().getStepY(); } public int getOffsetZ() { - return getRaw().getOffsetZ(); + return getRaw().getStepZ(); } public Direction rotateYClockwise() { - return of(getRaw().rotateYClockwise()); + return of(getRaw().getClockWise()); } public Direction rotateYCounterclockwise() { - return of(getRaw().rotateYCounterclockwise()); + return of(getRaw().getCounterClockWise()); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java index 368d4a2a1..3bb26399c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.util.math; -import net.minecraft.util.math.Position; -import net.minecraft.util.math.Vec3d; +import net.minecraft.core.Position; +import net.minecraft.world.phys.Vec3; public class Vector3d { public final double x; @@ -30,12 +30,12 @@ public static Vector3d of(org.joml.Vector3d vec) { return new Vector3d(vec.x, vec.y, vec.z); } - public static Vector3d of(Vec3d vec) { + public static Vector3d of(Vec3 vec) { return new Vector3d(vec.x, vec.y, vec.z); } public static Vector3d of(Position vec) { - return new Vector3d(vec.getX(), vec.getY(), vec.getZ()); + return new Vector3d(vec.x(), vec.y(), vec.z()); } public Vector3i toInt() { @@ -185,8 +185,8 @@ public Vector3d ofCenter() { return new Vector3d(x + 0.5, y + 0.5, z + 0.5); } - public Vec3d toMinecraft() { - return new Vec3d(x, y, z); + public Vec3 toMinecraft() { + return new Vec3(x, y, z); } public Vector3d mul(Vector3d other) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java index c38d48cf0..62e41843f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.midohra.util.math; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; public class Vector3i { public final int x; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java index fb0f6d0c3..e257acbe9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java @@ -1,22 +1,22 @@ package net.pitan76.mcpitanlib.midohra.util.math.v0; -import net.minecraft.util.math.Vec3i; +import net.minecraft.core.Vec3i; import net.pitan76.mcpitanlib.midohra.util.math.Direction; -public class BlockPos extends net.minecraft.util.math.BlockPos { - private final net.minecraft.util.math.BlockPos blockPos; +public class BlockPos extends net.minecraft.core.BlockPos { + private final net.minecraft.core.BlockPos blockPos; - protected BlockPos(net.minecraft.util.math.BlockPos blockPos) { + protected BlockPos(net.minecraft.core.BlockPos blockPos) { super(blockPos.getX(), blockPos.getY(), blockPos.getZ()); this.blockPos = blockPos; } - public static BlockPos of(net.minecraft.util.math.BlockPos blockPos) { + public static BlockPos of(net.minecraft.core.BlockPos blockPos) { return new BlockPos(blockPos); } public static BlockPos of(int x, int y, int z) { - return new BlockPos(new net.minecraft.util.math.BlockPos(x, y, z)); + return new BlockPos(new net.minecraft.core.BlockPos(x, y, z)); } public int getX() { @@ -31,16 +31,16 @@ public int getZ() { return blockPos.getZ(); } - public net.minecraft.util.math.BlockPos toMinecraft() { + public net.minecraft.core.BlockPos toMinecraft() { return blockPos; } - public BlockPos add(int x, int y, int z) { - return new BlockPos(blockPos.add(x, y, z)); + public BlockPos offset(int x, int y, int z) { + return new BlockPos(blockPos.offset(x, y, z)); } public BlockPos add(BlockPos pos) { - return new BlockPos(blockPos.add(pos.blockPos)); + return new BlockPos(blockPos.offset(pos.blockPos)); } public BlockPos subtract(int x, int y, int z) { @@ -51,12 +51,12 @@ public BlockPos subtract(BlockPos pos) { return new BlockPos(blockPos.subtract(pos.blockPos)); } - public BlockPos up() { - return new BlockPos(blockPos.up()); + public BlockPos above() { + return new BlockPos(blockPos.above()); } - public BlockPos down() { - return new BlockPos(blockPos.down()); + public BlockPos below() { + return new BlockPos(blockPos.below()); } public BlockPos north() { @@ -76,15 +76,15 @@ public BlockPos west() { } public BlockPos offset(Direction direction, int amount) { - return new BlockPos(blockPos.offset(direction.toMinecraft(), amount)); + return new BlockPos(blockPos.relative(direction.toMinecraft(), amount)); } public BlockPos offset(Direction direction) { - return new BlockPos(blockPos.offset(direction.toMinecraft())); + return new BlockPos(blockPos.relative(direction.toMinecraft())); } @Override - public BlockPos add(Vec3i vec3i) { - return new BlockPos(blockPos.add(vec3i)); + public BlockPos offset(Vec3i vec3i) { + return new BlockPos(blockPos.offset(vec3i)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java index a0e536955..c194b761d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java @@ -3,21 +3,21 @@ import net.pitan76.mcpitanlib.midohra.util.math.Direction; public class VoxelShape { - private final net.minecraft.util.shape.VoxelShape voxelShape; + private final net.minecraft.world.phys.shapes.VoxelShape voxelShape; - public static final VoxelShape EMPTY = of(net.minecraft.util.shape.VoxelShapes.empty()); - public static final VoxelShape FULL_CUBE = of(net.minecraft.util.shape.VoxelShapes.fullCube()); + public static final VoxelShape EMPTY = of(net.minecraft.world.phys.shapes.Shapes.empty()); + public static final VoxelShape FULL_CUBE = of(net.minecraft.world.phys.shapes.Shapes.block()); - public VoxelShape(net.minecraft.util.shape.VoxelShape voxelShape) { + public VoxelShape(net.minecraft.world.phys.shapes.VoxelShape voxelShape) { this.voxelShape = voxelShape; } - public static VoxelShape of(net.minecraft.util.shape.VoxelShape shape) { + public static VoxelShape of(net.minecraft.world.phys.shapes.VoxelShape shape) { return new VoxelShape(shape); } @Deprecated - public net.minecraft.util.shape.VoxelShape raw() { + public net.minecraft.world.phys.shapes.VoxelShape raw() { return voxelShape; } @@ -26,23 +26,23 @@ public boolean isEmpty() { } public VoxelShape union(VoxelShape other) { - return of(net.minecraft.util.shape.VoxelShapes.union(this.raw(), other.raw())); + return of(net.minecraft.world.phys.shapes.Shapes.or(this.raw(), other.raw())); } public VoxelShape asCuboid() { - return of(raw().asCuboid()); + return of(raw().singleEncompassing()); } public VoxelShape offset(double x, double y, double z) { - return of(raw().offset(x, y, z)); + return of(raw().move(x, y, z)); } public VoxelShape getFace(Direction direction) { - return of(raw().getFace(direction.toMinecraft())); + return of(raw().getFaceShape(direction.toMinecraft())); } public VoxelShape simplify() { - return of(raw().simplify()); + return of(raw().optimize()); } @Override @@ -67,9 +67,9 @@ public static VoxelShape fullCube() { } public static VoxelShape union(VoxelShape... shapes) { - net.minecraft.util.shape.VoxelShape result = net.minecraft.util.shape.VoxelShapes.empty(); + net.minecraft.world.phys.shapes.VoxelShape result = net.minecraft.world.phys.shapes.Shapes.empty(); for (VoxelShape shape : shapes) { - result = net.minecraft.util.shape.VoxelShapes.union(result, shape.raw()); + result = net.minecraft.world.phys.shapes.Shapes.or(result, shape.raw()); } return of(result); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java index 60a94b216..e15592611 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.midohra.world; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.core.BlockPos; public class BlockView implements IWorldView { - private net.minecraft.world.BlockView blockView; + private net.minecraft.world.level.BlockGetter blockView; - public BlockView(net.minecraft.world.BlockView blockView) { + public BlockView(net.minecraft.world.level.BlockGetter blockView) { this.blockView = blockView; } - public static BlockView of(net.minecraft.world.BlockView blockView) { + public static BlockView of(net.minecraft.world.level.BlockGetter blockView) { return new BlockView(blockView); } - public net.minecraft.world.BlockView getRaw() { + public net.minecraft.world.level.BlockGetter getRaw() { return blockView; } - public net.minecraft.world.BlockView toMinecraft() { + public net.minecraft.world.level.BlockGetter toMinecraft() { return getRaw(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java index 95d95ab78..4a252ae0f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.midohra.world; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.core.BlockPos; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; @@ -23,6 +23,6 @@ default net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState(net.pitan7 } default FluidWrapper getFluid(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { - return FluidWrapper.of(getFluidState(pos.toMinecraft()).getFluid()); + return FluidWrapper.of(getFluidState(pos.toMinecraft()).getType()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java index 4d8bc2f0e..a3ce10bee 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java @@ -5,37 +5,37 @@ public interface RedstoneView { - net.minecraft.world.RedstoneView getRedstoneView(); + net.minecraft.world.level.SignalGetter getRedstoneView(); default boolean isReceivingRedstonePower(BlockPos pos) { - return getRedstoneView().isReceivingRedstonePower(pos.toMinecraft()); + return getRedstoneView().hasNeighborSignal(pos.toMinecraft()); } default int getEmittedRedstonePower(BlockPos pos, Direction direction) { - return getRedstoneView().getEmittedRedstonePower(pos.toMinecraft(), direction.toMinecraft()); + return getRedstoneView().getSignal(pos.toMinecraft(), direction.toMinecraft()); } default int getEmittedRedstonePower(BlockPos pos, Direction direction, boolean onlyFromGate) { - return getRedstoneView().getEmittedRedstonePower(pos.toMinecraft(), direction.toMinecraft(), onlyFromGate); + return getRedstoneView().getControlInputSignal(pos.toMinecraft(), direction.toMinecraft(), onlyFromGate); } default boolean isEmittingRedstonePower(BlockPos pos, Direction direction) { - return getRedstoneView().isEmittingRedstonePower(pos.toMinecraft(), direction.toMinecraft()); + return getRedstoneView().hasSignal(pos.toMinecraft(), direction.toMinecraft()); } default int getStrongRedstonePower(BlockPos pos, Direction direction) { - return getRedstoneView().getStrongRedstonePower(pos.toMinecraft(), direction.toMinecraft()); + return getRedstoneView().getDirectSignal(pos.toMinecraft(), direction.toMinecraft()); } default int getReceivedStrongRedstonePower(BlockPos pos) { - return getRedstoneView().getReceivedStrongRedstonePower(pos.toMinecraft()); + return getRedstoneView().getDirectSignalTo(pos.toMinecraft()); } - static RedstoneView of(net.minecraft.world.RedstoneView redstoneView) { + static RedstoneView of(net.minecraft.world.level.SignalGetter redstoneView) { return () -> redstoneView; } - static RedstoneView of(net.minecraft.world.WorldView world) { + static RedstoneView of(net.minecraft.world.level.LevelReader world) { return WorldView.of(world); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java index 9ee497435..f34b04aa0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java @@ -11,33 +11,33 @@ import net.pitan76.mcpitanlib.midohra.world.chunk.ServerChunkManager; public class ServerWorld extends World { - private final net.minecraft.server.world.ServerWorld world; + private final net.minecraft.server.level.ServerLevel world; - protected ServerWorld(net.minecraft.server.world.ServerWorld world) { + protected ServerWorld(net.minecraft.server.level.ServerLevel world) { super(null); this.world = world; } - public static ServerWorld of(net.minecraft.server.world.ServerWorld world) { + public static ServerWorld of(net.minecraft.server.level.ServerLevel world) { return new ServerWorld(world); } @Override - public net.minecraft.server.world.ServerWorld getRaw() { + public net.minecraft.server.level.ServerLevel getRaw() { return world; } @Override - public net.minecraft.server.world.ServerWorld toMinecraft() { + public net.minecraft.server.level.ServerLevel toMinecraft() { return getRaw(); } public void playSound(Player player, BlockPos pos, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, long seed) { - getRaw().playSound(player.getEntity(), pos.getX(), pos.getY(), pos.getZ(), sound.getEntry(), category.get(), volume, pitch, seed); + getRaw().playSeededSound(player.getEntity(), pos.getX(), pos.getY(), pos.getZ(), sound.getEntry(), category.get(), volume, pitch, seed); } public void playSoundFromEntity(Player player, Player target, CompatSoundEvent sound, CompatSoundCategory category, float volume, float pitch, long seed) { - getRaw().playSoundFromEntity(player.getEntity(), target.getEntity(), sound.getEntry(), category.get(), volume, pitch, seed); + getRaw().playSeededSound(player.getEntity(), target.getEntity(), sound.getEntry(), category.get(), volume, pitch, seed); } public MinecraftServer getServer() { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java index ff3bf1da9..12ec92a10 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.midohra.world; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvent; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; @@ -24,23 +24,23 @@ public class World extends WorldAccess { - private final net.minecraft.world.World world; + private final net.minecraft.world.level.Level world; - protected World(net.minecraft.world.World world) { + protected World(net.minecraft.world.level.Level world) { super(null); this.world = world; } - public static World of(net.minecraft.world.World world) { + public static World of(net.minecraft.world.level.Level world) { return new World(world); } @Override - public net.minecraft.world.World getRaw() { + public net.minecraft.world.level.Level getRaw() { return world; } - public net.minecraft.world.World toMinecraft() { + public net.minecraft.world.level.Level toMinecraft() { return getRaw(); } @@ -49,7 +49,7 @@ public void addBlockEntity(BlockEntityWrapper blockEntity) { } public void addBlockEntity(BlockEntity blockEntity) { - getRaw().addBlockEntity(blockEntity); + getRaw().setBlockEntity(blockEntity); } public void removeBlockEntity(BlockPos pos) { @@ -93,12 +93,12 @@ public BlockPos getSpawnPos() { } public Optional getWorld(CompatIdentifier id) { - Optional optional = WorldUtil.getWorld(getRaw(), id); + Optional optional = WorldUtil.getWorld(getRaw(), id); return optional.map(World::of); } public Optional getServerWorld(CompatIdentifier id) { - Optional optional = WorldUtil.getWorld(getRaw(), id); + Optional optional = WorldUtil.getWorld(getRaw(), id); return optional.map(ServerWorld::of); } @@ -106,23 +106,23 @@ public void spawnEntity(Entity entity) { WorldUtil.spawnEntity(getRaw(), entity); } - public void spawnStack(net.minecraft.item.ItemStack stack, BlockPos pos) { + public void spawnStack(net.minecraft.world.item.ItemStack stack, BlockPos pos) { WorldUtil.spawnStack(getRaw(), pos.toMinecraft(), stack); } public RecipeManager getRecipeManager() { - return RecipeManager.of(getRaw().getRecipeManager()); + return RecipeManager.of(getRaw().recipeAccess()); } @Deprecated @Override - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category) { + public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category) { getRaw().playSound(playerEntity, pos, sound, category); } @Deprecated @Override - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { + public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); } @@ -147,8 +147,8 @@ public void playSound(BlockPos pos, CompatSoundEvent soundEvent, CompatSoundCate } public Optional toServerWorld() { - if (getRaw() instanceof net.minecraft.server.world.ServerWorld) { - return Optional.of(ServerWorld.of((net.minecraft.server.world.ServerWorld) getRaw())); + if (getRaw() instanceof net.minecraft.server.level.ServerLevel) { + return Optional.of(ServerWorld.of((net.minecraft.server.level.ServerLevel) getRaw())); } return Optional.empty(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java index 5635acba5..48cd5ee8f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.midohra.world; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.predicate.entity.EntityPredicates; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.EntitySelector; import net.minecraft.server.MinecraftServer; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.sounds.SoundEvent; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; @@ -28,23 +28,23 @@ import java.util.function.Predicate; public class WorldAccess extends WorldView { - private final net.minecraft.world.WorldAccess world; + private final net.minecraft.world.level.LevelAccessor world; - protected WorldAccess(net.minecraft.world.WorldAccess world) { + protected WorldAccess(net.minecraft.world.level.LevelAccessor world) { super(null); this.world = world; } - public static WorldAccess of(net.minecraft.world.WorldAccess world) { + public static WorldAccess of(net.minecraft.world.level.LevelAccessor world) { return new WorldAccess(world); } @Override - protected net.minecraft.world.WorldAccess getRaw() { + protected net.minecraft.world.level.LevelAccessor getRaw() { return world; } - public net.minecraft.world.WorldAccess toMinecraft() { + public net.minecraft.world.level.LevelAccessor toMinecraft() { return getRaw(); } @@ -106,12 +106,12 @@ public boolean setBlockState(BlockPos pos, BlockState state) { } @Deprecated - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch) { + public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); } @Deprecated - public void playSound(PlayerEntity playerEntity, net.minecraft.util.math.BlockPos pos, SoundEvent sound, SoundCategory category) { + public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category) { getRaw().playSound(playerEntity, pos, sound, category); } @@ -152,11 +152,11 @@ public List getEntitiesByType(EntityTypeWrapper entityType, Box box, Predicat } public List getEntitiesByClass(Class entityClass, Box box) { - return getEntitiesByClass(entityClass, box, EntityPredicates.VALID_ENTITY); + return getEntitiesByClass(entityClass, box, EntitySelector.ENTITY_STILL_ALIVE); } public List getEntitiesByType(EntityType entityType, Box box) { - return getEntitiesByType(entityType, box, EntityPredicates.VALID_ENTITY); + return getEntitiesByType(entityType, box, EntitySelector.ENTITY_STILL_ALIVE); } public boolean breakBlock(BlockPos pos, boolean drop, Player player) { @@ -182,7 +182,7 @@ public List getEntitiesByClassM(Class entityClass, Box box) { } public void spawnEntity(Entity entity) { - getRaw().spawnEntity(entity); + getRaw().addFreshEntity(entity); } public void spawnEntity(EntityWrapper entity) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java index 6e73462d4..e6592911c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.midohra.world; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.fluid.FluidState; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.material.FluidState; import net.pitan76.mcpitanlib.api.util.world.WorldAccessUtil; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; @@ -10,21 +10,21 @@ import java.util.Optional; public class WorldView implements IWorldView, RedstoneView { - private final net.minecraft.world.WorldView world; + private final net.minecraft.world.level.LevelReader world; - protected WorldView(net.minecraft.world.WorldView world) { + protected WorldView(net.minecraft.world.level.LevelReader world) { this.world = world; } - public static WorldView of(net.minecraft.world.WorldView world) { + public static WorldView of(net.minecraft.world.level.LevelReader world) { return new WorldView(world); } - protected net.minecraft.world.WorldView getRaw() { + protected net.minecraft.world.level.LevelReader getRaw() { return world; } - public net.minecraft.world.WorldView toMinecraft() { + public net.minecraft.world.level.LevelReader toMinecraft() { return getRaw(); } @@ -50,23 +50,23 @@ public BlockEntityWrapper getBlockEntity(BlockPos pos, B } @Override - public BlockEntity getBlockEntity(net.minecraft.util.math.BlockPos pos) { + public BlockEntity getBlockEntity(net.minecraft.core.BlockPos pos) { return getRaw().getBlockEntity(pos); } @Override - public net.minecraft.block.BlockState getBlockState(net.minecraft.util.math.BlockPos pos) { + public net.minecraft.world.level.block.state.BlockState getBlockState(net.minecraft.core.BlockPos pos) { return getRaw().getBlockState(pos); } @Override - public FluidState getFluidState(net.minecraft.util.math.BlockPos pos) { + public FluidState getFluidState(net.minecraft.core.BlockPos pos) { return getRaw().getFluidState(pos); } @Override @Deprecated - public net.minecraft.world.RedstoneView getRedstoneView() { + public net.minecraft.world.level.SignalGetter getRedstoneView() { return getRaw(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java index 7f3084f67..bff1515a7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java @@ -5,37 +5,37 @@ import net.pitan76.mcpitanlib.midohra.world.World; public class ChunkManager { - private final net.minecraft.world.chunk.ChunkManager chunkManager; + private final net.minecraft.world.level.chunk.ChunkSource chunkManager; - protected ChunkManager(net.minecraft.world.chunk.ChunkManager chunkManager) { + protected ChunkManager(net.minecraft.world.level.chunk.ChunkSource chunkManager) { this.chunkManager = chunkManager; } - public static ChunkManager of(net.minecraft.world.chunk.ChunkManager chunkManager) { + public static ChunkManager of(net.minecraft.world.level.chunk.ChunkSource chunkManager) { return new ChunkManager(chunkManager); } - public static ChunkManager of(net.minecraft.world.World world) { - return of(world.getChunkManager()); + public static ChunkManager of(net.minecraft.world.level.Level world) { + return of(world.getChunkSource()); } public static ChunkManager of(World world) { return of(world.getRaw()); } - public net.minecraft.world.chunk.ChunkManager getRaw() { + public net.minecraft.world.level.chunk.ChunkSource getRaw() { return chunkManager; } - public net.minecraft.world.chunk.ChunkManager toMinecraft() { + public net.minecraft.world.level.chunk.ChunkSource toMinecraft() { return getRaw(); } public IWorldView getWorld() { - return BlockView.of(getRaw().getWorld()); + return BlockView.of(getRaw().getLevel()); } public boolean isChunkLoaded(int x, int z) { - return getRaw().isChunkLoaded(x, z); + return getRaw().hasChunk(x, z); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java index e1faf1d6f..d7468e60e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java @@ -1,37 +1,37 @@ package net.pitan76.mcpitanlib.midohra.world.chunk; import net.minecraft.util.Unit; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.ChunkPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.ChunkPos; import java.util.Comparator; public class ChunkTicketType { - public static final ChunkTicketType START = of(net.minecraft.server.world.ChunkTicketType.PLAYER_SPAWN); - public static final ChunkTicketType DRAGON = of(net.minecraft.server.world.ChunkTicketType.DRAGON); - public static final ChunkTicketType PLAYER = of(net.minecraft.server.world.ChunkTicketType.PLAYER_SIMULATION); - public static final ChunkTicketType FORCED = of(net.minecraft.server.world.ChunkTicketType.FORCED); - public static final ChunkTicketType PORTAL = of(net.minecraft.server.world.ChunkTicketType.PORTAL); - public static final ChunkTicketType ENDER_PEARL = of(net.minecraft.server.world.ChunkTicketType.ENDER_PEARL); - public static final ChunkTicketType POST_TELEPORT = of(net.minecraft.server.world.ChunkTicketType.PORTAL); - public static final ChunkTicketType UNKNOWN = of(net.minecraft.server.world.ChunkTicketType.UNKNOWN); + public static final ChunkTicketType START = of(net.minecraft.server.level.TicketType.PLAYER_SPAWN); + public static final ChunkTicketType DRAGON = of(net.minecraft.server.level.TicketType.DRAGON); + public static final ChunkTicketType PLAYER = of(net.minecraft.server.level.TicketType.PLAYER_SIMULATION); + public static final ChunkTicketType FORCED = of(net.minecraft.server.level.TicketType.FORCED); + public static final ChunkTicketType PORTAL = of(net.minecraft.server.level.TicketType.PORTAL); + public static final ChunkTicketType ENDER_PEARL = of(net.minecraft.server.level.TicketType.ENDER_PEARL); + public static final ChunkTicketType POST_TELEPORT = of(net.minecraft.server.level.TicketType.PORTAL); + public static final ChunkTicketType UNKNOWN = of(net.minecraft.server.level.TicketType.UNKNOWN); - private final net.minecraft.server.world.ChunkTicketType ticketType; + private final net.minecraft.server.level.TicketType ticketType; - protected ChunkTicketType(net.minecraft.server.world.ChunkTicketType ticketType) { + protected ChunkTicketType(net.minecraft.server.level.TicketType ticketType) { this.ticketType = ticketType; } - public static ChunkTicketType of(net.minecraft.server.world.ChunkTicketType ticketType) { + public static ChunkTicketType of(net.minecraft.server.level.TicketType ticketType) { return new ChunkTicketType<>(ticketType); } - public net.minecraft.server.world.ChunkTicketType getRaw() { + public net.minecraft.server.level.TicketType getRaw() { return ticketType; } - public net.minecraft.server.world.ChunkTicketType toMinecraft() { + public net.minecraft.server.level.TicketType toMinecraft() { return getRaw(); } @@ -48,7 +48,7 @@ public Comparator getArgumentComparator() { } public long getExpiryTicks() { - return getRaw().expiryTicks(); + return getRaw().timeout(); } @Override @@ -57,7 +57,7 @@ public String toString() { } public ChunkTicketType(String name, long expiryTicks) { - this(new net.minecraft.server.world.ChunkTicketType(expiryTicks, 6)); + this(new net.minecraft.server.level.TicketType(expiryTicks, 6)); } public ChunkTicketType(String name) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java index 40264d352..b271819dd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java @@ -7,42 +7,42 @@ import net.pitan76.mcpitanlib.midohra.world.World; public class ServerChunkManager extends ChunkManager { - private final net.minecraft.server.world.ServerChunkManager chunkManager; + private final net.minecraft.server.level.ServerChunkCache chunkManager; - protected ServerChunkManager(net.minecraft.server.world.ServerChunkManager chunkManager) { + protected ServerChunkManager(net.minecraft.server.level.ServerChunkCache chunkManager) { super(null); this.chunkManager = chunkManager; } - public static ServerChunkManager of(net.minecraft.server.world.ServerChunkManager chunkManager) { + public static ServerChunkManager of(net.minecraft.server.level.ServerChunkCache chunkManager) { return new ServerChunkManager(chunkManager); } public static ServerChunkManager of(ServerWorld world) { - return of(world.getRaw().getChunkManager()); + return of(world.getRaw().getChunkSource()); } @Override - public net.minecraft.server.world.ServerChunkManager getRaw() { + public net.minecraft.server.level.ServerChunkCache getRaw() { return chunkManager; } @Override - public net.minecraft.server.world.ServerChunkManager toMinecraft() { + public net.minecraft.server.level.ServerChunkCache toMinecraft() { return getRaw(); } @Override public World getWorld() { - return World.of(getRaw().getWorld()); + return World.of(getRaw().getLevel()); } public void addTicket(ChunkTicketType ticketType, ChunkPos pos, int radius, T argument) { - getRaw().addTicket(ticketType.getRaw(), pos.getRaw(), radius); + getRaw().addTicketWithRadius(ticketType.getRaw(), pos.getRaw(), radius); } public void removeTicket(ChunkTicketType ticketType, ChunkPos pos, int radius, T argument) { - getRaw().removeTicket(ticketType.getRaw(), pos.getRaw(), radius); + getRaw().removeTicketWithRadius(ticketType.getRaw(), pos.getRaw(), radius); } public void markForUpdate(BlockPos pos) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java index 2c5daf8fb..36bed422c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java @@ -1,31 +1,31 @@ package net.pitan76.mcpitanlib.midohra.world.tick; -import net.minecraft.block.Block; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.material.Fluid; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.fluid.FluidWrapper; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; public class ScheduledTickView { - private final net.minecraft.world.tick.ScheduledTickView scheduledTickView; + private final net.minecraft.world.level.ScheduledTickAccess scheduledTickView; - public ScheduledTickView(net.minecraft.world.tick.ScheduledTickView scheduledTickView) { + public ScheduledTickView(net.minecraft.world.level.ScheduledTickAccess scheduledTickView) { this.scheduledTickView = scheduledTickView; } - public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.tick.ScheduledTickView scheduledTickView) { + public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.level.ScheduledTickAccess scheduledTickView) { return new net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView(scheduledTickView); } - public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.World world) { + public static net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView of(net.minecraft.world.level.Level world) { return new net.pitan76.mcpitanlib.midohra.world.tick.ScheduledTickView(world); } - public net.minecraft.world.tick.ScheduledTickView toMinecraft() { + public net.minecraft.world.level.ScheduledTickAccess toMinecraft() { return get(); } - protected net.minecraft.world.tick.ScheduledTickView get() { + protected net.minecraft.world.level.ScheduledTickAccess get() { return scheduledTickView; } @@ -33,15 +33,15 @@ public void scheduleBlockTick(BlockPos blockPos, BlockWrapper blockWrapper, int scheduleBlockTick(blockPos.toMinecraft(), blockWrapper.get(), delay); } - public void scheduleBlockTick(net.minecraft.util.math.BlockPos blockPos, Block block, int delay) { - get().scheduleBlockTick(blockPos, block, delay); + public void scheduleBlockTick(net.minecraft.core.BlockPos blockPos, Block block, int delay) { + get().scheduleTick(blockPos, block, delay); } public void scheduleFluidTick(BlockPos blockPos, FluidWrapper fluidWrapper, int delay) { scheduleFluidTick(blockPos.toMinecraft(), fluidWrapper.get(), delay); } - public void scheduleFluidTick(net.minecraft.util.math.BlockPos blockPos, Fluid block, int delay) { - get().scheduleFluidTick(blockPos, block, delay); + public void scheduleFluidTick(net.minecraft.core.BlockPos blockPos, Fluid block, int delay) { + get().scheduleTick(blockPos, block, delay); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java index 27f5f53a6..9f2e05b51 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemPlacementContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.context.BlockPlaceContext; import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; import net.pitan76.mcpitanlib.api.block.args.v2.PlacementStateArgs; import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; @@ -11,13 +11,11 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -// TODO(Ravel): can not resolve target class Block @Mixin(Block.class) public class Block4CompatProviderMixin { - // TODO(Ravel): no target class - @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { + @Inject(method = "getStateForPlacement", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getPlacementState(BlockPlaceContext ctx, CallbackInfoReturnable cir) { // ExtendBlockProviderを実装している場合 if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java new file mode 100644 index 000000000..47fc6d3ff --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java @@ -0,0 +1,97 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; +import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; +import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; +import net.pitan76.mcpitanlib.api.block.args.RotateArgs; +import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; +import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; +import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(BlockBehaviour.class) +public class BlockBehaviour4CompatProviderMixin { + @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + @Inject(method = "getShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + @Inject(method = "updateShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getStateForNeighborUpdate(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random)), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toMinecraft()); + } + } + + @Inject(method = "getRenderShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getRenderType(BlockState state, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + CompatBlockRenderType returnValue = provider.getRenderType(new RenderTypeArgs(state), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toMinecraft()); + } + } + + @Inject(method = "rotate", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_rotate(BlockState state, Rotation rotation, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.rotate(new RotateArgs(state, rotation), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toMinecraft()); + } + } + + @Inject(method = "skipRendering", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_isSideInvisible(BlockState state, BlockState stateFrom, Direction direction, CallbackInfoReturnable cir) { + if (this instanceof CompatBlockProvider) { + CompatBlockProvider provider = (CompatBlockProvider) this; + Options options = new Options(); + Boolean returnValue = provider.isSideInvisible(new SideInvisibleArgs(state, stateFrom, direction), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java new file mode 100644 index 000000000..a8c598197 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java @@ -0,0 +1,139 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.core.BlockPos; +import net.minecraft.util.RandomSource; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; +import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; +import net.pitan76.mcpitanlib.api.event.block.*; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.List; + +@Mixin(BlockBehaviour.class) +public class BlockBehaviourMixin { + @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + @Inject(method = "getShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + @Inject(method = "tick", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_scheduledTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random, CallbackInfo ci) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + provider.scheduledTick(new BlockScheduledTickEvent(state, world, pos, random), options); + if (options.cancel) + ci.cancel(); + } + } + + @Inject(method = "useWithoutItem", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_onUse(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + CompatActionResult returnValue = provider.onRightClick(new BlockUseEvent(state, world, pos, player, player.getUsedItemHand(), hit), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue.toActionResult()); + } + } + + @Inject(method = "getMenuProvider", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_createScreenHandlerFactory(BlockState state, Level world, BlockPos pos, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + MenuProvider returnValue = new SimpleMenuProvider((syncId, inventory, player) -> + provider.createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player), options), provider.getScreenTitle()); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + @Inject(method = "affectNeighborsAfterRemoval", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_onStateReplaced(BlockState state, ServerLevel world, BlockPos pos, boolean moved, CallbackInfo ci) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + provider.onStateReplaced(new StateReplacedEvent(state, world, pos, world.getBlockState(pos), moved), options); + if (options.cancel) + ci.cancel(); + } + } + + @Inject(method = "getDrops", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getDroppedStacks(BlockState state, LootParams.Builder builder, CallbackInfoReturnable> cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + List returnValue = provider.getDroppedStacks(new DroppedStacksArgs(state, builder), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + @Inject(method = "isPathfindable", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_canPathfindThrough(BlockState state, PathComputationType type, CallbackInfoReturnable cir) { + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + Boolean returnValue = provider.canPathfindThrough(new CanPathfindThroughArgs(state, type), options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } + + @Inject(method = "getCloneItemStack", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getPickStack(LevelReader world, BlockPos pos, BlockState state, boolean includeData, CallbackInfoReturnable cir) { + // ExtendBlockProviderを実装している場合 (1.21.5からAbstractBlockに移転) + if (this instanceof ExtendBlockProvider) { + ExtendBlockProvider provider = (ExtendBlockProvider) this; + Options options = new Options(); + + PickStackEvent event = new PickStackEvent(world, pos, state); + event.setIncludeData(includeData); + + ItemStack returnValue = provider.getPickStack(event, options); + if (options.cancel && returnValue != null) + cir.setReturnValue(returnValue); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java index 4f2aecdcb..e04e3fbde 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java @@ -1,14 +1,12 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; -// TODO(Ravel): can not resolve target class Block @Mixin(Block.class) public interface BlockInvoker { - // TODO(Ravel): Could not determine a single target - @Invoker("setDefaultState") + @Invoker("registerDefaultState") void setDefaultState_invoke(BlockState state); } diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java index a94f6a5cf..1ed344b4e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; import net.pitan76.mcpitanlib.api.event.block.*; @@ -22,13 +22,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -// TODO(Ravel): can not resolve target class Block @Mixin(Block.class) public class BlockMixin { - // TODO(Ravel): no target class - @Inject(method = "onPlaced", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack, CallbackInfo ci) { + @Inject(method = "setPlacedBy", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onPlaced(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack, CallbackInfo ci) { // イベントを呼び出す if (!BlockEventRegistry.ON_PLACED.isEmpty()) { int maxPriority = BlockEventRegistry.ON_PLACED.getMaxPriority(); @@ -49,9 +47,8 @@ public class BlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "onBreak", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfoReturnable cir) { + @Inject(method = "playerWillDestroy", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onBreak(Level world, BlockPos pos, BlockState state, Player player, CallbackInfoReturnable cir) { // イベントを呼び出す if (!BlockEventRegistry.ON_BREAK.isEmpty()) { BlockState newState = state; @@ -77,9 +74,8 @@ public class BlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "appendProperties", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$appendProperties(StateManager.Builder builder, CallbackInfo ci) { + @Inject(method = "createBlockStateDefinition", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$appendProperties(StateDefinition.Builder builder, CallbackInfo ci) { // ExtendBlockProviderを実装している場合 if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; @@ -90,9 +86,8 @@ public class BlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getPlacementState", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable cir) { + @Inject(method = "getStateForPlacement", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getPlacementState(BlockPlaceContext ctx, CallbackInfoReturnable cir) { // ExtendBlockProviderを実装している場合 if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java index 623c5fe85..11913f03c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java @@ -1,22 +1,20 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.CraftingRecipe; -import net.minecraft.recipe.input.CraftingRecipeInput; -import net.minecraft.util.collection.DefaultedList; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.item.FixedRecipeRemainderItem; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -// TODO(Ravel): can not resolve target class CraftingRecipe @Mixin(CraftingRecipe.class) public interface CraftingRecipeMixin { - // TODO(Ravel): no target class - @Inject(method = "collectRecipeRemainders", at = @At("RETURN")) - private static void mcpitanlib$collectRecipeRemainders(CraftingRecipeInput input, CallbackInfoReturnable> cir) { - DefaultedList defaultedList = cir.getReturnValue(); + @Inject(method = "defaultCraftingReminder", at = @At("RETURN")) + private static void mcpitanlib$collectRecipeRemainders(CraftingInput input, CallbackInfoReturnable> cir) { + NonNullList defaultedList = cir.getReturnValue(); int i = 0; for (ItemStack stack : defaultedList) { diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java index abc597de2..ecd497aa4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java @@ -1,23 +1,23 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.block.BlockState; -import net.minecraft.component.type.TooltipDisplayComponent; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.item.consume.UseAction; -import net.minecraft.item.tooltip.TooltipType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsageContext; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.item.component.TooltipDisplay; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.item.ItemUseAnimation; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.network.chat.Component; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionHand; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.event.item.*; import net.pitan76.mcpitanlib.api.event.v2.ItemEventRegistry; import net.pitan76.mcpitanlib.api.event.v2.listener.InventoryTickTask; @@ -29,6 +29,7 @@ import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; import net.pitan76.mcpitanlib.api.util.CompatActionResult; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -37,12 +38,10 @@ import java.util.function.Consumer; -// TODO(Ravel): can not resolve target class Item @Mixin(Item.class) public class ItemMixin { - // TODO(Ravel): no target class @Inject(method = "use", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$use(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable cir) { + private void mcpitanlib$use(Level world, Player user, InteractionHand hand, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; Options options = new Options(); @@ -52,22 +51,20 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$useOnBlock(ItemUsageContext context, CallbackInfoReturnable cir) { + @Inject(method = "useOn", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$useOnBlock(UseOnContext context, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; - ItemUsageContextMixin contextAccessor = (ItemUsageContextMixin) context; + UseOnContextMixin contextAccessor = (UseOnContextMixin) context; Options options = new Options(); - CompatActionResult returnValue = provider.onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHit()), options); + CompatActionResult returnValue = provider.onRightClickOnBlock(new ItemUseOnBlockEvent(context.getPlayer(), context.getHand(), contextAccessor.getHitResult()), options); if (options.cancel && returnValue != null) cir.setReturnValue(returnValue.toActionResult()); } } - // TODO(Ravel): no target class - @Inject(method = "useOnEntity", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand, CallbackInfoReturnable cir) { + @Inject(method = "interactLivingEntity", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$useOnEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; Options options = new Options(); @@ -77,9 +74,8 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "finishUsing", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$finishUsing(ItemStack stack, World world, LivingEntity user, CallbackInfoReturnable cir) { + @Inject(method = "finishUsingItem", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$finishUsing(ItemStack stack, Level world, LivingEntity user, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; Options options = new Options(); @@ -102,9 +98,8 @@ public class ItemMixin { } */ - // TODO(Ravel): no target class - @Inject(method = "appendTooltip", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$appendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer textConsumer, TooltipType type, CallbackInfo ci) { + @Inject(method = "appendHoverText", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$appendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplay displayComponent, Consumer textConsumer, TooltipFlag type, CallbackInfo ci) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; Options options = new Options(); @@ -114,8 +109,7 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "postHit", at = @At("HEAD"), cancellable = true) + @Inject(method = "hurtEnemy", at = @At("HEAD"), cancellable = true) private void mcpitanlib$postHit(ItemStack stack, LivingEntity target, LivingEntity attacker, CallbackInfo ci) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; @@ -126,9 +120,8 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "postMine", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner, CallbackInfoReturnable cir) { + @Inject(method = "mineBlock", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$postMine(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; Options options = new Options(); @@ -138,9 +131,8 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "onCraft", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onCraft(ItemStack stack, World world, CallbackInfo ci) { + @Inject(method = "onCraftedPostProcess", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onCraft(ItemStack stack, Level world, CallbackInfo ci) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; Options options = new Options(); @@ -176,8 +168,7 @@ public class ItemMixin { } */ - // TODO(Ravel): no target class - @Inject(method = "getItemBarColor", at = @At("HEAD"), cancellable = true) + @Inject(method = "getBarColor", at = @At("HEAD"), cancellable = true) private void mcpitanlib$getItemBarColor(ItemStack stack, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; @@ -188,8 +179,7 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "isItemBarVisible", at = @At("HEAD"), cancellable = true) + @Inject(method = "isBarVisible", at = @At("HEAD"), cancellable = true) private void mcpitanlib$isItemBarVisible(ItemStack stack, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; @@ -200,8 +190,7 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getItemBarStep", at = @At("HEAD"), cancellable = true) + @Inject(method = "getBarWidth", at = @At("HEAD"), cancellable = true) private void mcpitanlib$getItemBarStep(ItemStack stack, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; @@ -212,8 +201,7 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getBonusAttackDamage", at = @At("HEAD"), cancellable = true) + @Inject(method = "getAttackDamageBonus", at = @At("HEAD"), cancellable = true) private void mcpitanlib$getBonusAttackDamage(Entity target, float baseAttackDamage, DamageSource damageSource, CallbackInfoReturnable cir) { if (this instanceof ExtendItemProvider) { ExtendItemProvider provider = (ExtendItemProvider) this; @@ -224,9 +212,8 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getUseAction", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getUseAction(ItemStack stack, CallbackInfoReturnable cir) { + @Inject(method = "getUseAnimation", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getUseAction(ItemStack stack, CallbackInfoReturnable cir) { if (this instanceof CompatItemProvider) { CompatItemProvider provider = (CompatItemProvider) this; Options options = new Options(); @@ -236,9 +223,8 @@ public class ItemMixin { } } - // TODO(Ravel): no target class @Inject(method = "inventoryTick", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inventoryTick(ItemStack stack, ServerWorld world, Entity entity, EquipmentSlot slot, CallbackInfo ci) { + private void mcpitanlib$inventoryTick(ItemStack stack, ServerLevel world, Entity entity, EquipmentSlot slot, CallbackInfo ci) { // イベントを呼び出す if (!ItemEventRegistry.INVENTORY_TICK.isEmpty()) { int maxPriority = ItemEventRegistry.INVENTORY_TICK.getMaxPriority(); @@ -259,8 +245,7 @@ public class ItemMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getRecipeRemainder", at = @At("HEAD"), cancellable = true) + @Inject(method = "getCraftingRemainder", at = @At("HEAD"), cancellable = true) private void mcpitanlib$getRecipeRemainder(CallbackInfoReturnable cir) { if (this instanceof FixedRecipeRemainderItem) { ItemStack returnValue = ((FixedRecipeRemainderItem) this) diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java index 1240b432c..fb8513ca9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java @@ -1,24 +1,22 @@ package net.pitan76.mcpitanlib.mixin; import com.mojang.serialization.Dynamic; -import net.minecraft.datafixer.fix.ItemStackComponentizationFix; +import net.minecraft.util.datafix.fixes.ItemStackComponentizationFix; import net.pitan76.mcpitanlib.api.datafixer.ItemStackFixer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -// TODO(Ravel): can not resolve target class ItemStackComponentizationFix @Mixin(ItemStackComponentizationFix.class) public class ItemStackComponentizationFixMixin { - // TODO(Ravel): no target class - @Inject(method = "fixStack", at = @At("TAIL")) - private static void mcpitanlib$fixStack(ItemStackComponentizationFix.StackData data, Dynamic dynamic, CallbackInfo ci) { + @Inject(method = "fixItemStack", at = @At("TAIL")) + private static void mcpitanlib$fixStack(ItemStackComponentizationFix.ItemStackData data, Dynamic dynamic, CallbackInfo ci) { if (!ItemStackFixer.getNbt2componentMapIfItemEqualMap().isEmpty()) { ItemStackFixer.getNbt2componentMapIfItemEqualMap().forEach((itemId, map) -> { for (String nbtKey : map.keySet()) { - if (data.itemEquals(itemId)) { - data.moveToComponent(nbtKey, map.get(nbtKey)); + if (data.is(itemId)) { + data.moveTagToComponent(nbtKey, map.get(nbtKey)); } } }); @@ -27,15 +25,15 @@ public class ItemStackComponentizationFixMixin { if (!ItemStackFixer.getNbt2componentMapIfitemMatchesMap().isEmpty()) { ItemStackFixer.getNbt2componentMapIfitemMatchesMap().forEach((itemIds, map) -> { for (String nbtKey : map.keySet()) { - if (data.itemMatches(itemIds)) { - data.moveToComponent(nbtKey, map.get(nbtKey)); + if (data.is(itemIds)) { + data.moveTagToComponent(nbtKey, map.get(nbtKey)); } } }); } if (!ItemStackFixer.getNbt2componentMap().isEmpty()) { - ItemStackFixer.getNbt2componentMap().forEach(data::moveToComponent); + ItemStackFixer.getNbt2componentMap().forEach(data::moveTagToComponent); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java index 246e445a0..e23a50724 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.ServerLevel; import net.pitan76.mcpitanlib.api.event.v0.event.ItemStackActionEvent; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -12,13 +12,11 @@ import java.util.function.Consumer; -// TODO(Ravel): can not resolve target class ItemStack @Mixin(ItemStack.class) public abstract class ItemStackMixin { - // TODO(Ravel): no target class - @Inject(method = "damage(ILnet/minecraft/server/world/ServerWorld;Lnet/minecraft/server/network/ServerPlayerEntity;Ljava/util/function/Consumer;)V", at = @At("HEAD"), cancellable = true) - public void mcpitanlib$damage(int amount, ServerWorld world, ServerPlayerEntity player, Consumer breakCallback, CallbackInfo ci) { + @Inject(method = "hurtAndBreak(ILnet/minecraft/server/level/ServerLevel;Lnet/minecraft/server/level/ServerPlayer;Ljava/util/function/Consumer;)V", at = @At("HEAD"), cancellable = true) + public void mcpitanlib$damage(int amount, ServerLevel world, ServerPlayer player, Consumer breakCallback, CallbackInfo ci) { ItemStackActionEvent.returnValue = null; ItemStackActionEvent.call((ItemStack) (Object) this); if (ItemStackActionEvent.returnValue != null) diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java new file mode 100644 index 000000000..4d3295fb9 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java @@ -0,0 +1,90 @@ +package net.pitan76.mcpitanlib.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.mojang.blaze3d.buffers.GpuBufferSlice; +import net.minecraft.client.Camera; +import net.minecraft.client.DeltaTracker; +import net.minecraft.client.Minecraft; +import net.minecraft.client.render.*; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.WorldBorderRenderer; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.state.WorldBorderRenderState; +import net.minecraft.client.renderer.state.LevelRenderState; +import com.mojang.blaze3d.resource.GraphicsResourceAllocator; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.level.border.WorldBorder; +import net.pitan76.mcpitanlib.api.client.event.WorldRenderRegistry; +import net.pitan76.mcpitanlib.api.client.event.listener.*; +import org.jetbrains.annotations.Nullable; +import org.joml.Matrix4f; +import org.joml.Vector4f; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(LevelRenderer.class) +public abstract class LevelRendererMixin { + @Shadow private int ticks; + + @Shadow public abstract boolean hasRenderedAllSections(); + + @Shadow @Nullable public abstract Frustum getCapturedFrustum(); + + @Shadow @Final private Minecraft minecraft; + @Shadow @Final private LevelRenderState levelRenderState; + @Shadow @Nullable private ClientLevel level; + @Unique + private final WorldRenderContextImpl mcpitanlib$contextCache = new WorldRenderContextImpl(); + + @Inject(method = "renderBlockOutline", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$onRenderTargetBlockOutline(MultiBufferSource.BufferSource immediate, PoseStack matrices, boolean renderBlockOutline, LevelRenderState renderStates, CallbackInfo ci) { + if (WorldRenderRegistry.isEmptyBlockOutlineListeners) return; + + mcpitanlib$contextCache.worldRenderer = (LevelRenderer)(Object) this; + mcpitanlib$contextCache.advancedTranslucency = hasRenderedAllSections(); + mcpitanlib$contextCache.consumers = immediate; + mcpitanlib$contextCache.matrixStack = matrices; + mcpitanlib$contextCache.tickDelta = ticks; + + BeforeBlockOutlineEvent event = new BeforeBlockOutlineEvent(mcpitanlib$contextCache, Minecraft.getInstance().hitResult); + + for (BeforeBlockOutlineListener listener : WorldRenderRegistry.beforeBlockOutlineListeners) { + if (!listener.beforeBlockOutline(event)) { + ci.cancel(); + return; + } + } + } + + @Inject(method = "renderLevel", at = @At("HEAD")) + private void beforeRender(GraphicsResourceAllocator allocator, DeltaTracker tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci) { + mcpitanlib$contextCache.prepare(minecraft.gameRenderer, (LevelRenderer) (Object) this, levelRenderState, level, tickCounter, renderBlockOutline, camera, positionMatrix, matrix4f, projectionMatrix); + } + + @ModifyExpressionValue(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;prepareCullFrustum(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/world/phys/Vec3;)Lnet/minecraft/client/renderer/culling/Frustum;")) + private Frustum onSetupFrustum(Frustum frustum) { + mcpitanlib$contextCache.frustum = frustum; + return frustum; + } + + + @WrapOperation(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldBorderRenderer;extract(Lnet/minecraft/world/level/border/WorldBorder;FLnet/minecraft/world/phys/Vec3;DLnet/minecraft/client/renderer/state/WorldBorderRenderState;)V")) + private void mcpitanlib$onWorldBorderExtraction(WorldBorderRenderer instance, WorldBorder worldBorder, float tickDelta, Vec3 vec3d, double d, WorldBorderRenderState worldBorderRenderState, Operation original) { + original.call(instance, worldBorder, tickDelta, vec3d, d, worldBorderRenderState); + if (WorldRenderRegistry.isEmptyWorldRenderAfterLevelListeners) return; + + for (WorldRenderContextListener listener : WorldRenderRegistry.worldRenderAfterLevelListeners) { + listener.render(mcpitanlib$contextCache); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java b/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java index f4c81ebb0..608fabf85 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java @@ -18,7 +18,7 @@ public class MinecraftServerTimer implements MinecraftServerTimerAccess { @Unique private final List mcpitanlib$timerItems = new ArrayList<>(); - @Inject(method = "tick", at = @At("TAIL")) + @Inject(method = "tickServer", at = @At("TAIL")) private void mcpitanlib$onTick(CallbackInfo ci) { if (mcpitanlib$timerItems.isEmpty()) return; List items = new ArrayList<>(mcpitanlib$timerItems); diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java index 6ae6c68da..839da0438 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java @@ -2,9 +2,12 @@ import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.recipe.*; -import net.minecraft.resource.ResourceManager; +import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.resources.Identifier; -import net.minecraft.util.profiler.Profiler; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeMap; import net.pitan76.mcpitanlib.api.event.v0.event.RecipeManagerEvent; import net.pitan76.mcpitanlib.api.event.v1.RecipeManagerRegistry; import org.spongepowered.asm.mixin.Mixin; @@ -14,16 +17,12 @@ import java.util.SortedMap; -// TODO(Ravel): can not resolve target class ServerRecipeManager -// TODO(Ravel): can not resolve target class ServerRecipeManager -@Mixin(ServerRecipeManager.class) +@Mixin(RecipeManager.class) public class RecipeManagerMixin { - // TODO(Ravel): no target class -// TODO(Ravel): no target class - @Inject(method = "prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Lnet/minecraft/recipe/PreparedRecipes;", + @Inject(method = "prepare(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)Lnet/minecraft/world/item/crafting/RecipeMap;", at = @At(value = "TAIL")) - private void mcpitanlib$invokeApply(ResourceManager resourceManager, Profiler profiler, CallbackInfoReturnable cir, @Local SortedMap> sortedMap) { + private void mcpitanlib$invokeApply(ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfoReturnable cir, @Local SortedMap> sortedMap) { if (RecipeManagerRegistry.managers.isEmpty()) return; RecipeManagerRegistry.managers.forEach((manager) -> manager.apply(new RecipeManagerEvent(sortedMap, resourceManager, profiler))); } diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java new file mode 100644 index 000000000..496875c7a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.server.level.ServerLevel; +import net.pitan76.mcpitanlib.api.timer.ServerWorldTimerAccess; +import net.pitan76.mcpitanlib.api.timer.TimerItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; + +@Mixin(ServerLevel.class) +public class ServerLevelTimer implements ServerWorldTimerAccess { + @Unique + private final List mcpitanlib$timerItems = new ArrayList<>(); + + @Inject(method = "tick", at = @At("TAIL")) + private void onTick(CallbackInfo ci) { + if (mcpitanlib$timerItems.isEmpty()) return; + List items = new ArrayList<>(mcpitanlib$timerItems); + + for (TimerItem item : items) { + if (--item.ticksUntilSomething == 0L) { + if (item.executeSupplier.get()) + mcpitanlib$timerItems.remove(item); + } + } + } + + @Override + public void mcpitanlib$addTimer(long ticksUntilSomething, Supplier executeSupplier) { + mcpitanlib$timerItems.add(new TimerItem(ticksUntilSomething, executeSupplier)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java new file mode 100644 index 000000000..6e0babcd1 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java @@ -0,0 +1,12 @@ +package net.pitan76.mcpitanlib.mixin; + +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.phys.BlockHitResult; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(UseOnContext.class) +public interface UseOnContextMixin { + @Accessor + public BlockHitResult getHitResult(); +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java index 568fa9c5d..31f66b243 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.test; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.command.CommandSettings; import net.pitan76.mcpitanlib.api.command.LiteralCommand; import net.pitan76.mcpitanlib.api.command.argument.IntegerCommand; diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java index ab182e28c..549febca6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.test; -import net.minecraft.inventory.Inventory; +import net.minecraft.world.Container; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.api.util.InventoryUtil; @@ -9,7 +9,7 @@ public class ExampleContainerGui extends SimpleContainerGui { - public static Inventory EXAMPLE_INVENTORY = InventoryUtil.createSimpleInventory(1); + public static Container EXAMPLE_INVENTORY = InventoryUtil.createSimpleInventory(1); public ExampleContainerGui(CreateMenuEvent e) { super(ExampleMod.EXAMPLE_CONTAINER_GUI.get(), e); diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java index 3e6d42413..ea3349649 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.test; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -10,7 +10,7 @@ public class ExampleContainerGuiScreen extends CompatInventoryScreen> EXAMPLE_SCREENHANDLER; - public static SupplierResult> EXAMPLE_CONTAINER_GUI; + public static SupplierResult> EXAMPLE_SCREENHANDLER; + public static SupplierResult> EXAMPLE_CONTAINER_GUI; public static RegistryResult EXAMPLE_ITEM; public static RegistryResult EXAMPLE_BLOCK; diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java index aa3b041be..0fae5104a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.test; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; import net.pitan76.mcpitanlib.guilib.GuiRegistry; public class ExampleModClient { public static void init() { - CompatRegistryClient.registerScreen(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_SCREENHANDLER.get(), ExampleScreen::new); + CompatRegistryClient2.registerScreen(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_SCREENHANDLER.get(), ExampleScreen::new); GuiRegistry.registerSimpleContainerGui(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_CONTAINER_GUI.get()); } diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java index 17bd18c72..1685da685 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.test; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.client.gui.screen.CompatInventoryScreen; import net.pitan76.mcpitanlib.api.client.gui.widget.CompatibleTexturedButtonWidget; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -10,7 +10,7 @@ public class ExampleScreen extends CompatInventoryScreen { public static CompatIdentifier GUI = CompatIdentifier.of("textures/gui/container/blast_furnace.png"); - public ExampleScreen(ExampleScreenHandler handler, PlayerInventory inventory, Text title) { + public ExampleScreen(ExampleScreenHandler handler, Inventory inventory, Component title) { super(handler, inventory, title); } diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java index ff99d6ae9..3d5d51503 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.test; -import net.minecraft.item.ItemStack; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; From 26246c96bb8650fdb922f7c3bb25a6147155d7c0 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 15:19:10 +0900 Subject: [PATCH 010/151] port to 26.1 --- build.gradle | 4 + .../net/pitan76/fabric/mixin/RecipeMixin.java | 27 -- .../api/block/CompatStairsBlock.java | 2 - .../mcpitanlib/api/block/ExtendBlock.java | 8 +- .../api/client/SimpleHandledScreen.java | 29 +- .../mcpitanlib/api/client/SimpleScreen.java | 23 +- .../api/client/color/BlockColorEvent.java | 15 +- .../color/CompatBlockColorProvider.java | 45 +++- .../api/client/event/ItemTooltipRegistry.java | 6 +- .../api/client/event/WorldRenderRegistry.java | 240 ++++++++--------- .../listener/BeforeBlockOutlineEvent.java | 2 +- .../event/listener/WorldRenderContext.java | 4 +- .../listener/WorldRenderContextImpl.java | 18 +- .../gui/screen/SimpleHandledScreen.java | 31 +-- .../CompatibleTexturedButtonWidget.java | 6 +- .../RedrawableTexturedButtonWidget.java | 6 - .../client/gui/widget/SimpleListWidget.java | 9 +- .../client/gui/widget/SimpleSliderWidget.java | 4 +- .../client/registry/ArchRegistryClient.java | 40 ++- .../client/registry/CompatRegistryClient.java | 249 +++++++++--------- .../client/registry/KeybindingRegistry.java | 4 +- .../fabric/CompatRegistryClientImpl.java | 25 -- .../api/client/render/DrawObjectDM.java | 13 +- .../entity/CompatBlockEntityRenderer.java | 2 +- .../entity/event/BlockEntityRenderEvent.java | 11 +- .../pitan76/mcpitanlib/api/entity/Player.java | 10 +- .../api/event/block/BlockBreakEvent.java | 5 +- .../api/event/block/BlockUseEvent.java | 3 +- .../event/block/ScreenHandlerCreateEvent.java | 3 +- .../api/event/item/CanMineArgs.java | 7 +- .../mcpitanlib/api/event/item/CraftEvent.java | 3 +- .../api/event/item/ItemUseEvent.java | 5 +- .../api/event/item/ItemUseOnBlockEvent.java | 5 +- .../api/event/item/ItemUseOnEntityEvent.java | 3 +- .../api/event/item/PostMineEvent.java | 5 +- .../api/event/result/EventResult.java | 24 +- .../api/event/v0/ClientTickEventRegistry.java | 11 +- .../ExtendedNamedScreenHandlerFactory.java | 18 +- .../gui/ExtendedScreenHandlerTypeBuilder.java | 14 +- .../api/gui/args/CreateMenuEvent.java | 7 +- .../api/item/CompatibleItemSettings.java | 16 +- .../api/item/CreativeTabBuilder.java | 24 +- .../api/item/CreativeTabManager.java | 33 ++- .../api/item/args/StoppedUsingArgs.java | 5 +- .../api/recipe/CompatRecipeType.java | 1 - .../api/recipe/v2/CompatRecipeEntry.java | 1 - .../api/registry/CompatRegistry.java | 2 +- .../api/registry/WorldGenRegistry.java | 35 +-- .../api/registry/result/RegistryResult.java | 1 - .../api/registry/result/RegistrySupplier.java | 30 +++ .../api/registry/result/SupplierResult.java | 1 - .../api/tile/BlockEntityTypeBuilder.java | 12 +- .../mcpitanlib/api/util/RecipeUtil.java | 119 ++++----- .../api/util/ScreenHandlerUtil.java | 10 +- .../mcpitanlib/api/util/WorldUtil.java | 10 +- .../api/util/client/ClientUtil.java | 6 +- .../core/registry/MCPLRegistry.java | 51 +--- .../core/registry/MCPLRegistry1_20.java | 30 ++- .../core/registry/MCPLRegistry1_21.java | 21 +- .../fabric/ExtendModInitializer.java | 0 .../fabric/MCPitanLibFabric.java | 2 +- .../midohra/server/PlayerManager.java | 3 +- .../mcpitanlib/midohra/world/World.java | 5 +- .../mcpitanlib/midohra/world/WorldAccess.java | 6 +- .../AbstractBlock4CompatProviderMixin.java | 1 - src/main/resources/mcpitanlib.accesswidener | 25 +- src/main/resources/mcpitanlib.mixins.json | 2 +- 67 files changed, 683 insertions(+), 715 deletions(-) delete mode 100644 src/main/java/net/pitan76/fabric/mixin/RecipeMixin.java delete mode 100644 src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java rename src/main/java/net/pitan76/{ => mcpitanlib}/fabric/ExtendModInitializer.java (100%) rename src/main/java/net/pitan76/{ => mcpitanlib}/fabric/MCPitanLibFabric.java (91%) diff --git a/build.gradle b/build.gradle index 02bbdc3d6..f93b83c89 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,10 @@ repositories { maven { url "https://maven.shedaniel.me/" } } +loom { + accessWidenerPath = file("src/main/resources/mcpitanlib.accesswidener") +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/src/main/java/net/pitan76/fabric/mixin/RecipeMixin.java b/src/main/java/net/pitan76/fabric/mixin/RecipeMixin.java deleted file mode 100644 index 0b86fecfc..000000000 --- a/src/main/java/net/pitan76/fabric/mixin/RecipeMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.pitan76.mcpitanlib.fabric.mixin; - -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.input.RecipeInput; -import org.spongepowered.asm.mixin.Mixin; - -// TODO(Ravel): can not resolve target class Recipe -@Mixin(Recipe.class) -public interface RecipeMixin { - - /* - @Inject(method = "getRemainder", at = @At("RETURN")) - default void injectGetRemainder(C input, CallbackInfoReturnable> cir) { - DefaultedList defaultedList = cir.getReturnValue(); - - int i = 0; - for(ItemStack stack : defaultedList) { - if (stack.getItem() instanceof FixedRecipeRemainderItem) { - FixedRecipeRemainderItem remainder = (FixedRecipeRemainderItem) stack.getItem(); - defaultedList.set(i, remainder.getFixedRecipeRemainder(stack.copy())); - } - i++; - } - } - - */ -} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java index 8f6f57e23..c31f34d8b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java @@ -1,10 +1,8 @@ package net.pitan76.mcpitanlib.api.block; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.StairBlock; -import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Half; import net.minecraft.world.level.block.state.properties.StairsShape; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java index c26f49145..85ea4b1c4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java @@ -2,14 +2,12 @@ import com.mojang.serialization.MapCodec; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.InsideBlockEffectApplier; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.pathfinder.PathComputationType; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.ItemStack; @@ -110,7 +108,7 @@ public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource @Override @Deprecated - protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, net.minecraft.world.entity.player.Player player, BlockHitResult hit) { return onRightClick(new BlockUseEvent(state, world, pos, player, player.getUsedItemHand(), hit)).toActionResult(); } @@ -167,7 +165,7 @@ public void onPlaced(BlockPlacedEvent event) { @Override @Deprecated - public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, net.minecraft.world.entity.player.Player player) { return onBreak(new BlockBreakEvent(world, pos, state, player)).state; } @@ -316,7 +314,7 @@ public void onEntityCollision(EntityCollisionEvent e) { @Deprecated @Override - public void attack(BlockState state, Level world, BlockPos pos, Player player) { + public void attack(BlockState state, Level world, BlockPos pos, net.minecraft.world.entity.player.Player player) { onBlockBreakStart(new BlockBreakStartEvent(state, world, pos, new Player(player))); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java index dc9e7e781..8c61a7640 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java @@ -2,14 +2,14 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.input.KeyEvent; -import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.item.ItemModelResolver; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.network.chat.Component; @@ -31,7 +31,7 @@ public abstract class SimpleHandledScreen extends AbstractContainerScreen toTintSource() { + List tintSources = new ArrayList<>(); + + // TODO: 16は適当な数。実際にはtintIndexの最大値に合わせて増やす必要があるかもしれない + for (int i = 0; i < 16; i++) { + tintSources.add(new BuiltBlockTintSource(this, i)); + } + return tintSources; + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java index 8166f7406..d597f4180 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java @@ -1,10 +1,12 @@ package net.pitan76.mcpitanlib.api.client.event; -import dev.architectury.event.events.client.ClientTooltipEvent; +import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; import net.pitan76.mcpitanlib.api.client.event.listener.ItemTooltipListener; public class ItemTooltipRegistry { public static void registerItemTooltip(ItemTooltipListener listener) { - ClientTooltipEvent.ITEM.register(listener::onTooltip); + ItemTooltipCallback.EVENT.register(((stack, tooltipContext, type, texts) -> { + listener.onTooltip(stack, texts, tooltipContext, type); + })); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java index 5e88ff0da..87973b6bf 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java @@ -37,124 +37,124 @@ public static void registerWorldRenderAfterLevel(WorldRenderContextListener list isEmptyWorldRenderAfterLevelListeners = false; //throw new AssertionError(); } - public static void _registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { - WorldRenderEvents.BEFORE_BLOCK_OUTLINE.register(((worldRenderContext, renderState) -> listener.beforeBlockOutline(new BeforeBlockOutlineEvent( - new WorldRenderContext() { - @Override - public WorldRenderer getWorldRenderer() { - return worldRenderContext.worldRenderer(); - } - - @Override - public MatrixStack getMatrixStack() { - return worldRenderContext.matrices(); - } - - @Override - public float getTickDelta() { - return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); - } - - @Override - public Camera getCamera() { - return worldRenderContext.gameRenderer().getCamera(); - } - - @Override - public GameRenderer getGameRenderer() { - return worldRenderContext.gameRenderer(); - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return getGameRenderer().getLightmapTextureManager(); - } - - @Override - public Matrix4f getProjectionMatrix() { - return worldRenderContext.gameRenderer().getBasicProjectionMatrix(0); - } - - @Override - public ClientWorld getWorld() { - return ClientUtil.getWorld(); - } - - @Override - public boolean isAdvancedTranslucency() { - return renderState.isTranslucent(); - } - - @Override - public VertexConsumerProvider getConsumers() { - return worldRenderContext.consumers(); - } - - @Override - public Frustum getFrustum() { - return worldRenderContext.worldRenderer().getCapturedFrustum(); - } - }, renderState)))); - } - - public static void _registerWorldRenderAfterLevel(WorldRenderContextListener listener) { - WorldRenderEvents.END_MAIN.register((context -> { - listener.render(new WorldRenderContext() { - @Override - public WorldRenderer getWorldRenderer() { - return context.worldRenderer(); - } - - @Override - public MatrixStack getMatrixStack() { - return context.matrices(); - } - - @Override - public float getTickDelta() { - return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); - } - - @Override - public Camera getCamera() { - return context.gameRenderer().getCamera(); - } - - @Override - public GameRenderer getGameRenderer() { - return context.gameRenderer(); - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return getGameRenderer().getLightmapTextureManager(); - } - - @Override - public Matrix4f getProjectionMatrix() { - return context.gameRenderer().getBasicProjectionMatrix(0); - } - - @Override - public ClientWorld getWorld() { - return ClientUtil.getWorld(); - } - - @Override - public boolean isAdvancedTranslucency() { - return true; - } - - @Override - public @Nullable VertexConsumerProvider getConsumers() { - return context.consumers(); - } - - @Override - public @Nullable Frustum getFrustum() { - return context.worldRenderer().getCapturedFrustum(); - } - }); - })); - } +// public static void _registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { +// WorldRenderEvents.BEFORE_BLOCK_OUTLINE.register(((worldRenderContext, renderState) -> listener.beforeBlockOutline(new BeforeBlockOutlineEvent( +// new WorldRenderContext() { +// @Override +// public WorldRenderer getWorldRenderer() { +// return worldRenderContext.worldRenderer(); +// } +// +// @Override +// public MatrixStack getMatrixStack() { +// return worldRenderContext.matrices(); +// } +// +// @Override +// public float getTickDelta() { +// return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); +// } +// +// @Override +// public Camera getCamera() { +// return worldRenderContext.gameRenderer().getCamera(); +// } +// +// @Override +// public GameRenderer getGameRenderer() { +// return worldRenderContext.gameRenderer(); +// } +// +// @Override +// public LightmapTextureManager getLightmapTextureManager() { +// return getGameRenderer().getLightmapTextureManager(); +// } +// +// @Override +// public Matrix4f getProjectionMatrix() { +// return worldRenderContext.gameRenderer().getBasicProjectionMatrix(0); +// } +// +// @Override +// public ClientWorld getWorld() { +// return ClientUtil.getWorld(); +// } +// +// @Override +// public boolean isAdvancedTranslucency() { +// return renderState.isTranslucent(); +// } +// +// @Override +// public VertexConsumerProvider getConsumers() { +// return worldRenderContext.consumers(); +// } +// +// @Override +// public Frustum getFrustum() { +// return worldRenderContext.worldRenderer().getCapturedFrustum(); +// } +// }, renderState)))); +// } +// +// public static void _registerWorldRenderAfterLevel(WorldRenderContextListener listener) { +// WorldRenderEvents.END_MAIN.register((context -> { +// listener.render(new WorldRenderContext() { +// @Override +// public WorldRenderer getWorldRenderer() { +// return context.worldRenderer(); +// } +// +// @Override +// public MatrixStack getMatrixStack() { +// return context.matrices(); +// } +// +// @Override +// public float getTickDelta() { +// return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); +// } +// +// @Override +// public Camera getCamera() { +// return context.gameRenderer().getCamera(); +// } +// +// @Override +// public GameRenderer getGameRenderer() { +// return context.gameRenderer(); +// } +// +// @Override +// public LightmapTextureManager getLightmapTextureManager() { +// return getGameRenderer().getLightmapTextureManager(); +// } +// +// @Override +// public Matrix4f getProjectionMatrix() { +// return context.gameRenderer().getBasicProjectionMatrix(0); +// } +// +// @Override +// public ClientWorld getWorld() { +// return ClientUtil.getWorld(); +// } +// +// @Override +// public boolean isAdvancedTranslucency() { +// return true; +// } +// +// @Override +// public @Nullable VertexConsumerProvider getConsumers() { +// return context.consumers(); +// } +// +// @Override +// public @Nullable Frustum getFrustum() { +// return context.worldRenderer().getCapturedFrustum(); +// } +// }); +// })); +// } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java index 3820cd5a3..36114a46b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.client.event.listener; +import net.minecraft.client.renderer.state.level.BlockOutlineRenderState; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.Camera; import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.state.BlockOutlineRenderState; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java index 52e4dd582..c426de214 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java @@ -6,13 +6,11 @@ import net.minecraft.client.Camera; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.rendertype.RenderTypes; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.render.*; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.world.entity.Entity; @@ -42,7 +40,7 @@ public interface WorldRenderContext { GameRenderer getGameRenderer(); - LightTexture getLightmapTextureManager(); +// LightTexture getLightmapTextureManager(); @Deprecated Matrix4f getProjectionMatrix(); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java index 9693d3d12..22e6ec7a6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java @@ -2,13 +2,10 @@ import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; -import net.minecraft.client.render.*; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.culling.Frustum; -import net.minecraft.client.renderer.state.LevelRenderState; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.multiplayer.ClientLevel; import com.mojang.math.Axis; @@ -24,7 +21,7 @@ public class WorldRenderContextImpl implements WorldRenderContext { public float tickDelta; public Camera camera; public GameRenderer gameRenderer; - public LightTexture lightmapTextureManager; +// public LightTexture lightmapTextureManager; public Matrix4f projectionMatrix; public ClientLevel world; public boolean advancedTranslucency; @@ -62,10 +59,10 @@ public GameRenderer getGameRenderer() { return gameRenderer; } - @Override - public LightTexture getLightmapTextureManager() { - return lightmapTextureManager; - } +// @Override +// public LightTexture getLightmapTextureManager() { +// return lightmapTextureManager; +// } @Override public Matrix4f getProjectionMatrix() { @@ -95,7 +92,7 @@ public boolean isAdvancedTranslucency() { return frustum; } - public void prepare(GameRenderer gameRenderer, LevelRenderer worldRenderer, LevelRenderState worldRenderState, @Nullable ClientLevel world, DeltaTracker tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix) { + public void prepare(GameRenderer gameRenderer, LevelRenderer worldRenderer, @Nullable ClientLevel world, DeltaTracker tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix) { this.gameRenderer = gameRenderer; this.worldRenderer = worldRenderer; this.world = world; @@ -114,7 +111,6 @@ public void prepare(GameRenderer gameRenderer, LevelRenderer worldRenderer, Leve this.projectionMatrix = projectionMatrix;; this.tickDelta = tickCounter.getGameTimeDeltaTicks(); - this.lightmapTextureManager = gameRenderer.lightTexture(); - this.frustum = worldRenderer.getCapturedFrustum(); + this.frustum = gameRenderer.getMainCamera().getCapturedFrustum(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java index 59583414f..a55aa73b7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java @@ -2,14 +2,14 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.input.KeyEvent; -import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.item.ItemModelResolver; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.network.chat.Component; @@ -31,7 +31,7 @@ public abstract class SimpleHandledScreen exten public int width, height, backgroundWidth, backgroundHeight, x, y; public S handler; public Font textRenderer; - public ItemRenderer itemRenderer; + public ItemModelResolver itemRenderer; public Component title; public Minecraft client; @@ -68,7 +68,8 @@ public CompatibleTexturedButtonWidget addDrawableCTBW(CompatibleTexturedButtonWi @Deprecated @Override - protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { + public void extractBackground(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { + super.extractBackground(context, mouseX, mouseY, delta); DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); drawBackgroundOverride(new DrawBackgroundArgs(drawObjectDM, delta, mouseX, mouseY)); } @@ -77,13 +78,13 @@ protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY @Deprecated @Override - protected void renderLabels(GuiGraphics context, int mouseX, int mouseY) { + protected void extractLabels(GuiGraphicsExtractor context, int mouseX, int mouseY) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); drawForegroundOverride(new DrawForegroundArgs(drawObjectDM, mouseX, mouseY)); } protected void drawForegroundOverride(DrawForegroundArgs args) { - super.renderLabels(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + super.extractLabels(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); } public void callDrawTexture(DrawObjectDM drawObjectDM, Identifier texture, int x, int y, int u, int v, int width, int height) { @@ -101,15 +102,15 @@ public void callRenderBackground(DrawObjectDM drawObjectDM) { public void callRenderBackground(RenderArgs args) { - super.renderBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + super.extractBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { - super.renderTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); + super.extractTooltip(args.drawObjectDM.getContext(), args.mouseX, args.mouseY); } public void renderOverride(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + super.extractRenderState(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } public void resizeOverride(Minecraft client, int width, int height) { @@ -140,7 +141,7 @@ public void fixScreen() { this.x = super.leftPos; //(this.width - this.backgroundWidth) / 2; this.y = super.topPos; //(this.height - this.backgroundHeight) / 2; this.textRenderer = super.font; - this.itemRenderer = Minecraft.getInstance().getItemRenderer(); + this.itemRenderer = Minecraft.getInstance().getItemModelResolver(); this.width = super.width; this.height = super.height; if (super.minecraft == null) @@ -163,7 +164,7 @@ public void setTextRenderer(Font textRenderer) { this.textRenderer = textRenderer; } - public void setItemRenderer(ItemRenderer itemRenderer) { + public void setItemRenderer(ItemModelResolver itemRenderer) { this.itemRenderer = itemRenderer; } @@ -197,7 +198,7 @@ public int getBackgroundHeight() { @Deprecated @Override - public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { + public void extractRenderState(GuiGraphicsExtractor context, int mouseX, int mouseY, float delta) { DrawObjectDM drawObjectDM = new DrawObjectDM(context, this); renderOverride(new RenderArgs(drawObjectDM, mouseX, mouseY, delta)); } @@ -212,7 +213,7 @@ public boolean keyPressed(KeyEventArgs args) { public void renderBackgroundTexture(RenderBackgroundTextureArgs args) { if (getBackgroundTexture() != null) - Screen.renderMenuBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); + Screen.extractMenuBackgroundTexture(args.getDrawObjectDM().getContext(), getBackgroundTexture(), x, y, 0, 0, this.width, this.height); RenderUtil.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); callDrawTexture(args.drawObjectDM, getBackgroundTexture(), 0, 0, 0, 0, width, height); @@ -232,7 +233,7 @@ public boolean keyPressed(KeyEvent input) { @Deprecated @Override - public void renderMenuBackground(GuiGraphics context) { + public void extractMenuBackground(GuiGraphicsExtractor context) { this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); } @@ -351,7 +352,7 @@ public Font callGetTextRenderer() { return ClientUtil.getTextRenderer(); } - public ItemRenderer callGetItemRenderer() { + public ItemModelResolver callGetItemRenderer() { if (itemRenderer != null) return itemRenderer; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java index 768ec9ccf..ddceb64de 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.client.gui.widget; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.renderer.RenderPipelines; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.WidgetSprites; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ImageButton; @@ -61,7 +61,7 @@ public void setPos(int x, int y) { } @Override - public void renderContents(GuiGraphics context, int mouseX, int mouseY, float delta) { + public void extractContents(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float delta) { int i = v; if (this.createNarrationMessage().toString().isEmpty()) { i = v + hoveredVOffset * 2; @@ -69,6 +69,6 @@ public void renderContents(GuiGraphics context, int mouseX, int mouseY, float de i += hoveredVOffset; } - context.blit(RenderPipelines.GUI_TEXTURED, texture, this.getX(), this.getY(), u, i, this.width, this.height, textureWidth, textureHeight); + graphics.blit(RenderPipelines.GUI_TEXTURED, texture, this.getX(), this.getY(), u, i, this.width, this.height, textureWidth, textureHeight); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java index 9d7924a4c..b157c5c43 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java @@ -1,7 +1,5 @@ package net.pitan76.mcpitanlib.api.client.gui.widget; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.Button.OnPress; import net.minecraft.resources.Identifier; public class RedrawableTexturedButtonWidget extends CompatibleTexturedButtonWidget { @@ -22,10 +20,6 @@ public RedrawableTexturedButtonWidget(int x, int y, int width, int height, int u this.texture = texture; } - public void renderButton(GuiGraphics context, int mouseX, int mouseY, float delta) { - super.renderWidget(context, mouseX, mouseY, delta); - } - public void setTexture(Identifier texture) { this.texture = texture; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java index 85790dc0c..f09f5d8f5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java @@ -4,8 +4,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.ContainerObjectSelectionList.Entry; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.components.AbstractWidget; @@ -75,7 +74,7 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { */ public void render(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + super.extractWidgetRenderState(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } @Environment(EnvType.CLIENT) @@ -92,8 +91,8 @@ public static WidgetEntry create(AbstractWidget widget) { @Deprecated @Override - public void renderContent(GuiGraphics context, int mouseX, int mouseY, boolean hovered, float deltaTicks) { - widget.render(context, mouseX, mouseY, deltaTicks); + public void extractContent(GuiGraphicsExtractor context, int mouseX, int mouseY, boolean hovered, float deltaTicks) { + widget.extractRenderState(context, mouseX, mouseY, deltaTicks); } @Deprecated diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java index 5f1edca92..a8571e6c9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java @@ -2,10 +2,8 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractSliderButton; import net.minecraft.network.chat.Component; -import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; import net.pitan76.mcpitanlib.api.util.TextUtil; @@ -53,7 +51,7 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { */ public void render(RenderArgs args) { - super.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + super.extractRenderState(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } public void setValue(double value) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java index bf8aa3952..584211380 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java @@ -1,12 +1,11 @@ package net.pitan76.mcpitanlib.api.client.registry; -import dev.architectury.event.events.client.ClientLifecycleEvent; -import dev.architectury.registry.client.gui.MenuScreenRegistry; -import dev.architectury.registry.client.level.entity.EntityRendererRegistry; -import dev.architectury.registry.client.particle.ParticleProviderRegistry; -import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.client.particle.v1.ParticleProviderRegistry; +import net.minecraft.client.renderer.block.BlockModelResolver; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; +import net.minecraft.client.renderer.item.ItemModelResolver; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -17,7 +16,6 @@ import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.SpriteSet; import net.minecraft.client.renderer.rendertype.RenderType; -import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; @@ -25,7 +23,6 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.EntityModelSet; -import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.world.entity.Entity; @@ -47,10 +44,7 @@ @Environment(EnvType.CLIENT) public class ArchRegistryClient { public static > void registerScreen(MenuType type, ScreenFactory factory) { - ClientLifecycleEvent.CLIENT_SETUP.register((state) -> { - - }); - MenuScreenRegistry.registerScreenFactory(type, factory::create); + CompatRegistryClient.registerScreen(type, factory::create); } public interface ScreenFactory> { @@ -58,11 +52,11 @@ public interface ScreenFactory void registerParticle(ParticleType type, ParticleProvider factory) { - ParticleProviderRegistry.register(type, factory); + CompatRegistryClient.registerParticle(type, factory); } public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { - ParticleProviderRegistry.register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { + ParticleProviderRegistry.getInstance().register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { @Override public TextureAtlas getAtlas() { return spriteSet.getAtlas(); @@ -91,7 +85,7 @@ public TextureAtlasSprite first() { } public static void registerEntityRenderer(Supplier> type, EntityRendererProvider provider) { - EntityRendererRegistry.register(type, provider); + CompatRegistryClient.registerEntityRenderer(type, provider); } @FunctionalInterface @@ -122,8 +116,8 @@ public static void registryClientSprite(Identifier atlasId, TextureAtlasSprite s } public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.blockEntityRenderDispatcher(), ctx.blockRenderDispatcher(), ctx.itemRenderer(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font() + BlockEntityRenderers.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( + ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font() ))); } @@ -133,13 +127,13 @@ public interface BlockEntityRendererFactory> void registerScreen(ScreenHandlerType type, ScreenFactory factory) { + public static > void registerScreen(MenuType type, ScreenFactory factory) { registerScreen(MCPitanLib.MOD_ID, type, factory); } - public static > void registerScreen(String modId, ScreenHandlerType type, ScreenFactory factory) { - MenuScreenRegistry.registerScreenFactory(type, factory::create); + public static > void registerScreen(String modId, MenuType type, ScreenFactory factory) { + MenuScreens.register(type, factory::create); } - public interface ScreenFactory> { - S create(H handler, PlayerInventory inventory, Text text); + public interface ScreenFactory> { + S create(H handler, Inventory inventory, Component text); } - public static void registerParticle(ParticleType type, ParticleFactory factory) { - ParticleProviderRegistry.register(type, factory); + public static void registerParticle(ParticleType type, ParticleProvider factory) { + ParticleProviderRegistry.getInstance().register(type, factory); } - public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { - ParticleProviderRegistry.register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { + public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { + ParticleProviderRegistry.getInstance().register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { @Override - public SpriteAtlasTexture getAtlas() { + public TextureAtlas getAtlas() { return spriteSet.getAtlas(); } @Override - public List getSprites() { + public List getSprites() { return spriteSet.getSprites(); } @Override - public Sprite getSprite(int age, int maxAge) { - return spriteSet.getSprite(age, maxAge); + public TextureAtlasSprite get(int age, int maxAge) { + return spriteSet.get(age, maxAge); } @Override - public Sprite getSprite(Random random) { - return spriteSet.getSprite(random); + public TextureAtlasSprite get(RandomSource random) { + return spriteSet.get(random); } @Override - public Sprite getFirst() { - return spriteSet.getFirst(); + public TextureAtlasSprite first() { + return spriteSet.first(); } })); } - public static void registerEntityModelLayer(EntityModelLayer layer, EntityModelLayerContext context) { - EntityModelLayerRegistry.register(layer, () -> TexturedModelData.of(context.getData(), context.getWidth(), context.getHeight())); + public static void registerEntityModelLayer(ModelLayerLocation layer, EntityModelLayerContext context) { + ModelLayerRegistry.registerModelLayer(layer, () -> LayerDefinition.create(context.getData(), context.getWidth(), context.getHeight())); } - public static void registerEntityRenderer(Supplier> type, EntityRendererFactory provider) { - EntityRendererRegistry.register(type, provider); + public static void registerEntityRenderer(Supplier> type, EntityRendererProvider provider) { + EntityRenderers.register(type.get(), provider); } @FunctionalInterface - public interface DeferredParticleProvider { - ParticleFactory create(ExtendedSpriteSet spriteSet); + public interface DeferredParticleProvider { + ParticleProvider create(ExtendedSpriteSet spriteSet); } - public interface ExtendedSpriteSet extends SpriteProvider { - SpriteAtlasTexture getAtlas(); + public interface ExtendedSpriteSet extends SpriteSet { + TextureAtlas getAtlas(); - List getSprites(); + List getSprites(); } public static void registryClientSpriteAtlasTexture(Identifier identifier) { //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, identifier); } - public static void registryClientSpriteAtlasTexture(Sprite sprite) { + public static void registryClientSpriteAtlasTexture(TextureAtlasSprite sprite) { //registryClientSprite(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, sprite); } @@ -134,13 +133,13 @@ public static void registryClientSprite(Identifier atlasId, Identifier identifie // ~1.19.2 } - public static void registryClientSprite(Identifier atlasId, Sprite sprite) { + public static void registryClientSprite(Identifier atlasId, TextureAtlasSprite sprite) { // ~1.19.2 } public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache() + BlockEntityRenderers.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( + ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache() ))); } @@ -149,22 +148,20 @@ public interface BlockEntityRendererFactory create(Context ctx); class Context { - private final BlockEntityRenderManager renderDispatcher; - private final BlockRenderManager renderManager; - private final ItemModelManager itemModelManager; - private final ItemRenderer itemRenderer; - private final EntityRenderManager entityRenderDispatcher; - private final LoadedEntityModels layerRenderDispatcher; - private final TextRenderer textRenderer; - private final SpriteHolder spriteHolder; - - private final PlayerSkinCache playerSkinRenderCache; - - public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager renderManager, ItemModelManager itemModelManager, ItemRenderer itemRenderer, EntityRenderManager entityRenderDispatcher, LoadedEntityModels layerRenderDispatcher, TextRenderer textRenderer, SpriteHolder spriteHolder, PlayerSkinCache playerSkinRenderCache) { + private final BlockEntityRenderDispatcher renderDispatcher; + private final BlockModelResolver renderManager; + private final ItemModelResolver itemModelManager; + private final EntityRenderDispatcher entityRenderDispatcher; + private final EntityModelSet layerRenderDispatcher; + private final Font textRenderer; + private final SpriteGetter spriteHolder; + + private final PlayerSkinRenderCache playerSkinRenderCache; + + public Context(BlockEntityRenderDispatcher renderDispatcher, BlockModelResolver renderManager, ItemModelResolver itemModelManager, EntityRenderDispatcher entityRenderDispatcher, EntityModelSet layerRenderDispatcher, Font textRenderer, SpriteGetter spriteHolder, PlayerSkinRenderCache playerSkinRenderCache) { this.renderDispatcher = renderDispatcher; this.renderManager = renderManager; this.itemModelManager = itemModelManager; - this.itemRenderer = itemRenderer; this.entityRenderDispatcher = entityRenderDispatcher; this.layerRenderDispatcher = layerRenderDispatcher; this.textRenderer = textRenderer; @@ -172,90 +169,82 @@ public Context(BlockEntityRenderManager renderDispatcher, BlockRenderManager ren this.playerSkinRenderCache = playerSkinRenderCache; } - public BlockEntityRenderManager getRenderDispatcher() { + public BlockEntityRenderDispatcher getRenderDispatcher() { return this.renderDispatcher; } - public BlockRenderManager getRenderManager() { + public BlockModelResolver getRenderManager() { return this.renderManager; } - public EntityRenderManager getEntityRenderDispatcher() { + public EntityRenderDispatcher getEntityRenderDispatcher() { return this.entityRenderDispatcher; } - public ItemModelManager getItemModelManager() { + public ItemModelResolver getItemModelManager() { return itemModelManager; } - public ItemRenderer getItemRenderer() { - return this.itemRenderer; - } - - public LoadedEntityModels getLayerRenderDispatcher() { + public EntityModelSet getLayerRenderDispatcher() { return this.layerRenderDispatcher; } - public ModelPart getLayerModelPart(EntityModelLayer modelLayer) { - return this.layerRenderDispatcher.getModelPart(modelLayer); + public ModelPart getLayerModelPart(ModelLayerLocation modelLayer) { + return this.layerRenderDispatcher.bakeLayer(modelLayer); } - public TextRenderer getTextRenderer() { + public Font getTextRenderer() { return this.textRenderer; } - public SpriteHolder getSpriteHolder() { + public SpriteGetter getSpriteHolder() { return spriteHolder; } - public PlayerSkinCache getPlayerSkinRenderCache() { + public PlayerSkinRenderCache getPlayerSkinRenderCache() { return playerSkinRenderCache; } } } - public static void registerRenderTypeBlock(RenderLayer layer, Block block) { - BlockRenderLayer blockRenderLayer = null; - if (layer == RenderLayers.cutout()) { - blockRenderLayer = BlockRenderLayer.CUTOUT; - } else if (layer == RenderLayers.glintTranslucent()) { - blockRenderLayer = BlockRenderLayer.TRANSLUCENT; - } else if (layer == RenderLayers.solid()) { - blockRenderLayer = BlockRenderLayer.SOLID; - } else if (layer == RenderLayers.tripwire()) { - blockRenderLayer = BlockRenderLayer.TRIPWIRE; + public static void registerRenderTypeBlock(RenderType layer, Block block) { + ChunkSectionLayer blockRenderLayer = null; + if (layer == RenderTypes.cutoutMovingBlock()) { + blockRenderLayer = ChunkSectionLayer.CUTOUT; + } else if (layer == RenderTypes.glintTranslucent()) { + blockRenderLayer = ChunkSectionLayer.TRANSLUCENT; + } else if (layer == RenderTypes.solidMovingBlock()) { + blockRenderLayer = ChunkSectionLayer.SOLID; } if (blockRenderLayer == null) return; - RenderTypeRegistry.register(blockRenderLayer, block); +// ChunkSectionLayerMap.register(blockRenderLayer, block); } - public static void registerRenderTypeFluid(RenderLayer layer, Fluid fluid) { - BlockRenderLayer blockRenderLayer = null; - if (layer == RenderLayers.cutout()) { - blockRenderLayer = BlockRenderLayer.CUTOUT; - } else if (layer == RenderLayers.glintTranslucent()) { - blockRenderLayer = BlockRenderLayer.TRANSLUCENT; - } else if (layer == RenderLayers.solid()) { - blockRenderLayer = BlockRenderLayer.SOLID; - } else if (layer == RenderLayers.tripwire()) { - blockRenderLayer = BlockRenderLayer.TRIPWIRE; + public static void registerRenderTypeFluid(RenderType layer, Fluid fluid) { + ChunkSectionLayer blockRenderLayer = null; + if (layer == RenderTypes.cutoutMovingBlock()) { + blockRenderLayer = ChunkSectionLayer.CUTOUT; + } else if (layer == RenderTypes.glintTranslucent()) { + blockRenderLayer = ChunkSectionLayer.TRANSLUCENT; + } else if (layer == RenderTypes.solidMovingBlock()) { + blockRenderLayer = ChunkSectionLayer.SOLID; } if (blockRenderLayer == null) return; - RenderTypeRegistry.register(blockRenderLayer, fluid); +// ChunkSectionLayerMap.register(blockRenderLayer, fluid); } public static void registerCutoutBlock(Block block) { - registerRenderTypeBlock(RenderLayers.cutout(), block); + registerRenderTypeBlock(RenderTypes.cutoutMovingBlock(), block); } public static void registerCompatBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.renderDispatcher(), ctx.renderManager(), ctx.itemModelManager(), ctx.itemRenderer(), ctx.entityRenderDispatcher(), ctx.loadedEntityModels(), ctx.textRenderer(), ctx.spriteHolder(), ctx.playerSkinRenderCache() + ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache() ))); } @@ -267,15 +256,15 @@ public static void registerRenderTypeFluid(CompatRenderLayer layer, Fluid fluid) registerRenderTypeFluid(layer.layer, fluid); } - public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { + public static void registerColorProviderBlock(List provider, Block... blocks) { if (blocks == null || blocks.length == 0) { - ColorProviderRegistry.BLOCK.register(provider); + BlockColorRegistry.register(provider); } else { - ColorProviderRegistry.BLOCK.register(provider, blocks); + BlockColorRegistry.register(provider, blocks); } } public static void registerColorProviderBlock(CompatBlockColorProvider provider, Block... blocks) { - registerColorProviderBlock((BlockColorProvider) provider, blocks); + registerColorProviderBlock(provider.toTintSource(), blocks); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java index 1fd2330ef..7b43db57d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.client.registry; -import dev.architectury.registry.client.keymappings.KeyMappingRegistry; +import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper; import net.minecraft.client.KeyMapping; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; @@ -9,7 +9,7 @@ public class KeybindingRegistry { public static void register(KeyMapping keyBinding) { - KeyMappingRegistry.register(keyBinding); + KeyMappingHelper.registerKeyMapping(keyBinding); } public static void register(KeyMapping keyBinding, ClientTickEventRegistry.Client client) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java deleted file mode 100644 index 15de7ac95..000000000 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.registry.fabric; - -import dev.architectury.registry.client.gui.MenuScreenRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; -import net.minecraft.block.Block; -import net.minecraft.client.color.block.BlockColorProvider; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; - -public class CompatRegistryClientImpl { - public static > void registerScreen(String modId, ScreenHandlerType type, CompatRegistryClient.ScreenFactory factory) { - MenuScreenRegistry.registerScreenFactory(type, factory::create); - } - - public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { - if (blocks == null || blocks.length == 0) { - ColorProviderRegistry.BLOCK.register(provider); - } else { - ColorProviderRegistry.BLOCK.register(provider, blocks); - } - } -} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java index 1270512a2..8ebc49d3e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java @@ -1,23 +1,22 @@ package net.pitan76.mcpitanlib.api.client.render; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.screens.Screen; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; -import org.joml.Matrix3x2f; import org.joml.Matrix3x2fStack; public class DrawObjectDM { private PoseStack stack; private Matrix3x2fStack matrix3x2fStack; - private GuiGraphics context; + private GuiGraphicsExtractor context; private Screen screen = null; - public DrawObjectDM(GuiGraphics context) { + public DrawObjectDM(GuiGraphicsExtractor context) { this.context = context; this.matrix3x2fStack = context.pose(); } @@ -30,12 +29,12 @@ public DrawObjectDM(PoseStack stack) { this.stack = stack; } - public DrawObjectDM(GuiGraphics context, Screen screen) { + public DrawObjectDM(GuiGraphicsExtractor context, Screen screen) { this(context); this.screen = screen; } - public GuiGraphics getContext() { + public GuiGraphicsExtractor getContext() { return context; } @@ -47,7 +46,7 @@ public Screen getScreen() { return screen; } - public void setContext(GuiGraphics context) { + public void setContext(GuiGraphicsExtractor context) { this.context = context; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java index be2a43dfb..0d631b3d6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java @@ -4,8 +4,8 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; import net.minecraft.client.renderer.SubmitNodeCollector; -import net.minecraft.client.renderer.state.CameraRenderState; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.world.phys.Vec3; import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java index 3c1333054..150a61c0d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java @@ -1,19 +1,18 @@ package net.pitan76.mcpitanlib.api.client.render.block.entity.event; +import net.minecraft.client.renderer.item.ItemModelResolver; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.chunk.ChunkSectionLayer; import net.minecraft.client.renderer.rendertype.RenderType; import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; import net.minecraft.client.renderer.SubmitNodeCollector; -import net.minecraft.client.renderer.entity.ItemRenderer; -import net.minecraft.client.renderer.state.CameraRenderState; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.world.item.ItemStack; import net.minecraft.core.BlockPos; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; import net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer; @@ -123,7 +122,7 @@ public void scale(float x, float y, float z) { MatrixStackUtil.scale(matrices, x, y, z); } - public ItemRenderer getItemRenderer() { + public ItemModelResolver getItemRenderer() { return ClientUtil.getItemRenderer(); } @@ -163,7 +162,7 @@ public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { //---- @Deprecated - public CompatRegistryClient2.BlockEntityRendererFactory.Context ctx; + public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; public BlockEntityRenderEvent(CompatBlockEntityRenderer renderer, T blockEntity, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { this(blockEntity, tickDelta, matrices, vertexConsumers, light, overlay); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index 1502598fc..f8e46776b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.entity; -import dev.architectury.registry.menu.ExtendedMenuProvider; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.component.DataComponents; @@ -11,7 +11,6 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.ItemCooldowns; import net.minecraft.world.entity.player.Abilities; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.ItemStack; import net.minecraft.nbt.CompoundTag; @@ -24,10 +23,7 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.stats.Stat; import net.minecraft.stats.StatType; -import net.minecraft.world.level.storage.TagValueInput; -import net.minecraft.world.level.storage.TagValueOutput; import net.minecraft.network.chat.Component; -import net.minecraft.util.ProblemReporter; import net.minecraft.world.InteractionHand; import net.minecraft.resources.Identifier; import net.minecraft.core.NonNullList; @@ -239,11 +235,11 @@ public void writeCustomDataToNbt(CompoundTag nbt) { } public void sendMessage(Component text) { - getEntity().displayClientMessage(text, false); + getEntity().sendSystemMessage(text); } public void sendActionBar(Component text) { - getEntity().displayClientMessage(text, true); + getEntity().sendOverlayMessage(text); } public void equipStack(EquipmentSlot slot, ItemStack stack) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java index d1284ae1a..a495aef5b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java @@ -2,7 +2,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; @@ -18,7 +17,7 @@ public class BlockBreakEvent extends BaseEvent { public BlockState state; public Player player; - public BlockBreakEvent(Level world, BlockPos pos, BlockState state, Player player) { + public BlockBreakEvent(Level world, BlockPos pos, BlockState state, net.minecraft.world.entity.player.Player player) { this.world = world; this.pos = pos; this.state = state; @@ -37,7 +36,7 @@ public Player getPlayer() { return player; } - public Player getPlayerEntity() { + public net.minecraft.world.entity.player.Player getPlayerEntity() { return player.getPlayerEntity(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java index 7491b64dc..40e528a8b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java @@ -2,7 +2,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.InteractionHand; @@ -27,7 +26,7 @@ public class BlockUseEvent extends BaseEvent { public BlockHitResult hit; public ItemStack stack; - public BlockUseEvent(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public BlockUseEvent(BlockState state, Level world, BlockPos pos, net.minecraft.world.entity.player.Player player, InteractionHand hand, BlockHitResult hit) { this.state = state; this.world = world; this.pos = pos; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java index 80b40c4e2..6bf3f94fb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.event.block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Inventory; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; @@ -17,7 +16,7 @@ public class ScreenHandlerCreateEvent extends BaseEvent { public Inventory inventory; public Player player; - public ScreenHandlerCreateEvent(BlockState state, Level world, BlockPos pos, int syncId, Inventory inventory, Player player) { + public ScreenHandlerCreateEvent(BlockState state, Level world, BlockPos pos, int syncId, Inventory inventory, net.minecraft.world.entity.player.Player player) { this.state = state; this.world = world; this.pos = pos; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java index 58da500c0..b887d296f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java @@ -2,7 +2,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; @@ -22,7 +21,7 @@ public class CanMineArgs { public LivingEntity entity; - public CanMineArgs(BlockState state, Level world, BlockPos pos, Player miner) { + public CanMineArgs(BlockState state, Level world, BlockPos pos, net.minecraft.world.entity.player.Player miner) { this.state = state; this.world = world; this.pos = pos; @@ -37,8 +36,8 @@ public CanMineArgs(ItemStack stack, BlockState state, Level world, BlockPos pos, this.pos = pos; this.entity = entity; - if (entity instanceof Player) { - this.miner = new Player((Player) entity); + if (entity instanceof net.minecraft.world.entity.player.Player) { + this.miner = new Player((net.minecraft.world.entity.player.Player) entity); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java index 3218b724e..18a799d4a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; @@ -18,7 +17,7 @@ public CraftEvent(ItemStack stack, Level world, Player player) { this.player = player; } - public CraftEvent(ItemStack stack, Level world, Player player) { + public CraftEvent(ItemStack stack, Level world, net.minecraft.world.entity.player.Player player) { this.stack = stack; this.world = world; this.player = new Player(player); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java index 4d6bacdbd..9f367c4e5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.event.item; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.InteractionHand; @@ -9,8 +8,6 @@ import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; import net.pitan76.mcpitanlib.api.util.StackActionResult; -import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import net.pitan76.mcpitanlib.midohra.world.IWorldView; @@ -21,7 +18,7 @@ public class ItemUseEvent extends BaseEvent { public InteractionHand hand; public ItemStack stack; - public ItemUseEvent(Level world, Player user, InteractionHand hand) { + public ItemUseEvent(Level world, net.minecraft.world.entity.player.Player user, InteractionHand hand) { this.world = world; this.user = new Player(user); this.hand = hand; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java index 446b86f37..c2d383e20 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java @@ -2,7 +2,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; @@ -30,11 +29,11 @@ public class ItemUseOnBlockEvent extends BaseEvent { public Level world; public BlockPos blockPos; - public ItemUseOnBlockEvent(Player player, InteractionHand hand, BlockHitResult hit) { + public ItemUseOnBlockEvent(net.minecraft.world.entity.player.Player player, InteractionHand hand, BlockHitResult hit) { this(player.level(), player, hand, player.getItemInHand(hand), hit); } - public ItemUseOnBlockEvent(Level world, @Nullable Player player, InteractionHand hand, ItemStack stack, BlockHitResult hit) { + public ItemUseOnBlockEvent(Level world, @Nullable net.minecraft.world.entity.player.Player player, InteractionHand hand, ItemStack stack, BlockHitResult hit) { if (player != null) this.player = new Player(player); this.hand = hand; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java index 14ceea22b..78543e9e1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.event.item; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.InteractionHand; @@ -17,7 +16,7 @@ public class ItemUseOnEntityEvent extends BaseEvent { public LivingEntity entity; public InteractionHand hand; - public ItemUseOnEntityEvent(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { + public ItemUseOnEntityEvent(ItemStack stack, net.minecraft.world.entity.player.Player user, LivingEntity entity, InteractionHand hand) { this.stack = stack; this.user = new Player(user); this.hand = hand; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java index de8760f2c..684630f08 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java @@ -5,7 +5,6 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; @@ -94,12 +93,12 @@ public void damageStack(int amount) { } public boolean isPlayer() { - return miner instanceof Player; + return miner instanceof net.minecraft.world.entity.player.Player; } public Player getPlayer() { if (isPlayer()) - return new Player((Player) miner); + return new Player((net.minecraft.world.entity.player.Player) miner); return null; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java index b02290b0c..90fd66d05 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java @@ -4,17 +4,14 @@ import net.pitan76.mcpitanlib.api.util.CompatActionResult; public class EventResult { + private static final EventResult TRUE = new EventResult(); + private static final EventResult STOP = new EventResult(); + private static final EventResult PASS = new EventResult(); + private static final EventResult FALSE = new EventResult(); - protected final dev.architectury.event.EventResult result; - private static final EventResult TRUE = new EventResult(dev.architectury.event.EventResult.interruptTrue()); - private static final EventResult STOP = new EventResult(dev.architectury.event.EventResult.interruptDefault()); - private static final EventResult PASS = new EventResult(dev.architectury.event.EventResult.pass()); - private static final EventResult FALSE = new EventResult(dev.architectury.event.EventResult.interruptFalse()); + protected EventResult() { - - protected EventResult(dev.architectury.event.EventResult result) { - this.result = result; } public static EventResult success() { @@ -33,13 +30,12 @@ public static EventResult fail() { return FALSE; } - @Deprecated - public dev.architectury.event.EventResult getResult() { - return result; - } - public InteractionResult toActionResult() { - return result.asMinecraft(); + if (this == TRUE) return InteractionResult.SUCCESS; + if (this == STOP) return InteractionResult.FAIL; + if (this == PASS) return InteractionResult.PASS; + if (this == FALSE) return InteractionResult.FAIL; + throw new IllegalStateException("Unknown EventResult: " + this); } public CompatActionResult toCompatActionResult() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java index c2e73f69f..0db724876 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java @@ -1,26 +1,25 @@ package net.pitan76.mcpitanlib.api.event.v0; -import dev.architectury.event.events.client.ClientTickEvent; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; public class ClientTickEventRegistry { public static void registerPost(Client client) { - ClientTickEvent.CLIENT_POST.register(client::tick); + ClientTickEvents.END_CLIENT_TICK.register(client::tick); } public static void registerPre(Client client) { - ClientTickEvent.CLIENT_PRE.register(client::tick); + ClientTickEvents.START_CLIENT_TICK.register(client::tick); } public static void registerLevelPost(ClientLevel world) { - ClientTickEvent.CLIENT_LEVEL_POST.register(world::tick); + ClientTickEvents.END_LEVEL_TICK.register(world::tick); } public static void registerLevelPre(ClientLevel world) { - ClientTickEvent.CLIENT_LEVEL_PRE.register(world::tick); + ClientTickEvents.START_LEVEL_TICK.register(world::tick); } @Environment(EnvType.CLIENT) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java index c27b03570..40a2ba9dc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java @@ -1,16 +1,18 @@ package net.pitan76.mcpitanlib.api.gui; -import dev.architectury.registry.menu.ExtendedMenuProvider; +import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Inventory; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuConstructor; import net.minecraft.network.chat.Component; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; import org.jetbrains.annotations.Nullable; @Deprecated -public class ExtendedNamedScreenHandlerFactory implements ExtendedMenuProvider { +public class ExtendedNamedScreenHandlerFactory implements ExtendedMenuProvider { private final Component name; private final MenuConstructor baseFactory; @@ -22,11 +24,6 @@ public ExtendedNamedScreenHandlerFactory(Component name, MenuConstructor baseFac this.bufFactory = bufFactory; } - @Override - public void saveExtraData(FriendlyByteBuf buf) { - bufFactory.saveExtraData(buf); - } - @Override public Component getDisplayName() { return name; @@ -39,6 +36,13 @@ public AbstractContainerMenu createMenu(int syncId, Inventory inv, Player player } + @Override + public FriendlyByteBuf getScreenOpeningData(ServerPlayer player) { + FriendlyByteBuf buf = PacketByteUtil.create(); + bufFactory.saveExtraData(buf); + return buf; + } + @FunctionalInterface public interface PacketByteBufFactory { void saveExtraData(FriendlyByteBuf buf); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java index 33b0f8e29..0c07c0b38 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java @@ -1,6 +1,11 @@ package net.pitan76.mcpitanlib.api.gui; -import dev.architectury.registry.menu.MenuRegistry; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; +import net.fabricmc.fabric.api.menu.v1.ExtendedMenuType; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.entity.player.Inventory; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -19,8 +24,13 @@ public ExtendedScreenHandlerTypeBuilder(Factory2 factory) { this.factory = factory; } + public static StreamCodec CODEC = ByteBufCodecs.BYTE_ARRAY.map( + (data) -> new FriendlyByteBuf(Unpooled.wrappedBuffer(data)) + , (buf) -> ByteBufUtil.getBytes(buf.unwrap())); + public MenuType build() { - return MenuRegistry.ofExtended(factory::create); +// return MenuRegistry.ofExtended(factory::create); + return new ExtendedMenuType<>(factory::create, CODEC); } @FunctionalInterface diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java index bedcff8b7..5ca6bf658 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.gui.args; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; @@ -8,9 +7,9 @@ public class CreateMenuEvent { public int syncId; public Inventory playerInventory; - public Player player; + public net.minecraft.world.entity.player.Player player; - public CreateMenuEvent(int syncId, Inventory playerInventory, Player player) { + public CreateMenuEvent(int syncId, Inventory playerInventory, net.minecraft.world.entity.player.Player player) { this.syncId = syncId; this.playerInventory = playerInventory; this.player = player; @@ -36,7 +35,7 @@ public Inventory getPlayerInventory() { return playerInventory; } - public Player getPlayerEntity() { + public net.minecraft.world.entity.player.Player getPlayerEntity() { return player; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java index 74978a660..bd3cafb34 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java @@ -1,13 +1,15 @@ package net.pitan76.mcpitanlib.api.item; -import dev.architectury.registry.registries.RegistrySupplier; +import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.Item; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.resources.ResourceKey; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; @@ -85,9 +87,15 @@ public CompatibleItemSettings recipeRemainder(Item recipeRemainder) { } public ExtendSettings build() { - if (itemGroupId != null) { - RegistrySupplier itemGroup = MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(itemGroupId); - settings.arch$tab(itemGroup); + if (itemGroupId != null && _itemId != null) { + ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, itemGroupId); +// RegistrySupplier itemGroup = MCPLRegistry1_20.REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.get(key); +// CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { +// entries.accept(new ItemStack()); +// }); +// if (output instanceof Item.Settings settings) +// settings.arch$tab(itemGroup); + MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.put(key, _itemId); } if (_itemId != null && !(this instanceof net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings)) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java index 812b47ebd..505973982 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item; -import dev.architectury.registry.CreativeTabRegistry; +import net.fabricmc.fabric.api.creativetab.v1.FabricCreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; @@ -82,16 +82,18 @@ public void setTexture(String texture) { * @return ItemGroup */ public CreativeModeTab build() { - return CreativeTabRegistry.create((builder -> { - if (displayName != null) builder.title(displayName); - else builder.title(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); - - if (iconSupplier != null) builder.icon(iconSupplier); - if (noRenderedName) builder.hideTitle(); - if (noScrollbar) builder.noScrollBar(); - if (special) builder.alignedRight(); - if (texture != null) builder.backgroundTexture(IdentifierUtil.id(texture)); - })); + CreativeModeTab.Builder builder = FabricCreativeModeTab.builder(); + + if (displayName != null) builder.title(displayName); + else builder.title(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); + + if (iconSupplier != null) builder.icon(iconSupplier); + if (noRenderedName) builder.hideTitle(); + if (noScrollbar) builder.noScrollBar(); + if (special) builder.alignedRight(); + if (texture != null) builder.backgroundTexture(IdentifierUtil.id(texture)); + + return builder.build(); } @SuppressWarnings("deprecation") diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java index c3b25afb6..4dd6b7e69 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java @@ -1,13 +1,18 @@ package net.pitan76.mcpitanlib.api.item; -import dev.architectury.registry.CreativeTabRegistry; +import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.util.ItemUtil; +import net.pitan76.mcpitanlib.api.util.item.ItemGroupUtil; +import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.function.Supplier; public class CreativeTabManager { @@ -67,16 +72,32 @@ public CreativeModeTab getItemGroup() { } public static void allRegister() { + if (!MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.isEmpty()) { + for (Map.Entry, Identifier> entry : MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.entrySet()) { + CreativeModeTabEvents.modifyOutputEvent(entry.getKey()).register(entries -> { + entries.accept(new ItemStack(ItemUtil.fromId(entry.getValue()))); + }); + } + } + if (!bookingItems.isEmpty()) { for (BookingItem bookingItem : bookingItems) { - CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); +// CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); + ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, ItemGroupUtil.toID(bookingItem.getItemGroup())); + CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { + entries.accept(new ItemStack(ItemUtil.fromId(bookingItem.identifier))); + }); } bookingItems = new ArrayList<>(); } if (!bookingStacks.isEmpty()) { for (BookingStack bookingStack : bookingStacks) { - CreativeTabRegistry.appendBuiltinStack(bookingStack.getItemGroup(), bookingStack.stack); +// CreativeTabRegistry.appendBuiltinStack(bookingStack.getItemGroup(), bookingStack.stack); + ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, ItemGroupUtil.toID(bookingStack.getItemGroup())); + CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { + entries.accept(bookingStack.stack); + }); } bookingStacks = new ArrayList<>(); } @@ -86,7 +107,11 @@ public static void register(Identifier identifier) { if (bookingItems.isEmpty()) return; for (BookingItem bookingItem : bookingItems) { if (!bookingItem.identifier.toString().equals(identifier.toString())) continue; - CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); +// CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); + ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, ItemGroupUtil.toID(bookingItem.getItemGroup())); + CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { + entries.accept(new ItemStack(ItemUtil.fromId(bookingItem.identifier))); + }); bookingItems.remove(bookingItem); break; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java b/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java index 2ff8c846f..0dcd6c387 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.item.args; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; @@ -71,10 +70,10 @@ public boolean isServer() { } public boolean isPlayer() { - return user instanceof Player; + return user instanceof net.minecraft.world.entity.player.Player; } public Optional getPlayer() { - return isPlayer() ? Optional.of(new Player((Player) user)) : Optional.empty(); + return isPlayer() ? Optional.of(new Player((net.minecraft.world.entity.player.Player) user)) : Optional.empty(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java index 59775f5a2..8e356bb06 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.recipe; -import net.minecraft.recipe.*; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.Identifier; import net.minecraft.world.item.crafting.BlastingRecipe; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java index d4f362208..441436cdc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.recipe.v2; -import net.minecraft.recipe.*; import net.minecraft.resources.ResourceKey; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java index a4dd26270..c57720e2b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.registry; -import dev.architectury.registry.registries.RegistrySupplier; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.core.component.DataComponentType; @@ -23,6 +22,7 @@ import net.pitan76.mcpitanlib.api.item.CreativeTabManager; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.block.BlockUtil; import net.pitan76.mcpitanlib.api.util.item.ItemUtil; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java index 077fc77bc..e0f9fafd8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java @@ -1,29 +1,27 @@ package net.pitan76.mcpitanlib.api.registry; -import dev.architectury.registry.level.biome.BiomeModifications; -import dev.architectury.registry.registries.DeferredRegister; -import dev.architectury.registry.registries.RegistrySupplier; +import net.fabricmc.fabric.api.biome.v1.BiomeModifications; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.core.Holder; import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import java.util.function.Supplier; +// TODO: Add support for biome modifiers and other world gen related things public class WorldGenRegistry { protected String MOD_ID; - protected DeferredRegister> CONFIGURED_FEATURE; - protected DeferredRegister PLACED_FEATURE; - @Deprecated public WorldGenRegistry(String MOD_ID) { this.MOD_ID = MOD_ID; - CONFIGURED_FEATURE = DeferredRegister.create(MOD_ID, Registries.CONFIGURED_FEATURE); - PLACED_FEATURE = DeferredRegister.create(MOD_ID, Registries.PLACED_FEATURE); } /** @@ -46,8 +44,10 @@ public static WorldGenRegistry createRegistry(CompatRegistry registry) { * @return The result of the registration */ public RegistryResult> registerFeature(Identifier id, Supplier> supplier) { - RegistrySupplier> feature = CONFIGURED_FEATURE.register(id, supplier); - return new RegistryResult<>(feature); +// RegistrySupplier> feature = CONFIGURED_FEATURE.register(id, supplier); +// ResourceKey> key = ResourceKey.create(Registries.CONFIGURED_FEATURE, id); +// return new RegistryResult<>(Registry.register(BuiltInRegistries.FEATURE, key, supplier.get())); + return null; } /** @@ -57,8 +57,11 @@ public static WorldGenRegistry createRegistry(CompatRegistry registry) { * @return The result of the registration */ public RegistryResult registerPlacedFeature(Identifier id, Supplier supplier) { - RegistrySupplier feature = PLACED_FEATURE.register(id, supplier); - return new RegistryResult<>(feature); +// RegistrySupplier feature = PLACED_FEATURE.register(id, supplier); +// return new RegistryResult<>(feature); +// ResourceKey PlacedFeatureKey = ResourceKey.create(Registries.PLACED_FEATURE, id); +// return new RegistryResult<>(Registry.register(BuiltInRegistries.FEATURE, PlacedFeatureKey, supplier.get())); + return null; } /** @@ -67,7 +70,7 @@ public RegistryResult registerPlacedFeature(Identifier id, Suppli * @param feature The feature to replace */ public static void replaceProperties(GenerationStep.Decoration decoration, RegistrySupplier feature) { - BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); +// BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); } public static void replaceProperties(GenerationStep.Decoration decoration, RegistryResult feature) { @@ -80,7 +83,7 @@ public static void replaceProperties(GenerationStep.Decoration decoration, Regis * @param feature The feature to replace */ public static void replaceProperties(GenerationStep.Decoration decoration, PlacedFeature feature) { - BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, Holder.direct(feature))); +// BiomeModifications.replaceProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, Holder.direct(feature))); } /** @@ -89,7 +92,7 @@ public static void replaceProperties(GenerationStep.Decoration decoration, Place * @param feature The feature to add */ public static void addProperties(GenerationStep.Decoration decoration, RegistrySupplier feature) { - BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); +// BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, feature)); } public static void addProperties(GenerationStep.Decoration decoration, RegistryResult feature) { @@ -102,6 +105,6 @@ public static void addProperties(GenerationStep.Decoration decoration, RegistryR * @param feature The feature to add */ public static void addProperties(GenerationStep.Decoration decoration, PlacedFeature feature) { - BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, Holder.direct(feature))); +// BiomeModifications.addProperties((ctx, mutable) -> mutable.getGenerationProperties().addFeature(decoration, Holder.direct(feature))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java index 3bcf95488..ed04a4f24 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.registry.result; -import dev.architectury.registry.registries.RegistrySupplier; import org.jetbrains.annotations.Nullable; /** diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java new file mode 100644 index 000000000..a427d1326 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.api.registry.result; + +public class RegistrySupplier { + public T value; + public boolean isRegistered; + + public RegistrySupplier() { + this.value = null; + this.isRegistered = false; + } + + public RegistrySupplier(T value) { + this.value = value; + this.isRegistered = true; + } + + public void set(T value) { + this.value = value; + this.isRegistered = true; + } + + public T get() { + if (!isRegistered) throw new IllegalStateException("The registry is not registered yet"); + return value; + } + + public T getOrNull() { + return isRegistered ? value : null; + } +} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java index 4e2a538c2..c9ac80cb7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.registry.result; -import dev.architectury.registry.registries.RegistrySupplier; import org.jetbrains.annotations.Nullable; import java.util.Optional; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java index d1b4b982f..7b895bf8a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.tile; import com.mojang.datafixers.types.Type; -import dev.architectury.injectables.annotations.ExpectPlatform; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; import java.util.ArrayList; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java index 8bff34563..344f8e136 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java @@ -1,17 +1,15 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.*; -import net.minecraft.recipe.book.CraftingRecipeCategory; -import net.minecraft.recipe.input.CraftingRecipeInput; -import net.minecraft.recipe.input.RecipeInput; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.world.World; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.Container; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemStackTemplate; +import net.minecraft.world.item.crafting.*; +import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.recipe.CompatRecipeType; import net.pitan76.mcpitanlib.api.recipe.MatchGetter; import net.pitan76.mcpitanlib.api.recipe.input.CompatRecipeInput; @@ -26,48 +24,51 @@ import java.util.Optional; public class RecipeUtil { - public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, CompatibilityCraftingRecipeCategory category, ItemStack output, DefaultedList input) { - return new ShapelessRecipe(group, CraftingRecipeCategory.valueOf(category.name()), output, input); + public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, CompatibilityCraftingRecipeCategory category, ItemStack output, NonNullList input) { + CraftingRecipe.CraftingBookInfo craftingBookInfo = new CraftingRecipe.CraftingBookInfo(CraftingBookCategory.valueOf(category.name()), group); + Recipe.CommonInfo commonInfo = new Recipe.CommonInfo(false); + ItemStackTemplate outputTemplate = ItemStackTemplate.fromNonEmptyStack(output); + return new ShapelessRecipe(commonInfo, craftingBookInfo, outputTemplate, input); } - public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, ItemStack output, DefaultedList input) { + public static ShapelessRecipe createShapelessRecipe(Identifier id, String group, ItemStack output, NonNullList input) { return createShapelessRecipe(id, group, CompatibilityCraftingRecipeCategory.MISC, output, input); } @Deprecated - public static ItemStack craft_2(Recipe recipe, C inventory, World world) { - return recipe.craft(inventory, world.getRegistryManager()); + public static ItemStack craft_2(Recipe recipe, C inventory, Level world) { + return recipe.assemble(inventory); } @Deprecated - public static ItemStack getOutput_2(Recipe recipe, World world) { - return craft_2(recipe, (C) CraftingRecipeInput.EMPTY, world); + public static ItemStack getOutput_2(Recipe recipe, Level world) { + return craft_2(recipe, (C) CraftingInput.EMPTY, world); } - public static ItemStack craft(Recipe recipe, Inventory inventory, World world) { + public static ItemStack craft(Recipe recipe, Container inventory, Level world) { if (inventory instanceof RecipeInput) { Recipe inputRecipe = (Recipe) recipe; - return inputRecipe.craft((RecipeInput) inventory, world.getRegistryManager()); + return inputRecipe.assemble((RecipeInput) inventory); } return ItemStack.EMPTY; } - public static ItemStack getOutput(Recipe recipe, World world) { + public static ItemStack getOutput(Recipe recipe, Level world) { return getOutput(recipe, RegistryLookupUtil.getRegistryLookup(world)); } - public static List> getAllRecipes(World world) { - RecipeManager iRecipeManager = getRecipeManager(world); - if (!(iRecipeManager instanceof ServerRecipeManager)) + public static List> getAllRecipes(Level world) { + RecipeAccess iRecipeManager = getRecipeManager(world); + if (!(iRecipeManager instanceof RecipeManager)) return new ArrayList<>(); - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + RecipeManager recipeManager = (RecipeManager) iRecipeManager; - Collection> recipes = recipeManager.values(); + Collection> recipes = recipeManager.getRecipes(); List> outRecipes = new ArrayList<>(); for (Object recipeEntryObj : recipes) { - if (recipeEntryObj instanceof RecipeEntry) { - RecipeEntry recipeEntry = (RecipeEntry) recipeEntryObj; + if (recipeEntryObj instanceof RecipeHolder) { + RecipeHolder recipeEntry = (RecipeHolder) recipeEntryObj; if (recipeEntry.value() instanceof Recipe) { outRecipes.add(recipeEntry.value()); } @@ -76,7 +77,7 @@ public static List> getAllRecipes(World world) { return outRecipes; } - public static List> getAllCompatRecipeEntry(World world) { + public static List> getAllCompatRecipeEntry(Level world) { List> recipes = getAllRecipes(world); List> outRecipes = new ArrayList<>(); for (Recipe recipe : recipes) { @@ -93,53 +94,53 @@ public static Identifier getId(Recipe recipe) { return IdentifierUtil.id(recipe.getClass().hashCode() + ""); } - public static > CompatRecipeEntry getFirstMatch(RecipeManager iRecipeManager, CompatRecipeType type, CompatRecipeInput input, World world) { - if (!(iRecipeManager instanceof ServerRecipeManager)) + public static > CompatRecipeEntry getFirstMatch(RecipeAccess iRecipeManager, CompatRecipeType type, CompatRecipeInput input, Level world) { + if (!(iRecipeManager instanceof RecipeManager)) return new CompatRecipeEntry<>(null); - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + RecipeManager recipeManager = (RecipeManager) iRecipeManager; - Optional> recipe = recipeManager.getFirstMatch(type.getType(), input.getInput(), world); + Optional> recipe = recipeManager.getRecipeFor(type.getType(), input.getInput(), world); return recipe.map(CompatRecipeEntry::new).orElseGet(() -> new CompatRecipeEntry<>(null)); } - public static > CompatRecipeEntry getFirstMatch(RecipeManager iRecipeManager, CompatRecipeType type, CompatRecipeInput input, World world, CompatIdentifier identifier) { - if (!(iRecipeManager instanceof ServerRecipeManager)) + public static > CompatRecipeEntry getFirstMatch(RecipeAccess iRecipeManager, CompatRecipeType type, CompatRecipeInput input, Level world, CompatIdentifier identifier) { + if (!(iRecipeManager instanceof RecipeManager)) return new CompatRecipeEntry<>(null); - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + RecipeManager recipeManager = (RecipeManager) iRecipeManager; - Optional> recipe = recipeManager.getFirstMatch(type.getType(), input.getInput(), world, RegistryKey.of(RegistryKeys.RECIPE, identifier.toMinecraft())); + Optional> recipe = recipeManager.getRecipeFor(type.getType(), input.getInput(), world, ResourceKey.create(Registries.RECIPE, identifier.toMinecraft())); return recipe.map(CompatRecipeEntry::new).orElseGet(() -> new CompatRecipeEntry<>(null)); } - public static > CompatRecipeEntry getFirstMatch(World world, CompatRecipeType type, CompatRecipeInput input) { + public static > CompatRecipeEntry getFirstMatch(Level world, CompatRecipeType type, CompatRecipeInput input) { return getFirstMatch(getRecipeManager(world), type, input, world); } - public static > CompatRecipeEntry getFirstMatch(World world, CompatRecipeType type, CompatRecipeInput input, CompatIdentifier identifier) { + public static > CompatRecipeEntry getFirstMatch(Level world, CompatRecipeType type, CompatRecipeInput input, CompatIdentifier identifier) { return getFirstMatch(getRecipeManager(world), type, input, world, identifier); } - public static RecipeManager getRecipeManager(World world) { - return world.getRecipeManager(); + public static RecipeAccess getRecipeManager(Level world) { + return world.recipeAccess(); } - public Optional> get(World world, CompatIdentifier id) { + public Optional> get(Level world, CompatIdentifier id) { return get(getRecipeManager(world), id); } - public Optional> get(RecipeManager iRecipeManager, CompatIdentifier id) { - if (!(iRecipeManager instanceof ServerRecipeManager)) + public Optional> get(RecipeAccess iRecipeManager, CompatIdentifier id) { + if (!(iRecipeManager instanceof RecipeManager)) return Optional.empty(); - ServerRecipeManager recipeManager = (ServerRecipeManager) iRecipeManager; + RecipeManager recipeManager = (RecipeManager) iRecipeManager; - return recipeManager.get(RegistryKey.of(RegistryKeys.RECIPE, id.toMinecraft())); + return recipeManager.byKey(ResourceKey.create(Registries.RECIPE, id.toMinecraft())); } public static > MatchGetter createCachedMatchGetter(RecipeType type) { return (input, world) -> { - Optional> optional = ServerRecipeManager.createCachedMatchGetter(type).getFirstMatch(input.getInput(), (ServerWorld) world); + Optional> optional = RecipeManager.createCheck(type).getRecipeFor(input.getInput(), (ServerLevel) world); return optional.map(CompatRecipeEntry::new); }; } @@ -148,10 +149,10 @@ public static > MatchGetter cre return createCachedMatchGetter(type.getType()); } - public static DefaultedList getInputs(Recipe recipe) { - List ingredients = recipe.getIngredientPlacement().getIngredients(); + public static NonNullList getInputs(Recipe recipe) { + List ingredients = recipe.placementInfo().ingredients(); - DefaultedList outIngredients = DefaultedList.ofSize(ingredients.size()); + NonNullList outIngredients = NonNullList.createWithCapacity(ingredients.size()); for (int i = 0; i < ingredients.size(); i++) { outIngredients.set(i, ingredients.get(i)); @@ -160,12 +161,12 @@ public static DefaultedList getInputs(Recipe recipe) { return outIngredients; } - public static DefaultedList getInputs(CompatRecipeEntry recipeEntry) { + public static NonNullList getInputs(CompatRecipeEntry recipeEntry) { return getInputs(recipeEntry.getRecipe()); } public static ItemStackList getInputsAsStack(Recipe recipe) { - DefaultedList ingredients = getInputs(recipe); + NonNullList ingredients = getInputs(recipe); ItemStackList stacks = ItemStackList.ofSize(ingredients.size(), ItemStackUtil.empty()); for (Ingredient ingredient : ingredients) { stacks.addAll(IngredientUtil.getMatchingStacksAsList(ingredient)); @@ -180,25 +181,25 @@ public static ItemStackList getInputsAsStack(CompatRecipeEntry recipeEntry) { public static ItemStack getOutput(Recipe recipe, CompatRegistryLookup registryLookup) { if (recipe instanceof ShapelessRecipe) { ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe; - return shapelessRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + return shapelessRecipe.assemble(CraftingInput.EMPTY); } if (recipe instanceof ShapedRecipe) { ShapedRecipe shapedRecipe = (ShapedRecipe) recipe; - return shapedRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + return shapedRecipe.assemble(CraftingInput.EMPTY); } if (recipe instanceof CraftingRecipe) { CraftingRecipe craftingRecipe = (CraftingRecipe) recipe; - return craftingRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + return craftingRecipe.assemble(CraftingInput.EMPTY); } - if (recipe instanceof SpecialCraftingRecipe) { - SpecialCraftingRecipe specialCraftingRecipe = (SpecialCraftingRecipe) recipe; - return specialCraftingRecipe.craft(CraftingRecipeInput.EMPTY, registryLookup.getRegistryLookup()); + if (recipe instanceof CustomRecipe) { + CustomRecipe specialCraftingRecipe = (CustomRecipe) recipe; + return specialCraftingRecipe.assemble(CraftingInput.EMPTY); } - return recipe.craft(null, registryLookup.getRegistryLookup()); + return recipe.assemble(null); } public static ItemStack getOutput(CompatRecipeEntry recipeEntry, CompatRegistryLookup registryLookup) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java index efad49f24..373c92cc3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.util; -import dev.architectury.registry.menu.ExtendedMenuProvider; -import dev.architectury.registry.menu.MenuRegistry; +import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.MenuProvider; @@ -33,15 +32,16 @@ public static List> getAllScreenHandlerTypes() { } public static void openExtendedMenu(ServerPlayer player, MenuProvider provider, Consumer bufWriter) { - MenuRegistry.openExtendedMenu(player, provider, bufWriter); + // TODO: Fabric API does not support opening a menu with a bufWriter, so we need to find a way to do this. +// player.openMenu(player, provider, bufWriter); } public static void openExtendedMenu(ServerPlayer player, ExtendedMenuProvider provider) { - MenuRegistry.openExtendedMenu(player, provider); + player.openMenu(provider); } public static void openMenu(ServerPlayer player, MenuProvider provider) { - MenuRegistry.openMenu(player, provider); + player.openMenu(provider); } public static int getRawId(MenuType type) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java index cfef68661..0b0062a28 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java @@ -10,9 +10,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.entity.*; import net.minecraft.world.entity.monster.Enemy; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.item.ItemStack; @@ -104,7 +102,7 @@ public static void spawnEntity(Level world, Entity entity) { } public static void playSound(Level world, @Nullable Player player, BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { - Player entity = player == null ? null : player.getEntity(); + net.minecraft.world.entity.player.Player entity = player == null ? null : player.getEntity(); world.playSound(entity, pos, sound, category, volume, pitch); } @@ -298,7 +296,7 @@ public static void updateComparators(Level world, BlockPos pos, Block block) { public static List getPlayers(Level world) { List players = new ArrayList<>(); - for (Player player : world.players()) { + for (net.minecraft.world.entity.player.Player player : world.players()) { players.add(new Player(player)); } @@ -388,7 +386,7 @@ public static void dropStackOnBlock(Level world, BlockPos pos, ItemStack stack) } public static float getSkyAngle(Level world, float tickDelta) { - long timeOfDay = world.getDayTime(); + long timeOfDay = world.getDefaultClockTime(); float f = ((float)(timeOfDay % 24000L) + tickDelta) / 24000.0F - 0.25F; if (f < 0.0F) { f += 1.0F; @@ -432,7 +430,7 @@ public static CompatIdentifier getEndId() { } public static long getTimeOfDay(Level world) { - return world.getDayTime(); + return world.getDefaultClockTime(); } public static List getEntitiesByClass(Level world, Class entityClass, net.pitan76.mcpitanlib.midohra.util.math.Box box) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java index 0fdec8579..0e082de2f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java @@ -8,7 +8,7 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.item.ItemModelResolver; import net.minecraft.client.renderer.texture.TextureManager; import com.mojang.blaze3d.platform.Window; import net.minecraft.client.multiplayer.ClientLevel; @@ -46,8 +46,8 @@ public static Font getTextRenderer() { return getClient().font; } - public static ItemRenderer getItemRenderer() { - return getClient().getItemRenderer(); + public static ItemModelResolver getItemRenderer() { + return getClient().getItemModelResolver(); } public static ResourceManager getResourceManager() { diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java index 74020ede8..5b0098811 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java @@ -1,9 +1,8 @@ package net.pitan76.mcpitanlib.core.registry; -import com.google.common.base.Suppliers; -import dev.architectury.registry.registries.Registrar; -import dev.architectury.registry.registries.RegistrarManager; -import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.item.enchantment.Enchantment; @@ -16,68 +15,46 @@ import net.minecraft.world.inventory.MenuType; import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import java.util.function.Supplier; @Deprecated public class MCPLRegistry { - - public Supplier REGISTRIES; - - public Registrar ITEMS; - public Registrar BLOCKS; - public Registrar> SCREEN_HANDLER_TYPE; - public Registrar> BLOCK_ENTITY_TYPE; - public Registrar> ENTITY_TYPE; - public Registrar SOUND_EVENT; - public Registrar FLUID; - public Registrar> PARTICLE_TYPE; - public Registrar STATUS_EFFECT; - public MCPLRegistry(String MOD_ID) { - REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(MOD_ID)); - - ITEMS = REGISTRIES.get().get(Registries.ITEM); - BLOCKS = REGISTRIES.get().get(Registries.BLOCK); - SCREEN_HANDLER_TYPE = REGISTRIES.get().get(Registries.MENU); - BLOCK_ENTITY_TYPE = REGISTRIES.get().get(Registries.BLOCK_ENTITY_TYPE); - ENTITY_TYPE = REGISTRIES.get().get(Registries.ENTITY_TYPE); - SOUND_EVENT = REGISTRIES.get().get(Registries.SOUND_EVENT); - FLUID = REGISTRIES.get().get(Registries.FLUID); - PARTICLE_TYPE = REGISTRIES.get().get(Registries.PARTICLE_TYPE); - STATUS_EFFECT = REGISTRIES.get().get(Registries.MOB_EFFECT); + } public RegistrySupplier registryItem(Identifier id, Supplier supplier) { - return ITEMS.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.ITEM, ResourceKey.create(Registries.ITEM, id), supplier.get())); } public RegistrySupplier registryBlock(Identifier id, Supplier supplier) { - return BLOCKS.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.BLOCK, ResourceKey.create(Registries.BLOCK, id), supplier.get())); } public RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { - return SCREEN_HANDLER_TYPE.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.MENU, ResourceKey.create(Registries.MENU, id), supplier.get())); } public RegistrySupplier> registryBlockEntityType(Identifier id, Supplier> supplier) { - return BLOCK_ENTITY_TYPE.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, ResourceKey.create(Registries.BLOCK_ENTITY_TYPE, id), supplier.get())); } public RegistrySupplier> registryEntityType(Identifier id, Supplier> supplier) { - return ENTITY_TYPE.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.ENTITY_TYPE, ResourceKey.create(Registries.ENTITY_TYPE, id), supplier.get())); } public RegistrySupplier registrySoundEvent(Identifier id, Supplier supplier) { - return SOUND_EVENT.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.SOUND_EVENT, ResourceKey.create(Registries.SOUND_EVENT, id), supplier.get())); } public RegistrySupplier registryFluid(Identifier id, Supplier supplier) { - return FLUID.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.FLUID, ResourceKey.create(Registries.FLUID, id), supplier.get())); } public RegistrySupplier> registryParticleType(Identifier id, Supplier> supplier) { - return PARTICLE_TYPE.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.PARTICLE_TYPE, ResourceKey.create(Registries.PARTICLE_TYPE, id), supplier.get())); } public RegistrySupplier registryEnchantment(Identifier id, Supplier supplier) { @@ -86,7 +63,7 @@ public RegistrySupplier registryEnchantment(Identifier id, Supplier } public RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { - return STATUS_EFFECT.register(id, supplier); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.MOB_EFFECT, ResourceKey.create(Registries.MOB_EFFECT, id), supplier.get())); } public void allRegister1_16() { diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java index 6b851be33..616c8fa24 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java @@ -1,11 +1,13 @@ package net.pitan76.mcpitanlib.core.registry; -import dev.architectury.registry.registries.DeferredRegister; -import dev.architectury.registry.registries.RegistrySupplier; -import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import java.util.HashMap; import java.util.Map; @@ -14,30 +16,34 @@ @Deprecated public class MCPLRegistry1_20 { @Deprecated - public static final Map> REGISTRY_SUPPLIER_ITEM_GROUP_CACHE = new HashMap<>(); + public static final Map, RegistrySupplier> REGISTRY_SUPPLIER_ITEM_GROUP_CACHE = new HashMap<>(); - private final MCPLRegistry mcplr; + @Deprecated + public static final Map, Identifier> ITEM_GROUP_ITEM_ID_CACHE = new HashMap<>(); - protected DeferredRegister ITEM_GROUP; + private final MCPLRegistry mcplr; public MCPLRegistry1_20(MCPLRegistry mcplr, String MOD_ID) { this.mcplr = mcplr; - ITEM_GROUP = DeferredRegister.create(MOD_ID, Registries.CREATIVE_MODE_TAB); } public void register() { - ITEM_GROUP.register(); + } public RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { - RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); - REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); + ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, id); + RegistrySupplier itemGroup = new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, supplier.get())); +// RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); + REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(key, itemGroup); return itemGroup; } public RegistrySupplier registryItemGroup(Identifier id, CreativeTabBuilder builder) { - RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); - REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(id, itemGroup); + ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, id); + RegistrySupplier itemGroup = new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, builder.build())); +// RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); + REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(key, itemGroup); return itemGroup; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java index e9a3dcd79..4ee19dabc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java @@ -1,10 +1,13 @@ package net.pitan76.mcpitanlib.core.registry; -import dev.architectury.registry.registries.DeferredRegister; -import dev.architectury.registry.registries.RegistrySupplier; +import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.TicketType; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; import java.util.function.Supplier; @@ -12,28 +15,24 @@ @Deprecated public class MCPLRegistry1_21 { - public final DeferredRegister> DATA_COMPONENT_TYPE; - public final DeferredRegister TICKET_TYPE; private final MCPLRegistry mcplr; public MCPLRegistry1_21(MCPLRegistry mcplr, String MOD_ID) { this.mcplr = mcplr; - DATA_COMPONENT_TYPE = DeferredRegister.create(MOD_ID, Registries.DATA_COMPONENT_TYPE); - TICKET_TYPE = DeferredRegister.create(MOD_ID, Registries.TICKET_TYPE); } public void register() { - DATA_COMPONENT_TYPE.register(); - TICKET_TYPE.register(); + } public RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { - return DATA_COMPONENT_TYPE.register(id, supplier); + ResourceKey> key = ResourceKey.create(Registries.DATA_COMPONENT_TYPE, id); + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, key, supplier.get())); } public Supplier> registryChunkTicketType(Identifier id, Supplier> supplier) { - RegistrySupplier ticketType = TICKET_TYPE.register(id, () -> supplier.get().getRaw()); - return () -> ChunkTicketType.of(ticketType.get()); + ResourceKey key = ResourceKey.create(Registries.TICKET_TYPE, id); + return () -> ChunkTicketType.of(Registry.register(BuiltInRegistries.TICKET_TYPE, key, supplier.get().getRaw())); } } diff --git a/src/main/java/net/pitan76/fabric/ExtendModInitializer.java b/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java similarity index 100% rename from src/main/java/net/pitan76/fabric/ExtendModInitializer.java rename to src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java diff --git a/src/main/java/net/pitan76/fabric/MCPitanLibFabric.java b/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java similarity index 91% rename from src/main/java/net/pitan76/fabric/MCPitanLibFabric.java rename to src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java index e491a3dbc..939cd37a0 100644 --- a/src/main/java/net/pitan76/fabric/MCPitanLibFabric.java +++ b/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java @@ -1,4 +1,4 @@ -package net.pitan76.mcpitanlib; +package net.pitan76.mcpitanlib.fabric; import net.fabricmc.api.ModInitializer; import net.pitan76.mcpitanlib.MCPitanLib; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java index 8a4331e0b..2a48fb11a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.midohra.server; -import net.minecraft.world.entity.player.Player; import net.minecraft.server.players.IpBanList; import net.minecraft.server.players.UserBanList; import net.minecraft.server.MinecraftServer; @@ -88,7 +87,7 @@ public List getPlayersByIP(String ip) { public List getPlayers() { List players = new ArrayList<>(); - for (Player p : getRaw().getPlayers()) { + for (net.minecraft.world.entity.player.Player p : getRaw().getPlayers()) { players.add(new Player(p)); } return players; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java index 12ec92a10..1740c0d07 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java @@ -3,7 +3,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.material.FluidState; import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundEvent; @@ -116,13 +115,13 @@ public RecipeManager getRecipeManager() { @Deprecated @Override - public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category) { + public void playSound(net.minecraft.world.entity.player.Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category) { getRaw().playSound(playerEntity, pos, sound, category); } @Deprecated @Override - public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { + public void playSound(net.minecraft.world.entity.player.Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java index 48cd5ee8f..761d96c12 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -4,7 +4,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.EntitySelector; import net.minecraft.server.MinecraftServer; import net.minecraft.sounds.SoundSource; @@ -12,7 +11,6 @@ import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; -import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; import net.pitan76.mcpitanlib.api.util.world.WorldAccessUtil; import net.pitan76.mcpitanlib.midohra.block.BlockState; @@ -106,12 +104,12 @@ public boolean setBlockState(BlockPos pos, BlockState state) { } @Deprecated - public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { + public void playSound(net.minecraft.world.entity.player.Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category, float volume, float pitch) { getRaw().playSound(playerEntity, pos, sound, category, volume, pitch); } @Deprecated - public void playSound(Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category) { + public void playSound(net.minecraft.world.entity.player.Player playerEntity, net.minecraft.core.BlockPos pos, SoundEvent sound, SoundSource category) { getRaw().playSound(playerEntity, pos, sound, category); } diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java index be3e7a36f..4100fd3da 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java @@ -27,7 +27,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -// TODO(Ravel): can not resolve target class AbstractBlock @Mixin(AbstractBlock.class) public class AbstractBlock4CompatProviderMixin { // TODO(Ravel): no target class diff --git a/src/main/resources/mcpitanlib.accesswidener b/src/main/resources/mcpitanlib.accesswidener index 8bb3e9c78..8965697fa 100644 --- a/src/main/resources/mcpitanlib.accesswidener +++ b/src/main/resources/mcpitanlib.accesswidener @@ -1,23 +1,4 @@ -accessWidener v2 named -accessible field net/minecraft/item/ItemGroups BUILDING_BLOCKS Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups COLORED_BLOCKS Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups NATURAL Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups FUNCTIONAL Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups REDSTONE Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups HOTBAR Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups SEARCH Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups TOOLS Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups COMBAT Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups FOOD_AND_DRINK Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups INGREDIENTS Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups SPAWN_EGGS Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups OPERATOR Lnet/minecraft/registry/RegistryKey; -accessible field net/minecraft/item/ItemGroups INVENTORY Lnet/minecraft/registry/RegistryKey; +accessWidener v2 official -accessible method net/minecraft/block/AbstractBlock onStateReplaced (Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Z)V - -accessible class net/minecraft/screen/ScreenHandlerType$Factory -accessible method net/minecraft/screen/ScreenHandlerType (Lnet/minecraft/screen/ScreenHandlerType$Factory;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V -extendable method net/minecraft/screen/ScreenHandlerType (Lnet/minecraft/screen/ScreenHandlerType$Factory;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V - -accessible class net/minecraft/datafixer/fix/ItemStackComponentizationFix$StackData +mutable field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen imageWidth I +mutable field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen imageHeight I diff --git a/src/main/resources/mcpitanlib.mixins.json b/src/main/resources/mcpitanlib.mixins.json index 0a36c5829..d4b92ebd9 100644 --- a/src/main/resources/mcpitanlib.mixins.json +++ b/src/main/resources/mcpitanlib.mixins.json @@ -4,7 +4,7 @@ "package": "net.pitan76.mcpitanlib.fabric.mixin", "compatibilityLevel": "JAVA_8", "mixins": [ - "RecipeMixin" + ], "client": [ ], From e33c34eaeaba01384f5bbc092acefdb4470a340a Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 16:34:04 +0900 Subject: [PATCH 011/151] port to 26.1-2 --- .../color/fabric/BlockColorEventImpl.java | 2 +- .../block/BlockApiLookupWithDirection.java | 12 +++--- .../lookup/block/BlockApiLookupWrapper.java | 4 +- .../fabric/BlockEntityTypeBuilderImpl.java | 3 +- .../registry/EntityRendererRegistry.java | 2 +- .../entity/v2/CompatBlockEntityRenderer.java | 6 +-- .../api/command/CommandRegistry.java | 6 +-- .../api/event/ServerCommandEvent.java | 3 +- .../api/event/result/TypedEventResult.java | 23 ++++++----- .../event/v0/AttackEntityEventRegistry.java | 14 +++---- .../api/event/v0/EventRegistry.java | 21 ++++++---- .../event/v0/InteractionEventRegistry.java | 36 +++++++++++------ .../api/event/v0/LivingHurtEventRegistry.java | 12 +++--- .../api/event/v0/event/ClickBlockEvent.java | 3 +- .../api/event/v0/event/LivingHurtEvent.java | 7 ++-- .../event/v0/event/ServerConnectionEvent.java | 8 ++-- .../event/v1/AttackEntityEventRegistry.java | 11 +++-- .../api/event/v1/LivingHurtEventRegistry.java | 10 ++--- .../api/event/v1/event/AttackEntityEvent.java | 3 +- .../extra/transfer/util/FluidStorageUtil.java | 30 +++++++------- .../api/gui/ExtendedScreenHandlerFactory.java | 10 +++-- .../api/gui/SimpleScreenHandler.java | 15 ++++--- .../api/gui/args/SlotClickEvent.java | 18 ++++----- .../api/gui/slot/CompatSlotActionType.java | 40 +++++++++---------- .../api/gui/slot/CompatibleSlot.java | 5 +-- .../block/BlockApiLookupWithDirection.java | 12 +++--- .../lookup/block/BlockApiLookupWrapper.java | 4 +- .../api/network/ClientNetworking.java | 26 +++++------- .../api/network/ServerNetworking.java | 31 +++++++------- .../api/recipe/CompatibleRecipeEntry.java | 1 - .../api/state/property/CompatProperties.java | 1 - .../api/tile/RenderAttachmentBlockEntity.java | 2 +- .../transfer/fluid/v1/FabricFluidVariant.java | 2 +- .../transfer/fluid/v1/FluidStorageUtil.java | 6 ++- .../mcpitanlib/api/util/BlockStateUtil.java | 9 ++--- .../api/util/PersistentStateUtil.java | 10 ++--- .../mcpitanlib/api/util/PlatformUtil.java | 22 +++++----- .../util/client/BlockEntityRendererUtil.java | 8 ++-- .../api/util/entity/EquipmentSlotUtil.java | 6 +-- .../api/util/inventory/CompatInventory.java | 7 ++-- .../mcpitanlib/api/util/math/PosUtil.java | 1 - .../util/particle/CompatParticleTypes.java | 1 - .../mcpitanlib/guilib/GuiRegistry.java | 8 ++-- .../AbstractBlock4CompatProviderMixin.java | 2 +- .../mcpitanlib/test/ExampleModClient.java | 4 +- 45 files changed, 237 insertions(+), 230 deletions(-) diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/color/fabric/BlockColorEventImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/color/fabric/BlockColorEventImpl.java index a4eef8c36..6b3627f94 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/color/fabric/BlockColorEventImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/color/fabric/BlockColorEventImpl.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.client.color.fabric; -import net.minecraft.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.tile.RenderAttachmentBlockEntity; public class BlockColorEventImpl { diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java index 9f5e6d946..64943d6ab 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.lookup.block; import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; @@ -14,9 +14,9 @@ import java.util.function.BiFunction; -public class BlockApiLookupWithDirection
extends BlockApiLookupWrapper { +public class BlockApiLookupWithDirection extends BlockApiLookupWrapper { - public BlockApiLookupWithDirection(BlockApiLookup<@NotNull A, net.minecraft.util.math.Direction> lookup) { + public BlockApiLookupWithDirection(BlockApiLookup<@NotNull A, net.minecraft.core.Direction> lookup) { super(lookup); } @@ -25,7 +25,7 @@ public static BlockApiLookupWrapper of(BlockApiLookup<@NotNull A, C return new BlockApiLookupWrapper<>(lookup); } - public static BlockApiLookupWithDirection ofDir(BlockApiLookup<@NotNull A, net.minecraft.util.math.Direction> lookup) { + public static BlockApiLookupWithDirection ofDir(BlockApiLookup<@NotNull A, net.minecraft.core.Direction> lookup) { return new BlockApiLookupWithDirection<>(lookup); } @@ -46,7 +46,7 @@ public void registerForBlockEntityM(BiFunction void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { + public void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { super.registerForBlockEntity(provider, blockEntityType); } diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java index 0651be594..fbdb36745 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.lookup.block; import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java index f4a58fdc3..bde486871 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java @@ -3,8 +3,7 @@ import com.mojang.datafixers.types.Type; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; public class BlockEntityTypeBuilderImpl { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java index f5de9bfde..56564d8e1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java @@ -8,6 +8,6 @@ public class EntityRendererRegistry { public static void registerEntityRendererAsFlyingItem(Supplier> entityType) { - CompatRegistryClient2.registerEntityRenderer(entityType, (ctx -> (EntityRenderer) new ThrownItemRenderer<>(ctx))); + CompatRegistryClient.registerEntityRenderer(entityType, (ctx -> (EntityRenderer) new ThrownItemRenderer<>(ctx))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java index 39393d64f..3bee38c06 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java @@ -1,20 +1,20 @@ package net.pitan76.mcpitanlib.api.client.render.block.entity.v2; import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; import net.pitan76.mcpitanlib.api.client.render.block.entity.event.CompatBlockEntityRendererConstructArgs; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; public abstract class CompatBlockEntityRenderer implements net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer { @Deprecated - public CompatRegistryClient2.BlockEntityRendererFactory.Context ctx; + public CompatRegistryClient.BlockEntityRendererFactory.Context ctx; public CompatBlockEntityRenderer(CompatBlockEntityRendererConstructArgs args) { } - public CompatBlockEntityRenderer(CompatRegistryClient2.BlockEntityRendererFactory.Context ctx) { + public CompatBlockEntityRenderer(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { this.ctx = ctx; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java index d0340c3be..f15d95dce 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java @@ -2,7 +2,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import dev.architectury.event.events.common.CommandRegistrationEvent; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.Commands; import net.minecraft.commands.CommandSourceStack; @@ -17,7 +17,7 @@ public class CommandRegistry { public static CommandBuildContext latestCommandRegistryAccess; public static void register(String name, LiteralCommand command) { - CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { + CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> { latestCommandRegistryAccess = registry; CommandSettings settings = new CommandSettings(); @@ -39,7 +39,7 @@ public static void register(String name, LiteralCommand command) { } public static void register(LiteralArgumentBuilder builder) { - CommandRegistrationEvent.EVENT.register((dispatcher, registry, environment) -> { + CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> { latestCommandRegistryAccess = registry; dispatcher.register(builder); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java index 1ae347801..8105d8907 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.context.StringRange; import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Player; import net.minecraft.commands.CommandSourceStack; import net.minecraft.network.chat.Component; import net.minecraft.world.level.Level; @@ -28,7 +27,7 @@ public CommandSourceStack getSource() { return getContext().getSource(); } - public Player getPlayerEntity() throws CommandSyntaxException { + public net.minecraft.world.entity.player.Player getPlayerEntity() throws CommandSyntaxException { return getSource().getPlayer(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java b/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java index 5f4d23593..437908aab 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java @@ -1,48 +1,49 @@ package net.pitan76.mcpitanlib.api.event.result; -import dev.architectury.event.CompoundEventResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.InteractionResult; import net.pitan76.mcpitanlib.api.util.CompatActionResult; public class TypedEventResult { - protected final dev.architectury.event.CompoundEventResult result; + protected final InteractionResult result; + protected final T object; - protected TypedEventResult(dev.architectury.event.CompoundEventResult result) { + protected TypedEventResult(InteractionResult result, T object) { this.result = result; + this.object = object; } public static TypedEventResult success(T value) { - return new TypedEventResult<>(CompoundEventResult.interruptTrue(value)); + return new TypedEventResult<>(InteractionResult.SUCCESS, value); } public static TypedEventResult stop(T value) { - return new TypedEventResult<>(CompoundEventResult.interruptDefault(value)); + return new TypedEventResult<>(InteractionResult.FAIL, value); } public static TypedEventResult pass() { - return new TypedEventResult<>(CompoundEventResult.pass()); + return new TypedEventResult<>(InteractionResult.PASS, null); } public static TypedEventResult fail(T value) { - return new TypedEventResult<>(CompoundEventResult.interruptFalse(value)); + return new TypedEventResult<>(InteractionResult.FAIL, value); } @Deprecated - public dev.architectury.event.CompoundEventResult getResult() { + public InteractionResult getResult() { return result; } public InteractionResult toActionResult() { - return result.result().asMinecraft(); + return result; } public CompatActionResult toCompatActionResult() { - return CompatActionResult.of(result.result().asMinecraft()); + return CompatActionResult.of(result); } public CompatActionResult toCompatActionResult(ItemStack stack) { - if (result.object() != stack) + if (object != stack) return toCompatActionResult(); if (toActionResult() instanceof InteractionResult.Success) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java index 2591dc186..ff79a348e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java @@ -1,26 +1,26 @@ package net.pitan76.mcpitanlib.api.event.v0; -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.PlayerEvent; +import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.InteractionHand; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.CompatActionResult; import org.jetbrains.annotations.Nullable; @Deprecated public class AttackEntityEventRegistry { public static void register(AttackEntity attackEntity) { - PlayerEvent.ATTACK_ENTITY.register(attackEntity::attack); + AttackEntityCallback.EVENT.register(attackEntity::attack); } public interface AttackEntity { - default EventResult attack(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { - return attack(new Player(player), level, target, hand, result); + default InteractionResult attack(net.minecraft.world.entity.player.Player player, Level level, InteractionHand hand, Entity target, @Nullable EntityHitResult result) { + return attack(new Player(player), level, target, hand, result).toActionResult(); } - EventResult attack(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result); + CompatActionResult attack(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java index 7c51d7b82..731335ca9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.api.event.v0; -import dev.architectury.event.events.common.LifecycleEvent; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.minecraft.world.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -43,31 +44,35 @@ public interface ItemStackDamageState { public static class ServerLifecycle { // Architectury: LifecycleEvent public static void serverStarted(ServerState state) { - LifecycleEvent.SERVER_STARTED.register(state::stateChanged); + ServerLifecycleEvents.SERVER_STARTED.register(state::stateChanged); } public static void serverStarting(ServerState state) { - LifecycleEvent.SERVER_STARTING.register(state::stateChanged); + ServerLifecycleEvents.SERVER_STARTING.register(state::stateChanged); } public static void serverStopped(ServerState state) { - LifecycleEvent.SERVER_STOPPED.register(state::stateChanged); + ServerLifecycleEvents.SERVER_STOPPED.register(state::stateChanged); } public static void serverStopping(ServerState state) { - LifecycleEvent.SERVER_STOPPING.register(state::stateChanged); + ServerLifecycleEvents.SERVER_STOPPING.register(state::stateChanged); } public static void serverWorldLoad(ServerWorldState state) { - LifecycleEvent.SERVER_LEVEL_LOAD.register(state::act); + ServerLevelEvents.LOAD.register((_, level) -> state.act(level)); } public static void serverWorldSave(ServerWorldState state) { - LifecycleEvent.SERVER_LEVEL_SAVE.register(state::act); + ServerLifecycleEvents.AFTER_SAVE.register((server, _, _) -> { + for (ServerLevel level : server.getAllLevels()) { + state.act(level); + } + }); } public static void serverWorldUnload(ServerWorldState state) { - LifecycleEvent.SERVER_LEVEL_UNLOAD.register(state::act); + ServerLevelEvents.UNLOAD.register((_, level) -> state.act(level)); } public interface ServerState extends InstanceState { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java index 975340f34..e4f1d49e5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java @@ -1,8 +1,12 @@ package net.pitan76.mcpitanlib.api.event.v0; -import dev.architectury.event.events.common.InteractionEvent; +import net.fabricmc.fabric.api.event.client.player.ClientPlayerBlockBreakEvents; +import net.fabricmc.fabric.api.event.client.player.ClientPreAttackCallback; +import net.fabricmc.fabric.api.event.player.AttackBlockCallback; +import net.fabricmc.fabric.api.event.player.UseBlockCallback; +import net.fabricmc.fabric.api.event.player.UseEntityCallback; +import net.fabricmc.fabric.api.event.player.UseItemCallback; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionHand; import net.pitan76.mcpitanlib.api.entity.Player; @@ -12,27 +16,33 @@ public class InteractionEventRegistry { public static void registerRightClickBlock(RightClickBlock rightClickBlock) { - InteractionEvent.RIGHT_CLICK_BLOCK.register((player, hand, pos, direction) -> rightClickBlock.click(new ClickBlockEvent(player, hand, pos, direction)).toActionResult()); + UseBlockCallback.EVENT.register((player, world, hand, result) -> rightClickBlock.click(new ClickBlockEvent(player, hand, result.getBlockPos(), result.getDirection())).toActionResult()); } public static void registerLeftClickBlock(LeftClickBlock leftClickBlock) { - InteractionEvent.LEFT_CLICK_BLOCK.register((player, hand, pos, direction) -> leftClickBlock.click(new ClickBlockEvent(player, hand, pos, direction)).toActionResult()); + AttackBlockCallback.EVENT.register((player, world, hand, pos, dir) -> leftClickBlock.click(new ClickBlockEvent(player, hand, pos, dir)).toActionResult()); } public static void registerRightClickItem(RightClickItem rightClickItem) { - InteractionEvent.RIGHT_CLICK_ITEM.register(rightClickItem::click); + UseItemCallback.EVENT.register((player, _, hand) + -> rightClickItem.click2(player, hand)); } public static void registerClientLeftClickAir(ClientLeftClickAir clientLeftClickAir) { - InteractionEvent.CLIENT_LEFT_CLICK_AIR.register(clientLeftClickAir::click); + ClientPreAttackCallback.EVENT.register((_, player, _) -> { + clientLeftClickAir.click(player, player.getUsedItemHand()); + return false; + }); } public static void registerClientRightClickAir(ClientRightClickAir clientRightClickAir) { - InteractionEvent.CLIENT_RIGHT_CLICK_AIR.register(clientRightClickAir::click); + ClientPlayerBlockBreakEvents.AFTER.register((_, player, _, _) + -> clientRightClickAir.click(player, player.getUsedItemHand())); } public static void registerInteractEntity(InteractEntity interactEntity) { - InteractionEvent.INTERACT_ENTITY.register(interactEntity::interact); + UseEntityCallback.EVENT.register((player, _, hand, entity, _) + -> interactEntity.interact(player, entity, hand)); } // ---- @@ -46,7 +56,7 @@ public interface RightClickBlock { } public interface RightClickItem { - default InteractionResult click(Player var1, InteractionHand var2) { + default InteractionResult click2(net.minecraft.world.entity.player.Player var1, InteractionHand var2) { return click(new Player(var1), var2).toActionResult(); } @@ -54,7 +64,7 @@ default InteractionResult click(Player var1, InteractionHand var2) { } public interface ClientLeftClickAir { - default void click(Player var1, InteractionHand var2) { + default void click(net.minecraft.world.entity.player.Player var1, InteractionHand var2) { click(new Player(var1), var2); } @@ -62,7 +72,7 @@ default void click(Player var1, InteractionHand var2) { } public interface ClientRightClickAir { - default void click(Player var1, InteractionHand var2) { + default void click(net.minecraft.world.entity.player.Player var1, InteractionHand var2) { click(new Player(var1), var2); } @@ -71,8 +81,8 @@ default void click(Player var1, InteractionHand var2) { public interface InteractEntity { @SuppressWarnings("deprecation") - default dev.architectury.event.EventResult interact(Player var1, Entity var2, InteractionHand var3) { - return interact(new Player(var1), var2, var3).toEventResult().getResult(); + default InteractionResult interact(net.minecraft.world.entity.player.Player var1, Entity var2, InteractionHand var3) { + return interact(new Player(var1), var2, var3).toActionResult(); } CompatActionResult interact(Player player, Entity entity, InteractionHand hand); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java index 657cdf6c9..6d4ed9711 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java @@ -1,19 +1,21 @@ package net.pitan76.mcpitanlib.api.event.v0; -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.EntityEvent; +import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.damagesource.DamageSource; +import net.pitan76.mcpitanlib.api.event.result.EventResult; import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; +@Deprecated public class LivingHurtEventRegistry { public static void register(LivingHurt livingHurt) { - EntityEvent.LIVING_HURT.register(livingHurt::hurt); + ServerLivingEntityEvents.ALLOW_DAMAGE.register(livingHurt::hurt); } public interface LivingHurt { - default EventResult hurt(LivingEntity var1, DamageSource var2, float var3) { - return hurt(new LivingHurtEvent(var1, var2, var3)); + default boolean hurt(LivingEntity var1, DamageSource var2, float var3) { + return hurt(new LivingHurtEvent(var1, var2, var3)).toActionResult() == InteractionResult.SUCCESS; } EventResult hurt(LivingHurtEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java index 5d6b1ee9c..d7247e6f4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java @@ -2,7 +2,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.InteractionHand; import net.minecraft.core.BlockPos; @@ -25,7 +24,7 @@ public ClickBlockEvent(Player player, InteractionHand hand, BlockPos pos, Direct this.direction = direction; } - public ClickBlockEvent(Player player, InteractionHand hand, BlockPos pos, Direction direction) { + public ClickBlockEvent(net.minecraft.world.entity.player.Player player, InteractionHand hand, BlockPos pos, Direction direction) { this.player = new Player(player); this.hand = hand; this.pos = pos; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java index cdb9a4864..1e98c59e0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java @@ -3,7 +3,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -45,11 +44,11 @@ public boolean isDirect() { } public boolean isPlayerAttacker() { - return getAttacker() instanceof Player; + return getAttacker() instanceof net.minecraft.world.entity.player.Player; } - public Player getPlayerEntityAttacker() { - return (Player) getAttacker(); + public net.minecraft.world.entity.player.Player getPlayerEntityAttacker() { + return (net.minecraft.world.entity.player.Player) getAttacker(); } public Player getPlayerAttacker() { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java index ec21cc0e7..276d597be 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java @@ -1,15 +1,17 @@ package net.pitan76.mcpitanlib.api.event.v0.event; -import dev.architectury.event.events.common.PlayerEvent; +import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; public class ServerConnectionEvent { // Architectury: PlayerEvent public static void join(EventRegistry.ServerConnection.PlayerJoin state) { - PlayerEvent.PLAYER_JOIN.register(state::join); + ServerPlayConnectionEvents.JOIN.register(((listener, _, _) + -> state.join(listener.getPlayer()))); } public static void quit(EventRegistry.ServerConnection.PlayerQuit state) { - PlayerEvent.PLAYER_QUIT.register(state::quit); + ServerPlayConnectionEvents.DISCONNECT.register(((listener, _) + -> state.quit(listener.getPlayer()))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java index 7ced46d48..8fb8e4b33 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java @@ -1,9 +1,8 @@ package net.pitan76.mcpitanlib.api.event.v1; -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.PlayerEvent; +import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.InteractionHand; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.level.Level; @@ -13,12 +12,12 @@ public class AttackEntityEventRegistry { public static void register(AttackEntity attackEntity) { - PlayerEvent.ATTACK_ENTITY.register(attackEntity::attack); + AttackEntityCallback.EVENT.register(attackEntity::attack); } public interface AttackEntity { - default EventResult attack(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { - return attack(new AttackEntityEvent(player, level, target, hand, result)).toEventResult().getResult(); + default InteractionResult attack(net.minecraft.world.entity.player.Player player, Level level, InteractionHand hand, Entity target, @Nullable EntityHitResult result) { + return attack(new AttackEntityEvent(player, level, target, hand, result)).toActionResult(); } CompatActionResult attack(AttackEntityEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java index a2faf4a97..6426fbeff 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java @@ -1,21 +1,21 @@ package net.pitan76.mcpitanlib.api.event.v1; -import dev.architectury.event.EventResult; -import dev.architectury.event.events.common.EntityEvent; +import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents; +import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.damagesource.DamageSource; import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; public class LivingHurtEventRegistry { public static void register(LivingHurt livingHurt) { - EntityEvent.LIVING_HURT.register(livingHurt::hurt); + ServerLivingEntityEvents.ALLOW_DAMAGE.register(livingHurt::hurt); } public interface LivingHurt { @SuppressWarnings("deprecation") - default EventResult hurt(LivingEntity var1, DamageSource var2, float var3) { - return hurt(new LivingHurtEvent(var1, var2, var3)).getResult(); + default boolean hurt(LivingEntity var1, DamageSource var2, float var3) { + return hurt(new LivingHurtEvent(var1, var2, var3)).toActionResult() == InteractionResult.SUCCESS; } net.pitan76.mcpitanlib.api.event.result.EventResult hurt(LivingHurtEvent event); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java index b7ab9898c..2ec2075a7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.event.v1.event; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.InteractionHand; @@ -19,7 +18,7 @@ public class AttackEntityEvent { public InteractionHand hand; public EntityHitResult result; - public AttackEntityEvent(Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { + public AttackEntityEvent(net.minecraft.world.entity.player.Player player, Level level, Entity target, InteractionHand hand, @Nullable EntityHitResult result) { this(new Player(player), level, target, hand, result); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java index 0d85026f5..26f3697ee 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java @@ -3,9 +3,9 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; -import net.minecraft.fluid.FluidState; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.world.World; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.material.FluidState; import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; @@ -19,36 +19,36 @@ public static SingleFluidStorage withFixedCapacity(long capacity, Runnable onCha public static void readNbt(SingleFluidStorage storage, NbtRWArgs args) { if (args instanceof ReadNbtArgs) - storage.readData(((ReadNbtArgs) args).view); + storage.readValue(((ReadNbtArgs) args).view); } public static void writeNbt(SingleFluidStorage storage, NbtRWArgs args) { if (args instanceof WriteNbtArgs) - storage.writeData(((WriteNbtArgs) args).view); + storage.writeValue(((WriteNbtArgs) args).view); } - public static void readNbt(SingleFluidStorage storage, NbtCompound nbt, CompatRegistryLookup registryLookup) { - storage.readData(NbtDataConverter.nbt2readData(nbt, registryLookup)); + public static void readNbt(SingleFluidStorage storage, CompoundTag nbt, CompatRegistryLookup registryLookup) { + storage.readValue(NbtDataConverter.nbt2readData(nbt, registryLookup)); } - public static void writeNbt(SingleFluidStorage storage, NbtCompound nbt, CompatRegistryLookup registryLookup) { - storage.writeData(NbtDataConverter.nbt2writeData(nbt, registryLookup)); + public static void writeNbt(SingleFluidStorage storage, CompoundTag nbt, CompatRegistryLookup registryLookup) { + storage.writeValue(NbtDataConverter.nbt2writeData(nbt, registryLookup)); } /** * @deprecated Use {@link #readNbt(SingleFluidStorage, NbtRWArgs)} instead */ @Deprecated - public static void readNbt(SingleFluidStorage storage, NbtCompound nbt, World world) { - readNbt(storage, nbt, new CompatRegistryLookup(world.getRegistryManager())); + public static void readNbt(SingleFluidStorage storage, CompoundTag nbt, Level world) { + readNbt(storage, nbt, new CompatRegistryLookup(world.registryAccess())); } /** * @deprecated Use {@link #writeNbt(SingleFluidStorage, NbtRWArgs)} instead */ @Deprecated - public static void writeNbt(SingleFluidStorage storage, NbtCompound nbt, World world) { - writeNbt(storage, nbt, new CompatRegistryLookup(world.getRegistryManager())); + public static void writeNbt(SingleFluidStorage storage, CompoundTag nbt, Level world) { + writeNbt(storage, nbt, new CompatRegistryLookup(world.registryAccess())); } public static long getAmount(SingleFluidStorage storage) { @@ -77,14 +77,14 @@ public static long extract(SingleFluidStorage storage, FluidVariant extractedVar public static void insert(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { try (Transaction transaction = Transaction.openOuter()) { - insert(storage, FluidVariant.of(fluidState.getFluid()), maxAmount, transaction); + insert(storage, FluidVariant.of(fluidState.getType()), maxAmount, transaction); transaction.commit(); } } public static void extract(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { try (Transaction transaction = Transaction.openOuter()) { - extract(storage, FluidVariant.of(fluidState.getFluid()), maxAmount, transaction); + extract(storage, FluidVariant.of(fluidState.getType()), maxAmount, transaction); transaction.commit(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java index 35d363fdd..da194bf64 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java @@ -1,21 +1,25 @@ package net.pitan76.mcpitanlib.api.gui; -import dev.architectury.registry.menu.ExtendedMenuProvider; +import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; import net.pitan76.mcpitanlib.api.event.container.factory.ExtraDataArgs; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; @Deprecated -public interface ExtendedScreenHandlerFactory extends ExtendedMenuProvider { +public interface ExtendedScreenHandlerFactory extends ExtendedMenuProvider { @Override default Component getDisplayName() { return getDisplayName(new DisplayNameArgs()); } @Override - default void saveExtraData(FriendlyByteBuf buf) { + default FriendlyByteBuf getScreenOpeningData(ServerPlayer player) { + FriendlyByteBuf buf = PacketByteUtil.create(); writeExtraData(new ExtraDataArgs(buf)); + return buf; } Component getDisplayName(DisplayNameArgs args); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java index 99550bf35..57f1e1243 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java @@ -1,13 +1,12 @@ package net.pitan76.mcpitanlib.api.gui; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.Container; +import net.minecraft.world.inventory.ContainerInput; import net.minecraft.world.item.ItemStack; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.inventory.Slot; -import net.minecraft.world.inventory.ClickType; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.api.gui.args.SlotClickEvent; @@ -33,7 +32,7 @@ protected SimpleScreenHandler(@Nullable MenuType type, CreateMenuEvent e) { @Deprecated @Override - public boolean stillValid(Player player) { + public boolean stillValid(net.minecraft.world.entity.player.Player player) { return canUse(new Player(player)); } @@ -67,7 +66,7 @@ protected Slot addSlot(Slot slot) { @Deprecated @Override - public void removed(Player player) { + public void removed(net.minecraft.world.entity.player.Player player) { this.close(new Player(player)); } @@ -162,7 +161,7 @@ protected List addSlotsY(Container inventory, int firstIndex, int x, int f } @Deprecated - public ItemStack quickMoveOverride(Player player, int index) { + public ItemStack quickMoveOverride(net.minecraft.world.entity.player.Player player, int index) { return quickMoveOverride(new Player(player), index); } @@ -216,7 +215,7 @@ public ItemStack quickMoveOverride(Player player, int index) { @Deprecated @Override - public ItemStack quickMoveStack(Player player, int slot) { + public ItemStack quickMoveStack(net.minecraft.world.entity.player.Player player, int slot) { return quickMoveOverride(player, slot); } @@ -232,11 +231,11 @@ public Slot callGetSlot(int index) { @Deprecated @Override - public void clicked(int slotIndex, int button, ClickType actionType, Player player) { + public void clicked(int slotIndex, int button, ContainerInput actionType, net.minecraft.world.entity.player.Player player) { overrideOnSlotClick(slotIndex, button, actionType, new Player(player)); } - public void overrideOnSlotClick(int slotIndex, int button, ClickType actionType, Player player) { + public void overrideOnSlotClick(int slotIndex, int button, ContainerInput actionType, Player player) { onSlotClick(new SlotClickEvent(slotIndex, button, actionType, player)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java index 9466ae7c6..3e32f803f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.gui.args; -import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.ContainerInput; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.gui.slot.CompatSlotActionType; public class SlotClickEvent { public int slot; public int button; - public ClickType actionType; + public ContainerInput actionType; public Player player; - public SlotClickEvent(int slot, int button, ClickType actionType, Player player) { + public SlotClickEvent(int slot, int button, ContainerInput actionType, Player player) { this.slot = slot; this.button = button; this.actionType = actionType; @@ -25,7 +25,7 @@ public int getButton() { return button; } - public ClickType getRawActionType() { + public ContainerInput getRawActionType() { return actionType; } @@ -46,22 +46,22 @@ public boolean isServer() { } public boolean isSwapAction() { - return actionType == ClickType.SWAP; + return actionType == ContainerInput.SWAP; } public boolean isPickupAction() { - return actionType == ClickType.PICKUP; + return actionType == ContainerInput.PICKUP; } public boolean isQuickCraftAction() { - return actionType == ClickType.QUICK_CRAFT; + return actionType == ContainerInput.QUICK_CRAFT; } public boolean isQuickMoveAction() { - return actionType == ClickType.QUICK_MOVE; + return actionType == ContainerInput.QUICK_MOVE; } public boolean isThrowAction() { - return actionType == ClickType.THROW; + return actionType == ContainerInput.THROW; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java index 72b1cb566..7f1fb5070 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java @@ -1,38 +1,38 @@ package net.pitan76.mcpitanlib.api.gui.slot; -import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.ContainerInput; public class CompatSlotActionType { - public static final CompatSlotActionType PICKUP = new CompatSlotActionType(ClickType.PICKUP); - public static final CompatSlotActionType QUICK_MOVE = new CompatSlotActionType(ClickType.QUICK_MOVE); - public static final CompatSlotActionType SWAP = new CompatSlotActionType(ClickType.SWAP); - public static final CompatSlotActionType THROW = new CompatSlotActionType(ClickType.THROW); - public static final CompatSlotActionType CLONE = new CompatSlotActionType(ClickType.CLONE); - public static final CompatSlotActionType QUICK_CRAFT = new CompatSlotActionType(ClickType.QUICK_CRAFT); - public static final CompatSlotActionType PICKUP_ALL = new CompatSlotActionType(ClickType.PICKUP_ALL); + public static final CompatSlotActionType PICKUP = new CompatSlotActionType(ContainerInput.PICKUP); + public static final CompatSlotActionType QUICK_MOVE = new CompatSlotActionType(ContainerInput.QUICK_MOVE); + public static final CompatSlotActionType SWAP = new CompatSlotActionType(ContainerInput.SWAP); + public static final CompatSlotActionType THROW = new CompatSlotActionType(ContainerInput.THROW); + public static final CompatSlotActionType CLONE = new CompatSlotActionType(ContainerInput.CLONE); + public static final CompatSlotActionType QUICK_CRAFT = new CompatSlotActionType(ContainerInput.QUICK_CRAFT); + public static final CompatSlotActionType PICKUP_ALL = new CompatSlotActionType(ContainerInput.PICKUP_ALL); - public final ClickType raw; + public final ContainerInput raw; - protected CompatSlotActionType(ClickType raw) { + protected CompatSlotActionType(ContainerInput raw) { this.raw = raw; } - public static CompatSlotActionType of(ClickType raw) { - if (raw == ClickType.PICKUP) return PICKUP; - if (raw == ClickType.QUICK_MOVE) return QUICK_MOVE; - if (raw == ClickType.SWAP) return SWAP; - if (raw == ClickType.THROW) return THROW; - if (raw == ClickType.CLONE) return CLONE; - if (raw == ClickType.QUICK_CRAFT) return QUICK_CRAFT; - if (raw == ClickType.PICKUP_ALL) return PICKUP_ALL; + public static CompatSlotActionType of(ContainerInput raw) { + if (raw == ContainerInput.PICKUP) return PICKUP; + if (raw == ContainerInput.QUICK_MOVE) return QUICK_MOVE; + if (raw == ContainerInput.SWAP) return SWAP; + if (raw == ContainerInput.THROW) return THROW; + if (raw == ContainerInput.CLONE) return CLONE; + if (raw == ContainerInput.QUICK_CRAFT) return QUICK_CRAFT; + if (raw == ContainerInput.PICKUP_ALL) return PICKUP_ALL; return new CompatSlotActionType(raw); } public boolean isSwapOrPickupOrQuickMoveOrThrow() { - return raw == ClickType.SWAP || raw == ClickType.PICKUP || raw == ClickType.QUICK_MOVE || raw == ClickType.THROW; + return raw == ContainerInput.SWAP || raw == ContainerInput.PICKUP || raw == ContainerInput.QUICK_MOVE || raw == ContainerInput.THROW; } - public ClickType getRaw() { + public ContainerInput getRaw() { return raw; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java index 5bc2fd712..2251a367b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.gui.slot; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; import net.minecraft.world.inventory.Slot; @@ -101,7 +100,7 @@ public boolean mayPlace(ItemStack stack) { } @Override - public boolean mayPickup(Player playerEntity) { + public boolean mayPickup(net.minecraft.world.entity.player.Player playerEntity) { return canTakeItems(new Player(playerEntity)); } @@ -115,7 +114,7 @@ public boolean canTakeItems(Player player) { @Deprecated @Override - public boolean allowModification(Player player) { + public boolean allowModification(net.minecraft.world.entity.player.Player player) { return canTakePartial(new Player(player)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java index 9f5e6d946..64943d6ab 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.lookup.block; import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; @@ -14,9 +14,9 @@ import java.util.function.BiFunction; -public class BlockApiLookupWithDirection extends BlockApiLookupWrapper { +public class BlockApiLookupWithDirection extends BlockApiLookupWrapper { - public BlockApiLookupWithDirection(BlockApiLookup<@NotNull A, net.minecraft.util.math.Direction> lookup) { + public BlockApiLookupWithDirection(BlockApiLookup<@NotNull A, net.minecraft.core.Direction> lookup) { super(lookup); } @@ -25,7 +25,7 @@ public static BlockApiLookupWrapper of(BlockApiLookup<@NotNull A, C return new BlockApiLookupWrapper<>(lookup); } - public static BlockApiLookupWithDirection ofDir(BlockApiLookup<@NotNull A, net.minecraft.util.math.Direction> lookup) { + public static BlockApiLookupWithDirection ofDir(BlockApiLookup<@NotNull A, net.minecraft.core.Direction> lookup) { return new BlockApiLookupWithDirection<>(lookup); } @@ -46,7 +46,7 @@ public void registerForBlockEntityM(BiFunction void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { + public void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { super.registerForBlockEntity(provider, blockEntityType); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java index 0651be594..fbdb36745 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.lookup.block; import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java index afa6a7f00..0340399ff 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java @@ -1,8 +1,7 @@ package net.pitan76.mcpitanlib.api.network; -import dev.architectury.networking.NetworkManager; -import dev.architectury.networking.transformers.PacketTransformer; import io.netty.buffer.Unpooled; +import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.FriendlyByteBuf; @@ -14,8 +13,6 @@ import java.util.List; -import static dev.architectury.impl.NetworkAggregator.*; - public class ClientNetworking { public static void send(Identifier identifier, FriendlyByteBuf buf) { /* @@ -27,23 +24,22 @@ public static void send(Identifier identifier, FriendlyByteBuf buf) { */ BufPayload payload = new BufPayload(buf, identifier); - NetworkManager.sendToServer(payload); + ClientPlayNetworking.send(payload); } public static void registerReceiver(Identifier identifier, ClientNetworkHandler handler) { BufPayload.Type id = BufPayload.id(identifier); - NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, BufPayload.getCodec(id), - (payload, context) -> { - FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); + ClientPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); - LocalPlayer player = null; - if (context.getPlayer() instanceof LocalPlayer) - player = (LocalPlayer) context.getPlayer(); + LocalPlayer player = null; + if (context.player() instanceof LocalPlayer) + player = context.player(); - handler.receive(Minecraft.getInstance(), player, buf); - buf.release(); - }); + handler.receive(Minecraft.getInstance(), player, buf); + buf.release(); + }); } @FunctionalInterface @@ -52,7 +48,7 @@ public interface ClientNetworkHandler { } - public static void registerC2SType(CustomPacketPayload.Type type, StreamCodec codec, List packetTransformers) { + public static void registerC2SType(CustomPacketPayload.Type type, StreamCodec codec, List packetTransformers) { // Objects.requireNonNull(type, "Cannot register a null type!"); // packetTransformers = Objects.requireNonNullElse(packetTransformers, List.of()); // C2S_CODECS.put(type.id(), (PacketCodec) codec); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java index 8d0964fe1..fe8a5a3c0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java @@ -1,8 +1,8 @@ package net.pitan76.mcpitanlib.api.network; -import dev.architectury.impl.NetworkAggregator; -import dev.architectury.networking.NetworkManager; import io.netty.buffer.Unpooled; +import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; +import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -17,14 +17,16 @@ public static void send(ServerPlayer player, Identifier identifier, FriendlyByte registerS2CPayloadType(identifier); BufPayload payload = new BufPayload(buf, identifier); - NetworkManager.sendToPlayer(player, payload); + ServerPlayNetworking.send(player, payload); } public static void send(Iterable players, Identifier identifier, FriendlyByteBuf buf) { registerS2CPayloadType(identifier); BufPayload payload = new BufPayload(buf, identifier); - NetworkManager.sendToPlayers(players, payload); + for (ServerPlayer player : players) { + ServerPlayNetworking.send(player, payload); + } } public static void sendAll(MinecraftServer server, Identifier identifier, FriendlyByteBuf buf) { @@ -33,17 +35,16 @@ public static void sendAll(MinecraftServer server, Identifier identifier, Friend public static void registerReceiver(Identifier identifier, ServerNetworkHandler handler) { BufPayload.Type id = BufPayload.id(identifier); - NetworkManager.registerReceiver(NetworkManager.Side.C2S, id, BufPayload.getCodec(id), - (payload, context) -> { - FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); + ServerPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); - ServerPlayer player = null; - if (context.getPlayer() instanceof ServerPlayer) - player = (ServerPlayer) context.getPlayer(); + ServerPlayer player = null; + if (context.player() instanceof ServerPlayer) + player = context.player(); - handler.receive(context.getPlayer().level().getServer(), player, buf); - buf.release(); - }); + handler.receive(context.player().level().getServer(), player, buf); + buf.release(); + }); } private static final List registeredList = new ArrayList<>(); @@ -52,10 +53,8 @@ public static void registerS2CPayloadType(Identifier identifier) { if (registeredList.contains(identifier)) return; registeredList.add(identifier); - if (NetworkAggregator.S2C_CODECS.containsKey(identifier)) return; - BufPayload.Type id = BufPayload.id(identifier); - NetworkManager.registerS2CPayloadType(id, BufPayload.getCodec(id)); + PayloadTypeRegistry.serverboundPlay().register(id, BufPayload.getCodec(id)); } @FunctionalInterface diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java index 99534d294..d4beab35a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.recipe; -import net.minecraft.recipe.*; import net.minecraft.resources.ResourceKey; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java index 8d244f5fe..0bd546f71 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.state.property; -import net.minecraft.block.enums.*; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.ChestType; import net.minecraft.world.level.block.state.properties.ComparatorMode; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java index 94bf987ba..4a782142f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.tile; -import net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity; +import net.fabricmc.fabric.api.blockgetter.v2.RenderDataBlockEntity; import org.jetbrains.annotations.Nullable; public interface RenderAttachmentBlockEntity extends RenderDataBlockEntity { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java index fe003ced9..ea29c5b71 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.material.Fluid; import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; public class FabricFluidVariant implements IFluidVariant { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java index 85e70e38a..93dc7bfd6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java @@ -1,6 +1,10 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1; -import net.minecraft.fluid.Fluid; +import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; +import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; +import net.minecraft.world.level.material.Fluid; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric.FabricFluidStorage; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric.FabricFluidVariant; public class FluidStorageUtil { public static IFluidStorage withFixedCapacity(long capacity, Runnable onChange) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java index eae78e112..45aacc5ff 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java @@ -2,7 +2,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.item.ItemStack; @@ -72,7 +71,7 @@ public static boolean hasRandomTicks(BlockState state) { } public static void randomTick(BlockState state, ServerLevel world, BlockPos pos) { - state.randomTick(world, pos, world.random); + state.randomTick(world, pos, world.getRandom()); } public static CompatActionResult onUse(BlockState state, Level world, Player player, BlockHitResult hitResult) { @@ -83,11 +82,11 @@ public static CompatActionResult onUse(BlockState state, Level world, Player pla return onUse(state, world, player, BlockHitResultUtil.create(player.getPos(), dir, blockPos)); } - public static CompatActionResult onUseWithItem(BlockState state, ItemStack stack, Level world, Player player, InteractionHand hand, BlockHitResult hit) { + public static CompatActionResult onUseWithItem(BlockState state, ItemStack stack, Level world, net.minecraft.world.entity.player.Player player, InteractionHand hand, BlockHitResult hit) { return CompatActionResult.create(state.useItemOn(stack, world, player, hand, hit)); } - public static CompatActionResult onUseWithItem_actionResult(BlockState state, ItemStack stack, Level world, Player player, InteractionHand hand, BlockHitResult hit) { + public static CompatActionResult onUseWithItem_actionResult(BlockState state, ItemStack stack, Level world, net.minecraft.world.entity.player.Player player, InteractionHand hand, BlockHitResult hit) { return onUseWithItem(state, stack, world, player, hand, hit); } @@ -124,7 +123,7 @@ public static int getLuminance(BlockState state) { } public static int getOpacity(BlockState state) { - return state.getLightBlock(); + return state.getLightDampening(); } public static int getComparatorOutput(BlockState state, Level world, BlockPos pos) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java index 8bd088d55..7ed659dc2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java @@ -6,9 +6,9 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.saveddata.SavedData; -import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.saveddata.SavedDataType; import net.minecraft.world.level.Level; +import net.minecraft.world.level.storage.SavedDataStorage; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.world.CompatiblePersistentState; @@ -17,7 +17,7 @@ import java.util.function.Supplier; public class PersistentStateUtil { - public static T getOrCreate(DimensionDataStorage manager, String id, Supplier supplier, Function function) { + public static T getOrCreate(SavedDataStorage manager, String id, Supplier supplier, Function function) { Codec codec = CompoundTag.CODEC.xmap( // NBT -> PersistentState (nbt) -> { @@ -37,15 +37,15 @@ public static T getOrCreate(DimensionDataStorage manager, } ); - SavedDataType type = new SavedDataType<>(id, supplier, codec, DataFixTypes.LEVEL); + SavedDataType type = new SavedDataType<>(IdentifierUtil.id("mcpitanlib", id), supplier, codec, DataFixTypes.LEVEL); return manager.computeIfAbsent(type); } - public static DimensionDataStorage getManagerFromServer(MinecraftServer server) { + public static SavedDataStorage getManagerFromServer(MinecraftServer server) { return server.getLevel(Level.OVERWORLD).getDataStorage(); } - public static DimensionDataStorage getManagerFromWorld(ServerLevel world) { + public static SavedDataStorage getManagerFromWorld(ServerLevel world) { return world.getDataStorage(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java index ebfc9c287..1b2daea4a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java @@ -1,9 +1,7 @@ package net.pitan76.mcpitanlib.api.util; -import dev.architectury.injectables.annotations.ExpectPlatform; -import dev.architectury.platform.Platform; -import dev.architectury.utils.Env; import net.fabricmc.api.EnvType; +import net.fabricmc.loader.api.FabricLoader; import java.io.File; import java.nio.file.Path; @@ -11,19 +9,19 @@ public class PlatformUtil { public static boolean isDevelopmentEnvironment() { - return Platform.isDevelopmentEnvironment(); + return FabricLoader.getInstance().isDevelopmentEnvironment(); } public static boolean isFabric() { - return Platform.isFabric(); + return true; } public static boolean isForge() { - return Platform.isMinecraftForge(); + return false; } public static boolean isNeoForge() { - return Platform.isNeoForge(); + return false; } public static boolean isClient() { @@ -43,11 +41,11 @@ public static boolean isModLoaded(String id) { } public static Path getGameFolder() { - return Platform.getGameFolder(); + return FabricLoader.getInstance().getGameDir(); } public static Path getModsFolder() { - return Platform.getModsFolder(); + return FabricLoader.getInstance().getGameDir().resolve("mods"); } public static File getConfigFolderAsFile() { @@ -63,14 +61,14 @@ public static File getModsFolderAsFile() { } public static Collection getModIds() { - return Platform.getModIds(); + return FabricLoader.getInstance().getAllMods().stream().map(modContainer -> modContainer.getMetadata().getId()).toList(); } public static EnvType getEnv() { - return Platform.getEnv(); + return FabricLoader.getInstance().getEnvironmentType(); } public static String getGameVersion() { - return Platform.getMinecraftVersion(); + return FabricLoader.getInstance().getRawGameVersion(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java index 5d32eaf37..fa9df36a7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java @@ -1,14 +1,14 @@ package net.pitan76.mcpitanlib.api.util.client; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; public class BlockEntityRendererUtil { - public static BlockEntityRendererProvider.Context convert(CompatRegistryClient2.BlockEntityRendererFactory.Context ctx) { + public static BlockEntityRendererProvider.Context convert(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { return new BlockEntityRendererProvider.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getItemRenderer(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer(), ctx.getSpriteHolder(), ctx.getPlayerSkinRenderCache()); } - public static CompatRegistryClient2.BlockEntityRendererFactory.Context convert(BlockEntityRendererProvider.Context ctx) { - return new CompatRegistryClient2.BlockEntityRendererFactory.Context(ctx.blockEntityRenderDispatcher(), ctx.blockRenderDispatcher(), ctx.itemModelResolver(), ctx.itemRenderer(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.materials(), ctx.playerSkinRenderCache()); + public static CompatRegistryClient.BlockEntityRendererFactory.Context convert(BlockEntityRendererProvider.Context ctx) { + return new CompatRegistryClient.BlockEntityRendererFactory.Context(ctx.blockEntityRenderDispatcher(), ctx.blockRenderDispatcher(), ctx.itemModelResolver(), ctx.itemRenderer(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.materials(), ctx.playerSkinRenderCache()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java index dec1f836b..71075b679 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.util.entity; -import net.minecraft.entity.EquipmentSlot; +import net.minecraft.world.entity.EquipmentSlot; import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; public class EquipmentSlotUtil { @@ -24,12 +24,12 @@ public static int getEntitySlotId(EquipmentSlot slot) { if (slot == null) return 0; - return slot.getEntitySlotId(); + return slot.getId(); } public static EquipmentSlot fromEntitySlotId(int id) { for (EquipmentSlot slot : EquipmentSlot.values()) { - if (slot.getEntitySlotId() == id) { + if (slot.getId() == id) { return slot; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java index fd25ba9b9..d2a4d6149 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.util.inventory; import net.minecraft.world.entity.ContainerUser; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.Container; import net.minecraft.world.SimpleContainer; import net.minecraft.world.item.Item; @@ -64,7 +63,7 @@ public ItemStack removeItemType(Item item, int count) { @Override public void startOpen(ContainerUser user) { if (user instanceof Player) { - onOpen(new Player((Player) user)); + onOpen(new Player((net.minecraft.world.entity.player.Player) user)); return; } @@ -76,7 +75,7 @@ public void startOpen(ContainerUser user) { @Override public void stopOpen(ContainerUser user) { if (user instanceof Player) { - onClose(new Player((Player) user)); + onClose(new Player((net.minecraft.world.entity.player.Player) user)); return; } @@ -95,7 +94,7 @@ public void stopOpen(ContainerUser user) { @Deprecated @Override - public boolean stillValid(Player player) { + public boolean stillValid(net.minecraft.world.entity.player.Player player) { return canPlayerUse(new Player(player)); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java index a2b163d06..a205b2958 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java @@ -4,7 +4,6 @@ import net.minecraft.core.Direction; import net.minecraft.core.Position; import net.minecraft.core.Vec3i; -import net.minecraft.util.math.*; import net.minecraft.world.phys.Vec3; public class PosUtil { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java index 5caf230da..03042c58f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.util.particle; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.particle.*; public class CompatParticleTypes { public static final CompatParticleType ANGRY_VILLAGER = new CompatParticleType(ParticleTypes.ANGRY_VILLAGER); diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java index 51352c74c..f0b1bc976 100644 --- a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java @@ -6,7 +6,7 @@ import net.minecraft.client.gui.screens.inventory.MenuAccess; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; @@ -27,13 +27,13 @@ public static Supplier> register(C } @Environment(EnvType.CLIENT) - public static > void register(String id, MenuType type, CompatRegistryClient2.ScreenFactory factory) { - CompatRegistryClient2.registerScreen(id, type, factory); + public static > void register(String id, MenuType type, CompatRegistryClient.ScreenFactory factory) { + CompatRegistryClient.registerScreen(id, type, factory); } @Environment(EnvType.CLIENT) public static void registerSimpleContainerGui(String id, MenuType type) { - CompatRegistryClient2.registerScreen(id, type, SimpleContainerGuiScreen::new); + CompatRegistryClient.registerScreen(id, type, SimpleContainerGuiScreen::new); } public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java index 4100fd3da..b49692dc9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java @@ -6,7 +6,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.util.BlockRotation; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; +import net.minecraft.core.Direction; import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java index 0fae5104a..aa3b041be 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java @@ -1,11 +1,11 @@ package net.pitan76.mcpitanlib.test; -import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient2; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; import net.pitan76.mcpitanlib.guilib.GuiRegistry; public class ExampleModClient { public static void init() { - CompatRegistryClient2.registerScreen(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_SCREENHANDLER.get(), ExampleScreen::new); + CompatRegistryClient.registerScreen(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_SCREENHANDLER.get(), ExampleScreen::new); GuiRegistry.registerSimpleContainerGui(ExampleMod.MOD_ID, ExampleMod.EXAMPLE_CONTAINER_GUI.get()); } From 1d45f3caaeb31918935e9f103fe546e3b3ee67de Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 17:09:00 +0900 Subject: [PATCH 012/151] port to 26.1-3 --- .../api/block/CompatibleBlockSettings.java | 4 +- .../api/block/v2/CompatibleBlockSettings.java | 2 +- .../mcpitanlib/api/item/ExtendSettings.java | 2 +- .../api/util/PlayerManagerUtil.java | 3 +- .../mcpitanlib/api/util/PlayerUtil.java | 5 +- .../mcpitanlib/api/util/PropertyUtil.java | 1 - .../midohra/component/ItemComponentTypes.java | 72 +++++---- .../midohra/recipe/CraftingRecipe.java | 6 +- .../mcpitanlib/midohra/recipe/Recipe.java | 2 +- .../midohra/recipe/ShapedRecipe.java | 6 +- .../midohra/recipe/ShapelessRecipe.java | 6 +- .../midohra/util/math/ChunkPos.java | 10 +- .../AbstractBlock4CompatProviderMixin.java | 46 +++--- .../mcpitanlib/mixin/AbstractBlockMixin.java | 85 +++++------ .../BlockBehaviour4CompatProviderMixin.java | 97 ------------ .../mcpitanlib/mixin/BlockBehaviourMixin.java | 139 ------------------ .../mixin/ItemUsageContextMixin.java | 14 -- .../mcpitanlib/mixin/LevelRendererMixin.java | 8 +- .../mcpitanlib/mixin/RecipeManagerMixin.java | 1 - .../mcpitanlib/mixin/ServerLevelTimer.java | 3 +- .../mcpitanlib/mixin/ServerWorldTimer.java | 40 ----- .../mcpitanlib/mixin/WorldRendererMixin.java | 106 ------------- .../resources/mcpitanlib-common.mixins.json | 2 +- src/main/resources/mcpitanlib.accesswidener | 1 + src/main/resources/mcpitanlib.mixins.json | 14 -- 25 files changed, 122 insertions(+), 553 deletions(-) delete mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java delete mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java delete mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java delete mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java delete mode 100644 src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java delete mode 100644 src/main/resources/mcpitanlib.mixins.json diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java index f905b92aa..d00af1584 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java @@ -107,8 +107,8 @@ public CompatibleBlockSettings blockVision(BlockBehaviour.StatePredicate predica return this; } - public CompatibleBlockSettings postProcess(BlockBehaviour.StatePredicate predicate) { - settings.hasPostProcess(predicate); + public CompatibleBlockSettings postProcess(BlockBehaviour.PostProcess predicate) { + settings.postProcess(predicate); return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java index d1e7a76f7..0a06eb1d1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java @@ -120,7 +120,7 @@ public CompatibleBlockSettings blockVision(BlockBehaviour.StatePredicate predica return this; } - public CompatibleBlockSettings postProcess(BlockBehaviour.StatePredicate predicate) { + public CompatibleBlockSettings postProcess(BlockBehaviour.PostProcess predicate) { super.postProcess(predicate); return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java index ccb9da55d..c1b76fb09 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java @@ -21,7 +21,7 @@ public ExtendSettings addGroup(CreativeModeTab itemGroup) { // identifier: Item ID @Deprecated public ExtendSettings addGroup(CreativeModeTab itemGroup, Identifier identifier) { - this.arch$tab(itemGroup); +// this.arch$tab(itemGroup); CreativeTabManager.addItem(itemGroup, identifier); return this; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java index 7fd5e9ea3..3c38b801f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.world.entity.player.Player; import net.minecraft.server.MinecraftServer; import net.minecraft.server.players.PlayerList; import net.minecraft.world.level.Level; @@ -58,7 +57,7 @@ public static List getPlayers(MinecraftServer server) { */ public static List getPlayers(Level world) { List players = new ArrayList<>(); - for (Player p : world.players()) { + for (net.minecraft.world.entity.player.Player p : world.players()) { players.add(new Player(p)); } return players; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java index 7afaf6848..141711dfb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.util; -import net.minecraft.world.entity.player.Player; import net.minecraft.server.MinecraftServer; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; @@ -22,7 +21,7 @@ public static Player getPlayerByName(MinecraftServer server, String name) { public static List getPlayersByIP(MinecraftServer server, String ip) { List players = new ArrayList<>(); - for (Player p: server.getPlayerList().getPlayersWithAddress(ip)) { + for (net.minecraft.world.entity.player.Player p: server.getPlayerList().getPlayersWithAddress(ip)) { players.add(new Player(p)); } return players; @@ -30,7 +29,7 @@ public static List getPlayersByIP(MinecraftServer server, String ip) { public static List getPlayers(MinecraftServer server) { List players = new ArrayList<>(); - for (Player p : server.getPlayerList().getPlayers()) { + for (net.minecraft.world.entity.player.Player p : server.getPlayerList().getPlayers()) { players.add(new Player(p)); } return players; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java index e5ad44042..d36f78b91 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java @@ -8,7 +8,6 @@ import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.block.state.properties.StairsShape; -import net.minecraft.state.property.*; import net.minecraft.util.StringRepresentable; import net.minecraft.core.Direction; import net.pitan76.mcpitanlib.api.event.block.AppendPropertiesArgs; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java b/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java index 5fba94d39..0d57e2eff 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java @@ -1,15 +1,13 @@ -// TODO(Ravel): Failed to fully resolve file: null cannot be cast to non-null type com.intellij.psi.PsiJavaCodeReferenceElement -// TODO(Ravel): Failed to fully resolve file: null cannot be cast to non-null type com.intellij.psi.PsiJavaCodeReferenceElement package net.pitan76.mcpitanlib.midohra.component; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.TypedEntityData; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.text.Text; -import net.minecraft.util.Rarity; +import net.minecraft.core.component.DataComponents; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; import net.minecraft.util.Unit; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.component.TypedEntityData; import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; import net.pitan76.mcpitanlib.api.util.*; import net.pitan76.mcpitanlib.midohra.component.item.CustomNameComponentType; @@ -19,34 +17,34 @@ import java.util.List; public class ItemComponentTypes { - public static final ItemComponentType CUSTOM_DATA = new ItemComponentType<>(DataComponentTypes.CUSTOM_DATA) { + public static final ItemComponentType CUSTOM_DATA = new ItemComponentType<>(DataComponents.CUSTOM_DATA) { @Override - public void put(ItemStack stack, NbtCompound value) { + public void put(ItemStack stack, CompoundTag value) { CustomDataUtil.setNbt(stack, value); } @Override - public NbtCompound get(ItemStack stack) { + public CompoundTag get(ItemStack stack) { return CustomDataUtil.getNbt(stack); } }; - public static final ItemComponentType MAX_STACK_SIZE = new ItemComponentType<>(DataComponentTypes.MAX_STACK_SIZE) { + public static final ItemComponentType MAX_STACK_SIZE = new ItemComponentType<>(DataComponents.MAX_STACK_SIZE) { @Override public void put(ItemStack stack, Integer value) { - stack.set(DataComponentTypes.MAX_STACK_SIZE, value); + stack.set(DataComponents.MAX_STACK_SIZE, value); } @Override public Integer get(ItemStack stack) { - return stack.getMaxCount(); + return stack.getMaxStackSize(); } }; - public static final ItemComponentType MAX_DAMAGE = new ItemComponentType<>(DataComponentTypes.MAX_DAMAGE) { + public static final ItemComponentType MAX_DAMAGE = new ItemComponentType<>(DataComponents.MAX_DAMAGE) { @Override public void put(ItemStack stack, Integer value) { - stack.set(DataComponentTypes.MAX_DAMAGE, value); + stack.set(DataComponents.MAX_DAMAGE, value); } @Override @@ -55,25 +53,25 @@ public Integer get(ItemStack stack) { } }; - public static final ItemComponentType DAMAGE = new ItemComponentType<>(DataComponentTypes.DAMAGE) { + public static final ItemComponentType DAMAGE = new ItemComponentType<>(DataComponents.DAMAGE) { @Override public void put(ItemStack stack, Integer value) { - stack.setDamage(value); + stack.setDamageValue(value); } @Override public Integer get(ItemStack stack) { - return stack.getDamage(); + return stack.getDamageValue(); } }; - public static final ItemComponentType UNBREAKABLE = new ItemComponentType<>(DataComponentTypes.UNBREAKABLE) { + public static final ItemComponentType UNBREAKABLE = new ItemComponentType<>(DataComponents.UNBREAKABLE) { @Override public void put(ItemStack stack, Boolean value) { if (value) { - stack.set(DataComponentTypes.UNBREAKABLE, Unit.valueOf("")); + stack.set(DataComponents.UNBREAKABLE, Unit.valueOf("")); } else { - stack.remove(DataComponentTypes.UNBREAKABLE); + stack.remove(DataComponents.UNBREAKABLE); } } @@ -87,47 +85,47 @@ public Boolean get(ItemStack stack) { public static final CustomNameComponentType CUSTOM_NAME = new CustomNameComponentType(); - public static final ItemComponentType BLOCK_ENTITY_DATA = new ItemComponentType<>(DataComponentTypes.BLOCK_ENTITY_DATA) { + public static final ItemComponentType BLOCK_ENTITY_DATA = new ItemComponentType<>(DataComponents.BLOCK_ENTITY_DATA) { @Override - public void put(ItemStack stack, NbtCompound value) { + public void put(ItemStack stack, CompoundTag value) { BlockEntityDataUtil.setBlockEntityNbt(stack, value); } @Override - public NbtCompound get(ItemStack stack) { + public CompoundTag get(ItemStack stack) { return BlockEntityDataUtil.getBlockEntityNbt(stack); } }; - public static final ItemComponentType ENTITY_DATA = new ItemComponentType<>(DataComponentTypes.ENTITY_DATA) { + public static final ItemComponentType ENTITY_DATA = new ItemComponentType<>(DataComponents.ENTITY_DATA) { @Override - public void put(ItemStack stack, NbtCompound value) { + public void put(ItemStack stack, CompoundTag value) { EntityType type = EntityTypeUtil.fromId(CompatIdentifier.of(NbtUtil.getString(value, "id"))); - stack.set(DataComponentTypes.ENTITY_DATA, TypedEntityData.create(type, value)); + stack.set(DataComponents.ENTITY_DATA, TypedEntityData.of(type, value)); } @Override - public NbtCompound get(ItemStack stack) { + public CompoundTag get(ItemStack stack) { if (!has(stack)) return NbtUtil.create(); - if (!stack.contains(DataComponentTypes.ENTITY_DATA)) return NbtUtil.create(); + if (!stack.has(DataComponents.ENTITY_DATA)) return NbtUtil.create(); - TypedEntityData> data = stack.get(DataComponentTypes.ENTITY_DATA); - NbtCompound nbt = data.copyNbtWithoutId(); + TypedEntityData> data = stack.get(DataComponents.ENTITY_DATA); + CompoundTag nbt = data.copyTagWithoutId(); - String id = EntityTypeUtil.toID(data.getType()).toString(); + String id = EntityTypeUtil.toID(data.type()).toString(); NbtUtil.putString(nbt, "id", id); return nbt; } }; - public static final ItemComponentType> LORE = new ItemComponentType<>(DataComponentTypes.LORE) { + public static final ItemComponentType> LORE = new ItemComponentType<>(DataComponents.LORE) { @Override - public void put(ItemStack stack, List value) { + public void put(ItemStack stack, List value) { LoreUtil.setLore(stack, value); } @Override - public List get(ItemStack stack) { + public List get(ItemStack stack) { return LoreUtil.getLore(stack); } }; diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java index 9f32076a9..361c4d769 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java @@ -37,7 +37,7 @@ public boolean matches(CraftingRecipeInputOrInventory input, World world) { } public net.minecraft.world.item.ItemStack craft(CraftingRecipeInputOrInventory input, World world) { - return getRaw().assemble(input.getRaw(), world.getRaw().registryAccess()); + return getRaw().assemble(input.getRaw()); } public ItemStack craftMidohra(CraftingRecipeInputOrInventory input, World world) { @@ -45,11 +45,11 @@ public ItemStack craftMidohra(CraftingRecipeInputOrInventory input, World world) } public net.minecraft.world.item.ItemStack craft(CraftingRecipeInputOrInventory input, CompatRegistryLookup registryLookup) { - return getRaw().assemble(input.getRaw(), registryLookup.getRegistryLookup()); + return getRaw().assemble(input.getRaw()); } public net.minecraft.world.item.ItemStack craft(CraftingRecipeInputOrInventory input, net.minecraft.world.level.Level world) { - return getRaw().assemble(input.getRaw(), world.registryAccess()); + return getRaw().assemble(input.getRaw()); } public NonNullList getRecipeRemaindersDefaultedList(CraftingRecipeInputOrInventory input) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java index f7f04f031..8d97c6c2b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java @@ -70,7 +70,7 @@ public boolean matches(TypedRecipeInputOrInventory in } public net.minecraft.world.item.ItemStack craft(TypedRecipeInputOrInventory input, World world) { - return ((net.minecraft.world.item.crafting.Recipe)getRaw()).assemble(input.getRecipeInput(), world.getRaw().registryAccess()); + return ((net.minecraft.world.item.crafting.Recipe)getRaw()).assemble(input.getRecipeInput()); } public ItemStack craftMidohra(TypedRecipeInputOrInventory input, World world) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java index 3c46a0bce..789f4e20b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java @@ -31,15 +31,15 @@ public boolean matches(CraftingRecipeInputOrInventory input) { @Deprecated public net.minecraft.world.item.ItemStack craft() { - return getRaw().assemble(null, null); + return getRaw().assemble(null); } public net.minecraft.world.item.ItemStack craft(CompatRegistryLookup registryLookup) { - return getRaw().assemble(null, registryLookup.getRegistryLookup()); + return getRaw().assemble(null); } public net.minecraft.world.item.ItemStack craft(Level world) { - return getRaw().assemble(null, world.registryAccess()); + return getRaw().assemble(null); } public net.minecraft.world.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java index 5bb66e652..af065075b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java @@ -31,15 +31,15 @@ public boolean matches(CraftingRecipeInputOrInventory input) { @Deprecated public net.minecraft.world.item.ItemStack craft() { - return getRaw().assemble(null, null); + return getRaw().assemble(null); } public net.minecraft.world.item.ItemStack craft(CompatRegistryLookup registryLookup) { - return getRaw().assemble(null, registryLookup.getRegistryLookup()); + return getRaw().assemble(null); } public net.minecraft.world.item.ItemStack craft(Level world) { - return getRaw().assemble(null, world.registryAccess()); + return getRaw().assemble(null); } public net.minecraft.world.item.ItemStack craft(net.pitan76.mcpitanlib.midohra.world.World world) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java index 320522cc0..da874f08d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java @@ -18,11 +18,11 @@ public static ChunkPos of(int x, int z) { } public static ChunkPos of(BlockPos pos) { - return of(new net.minecraft.world.level.ChunkPos(pos.toMinecraft())); + return of(net.minecraft.world.level.ChunkPos.containing(pos.toMinecraft())); } public static ChunkPos of(long pos) { - return of(new net.minecraft.world.level.ChunkPos(pos)); + return of(net.minecraft.world.level.ChunkPos.unpack(pos)); } public static ChunkPos fromRegion(int x, int z) { @@ -42,11 +42,11 @@ public net.minecraft.world.level.ChunkPos toMinecraft() { } public int getX() { - return getRaw().x; + return getRaw().x(); } public int getZ() { - return getRaw().z; + return getRaw().z(); } public int getOffsetX(int offsetX) { @@ -110,7 +110,7 @@ public BlockPos getBlockPos(int offsetX, int y, int offsetZ) { } public long toLong() { - return getRaw().toLong(); + return getRaw().pack(); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java index b49692dc9..55c378ba5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.ScheduledTickAccess; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; @@ -27,11 +27,10 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -@Mixin(AbstractBlock.class) +@Mixin(BlockBehaviour.class) public class AbstractBlock4CompatProviderMixin { - // TODO(Ravel): no target class @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; Options options = new Options(); @@ -41,9 +40,8 @@ public class AbstractBlock4CompatProviderMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + @Inject(method = "getShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; Options options = new Options(); @@ -53,9 +51,8 @@ public class AbstractBlock4CompatProviderMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getStateForNeighborUpdate", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random, CallbackInfoReturnable cir) { + @Inject(method = "updateShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getStateForNeighborUpdate(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random, CallbackInfoReturnable cir) { if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; Options options = new Options(); @@ -65,9 +62,8 @@ public class AbstractBlock4CompatProviderMixin { } } - // TODO(Ravel): no target class @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getRenderType(BlockState state, CallbackInfoReturnable cir) { + private void mcpitanlib$inject_getRenderType(BlockState state, CallbackInfoReturnable cir) { if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; Options options = new Options(); @@ -77,9 +73,8 @@ public class AbstractBlock4CompatProviderMixin { } } - // TODO(Ravel): no target class @Inject(method = "rotate", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_rotate(BlockState state, BlockRotation rotation, CallbackInfoReturnable cir) { + private void mcpitanlib$inject_rotate(BlockState state, Rotation rotation, CallbackInfoReturnable cir) { if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; Options options = new Options(); @@ -89,8 +84,7 @@ public class AbstractBlock4CompatProviderMixin { } } - // TODO(Ravel): no target class - @Inject(method = "isSideInvisible", at = @At("HEAD"), cancellable = true) + @Inject(method = "skipRendering", at = @At("HEAD"), cancellable = true) private void mcpitanlib$inject_isSideInvisible(BlockState state, BlockState stateFrom, Direction direction, CallbackInfoReturnable cir) { if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java index 683e7526e..903b4c388 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java @@ -1,23 +1,23 @@ package net.pitan76.mcpitanlib.mixin; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.SimpleNamedScreenHandlerFactory; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; import net.pitan76.mcpitanlib.api.event.block.*; @@ -30,12 +30,10 @@ import java.util.List; -// TODO(Ravel): can not resolve target class AbstractBlock -@Mixin(AbstractBlock.class) +@Mixin(BlockBehaviour.class) public class AbstractBlockMixin { - // TODO(Ravel): no target class @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); @@ -45,9 +43,8 @@ public class AbstractBlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { + @Inject(method = "getShape", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); @@ -57,9 +54,8 @@ public class AbstractBlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "scheduledTick", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random, CallbackInfo ci) { + @Inject(method = "tick", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_scheduledTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random, CallbackInfo ci) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); @@ -69,34 +65,31 @@ public class AbstractBlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable cir) { + @Inject(method = "useWithoutItem", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_onUse(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit, CallbackInfoReturnable cir) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); - CompatActionResult returnValue = provider.onRightClick(new BlockUseEvent(state, world, pos, player, player.getActiveHand(), hit), options); + CompatActionResult returnValue = provider.onRightClick(new BlockUseEvent(state, world, pos, player, player.getUsedItemHand(), hit), options); if (options.cancel && returnValue != null) cir.setReturnValue(returnValue.toActionResult()); } } - // TODO(Ravel): no target class - @Inject(method = "createScreenHandlerFactory", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_createScreenHandlerFactory(BlockState state, World world, BlockPos pos, CallbackInfoReturnable cir) { + @Inject(method = "getMenuProvider", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_createScreenHandlerFactory(BlockState state, Level world, BlockPos pos, CallbackInfoReturnable cir) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); - NamedScreenHandlerFactory returnValue = new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> + SimpleMenuProvider returnValue = new SimpleMenuProvider((syncId, inventory, player) -> provider.createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player), options), provider.getScreenTitle()); if (options.cancel && returnValue != null) cir.setReturnValue(returnValue); } } - // TODO(Ravel): no target class - @Inject(method = "onStateReplaced", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved, CallbackInfo ci) { + @Inject(method = "affectNeighborsAfterRemoval", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_onStateReplaced(BlockState state, ServerLevel world, BlockPos pos, boolean moved, CallbackInfo ci) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); @@ -106,9 +99,8 @@ public class AbstractBlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getDroppedStacks", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getDroppedStacks(BlockState state, LootWorldContext.Builder builder, CallbackInfoReturnable> cir) { + @Inject(method = "getDrops", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_getDroppedStacks(BlockState state, LootParams.Builder builder, CallbackInfoReturnable> cir) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); @@ -119,8 +111,8 @@ public class AbstractBlockMixin { } // TODO(Ravel): no target class - @Inject(method = "canPathfindThrough", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_canPathfindThrough(BlockState state, NavigationType type, CallbackInfoReturnable cir) { + @Inject(method = "isPathfindable", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$inject_canPathfindThrough(BlockState state, PathComputationType type, CallbackInfoReturnable cir) { if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; Options options = new Options(); @@ -130,9 +122,8 @@ public class AbstractBlockMixin { } } - // TODO(Ravel): no target class - @Inject(method = "getPickStack", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData, CallbackInfoReturnable cir) { + @Inject(method = "getCloneItemStack", at = @At("HEAD"), cancellable = true) + private void mcpitanlib$getPickStack(LevelReader world, BlockPos pos, BlockState state, boolean includeData, CallbackInfoReturnable cir) { // ExtendBlockProviderを実装している場合 (1.21.5からAbstractBlockに移転) if (this instanceof ExtendBlockProvider) { ExtendBlockProvider provider = (ExtendBlockProvider) this; diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java deleted file mode 100644 index 47fc6d3ff..000000000 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviour4CompatProviderMixin.java +++ /dev/null @@ -1,97 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.block.RenderShape; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.level.block.Rotation; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.util.RandomSource; -import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.ScheduledTickAccess; -import net.pitan76.mcpitanlib.api.block.CompatBlockRenderType; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; -import net.pitan76.mcpitanlib.api.block.args.RenderTypeArgs; -import net.pitan76.mcpitanlib.api.block.args.RotateArgs; -import net.pitan76.mcpitanlib.api.block.args.SideInvisibleArgs; -import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.block.args.v2.StateForNeighborUpdateArgs; -import net.pitan76.mcpitanlib.api.block.v2.CompatBlockProvider; -import net.pitan76.mcpitanlib.api.util.math.random.CompatRandom; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(BlockBehaviour.class) -public class BlockBehaviour4CompatProviderMixin { - @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "updateShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getStateForNeighborUpdate(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.getStateForNeighborUpdate(new StateForNeighborUpdateArgs(state, direction, neighborState, world, pos, neighborPos, tickView, new CompatRandom(random)), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toMinecraft()); - } - } - - @Inject(method = "getRenderShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getRenderType(BlockState state, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - CompatBlockRenderType returnValue = provider.getRenderType(new RenderTypeArgs(state), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toMinecraft()); - } - } - - @Inject(method = "rotate", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_rotate(BlockState state, Rotation rotation, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - net.pitan76.mcpitanlib.midohra.block.BlockState returnValue = provider.rotate(new RotateArgs(state, rotation), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toMinecraft()); - } - } - - @Inject(method = "skipRendering", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_isSideInvisible(BlockState state, BlockState stateFrom, Direction direction, CallbackInfoReturnable cir) { - if (this instanceof CompatBlockProvider) { - CompatBlockProvider provider = (CompatBlockProvider) this; - Options options = new Options(); - Boolean returnValue = provider.isSideInvisible(new SideInvisibleArgs(state, stateFrom, direction), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } -} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java deleted file mode 100644 index a8c598197..000000000 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockBehaviourMixin.java +++ /dev/null @@ -1,139 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.level.pathfinder.PathComputationType; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.storage.loot.LootParams; -import net.minecraft.world.MenuProvider; -import net.minecraft.world.SimpleMenuProvider; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.core.BlockPos; -import net.minecraft.util.RandomSource; -import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraft.world.level.BlockGetter; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelReader; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider; -import net.pitan76.mcpitanlib.api.block.ExtendBlockProvider.Options; -import net.pitan76.mcpitanlib.api.event.block.*; -import net.pitan76.mcpitanlib.api.util.CompatActionResult; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.List; - -@Mixin(BlockBehaviour.class) -public class BlockBehaviourMixin { - @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getCollisionShape(new CollisionShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getShape", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getOutlineShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - VoxelShape returnValue = provider.getOutlineShape(new OutlineShapeEvent(state, world, pos, context), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "tick", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_scheduledTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random, CallbackInfo ci) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - provider.scheduledTick(new BlockScheduledTickEvent(state, world, pos, random), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "useWithoutItem", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_onUse(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - CompatActionResult returnValue = provider.onRightClick(new BlockUseEvent(state, world, pos, player, player.getUsedItemHand(), hit), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue.toActionResult()); - } - } - - @Inject(method = "getMenuProvider", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_createScreenHandlerFactory(BlockState state, Level world, BlockPos pos, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - MenuProvider returnValue = new SimpleMenuProvider((syncId, inventory, player) -> - provider.createScreenHandler(new ScreenHandlerCreateEvent(state, world, pos, syncId, inventory, player), options), provider.getScreenTitle()); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "affectNeighborsAfterRemoval", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_onStateReplaced(BlockState state, ServerLevel world, BlockPos pos, boolean moved, CallbackInfo ci) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - provider.onStateReplaced(new StateReplacedEvent(state, world, pos, world.getBlockState(pos), moved), options); - if (options.cancel) - ci.cancel(); - } - } - - @Inject(method = "getDrops", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_getDroppedStacks(BlockState state, LootParams.Builder builder, CallbackInfoReturnable> cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - List returnValue = provider.getDroppedStacks(new DroppedStacksArgs(state, builder), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "isPathfindable", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$inject_canPathfindThrough(BlockState state, PathComputationType type, CallbackInfoReturnable cir) { - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - Boolean returnValue = provider.canPathfindThrough(new CanPathfindThroughArgs(state, type), options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } - - @Inject(method = "getCloneItemStack", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getPickStack(LevelReader world, BlockPos pos, BlockState state, boolean includeData, CallbackInfoReturnable cir) { - // ExtendBlockProviderを実装している場合 (1.21.5からAbstractBlockに移転) - if (this instanceof ExtendBlockProvider) { - ExtendBlockProvider provider = (ExtendBlockProvider) this; - Options options = new Options(); - - PickStackEvent event = new PickStackEvent(world, pos, state); - event.setIncludeData(includeData); - - ItemStack returnValue = provider.getPickStack(event, options); - if (options.cancel && returnValue != null) - cir.setReturnValue(returnValue); - } - } -} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java deleted file mode 100644 index 808caaf45..000000000 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemUsageContextMixin.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.item.ItemUsageContext; -import net.minecraft.util.hit.BlockHitResult; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -// TODO(Ravel): can not resolve target class ItemUsageContext -@Mixin(ItemUsageContext.class) -public interface ItemUsageContextMixin { - // TODO(Ravel): Could not determine a single target - @Accessor - public BlockHitResult getHit(); -} \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java index 4d3295fb9..5edc5269e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java @@ -7,16 +7,15 @@ import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; -import net.minecraft.client.render.*; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.WorldBorderRenderer; import net.minecraft.client.renderer.culling.Frustum; -import net.minecraft.client.renderer.state.WorldBorderRenderState; -import net.minecraft.client.renderer.state.LevelRenderState; import com.mojang.blaze3d.resource.GraphicsResourceAllocator; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.state.level.LevelRenderState; +import net.minecraft.client.renderer.state.level.WorldBorderRenderState; import net.minecraft.world.phys.Vec3; import net.minecraft.world.level.border.WorldBorder; import net.pitan76.mcpitanlib.api.client.event.WorldRenderRegistry; @@ -41,7 +40,6 @@ public abstract class LevelRendererMixin { @Shadow @Nullable public abstract Frustum getCapturedFrustum(); @Shadow @Final private Minecraft minecraft; - @Shadow @Final private LevelRenderState levelRenderState; @Shadow @Nullable private ClientLevel level; @Unique private final WorldRenderContextImpl mcpitanlib$contextCache = new WorldRenderContextImpl(); @@ -68,7 +66,7 @@ public abstract class LevelRendererMixin { @Inject(method = "renderLevel", at = @At("HEAD")) private void beforeRender(GraphicsResourceAllocator allocator, DeltaTracker tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci) { - mcpitanlib$contextCache.prepare(minecraft.gameRenderer, (LevelRenderer) (Object) this, levelRenderState, level, tickCounter, renderBlockOutline, camera, positionMatrix, matrix4f, projectionMatrix); + mcpitanlib$contextCache.prepare(minecraft.gameRenderer, (LevelRenderer) (Object) this, level, tickCounter, renderBlockOutline, camera, positionMatrix, matrix4f, projectionMatrix); } @ModifyExpressionValue(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;prepareCullFrustum(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/world/phys/Vec3;)Lnet/minecraft/client/renderer/culling/Frustum;")) diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java index 839da0438..b8db642b4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.mixin; import com.llamalad7.mixinextras.sugar.Local; -import net.minecraft.recipe.*; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.resources.Identifier; import net.minecraft.util.profiling.ProfilerFiller; diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java index 496875c7a..43ea885fa 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.function.BooleanSupplier; import java.util.function.Supplier; @Mixin(ServerLevel.class) @@ -19,7 +20,7 @@ public class ServerLevelTimer implements ServerWorldTimerAccess { private final List mcpitanlib$timerItems = new ArrayList<>(); @Inject(method = "tick", at = @At("TAIL")) - private void onTick(CallbackInfo ci) { + private void onTick(CallbackInfo ci, BooleanSupplier haveTime) { if (mcpitanlib$timerItems.isEmpty()) return; List items = new ArrayList<>(mcpitanlib$timerItems); diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java deleted file mode 100644 index e0c34206d..000000000 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerWorldTimer.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import net.minecraft.server.world.ServerWorld; -import net.pitan76.mcpitanlib.api.timer.ServerWorldTimerAccess; -import net.pitan76.mcpitanlib.api.timer.TimerItem; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; - -// TODO(Ravel): can not resolve target class ServerWorld -@Mixin(ServerWorld.class) -public class ServerWorldTimer implements ServerWorldTimerAccess { - @Unique - private final List mcpitanlib$timerItems = new ArrayList<>(); - - // TODO(Ravel): no target class - @Inject(method = "tick", at = @At("TAIL")) - private void onTick(CallbackInfo ci) { - if (mcpitanlib$timerItems.isEmpty()) return; - List items = new ArrayList<>(mcpitanlib$timerItems); - - for (TimerItem item : items) { - if (--item.ticksUntilSomething == 0L) { - if (item.executeSupplier.get()) - mcpitanlib$timerItems.remove(item); - } - } - } - - @Override - public void mcpitanlib$addTimer(long ticksUntilSomething, Supplier executeSupplier) { - mcpitanlib$timerItems.add(new TimerItem(ticksUntilSomething, executeSupplier)); - } -} diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java deleted file mode 100644 index 27f73185b..000000000 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/WorldRendererMixin.java +++ /dev/null @@ -1,106 +0,0 @@ -package net.pitan76.mcpitanlib.mixin; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.mojang.blaze3d.buffers.GpuBufferSlice; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.client.render.state.WorldBorderRenderState; -import net.minecraft.client.render.state.WorldRenderState; -import net.minecraft.client.util.ObjectAllocator; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.border.WorldBorder; -import net.pitan76.mcpitanlib.api.client.event.WorldRenderRegistry; -import net.pitan76.mcpitanlib.api.client.event.listener.*; -import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; -import org.joml.Vector4f; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -// TODO(Ravel): can not resolve target class WorldRenderer -// TODO(Ravel): can not resolve target class WorldRenderer -@Mixin(WorldRenderer.class) -public abstract class WorldRendererMixin { - // TODO(Ravel): Could not determine a single target -// TODO(Ravel): Could not determine a single target - @Shadow private int ticks; - - // TODO(Ravel): Could not determine a single target -// TODO(Ravel): Could not determine a single target - @Shadow public abstract boolean isTerrainRenderComplete(); - - // TODO(Ravel): Could not determine a single target -// TODO(Ravel): Could not determine a single target - @Shadow @Nullable public abstract Frustum getCapturedFrustum(); - - // TODO(Ravel): Could not determine a single target -// TODO(Ravel): Could not determine a single target - @Shadow @Final private MinecraftClient client; - // TODO(Ravel): Could not determine a single target -// TODO(Ravel): Could not determine a single target - @Shadow @Final private WorldRenderState worldRenderState; - // TODO(Ravel): Could not determine a single target -// TODO(Ravel): Could not determine a single target - @Shadow @Nullable private ClientWorld world; - @Unique - private final WorldRenderContextImpl mcpitanlib$contextCache = new WorldRenderContextImpl(); - - // TODO(Ravel): no target class -// TODO(Ravel): no target class - @Inject(method = "renderTargetBlockOutline", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$onRenderTargetBlockOutline(VertexConsumerProvider.Immediate immediate, MatrixStack matrices, boolean renderBlockOutline, WorldRenderState renderStates, CallbackInfo ci) { - if (WorldRenderRegistry.isEmptyBlockOutlineListeners) return; - - mcpitanlib$contextCache.worldRenderer = (WorldRenderer)(Object) this; - mcpitanlib$contextCache.advancedTranslucency = isTerrainRenderComplete(); - mcpitanlib$contextCache.consumers = immediate; - mcpitanlib$contextCache.matrixStack = matrices; - mcpitanlib$contextCache.tickDelta = ticks; - - BeforeBlockOutlineEvent event = new BeforeBlockOutlineEvent(mcpitanlib$contextCache, MinecraftClient.getInstance().crosshairTarget); - - for (BeforeBlockOutlineListener listener : WorldRenderRegistry.beforeBlockOutlineListeners) { - if (!listener.beforeBlockOutline(event)) { - ci.cancel(); - return; - } - } - } - - // TODO(Ravel): no target class -// TODO(Ravel): no target class - @Inject(method = "render", at = @At("HEAD")) - private void beforeRender(ObjectAllocator allocator, RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci) { - mcpitanlib$contextCache.prepare(client.gameRenderer, (WorldRenderer) (Object) this, worldRenderState, world, tickCounter, renderBlockOutline, camera, positionMatrix, matrix4f, projectionMatrix); - } - - // TODO(Ravel): no target class -// TODO(Ravel): no target class - @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupFrustum(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/client/render/Frustum;")) - private Frustum onSetupFrustum(Frustum frustum) { - mcpitanlib$contextCache.frustum = frustum; - return frustum; - } - - - // TODO(Ravel): no target class -// TODO(Ravel): no target class - @WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldBorderRendering;updateRenderState(Lnet/minecraft/world/border/WorldBorder;FLnet/minecraft/util/math/Vec3d;DLnet/minecraft/client/render/state/WorldBorderRenderState;)V")) - private void mcpitanlib$onWorldBorderExtraction(WorldBorderRendering instance, WorldBorder worldBorder, float tickDelta, Vec3d vec3d, double d, WorldBorderRenderState worldBorderRenderState, Operation original) { - original.call(instance, worldBorder, tickDelta, vec3d, d, worldBorderRenderState); - if (WorldRenderRegistry.isEmptyWorldRenderAfterLevelListeners) return; - - for (WorldRenderContextListener listener : WorldRenderRegistry.worldRenderAfterLevelListeners) { - listener.render(mcpitanlib$contextCache); - } - } -} diff --git a/src/main/resources/mcpitanlib-common.mixins.json b/src/main/resources/mcpitanlib-common.mixins.json index b3f321ad4..c40589368 100644 --- a/src/main/resources/mcpitanlib-common.mixins.json +++ b/src/main/resources/mcpitanlib-common.mixins.json @@ -13,7 +13,7 @@ "ItemMixin", "ItemStackComponentizationFixMixin", "ItemStackMixin", - "ItemUsageContextMixin", + "UseOnContextMixin", "MinecraftServerTimer", "RecipeManagerMixin", "ServerWorldTimer" diff --git a/src/main/resources/mcpitanlib.accesswidener b/src/main/resources/mcpitanlib.accesswidener index 8965697fa..dcb6a99aa 100644 --- a/src/main/resources/mcpitanlib.accesswidener +++ b/src/main/resources/mcpitanlib.accesswidener @@ -1,4 +1,5 @@ accessWidener v2 official +accessible class net/minecraft/util/datafix/fixes/ItemStackComponentizationFix$ItemStackData mutable field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen imageWidth I mutable field net/minecraft/client/gui/screens/inventory/AbstractContainerScreen imageHeight I diff --git a/src/main/resources/mcpitanlib.mixins.json b/src/main/resources/mcpitanlib.mixins.json deleted file mode 100644 index d4b92ebd9..000000000 --- a/src/main/resources/mcpitanlib.mixins.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "net.pitan76.mcpitanlib.fabric.mixin", - "compatibilityLevel": "JAVA_8", - "mixins": [ - - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} From a6582c138a833f55277c4e8c3fbf82a7c4759c86 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 17:19:30 +0900 Subject: [PATCH 013/151] port to 26.1-4 --- .../gui/widget/CompatTextFieldWidget.java | 4 +- .../api/client/render/CompatRenderLayer.java | 4 +- .../api/entity/CompatContainerUser.java | 5 +- .../api/event/ItemCommandEvent.java | 2 +- .../mcpitanlib/api/item/ExtendBlockItem.java | 3 -- .../api/simple/item/SimpleGuiItem.java | 3 +- .../api/sound/CompatSoundEvents.java | 53 ++++++++++--------- .../api/util/client/ScreenUtil.java | 6 +-- .../client/widget/ClickableWidgetUtil.java | 2 +- .../api/util/client/widget/TextFieldUtil.java | 4 +- 10 files changed, 42 insertions(+), 44 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java index bcd3786d3..349b51deb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java @@ -136,10 +136,10 @@ public boolean callKeyReleased(int keyCode, int scanCode, int modifiers) { @Deprecated @Override public boolean charTyped(CharacterEvent input) { - return callCharTyped((char) input.codepoint(), input.modifiers()); + return callCharTyped((char) input.codepoint(), -1); } public boolean callCharTyped(char chr, int modifiers) { - return super.charTyped(new CharacterEvent(chr, modifiers)); + return super.charTyped(new CharacterEvent(chr)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java b/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java index b8d2ba66d..5cdf9e8f6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java @@ -25,11 +25,11 @@ public RenderType raw() { } public static CompatRenderLayer getEntityCutout(CompatIdentifier id) { - return new CompatRenderLayer(RenderTypes.entityCutout(id.toMinecraft())); + return new CompatRenderLayer(RenderTypes.entityCutoutCull(id.toMinecraft())); } public static CompatRenderLayer getEntityCutoutNoCull(CompatIdentifier id) { - return new CompatRenderLayer(RenderTypes.entityCutoutNoCull(id.toMinecraft())); + return new CompatRenderLayer(RenderTypes.entityCutout(id.toMinecraft())); } public static CompatRenderLayer getEntityTranslucent(CompatIdentifier id) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java index 2d9fd5bfa..2af53c486 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java @@ -2,7 +2,6 @@ import net.minecraft.world.entity.ContainerUser; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; public class CompatContainerUser { protected ContainerUser containerUser; @@ -20,11 +19,11 @@ public LivingEntity asLivingEntity() { } public boolean isPlayer() { - return containerUser instanceof Player; + return containerUser instanceof net.minecraft.world.entity.player.Player; } public Player asPlayer() { - return new Player((Player) containerUser); + return new Player((net.minecraft.world.entity.player.Player) containerUser); } @Deprecated diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java index 30f21640c..7128b0537 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java @@ -6,6 +6,6 @@ public class ItemCommandEvent extends RequiredCommandEvent { public Item getValue() { - return ItemArgument.getItem(context, ((ItemCommand) getCommand()).getArgumentName()).getItem(); + return ItemArgument.getItem(context, ((ItemCommand) getCommand()).getArgumentName()).item().value(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java index d185dc2aa..9743f07cb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java @@ -1,7 +1,5 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.world.item.Item.Properties; -import net.minecraft.world.item.Item.TooltipContext; import net.minecraft.world.level.block.Block; import net.minecraft.world.item.component.TooltipDisplay; import net.minecraft.world.item.TooltipFlag; @@ -20,7 +18,6 @@ import net.pitan76.mcpitanlib.core.Dummy; import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; -import java.util.List; import java.util.function.Consumer; public class ExtendBlockItem extends BlockItem implements ExtendItemProvider { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java b/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java index b2332a3e8..ed8574cd5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java @@ -8,6 +8,7 @@ import net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import net.pitan76.mcpitanlib.api.util.StackActionResult; public class SimpleGuiItem extends CompatItem implements SimpleScreenHandlerFactory { @@ -41,7 +42,7 @@ public StackActionResult onRightClick(ItemUseEvent e) { @Override public Component getDisplayName(DisplayNameArgs args) { if (name == null) - return getName(); + return getName(ItemStackUtil.getDefaultStack(this)); return name; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java index b4c92170f..3d4a04c96 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.api.sound; import com.google.common.collect.ImmutableList; +import net.minecraft.world.entity.animal.feline.CatSoundVariants; import net.minecraft.world.entity.animal.wolf.WolfSoundVariants; import net.minecraft.sounds.SoundEvents; @@ -255,15 +256,15 @@ public class CompatSoundEvents { public static final CompatSoundEvent BLOCK_CANDLE_HIT = new CompatSoundEvent(SoundEvents.CANDLE_HIT); public static final CompatSoundEvent BLOCK_CANDLE_PLACE = new CompatSoundEvent(SoundEvents.CANDLE_PLACE); public static final CompatSoundEvent BLOCK_CANDLE_STEP = new CompatSoundEvent(SoundEvents.CANDLE_STEP); - public static final CompatSoundEvent ENTITY_CAT_AMBIENT = new CompatSoundEvent(SoundEvents.CAT_AMBIENT); - public static final CompatSoundEvent ENTITY_CAT_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.CAT_STRAY_AMBIENT); - public static final CompatSoundEvent ENTITY_CAT_DEATH = new CompatSoundEvent(SoundEvents.CAT_DEATH); - public static final CompatSoundEvent ENTITY_CAT_EAT = new CompatSoundEvent(SoundEvents.CAT_EAT); - public static final CompatSoundEvent ENTITY_CAT_HISS = new CompatSoundEvent(SoundEvents.CAT_HISS); - public static final CompatSoundEvent ENTITY_CAT_BEG_FOR_FOOD = new CompatSoundEvent(SoundEvents.CAT_BEG_FOR_FOOD); - public static final CompatSoundEvent ENTITY_CAT_HURT = new CompatSoundEvent(SoundEvents.CAT_HURT); - public static final CompatSoundEvent ENTITY_CAT_PURR = new CompatSoundEvent(SoundEvents.CAT_PURR); - public static final CompatSoundEvent ENTITY_CAT_PURREOW = new CompatSoundEvent(SoundEvents.CAT_PURREOW); + public static final CompatSoundEvent ENTITY_CAT_AMBIENT = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); + public static final CompatSoundEvent ENTITY_CAT_STRAY_AMBIENT = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().strayAmbientSound()); + public static final CompatSoundEvent ENTITY_CAT_DEATH = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); + public static final CompatSoundEvent ENTITY_CAT_EAT = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().eatSound()); + public static final CompatSoundEvent ENTITY_CAT_HISS = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().hissSound()); + public static final CompatSoundEvent ENTITY_CAT_BEG_FOR_FOOD = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().begForFoodSound()); + public static final CompatSoundEvent ENTITY_CAT_HURT = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); + public static final CompatSoundEvent ENTITY_CAT_PURR = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().purrSound()); + public static final CompatSoundEvent ENTITY_CAT_PURREOW = new CompatSoundEvent(SoundEvents.CAT_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().purreowSound()); public static final CompatSoundEvent BLOCK_CAVE_VINES_BREAK = new CompatSoundEvent(SoundEvents.CAVE_VINES_BREAK); public static final CompatSoundEvent BLOCK_CAVE_VINES_FALL = new CompatSoundEvent(SoundEvents.CAVE_VINES_FALL); public static final CompatSoundEvent BLOCK_CAVE_VINES_HIT = new CompatSoundEvent(SoundEvents.CAVE_VINES_HIT); @@ -308,10 +309,10 @@ public class CompatSoundEvents { public static final CompatSoundEvent BLOCK_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.CHEST_CLOSE); public static final CompatSoundEvent BLOCK_CHEST_LOCKED = new CompatSoundEvent(SoundEvents.CHEST_LOCKED); public static final CompatSoundEvent BLOCK_CHEST_OPEN = new CompatSoundEvent(SoundEvents.CHEST_OPEN); - public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.CHICKEN_AMBIENT); - public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.CHICKEN_DEATH); + public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); + public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); public static final CompatSoundEvent ENTITY_CHICKEN_EGG = new CompatSoundEvent(SoundEvents.CHICKEN_EGG); - public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.CHICKEN_HURT); + public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); public static final CompatSoundEvent ENTITY_CHICKEN_STEP = new CompatSoundEvent(SoundEvents.CHICKEN_STEP); public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_BREAK = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_BREAK); public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_FALL = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_FALL); @@ -370,11 +371,11 @@ public class CompatSoundEvents { public static final CompatSoundEvent BLOCK_CORAL_BLOCK_HIT = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_HIT); public static final CompatSoundEvent BLOCK_CORAL_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_PLACE); public static final CompatSoundEvent BLOCK_CORAL_BLOCK_STEP = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_STEP); - public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.COW_AMBIENT); - public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.COW_DEATH); - public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.COW_HURT); + public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).ambientSound()); + public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).deathSound()); + public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).hurtSound()); public static final CompatSoundEvent ENTITY_COW_MILK = new CompatSoundEvent(SoundEvents.COW_MILK); - public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.COW_STEP); + public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).stepSound()); public static final CompatSoundEvent BLOCK_CRAFTER_CRAFT = new CompatSoundEvent(SoundEvents.CRAFTER_CRAFT); public static final CompatSoundEvent BLOCK_CRAFTER_FAIL = new CompatSoundEvent(SoundEvents.CRAFTER_FAIL); public static final CompatSoundEvent ENTITY_CREEPER_DEATH = new CompatSoundEvent(SoundEvents.CREEPER_DEATH); @@ -1071,9 +1072,9 @@ public class CompatSoundEvents { public static final CompatSoundEvent ENTITY_PHANTOM_FLAP = new CompatSoundEvent(SoundEvents.PHANTOM_FLAP); public static final CompatSoundEvent ENTITY_PHANTOM_HURT = new CompatSoundEvent(SoundEvents.PHANTOM_HURT); public static final CompatSoundEvent ENTITY_PHANTOM_SWOOP = new CompatSoundEvent(SoundEvents.PHANTOM_SWOOP); - public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.PIG_AMBIENT); - public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.PIG_DEATH); - public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.PIG_HURT); + public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); + public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); + public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); public static final CompatSoundEvent ENTITY_PIG_SADDLE = new CompatSoundEvent(SoundEvents.PIG_SADDLE); public static final CompatSoundEvent ENTITY_PIG_STEP = new CompatSoundEvent(SoundEvents.PIG_STEP); public static final CompatSoundEvent ENTITY_PIGLIN_ADMIRING_ITEM = new CompatSoundEvent(SoundEvents.PIGLIN_ADMIRING_ITEM); @@ -1551,15 +1552,15 @@ public class CompatSoundEvents { public static final CompatSoundEvent ITEM_WOLF_ARMOR_CRACK = new CompatSoundEvent(SoundEvents.WOLF_ARMOR_CRACK); public static final CompatSoundEvent ITEM_WOLF_ARMOR_DAMAGE = new CompatSoundEvent(SoundEvents.WOLF_ARMOR_DAMAGE); public static final CompatSoundEvent ITEM_WOLF_ARMOR_REPAIR = new CompatSoundEvent(SoundEvents.WOLF_ARMOR_REPAIR); - public static final CompatSoundEvent ENTITY_WOLF_AMBIENT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).ambientSound()); - public static final CompatSoundEvent ENTITY_WOLF_DEATH = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).deathSound()); - public static final CompatSoundEvent ENTITY_WOLF_GROWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).growlSound()); - public static final CompatSoundEvent ENTITY_WOLF_HOWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).ambientSound()); - public static final CompatSoundEvent ENTITY_WOLF_HURT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).hurtSound()); - public static final CompatSoundEvent ENTITY_WOLF_PANT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).pantSound()); + public static final CompatSoundEvent ENTITY_WOLF_AMBIENT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); + public static final CompatSoundEvent ENTITY_WOLF_DEATH = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); + public static final CompatSoundEvent ENTITY_WOLF_GROWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).adultSounds().growlSound()); + public static final CompatSoundEvent ENTITY_WOLF_HOWL = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); + public static final CompatSoundEvent ENTITY_WOLF_HURT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); + public static final CompatSoundEvent ENTITY_WOLF_PANT = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).adultSounds().pantSound()); public static final CompatSoundEvent ENTITY_WOLF_SHAKE = new CompatSoundEvent(SoundEvents.WOLF_SHAKE); public static final CompatSoundEvent ENTITY_WOLF_STEP = new CompatSoundEvent(SoundEvents.WOLF_STEP); - public static final CompatSoundEvent ENTITY_WOLF_WHINE = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).whineSound()); + public static final CompatSoundEvent ENTITY_WOLF_WHINE = new CompatSoundEvent(SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.SoundSet.CLASSIC).adultSounds().whineSound()); public static final CompatSoundEvent BLOCK_WOODEN_DOOR_CLOSE = new CompatSoundEvent(SoundEvents.WOODEN_DOOR_CLOSE); public static final CompatSoundEvent BLOCK_WOODEN_DOOR_OPEN = new CompatSoundEvent(SoundEvents.WOODEN_DOOR_OPEN); public static final CompatSoundEvent BLOCK_WOODEN_TRAPDOOR_CLOSE = new CompatSoundEvent(SoundEvents.WOODEN_TRAPDOOR_CLOSE); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java index a37d480ef..270c418cd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java @@ -137,17 +137,17 @@ public static class ClickableWidgetUtil extends net.pitan76.mcpitanlib.api.util. public static class RendererUtil { public static int drawText(Font renderer, DrawObjectDM drawObjectDM, Component text, int x, int y, int color) { - drawObjectDM.getContext().drawString(renderer, text, x, y, fixColor(color), false); + drawObjectDM.getContext().text(renderer, text, x, y, fixColor(color), false); return -1; } public static int drawText(Font renderer, DrawObjectDM drawObjectDM, String text, int x, int y, int color) { - drawObjectDM.getContext().drawString(renderer, text, x, y, fixColor(color), false); + drawObjectDM.getContext().text(renderer, text, x, y, fixColor(color), false); return -1; } public static int drawText(Font renderer, DrawObjectDM drawObjectDM, FormattedCharSequence text, int x, int y, int color) { - drawObjectDM.getContext().drawString(renderer, text, x, y, fixColor(color), false); + drawObjectDM.getContext().text(renderer, text, x, y, fixColor(color), false); return -1; } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java index f9f69e04f..3b4635c59 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java @@ -5,6 +5,6 @@ public class ClickableWidgetUtil { public static void render(AbstractWidget widget, RenderArgs args) { - widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + widget.extractRenderState(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java index a669aae21..c52f39ae2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java @@ -14,7 +14,7 @@ public static void setFocused(EditBox widget, boolean focused) { } public static void render(EditBox widget, RenderArgs args) { - widget.render(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + widget.extractRenderState(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } public static void setEditable(EditBox widget, boolean editable) { @@ -58,7 +58,7 @@ public static boolean keyReleased(EditBox widget, int keyCode, int scanCode, int } public static boolean charTyped(EditBox widget, char chr, int modifiers) { - return widget.charTyped(new CharacterEvent(chr, modifiers)); + return widget.charTyped(new CharacterEvent(chr)); } public static EditBox create(Font renderer, int x, int y, int width, int height, Component text) { From 0e426c1ca59ca8f763db632bbc57c8b4628b01c7 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 17:24:50 +0900 Subject: [PATCH 014/151] port to 26.1-5 --- .../api/transfer/fluid/v1/FabricFluidStorage.java | 9 ++++----- .../api/transfer/fluid/v1/FluidStorageUtil.java | 1 - .../net/pitan76/mcpitanlib/api/util/CommandUtil.java | 2 +- .../api/util/client/BlockEntityRendererUtil.java | 4 ++-- .../api/util/client/render/WorldRendererUtil.java | 2 +- .../net/pitan76/mcpitanlib/api/util/item/ItemUtil.java | 6 +++--- .../particle/effect/ItemStackParticleEffectUtil.java | 4 ++-- .../mcpitanlib/api/util/screen/ScreenHandlerUtil.java | 2 +- .../pitan76/mcpitanlib/core/registry/FuelRegistry.java | 7 ++++++- 9 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java index c42266ec7..529f8d472 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java @@ -1,11 +1,10 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric; +package net.pitan76.mcpitanlib.api.transfer.fluid.v1; import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric.FabricFluidVariant; public class FabricFluidStorage implements IFluidStorage { @@ -68,12 +67,12 @@ public long extract(IFluidVariant variant, long maxAmount, boolean simulate) { @Override public void writeNbt(WriteNbtArgs args) { - storage.writeData(args.view); + storage.writeValue(args.view); } @Override public void readNbt(ReadNbtArgs args) { - storage.readData(args.view); + storage.readValue(args.view); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java index 93dc7bfd6..4e92acb14 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java @@ -3,7 +3,6 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; import net.minecraft.world.level.material.Fluid; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric.FabricFluidStorage; import net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric.FabricFluidVariant; public class FluidStorageUtil { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java index eb5acdab2..1ed916d21 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java @@ -12,7 +12,7 @@ public class CommandUtil { public static Item getItemArgument(String name, ServerCommandEvent e) { - return ItemArgument.getItem(e.getContext(), name).getItem(); + return ItemArgument.getItem(e.getContext(), name).item().value(); } public static Block getBlockArgument(String name, ServerCommandEvent e) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java index fa9df36a7..4ae0a734a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java @@ -5,10 +5,10 @@ public class BlockEntityRendererUtil { public static BlockEntityRendererProvider.Context convert(CompatRegistryClient.BlockEntityRendererFactory.Context ctx) { - return new BlockEntityRendererProvider.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getItemRenderer(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer(), ctx.getSpriteHolder(), ctx.getPlayerSkinRenderCache()); + return new BlockEntityRendererProvider.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer(), ctx.getSpriteHolder(), ctx.getPlayerSkinRenderCache()); } public static CompatRegistryClient.BlockEntityRendererFactory.Context convert(BlockEntityRendererProvider.Context ctx) { - return new CompatRegistryClient.BlockEntityRendererFactory.Context(ctx.blockEntityRenderDispatcher(), ctx.blockRenderDispatcher(), ctx.itemModelResolver(), ctx.itemRenderer(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.materials(), ctx.playerSkinRenderCache()); + return new CompatRegistryClient.BlockEntityRendererFactory.Context(ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java index fb0b87078..d1984282f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java @@ -6,7 +6,7 @@ public class WorldRendererUtil { public static int getLightmapCoordinates(Level world, BlockPos pos) { - return LevelRenderer.getLightColor(world, pos); + return LevelRenderer.getLightCoords(world, pos); } public static int getLightmapCoordinates(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java index 753d8b4e9..57f2cc228 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java @@ -228,7 +228,7 @@ public static boolean isOf(ItemStack stack, Item item) { * @return Name of the item. */ public static String getNameAsString(Item item) { - return item.getName().getString(); + return item.getName(ItemStackUtil.getDefaultStack(item)).getString(); } /** @@ -237,7 +237,7 @@ public static String getNameAsString(Item item) { * @return Name of the item. */ public static TextComponent getName(Item item) { - return new TextComponent(item.getName()); + return new TextComponent(item.getName(ItemStackUtil.getDefaultStack(item))); } /** @@ -258,6 +258,6 @@ public static Item getRecipeRemainder(Item item) { } public static ItemStack getRecipeRemainderStack(Item item) { - return item.getCraftingRemainder(); + return item.getCraftingRemainder().create(); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java index 6c18712fe..a5aeb00b6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java @@ -13,10 +13,10 @@ public ItemStackParticleEffectUtil() { } public ItemParticleOption create(ParticleType type, ItemStack stack) { - return new ItemParticleOption(type, stack); + return new ItemParticleOption(type, stack.getItem()); } public ItemParticleOption createTypedItem(ItemStack stack) { - return new ItemParticleOption(ParticleTypes.ITEM, stack); + return new ItemParticleOption(ParticleTypes.ITEM, stack.getItem()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java index 6a8fecb53..56548e26b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java @@ -19,7 +19,7 @@ public static int calcComparatorOutput(@Nullable BlockEntity blockEntity) { } public static int calculateStackSize(Set slots, int mode, ItemStack stack) { - return AbstractContainerMenu.getQuickCraftPlaceCount(slots, mode, stack); + return AbstractContainerMenu.getQuickCraftPlaceCount(slots.size(), mode, stack); } public static boolean canInsertItemIntoSlot(@Nullable Slot slot, ItemStack stack, boolean allowOverflow) { diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java index f43e44e4f..edc318578 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.core.registry; +import net.fabricmc.fabric.api.registry.FuelValueEvents; import net.minecraft.world.level.ItemLike; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -10,7 +11,11 @@ private FuelRegistry() { } public static void register(int time, ItemLike... item) { - dev.architectury.registry.fuel.FuelRegistry.register(time, item); + FuelValueEvents.BUILD.register(((builder, context) -> { + for (ItemLike i : item) { + builder.add(i.asItem(), context.baseSmeltTime() * time); + } + })); } @Deprecated From a79b2236630dd0e13fdcddfee24e905b3010d472 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 17:33:41 +0900 Subject: [PATCH 015/151] update shadow plugin version and modify version property in processResources --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index f93b83c89..a6bb10798 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' id 'maven-publish' - id 'com.github.johnrengelman.shadow' version '8.1.1' + id 'com.gradleup.shadow' version '9.4.0' } def loadProperties(filename) { @@ -57,13 +57,13 @@ dependencies { } processResources { - inputs.property "version", info.version + inputs.property "version", info.mod_version inputs.property "minecraft_version", project.minecraft_version inputs.property "loader_version", project.fabric_loader_version filteringCharset "UTF-8" filesMatching("fabric.mod.json") { - expand "version": info.version, + expand "version": info.mod_version, "minecraft_version": project.minecraft_version, "loader_version": project.fabric_loader_version } From b01f1db49d5cbb460351c46feb54b527fdf28bbc Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 18:33:04 +0900 Subject: [PATCH 016/151] update shadowJar configuration to include relocated snakeyaml dependency --- build.gradle | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index a6bb10798..ebe61a13a 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ dependencies { implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" implementation 'org.yaml:snakeyaml:2.0' - include 'org.yaml:snakeyaml:2.0' + shadow 'org.yaml:snakeyaml:2.0' // api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { // exclude(group: "net.fabricmc.fabric-api") @@ -69,19 +69,6 @@ processResources { } } -shadowJar { - relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" - archiveClassifier.set("") -} - -tasks.build { - dependsOn shadowJar -} - -tasks.jar { - enabled = false -} - def targetJavaVersion = 25 tasks.withType(JavaCompile).configureEach { // ensure that the encoding is set to UTF-8, no matter what the system default is @@ -105,6 +92,13 @@ java { withSourcesJar() } +shadowJar { + relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" + configurations = [project.configurations.shadow] + archiveClassifier.set("") +} + + jar { from("LICENSE") { rename { "${it}_${info.archives_base_name}" } From 7c9ea10c414fb1252d8f738d990152670e15f0cc Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 19:10:45 +0900 Subject: [PATCH 017/151] update fabric.mod.json and mixin configurations for compatibility with Minecraft 26 --- src/main/resources/fabric.mod.json | 6 ++---- src/main/resources/mcpitanlib-common.mixins.json | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 43d653478..9e5722dff 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,13 +30,11 @@ } }, "mixins": [ - "mcpitanlib.mixins.json", "mcpitanlib-common.mixins.json" ], "accessWidener": "mcpitanlib.accesswidener", "depends": { - "minecraft": ">1.21.10", - "fabricloader": "*", - "architectury": "*" + "minecraft": ">=26", + "fabricloader": "*" } } diff --git a/src/main/resources/mcpitanlib-common.mixins.json b/src/main/resources/mcpitanlib-common.mixins.json index c40589368..1f8c4e3d5 100644 --- a/src/main/resources/mcpitanlib-common.mixins.json +++ b/src/main/resources/mcpitanlib-common.mixins.json @@ -13,13 +13,13 @@ "ItemMixin", "ItemStackComponentizationFixMixin", "ItemStackMixin", - "UseOnContextMixin", "MinecraftServerTimer", "RecipeManagerMixin", - "ServerWorldTimer" + "ServerLevelTimer", + "UseOnContextMixin" ], "client": [ - "WorldRendererMixin" + "LevelRendererMixin" ], "injectors": { "defaultRequire": 1 From 9e1aee2d1e8701fa7faf771747d7471ec9ba7132 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 19:12:27 +0900 Subject: [PATCH 018/151] rename injection method from getRenderType to getRenderShape for compatibility --- .../mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java index 55c378ba5..5d214cc06 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java @@ -62,7 +62,7 @@ public class AbstractBlock4CompatProviderMixin { } } - @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) + @Inject(method = "getRenderShape", at = @At("HEAD"), cancellable = true) private void mcpitanlib$inject_getRenderType(BlockState state, CallbackInfoReturnable cir) { if (this instanceof CompatBlockProvider) { CompatBlockProvider provider = (CompatBlockProvider) this; From 1f6c2b1c7b159cd7c416395ca36261032d723f06 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 19:13:20 +0900 Subject: [PATCH 019/151] fix parameter order in onTick method for consistency --- .../java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java index 43ea885fa..a68b0332e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java @@ -20,7 +20,7 @@ public class ServerLevelTimer implements ServerWorldTimerAccess { private final List mcpitanlib$timerItems = new ArrayList<>(); @Inject(method = "tick", at = @At("TAIL")) - private void onTick(CallbackInfo ci, BooleanSupplier haveTime) { + private void onTick(BooleanSupplier haveTime, CallbackInfo ci) { if (mcpitanlib$timerItems.isEmpty()) return; List items = new ArrayList<>(mcpitanlib$timerItems); From 4e2e7fab04f74eebcbc260ef3f6ead0cb194181e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 19:34:58 +0900 Subject: [PATCH 020/151] add payload registration methods and update render context handling --- .../listener/WorldRenderContextImpl.java | 2 ++ .../api/network/ClientNetworking.java | 15 +++++++---- .../api/network/ServerNetworking.java | 1 + .../mcpitanlib/mixin/LevelRendererMixin.java | 25 +++++++++---------- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java index 22e6ec7a6..fd7c04ec6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java @@ -113,4 +113,6 @@ public void prepare(GameRenderer gameRenderer, LevelRenderer worldRenderer, @Nul this.tickDelta = tickCounter.getGameTimeDeltaTicks(); this.frustum = gameRenderer.getMainCamera().getCapturedFrustum(); } + + } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java index 0340399ff..97f457401 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java @@ -2,6 +2,7 @@ import io.netty.buffer.Unpooled; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; +import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.FriendlyByteBuf; @@ -11,6 +12,7 @@ import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.core.network.BufPayload; +import java.util.ArrayList; import java.util.List; public class ClientNetworking { @@ -29,6 +31,7 @@ public static void send(Identifier identifier, FriendlyByteBuf buf) { public static void registerReceiver(Identifier identifier, ClientNetworkHandler handler) { BufPayload.Type id = BufPayload.id(identifier); + registerC2SPayloadType(identifier); ClientPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); @@ -47,11 +50,13 @@ public interface ClientNetworkHandler { void receive(Minecraft client, LocalPlayer player, FriendlyByteBuf buf); } + private static final List registeredList = new ArrayList<>(); - public static void registerC2SType(CustomPacketPayload.Type type, StreamCodec codec, List packetTransformers) { -// Objects.requireNonNull(type, "Cannot register a null type!"); -// packetTransformers = Objects.requireNonNullElse(packetTransformers, List.of()); -// C2S_CODECS.put(type.id(), (PacketCodec) codec); -// C2S_TRANSFORMERS.put(type.id(), PacketTransformer.concat(packetTransformers)); + public static void registerC2SPayloadType(Identifier identifier) { + if (registeredList.contains(identifier)) return; + registeredList.add(identifier); + + BufPayload.Type id = BufPayload.id(identifier); + PayloadTypeRegistry.clientboundPlay().register(id, BufPayload.getCodec(id)); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java index fe8a5a3c0..cb3aa3f0f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java @@ -35,6 +35,7 @@ public static void sendAll(MinecraftServer server, Identifier identifier, Friend public static void registerReceiver(Identifier identifier, ServerNetworkHandler handler) { BufPayload.Type id = BufPayload.id(identifier); + ServerPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java index 5edc5269e..4c58dd2f2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java @@ -10,10 +10,12 @@ import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.WorldBorderRenderer; +import net.minecraft.client.renderer.chunk.ChunkSectionsToRender; import net.minecraft.client.renderer.culling.Frustum; import com.mojang.blaze3d.resource.GraphicsResourceAllocator; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.client.renderer.state.level.LevelRenderState; import net.minecraft.client.renderer.state.level.WorldBorderRenderState; import net.minecraft.world.phys.Vec3; @@ -22,6 +24,7 @@ import net.pitan76.mcpitanlib.api.client.event.listener.*; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; +import org.joml.Matrix4fc; import org.joml.Vector4f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -37,8 +40,6 @@ public abstract class LevelRendererMixin { @Shadow public abstract boolean hasRenderedAllSections(); - @Shadow @Nullable public abstract Frustum getCapturedFrustum(); - @Shadow @Final private Minecraft minecraft; @Shadow @Nullable private ClientLevel level; @Unique @@ -65,20 +66,18 @@ public abstract class LevelRendererMixin { } @Inject(method = "renderLevel", at = @At("HEAD")) - private void beforeRender(GraphicsResourceAllocator allocator, DeltaTracker tickCounter, boolean renderBlockOutline, Camera camera, Matrix4f positionMatrix, Matrix4f matrix4f, Matrix4f projectionMatrix, GpuBufferSlice fogBuffer, Vector4f fogColor, boolean renderSky, CallbackInfo ci) { - mcpitanlib$contextCache.prepare(minecraft.gameRenderer, (LevelRenderer) (Object) this, level, tickCounter, renderBlockOutline, camera, positionMatrix, matrix4f, projectionMatrix); - } - - @ModifyExpressionValue(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;prepareCullFrustum(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/world/phys/Vec3;)Lnet/minecraft/client/renderer/culling/Frustum;")) - private Frustum onSetupFrustum(Frustum frustum) { - mcpitanlib$contextCache.frustum = frustum; - return frustum; + private void mcpitanlib$beforeRender(GraphicsResourceAllocator allocator, DeltaTracker tickCounter, boolean renderOutline, CameraRenderState cameraRenderState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor, boolean shouldRenderSky, ChunkSectionsToRender chunkSectionsToRender, CallbackInfo ci) { + mcpitanlib$contextCache.prepare(minecraft.gameRenderer, (LevelRenderer) (Object) this, level, tickCounter, renderOutline, Minecraft.getInstance().gameRenderer.getMainCamera(), new Matrix4f(), new Matrix4f(), new Matrix4f()); } +// @ModifyExpressionValue(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;cullFrustum(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/world/phys/Vec3;)Lnet/minecraft/client/renderer/culling/Frustum;")) +// private Frustum onSetupFrustum(Frustum frustum) { +// mcpitanlib$contextCache.frustum = frustum; +// return frustum; +// } - @WrapOperation(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldBorderRenderer;extract(Lnet/minecraft/world/level/border/WorldBorder;FLnet/minecraft/world/phys/Vec3;DLnet/minecraft/client/renderer/state/WorldBorderRenderState;)V")) - private void mcpitanlib$onWorldBorderExtraction(WorldBorderRenderer instance, WorldBorder worldBorder, float tickDelta, Vec3 vec3d, double d, WorldBorderRenderState worldBorderRenderState, Operation original) { - original.call(instance, worldBorder, tickDelta, vec3d, d, worldBorderRenderState); + @Inject(method = "renderLevel", at = @At("TAIL")) + private void mcpitanlib$onWorldRenderEnd(GraphicsResourceAllocator allocator, DeltaTracker tickCounter, boolean renderOutline, CameraRenderState cameraState, Matrix4fc modelViewMatrix, GpuBufferSlice terrainFog, Vector4f fogColor,boolean shouldRenderSky,ChunkSectionsToRender chunkSectionsToRender, CallbackInfo ci) { if (WorldRenderRegistry.isEmptyWorldRenderAfterLevelListeners) return; for (WorldRenderContextListener listener : WorldRenderRegistry.worldRenderAfterLevelListeners) { From af63bace5d401e661fde179986e01ffa00ae040c Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 19:35:06 +0900 Subject: [PATCH 021/151] update compatdatapacks76 and legacyitemmodels versions for Minecraft 26 compatibility --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9791843bf..19ee61819 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,8 +15,8 @@ neoforge_version=26.1.0.1-beta #cloth_config_version=21.11.153 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ -compatdatapacks76_version=1.0.14.2111 -legacyitemmodels_version=1.0.2.2111 +compatdatapacks76_version=1.0.14.261 +legacyitemmodels_version=1.0.2.261 fabricEnabled=true neoforgeEnabled=false From 64e72035363e26d8513e1409df4c15c0ac4a2a50 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 22:31:21 +0900 Subject: [PATCH 022/151] bump compatdatapacks76 version to 1.0.15.261 for Minecraft 26 compatibility --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 19ee61819..daffd8b0e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ neoforge_version=26.1.0.1-beta #cloth_config_version=21.11.153 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ -compatdatapacks76_version=1.0.14.261 +compatdatapacks76_version=1.0.15.261 legacyitemmodels_version=1.0.2.261 fabricEnabled=true From 4a61e2c1397b3b1b018416ed43e2118769ef1fa7 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 23:42:24 +0900 Subject: [PATCH 023/151] refactor SimpleHandledScreen: clean up background rendering and update method calls --- .../api/client/gui/screen/SimpleHandledScreen.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java index a55aa73b7..11493031f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java @@ -40,7 +40,6 @@ public SimpleHandledScreen(S handler, Inventory inventory, Component title) { fixScreen(); this.handler = handler; this.title = title; - } @Deprecated @@ -102,7 +101,8 @@ public void callRenderBackground(DrawObjectDM drawObjectDM) { public void callRenderBackground(RenderArgs args) { - super.extractBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); + // TODO: 以前のバージョンではどう機能しているかチェックする必要がある。このバージョンで利用すると全体が暗くなる + // super.extractBackground(args.drawObjectDM.getContext(), args.mouseX, args.mouseY, args.delta); } public void callDrawMouseoverTooltip(DrawMouseoverTooltipArgs args) { @@ -234,7 +234,7 @@ public boolean keyPressed(KeyEvent input) { @Deprecated @Override public void extractMenuBackground(GuiGraphicsExtractor context) { - this.renderBackgroundTexture(new RenderBackgroundTextureArgs(new DrawObjectDM(context, this), 0)); + callRenderBackground(new RenderArgs(new DrawObjectDM(context, this), 0, 0, 0)); } public void closeOverride() { From 793b41757cb598317f9ecce4ea8111562ba52cf5 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 23:42:51 +0900 Subject: [PATCH 024/151] fix: ExampleGuiBlock --- src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java b/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java index 5cfff8e38..4db7a6e12 100644 --- a/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java @@ -18,7 +18,7 @@ public ExampleGuiBlock(CompatibleBlockSettings settings) { @Override public CompatActionResult onRightClick(BlockUseEvent e) { - if (e.isClient()) + if (!e.isClient()) e.player.openGuiScreen(this); return e.success(); From 9fbbebdee496e1a4f2ea018793ba2f9a70d63aec Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 23:48:59 +0900 Subject: [PATCH 025/151] feat: add CurseForge and Modrinth integration for project publishing --- build.gradle | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/build.gradle b/build.gradle index ebe61a13a..3182b51e8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,8 @@ plugins { id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' id 'maven-publish' + id 'com.matthewprenger.cursegradle' version '1.5.0-SNAPSHOT' // FORK: maven.pitan76.net + id "com.modrinth.minotaur" version "2.+" id 'com.gradleup.shadow' version '9.4.0' } @@ -105,6 +107,44 @@ jar { } } +if (System.getenv("CURSEFORGE_TOKEN") != null) { + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = '682213' + changelog = info.changelog + releaseType = 'beta' + addGameVersion "Fabric" + addGameVersion "26.1" + relations { + requiredDependency 'fabric-api' + embeddedLibrary 'compatdatapacks' + embeddedLibrary 'legacyitemmodels' + } + + mainArtifact(tasks.jar) + } + } +} + +if (System.getenv("MODRINTH_TOKEN") != null) { + modrinth { + token = System.getenv("MODRINTH_TOKEN") + projectId = 'mcpitanlibarch' + versionNumber = project.mod_version + "-fabric" + gameVersions = ["26.1"] + versionType = 'beta' + uploadFile = tasks.jar + changelog = info.changelog + loaders = ["fabric"] + dependencies { + required.project "fabric-api" + embedded.project "compatdatapacks" + embedded.project "legacyitemmodels" + } + } +} + // configure the maven publication publishing { publications { From c0e8c3b23bf2d9d1c759e7efcf1704a3bfa0e8e1 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 23:50:11 +0900 Subject: [PATCH 026/151] fix: update version number format in build.gradle for Modrinth integration --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3182b51e8..6e155aca9 100644 --- a/build.gradle +++ b/build.gradle @@ -131,7 +131,7 @@ if (System.getenv("MODRINTH_TOKEN") != null) { modrinth { token = System.getenv("MODRINTH_TOKEN") projectId = 'mcpitanlibarch' - versionNumber = project.mod_version + "-fabric" + versionNumber = info.mod_version + "-fabric-" + project.minecraft_version gameVersions = ["26.1"] versionType = 'beta' uploadFile = tasks.jar From 184e577278e46278c8ee310ce2c43795353a56b5 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 25 Mar 2026 23:56:48 +0900 Subject: [PATCH 027/151] fix: update versioning format in build.gradle for Minecraft 26 compatibility --- build.gradle | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 6e155aca9..71ed14eb2 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ def loadProperties(filename) { ext.info = loadProperties("$rootDir/info.properties") -version = info.mod_version +version = info.mod_version + "-" + rootProject.minecraft_version group = info.maven_group base { @@ -69,6 +69,8 @@ processResources { "minecraft_version": project.minecraft_version, "loader_version": project.fabric_loader_version } + + project.version = project.version + "-fabric" } def targetJavaVersion = 25 @@ -131,7 +133,7 @@ if (System.getenv("MODRINTH_TOKEN") != null) { modrinth { token = System.getenv("MODRINTH_TOKEN") projectId = 'mcpitanlibarch' - versionNumber = info.mod_version + "-fabric-" + project.minecraft_version + versionNumber = info.mod_version + "-fabric-" + rootProject.minecraft_version.toString() gameVersions = ["26.1"] versionType = 'beta' uploadFile = tasks.jar @@ -145,20 +147,24 @@ if (System.getenv("MODRINTH_TOKEN") != null) { } } -// configure the maven publication publishing { publications { - register("mavenJava", MavenPublication) { - artifactId = info.archives_base_name + mavenFabric(MavenPublication) { + artifactId = info.archives_base_name + "-fabric-" + rootProject.minecraft_version + version = info.mod_version from components.java } } // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { - // Add repositories to publish to here. - // Notice: This block does NOT have the same function as the block in the top level. - // The repositories here will be used for publishing your artifact, not for - // retrieving dependencies. + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/PTOM76/maven") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") + } + } } } From d892673c503af854c6c50fa408e4fde158f51e44 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Thu, 26 Mar 2026 02:48:45 +0900 Subject: [PATCH 028/151] fix: update player entity handling in CompatibleSlot for consistency --- .../net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java index 2251a367b..d61389f8e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java @@ -101,15 +101,15 @@ public boolean mayPlace(ItemStack stack) { @Override public boolean mayPickup(net.minecraft.world.entity.player.Player playerEntity) { - return canTakeItems(new Player(playerEntity)); + return canTakeItems(playerEntity); } public boolean canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { return super.mayPlace(stack.toMinecraft()); } - public boolean canTakeItems(Player player) { - return super.mayPickup(player.getEntity()); + public boolean canTakeItems(net.minecraft.world.entity.player.Player player) { + return super.mayPickup(player); } @Deprecated From b45121f29aeab8c176eb6844a9d502306cba0456 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Thu, 26 Mar 2026 14:05:36 +0900 Subject: [PATCH 029/151] fix: improve player entity handling in CompatibleSlot for item pickup --- .../net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java index d61389f8e..2251a367b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java @@ -101,15 +101,15 @@ public boolean mayPlace(ItemStack stack) { @Override public boolean mayPickup(net.minecraft.world.entity.player.Player playerEntity) { - return canTakeItems(playerEntity); + return canTakeItems(new Player(playerEntity)); } public boolean canInsert(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { return super.mayPlace(stack.toMinecraft()); } - public boolean canTakeItems(net.minecraft.world.entity.player.Player player) { - return super.mayPickup(player); + public boolean canTakeItems(Player player) { + return super.mayPickup(player.getEntity()); } @Deprecated From d00329060eb09a026345d513af08c0d5b8ce78f0 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Thu, 26 Mar 2026 14:20:35 +0900 Subject: [PATCH 030/151] fix: streamline payload type registration in client and server networking --- .../pitan76/mcpitanlib/api/network/ClientNetworking.java | 8 +------- .../pitan76/mcpitanlib/api/network/ServerNetworking.java | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java index 97f457401..218a3756c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java @@ -17,13 +17,7 @@ public class ClientNetworking { public static void send(Identifier identifier, FriendlyByteBuf buf) { - /* - if (!C2S_TYPE.containsKey(identifier)) { - CustomPayload.Id type = new CustomPayload.Id<>(identifier); - C2S_TYPE.put(identifier, type); - //registerC2SType(type, NetworkAggregator.BufCustomPacketPayload.streamCodec(type), List.of()); - } - */ + registerC2SPayloadType(identifier); BufPayload payload = new BufPayload(buf, identifier); ClientPlayNetworking.send(payload); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java index cb3aa3f0f..9264a4ad8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java @@ -34,6 +34,7 @@ public static void sendAll(MinecraftServer server, Identifier identifier, Friend } public static void registerReceiver(Identifier identifier, ServerNetworkHandler handler) { + registerS2CPayloadType(identifier); BufPayload.Type id = BufPayload.id(identifier); ServerPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { From 3837a537d13d6061c672ed3ad87d3793cf9030ec Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Thu, 26 Mar 2026 17:18:28 +0900 Subject: [PATCH 031/151] chore: add littleobffallback --- build.gradle | 4 ++++ gradle.properties | 1 + 2 files changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 71ed14eb2..e078da862 100644 --- a/build.gradle +++ b/build.gradle @@ -54,8 +54,12 @@ dependencies { implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { exclude(group: "net.fabricmc.fabric-api") } + implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { + exclude(group: "net.fabricmc.fabric-api") + } include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") + include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") } processResources { diff --git a/gradle.properties b/gradle.properties index daffd8b0e..c5e6016a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,6 +17,7 @@ neoforge_version=26.1.0.1-beta # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.15.261 legacyitemmodels_version=1.0.2.261 +littleobffallback_version=0.0.1.261 fabricEnabled=true neoforgeEnabled=false From fb1b72f0a08239d3912eda2c75f8b3e0fce20dae Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Thu, 26 Mar 2026 20:02:58 +0900 Subject: [PATCH 032/151] add Player API --- .../pitan76/mcpitanlib/api/entity/Player.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index f8e46776b..eedb0d1a3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -34,6 +34,7 @@ import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; import net.pitan76.mcpitanlib.api.gui.ExtendedNamedScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.gui.v2.ExtendedScreenHandlerFactory; import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; @@ -150,7 +151,7 @@ public void openExtendedMenu(ExtendedMenuProvider provider) { ScreenHandlerUtil.openExtendedMenu((ServerPlayer) this.getPlayerEntity(), provider); } - public void openExtendedMenu(ExtendedNamedScreenHandlerFactory provider) { + public void openExtendedMenu(ExtendedScreenHandlerFactory provider) { this.openExtendedMenu((ExtendedMenuProvider) provider); } @@ -540,4 +541,24 @@ public void sendMessage(TextComponent textComponent) { public void sendActionBar(TextComponent textComponent) { sendActionBar(textComponent.getText()); } + + public void openExtendedMenu(ExtendedNamedScreenHandlerFactory provider) { + this.openExtendedMenu((ExtendedMenuProvider) provider); + } + + public void offerOrDrop(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + offerOrDrop(stack.toMinecraft()); + } + + public void insertStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + insertStack(stack.toMinecraft()); + } + + public void insertStack(int slot, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + insertStack(slot, stack.toMinecraft()); + } + + public void giveStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + giveStack(stack.toMinecraft()); + } } \ No newline at end of file From c80d89f3da9d004b6bd0bade9bbcc7811caac4a0 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Thu, 26 Mar 2026 20:03:06 +0900 Subject: [PATCH 033/151] gradle --- build.gradle | 8 ++++---- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index e078da862..99df56c6c 100644 --- a/build.gradle +++ b/build.gradle @@ -54,12 +54,12 @@ dependencies { implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { exclude(group: "net.fabricmc.fabric-api") } - implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { - exclude(group: "net.fabricmc.fabric-api") - } +// implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { +// exclude(group: "net.fabricmc.fabric-api") +// } include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") - include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") +// include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") } processResources { diff --git a/gradle.properties b/gradle.properties index c5e6016a5..329f1659f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ neoforge_version=26.1.0.1-beta # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.15.261 legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.0.1.261 +littleobffallback_version=0.0.2.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 64d6ba64c6643165120b96b3000e9bd5cbb21403 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Thu, 26 Mar 2026 21:28:00 +0900 Subject: [PATCH 034/151] fix playyer --- src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index eedb0d1a3..0ab80bc88 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -151,7 +151,7 @@ public void openExtendedMenu(ExtendedMenuProvider provider) { ScreenHandlerUtil.openExtendedMenu((ServerPlayer) this.getPlayerEntity(), provider); } - public void openExtendedMenu(ExtendedScreenHandlerFactory provider) { + public void openExtendedMenu(ExtendedNamedScreenHandlerFactory provider) { this.openExtendedMenu((ExtendedMenuProvider) provider); } @@ -538,11 +538,11 @@ public void sendMessage(TextComponent textComponent) { sendMessage(textComponent.getText()); } - public void sendActionBar(TextComponent textComponent) { + public void sendActionBar(TextComponent textComponent) { sendActionBar(textComponent.getText()); } - public void openExtendedMenu(ExtendedNamedScreenHandlerFactory provider) { + public void openExtendedMenu(ExtendedScreenHandlerFactory provider) { this.openExtendedMenu((ExtendedMenuProvider) provider); } From 7b8e775372d11ceaac92b5970b8fd352997b4f30 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 31 Mar 2026 21:25:52 +0900 Subject: [PATCH 035/151] bump version 3.5.3 --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 8b7dae628..83b4b5712 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.5.2 +mod_version=3.5.3 maven_group=net.pitan76 changelog=Add Compat APIs From bf43100904e11c42a5bd8329d0b72502ed616de1 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 31 Mar 2026 23:21:25 +0900 Subject: [PATCH 036/151] fix: update cloth-config-fabric version and adjust dependencies --- build.gradle | 8 ++++---- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 99df56c6c..22581ba83 100644 --- a/build.gradle +++ b/build.gradle @@ -43,10 +43,10 @@ dependencies { implementation 'org.yaml:snakeyaml:2.0' shadow 'org.yaml:snakeyaml:2.0' -// api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { -// exclude(group: "net.fabricmc.fabric-api") -// } -// include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") + api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") implementation("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") { exclude(group: "net.fabricmc.fabric-api") diff --git a/gradle.properties b/gradle.properties index 329f1659f..d3733e9ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ fabric_api_version=0.144.0+26.1 # https://projects.neoforged.net/neoforged/neoforge neoforge_version=26.1.0.1-beta -#cloth_config_version=21.11.153 +cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.15.261 From 9dcf7ab6ef7f25f7486ad5ff534c4e1ca2771dfa Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 1 Apr 2026 17:38:21 +0900 Subject: [PATCH 037/151] fix: improve menu handling and add crafting remainder check --- .../api/item/CompatibleItemSettings.java | 3 --- .../api/util/ScreenHandlerUtil.java | 25 +++++++++++++++++-- .../mcpitanlib/api/util/item/ItemUtil.java | 3 +++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java index bd3cafb34..61287548d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java @@ -1,15 +1,12 @@ package net.pitan76.mcpitanlib.api.item; -import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.Item; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.resources.ResourceKey; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; -import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java index 373c92cc3..a8cbb7c3d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java @@ -3,12 +3,17 @@ import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.inventory.Slot; import net.minecraft.server.level.ServerPlayer; import net.minecraft.core.NonNullList; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import org.jspecify.annotations.Nullable; import java.util.ArrayList; import java.util.List; @@ -32,8 +37,24 @@ public static List> getAllScreenHandlerTypes() { } public static void openExtendedMenu(ServerPlayer player, MenuProvider provider, Consumer bufWriter) { - // TODO: Fabric API does not support opening a menu with a bufWriter, so we need to find a way to do this. -// player.openMenu(player, provider, bufWriter); + player.openMenu(new ExtendedMenuProvider<>() { + @Override + public @Nullable AbstractContainerMenu createMenu(int containerId, Inventory inventory, Player player) { + return provider.createMenu(containerId, inventory, player); + } + + @Override + public Component getDisplayName() { + return provider.getDisplayName(); + } + + @Override + public Object getScreenOpeningData(ServerPlayer player) { + FriendlyByteBuf buf = PacketByteUtil.create(); + bufWriter.accept(buf); + return buf; + } + }); } public static void openExtendedMenu(ServerPlayer player, ExtendedMenuProvider provider) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java index 57f2cc228..9b9c0348e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java @@ -258,6 +258,9 @@ public static Item getRecipeRemainder(Item item) { } public static ItemStack getRecipeRemainderStack(Item item) { + if (item.getCraftingRemainder() == null) + return ItemStackUtil.empty(); + return item.getCraftingRemainder().create(); } } From 70191b0d4d179073af6f14196c1bd6c3c2250753 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 1 Apr 2026 23:09:18 +0900 Subject: [PATCH 038/151] feat: add cursor stack handling methods in ScreenHandlerUtil and SimpleScreenHandler --- .../mcpitanlib/api/gui/SimpleScreenHandler.java | 8 ++++++++ .../mcpitanlib/api/util/ScreenHandlerUtil.java | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java index 57f1e1243..80594e1b5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java @@ -272,4 +272,12 @@ public int getStateId() { public int callGetRevision() { return super.getStateId(); } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getCursorStackM() { + return ScreenHandlerUtil.getCursorStackM(this); + } + + public ItemStack callGetCursorStack() { + return ScreenHandlerUtil.getCursorStack(this); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java index a8cbb7c3d..35e4b9074 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java @@ -12,6 +12,7 @@ import net.minecraft.world.inventory.Slot; import net.minecraft.server.level.ServerPlayer; import net.minecraft.core.NonNullList; +import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; import org.jspecify.annotations.Nullable; @@ -72,4 +73,20 @@ public static int getRawId(MenuType type) { public static MenuType fromIndex(int index) { return BuiltInRegistries.MENU.byId(index); } + + public static ItemStack getCursorStack(AbstractContainerMenu screenHandler) { + return screenHandler.getCarried(); + } + + public static net.pitan76.mcpitanlib.midohra.item.ItemStack getCursorStackM(AbstractContainerMenu screenHandler) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getCursorStack(screenHandler)); + } + + public static void setCursorStack(AbstractContainerMenu screenHandler, ItemStack stack) { + screenHandler.setCarried(stack); + } + + public static void setCursorStackM(AbstractContainerMenu screenHandler, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + setCursorStack(screenHandler, stack.toMinecraft()); + } } From 70e4f9c08d969db056e0afcabf92d1cf12bde196 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Fri, 3 Apr 2026 22:17:16 +0900 Subject: [PATCH 039/151] fix: update littleobffallback dependency handling and adjust crafting remainder return type --- build.gradle | 8 ++++---- .../java/net/pitan76/mcpitanlib/mixin/ItemMixin.java | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 22581ba83..cd86c3064 100644 --- a/build.gradle +++ b/build.gradle @@ -54,12 +54,12 @@ dependencies { implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { exclude(group: "net.fabricmc.fabric-api") } -// implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { -// exclude(group: "net.fabricmc.fabric-api") -// } + implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { + changing = true + } include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") -// include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") + include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") } processResources { diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java index ecd497aa4..7401bb058 100644 --- a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java +++ b/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java @@ -1,16 +1,13 @@ package net.pitan76.mcpitanlib.mixin; +import net.minecraft.world.item.*; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.item.component.TooltipDisplay; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.item.ItemUseAnimation; -import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.server.level.ServerLevel; import net.minecraft.network.chat.Component; @@ -29,7 +26,6 @@ import net.pitan76.mcpitanlib.api.item.v2.CompatItemProvider; import net.pitan76.mcpitanlib.api.util.CompatActionResult; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; -import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -246,11 +242,11 @@ public class ItemMixin { } @Inject(method = "getCraftingRemainder", at = @At("HEAD"), cancellable = true) - private void mcpitanlib$getRecipeRemainder(CallbackInfoReturnable cir) { + private void mcpitanlib$getRecipeRemainder(CallbackInfoReturnable cir) { if (this instanceof FixedRecipeRemainderItem) { ItemStack returnValue = ((FixedRecipeRemainderItem) this) .getFixedRecipeRemainder(ItemStackUtil.create((Item) (Object) this)); - cir.setReturnValue(returnValue); + cir.setReturnValue(ItemStackTemplate.fromNonEmptyStack(returnValue)); } } } From 03a000bc23f4881abcd462e63924685f46349af6 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Fri, 3 Apr 2026 22:43:38 +0900 Subject: [PATCH 040/151] fix: update compatdatapacks76 version to 1.0.16.261 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d3733e9ae..cd0b4ae98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ neoforge_version=26.1.0.1-beta cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ -compatdatapacks76_version=1.0.15.261 +compatdatapacks76_version=1.0.16.261 legacyitemmodels_version=1.0.2.261 littleobffallback_version=0.0.2.261-SNAPSHOT From 418bde30e9f0837597eb22f84ec2468ee1861f5f Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Fri, 3 Apr 2026 22:50:44 +0900 Subject: [PATCH 041/151] fix: update compatdatapacks76 version to 1.0.17.261 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index cd0b4ae98..8acb3f50b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ neoforge_version=26.1.0.1-beta cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ -compatdatapacks76_version=1.0.16.261 +compatdatapacks76_version=1.0.17.261 legacyitemmodels_version=1.0.2.261 littleobffallback_version=0.0.2.261-SNAPSHOT From a8698e3e3ca6281142d47b571476ee5cb88a844f Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Fri, 3 Apr 2026 23:48:31 +0900 Subject: [PATCH 042/151] fix: update compatdatapacks76 version to 1.0.16.261-SNAPSHOT and adjust littleobffallback version --- gradle.properties | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8acb3f50b..2851c6bd0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,9 +15,10 @@ neoforge_version=26.1.0.1-beta cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ -compatdatapacks76_version=1.0.17.261 +compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.0.2.261-SNAPSHOT +#littleobffallback_version=0.0.2.261-SNAPSHOT +littleobffallback_version=0.0.2.261-20260403.144559-12 fabricEnabled=true neoforgeEnabled=false From b81c4189253dd0ee3e51f78004f4a0b593939c3f Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Fri, 3 Apr 2026 23:59:24 +0900 Subject: [PATCH 043/151] fix: update sound event variants for chicken, cow, and pig entities --- .../api/sound/CompatSoundEvents.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java index 3d4a04c96..44615c9cc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java @@ -1,7 +1,10 @@ package net.pitan76.mcpitanlib.api.sound; import com.google.common.collect.ImmutableList; +import net.minecraft.world.entity.animal.chicken.ChickenSoundVariants; +import net.minecraft.world.entity.animal.cow.CowSoundVariants; import net.minecraft.world.entity.animal.feline.CatSoundVariants; +import net.minecraft.world.entity.animal.pig.PigSoundVariants; import net.minecraft.world.entity.animal.wolf.WolfSoundVariants; import net.minecraft.sounds.SoundEvents; @@ -309,10 +312,10 @@ public class CompatSoundEvents { public static final CompatSoundEvent BLOCK_CHEST_CLOSE = new CompatSoundEvent(SoundEvents.CHEST_CLOSE); public static final CompatSoundEvent BLOCK_CHEST_LOCKED = new CompatSoundEvent(SoundEvents.CHEST_LOCKED); public static final CompatSoundEvent BLOCK_CHEST_OPEN = new CompatSoundEvent(SoundEvents.CHEST_OPEN); - public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); - public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); + public static final CompatSoundEvent ENTITY_CHICKEN_AMBIENT = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(ChickenSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); + public static final CompatSoundEvent ENTITY_CHICKEN_DEATH = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(ChickenSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); public static final CompatSoundEvent ENTITY_CHICKEN_EGG = new CompatSoundEvent(SoundEvents.CHICKEN_EGG); - public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); + public static final CompatSoundEvent ENTITY_CHICKEN_HURT = new CompatSoundEvent(SoundEvents.CHICKEN_SOUNDS.get(ChickenSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); public static final CompatSoundEvent ENTITY_CHICKEN_STEP = new CompatSoundEvent(SoundEvents.CHICKEN_STEP); public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_BREAK = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_BREAK); public static final CompatSoundEvent BLOCK_CHISELED_BOOKSHELF_FALL = new CompatSoundEvent(SoundEvents.CHISELED_BOOKSHELF_FALL); @@ -371,11 +374,11 @@ public class CompatSoundEvents { public static final CompatSoundEvent BLOCK_CORAL_BLOCK_HIT = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_HIT); public static final CompatSoundEvent BLOCK_CORAL_BLOCK_PLACE = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_PLACE); public static final CompatSoundEvent BLOCK_CORAL_BLOCK_STEP = new CompatSoundEvent(SoundEvents.CORAL_BLOCK_STEP); - public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).ambientSound()); - public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).deathSound()); - public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).hurtSound()); + public static final CompatSoundEvent ENTITY_COW_AMBIENT = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CowSoundVariants.SoundSet.CLASSIC).ambientSound()); + public static final CompatSoundEvent ENTITY_COW_DEATH = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CowSoundVariants.SoundSet.CLASSIC).deathSound()); + public static final CompatSoundEvent ENTITY_COW_HURT = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CowSoundVariants.SoundSet.CLASSIC).hurtSound()); public static final CompatSoundEvent ENTITY_COW_MILK = new CompatSoundEvent(SoundEvents.COW_MILK); - public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).stepSound()); + public static final CompatSoundEvent ENTITY_COW_STEP = new CompatSoundEvent(SoundEvents.COW_SOUNDS.get(CowSoundVariants.SoundSet.CLASSIC).stepSound()); public static final CompatSoundEvent BLOCK_CRAFTER_CRAFT = new CompatSoundEvent(SoundEvents.CRAFTER_CRAFT); public static final CompatSoundEvent BLOCK_CRAFTER_FAIL = new CompatSoundEvent(SoundEvents.CRAFTER_FAIL); public static final CompatSoundEvent ENTITY_CREEPER_DEATH = new CompatSoundEvent(SoundEvents.CREEPER_DEATH); @@ -1072,9 +1075,9 @@ public class CompatSoundEvents { public static final CompatSoundEvent ENTITY_PHANTOM_FLAP = new CompatSoundEvent(SoundEvents.PHANTOM_FLAP); public static final CompatSoundEvent ENTITY_PHANTOM_HURT = new CompatSoundEvent(SoundEvents.PHANTOM_HURT); public static final CompatSoundEvent ENTITY_PHANTOM_SWOOP = new CompatSoundEvent(SoundEvents.PHANTOM_SWOOP); - public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); - public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); - public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(CatSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); + public static final CompatSoundEvent ENTITY_PIG_AMBIENT = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(PigSoundVariants.SoundSet.CLASSIC).adultSounds().ambientSound()); + public static final CompatSoundEvent ENTITY_PIG_DEATH = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(PigSoundVariants.SoundSet.CLASSIC).adultSounds().deathSound()); + public static final CompatSoundEvent ENTITY_PIG_HURT = new CompatSoundEvent(SoundEvents.PIG_SOUNDS.get(PigSoundVariants.SoundSet.CLASSIC).adultSounds().hurtSound()); public static final CompatSoundEvent ENTITY_PIG_SADDLE = new CompatSoundEvent(SoundEvents.PIG_SADDLE); public static final CompatSoundEvent ENTITY_PIG_STEP = new CompatSoundEvent(SoundEvents.PIG_STEP); public static final CompatSoundEvent ENTITY_PIGLIN_ADMIRING_ITEM = new CompatSoundEvent(SoundEvents.PIGLIN_ADMIRING_ITEM); From 5497220149442b9e5eea43c34378b09b5dd86e3e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 00:00:33 +0900 Subject: [PATCH 044/151] fix: update littleobffallback version to 0.0.3.261-SNAPSHOT --- gradle.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2851c6bd0..6de374bff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,8 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -#littleobffallback_version=0.0.2.261-SNAPSHOT -littleobffallback_version=0.0.2.261-20260403.144559-12 +littleobffallback_version=0.0.3.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From cacba972eea2b6ec8d998e2878cf605e59f9fb3b Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 00:07:23 +0900 Subject: [PATCH 045/151] fix: update fabric loader and API versions to 0.18.6 and 0.145.1+26.1 respectively --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6de374bff..c9f88d9fd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,8 +6,8 @@ minecraft_version=26.1 #architectury_version=19.0.1 # https://fabricmc.net/develop/ -fabric_loader_version=0.18.4 -fabric_api_version=0.144.0+26.1 +fabric_loader_version=0.18.6 +fabric_api_version=0.145.1+26.1 # https://projects.neoforged.net/neoforged/neoforge neoforge_version=26.1.0.1-beta From a01f485bc7c09550a59ee053f2400075b57641cb Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 00:30:36 +0900 Subject: [PATCH 046/151] fix: enhance item group handling in registry and settings --- .../net/pitan76/mcpitanlib/api/item/CreativeTabManager.java | 5 ++--- .../mcpitanlib/api/item/v2/CompatibleItemSettings.java | 6 ++++++ .../pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java index 4dd6b7e69..f58c20291 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java @@ -74,9 +74,8 @@ public CreativeModeTab getItemGroup() { public static void allRegister() { if (!MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.isEmpty()) { for (Map.Entry, Identifier> entry : MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.entrySet()) { - CreativeModeTabEvents.modifyOutputEvent(entry.getKey()).register(entries -> { - entries.accept(new ItemStack(ItemUtil.fromId(entry.getValue()))); - }); + CreativeModeTabEvents.modifyOutputEvent(entry.getKey()).register(entries -> + entries.accept(new ItemStack(ItemUtil.fromId(entry.getValue())))); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java index a9e72281f..8c1e5b01c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java @@ -17,6 +17,7 @@ import net.pitan76.mcpitanlib.api.tag.item.RepairIngredientTag; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.CompatRarity; +import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; @@ -169,6 +170,11 @@ public ExtendSettings build() { if (identifier != null) { settings.setId(ResourceKey.create(Registries.ITEM, identifier.toMinecraft())); + + if (itemGroupId != null) { + ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, itemGroupId); + MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.put(key, identifier.toMinecraft()); + } } return settings; diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java index 616c8fa24..b17a0c9c7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java @@ -33,7 +33,8 @@ public void register() { public RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, id); - RegistrySupplier itemGroup = new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, supplier.get())); + RegistrySupplier itemGroup = + new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, supplier.get())); // RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(key, itemGroup); return itemGroup; @@ -41,7 +42,8 @@ public RegistrySupplier registryItemGroup(Identifier id, Suppli public RegistrySupplier registryItemGroup(Identifier id, CreativeTabBuilder builder) { ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, id); - RegistrySupplier itemGroup = new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, builder.build())); + RegistrySupplier itemGroup = + new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, builder.build())); // RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(key, itemGroup); return itemGroup; From 9f2be9d8476a750ab5d7b37c5c9333adb0aaead3 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 00:33:42 +0900 Subject: [PATCH 047/151] fix: refactor item group handling to use list for item IDs in registry --- .../mcpitanlib/api/item/CompatibleItemSettings.java | 2 +- .../mcpitanlib/api/item/CreativeTabManager.java | 4 ++-- .../api/item/v2/CompatibleItemSettings.java | 2 +- .../mcpitanlib/core/registry/MCPLRegistry1_20.java | 12 +++++++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java index 61287548d..744c340cd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java @@ -92,7 +92,7 @@ public ExtendSettings build() { // }); // if (output instanceof Item.Settings settings) // settings.arch$tab(itemGroup); - MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.put(key, _itemId); + MCPLRegistry1_20.addItemGroupItem(key, _itemId); } if (_itemId != null && !(this instanceof net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings)) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java index f58c20291..bfcc4ccc8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java @@ -73,9 +73,9 @@ public CreativeModeTab getItemGroup() { public static void allRegister() { if (!MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.isEmpty()) { - for (Map.Entry, Identifier> entry : MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.entrySet()) { + for (Map.Entry, List> entry : MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.entrySet()) { CreativeModeTabEvents.modifyOutputEvent(entry.getKey()).register(entries -> - entries.accept(new ItemStack(ItemUtil.fromId(entry.getValue())))); + entries.acceptAll(entry.getValue().stream().map(id -> new ItemStack(ItemUtil.fromId(id))).toList())); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java index 8c1e5b01c..86e74fd93 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java @@ -173,7 +173,7 @@ public ExtendSettings build() { if (itemGroupId != null) { ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, itemGroupId); - MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.put(key, identifier.toMinecraft()); + MCPLRegistry1_20.addItemGroupItem(key, identifier.toMinecraft()); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java index b17a0c9c7..92cd14a22 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java @@ -9,7 +9,9 @@ import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.function.Supplier; @@ -19,7 +21,15 @@ public class MCPLRegistry1_20 { public static final Map, RegistrySupplier> REGISTRY_SUPPLIER_ITEM_GROUP_CACHE = new HashMap<>(); @Deprecated - public static final Map, Identifier> ITEM_GROUP_ITEM_ID_CACHE = new HashMap<>(); + public static final Map, List> ITEM_GROUP_ITEM_ID_CACHE = new HashMap<>(); + + public static void addItemGroupItem(ResourceKey itemGroup, Identifier itemId) { + if (!ITEM_GROUP_ITEM_ID_CACHE.containsKey(itemGroup)) { + ITEM_GROUP_ITEM_ID_CACHE.put(itemGroup, new ArrayList<>()); + } + + ITEM_GROUP_ITEM_ID_CACHE.get(itemGroup).add(itemId); + } private final MCPLRegistry mcplr; From ef2f44dbb2070e14facee5031dfef2079c143588 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 02:15:42 +0900 Subject: [PATCH 048/151] fix: update littleobffallback version to 0.0.4.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c9f88d9fd..11bd03da5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.0.3.261-SNAPSHOT +littleobffallback_version=0.0.4.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 2348a5034fcaaf9a99513efa78625ccc12273256 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 02:21:18 +0900 Subject: [PATCH 049/151] fix: update littleobffallback version to 0.0.5.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 11bd03da5..9e650bef3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.0.4.261-SNAPSHOT +littleobffallback_version=0.0.5.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From a983d5ee04570776ecb0483b67bf7715c1fa54f7 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 02:25:07 +0900 Subject: [PATCH 050/151] fix: update littleobffallback version to 0.0.7.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9e650bef3..a5505e3af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.0.5.261-SNAPSHOT +littleobffallback_version=0.0.7.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 0ee6a68bddd7716f377de16cd275a0686c91a626 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 02:39:52 +0900 Subject: [PATCH 051/151] fix: update littleobffallback version to 0.0.9.261-SNAPSHOT and refactor particle effect methods --- gradle.properties | 2 +- .../util/particle/effect/ItemStackParticleEffectUtil.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index a5505e3af..498bbcae6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.0.7.261-SNAPSHOT +littleobffallback_version=0.0.9.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java index a5aeb00b6..d50e422bc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java @@ -12,11 +12,11 @@ public ItemStackParticleEffectUtil() { // Empty constructor } - public ItemParticleOption create(ParticleType type, ItemStack stack) { - return new ItemParticleOption(type, stack.getItem()); + public ParticleType create(ParticleType type, ItemStack stack) { + return new ItemParticleOption(type, stack.getItem()).getType(); } - public ItemParticleOption createTypedItem(ItemStack stack) { - return new ItemParticleOption(ParticleTypes.ITEM, stack.getItem()); + public ParticleType createTypedItem(ItemStack stack) { + return new ItemParticleOption(ParticleTypes.ITEM, stack.getItem()).getType(); } } From e937bc960019181ec446ed5bc84ff0cc59033819 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 02:46:59 +0900 Subject: [PATCH 052/151] fix: update littleobffallback version to 0.1.0.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 498bbcae6..3fcca9587 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.0.9.261-SNAPSHOT +littleobffallback_version=0.1.0.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 20e203634b65f89213c90f50dc80fa486e3207c3 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 02:57:10 +0900 Subject: [PATCH 053/151] fix: update littleobffallback version to 0.1.1.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 3fcca9587..1ef62f7fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.1.0.261-SNAPSHOT +littleobffallback_version=0.1.1.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 03ad80f77a63e0318f71c54effee6365712a6898 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 03:22:33 +0900 Subject: [PATCH 054/151] fix: update littleobffallback version to 0.1.6.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1ef62f7fc..6b3c554c7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.1.1.261-SNAPSHOT +littleobffallback_version=0.1.6.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 03e6ef649aabd851da5e9c3620a3dfbbb3c00d42 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 03:32:41 +0900 Subject: [PATCH 055/151] fix: update littleobffallback version to 0.1.7.261-SNAPSHOT and refactor particle effect methods --- gradle.properties | 2 +- .../util/particle/effect/ItemStackParticleEffectUtil.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6b3c554c7..8f93461de 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.1.6.261-SNAPSHOT +littleobffallback_version=0.1.7.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java index d50e422bc..a5aeb00b6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java @@ -12,11 +12,11 @@ public ItemStackParticleEffectUtil() { // Empty constructor } - public ParticleType create(ParticleType type, ItemStack stack) { - return new ItemParticleOption(type, stack.getItem()).getType(); + public ItemParticleOption create(ParticleType type, ItemStack stack) { + return new ItemParticleOption(type, stack.getItem()); } - public ParticleType createTypedItem(ItemStack stack) { - return new ItemParticleOption(ParticleTypes.ITEM, stack.getItem()).getType(); + public ItemParticleOption createTypedItem(ItemStack stack) { + return new ItemParticleOption(ParticleTypes.ITEM, stack.getItem()); } } From 4501d0360c78d818cf973fc787d5b613f8fd83ff Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 12:24:22 +0900 Subject: [PATCH 056/151] fix: update littleobffallback version to 0.1.8.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8f93461de..618bf73ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.1.7.261-SNAPSHOT +littleobffallback_version=0.1.8.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From b1d6b2ba271699430294724c23391c11621f154f Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 12:37:12 +0900 Subject: [PATCH 057/151] fix: update littleobffallback version to 0.2.0.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 618bf73ac..d24cfbc9a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.1.8.261-SNAPSHOT +littleobffallback_version=0.2.0.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From dd37b01482415ecbc9d943fbe47f0622805bbc3b Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 12:54:13 +0900 Subject: [PATCH 058/151] fix: update littleobffallback version to 0.2.1.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d24cfbc9a..29e68126f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.2.0.261-SNAPSHOT +littleobffallback_version=0.2.1.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From c5cc876f2b6aacc8a6a9035a3ede2f399863d553 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 12:54:54 +0900 Subject: [PATCH 059/151] [cp] chore: bump version 3.6.0 --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 83b4b5712..6d47cbd6e 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.5.3 +mod_version=3.6.0 maven_group=net.pitan76 changelog=Add Compat APIs From 581647f076c289597880047caa8c8d6223e90f57 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 13:04:54 +0900 Subject: [PATCH 060/151] fix: update littleobffallback version to 0.2.2.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 29e68126f..ffb3aa0ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.2.1.261-SNAPSHOT +littleobffallback_version=0.2.2.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From b56000f31fc473fa6ef57b6a9680a10dee4c9353 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 13:19:50 +0900 Subject: [PATCH 061/151] fix: update littleobffallback version to 0.2.4.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ffb3aa0ca..4301c0800 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.2.2.261-SNAPSHOT +littleobffallback_version=0.2.4.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 71b6fe1c609fa414f6bdc710a0cef36cd5135871 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 13:27:12 +0900 Subject: [PATCH 062/151] fix: update littleobffallback version to 0.2.5.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4301c0800..ef821a4df 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.2.4.261-SNAPSHOT +littleobffallback_version=0.2.5.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 5a8d6a8457376018782799132c40c7629dd81bb1 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 14:50:27 +0900 Subject: [PATCH 063/151] fix: update littleobffallback version to 0.2.5.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ef821a4df..43e205ac3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.2.5.261-SNAPSHOT +littleobffallback_version=0.2.6.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 9567904f62f45180f4af2e4b8800e27d19593d6c Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 4 Apr 2026 16:33:59 +0900 Subject: [PATCH 064/151] feat: add new utility classes and methods for block and item handling --- .../api/gui/SimpleScreenHandler.java | 24 ++++++ .../api/gui/slot/CompatibleSlot.java | 9 +++ .../api/util/BlockEntityDataUtil.java | 25 ++++++ .../mcpitanlib/api/util/block/BlockUtil.java | 4 + .../api/util/collection/ItemStackList.java | 4 + .../api/util/inventory/CompatInventory.java | 2 +- .../util/inventory/CompatPlayerInventory.java | 47 ++++++++++- .../effect/CompatItemStackParticleEffect.java | 58 ++++++++++++++ .../particle/effect/CompatParticleEffect.java | 45 +++++++++++ .../api/util/recipe/CraftingRecipeUtil.java | 67 ++++++++++++++++ .../mcpitanlib/midohra/block/BlockStateM.java | 30 +++++++ .../midohra/block/BlockWrapper.java | 9 +++ .../mcpitanlib/midohra/block/MCBlocks.java | 4 + .../midohra/block/SupplierBlockWrapper.java | 5 ++ .../block/SupplierTypedBlockWrapper.java | 41 ++++++++++ .../midohra/block/TypedBlockWrapper.java | 22 ++++++ .../block/entity/BlockEntityTypeWrapper.java | 18 +++++ .../SupplierBlockEntityTypeWrapper.java | 5 ++ .../entity/SupplierBlockEntityWrapper.java | 5 ++ .../SupplierTypedBlockEntityWrapper.java | 41 ++++++++++ .../block/entity/TypedBlockEntityWrapper.java | 22 ++++++ .../midohra/entity/EntityWrapper.java | 19 ++++- .../entity/SupplierEntityTypeWrapper.java | 32 ++++++++ .../midohra/entity/SupplierEntityWrapper.java | 32 ++++++++ .../midohra/item/ItemGroupWrapper.java | 20 ++++- .../mcpitanlib/midohra/item/MCItems.java | 4 + .../item/SupplierItemGroupWrapper.java | 37 +++++++++ .../midohra/item/SupplierItemWrapper.java | 10 +++ .../item/SupplierTypedItemWrapper.java | 41 ++++++++++ .../midohra/item/TypedItemWrapper.java | 26 +++++++ .../midohra/registry/MidohraRegistry.java | 78 +++++++++++++++++++ .../midohra/util/math/BlockPos.java | 56 +++++++++++++ .../mcpitanlib/midohra/world/ServerWorld.java | 11 +++ .../mcpitanlib/midohra/world/World.java | 47 +++++++++++ .../mcpitanlib/midohra/world/WorldAccess.java | 12 +++ 35 files changed, 906 insertions(+), 6 deletions(-) create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java index 80594e1b5..f0ea77dc5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java @@ -280,4 +280,28 @@ public net.pitan76.mcpitanlib.midohra.item.ItemStack getCursorStackM() { public ItemStack callGetCursorStack() { return ScreenHandlerUtil.getCursorStack(this); } + + public void setCursorStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + ScreenHandlerUtil.setCursorStackM(this, stack); + } + + @Deprecated + @Override + public boolean canTakeItemForPickAll(ItemStack carried, Slot target) { + return canInsertIntoSlotOverride(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(carried), target); + } + + @Deprecated + @Override + public boolean canDragTo(Slot slot) { + return canInsertIntoSlotOverride(slot); + } + + public boolean canInsertIntoSlotOverride(net.pitan76.mcpitanlib.midohra.item.ItemStack carried, Slot target) { + return super.canTakeItemForPickAll(carried.toMinecraft(), target); + } + + public boolean canInsertIntoSlotOverride(Slot slot) { + return super.canDragTo(slot); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java index 2251a367b..c3ab9a336 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java @@ -4,6 +4,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.inventory.Slot; import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; public class CompatibleSlot extends Slot { @@ -20,6 +21,14 @@ public CompatibleSlot(Container inventory, int index, int x, int y) { this.y = y; } + public CompatibleSlot(ICompatInventory inventory, int index, int x, int y) { + super(inventory, index, x, y); + this.inventory = inventory; + this.index = index; + this.x = x; + this.y = y; + } + public void callSetStack(ItemStack stack) { super.setByPlayer(stack); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java index 9db5a8e30..5286b0057 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java @@ -8,6 +8,7 @@ import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; public class BlockEntityDataUtil { public static CompoundTag getBlockEntityNbt(ItemStack stack) { @@ -46,4 +47,28 @@ public static void writeCompatBlockEntityNbtToStack(ItemStack stack, CompatBlock public static void removeBlockEntityNbt(ItemStack stack) { stack.remove(DataComponents.BLOCK_ENTITY_DATA); } + + public static boolean hasBlockEntityNbt(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return hasBlockEntityNbt(stack.toMinecraft()); + } + + public static NbtCompound getBlockEntityNbt(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return NbtCompound.of(getBlockEntityNbt(stack.toMinecraft())); + } + + public static void setBlockEntityNbt(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, NbtCompound nbt) { + setBlockEntityNbt(stack.toMinecraft(), nbt.toMinecraft()); + } + + public static void removeBlockEntityNbt(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + removeBlockEntityNbt(stack.toMinecraft()); + } + + public static void readCompatBlockEntityNbtFromStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, CompatBlockEntity blockEntity) { + readCompatBlockEntityNbtFromStack(stack.toMinecraft(), blockEntity); + } + + public static void writeCompatBlockEntityNbtToStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, CompatBlockEntity blockEntity) { + writeCompatBlockEntityNbtToStack(stack.toMinecraft(), blockEntity); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java index be1667a5e..05d7d21d3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java @@ -232,4 +232,8 @@ public static Block fromItem(Item item) { public static Block fromItem(ItemStack stack) { return BlockUtilV2.fromItem(stack); } + + public static float getHardness(Block block) { + return block.defaultDestroyTime(); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java index e049ac557..a96d6a813 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java @@ -211,4 +211,8 @@ public static ItemStackList of2(List stacks) { return list; } + + public void set(int index, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + set(index, stack.toMinecraft()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java index d2a4d6149..b39e393eb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java @@ -16,7 +16,7 @@ import java.util.List; -public class CompatInventory extends SimpleContainer { +public class CompatInventory extends SimpleContainer implements ICompatInventory { public CompatInventory(int size) { super(size); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java index a46122524..9bc1e4875 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java @@ -4,7 +4,7 @@ import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.entity.Player; -public class CompatPlayerInventory { +public class CompatPlayerInventory implements ICompatInventory { public Inventory inv; public CompatPlayerInventory(Inventory inv) { @@ -38,5 +38,50 @@ public void offerOrDrop(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { public Inventory getRaw() { return inv; } + + @Override + public int getContainerSize() { + return inv.getContainerSize(); + } + + @Override + public boolean isEmpty() { + return inv.isEmpty(); + } + + @Override + public ItemStack getItem(int slot) { + return inv.getItem(slot); + } + + @Override + public ItemStack removeItem(int slot, int count) { + return inv.removeItem(slot, count); + } + + @Override + public ItemStack removeItemNoUpdate(int slot) { + return inv.removeItemNoUpdate(slot); + } + + @Override + public void setItem(int slot, ItemStack itemStack) { + inv.setItem(slot, itemStack); + } + + @Override + public void setChanged() { + inv.setChanged(); + } + + @Override + public boolean stillValid(net.minecraft.world.entity.player.Player player) { + return inv.stillValid(player); + } + + @Override + public void clearContent() { + inv.clearContent(); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java new file mode 100644 index 000000000..bc63b10e5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java @@ -0,0 +1,58 @@ +package net.pitan76.mcpitanlib.api.util.particle.effect; + +import net.minecraft.core.particles.ItemParticleOption; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemStackTemplate; +import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.util.ParticleEffectUtil; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +public class CompatItemStackParticleEffect extends CompatParticleEffect { + @Deprecated + public CompatItemStackParticleEffect(ItemParticleOption effect) { + super(effect); + } + + public CompatItemStackParticleEffect(ItemStack stack) { + this(ParticleEffectUtil.itemStack.createTypedItem(stack)); + } + + @Deprecated + public static CompatItemStackParticleEffect of(ItemParticleOption effect) { + return new CompatItemStackParticleEffect(effect); + } + + public static CompatItemStackParticleEffect of(ItemStack stack) { + return new CompatItemStackParticleEffect(stack); + } + + public static CompatItemStackParticleEffect of(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return new CompatItemStackParticleEffect(stack.toMinecraft()); + } + + public static CompatItemStackParticleEffect of(CompatParticleEffect effect) { + if (effect.getRaw() instanceof ItemParticleOption itemEffect) { + return new CompatItemStackParticleEffect(itemEffect); + } + throw new IllegalArgumentException("The provided particle effect is not an ItemParticleOption."); + } + + public static CompatItemStackParticleEffect of(Item item) { + return new CompatItemStackParticleEffect(ItemStackUtil.create(item)); + } + + public static CompatItemStackParticleEffect of(ItemWrapper item) { + return of(item.get()); + } + + public ItemStack getStack() { + ItemParticleOption itemEffect = (ItemParticleOption) getRaw(); + ItemStackTemplate template = itemEffect.getItem(); + return template.create(); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java new file mode 100644 index 000000000..51967cdf4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java @@ -0,0 +1,45 @@ +package net.pitan76.mcpitanlib.api.util.particle.effect; + +import net.minecraft.core.particles.ParticleOptions; +import net.pitan76.mcpitanlib.api.util.particle.CompatParticleType; + +public class CompatParticleEffect { + private final ParticleOptions effect; + + @Deprecated + public CompatParticleEffect(ParticleOptions effect) { + this.effect = effect; + } + + @Deprecated + public static CompatParticleEffect of(ParticleOptions effect) { + return new CompatParticleEffect(effect); + } + + public static CompatParticleEffect of(CompatParticleType type) { + ParticleOptions options = type::getRaw; + return new CompatParticleEffect(options); + } + + @Deprecated + public ParticleOptions getRaw() { + return effect; + } + + public CompatParticleType getType() { + return CompatParticleType.of(getRaw().getType()); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatParticleEffect other = (CompatParticleEffect) obj; + return getRaw().equals(other.getRaw()); + } + + @Override + public int hashCode() { + return getRaw().hashCode(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java new file mode 100644 index 000000000..d7068de66 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java @@ -0,0 +1,67 @@ +package net.pitan76.mcpitanlib.api.util.recipe; + +import net.minecraft.world.level.Level; +import net.pitan76.mcpitanlib.api.util.LoggerUtil; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.recipe.CraftingRecipe; +import net.pitan76.mcpitanlib.midohra.recipe.ShapedRecipe; +import net.pitan76.mcpitanlib.midohra.recipe.ShapelessRecipe; +import net.pitan76.mcpitanlib.midohra.recipe.entry.RecipeEntry; +import net.pitan76.mcpitanlib.midohra.recipe.input.CraftingRecipeInputOrInventory; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import net.pitan76.mcpitanlib.midohra.world.World; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.stream.Collectors; + +public class CraftingRecipeUtil { + @Nullable + public static ItemStack getOutput(CraftingRecipe recipe, CraftingRecipeInputOrInventory input, World world) { + if (recipe instanceof ShapedRecipe || recipe instanceof ShapelessRecipe) { + return recipe.getOutputMidohra(input, world); + } else { + try { + return recipe.getOutputMidohra(input, world); + } catch (ArrayIndexOutOfBoundsException e) { + String id = "Unknown recipe"; + for (RecipeEntry entry : RecipeUtil.getRecipeEntries(world)) { + if (entry.getRawRecipe() == recipe.getRaw()) { + id = entry.getId().toString(); + break; + } + } + + LoggerUtil.getLogger().error("{}: {}", e.getMessage(), id); + return null; + } catch (Exception ignored) { + return null; + } + } + } + + public static net.minecraft.world.item.ItemStack getOutputRaw(CraftingRecipe recipe, CraftingRecipeInputOrInventory input, Level world) { + return getOutput(recipe, input, World.of(world)).toMinecraft(); + } + + public static Collection getCraftingRecipes(ServerWorld world) { + try { + return RecipeUtil.getCraftingRecipes(world).stream().map( + recipe -> { + if (recipe instanceof ShapedRecipe || recipe instanceof ShapelessRecipe) + return recipe; + + if (recipe.getRaw() instanceof net.minecraft.world.item.crafting.ShapedRecipe) + return ShapedRecipe.of((net.minecraft.world.item.crafting.ShapedRecipe) recipe.getRaw()); + + if (recipe.getRaw() instanceof net.minecraft.world.item.crafting.ShapelessRecipe) + return ShapelessRecipe.of((net.minecraft.world.item.crafting.ShapelessRecipe) recipe.getRaw()); + + return recipe; + } + ).collect(Collectors.toList()); + } catch (Exception e) { + return RecipeUtil.getCraftingRecipes(world); + } + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java new file mode 100644 index 000000000..540980728 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java @@ -0,0 +1,30 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.api.util.BlockStateUtil; + +public class BlockStateM extends BlockState { + + public BlockStateM(net.minecraft.world.level.block.state.BlockState state) { + super(state); + } + + public BlockStateM(Block block) { + this(BlockStateUtil.getDefaultState(block)); + } + + public BlockStateM(BlockWrapper wrapper) { + this(wrapper.get()); + } + + public static BlockStateM of(net.minecraft.world.level.block.state.BlockState state) { + return new BlockStateM(state); + } + + public static BlockStateM of(Block block) { + if (block == null) + return of((net.minecraft.world.level.block.state.BlockState) null); + + return of(BlockStateUtil.getDefaultState(block)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java index ec5330103..6926efd35 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -133,4 +133,13 @@ public Optional toBuiltBlock() { } return Optional.empty(); } + + public float getHardness() { + if (isEmpty()) return 0; + return BlockUtil.getHardness(block); + } + + public BlockStateM getDefaultStateM() { + return BlockStateM.of(get()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java new file mode 100644 index 000000000..b6426f748 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java @@ -0,0 +1,4 @@ +package net.pitan76.mcpitanlib.midohra.block; + +public class MCBlocks extends Blocks { +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java index 0b001d093..4c798f789 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java @@ -2,6 +2,7 @@ import net.minecraft.world.level.block.Block; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import java.util.function.Supplier; @@ -20,6 +21,10 @@ public static SupplierBlockWrapper of(RegistryResult result) { return new SupplierBlockWrapper(result::get); } + public static SupplierBlockWrapper of(RegistrySupplier result) { + return new SupplierBlockWrapper(result::get); + } + @Override public Block get() { return supplier.get(); diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java new file mode 100644 index 000000000..4e3dc94f4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierTypedBlockWrapper extends TypedBlockWrapper { + private final Supplier supplier; + + protected SupplierTypedBlockWrapper(Supplier supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierTypedBlockWrapper of(Supplier supplier) { + return new SupplierTypedBlockWrapper<>(supplier); + } + + public static SupplierTypedBlockWrapper of(RegistryResult result) { + return new SupplierTypedBlockWrapper<>(result::get); + } + + public static SupplierTypedBlockWrapper of(RegistrySupplier result) { + return new SupplierTypedBlockWrapper<>(result::get); + } + + public static SupplierTypedBlockWrapper of(SupplierBlockWrapper result) { + return new SupplierTypedBlockWrapper<>(() -> (T) result.get()); + } + + public SupplierBlockWrapper asNonTyped() { + return SupplierBlockWrapper.of(supplier::get); + } + + @Override + public T get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java new file mode 100644 index 000000000..da5ab6ae5 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.minecraft.world.level.block.Block; + +public class TypedBlockWrapper extends BlockWrapper { + protected TypedBlockWrapper(T item) { + super(item); + } + + public static TypedBlockWrapper ofRaw(T item) { + return new TypedBlockWrapper<>(item); + } + + public static TypedBlockWrapper of(BlockWrapper wrapper) { + return new TypedBlockWrapper<>((T) wrapper.get()); + } + + @Override + public T get() { + return (T) super.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java index 8d56a2c48..e6746abe5 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java @@ -55,4 +55,22 @@ public BlockEntityWrapper createBlockEntity(TileCreateEvent e) { return SupplierBlockEntityWrapper.of(get().create(e.getBlockPos(), e.getBlockState())); } + + @Override + public int hashCode() { + return isEmpty() ? 0 : get().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + + BlockEntityTypeWrapper other = (BlockEntityTypeWrapper) obj; + + if (isEmpty() && other.isEmpty()) return true; + if (isEmpty() || other.isEmpty()) return false; + + return get().equals(other.get()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java index 0ee931c72..c9c267555 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java @@ -2,6 +2,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import java.util.function.Supplier; @@ -20,6 +21,10 @@ public static SupplierBlockEntityTypeWrapper of(RegistryResult> result) { + return new SupplierBlockEntityTypeWrapper(result::get); + } + @Override public BlockEntityType get() { return supplier.get(); diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java index 2c97dfdd0..9c8b68639 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java @@ -2,6 +2,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import java.util.function.Supplier; @@ -20,6 +21,10 @@ public static SupplierBlockEntityWrapper of(RegistryResult result) return new SupplierBlockEntityWrapper(result::get); } + public static SupplierBlockEntityWrapper of(RegistrySupplier result) { + return new SupplierBlockEntityWrapper(result::get); + } + @Override public BlockEntity get() { return supplier.get(); diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java new file mode 100644 index 000000000..f8b122a95 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.minecraft.world.level.block.entity.BlockEntity; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierTypedBlockEntityWrapper extends TypedBlockEntityWrapper { + private final Supplier supplier; + + protected SupplierTypedBlockEntityWrapper(Supplier supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierTypedBlockEntityWrapper of(Supplier supplier) { + return new SupplierTypedBlockEntityWrapper<>(supplier); + } + + public static SupplierTypedBlockEntityWrapper of(RegistryResult result) { + return new SupplierTypedBlockEntityWrapper<>(result::get); + } + + public static SupplierTypedBlockEntityWrapper of(RegistrySupplier result) { + return new SupplierTypedBlockEntityWrapper<>(result::get); + } + + public static SupplierTypedBlockEntityWrapper of(SupplierBlockEntityWrapper result) { + return new SupplierTypedBlockEntityWrapper<>(() -> (T) result.get()); + } + + public SupplierBlockEntityWrapper asNonTyped() { + return SupplierBlockEntityWrapper.of(supplier::get); + } + + @Override + public T get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java new file mode 100644 index 000000000..13f98f49b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.minecraft.world.level.block.entity.BlockEntity; + +public class TypedBlockEntityWrapper extends BlockEntityWrapper { + protected TypedBlockEntityWrapper(T item) { + super(item); + } + + public static TypedBlockEntityWrapper ofRaw(T item) { + return new TypedBlockEntityWrapper<>(item); + } + + public static TypedBlockEntityWrapper of(BlockEntityWrapper wrapper) { + return new TypedBlockEntityWrapper<>((T) wrapper.get()); + } + + @Override + public T get() { + return (T) super.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java index ff683cacd..301d3a8df 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java @@ -6,8 +6,8 @@ import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.EntityUtil; -import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.ChunkPos; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; import net.pitan76.mcpitanlib.midohra.world.ServerWorld; import net.pitan76.mcpitanlib.midohra.world.World; @@ -331,4 +331,21 @@ public Optional toCompatEntity() { public void spawn(World world) { world.spawnEntity(this); } + + public ChunkPos getChunkPos() { + return ChunkPos.of(get().chunkPosition()); + } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + EntityWrapper other = (EntityWrapper) obj; + return get() != null && get().equals(other.get()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java new file mode 100644 index 000000000..8ccd81cad --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.world.entity.EntityType; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierEntityTypeWrapper extends EntityTypeWrapper { + private final Supplier> supplier; + + protected SupplierEntityTypeWrapper(Supplier> supplier) { + this.supplier = supplier; + } + + public static SupplierEntityTypeWrapper of(Supplier> supplier) { + return new SupplierEntityTypeWrapper(supplier); + } + + public static SupplierEntityTypeWrapper of(RegistryResult> result) { + return new SupplierEntityTypeWrapper(result::get); + } + + public static SupplierEntityTypeWrapper of(RegistrySupplier> result) { + return new SupplierEntityTypeWrapper(result::get); + } + + @Override + public EntityType get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java new file mode 100644 index 000000000..409919b14 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.world.entity.Entity; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierEntityWrapper extends EntityWrapper { + private final Supplier supplier; + + protected SupplierEntityWrapper(Supplier supplier) { + this.supplier = supplier; + } + + public static SupplierEntityWrapper of(Supplier supplier) { + return new SupplierEntityWrapper(supplier); + } + + public static SupplierEntityWrapper of(RegistryResult result) { + return new SupplierEntityWrapper(result::get); + } + + public static SupplierEntityWrapper of(RegistrySupplier result) { + return new SupplierEntityWrapper(result::get); + } + + @Override + public Entity get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java index 887e1938b..747ec716e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java @@ -43,15 +43,29 @@ public net.minecraft.world.item.CreativeModeTab get() { public CompatIdentifier getId() { if (isEmpty()) return CompatIdentifier.empty(); - return ItemGroupUtil.toCompatID(itemGroup); + return ItemGroupUtil.toCompatID(get()); } public ItemStack getIcon() { if (isEmpty()) return ItemStack.EMPTY; - return ItemStack.of(itemGroup.getIconItem()); + return ItemStack.of(get().getIconItem()); } public boolean rawEquals(ItemGroupWrapper other) { - return itemGroup == other.itemGroup; + return get() == other.get(); + } + + @Override + public int hashCode() { + return get() != null ? get().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + + ItemGroupWrapper other = (ItemGroupWrapper) obj; + return rawEquals(other); } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java new file mode 100644 index 000000000..0384e429a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java @@ -0,0 +1,4 @@ +package net.pitan76.mcpitanlib.midohra.item; + +public class MCItems extends Items { +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java new file mode 100644 index 000000000..ac6714db4 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java @@ -0,0 +1,37 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.world.item.CreativeModeTab; +import net.pitan76.mcpitanlib.api.item.CreativeTabBuilder; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierItemGroupWrapper extends ItemGroupWrapper { + private final Supplier supplier; + + protected SupplierItemGroupWrapper(Supplier supplier) { + this.supplier = supplier; + } + + public static SupplierItemGroupWrapper of(Supplier supplier) { + return new SupplierItemGroupWrapper(supplier); + } + + public static SupplierItemGroupWrapper of(RegistryResult result) { + return new SupplierItemGroupWrapper(result::get); + } + + public static SupplierItemGroupWrapper of(RegistrySupplier result) { + return new SupplierItemGroupWrapper(result::get); + } + + public static SupplierItemGroupWrapper of(CreativeTabBuilder builder) { + return new SupplierItemGroupWrapper(builder::build); + } + + @Override + public CreativeModeTab get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java index 6563c07f2..2d8e6fd82 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java @@ -1,6 +1,8 @@ package net.pitan76.mcpitanlib.midohra.item; import net.minecraft.world.item.Item; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import java.util.function.Supplier; @@ -15,6 +17,14 @@ public static SupplierItemWrapper of(Supplier supplier) { return new SupplierItemWrapper(supplier); } + public static SupplierItemWrapper of(RegistryResult result) { + return new SupplierItemWrapper(result::get); + } + + public static SupplierItemWrapper of(RegistrySupplier result) { + return new SupplierItemWrapper(result::get); + } + @Override public Item get() { return supplier.get(); diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java new file mode 100644 index 000000000..6b22b4b9e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.world.item.Item; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierTypedItemWrapper extends TypedItemWrapper { + private final Supplier supplier; + + protected SupplierTypedItemWrapper(Supplier supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierTypedItemWrapper of(Supplier supplier) { + return new SupplierTypedItemWrapper<>(supplier); + } + + public static SupplierTypedItemWrapper of(RegistryResult result) { + return new SupplierTypedItemWrapper<>(result::get); + } + + public static SupplierTypedItemWrapper of(RegistrySupplier result) { + return new SupplierTypedItemWrapper<>(result::get); + } + + public static SupplierTypedItemWrapper of(SupplierItemWrapper result) { + return new SupplierTypedItemWrapper<>(() -> (T) result.get()); + } + + public SupplierItemWrapper asNonTyped() { + return SupplierItemWrapper.of(supplier::get); + } + + @Override + public T get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java new file mode 100644 index 000000000..823f0ef3d --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.world.item.Item; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class TypedItemWrapper extends ItemWrapper { + protected TypedItemWrapper(T item) { + super(item); + } + + public static TypedItemWrapper ofRaw(T item) { + return new TypedItemWrapper<>(item); + } + + public static TypedItemWrapper of(ItemWrapper wrapper) { + return new TypedItemWrapper<>((T) wrapper.get()); + } + + @Override + public T get() { + return (T) super.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java new file mode 100644 index 000000000..6a3a58966 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java @@ -0,0 +1,78 @@ +package net.pitan76.mcpitanlib.midohra.registry; + +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.SupplierTypedBlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.TypedBlockWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.item.SupplierItemWrapper; +import net.pitan76.mcpitanlib.midohra.item.SupplierTypedItemWrapper; +import net.pitan76.mcpitanlib.midohra.item.TypedItemWrapper; + +import java.util.function.Supplier; + +public class MidohraRegistry { + protected final CompatRegistryV2 registry; + + public MidohraRegistry(CompatRegistryV2 registry) { + this.registry = registry; + } + + public static MidohraRegistry of(CompatRegistryV2 registry) { + return new MidohraRegistry(registry); + } + + public CompatRegistryV2 getCompatRegistry() { + return registry; + } + + public ItemWrapper registerRawItem(CompatIdentifier id, Supplier supplier) { + return SupplierItemWrapper.of(registry.registerItem(id, supplier)); + } + + public ItemWrapper registerRawItem(String id, Supplier supplier) { + return registerRawItem(fixId(id), supplier); + } + + public TypedItemWrapper registerItem(CompatIdentifier id, Supplier supplier) { + return SupplierTypedItemWrapper.of(registerRawItem(id, supplier::get)); + } + + public TypedItemWrapper registerItem(String id, Supplier supplier) { + return registerItem(fixId(id), supplier); + } + + public BlockWrapper registerRawBlock(CompatIdentifier id, Supplier supplier) { + return SupplierBlockWrapper.of(registry.registerBlock(id, supplier)); + } + + public BlockWrapper registerRawBlock(String id, Supplier supplier) { + return registerRawBlock(fixId(id), supplier); + } + + public TypedBlockWrapper registerBlock(CompatIdentifier id, Supplier supplier) { + return SupplierTypedBlockWrapper.of(registerRawBlock(id, supplier::get)); + } + + public TypedBlockWrapper registerBlock(String id, Supplier supplier) { + return registerBlock(fixId(id), supplier); + } + + /** + * If the id doesn't contain a namespace, add the default namespace to it. + * @param id The id to fix. + * @return The fixed id. + */ + public CompatIdentifier fixId(String id) { + if (!id.contains(":")) { + id = registry.cr1.getNamespace() + ":" + id; + } + return CompatIdentifier.of(id); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java index 915dfcd1e..25751d2a0 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java @@ -135,4 +135,60 @@ public Vector3d toVector3d() { public Vector3d toCenterVector3d() { return new Vector3d(getX() + 0.5, getY() + 0.5, getZ() + 0.5); } + + public int getManhattanDistance(Vector3i other) { + return blockPos.distManhattan(other.toMinecraft()); + } + + public int getManhattanDistance(BlockPos other) { + return blockPos.distManhattan(other.toMinecraft()); + } + + public BlockPos up(int n) { + return new BlockPos(blockPos.above(n)); + } + + public BlockPos down(int n) { + return new BlockPos(blockPos.below(n)); + } + + public BlockPos north(int n) { + return new BlockPos(blockPos.north(n)); + } + + public BlockPos south(int n) { + return new BlockPos(blockPos.south(n)); + } + + public BlockPos east(int n) { + return new BlockPos(blockPos.east(n)); + } + + public BlockPos west(int n) { + return new BlockPos(blockPos.west(n)); + } + + public BlockPos[] getAllFaces() { + return new BlockPos[] { + up(), down(), north(), south(), east(), west() + }; + } + + public BlockPos[] getAllFaces(int n) { + return new BlockPos[] { + up(n), down(n), north(n), south(n), east(n), west(n) + }; + } + + public BlockPos[] getVerticalFaces() { + return new BlockPos[] { + up(), down() + }; + } + + public BlockPos[] getHorizontalFaces() { + return new BlockPos[] { + north(), south(), east(), west() + }; + } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java index f34b04aa0..d250e8b53 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java @@ -4,10 +4,13 @@ import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; +import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.recipe.ServerRecipeManager; import net.pitan76.mcpitanlib.midohra.server.MCServer; import net.pitan76.mcpitanlib.midohra.server.PlayerManager; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.ChunkPos; +import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; import net.pitan76.mcpitanlib.midohra.world.chunk.ServerChunkManager; public class ServerWorld extends World { @@ -60,4 +63,12 @@ public ServerChunkManager getChunkManager() { public ServerRecipeManager getRecipeManager() { return ServerRecipeManager.of(this); } + + public void addTicket(ChunkTicketType type, ChunkPos pos, int radius) { + WorldUtil.addTicket(getRaw(), type, pos.getRaw(), radius); + } + + public void removeTicket(ChunkTicketType type, ChunkPos pos, int radius) { + WorldUtil.removeTicket(getRaw(), type, pos.getRaw(), radius); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java index 1740c0d07..4eb769cad 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java @@ -13,9 +13,12 @@ import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.particle.effect.CompatParticleEffect; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.recipe.RecipeManager; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; import java.util.List; import java.util.Optional; @@ -163,4 +166,48 @@ public boolean isAir(BlockPos pos) { public Block getBlock(BlockPos pos) { return WorldUtil.getBlock(getRaw(), pos.toMinecraft()); } + + public void addParticle(CompatParticleEffect effect, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + WorldUtil.addParticle(getRaw(), effect.getRaw(), x, y, z, velocityX, velocityY, velocityZ); + } + + public void addParticle(CompatParticleEffect effect, Vector3d pos, Vector3d velocity) { + addParticle(effect, pos.getX(), pos.getY(), pos.getZ(), velocity.getX(), velocity.getY(), velocity.getZ()); + } + + public boolean isRaining() { + return WorldUtil.isRaining(getRaw()); + } + + public boolean isThundering() { + return WorldUtil.isThundering(getRaw()); + } + + public boolean hasSkyLight() { + return WorldUtil.hasSkyLight(getRaw()); + } + + public boolean isSkyVisible(BlockPos pos) { + return WorldUtil.isSkyVisible(getRaw(), pos.toMinecraft()); + } + + public boolean isDay() { + return WorldUtil.isDay(getRaw()); + } + + public float getSkyAngle(float partialTicks) { + return WorldUtil.getSkyAngle(getRaw(), partialTicks); + } + + public float getSkyAngle() { + return getSkyAngle(0); + } + + public void dropStackOnBlock(BlockPos pos, ItemStack stack) { + WorldUtil.dropStackOnBlock(getRaw(), pos.toMinecraft(), stack.toMinecraft()); + } + + public void spawnStack(ItemStack stack, BlockPos pos) { + WorldUtil.spawnStack(getRaw(), pos.toMinecraft(), stack.toMinecraft()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java index 761d96c12..4ce80c704 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -186,4 +186,16 @@ public void spawnEntity(Entity entity) { public void spawnEntity(EntityWrapper entity) { spawnEntity(entity.get()); } + + public List getMobs(Box box) { + return getEntitiesByClassM(net.minecraft.world.entity.Mob.class, box); + } + + public List getAnimals(Box box) { + return getEntitiesByClassM(net.minecraft.world.entity.animal.Animal.class, box); + } + + public int getLuminance(BlockPos pos) { + return getBlockState(pos).getLuminance(); + } } From bc1d0d2ef697f2d9c3932e4d11b72daa59901011 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 5 Apr 2026 15:32:34 +0900 Subject: [PATCH 065/151] feat: introduce BlockHalfProperty and StairShapeProperty with compatibility utilities --- .../api/block/v2/CompatStairsBlock.java | 8 ++-- .../api/state/property/BlockHalfProperty.java | 34 +++++++++++++ .../api/state/property/EnumProperty.java | 8 ++-- .../state/property/StairShapeProperty.java | 34 +++++++++++++ .../block/properties/CompatBlockHalf.java | 45 +++++++++++++++++ .../block/properties/CompatStairShape.java | 48 +++++++++++++++++++ .../api/util/collection/ItemStackList.java | 4 ++ .../api/util/color/CompatBrightness.java | 13 ++++- .../api/util/color/CompatDyeColor.java | 13 +++++ .../api/util/color/CompatMapColor.java | 13 +++++ .../api/util/particle/CompatParticleType.java | 13 +++++ .../mcpitanlib/midohra/block/BlockState.java | 28 +++++++++++ .../midohra/block/BlockWrapper.java | 4 ++ .../block/entity/BlockEntityTypeWrapper.java | 9 +++- .../SupplierTypedBlockEntityTypeWrapper.java | 42 ++++++++++++++++ .../entity/TypedBlockEntityTypeWrapper.java | 36 ++++++++++++++ .../block/entity/TypedBlockEntityWrapper.java | 8 ++-- .../SupplierTypedEntityTypeWrapper.java | 42 ++++++++++++++++ .../entity/TypedEntityTypeWrapper.java | 23 +++++++++ .../midohra/fluid/FluidWrapper.java | 4 ++ .../mcpitanlib/midohra/item/ItemStack.java | 40 ++++++++++++++++ .../mcpitanlib/midohra/item/ItemWrapper.java | 4 ++ .../mcpitanlib/midohra/world/WorldAccess.java | 10 +++- 23 files changed, 465 insertions(+), 18 deletions(-) create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java index fc823a7ce..fb8ce089d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java @@ -9,10 +9,7 @@ import net.minecraft.world.level.BlockGetter; import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; -import net.pitan76.mcpitanlib.api.state.property.BooleanProperty; -import net.pitan76.mcpitanlib.api.state.property.CompatProperties; -import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; -import net.pitan76.mcpitanlib.api.state.property.EnumProperty; +import net.pitan76.mcpitanlib.api.state.property.*; import net.pitan76.mcpitanlib.midohra.block.BlockState; public class CompatStairsBlock extends net.pitan76.mcpitanlib.api.block.CompatStairsBlock { @@ -22,6 +19,9 @@ public class CompatStairsBlock extends net.pitan76.mcpitanlib.api.block.CompatSt public static final EnumProperty SHAPE = CompatProperties.of(StairBlock.SHAPE); public static final BooleanProperty WATERLOGGED = CompatProperties.of(StairBlock.WATERLOGGED); + public static final BlockHalfProperty COMPAT_HALF = BlockHalfProperty.ofRaw(StairBlock.HALF); + public static final StairShapeProperty COMPAT_SHAPE = StairShapeProperty.ofRaw(StairBlock.SHAPE); + public CompatStairsBlock(net.minecraft.world.level.block.state.BlockState baseBlockState, CompatibleBlockSettings settings) { super(baseBlockState, settings); } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java new file mode 100644 index 000000000..0736b97b0 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.state.property; + +import net.minecraft.world.level.block.state.properties.Half; +import net.pitan76.mcpitanlib.api.util.block.properties.CompatBlockHalf; +import net.pitan76.mcpitanlib.midohra.block.BlockState; + +import java.util.function.Predicate; + +public class BlockHalfProperty extends EnumProperty { + + public BlockHalfProperty(String name, Class type) { + super(name, type); + } + + public BlockHalfProperty(String name, Class type, Predicate filter) { + super(name, type, filter); + } + + public BlockHalfProperty(net.minecraft.world.level.block.state.properties.EnumProperty property) { + super(property); + } + + public static BlockHalfProperty ofRaw(net.minecraft.world.level.block.state.properties.EnumProperty property) { + return new BlockHalfProperty(property); + } + + public BlockState with(BlockState state, CompatBlockHalf value) { + return super.with(state, value.getBlockHalf()); + } + + public CompatBlockHalf getCompat(BlockState state) { + return CompatBlockHalf.of(super.get(state)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java index d80a945c9..2d6b94f03 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java @@ -6,7 +6,7 @@ public class EnumProperty & StringRepresentable> implements IProperty { - private final net.minecraft.world.level.block.state.properties.EnumProperty property; + private final net.minecraft.world.level.block.state.properties.EnumProperty property; public EnumProperty(String name, Class type) { this(net.minecraft.world.level.block.state.properties.EnumProperty.create(name, type)); @@ -16,7 +16,7 @@ public EnumProperty(String name, Class type, Predicate filter) { this(net.minecraft.world.level.block.state.properties.EnumProperty.create(name, type, filter)); } - public EnumProperty(net.minecraft.world.level.block.state.properties.EnumProperty property) { + public EnumProperty(net.minecraft.world.level.block.state.properties.EnumProperty property) { this.property = property; } @@ -29,12 +29,12 @@ public static & StringRepresentable> EnumProperty of(Strin } - public static & StringRepresentable> EnumProperty of(net.minecraft.world.level.block.state.properties.EnumProperty property) { + public static & StringRepresentable> EnumProperty of(net.minecraft.world.level.block.state.properties.EnumProperty property) { return new EnumProperty<>(property); } @Override - public net.minecraft.world.level.block.state.properties.EnumProperty getProperty() { + public net.minecraft.world.level.block.state.properties.EnumProperty getProperty() { return property; } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java b/src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java new file mode 100644 index 000000000..e5b241e45 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.state.property; + +import net.minecraft.world.level.block.state.properties.StairsShape; +import net.pitan76.mcpitanlib.api.util.block.properties.CompatStairShape; +import net.pitan76.mcpitanlib.midohra.block.BlockState; + +import java.util.function.Predicate; + +public class StairShapeProperty extends EnumProperty { + + public StairShapeProperty(String name, Class type) { + super(name, type); + } + + public StairShapeProperty(String name, Class type, Predicate filter) { + super(name, type, filter); + } + + public StairShapeProperty(net.minecraft.world.level.block.state.properties.EnumProperty property) { + super(property); + } + + public static StairShapeProperty ofRaw(net.minecraft.world.level.block.state.properties.EnumProperty property) { + return new StairShapeProperty(property); + } + + public BlockState with(BlockState state, CompatStairShape value) { + return super.with(state, value.getStairShape()); + } + + public CompatStairShape getCompat(BlockState state) { + return CompatStairShape.of(super.get(state)); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java new file mode 100644 index 000000000..f8a764691 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java @@ -0,0 +1,45 @@ +package net.pitan76.mcpitanlib.api.util.block.properties; + +import net.minecraft.world.level.block.state.properties.Half; +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class CompatBlockHalf implements CompatStringIdentifiable { + private final Half blockHalf; + + public static final CompatBlockHalf TOP = of(Half.TOP); + public static final CompatBlockHalf BOTTOM = of(Half.BOTTOM); + + public CompatBlockHalf(Half blockHalf) { + this.blockHalf = blockHalf; + } + + public static CompatBlockHalf of(Half blockHalf) { + return new CompatBlockHalf(blockHalf); + } + + public Half getBlockHalf() { + return blockHalf; + } + + public String getName() { + return blockHalf.name(); + } + + @Override + public String asString_compat() { + return getName(); + } + + @Override + public int hashCode() { + return blockHalf.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatBlockHalf other = (CompatBlockHalf) obj; + return blockHalf == other.blockHalf; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java b/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java new file mode 100644 index 000000000..3a25a73f6 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.util.block.properties; + +import net.minecraft.world.level.block.state.properties.StairsShape; +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class CompatStairShape implements CompatStringIdentifiable { + private final StairsShape stairShape; + + public static final CompatStairShape STRAIGHT = of(StairsShape.STRAIGHT); + public static final CompatStairShape INNER_LEFT = of(StairsShape.INNER_LEFT); + public static final CompatStairShape INNER_RIGHT = of(StairsShape.INNER_RIGHT); + public static final CompatStairShape OUTER_LEFT = of(StairsShape.OUTER_LEFT); + public static final CompatStairShape OUTER_RIGHT = of(StairsShape.OUTER_RIGHT); + + public CompatStairShape(StairsShape stairShape) { + this.stairShape = stairShape; + } + + public static CompatStairShape of(StairsShape stairShape) { + return new CompatStairShape(stairShape); + } + + public StairsShape getStairShape() { + return stairShape; + } + + public String getName() { + return stairShape.name(); + } + + @Override + public String asString_compat() { + return getName(); + } + + @Override + public int hashCode() { + return stairShape.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatStairShape other = (CompatStairShape) obj; + return stairShape == other.stairShape; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java index a96d6a813..bfac1d570 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java @@ -215,4 +215,8 @@ public static ItemStackList of2(List stacks) { public void set(int index, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { set(index, stack.toMinecraft()); } + + public boolean isEmpty(int index) { + return get(index).isEmpty(); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java index 947765b0f..a7aa2866b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java @@ -34,7 +34,16 @@ public int getBrightness() { return get().modifier; } + @Override + public int hashCode() { + return brightness.hashCode(); + } - - + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatBrightness other = (CompatBrightness) obj; + return brightness == other.brightness; + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java index 68ce038a5..452b97db7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java @@ -43,4 +43,17 @@ public String getName() { public String asString_compat() { return getName(); } + + @Override + public int hashCode() { + return color.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatDyeColor other = (CompatDyeColor) obj; + return color == other.color; + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java index 905491fdb..75de88416 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java @@ -91,4 +91,17 @@ public int getRgb() { public int getRenderColor(CompatBrightness brightness) { return color.calculateARGBColor(brightness.get()); } + + @Override + public int hashCode() { + return color.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatMapColor other = (CompatMapColor) obj; + return color.equals(other.color); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java index 49469c5ad..d6b69364e 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java @@ -31,4 +31,17 @@ public Identifier getId() { public CompatIdentifier getCompatId() { return CompatIdentifier.fromMinecraft(getId()); } + + @Override + public int hashCode() { + return particleType.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + CompatParticleType other = (CompatParticleType) obj; + return particleType.equals(other.particleType); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java index fe1b8f495..2855ae7f6 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java @@ -2,9 +2,13 @@ import net.minecraft.world.level.block.state.properties.Property; import net.pitan76.mcpitanlib.api.sound.CompatBlockSoundGroup; +import net.pitan76.mcpitanlib.api.state.property.BlockHalfProperty; import net.pitan76.mcpitanlib.api.state.property.DirectionProperty; import net.pitan76.mcpitanlib.api.state.property.IProperty; +import net.pitan76.mcpitanlib.api.state.property.StairShapeProperty; import net.pitan76.mcpitanlib.api.util.BlockStateUtil; +import net.pitan76.mcpitanlib.api.util.block.properties.CompatBlockHalf; +import net.pitan76.mcpitanlib.api.util.block.properties.CompatStairShape; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.world.ServerWorld; import net.pitan76.mcpitanlib.midohra.world.World; @@ -72,6 +76,14 @@ public BlockState with(DirectionProperty property, net.pitan76.mcpitanlib.midohr return of(property.with(toMinecraft(), value.toMinecraft())); } + public BlockState with(BlockHalfProperty property, CompatBlockHalf value) { + return of(property.with(toMinecraft(), value.getBlockHalf())); + } + + public BlockState with(StairShapeProperty property, CompatStairShape value) { + return of(property.with(toMinecraft(), value.getStairShape())); + } + public > BlockState cycle(Property property) { return of(toMinecraft().cycle(property)); } @@ -96,6 +108,14 @@ public net.pitan76.mcpitanlib.midohra.util.math.Direction get(DirectionProperty return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(get(property.getProperty())); } + public CompatBlockHalf get(BlockHalfProperty property) { + return CompatBlockHalf.of(get(property.getProperty())); + } + + public CompatStairShape get(StairShapeProperty property) { + return CompatStairShape.of(get(property.getProperty())); + } + public > boolean contains(Property property) { return toMinecraft().hasProperty(property); } @@ -108,6 +128,14 @@ public boolean contains(DirectionProperty property) { return contains(property.getProperty()); } + public boolean contains(BlockHalfProperty property) { + return contains(property.getProperty()); + } + + public boolean contains(StairShapeProperty property) { + return contains(property.getProperty()); + } + @Override public int hashCode() { return toMinecraft().hashCode(); diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java index 6926efd35..b613a8ebb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -60,6 +60,10 @@ public net.minecraft.world.level.block.Block get() { } public net.minecraft.world.level.block.Block gerOrDefault(net.minecraft.world.level.block.Block defaultItem) { + return getOrDefault(defaultItem); + } + + public net.minecraft.world.level.block.Block getOrDefault(net.minecraft.world.level.block.Block defaultItem) { return isEmpty() ? defaultItem : get(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java index e6746abe5..b6fe8300d 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java @@ -42,18 +42,23 @@ public boolean supports(BlockState state) { return isPresent() && get().isValid(state.toMinecraft()); } + public boolean hasBlockEntity(BlockView world, BlockPos pos) { + if (isEmpty()) return false; + return get().getBlockEntity(world.getRaw(), pos.toMinecraft()) != null; + } + public BlockEntityWrapper getBlockEntity(BlockView world, BlockPos pos) { if (isEmpty()) return BlockEntityWrapper.EMPTY; - return SupplierBlockEntityWrapper.of(get().getBlockEntity(world.getRaw(), pos.toMinecraft())); + return BlockEntityWrapper.of(get().getBlockEntity(world.getRaw(), pos.toMinecraft())); } public BlockEntityWrapper createBlockEntity(TileCreateEvent e) { if (isEmpty()) return BlockEntityWrapper.EMPTY; - return SupplierBlockEntityWrapper.of(get().create(e.getBlockPos(), e.getBlockState())); + return BlockEntityWrapper.of(get().create(e.getBlockPos(), e.getBlockState())); } @Override diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java new file mode 100644 index 000000000..7b08f0d6a --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierTypedBlockEntityTypeWrapper extends TypedBlockEntityTypeWrapper { + private final Supplier> supplier; + + protected SupplierTypedBlockEntityTypeWrapper(Supplier> supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierTypedBlockEntityTypeWrapper of(Supplier> supplier) { + return new SupplierTypedBlockEntityTypeWrapper<>(supplier); + } + + public static SupplierTypedBlockEntityTypeWrapper of(RegistryResult> result) { + return new SupplierTypedBlockEntityTypeWrapper<>(result::get); + } + + public static SupplierTypedBlockEntityTypeWrapper of(RegistrySupplier> result) { + return new SupplierTypedBlockEntityTypeWrapper<>(result::get); + } + + public static SupplierTypedBlockEntityTypeWrapper of(SupplierBlockEntityTypeWrapper result) { + return new SupplierTypedBlockEntityTypeWrapper<>(() -> (BlockEntityType) result.get()); + } + + public SupplierBlockEntityTypeWrapper asNonTyped() { + return SupplierBlockEntityTypeWrapper.of(supplier::get); + } + + @Override + public BlockEntityType get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java new file mode 100644 index 000000000..d492cc9be --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.midohra.block.entity; + +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.BlockView; + +public class TypedBlockEntityTypeWrapper extends BlockEntityTypeWrapper { + protected TypedBlockEntityTypeWrapper(BlockEntityType type) { + super(type); + } + + public static TypedBlockEntityTypeWrapper ofRaw(BlockEntityType type) { + return new TypedBlockEntityTypeWrapper<>(type); + } + + public static TypedBlockEntityTypeWrapper of(BlockEntityTypeWrapper wrapper) { + return new TypedBlockEntityTypeWrapper<>((BlockEntityType) wrapper.get()); + } + + @Override + public BlockEntityType get() { + return (BlockEntityType) super.get(); + } + + @Override + public TypedBlockEntityWrapper getBlockEntity(BlockView world, BlockPos pos) { + return TypedBlockEntityWrapper.ofRaw(get().getBlockEntity(world.getRaw(), pos.toMinecraft())); + } + + @Override + public TypedBlockEntityWrapper createBlockEntity(TileCreateEvent e) { + return TypedBlockEntityWrapper.ofRaw(get().create(e.getBlockPos(), e.getBlockState())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java index 13f98f49b..9e8c37bdb 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java @@ -3,12 +3,12 @@ import net.minecraft.world.level.block.entity.BlockEntity; public class TypedBlockEntityWrapper extends BlockEntityWrapper { - protected TypedBlockEntityWrapper(T item) { - super(item); + protected TypedBlockEntityWrapper(T blockEntity) { + super(blockEntity); } - public static TypedBlockEntityWrapper ofRaw(T item) { - return new TypedBlockEntityWrapper<>(item); + public static TypedBlockEntityWrapper ofRaw(T blockEntity) { + return new TypedBlockEntityWrapper<>(blockEntity); } public static TypedBlockEntityWrapper of(BlockEntityWrapper wrapper) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java new file mode 100644 index 000000000..879b6c991 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierTypedEntityTypeWrapper extends TypedEntityTypeWrapper { + private final Supplier> supplier; + + protected SupplierTypedEntityTypeWrapper(Supplier> supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierTypedEntityTypeWrapper of(Supplier> supplier) { + return new SupplierTypedEntityTypeWrapper<>(supplier); + } + + public static SupplierTypedEntityTypeWrapper of(RegistryResult> result) { + return new SupplierTypedEntityTypeWrapper<>(result::get); + } + + public static SupplierTypedEntityTypeWrapper of(RegistrySupplier> result) { + return new SupplierTypedEntityTypeWrapper<>(result::get); + } + + public static SupplierTypedEntityTypeWrapper of(SupplierEntityTypeWrapper result) { + return new SupplierTypedEntityTypeWrapper<>(() -> (EntityType) result.get()); + } + + public SupplierEntityTypeWrapper asNonTyped() { + return SupplierEntityTypeWrapper.of(supplier::get); + } + + @Override + public EntityType get() { + return supplier.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java new file mode 100644 index 000000000..d2e44ad35 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java @@ -0,0 +1,23 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; + +public class TypedEntityTypeWrapper extends EntityTypeWrapper { + protected TypedEntityTypeWrapper(EntityType type) { + super(type); + } + + public static TypedEntityTypeWrapper ofRaw(EntityType type) { + return new TypedEntityTypeWrapper<>(type); + } + + public static TypedEntityTypeWrapper of(EntityTypeWrapper wrapper) { + return new TypedEntityTypeWrapper<>((EntityType) wrapper.get()); + } + + @Override + public EntityType get() { + return (EntityType) super.get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java index 2af5cc3e0..703665cc1 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java @@ -58,6 +58,10 @@ public net.minecraft.world.level.material.Fluid get() { } public net.minecraft.world.level.material.Fluid gerOrDefault(net.minecraft.world.level.material.Fluid defaultFluid) { + return getOrDefault(defaultFluid); + } + + public net.minecraft.world.level.material.Fluid getOrDefault(net.minecraft.world.level.material.Fluid defaultFluid) { return isEmpty() ? defaultFluid : get(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java index b48710d53..6f3e08a58 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java @@ -219,4 +219,44 @@ public void setLoreM(List lore) { public List getLoreM() { return getLore().stream().map(TextComponent::new).toList(); } + + @Override + public int hashCode() { + return stack.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + + ItemStack other = (ItemStack) obj; + return stack.equals(other.stack); + } + + /** + * instanceof check for the raw item of this stack. + * @param clazz the class of the item to check + * @return true if the raw item of this stack is an instance of the given class, false otherwise + */ + public boolean instanceOf(Class clazz) { + if (isEmpty()) return false; + + return clazz.isInstance(getRawItem()); + } + + /** + * instanceof check for the raw item of this stack. + * @param wrapper the item to check + * @return true if the raw item of this stack is an instance of the given item, false otherwise + */ + public boolean instanceOf(ItemWrapper wrapper) { + if (isEmpty()) return false; + + Item item = wrapper.get(); + if (item == null) return false; + + Class clazz = item.getClass(); + return clazz.isInstance(getRawItem()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java index 3955cee32..a258183a4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java @@ -65,6 +65,10 @@ public net.minecraft.world.item.Item get() { } public net.minecraft.world.item.Item gerOrDefault(net.minecraft.world.item.Item defaultItem) { + return getOrDefault(defaultItem); + } + + public net.minecraft.world.item.Item getOrDefault(net.minecraft.world.item.Item defaultItem) { return isEmpty() ? defaultItem : get(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java index 4ce80c704..134154f55 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -1,5 +1,7 @@ package net.pitan76.mcpitanlib.midohra.world; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.entity.Entity; @@ -188,11 +190,15 @@ public void spawnEntity(EntityWrapper entity) { } public List getMobs(Box box) { - return getEntitiesByClassM(net.minecraft.world.entity.Mob.class, box); + return getEntitiesByClassM(LivingEntity.class, box, entity -> entity.get() instanceof net.minecraft.world.entity.Mob); + } + + public List getMonsters(Box box) { + return getEntitiesByClassM(LivingEntity.class, box, entity -> entity.get() instanceof Enemy); } public List getAnimals(Box box) { - return getEntitiesByClassM(net.minecraft.world.entity.animal.Animal.class, box); + return getEntitiesByClassM(LivingEntity.class, box, entity -> entity.get() instanceof net.minecraft.world.entity.animal.Animal); } public int getLuminance(BlockPos pos) { From 52b10f1ff78f36097ff216856ddce07add3ccfb0 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 5 Apr 2026 15:33:27 +0900 Subject: [PATCH 066/151] [cp] changelog --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 6d47cbd6e..2b63120c5 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib mod_version=3.6.0 maven_group=net.pitan76 -changelog=Add Compat APIs +changelog=Add Compat APIs / Support for 26.1 From c68e3c089672e7b8894c58f532f756f19e295089 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 5 Apr 2026 18:23:21 +0900 Subject: [PATCH 067/151] feat: add block and entity type registration methods to MidohraRegistry --- .../midohra/registry/MidohraRegistry.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java index 6a3a58966..06df4208f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java @@ -1,15 +1,29 @@ package net.pitan76.mcpitanlib.midohra.registry; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; +import net.pitan76.mcpitanlib.api.entity.CompatEntity; +import net.pitan76.mcpitanlib.api.entity.EntityTypeBuilder; import net.pitan76.mcpitanlib.api.item.v2.CompatItem; import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; import net.pitan76.mcpitanlib.midohra.block.SupplierTypedBlockWrapper; import net.pitan76.mcpitanlib.midohra.block.TypedBlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.SupplierBlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.SupplierTypedBlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.TypedBlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.SupplierEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.SupplierTypedEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.TypedEntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import net.pitan76.mcpitanlib.midohra.item.SupplierItemWrapper; import net.pitan76.mcpitanlib.midohra.item.SupplierTypedItemWrapper; @@ -64,6 +78,50 @@ public TypedBlockWrapper registerBlock(String id, Sup return registerBlock(fixId(id), supplier); } + public BlockEntityTypeWrapper registerRawBlockEntityType(CompatIdentifier id, Supplier> supplier) { + return SupplierBlockEntityTypeWrapper.of(registry.registerBlockEntityType(id, supplier)); + } + + public BlockEntityTypeWrapper registerRawBlockEntityType(String id, Supplier> supplier) { + return registerRawBlockEntityType(fixId(id), supplier); + } + + public BlockEntityTypeWrapper registerRawBlockEntityType(CompatIdentifier id, BlockEntityTypeBuilder builder) { + return SupplierBlockEntityTypeWrapper.of(() -> registry.registerBlockEntityType(id, builder).get()); + } + + public BlockEntityTypeWrapper registerRawBlockEntityType(String id, BlockEntityTypeBuilder builder) { + return registerRawBlockEntityType(fixId(id), builder); + } + + public TypedBlockEntityTypeWrapper registerBlockEntityType(CompatIdentifier id, BlockEntityTypeBuilder builder) { + return SupplierTypedBlockEntityTypeWrapper.of(() -> (BlockEntityType) registerRawBlockEntityType(id, builder).get()); + } + + public EntityTypeWrapper registerRawEntityType(CompatIdentifier id, Supplier> supplier) { + return SupplierEntityTypeWrapper.of(registry.registerEntity(id, supplier)); + } + + public EntityTypeWrapper registerRawEntityType(String id, Supplier> supplier) { + return registerRawEntityType(fixId(id), supplier); + } + + public EntityTypeWrapper registerRawEntityType(CompatIdentifier id, EntityTypeBuilder builder) { + return SupplierEntityTypeWrapper.of(() -> registry.registerEntity(id, () -> builder.build()).get()); + } + + public EntityTypeWrapper registerRawEntityType(String id, EntityTypeBuilder builder) { + return registerRawEntityType(fixId(id), builder); + } + + public TypedEntityTypeWrapper registerEntityType(CompatIdentifier id, EntityTypeBuilder builder) { + return SupplierTypedEntityTypeWrapper.of(() -> (EntityType) registerRawEntityType(id, builder).get()); + } + + public TypedEntityTypeWrapper registerEntityType(String id, EntityTypeBuilder builder) { + return registerEntityType(fixId(id), builder); + } + /** * If the id doesn't contain a namespace, add the default namespace to it. * @param id The id to fix. From b143ee44036d4bd56b4fc8c430ff1a6c676ca3fc Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 5 Apr 2026 18:24:13 +0900 Subject: [PATCH 068/151] fix: update littleobffallback version to 0.3.2 and increment mod version to 3.6.1 --- gradle.properties | 2 +- info.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 43e205ac3..003daa7aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.2.6.261-SNAPSHOT +littleobffallback_version=0.3.2.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false diff --git a/info.properties b/info.properties index 2b63120c5..2f23614a7 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.0 +mod_version=3.6.1 maven_group=net.pitan76 changelog=Add Compat APIs / Support for 26.1 From f4403326ec3d2b471f030e12e807ff67f0ecf804 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 5 Apr 2026 18:24:44 +0900 Subject: [PATCH 069/151] fix: increment mod version to 3.6.2 in info.properties --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 2f23614a7..fd379391b 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.1 +mod_version=3.6.2 maven_group=net.pitan76 changelog=Add Compat APIs / Support for 26.1 From dea8098bbc0928fc618044cd4a4aba34fe349a69 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 5 Apr 2026 20:59:22 +0900 Subject: [PATCH 070/151] chore: update mod version to 3.6.3 in info.properties --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index fd379391b..350896d9f 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.2 +mod_version=3.6.3 maven_group=net.pitan76 changelog=Add Compat APIs / Support for 26.1 From 75fe7d719cfe36df3af110637d41608d12564dd3 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 5 Apr 2026 21:02:32 +0900 Subject: [PATCH 071/151] feat: enhance entity and item interactions with new utility methods --- .../pitan76/mcpitanlib/api/entity/Player.java | 19 ++++++++++ .../api/event/item/InventoryTickEvent.java | 35 +++++++++++++++++++ .../api/util/entity/ItemEntityUtil.java | 19 ++++++++++ .../api/util/entity/LivingEntityUtil.java | 27 ++++++++++++++ .../midohra/entity/ItemEntityWrapper.java | 5 +++ .../mcpitanlib/midohra/util/math/Box.java | 9 +++++ .../mcpitanlib/midohra/world/World.java | 9 +++++ 7 files changed, 123 insertions(+) diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index 0ab80bc88..e91f59559 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -35,6 +35,7 @@ import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; import net.pitan76.mcpitanlib.api.gui.ExtendedNamedScreenHandlerFactory; import net.pitan76.mcpitanlib.api.gui.v2.ExtendedScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; import net.pitan76.mcpitanlib.api.item.CompatFoodComponent; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; @@ -43,7 +44,9 @@ import net.pitan76.mcpitanlib.api.util.NbtUtil; import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; import net.pitan76.mcpitanlib.core.player.ItemCooldown; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; import java.util.*; import java.util.function.Consumer; @@ -561,4 +564,20 @@ public void insertStack(int slot, net.pitan76.mcpitanlib.midohra.item.ItemStack public void giveStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { giveStack(stack.toMinecraft()); } + + public Vector3d getPosM() { + return Vector3d.of(getPos()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getBlockPosM() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getBlockPos()); + } + + public ItemStack getEquippedStack(ArmorEquipmentType type) { + return LivingEntityUtil.getEquippedStack(getEntity(), type.getSlot()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getEquippedStackM(ArmorEquipmentType type) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getEquippedStack(type)); + } } \ No newline at end of file diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java index f73850ed8..6defd4f25 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java @@ -6,10 +6,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; +import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.api.util.entity.EquipmentSlotUtil; import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; public class InventoryTickEvent extends BaseEvent { public ItemStack stack; @@ -78,4 +81,36 @@ public boolean isClient() { public EquipmentSlot getEquipmentSlot() { return equipmentSlot; } + + public ArmorEquipmentType getArmorEquipmentType() { + return EquipmentSlotUtil.getArmorEquipmentType(equipmentSlot); + } + + public boolean isPlayer() { + return getEntity() instanceof net.minecraft.world.entity.player.Player; + } + + public Player getPlayer() { + if (isPlayer()) { + return new Player((net.minecraft.world.entity.player.Player) getEntity()); + } else { + return null; + } + } + + public EntityWrapper getEntityWrapper() { + return EntityWrapper.of(getEntity()); + } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } + + public net.pitan76.mcpitanlib.midohra.world.ServerWorld getServerWorldM() { + return net.pitan76.mcpitanlib.midohra.world.ServerWorld.of(getServerWorld()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java index 99898aefd..5524b8b41 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java @@ -7,11 +7,14 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraft.world.level.Level; +import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.entity.ItemEntityWrapper; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; import net.pitan76.mcpitanlib.midohra.util.math.Vector3i; import java.util.List; +import java.util.stream.Collectors; public class ItemEntityUtil { public static ItemEntity create(Level world, double x, double y, double z, ItemStack stack) { @@ -115,4 +118,20 @@ public static ItemEntity createWithSpawnAtCenter(net.pitan76.mcpitanlib.midohra. public static ItemEntity createWithSpawn(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack, net.pitan76.mcpitanlib.midohra.util.math.Vector3i pos) { return createWithSpawn(world, stack, pos.toCenter()); } + + public static List getEntities(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + return getEntities(world.getRaw(), box.toMinecraft()); + } + + public static List getEntityWrappers(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.Box box) { + return getEntities(world, box).stream().map(ItemEntityWrapper::of).collect(Collectors.toList()); + } + + public static void onPlayerCollision(ItemEntity itemEntity, Player player) { + itemEntity.playerTouch(player.getEntity()); + } + + public static void onPlayerCollision(ItemEntityWrapper itemEntity, Player player) { + onPlayerCollision(itemEntity.get(), player); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java index 267fbdea0..829a8190a 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.api.util.entity; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.effect.MobEffectInstance; @@ -7,7 +8,9 @@ import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffect; import net.pitan76.mcpitanlib.api.entity.effect.CompatStatusEffectInstance; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; import net.pitan76.mcpitanlib.api.util.EntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; import java.util.ArrayList; import java.util.List; @@ -54,4 +57,28 @@ public static ItemStack getEquippedStack(LivingEntity entity, EquipmentSlot slot public static void setEquippedStack(LivingEntity entity, EquipmentSlot slot, ItemStack stack) { entity.setItemSlot(slot, stack); } + + public static ItemStack getEquippedStack(LivingEntity entity, ArmorEquipmentType type) { + return getEquippedStack(entity, type.getSlot()); + } + + public static void setEquippedStack(LivingEntity entity, ArmorEquipmentType type, ItemStack stack) { + entity.setItemSlot(type.getSlot(), stack); + } + + public static net.pitan76.mcpitanlib.midohra.item.ItemStack getEquippedStack(EntityWrapper entity, ArmorEquipmentType slot) { + Entity e = entity.get(); + if (e instanceof LivingEntity) { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getEquippedStack((LivingEntity) e, slot)); + } + + return net.pitan76.mcpitanlib.midohra.item.ItemStack.empty(); + } + + public static void setEquippedStack(EntityWrapper entity, ArmorEquipmentType slot, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + Entity e = entity.get(); + if (e instanceof LivingEntity) { + setEquippedStack((LivingEntity) e, slot, stack.toMinecraft()); + } + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java index 908f4fb71..5878f8af4 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.midohra.entity; +import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.util.entity.ItemEntityUtil; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; @@ -76,4 +77,8 @@ public static ItemEntityWrapper createWithSpawn(ItemStack stack, World world, Bl public void setToDefaultPickupDelay() { ItemEntityUtil.setToDefaultPickupDelay(get()); } + + public void onPlayerCollision(Player player) { + ItemEntityUtil.onPlayerCollision(this, player); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java index 20afb83bc..e677902d8 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java @@ -141,4 +141,13 @@ public Vector3i getMinVector() { public Vector3i getMaxVector() { return new Vector3i((int) box.maxX, (int) box.maxY, (int) box.maxZ); } + + public Box(Vector3d center, double sizeX, double sizeY, double sizeZ) { + this(center.getX() - sizeX / 2, center.getY() - sizeY / 2, center.getZ() - sizeZ / 2, + center.getX() + sizeX / 2, center.getY() + sizeY / 2, center.getZ() + sizeZ / 2); + } + + public Box(Vector3d center, double size) { + this(center, size, size, size); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java index 4eb769cad..6c5f41356 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java @@ -13,6 +13,7 @@ import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.particle.CompatParticleType; import net.pitan76.mcpitanlib.api.util.particle.effect.CompatParticleEffect; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.item.ItemStack; @@ -210,4 +211,12 @@ public void dropStackOnBlock(BlockPos pos, ItemStack stack) { public void spawnStack(ItemStack stack, BlockPos pos) { WorldUtil.spawnStack(getRaw(), pos.toMinecraft(), stack.toMinecraft()); } + + public void addParticle(CompatParticleType type, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + WorldUtil.addParticle(getRaw(), type, x, y, z, velocityX, velocityY, velocityZ); + } + + public void addParticle(CompatParticleType type, Vector3d pos, Vector3d velocity) { + addParticle(type, pos.getX(), pos.getY(), pos.getZ(), velocity.getX(), velocity.getY(), velocity.getZ()); + } } From cce8fbb9de0c0383527495f872936b046197dd46 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Mon, 6 Apr 2026 00:00:11 +0900 Subject: [PATCH 072/151] fix: update mod version to 3.6.3-fix.1 in info.properties --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 350896d9f..dc2f09531 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.3 +mod_version=3.6.3-fix.1 maven_group=net.pitan76 changelog=Add Compat APIs / Support for 26.1 From 194163f70262e53919c9848428850895b56bf0c8 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Mon, 6 Apr 2026 00:19:17 +0900 Subject: [PATCH 073/151] feat: update build.gradle to enhance jar and shadowJar tasks for better resource handling --- build.gradle | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index cd86c3064..03717edb1 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ dependencies { exclude(group: "net.fabricmc.fabric-api") } implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { - changing = true + exclude(group: "net.fabricmc.fabric-api") } include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") @@ -100,12 +100,31 @@ java { withSourcesJar() } -shadowJar { +tasks.named("jar") { + archiveClassifier.set("dev-unshadowed") +} + +tasks.named("shadowJar") { + dependsOn tasks.named("jar") + + doFirst { + copy { + from zipTree(tasks.named("jar").get().archiveFile) + include "fabric.mod.json" + into project.sourceSets.main.output.resourcesDir + } + } + + from(zipTree(tasks.named("jar").get().archiveFile)) { + include "META-INF/jars/**" + } + relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" configurations = [project.configurations.shadow] archiveClassifier.set("") -} + duplicatesStrategy = DuplicatesStrategy.INCLUDE +} jar { from("LICENSE") { @@ -122,13 +141,14 @@ if (System.getenv("CURSEFORGE_TOKEN") != null) { releaseType = 'beta' addGameVersion "Fabric" addGameVersion "26.1" + addGameVersion "26.1.1" relations { requiredDependency 'fabric-api' embeddedLibrary 'compatdatapacks' embeddedLibrary 'legacyitemmodels' } - mainArtifact(tasks.jar) + mainArtifact(tasks.shadowJar) } } } @@ -138,9 +158,9 @@ if (System.getenv("MODRINTH_TOKEN") != null) { token = System.getenv("MODRINTH_TOKEN") projectId = 'mcpitanlibarch' versionNumber = info.mod_version + "-fabric-" + rootProject.minecraft_version.toString() - gameVersions = ["26.1"] + gameVersions = ["26.1", "26.1.1"] versionType = 'beta' - uploadFile = tasks.jar + uploadFile = tasks.shadowJar changelog = info.changelog loaders = ["fabric"] dependencies { From 0ecfbcbf1173288e0c410b3d84589fce6890cab7 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Mon, 6 Apr 2026 12:09:04 +0900 Subject: [PATCH 074/151] fix: update littleobffallback version to 0.3.3.261-SNAPSHOT and increment mod version to 3.6.3-fix.2 --- gradle.properties | 2 +- info.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 003daa7aa..3c31e3445 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.2.261-SNAPSHOT +littleobffallback_version=0.3.3.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false diff --git a/info.properties b/info.properties index dc2f09531..02744b2de 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.3-fix.1 +mod_version=3.6.3-fix.2 maven_group=net.pitan76 -changelog=Add Compat APIs / Support for 26.1 +changelog=Update littleobffallback From 58b6a6d5e19dea7293333e530e45a634cb934758 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Mon, 6 Apr 2026 21:41:12 +0900 Subject: [PATCH 075/151] fix: improve registry methods to return proper data types for DataComponentType and ChunkTicketType --- info.properties | 2 +- .../pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/info.properties b/info.properties index 02744b2de..a8255e584 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.3-fix.2 +mod_version=3.6.3-fix.3 maven_group=net.pitan76 changelog=Update littleobffallback diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java index 4ee19dabc..6b1577892 100644 --- a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java +++ b/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java @@ -28,11 +28,13 @@ public void register() { public RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { ResourceKey> key = ResourceKey.create(Registries.DATA_COMPONENT_TYPE, id); - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, key, supplier.get())); + DataComponentType dataComponentType = Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, key, supplier.get()); + return new RegistrySupplier<>(dataComponentType); } public Supplier> registryChunkTicketType(Identifier id, Supplier> supplier) { ResourceKey key = ResourceKey.create(Registries.TICKET_TYPE, id); - return () -> ChunkTicketType.of(Registry.register(BuiltInRegistries.TICKET_TYPE, key, supplier.get().getRaw())); + net.minecraft.server.level.TicketType ticketType = Registry.register(BuiltInRegistries.TICKET_TYPE, key, supplier.get().getRaw()); + return () -> ChunkTicketType.of(ticketType); } } From 712340bfc78436dc899597f67dc36ba40f2e3250 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Wed, 8 Apr 2026 23:07:04 +0900 Subject: [PATCH 076/151] fix: update littleobffallback version to 0.3.4.261-SNAPSHOT and increment mod version to 3.6.3-fix.4 --- gradle.properties | 2 +- info.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3c31e3445..b2bfd0b3e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.3.261-SNAPSHOT +littleobffallback_version=0.3.4.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false diff --git a/info.properties b/info.properties index a8255e584..44a5a5717 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.3-fix.3 +mod_version=3.6.3-fix.4 maven_group=net.pitan76 changelog=Update littleobffallback From 5bc9f5d08d620d3d9adc421482e06f73deed759c Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 00:21:59 +0900 Subject: [PATCH 077/151] feat: add compat APIs --- .../api/event/entity/EntityHitEvent.java | 10 +++ .../mcpitanlib/midohra/block/BlockState.java | 5 ++ .../midohra/block/BlockWrapper.java | 27 ++++++ .../block/entity/BlockEntityWrapper.java | 27 ++++++ .../midohra/entity/EntityTypeWrapper.java | 5 ++ .../midohra/entity/EntityWrapper.java | 26 ++++++ .../mcpitanlib/midohra/entity/SpawnGroup.java | 76 +++++++++++++++++ .../mcpitanlib/midohra/fluid/FluidState.java | 84 +++++++++++++++++++ .../mcpitanlib/midohra/item/ItemWrapper.java | 27 ++++++ .../mcpitanlib/midohra/nbt/NbtElement.java | 71 ++++++++++++++++ .../mcpitanlib/midohra/nbt/NbtInteger.java | 68 +++++++++++++++ .../mcpitanlib/midohra/nbt/NbtString.java | 68 +++++++++++++++ .../midohra/registry/MidohraRegistry.java | 32 ++++--- .../mcpitanlib/midohra/server/MCServer.java | 6 ++ .../mcpitanlib/midohra/world/BlockView.java | 5 ++ .../midohra/world/CompatPersistentState.java | 19 +++++ .../mcpitanlib/midohra/world/IWorldView.java | 6 ++ .../midohra/world/PersistentStateManager.java | 47 +++++++++++ .../midohra/world/PersistentStateWrapper.java | 44 ++++++++++ .../mcpitanlib/midohra/world/ServerWorld.java | 4 + .../mcpitanlib/midohra/world/WorldView.java | 5 ++ .../world/chunk/ServerChunkManager.java | 5 ++ 22 files changed, 657 insertions(+), 10 deletions(-) create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java index aba80f41f..066660e0f 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java @@ -3,6 +3,8 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.util.hit.HitResultType; public class EntityHitEvent { @@ -23,4 +25,12 @@ public Entity getEntity() { public HitResult.Type getType() { return entityHitResult.getType(); } + + public EntityWrapper getEntityWrapper() { + return EntityWrapper.of(getEntity()); + } + + public HitResultType getTypeM() { + return HitResultType.from(getType()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java index 2855ae7f6..458b60bea 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java @@ -9,6 +9,7 @@ import net.pitan76.mcpitanlib.api.util.BlockStateUtil; import net.pitan76.mcpitanlib.api.util.block.properties.CompatBlockHalf; import net.pitan76.mcpitanlib.api.util.block.properties.CompatStairShape; +import net.pitan76.mcpitanlib.midohra.fluid.FluidState; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.world.ServerWorld; import net.pitan76.mcpitanlib.midohra.world.World; @@ -184,4 +185,8 @@ public boolean randomTick(ServerWorld world, BlockPos pos) { BlockStateUtil.randomTick(this.toMinecraft(), world.getRaw(), pos.toRaw()); return true; } + + public FluidState getFluidState() { + return FluidState.of(BlockStateUtil.getFluidState(this.toMinecraft())); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java index b613a8ebb..f2ab6b96c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.midohra.block; +import net.minecraft.world.level.block.Block; import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.block.BlockUtil; @@ -146,4 +147,30 @@ public float getHardness() { public BlockStateM getDefaultStateM() { return BlockStateM.of(get()); } + + /** + * instanceof check for the block of this wrapper. + * @param clazz the class of the block to check + * @return true if the block of this wrapper is an instance of the given class, false otherwise + */ + public boolean instanceOf(Class clazz) { + if (isEmpty()) return false; + + return clazz.isInstance(get()); + } + + /** + * instanceof check for the block of this wrapper. + * @param wrapper the block to check + * @return true if the block of this wrapper is an instance of the given block, false otherwise + */ + public boolean instanceOf(BlockWrapper wrapper) { + if (isEmpty()) return false; + + Block block = wrapper.get(); + if (block == null) return false; + + Class clazz = block.getClass(); + return clazz.isInstance(get()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java index c72014696..15d773cdc 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.midohra.block.entity; +import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; @@ -130,4 +131,30 @@ public Optional toBuiltBlockEntity() { } return Optional.empty(); } + + /** + * instanceof check for the block entity of this wrapper. + * @param clazz the class of the block entity to check + * @return true if the block entity of this wrapper is an instance of the given class, false otherwise + */ + public boolean instanceOf(Class clazz) { + if (isEmpty()) return false; + + return clazz.isInstance(get()); + } + + /** + * instanceof check for the block entity of this wrapper. + * @param wrapper the block entity to check + * @return true if the block entity of this wrapper is an instance of the given block entity, false otherwise + */ + public boolean instanceOf(BlockEntityWrapper wrapper) { + if (isEmpty()) return false; + + BlockEntity blockEntity = wrapper.get(); + if (blockEntity == null) return false; + + Class clazz = blockEntity.getClass(); + return clazz.isInstance(get()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java index c108657c5..4dd0aa00c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java @@ -92,4 +92,9 @@ public EntityWrapper createEntity(ServerWorld world, @Nullable Consumer clazz) { + if (isEmpty()) return false; + + return clazz.isInstance(get()); + } + + /** + * instanceof check for the entity of this wrapper. + * @param wrapper the entity to check + * @return true if the entity of this wrapper is an instance of the given entity, false otherwise + */ + public boolean instanceOf(EntityWrapper wrapper) { + if (isEmpty()) return false; + + Entity entity = wrapper.get(); + if (entity == null) return false; + + Class clazz = entity.getClass(); + return clazz.isInstance(get()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java new file mode 100644 index 000000000..622613148 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java @@ -0,0 +1,76 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.pitan76.mcpitanlib.api.util.CompatStringIdentifiable; + +public class SpawnGroup implements CompatStringIdentifiable { + private final net.minecraft.world.entity.MobCategory spawnGroup; + + public static final SpawnGroup MONSTER = of(net.minecraft.world.entity.MobCategory.MONSTER); + public static final SpawnGroup CREATURE = of(net.minecraft.world.entity.MobCategory.CREATURE); + public static final SpawnGroup AMBIENT = of(net.minecraft.world.entity.MobCategory.AMBIENT); + public static final SpawnGroup AXOLOTLS = of(net.minecraft.world.entity.MobCategory.AXOLOTLS); + public static final SpawnGroup UNDERGROUND_WATER_CREATURE = of(net.minecraft.world.entity.MobCategory.UNDERGROUND_WATER_CREATURE); + public static final SpawnGroup WATER_CREATURE = of(net.minecraft.world.entity.MobCategory.WATER_CREATURE); + public static final SpawnGroup WATER_AMBIENT = of(net.minecraft.world.entity.MobCategory.WATER_AMBIENT); + public static final SpawnGroup MISC = of(net.minecraft.world.entity.MobCategory.MISC); + + protected SpawnGroup(net.minecraft.world.entity.MobCategory spawnGroup) { + this.spawnGroup = spawnGroup; + } + + public static SpawnGroup of(net.minecraft.world.entity.MobCategory spawnGroup) { + return new SpawnGroup(spawnGroup); + } + + public static SpawnGroup byName(String name) { + for (net.minecraft.world.entity.MobCategory group : net.minecraft.world.entity.MobCategory.values()) { + if (group.getName().equals(name)) { + return of(group); + } + } + + throw new IllegalArgumentException("No spawn group with name: " + name); + } + + public net.minecraft.world.entity.MobCategory getRaw() { + return spawnGroup; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + SpawnGroup other = (SpawnGroup) obj; + return getRaw() == other.getRaw(); + } + + @Override + public int hashCode() { + return getRaw().hashCode(); + } + + @Override + public String asString_compat() { + return getRaw().getName(); + } + + public int getCapacity() { + return getRaw().getMaxInstancesPerChunk(); + } + + public boolean isPeaceful() { + return getRaw().isFriendly(); + } + + public boolean isRare() { + return getRaw().isPersistent(); + } + + public int getImmediateDespawnRange() { + return getRaw().getDespawnDistance(); + } + + public int getDespawningStartRange() { + return getRaw().getNoDespawnDistance(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java new file mode 100644 index 000000000..5738f8d26 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java @@ -0,0 +1,84 @@ +package net.pitan76.mcpitanlib.midohra.fluid; + +import net.pitan76.mcpitanlib.api.util.FluidStateUtil; +import net.pitan76.mcpitanlib.api.util.particle.effect.CompatParticleEffect; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.util.math.Box; + +public class FluidState { + private final net.minecraft.world.level.material.FluidState fluidState; + + public FluidState(net.minecraft.world.level.material.FluidState fluidState) { + this.fluidState = fluidState; + } + + public static FluidState of(net.minecraft.world.level.material.FluidState fluidState) { + return new FluidState(fluidState); + } + + public net.minecraft.world.level.material.FluidState getRaw() { + return fluidState; + } + + public net.minecraft.world.level.material.FluidState toMinecraft() { + return getRaw(); + } + + public boolean isNull() { + return getRaw() == null; + } + + public boolean isEmpty() { + return isNull() || getRaw().isEmpty(); + } + + public FluidWrapper getFluid() { + return FluidWrapper.of(getRaw().getType()); + } + + public BlockState getBlockState() { + return BlockState.of(getRaw().createLegacyBlock()); + } + + public boolean hasRandomTicks() { + return getRaw().isRandomlyTicking(); + } + + public CompatParticleEffect getParticle() { + return CompatParticleEffect.of(getRaw().getDripParticle()); + } + + public int getLevel() { + return getRaw().getAmount(); + } + + public boolean isStill() { + return getRaw().isSource(); + } + + public boolean isFull() { + return getRaw().isFull(); + } + + public boolean isWater() { + return FluidStateUtil.isWater(getRaw()); + } + + public boolean isLava() { + return FluidStateUtil.isLava(getRaw()); + } + + + @Override + public int hashCode() { + return getRaw().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + FluidState other = (FluidState) obj; + return getRaw().equals(other.getRaw()); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java index a258183a4..fd938c2c3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.midohra.item; +import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.item.v2.CompatItem; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; @@ -162,4 +163,30 @@ public Optional toBuiltItem() { } return Optional.empty(); } + + /** + * instanceof check for the item of this wrapper. + * @param clazz the class of the item to check + * @return true if the item of this wrapper is an instance of the given class, false otherwise + */ + public boolean instanceOf(Class clazz) { + if (isEmpty()) return false; + + return clazz.isInstance(get()); + } + + /** + * instanceof check for the item of this wrapper. + * @param wrapper the item to check + * @return true if the item of this wrapper is an instance of the given item, false otherwise + */ + public boolean instanceOf(ItemWrapper wrapper) { + if (isEmpty()) return false; + + Item item = wrapper.get(); + if (item == null) return false; + + Class clazz = item.getClass(); + return clazz.isInstance(get()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java index c86394d1c..32beba043 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.midohra.nbt; import net.minecraft.nbt.TagType; +import org.jetbrains.annotations.Nullable; public class NbtElement implements ElementConvertible { protected final net.minecraft.nbt.Tag nbt; @@ -46,4 +47,74 @@ public NbtElement toElement() { public String asString() { return nbt.asString().orElse(""); } + + public boolean isNbtCompound() { + return nbt instanceof net.minecraft.nbt.CompoundTag; + } + + @Nullable + public NbtCompound asNbtCompound() { + if (isNbtCompound()) { + return NbtCompound.of((net.minecraft.nbt.CompoundTag) nbt); + } + + return null; + } + + public NbtCompound asNbtCompoundOrDefault(NbtCompound defaultCompound) { + NbtCompound compound = asNbtCompound(); + return compound != null ? compound : defaultCompound; + } + + public boolean isNbtList() { + return nbt instanceof net.minecraft.nbt.ListTag; + } + + @Nullable + public NbtList asNbtList() { + if (isNbtList()) { + return NbtList.of((net.minecraft.nbt.ListTag) nbt); + } + + return null; + } + + public NbtList asNbtListOrDefault(NbtList defaultList) { + NbtList list = asNbtList(); + return list != null ? list : defaultList; + } + + public boolean isNbtString() { + return nbt instanceof net.minecraft.nbt.StringTag; + } + + public NbtString asNbtString() { + if (isNbtString()) { + return NbtString.of((net.minecraft.nbt.StringTag) nbt); + } + + return NbtString.of(""); + } + + public NbtString asNbtStringOrDefault(NbtString defaultString) { + NbtString string = asNbtString(); + return string != null ? string : defaultString; + } + + public boolean isNbtInteger() { + return nbt instanceof net.minecraft.nbt.IntTag; + } + + public NbtInteger asNbtInteger() { + if (isNbtInteger()) { + return NbtInteger.of((net.minecraft.nbt.IntTag) nbt); + } + + return NbtInteger.of(0); + } + + public NbtInteger asNbtIntegerOrDefault(NbtInteger defaultInteger) { + NbtInteger integer = asNbtInteger(); + return integer != null ? integer : defaultInteger; + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java new file mode 100644 index 000000000..52f03cd21 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java @@ -0,0 +1,68 @@ +package net.pitan76.mcpitanlib.midohra.nbt; + +import java.util.Optional; + +public class NbtInteger implements ElementConvertible { + protected final net.minecraft.nbt.IntTag nbtInt; + + protected NbtInteger(net.minecraft.nbt.IntTag nbtInt) { + this.nbtInt = nbtInt; + } + + public static NbtInteger of(net.minecraft.nbt.IntTag nbtInt) { + return new NbtInteger(nbtInt); + } + + public static NbtInteger of(int value) { + return new NbtInteger(net.minecraft.nbt.IntTag.valueOf(value)); + } + + public static Optional ofOptional(NbtElement nbtElement) { + if (nbtElement.toMinecraft() instanceof net.minecraft.nbt.IntTag) + return Optional.of(new NbtInteger((net.minecraft.nbt.IntTag) nbtElement.toMinecraft())); + + return Optional.empty(); + } + + public NbtInteger copy() { + return new NbtInteger(nbtInt.copy()); + } + + public byte getType() { + return nbtInt.getId(); + } + + public int getValue() { + return nbtInt.value(); + } + + public String asString() { + return nbtInt.asString().orElse(""); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + + return o instanceof NbtInteger && nbtInt.equals(((NbtInteger) o).nbtInt); + } + + @Override + public int hashCode() { + return nbtInt.hashCode(); + } + + @Override + public String toString() { + return nbtInt.toString(); + } + + public net.minecraft.nbt.IntTag toMinecraft() { + return nbtInt; + } + + @Override + public NbtElement toElement() { + return NbtElement.of(nbtInt); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java new file mode 100644 index 000000000..ba8caa92e --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java @@ -0,0 +1,68 @@ +package net.pitan76.mcpitanlib.midohra.nbt; + +import java.util.Optional; + +public class NbtString implements ElementConvertible { + protected final net.minecraft.nbt.StringTag nbtString; + + protected NbtString(net.minecraft.nbt.StringTag nbtString) { + this.nbtString = nbtString; + } + + public static NbtString of(net.minecraft.nbt.StringTag nbtString) { + return new NbtString(nbtString); + } + + public static NbtString of(String value) { + return new NbtString(net.minecraft.nbt.StringTag.valueOf(value)); + } + + public static Optional ofOptional(NbtElement nbtElement) { + if (nbtElement.toMinecraft() instanceof net.minecraft.nbt.StringTag) + return Optional.of(new NbtString((net.minecraft.nbt.StringTag) nbtElement.toMinecraft())); + + return Optional.empty(); + } + + public NbtString copy() { + return new NbtString(nbtString.copy()); + } + + public byte getType() { + return nbtString.getId(); + } + + public String getValue() { + return nbtString.value(); + } + + public String asString() { + return nbtString.asString().orElse(""); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + + return o instanceof NbtString && nbtString.equals(((NbtString) o).nbtString); + } + + @Override + public int hashCode() { + return nbtString.hashCode(); + } + + @Override + public String toString() { + return nbtString.toString(); + } + + public net.minecraft.nbt.StringTag toMinecraft() { + return nbtString; + } + + @Override + public NbtElement toElement() { + return NbtElement.of(nbtString); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java b/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java index 06df4208f..5e908ebc7 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java @@ -8,6 +8,8 @@ import net.pitan76.mcpitanlib.api.entity.CompatEntity; import net.pitan76.mcpitanlib.api.entity.EntityTypeBuilder; import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; @@ -47,7 +49,8 @@ public CompatRegistryV2 getCompatRegistry() { } public ItemWrapper registerRawItem(CompatIdentifier id, Supplier supplier) { - return SupplierItemWrapper.of(registry.registerItem(id, supplier)); + RegistryResult result = registry.registerItem(id, supplier); + return SupplierItemWrapper.of(result); } public ItemWrapper registerRawItem(String id, Supplier supplier) { @@ -55,7 +58,8 @@ public ItemWrapper registerRawItem(String id, Supplier supplier) { } public TypedItemWrapper registerItem(CompatIdentifier id, Supplier supplier) { - return SupplierTypedItemWrapper.of(registerRawItem(id, supplier::get)); + ItemWrapper wrapper = registerRawItem(id, supplier::get); + return SupplierTypedItemWrapper.of(wrapper); } public TypedItemWrapper registerItem(String id, Supplier supplier) { @@ -63,7 +67,8 @@ public TypedItemWrapper registerItem(String id, Suppli } public BlockWrapper registerRawBlock(CompatIdentifier id, Supplier supplier) { - return SupplierBlockWrapper.of(registry.registerBlock(id, supplier)); + RegistryResult result = registry.registerBlock(id, supplier); + return SupplierBlockWrapper.of(result); } public BlockWrapper registerRawBlock(String id, Supplier supplier) { @@ -71,7 +76,8 @@ public BlockWrapper registerRawBlock(String id, Supplier supplier) { } public TypedBlockWrapper registerBlock(CompatIdentifier id, Supplier supplier) { - return SupplierTypedBlockWrapper.of(registerRawBlock(id, supplier::get)); + BlockWrapper wrapper = registerRawBlock(id, supplier::get); + return SupplierTypedBlockWrapper.of(wrapper); } public TypedBlockWrapper registerBlock(String id, Supplier supplier) { @@ -79,7 +85,8 @@ public TypedBlockWrapper registerBlock(String id, Sup } public BlockEntityTypeWrapper registerRawBlockEntityType(CompatIdentifier id, Supplier> supplier) { - return SupplierBlockEntityTypeWrapper.of(registry.registerBlockEntityType(id, supplier)); + RegistryResult> result = registry.registerBlockEntityType(id, supplier); + return SupplierBlockEntityTypeWrapper.of(result); } public BlockEntityTypeWrapper registerRawBlockEntityType(String id, Supplier> supplier) { @@ -87,7 +94,8 @@ public BlockEntityTypeWrapper registerRawBlockEntityType(String id, Supplier BlockEntityTypeWrapper registerRawBlockEntityType(CompatIdentifier id, BlockEntityTypeBuilder builder) { - return SupplierBlockEntityTypeWrapper.of(() -> registry.registerBlockEntityType(id, builder).get()); + SupplierResult> result = registry.registerBlockEntityType(id, builder); + return SupplierBlockEntityTypeWrapper.of(result::get); } public BlockEntityTypeWrapper registerRawBlockEntityType(String id, BlockEntityTypeBuilder builder) { @@ -95,11 +103,13 @@ public BlockEntityTypeWrapper registerRawBlockEnti } public TypedBlockEntityTypeWrapper registerBlockEntityType(CompatIdentifier id, BlockEntityTypeBuilder builder) { - return SupplierTypedBlockEntityTypeWrapper.of(() -> (BlockEntityType) registerRawBlockEntityType(id, builder).get()); + BlockEntityTypeWrapper wrapper = registerRawBlockEntityType(id, builder); + return SupplierTypedBlockEntityTypeWrapper.of(() -> (BlockEntityType) wrapper.get()); } public EntityTypeWrapper registerRawEntityType(CompatIdentifier id, Supplier> supplier) { - return SupplierEntityTypeWrapper.of(registry.registerEntity(id, supplier)); + RegistryResult> result = registry.registerEntity(id, supplier); + return SupplierEntityTypeWrapper.of(result); } public EntityTypeWrapper registerRawEntityType(String id, Supplier> supplier) { @@ -107,7 +117,8 @@ public EntityTypeWrapper registerRawEntityType(String id, Supplier } public EntityTypeWrapper registerRawEntityType(CompatIdentifier id, EntityTypeBuilder builder) { - return SupplierEntityTypeWrapper.of(() -> registry.registerEntity(id, () -> builder.build()).get()); + RegistryResult> result = registry.registerEntity(id, () -> builder.build()); + return SupplierEntityTypeWrapper.of(result::get); } public EntityTypeWrapper registerRawEntityType(String id, EntityTypeBuilder builder) { @@ -115,7 +126,8 @@ public EntityTypeWrapper registerRawEntityType(String i } public TypedEntityTypeWrapper registerEntityType(CompatIdentifier id, EntityTypeBuilder builder) { - return SupplierTypedEntityTypeWrapper.of(() -> (EntityType) registerRawEntityType(id, builder).get()); + EntityTypeWrapper wrapper = registerRawEntityType(id, builder); + return SupplierTypedEntityTypeWrapper.of(() -> (EntityType) wrapper.get()); } public TypedEntityTypeWrapper registerEntityType(String id, EntityTypeBuilder builder) { diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java b/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java index 997dafb98..a724371af 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java @@ -2,9 +2,11 @@ import net.minecraft.server.MinecraftServer; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.PersistentStateUtil; import net.pitan76.mcpitanlib.api.util.ServerUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.midohra.resource.ResourceManager; +import net.pitan76.mcpitanlib.midohra.world.PersistentStateManager; import net.pitan76.mcpitanlib.midohra.world.ServerWorld; public class MCServer { @@ -93,4 +95,8 @@ public ResourceManager getResourceManager() { public void execute(Runnable runnable) { ServerUtil.execute(getRaw(), runnable); } + + public PersistentStateManager getPersistentStateManager() { + return PersistentStateManager.of(PersistentStateUtil.getManagerFromServer(server)); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java index e15592611..c069c243c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java @@ -38,4 +38,9 @@ public BlockState getBlockState(BlockPos pos) { public FluidState getFluidState(BlockPos pos) { return getRaw().getFluidState(pos); } + + @Override + public boolean isNull() { + return getRaw() == null; + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java new file mode 100644 index 000000000..8be69bf92 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.nbt.CompoundTag; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.world.CompatiblePersistentState; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; + +public abstract class CompatPersistentState extends CompatiblePersistentState { + + @Deprecated + @Override + public CompoundTag writeNbt(WriteNbtArgs args) { + return writeNbtM(args).toMinecraft(); + } + + public NbtCompound writeNbtM(WriteNbtArgs args) { + return null; + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java index 4a252ae0f..952fcb064 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java @@ -25,4 +25,10 @@ default net.pitan76.mcpitanlib.midohra.block.BlockState getBlockState(net.pitan7 default FluidWrapper getFluid(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { return FluidWrapper.of(getFluidState(pos.toMinecraft()).getType()); } + + default net.pitan76.mcpitanlib.midohra.fluid.FluidState getFluidState(net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return net.pitan76.mcpitanlib.midohra.fluid.FluidState.of(getFluidState(pos.toMinecraft())); + } + + boolean isNull(); } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java new file mode 100644 index 000000000..e20d25922 --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.midohra.world; + +import net.minecraft.world.level.storage.SavedDataStorage; +import net.pitan76.mcpitanlib.api.util.PersistentStateUtil; +import net.pitan76.mcpitanlib.api.world.CompatiblePersistentState; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; + +import java.util.function.Function; +import java.util.function.Supplier; + +public class PersistentStateManager { + private final net.minecraft.world.level.storage.SavedDataStorage raw; + + public PersistentStateManager(net.minecraft.world.level.storage.SavedDataStorage storage) { + this.raw = storage; + } + + public static PersistentStateManager of(net.minecraft.world.level.storage.SavedDataStorage storage) { + return new PersistentStateManager(storage); + } + + public SavedDataStorage getRaw() { + return raw; + } + + @Override + public int hashCode() { + return getRaw().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + PersistentStateManager other = (PersistentStateManager) obj; + return getRaw().equals(other.getRaw()); + } + + public T getOrCreateCompatiblePersistentState(String id, Supplier supplier, Function function) { + return PersistentStateUtil.getOrCreate(getRaw(), id, supplier, (nbt) -> function.apply(NbtCompound.of(nbt))); + } + + public PersistentStateWrapper getOrCreate(String id, Supplier supplier, Function function) { + return PersistentStateWrapper.of( + PersistentStateUtil.getOrCreate(getRaw(), id, () -> supplier.get().getRaw() , (nbt) -> function.apply(NbtCompound.of(nbt)).getRaw())); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java new file mode 100644 index 000000000..d86c6181b --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java @@ -0,0 +1,44 @@ +package net.pitan76.mcpitanlib.midohra.world; + +public class PersistentStateWrapper { + private final net.minecraft.world.level.saveddata.SavedData raw; + + protected PersistentStateWrapper(net.minecraft.world.level.saveddata.SavedData raw) { + this.raw = raw; + } + + public static PersistentStateWrapper of(net.minecraft.world.level.saveddata.SavedData persistentState) { + return new PersistentStateWrapper(persistentState); + } + + public net.minecraft.world.level.saveddata.SavedData getRaw() { + return raw; + } + + @Override + public int hashCode() { + return getRaw() != null ? getRaw().hashCode() : 0; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + + PersistentStateWrapper that = (PersistentStateWrapper) obj; + + return getRaw() != null ? getRaw().equals(that.getRaw()) : that.getRaw() == null; + } + + public void markDirty() { + getRaw().setDirty(); + } + + public void setDirty(boolean dirty) { + getRaw().setDirty(dirty); + } + + public boolean isDirty() { + return getRaw().isDirty(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java index d250e8b53..efc33c5f9 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java @@ -71,4 +71,8 @@ public void addTicket(ChunkTicketType type, ChunkPos pos, int radius) { public void removeTicket(ChunkTicketType type, ChunkPos pos, int radius) { WorldUtil.removeTicket(getRaw(), type, pos.getRaw(), radius); } + + public PersistentStateManager getPersistentStateManager() { + return getChunkManager().getPersistentStateManager(); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java index e6592911c..d2f8b2172 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java @@ -82,4 +82,9 @@ public boolean equals(Object obj) { WorldView other = (WorldView) obj; return getRaw() != null ? getRaw().equals(other.getRaw()) : other.getRaw() == null; } + + @Override + public boolean isNull() { + return getRaw() == null; + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java index b271819dd..83a055658 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java @@ -3,6 +3,7 @@ import net.pitan76.mcpitanlib.api.util.world.ChunkManagerUtil; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.util.math.ChunkPos; +import net.pitan76.mcpitanlib.midohra.world.PersistentStateManager; import net.pitan76.mcpitanlib.midohra.world.ServerWorld; import net.pitan76.mcpitanlib.midohra.world.World; @@ -48,4 +49,8 @@ public void removeTicket(ChunkTicketType ticketType, ChunkPos pos, int ra public void markForUpdate(BlockPos pos) { ChunkManagerUtil.markForUpdate(getRaw(), pos); } + + public PersistentStateManager getPersistentStateManager() { + return PersistentStateManager.of(getRaw().getDataStorage()); + } } From f9e5e4ece0584de16bd3fde4249f3e61d46164b8 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 00:22:35 +0900 Subject: [PATCH 078/151] bump version 3.6.4 --- info.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/info.properties b/info.properties index 44a5a5717..9b7f358b0 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.3-fix.4 +mod_version=3.6.4 maven_group=net.pitan76 -changelog=Update littleobffallback +changelog=Update littleobffallback & add APIs From e50304b578a4ed06526eb192a0248b6519e6e184 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 13:10:15 +0900 Subject: [PATCH 079/151] feat: enhance Midohra API with new entity interface and utility methods --- .../api/entity/CompatThrownItemEntity.java | 3 +- .../api/network/PacketByteUtil.java | 16 +++++++ .../api/network/v2/ServerNetworking.java | 17 ++++++++ .../client/render/CompatItemRenderUtil.java | 9 ++++ .../mcpitanlib/midohra/entity/IEntityM.java | 43 +++++++++++++++++++ .../midohra/network/CompatPacketByteBuf.java | 10 +++++ .../mcpitanlib/midohra/world/ServerWorld.java | 27 ++++++++++++ .../mcpitanlib/midohra/world/World.java | 5 +++ 8 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java index 9c31ac538..41f1445ff 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java @@ -19,8 +19,9 @@ import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import net.pitan76.mcpitanlib.midohra.entity.IEntityM; -public abstract class CompatThrownItemEntity extends ThrowableItemProjectile { +public abstract class CompatThrownItemEntity extends ThrowableItemProjectile implements IEntityM { public CompatThrownItemEntity(EntityType entityType, Level world) { super(entityType, world); diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java index b60b7711b..c742ce045 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java @@ -254,6 +254,22 @@ public static long[] readLongArray(FriendlyByteBuf buf) { public static Tag readUnlimitedNbt(FriendlyByteBuf buf) { return buf.readNbt(NbtAccounter.unlimitedHeap()); } + + public static net.pitan76.mcpitanlib.midohra.nbt.NbtCompound readNbtM(FriendlyByteBuf buf) { + return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(readNbt(buf)); + } + + public static FriendlyByteBuf writeNbt(FriendlyByteBuf buf, net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt) { + return writeNbt(buf, nbt.toMinecraft()); + } + + public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos readBlockPosM(FriendlyByteBuf buf) { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(readBlockPos(buf)); + } + + public static FriendlyByteBuf writeBlockPos(FriendlyByteBuf buf, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return writeBlockPos(buf, pos.toMinecraft()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java index ec2cc1a36..4a34df57c 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java @@ -9,6 +9,7 @@ import net.pitan76.mcpitanlib.api.network.v2.args.ServerReceiveEvent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; +import net.pitan76.mcpitanlib.midohra.server.MCServer; import java.util.ArrayList; import java.util.List; @@ -94,4 +95,20 @@ public static void sendAll(MinecraftServer server, CompatIdentifier id) { public static void sendAll(Level world, CompatIdentifier id) { sendAll(world.getServer(), id, PacketByteUtil.create()); } + + public static void sendAll(MCServer server, CompatIdentifier id, CompatPacketByteBuf buf) { + sendAll(server.getRaw(), id, buf); + } + + public static void sendAll(MCServer server, CompatIdentifier id) { + sendAll(server.getRaw(), id); + } + + public static void sendAll(net.pitan76.mcpitanlib.midohra.world.World world, CompatIdentifier id, CompatPacketByteBuf buf) { + sendAll(world.getRaw(), id, buf); + } + + public static void sendAll(net.pitan76.mcpitanlib.midohra.world.World world, CompatIdentifier id) { + sendAll(world.getRaw(), id); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java index bd6527436..d0e977404 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java +++ b/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java @@ -6,6 +6,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.client.render.block.entity.event.BlockEntityRenderEvent; +import net.pitan76.mcpitanlib.midohra.world.World; /** * Cross-version utility for rendering items in block entity renderers. @@ -33,4 +34,12 @@ public static void renderItem(ItemStack stack, CompatItemDisplayContext displayC state.submit(e.matrices, e.getQueue(), light, overlay, 0); } + + public static void renderItemFixed(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, BlockEntityRenderEvent e, World world) { + renderItemFixed(stack.toMinecraft(), e, world.toMinecraft()); + } + + public static void renderItem(net.pitan76.mcpitanlib.midohra.item.ItemStack stack, CompatItemDisplayContext displayContext, BlockEntityRenderEvent e, World world) { + renderItem(stack.toMinecraft(), displayContext, e, world.toMinecraft()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java new file mode 100644 index 000000000..11fb703be --- /dev/null +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java @@ -0,0 +1,43 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import net.pitan76.mcpitanlib.midohra.world.World; + +/** + * An interface for entities that can be used in the Midohra API. + * This interface provides default methods to get the entity's wrapper, position, world, and type. + * It is recommended to implement this interface in your custom entity classes to easily integrate with the Midohra API. + */ +public interface IEntityM { + default EntityWrapper getEntityWrapper() { + return EntityWrapper.of((Entity) this); + } + + default BlockPos getMidohraBlockPos() { + return getEntityWrapper().getBlockPos(); + } + + default Vector3d getMidohraPos() { + return getEntityWrapper().getPos(); + } + + default World getMidohraWorld() { + return getEntityWrapper().getWorld(); + } + + default EntityTypeWrapper getTypeM() { + return getEntityWrapper().getType(); + } + + default boolean hasServerWorld() { + return getMidohraWorld().isServer(); + } + + default ServerWorld getMidohraServerWorld() { + return getMidohraWorld().toServerWorld().get(); + } +} diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java index 8d54a0c66..8a82ae9a2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java @@ -2,6 +2,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; public class CompatPacketByteBuf extends FriendlyByteBuf { @@ -113,4 +114,13 @@ public CompatPacketByteBuf writeBlockPos(BlockPos pos) { public BlockPos readBlockPosMidohra() { return BlockPos.of(readBlockPos()); } + + public NbtCompound readNbtM() { + return PacketByteUtil.readNbtM(this); + } + + public CompatPacketByteBuf writeNbt(NbtCompound nbt) { + PacketByteUtil.writeNbt(this, nbt); + return this; + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java index efc33c5f9..9984497cd 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java @@ -1,10 +1,19 @@ package net.pitan76.mcpitanlib.midohra.world; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.api.util.world.ServerWorldUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.recipe.ServerRecipeManager; import net.pitan76.mcpitanlib.midohra.server.MCServer; import net.pitan76.mcpitanlib.midohra.server.PlayerManager; @@ -12,6 +21,10 @@ import net.pitan76.mcpitanlib.midohra.util.math.ChunkPos; import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; import net.pitan76.mcpitanlib.midohra.world.chunk.ServerChunkManager; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.stream.Collectors; public class ServerWorld extends World { private final net.minecraft.server.level.ServerLevel world; @@ -75,4 +88,18 @@ public void removeTicket(ChunkTicketType type, ChunkPos pos, int radius) { public PersistentStateManager getPersistentStateManager() { return getChunkManager().getPersistentStateManager(); } + + public List getDroppedStacksOnBlock(BlockState state, BlockPos pos, @Nullable BlockEntityWrapper blockEntity) { + return ServerWorldUtil.getDroppedStacksOnBlock(state.toMinecraft(), getRaw(), pos.toMinecraft(), blockEntity) + .stream().map(ItemStack::of).collect(Collectors.toList()); + } + + public List getDroppedStacksOnBlock(BlockState state, BlockPos pos) { + return getDroppedStacksOnBlock(state, pos, null); + } + + public List getDroppedStacksOnBlock(BlockState state, BlockPos pos, @Nullable BlockEntityWrapper blockEntity, @Nullable EntityWrapper entity, ItemStack stack) { + return ServerWorldUtil.getDroppedStacksOnBlock(state.toMinecraft(), getRaw(), pos.toMinecraft(), blockEntity == null ? null : blockEntity.get(), entity == null ? null : entity.get(), stack.toMinecraft()) + .stream().map(ItemStack::of).collect(Collectors.toList()); + } } diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java index 6c5f41356..94e27d00b 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java @@ -16,6 +16,7 @@ import net.pitan76.mcpitanlib.api.util.particle.CompatParticleType; import net.pitan76.mcpitanlib.api.util.particle.effect.CompatParticleEffect; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.recipe.RecipeManager; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; @@ -219,4 +220,8 @@ public void addParticle(CompatParticleType type, double x, double y, double z, d public void addParticle(CompatParticleType type, Vector3d pos, Vector3d velocity) { addParticle(type, pos.getX(), pos.getY(), pos.getZ(), velocity.getX(), velocity.getY(), velocity.getZ()); } + + public void sendEntityStatus(EntityWrapper entity, byte status) { + WorldUtil.sendEntityStatus(getRaw(), entity.get(), status); + } } From 40a2c881388a2d9da11cce96f0b44875fbfe0bce Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 13:10:22 +0900 Subject: [PATCH 080/151] gradle --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 63e0e8303..f50f69e32 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-9.2.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 185ee20b06695ab9750fee961d55759b0311e77f Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 13:58:47 +0900 Subject: [PATCH 081/151] refactor: remove unused imports in ServerWorld.java --- .../net/pitan76/mcpitanlib/midohra/world/ServerWorld.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java index 9984497cd..5310000b3 100644 --- a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java +++ b/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java @@ -1,10 +1,6 @@ package net.pitan76.mcpitanlib.midohra.world; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.sound.CompatSoundCategory; import net.pitan76.mcpitanlib.api.sound.CompatSoundEvent; From 90b09b609dde2b37bab8328784cc21d5a302e477 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 16:36:02 +0900 Subject: [PATCH 082/151] chore: update littleobffallback version to 0.3.5.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b2bfd0b3e..fc0fb9a12 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.4.261-SNAPSHOT +littleobffallback_version=0.3.5.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=false From 1928b92d5efb61d0b1e86d4162c358df6fe9a575 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 17:00:54 +0900 Subject: [PATCH 083/151] use arch loom --- build.gradle | 250 +++++++----------- common/build.gradle | 6 +- .../java/net/pitan76/easyapi/FileControl.java | 0 .../net/pitan76/easyapi/config/Config.java | 0 .../net/pitan76/easyapi/config/IConfig.java | 0 .../pitan76/easyapi/config/JsonConfig.java | 0 .../pitan76/easyapi/config/YamlConfig.java | 0 .../pitan76/easyapi/config/package-info.java | 0 .../net/pitan76/mcpitanlib/MCPitanLib.java | 0 .../mcpitanlib/api/CommonModInitializer.java | 0 .../api/block/BlockItemByExtendBlock1215.java | 0 .../api/block/CompatBlockRenderType.java | 0 .../mcpitanlib/api/block/CompatBlocks.java | 0 .../api/block/CompatChestBlock.java | 0 .../api/block/CompatPillarBlock.java | 0 .../mcpitanlib/api/block/CompatSlabBlock.java | 0 .../api/block/CompatStairsBlock.java | 0 .../api/block/CompatWaterloggable.java | 0 .../api/block/CompatibleBlockSettings.java | 0 .../api/block/CompatibleMaterial.java | 0 .../mcpitanlib/api/block/ExtendBlock.java | 0 .../api/block/ExtendBlockEntityProvider.java | 0 .../api/block/ExtendBlockProvider.java | 0 .../api/block/args/RenderTypeArgs.java | 0 .../mcpitanlib/api/block/args/RotateArgs.java | 0 .../api/block/args/SideInvisibleArgs.java | 0 .../api/block/args/v2/CanPlaceAtArgs.java | 0 .../block/args/v2/CollisionShapeEvent.java | 0 .../args/v2/GetComparatorOutputArgs.java | 0 .../args/v2/HasComparatorOutputArgs.java | 0 .../api/block/args/v2/OutlineShapeEvent.java | 0 .../api/block/args/v2/PlacementStateArgs.java | 0 .../args/v2/StateForNeighborUpdateArgs.java | 0 .../api/block/v2/BlockSettingsBuilder.java | 0 .../mcpitanlib/api/block/v2/CompatBlock.java | 0 .../api/block/v2/CompatBlockProvider.java | 0 .../api/block/v2/CompatStairsBlock.java | 0 .../api/block/v2/CompatibleBlockSettings.java | 0 .../api/client/CompatInventoryScreen.java | 0 .../api/client/SimpleHandledScreen.java | 0 .../api/client/SimpleInventoryScreen.java | 0 .../api/client/SimpleOptionsScreen.java | 0 .../mcpitanlib/api/client/SimpleScreen.java | 0 .../api/client/color/BlockColorEvent.java | 0 .../color/CompatBlockColorProvider.java | 0 .../api/client/event/ItemTooltipRegistry.java | 0 .../api/client/event/WorldRenderRegistry.java | 0 .../listener/BeforeBlockOutlineEvent.java | 0 .../listener/BeforeBlockOutlineListener.java | 0 .../event/listener/ItemTooltipContext.java | 0 .../event/listener/ItemTooltipListener.java | 0 .../event/listener/WorldRenderContext.java | 0 .../listener/WorldRenderContextImpl.java | 0 .../listener/WorldRenderContextListener.java | 0 .../gui/screen/CompatInventoryScreen.java | 0 .../api/client/gui/screen/ScreenTexts.java | 0 .../gui/screen/SimpleHandledScreen.java | 0 .../gui/screen/SimpleInventoryScreen.java | 0 .../gui/widget/CompatTextFieldWidget.java | 0 .../CompatibleTexturedButtonWidget.java | 0 .../RedrawableTexturedButtonWidget.java | 0 .../client/gui/widget/SimpleListWidget.java | 0 .../client/gui/widget/SimpleSliderWidget.java | 0 .../api/client/option/CompatKeyBinding.java | 0 .../api/client/option/GameOptionsWrapper.java | 0 .../api/client/option/KeyCodes.java | 0 .../client/registry/ArchRegistryClient.java | 0 .../client/registry/CompatRegistryClient.java | 0 .../registry/EntityRendererRegistry.java | 0 .../client/registry/KeybindingRegistry.java | 0 .../registry/v2/KeybindingRegistry.java | 0 .../registry/v3/KeybindingRegistry.java | 0 .../api/client/render/CompatRenderLayer.java | 0 .../api/client/render/DrawObjectDM.java | 0 .../api/client/render/DrawObjectMV.java | 0 .../render/EntityModelLayerContext.java | 0 .../entity/CompatBlockEntityRenderer.java | 0 .../entity/event/BlockEntityRenderEvent.java | 0 ...ompatBlockEntityRendererConstructArgs.java | 0 .../entity/v2/CompatBlockEntityRenderer.java | 0 .../handledscreen/DrawBackgroundArgs.java | 0 .../handledscreen/DrawForegroundArgs.java | 0 .../DrawMouseoverTooltipArgs.java | 0 .../render/handledscreen/KeyEventArgs.java | 0 .../render/handledscreen/RenderArgs.java | 0 .../screen/RenderBackgroundTextureArgs.java | 0 .../api/command/AbstractCommand.java | 0 .../api/command/CommandRegistry.java | 0 .../api/command/CommandSettings.java | 0 .../mcpitanlib/api/command/ConfigCommand.java | 0 .../api/command/LiteralCommand.java | 0 .../api/command/argument/BlockCommand.java | 0 .../api/command/argument/BooleanCommand.java | 0 .../api/command/argument/DoubleCommand.java | 0 .../api/command/argument/EntitiesCommand.java | 0 .../api/command/argument/EntityCommand.java | 0 .../api/command/argument/FloatCommand.java | 0 .../command/argument/GreedyStringCommand.java | 0 .../api/command/argument/IntegerCommand.java | 0 .../api/command/argument/ItemCommand.java | 0 .../api/command/argument/LongCommand.java | 0 .../api/command/argument/PlayerCommand.java | 0 .../api/command/argument/PlayersCommand.java | 0 .../api/command/argument/RequiredCommand.java | 0 .../api/command/argument/StringCommand.java | 0 .../api/datafixer/ItemStackFixer.java | 0 .../api/enchantment/CompatEnchantment.java | 0 .../api/entity/CompatContainerUser.java | 0 .../mcpitanlib/api/entity/CompatEntity.java | 0 .../api/entity/CompatThrownItemEntity.java | 0 .../api/entity/EntityTypeBuilder.java | 0 .../mcpitanlib/api/entity/ExtendEntity.java | 0 .../api/entity/ExtendEntityType.java | 0 .../pitan76/mcpitanlib/api/entity/Player.java | 0 .../attribute/AttrModifierOperation.java | 0 .../AttributeModifiersComponentBuilder.java | 0 .../CompatAttributeModifierSlot.java | 0 .../CompatAttributeModifiersComponent.java | 0 .../attribute/CompatEntityAttribute.java | 0 .../CompatEntityAttributeInstance.java | 0 .../CompatEntityAttributeModifier.java | 0 .../attribute/CompatEntityAttributes.java | 0 .../api/entity/effect/CompatStatusEffect.java | 0 .../effect/CompatStatusEffectInstance.java | 0 .../mcpitanlib/api/event/BaseEvent.java | 0 .../api/event/BlockCommandEvent.java | 0 .../api/event/BooleanCommandEvent.java | 0 .../mcpitanlib/api/event/CommandEvent.java | 0 .../api/event/DoubleCommandEvent.java | 0 .../api/event/EntitiesCommandEvent.java | 0 .../api/event/EntityCommandEvent.java | 0 .../api/event/FloatCommandEvent.java | 0 .../api/event/IntegerCommandEvent.java | 0 .../api/event/ItemCommandEvent.java | 0 .../api/event/LongCommandEvent.java | 0 .../api/event/PlayerCommandEvent.java | 0 .../api/event/PlayersCommandEvent.java | 0 .../api/event/RequiredCommandEvent.java | 0 .../api/event/ServerCommandEvent.java | 0 .../api/event/StringCommandEvent.java | 0 .../api/event/block/AppendPropertiesArgs.java | 0 .../api/event/block/BlockBreakEvent.java | 0 .../api/event/block/BlockBreakStartEvent.java | 0 .../api/event/block/BlockPlacedEvent.java | 0 .../event/block/BlockScheduledTickEvent.java | 0 .../api/event/block/BlockUseEvent.java | 0 .../event/block/CanPathfindThroughArgs.java | 0 .../api/event/block/CollisionShapeEvent.java | 0 .../api/event/block/DroppedStacksArgs.java | 0 .../api/event/block/EntityCollisionEvent.java | 0 .../api/event/block/FluidStateArgs.java | 0 .../api/event/block/ItemScattererUtil.java | 0 .../api/event/block/NeighborUpdateEvent.java | 0 .../api/event/block/OutlineShapeEvent.java | 0 .../api/event/block/PickStackEvent.java | 0 .../api/event/block/PlacementStateArgs.java | 0 .../event/block/ScreenHandlerCreateEvent.java | 0 .../api/event/block/ShapesForStatesArgs.java | 0 .../block/StateForNeighborUpdateArgs.java | 0 .../api/event/block/StateReplacedEvent.java | 0 .../api/event/block/TileCreateEvent.java | 0 .../event/block/result/BlockBreakResult.java | 0 .../container/factory/DisplayNameArgs.java | 0 .../container/factory/ExtraDataArgs.java | 0 .../api/event/entity/CollisionEvent.java | 0 .../api/event/entity/EntityHitEvent.java | 0 .../api/event/entity/InitDataTrackerArgs.java | 0 .../api/event/item/BonusAttackDamageArgs.java | 0 .../api/event/item/CanMineArgs.java | 0 .../api/event/item/CanRepairArgs.java | 0 .../mcpitanlib/api/event/item/CraftEvent.java | 0 .../api/event/item/EnchantabilityArgs.java | 0 .../api/event/item/EnchantableArgs.java | 0 .../api/event/item/InventoryTickEvent.java | 0 .../event/item/ItemAppendTooltipEvent.java | 0 .../api/event/item/ItemBarColorArgs.java | 0 .../api/event/item/ItemBarStepArgs.java | 0 .../api/event/item/ItemBarVisibleArgs.java | 0 .../api/event/item/ItemFinishUsingEvent.java | 0 .../api/event/item/ItemUseEvent.java | 0 .../api/event/item/ItemUseOnBlockEvent.java | 0 .../api/event/item/ItemUseOnEntityEvent.java | 0 .../api/event/item/PostHitEvent.java | 0 .../api/event/item/PostMineEvent.java | 0 .../mcpitanlib/api/event/nbt/NbtRWArgs.java | 0 .../mcpitanlib/api/event/nbt/ReadNbtArgs.java | 0 .../api/event/nbt/WriteNbtArgs.java | 0 .../api/event/result/EventResult.java | 0 .../api/event/result/TypedEventResult.java | 0 .../api/event/tile/TileTickEvent.java | 0 .../event/v0/AttackEntityEventRegistry.java | 0 .../api/event/v0/ClientTickEventRegistry.java | 0 .../api/event/v0/EventRegistry.java | 0 .../event/v0/InteractionEventRegistry.java | 0 .../api/event/v0/LivingHurtEventRegistry.java | 0 .../api/event/v0/event/ClickBlockEvent.java | 0 .../event/v0/event/ItemStackActionEvent.java | 0 .../api/event/v0/event/LivingHurtEvent.java | 0 .../event/v0/event/RecipeManagerEvent.java | 0 .../event/v0/event/ServerConnectionEvent.java | 0 .../event/v1/AttackEntityEventRegistry.java | 0 .../api/event/v1/BlockEventRegistry.java | 0 .../api/event/v1/LivingHurtEventRegistry.java | 0 .../api/event/v1/RecipeManagerRegistry.java | 0 .../api/event/v1/event/AttackEntityEvent.java | 0 .../api/event/v1/listener/BlockBreakTask.java | 0 .../event/v1/listener/BlockPlacedTask.java | 0 .../api/event/v2/AbstractEvent.java | 0 .../api/event/v2/BlockEventRegistry.java | 0 .../api/event/v2/ItemEventRegistry.java | 0 .../mcpitanlib/api/event/v2/OrderedEvent.java | 0 .../event/v2/listener/InventoryTickTask.java | 0 .../extra/transfer/util/FluidStorageUtil.java | 0 .../mcpitanlib/api/gen/OreRegistry.java | 0 .../ExtendedNamedScreenHandlerFactory.java | 0 .../api/gui/ExtendedScreenHandler.java | 0 .../api/gui/ExtendedScreenHandlerFactory.java | 0 .../gui/ExtendedScreenHandlerTypeBuilder.java | 0 .../api/gui/SimpleScreenHandler.java | 0 .../gui/SimpleScreenHandlerTypeBuilder.java | 0 .../api/gui/args/CreateMenuEvent.java | 0 .../api/gui/args/SlotClickEvent.java | 0 .../api/gui/inventory/IInventory.java | 0 .../sided/ChestStyleSidedInventory.java | 0 .../inventory/sided/CompatSidedInventory.java | 0 .../sided/VanillaStyleSidedInventory.java | 0 .../sided/args/AvailableSlotsArgs.java | 0 .../inventory/sided/args/CanExtractArgs.java | 0 .../inventory/sided/args/CanInsertArgs.java | 0 .../api/gui/slot/CompatSlotActionType.java | 0 .../api/gui/slot/CompatibleSlot.java | 0 .../gui/v2/ExtendedScreenHandlerFactory.java | 0 .../gui/v2/SimpleScreenHandlerFactory.java | 0 .../mcpitanlib/api/helper/SimpleRegister.java | 0 .../api/item/ArmorEquipmentType.java | 0 .../api/item/CompatFoodComponent.java | 0 .../mcpitanlib/api/item/CompatItems.java | 0 .../api/item/CompatibleArmorItem.java | 0 .../api/item/CompatibleArmorMaterial.java | 0 .../api/item/CompatibleItemSettings.java | 0 .../api/item/CreativeTabBuilder.java | 0 .../api/item/CreativeTabManager.java | 0 .../api/item/DefaultItemGroups.java | 0 .../mcpitanlib/api/item/ExtendBlockItem.java | 0 .../mcpitanlib/api/item/ExtendItem.java | 0 .../api/item/ExtendItemProvider.java | 0 .../mcpitanlib/api/item/ExtendSettings.java | 0 .../api/item/FixedRecipeRemainderItem.java | 0 .../pitan76/mcpitanlib/api/item/FoodItem.java | 0 .../mcpitanlib/api/item/args/RarityArgs.java | 0 .../api/item/args/StoppedUsingArgs.java | 0 .../api/item/args/UseActionArgs.java | 0 .../api/item/consume/CompatUseAction.java | 0 .../item/equipment/CompatEquipmentAsset.java | 0 .../equipment/CompatEquippableComponent.java | 0 .../equipment/EquippableComponentBuilder.java | 0 .../mcpitanlib/api/item/stack/LoreUtil.java | 0 .../api/item/tool/CompatibleAxeItem.java | 0 .../api/item/tool/CompatibleHoeItem.java | 0 .../item/tool/CompatibleMiningToolItem.java | 0 .../api/item/tool/CompatiblePickaxeItem.java | 0 .../api/item/tool/CompatibleShearsItem.java | 0 .../api/item/tool/CompatibleShovelItem.java | 0 .../api/item/tool/CompatibleSwordItem.java | 0 .../api/item/tool/CompatibleToolItem.java | 0 .../api/item/tool/CompatibleToolMaterial.java | 0 .../api/item/v2/CompatArmorMaterial.java | 0 .../mcpitanlib/api/item/v2/CompatItem.java | 0 .../api/item/v2/CompatItemProvider.java | 0 .../api/item/v2/CompatibleItemSettings.java | 0 .../api/item/v2/ExtendBlockItem.java | 0 .../api/item/v2/ItemSettingsBuilder.java | 0 .../api/item/v3/CompatArmorMaterial.java | 0 .../api/item/v3/CompatToolMaterial.java | 0 .../item/v3/VanillaCompatToolMaterial.java | 0 .../block/BlockApiLookupWithDirection.java | 0 .../lookup/block/BlockApiLookupWrapper.java | 0 .../pitan76/mcpitanlib/api/nbt/NbtTag.java | 0 .../mcpitanlib/api/nbt/NbtTypeBytes.java | 0 .../api/network/ClientNetworking.java | 0 .../api/network/PacketByteUtil.java | 0 .../api/network/ServerNetworking.java | 0 .../api/network/v2/ClientNetworking.java | 0 .../api/network/v2/ServerNetworking.java | 0 .../network/v2/args/ClientReceiveEvent.java | 0 .../network/v2/args/ServerReceiveEvent.java | 0 .../api/offlineplayer/OfflinePlayer.java | 0 .../offlineplayer/OfflinePlayerManager.java | 0 .../api/packet/UpdatePacketType.java | 0 .../api/recipe/CompatRecipeType.java | 0 .../api/recipe/CompatibleRecipeEntry.java | 0 .../mcpitanlib/api/recipe/MatchGetter.java | 0 .../api/recipe/input/CompatRecipeInput.java | 0 .../api/recipe/v2/CompatRecipeEntry.java | 0 .../api/recipe/v2/CompatRecipeNonEntry.java | 0 .../api/recipe/v3/CompatRecipe.java | 0 .../api/registry/CompatRegistry.java | 0 .../api/registry/CompatRegistryLookup.java | 0 .../mcpitanlib/api/registry/FuelRegistry.java | 0 .../api/registry/WorldGenRegistry.java | 0 .../api/registry/result/RegistryResult.java | 0 .../api/registry/result/RegistrySupplier.java | 0 .../api/registry/result/SupplierResult.java | 0 .../api/registry/v2/CompatRegistryV2.java | 0 .../api/simple/block/SimpleGuiBlock.java | 0 .../api/simple/item/SimpleGuiItem.java | 0 .../api/sound/CompatBlockSoundGroup.java | 0 .../api/sound/CompatSoundCategory.java | 0 .../api/sound/CompatSoundEvent.java | 0 .../api/sound/CompatSoundEvents.java | 0 .../sound/RegistryResultCompatSoundEvent.java | 0 .../api/state/property/BlockHalfProperty.java | 0 .../api/state/property/BooleanProperty.java | 0 .../api/state/property/CompatProperties.java | 0 .../api/state/property/DirectionProperty.java | 0 .../api/state/property/EnumProperty.java | 0 .../api/state/property/IProperty.java | 0 .../api/state/property/IntProperty.java | 0 .../state/property/StairShapeProperty.java | 0 .../api/state/property/UnknownProperty.java | 0 .../mcpitanlib/api/tag/MineableToolTags.java | 0 .../pitan76/mcpitanlib/api/tag/TagKey.java | 0 .../api/tag/item/RepairIngredientTag.java | 0 .../mcpitanlib/api/tag/v2/CompatTagKey.java | 0 .../api/tag/v2/CompatTagKeyType.java | 0 .../api/tag/v2/typed/BlockTagKey.java | 0 .../api/tag/v2/typed/EntityTagKey.java | 0 .../api/tag/v2/typed/FluidTagKey.java | 0 .../api/tag/v2/typed/ItemTagKey.java | 0 .../mcpitanlib/api/text/CompatFormatting.java | 0 .../mcpitanlib/api/text/CompatStyle.java | 0 .../mcpitanlib/api/text/CompatTextColor.java | 0 .../mcpitanlib/api/text/TextComponent.java | 0 .../mcpitanlib/api/text/TextConverter.java | 0 .../api/text/VariableTextComponent.java | 0 .../api/tile/BlockEntityTypeBuilder.java | 0 .../api/tile/CompatBlockEntity.java | 0 .../api/tile/CompatChestBlockEntity.java | 0 .../api/tile/ExtendBlockEntity.java | 0 .../api/tile/ExtendBlockEntityTicker.java | 0 .../api/tile/RenderAttachmentBlockEntity.java | 0 .../api/tile/RenderDataBlockEntity.java | 0 .../api/tile/v2/BlockEntityTypeBuilder.java | 0 .../api/timer/MinecraftServerTimerAccess.java | 0 .../api/timer/ServerWorldTimerAccess.java | 0 .../mcpitanlib/api/timer/TimerItem.java | 0 .../transfer/fluid/v1/FabricFluidStorage.java | 2 +- .../transfer/fluid/v1/FabricFluidVariant.java | 2 +- .../transfer/fluid/v1/FluidStorageUtil.java | 2 +- .../api/transfer/fluid/v1/IFluidStorage.java | 0 .../api/transfer/fluid/v1/IFluidVariant.java | 0 .../api/util/ArmorMaterialUtil.java | 0 .../api/util/BlockEntityDataUtil.java | 0 .../api/util/BlockEntityTypeUtil.java | 0 .../mcpitanlib/api/util/BlockEntityUtil.java | 0 .../mcpitanlib/api/util/BlockStateUtil.java | 0 .../mcpitanlib/api/util/BlockUtil.java | 0 .../mcpitanlib/api/util/BlockViewUtil.java | 0 .../api/util/CommandManagerUtil.java | 0 .../mcpitanlib/api/util/CommandUtil.java | 0 .../api/util/CompatActionResult.java | 0 .../mcpitanlib/api/util/CompatIdentifier.java | 0 .../mcpitanlib/api/util/CompatRarity.java | 0 .../api/util/CompatStringIdentifiable.java | 0 .../api/util/CompatibleRecipeEntryUtil.java | 0 .../mcpitanlib/api/util/CustomDataUtil.java | 0 .../mcpitanlib/api/util/DamageSourceUtil.java | 0 .../api/util/DirectionBoolPropertyUtil.java | 0 .../mcpitanlib/api/util/EnchantmentUtil.java | 0 .../mcpitanlib/api/util/EntityTypeUtil.java | 0 .../mcpitanlib/api/util/EntityUtil.java | 0 .../api/util/EquipMaterialUtil.java | 0 .../api/util/FeatureConfigUtil.java | 0 .../mcpitanlib/api/util/FluidStateUtil.java | 0 .../mcpitanlib/api/util/FluidUtil.java | 0 .../pitan76/mcpitanlib/api/util/HandUtil.java | 0 .../mcpitanlib/api/util/IdentifierUtil.java | 0 .../mcpitanlib/api/util/IngredientUtil.java | 0 .../mcpitanlib/api/util/InteractUtil.java | 0 .../mcpitanlib/api/util/InventoryUtil.java | 0 .../mcpitanlib/api/util/ItemStackUtil.java | 0 .../pitan76/mcpitanlib/api/util/ItemUtil.java | 0 .../pitan76/mcpitanlib/api/util/Logger.java | 0 .../mcpitanlib/api/util/LoggerUtil.java | 0 .../mcpitanlib/api/util/MCVersionUtil.java | 0 .../pitan76/mcpitanlib/api/util/MathUtil.java | 0 .../pitan76/mcpitanlib/api/util/NbtUtil.java | 0 .../api/util/ParticleEffectUtil.java | 0 .../api/util/PersistentStateUtil.java | 0 .../mcpitanlib/api/util/PlacedFutureUtil.java | 0 .../mcpitanlib/api/util/PlatformUtil.java | 0 .../api/util/PlayerManagerUtil.java | 0 .../mcpitanlib/api/util/PlayerUtil.java | 0 .../mcpitanlib/api/util/PropertyUtil.java | 0 .../mcpitanlib/api/util/RecipeUtil.java | 0 .../api/util/RegistryLookupUtil.java | 0 .../mcpitanlib/api/util/ResourceUtil.java | 0 .../api/util/ScreenHandlerUtil.java | 0 .../mcpitanlib/api/util/ServerUtil.java | 0 .../api/util/SimpleInventoryUtil.java | 0 .../pitan76/mcpitanlib/api/util/SlotUtil.java | 0 .../mcpitanlib/api/util/SoundEventUtil.java | 0 .../api/util/StackActionResult.java | 0 .../mcpitanlib/api/util/StateManagerUtil.java | 0 .../mcpitanlib/api/util/StatusEffectUtil.java | 0 .../mcpitanlib/api/util/StyleUtil.java | 0 .../pitan76/mcpitanlib/api/util/TextUtil.java | 0 .../mcpitanlib/api/util/TimerUtil.java | 0 .../mcpitanlib/api/util/ToolMaterialUtil.java | 0 .../mcpitanlib/api/util/VoxelShapeUtil.java | 0 .../mcpitanlib/api/util/WorldRandomUtil.java | 0 .../mcpitanlib/api/util/WorldUtil.java | 0 .../api/util/block/BlockHitResultUtil.java | 0 .../mcpitanlib/api/util/block/BlockUtil.java | 0 .../api/util/block/entity/FurnaceUtil.java | 0 .../block/properties/CompatBlockHalf.java | 0 .../block/properties/CompatStairShape.java | 0 .../util/client/BlockEntityRendererUtil.java | 0 .../api/util/client/ClientUtil.java | 0 .../api/util/client/LanguageUtil.java | 0 .../api/util/client/MatrixStackUtil.java | 0 .../mcpitanlib/api/util/client/MouseUtil.java | 0 .../api/util/client/RenderUtil.java | 0 .../api/util/client/ScreenUtil.java | 0 .../api/util/client/WindowUtil.java | 0 .../render/CompatItemDisplayContext.java | 0 .../client/render/CompatItemRenderUtil.java | 0 .../client/render/VertexConsumerUtil.java | 0 .../client/render/VertexRenderingUtil.java | 0 .../util/client/render/WorldRendererUtil.java | 0 .../api/util/client/v2/RenderUtil.java | 0 .../api/util/client/v2/ScreenUtil.java | 0 .../client/widget/ClickableWidgetUtil.java | 0 .../api/util/client/widget/TextFieldUtil.java | 0 .../util/collection/ClippedItemStackList.java | 0 .../util/collection/DefaultedListUtil.java | 0 .../api/util/collection/ItemStackList.java | 0 .../api/util/color/CompatBrightness.java | 0 .../api/util/color/CompatDyeColor.java | 0 .../api/util/color/CompatMapColor.java | 0 .../mcpitanlib/api/util/debug/OutputUtil.java | 0 .../api/util/entity/ArrowEntityUtil.java | 0 .../api/util/entity/EquipmentSlotUtil.java | 0 .../api/util/entity/ItemEntityUtil.java | 0 .../api/util/entity/LivingEntityUtil.java | 0 .../api/util/entity/ProjectileEntityUtil.java | 0 .../api/util/entity/ServerPlayerUtil.java | 0 .../util/entity/SmallFireballEntityUtil.java | 0 .../api/util/entity/SnowballEntityUtil.java | 0 .../util/entity/SpectralArrowEntityUtil.java | 0 .../api/util/entity/ThrownItemEntityUtil.java | 0 .../api/util/event/BlockEventGenerator.java | 0 .../api/util/event/ItemEventGenerator.java | 0 .../api/util/inventory/ClippedInventory.java | 0 .../api/util/inventory/CompatInventory.java | 0 .../util/inventory/CompatPlayerInventory.java | 0 .../util/inventory/ContainerInventory.java | 0 .../api/util/inventory/ICompatInventory.java | 0 .../util/inventory/PlayerInventoryUtil.java | 0 .../util/inventory/args/CanInsertArgs.java | 0 .../mcpitanlib/api/util/item/FuelUtil.java | 0 .../api/util/item/ItemGroupUtil.java | 0 .../mcpitanlib/api/util/item/ItemUtil.java | 0 .../api/util/math/BlockRotations.java | 0 .../mcpitanlib/api/util/math/BoxUtil.java | 0 .../api/util/math/DirectionUtil.java | 0 .../mcpitanlib/api/util/math/PointUtil.java | 0 .../mcpitanlib/api/util/math/PosUtil.java | 0 .../mcpitanlib/api/util/math/Vec3dUtil.java | 0 .../mcpitanlib/api/util/math/Vec3iUtil.java | 0 .../api/util/math/random/CompatRandom.java | 0 .../mcpitanlib/api/util/nbt/InvRWUtil.java | 0 .../mcpitanlib/api/util/nbt/NbtListUtil.java | 0 .../mcpitanlib/api/util/nbt/NbtRWUtil.java | 0 .../mcpitanlib/api/util/nbt/v2/NbtRWUtil.java | 0 .../api/util/particle/CompatParticleType.java | 0 .../util/particle/CompatParticleTypes.java | 0 .../effect/CompatItemStackParticleEffect.java | 0 .../particle/effect/CompatParticleEffect.java | 0 .../effect/ItemStackParticleEffectUtil.java | 0 .../api/util/recipe/CraftingRecipeUtil.java | 0 .../api/util/recipe/RecipeMatcherUtil.java | 0 .../api/util/recipe/RecipeUtil.java | 0 .../recipe/input/CraftingRecipeInputUtil.java | 0 .../input/SingleStackRecipeInputUtil.java | 0 .../api/util/screen/ScreenHandlerUtil.java | 0 .../mcpitanlib/api/util/v1/BlockUtilV1.java | 0 .../mcpitanlib/api/util/v1/ItemUtilV1.java | 0 .../mcpitanlib/api/util/v2/BlockUtilV2.java | 0 .../api/util/v2/CustomNameUtil.java | 0 .../mcpitanlib/api/util/v2/ItemUtilV2.java | 0 .../api/util/world/ChunkManagerUtil.java | 0 .../api/util/world/ServerWorldUtil.java | 0 .../mcpitanlib/api/util/world/TickerUtil.java | 0 .../api/util/world/WorldAccessUtil.java | 0 .../api/util/world/WorldViewUtil.java | 0 .../api/world/CompatiblePersistentState.java | 0 .../mcpitanlib/api/world/ExtendWorld.java | 0 .../net/pitan76/mcpitanlib/core/Dummy.java | 0 .../core/command/CommandResult.java | 0 .../mcpitanlib/core/datafixer/Pair.java | 0 .../core/mc1216/NbtDataConverter.java | 0 .../mcpitanlib/core/network/BufPayload.java | 0 .../mcpitanlib/core/player/ItemCooldown.java | 0 .../core/registry/FuelRegistry.java | 0 .../core/registry/MCPLRegistry.java | 0 .../core/registry/MCPLRegistry1_20.java | 0 .../core/registry/MCPLRegistry1_21.java | 0 .../core/serialization/CompatMapCodec.java | 0 .../codecs/CompatBlockMapCodecUtil.java | 0 .../pitan76/mcpitanlib/debug/DebugTool.java | 0 .../fabric/ExtendModInitializer.java | 0 .../mcpitanlib/fabric/MCPitanLibFabric.java | 0 .../mcpitanlib/guilib/GuiRegistry.java | 0 .../mcpitanlib/guilib/GuiTextures.java | 0 .../mcpitanlib/guilib/MGLClientNetworks.java | 0 .../pitan76/mcpitanlib/guilib/MPLGuiLib.java | 0 .../mcpitanlib/guilib/api/IScreenInfo.java | 0 .../guilib/api/ISimpleScreenInfo.java | 0 .../mcpitanlib/guilib/api/NetworkDefines.java | 0 .../entity/BlockEntityWithContainer.java | 0 .../ExtendedBlockEntityWithContainer.java | 0 .../container/BlockEntityContainerGui.java | 0 .../guilib/api/container/ContainerGui.java | 0 .../ExtendedBlockEntityContainerGui.java | 0 .../api/container/SimpleContainerGui.java | 0 .../guilib/api/render/PartsRenderer.java | 0 .../guilib/api/render/SlotRenderer.java | 0 .../guilib/api/screen/ContainerGuiScreen.java | 0 .../api/screen/SimpleContainerGuiScreen.java | 0 .../mcpitanlib/guilib/test/TestContainer.java | 0 .../pitan76/mcpitanlib/midohra/Midohra.java | 0 .../mcpitanlib/midohra/MidohraAPI.java | 0 .../mcpitanlib/midohra/block/BlockState.java | 0 .../mcpitanlib/midohra/block/BlockStateM.java | 0 .../midohra/block/BlockWrapper.java | 0 .../mcpitanlib/midohra/block/Blocks.java | 0 .../mcpitanlib/midohra/block/MCBlocks.java | 0 .../midohra/block/SupplierBlockWrapper.java | 0 .../block/SupplierTypedBlockWrapper.java | 0 .../midohra/block/TypedBlockWrapper.java | 0 .../block/entity/BlockEntityTypeWrapper.java | 0 .../block/entity/BlockEntityWrapper.java | 0 .../RewritableBlockEntityTypeWrapper.java | 0 .../SupplierBlockEntityTypeWrapper.java | 0 .../entity/SupplierBlockEntityWrapper.java | 0 .../SupplierTypedBlockEntityTypeWrapper.java | 0 .../SupplierTypedBlockEntityWrapper.java | 0 .../entity/TypedBlockEntityTypeWrapper.java | 0 .../block/entity/TypedBlockEntityWrapper.java | 0 .../midohra/client/render/CameraWrapper.java | 0 .../midohra/component/ItemComponentTypes.java | 0 .../item/CustomNameComponentType.java | 0 .../component/item/ItemComponentType.java | 0 .../component/item/RarityComponentType.java | 0 .../midohra/easybuilder/BlockBuilder.java | 0 .../easybuilder/BlockEntityBuilder.java | 0 .../BlockWithBlockEntityBuilder.java | 0 .../midohra/easybuilder/ItemBuilder.java | 0 .../midohra/easybuilder/built/BuiltBlock.java | 0 .../easybuilder/built/BuiltBlockEntity.java | 0 .../built/BuiltBlockWithEntity.java | 0 .../midohra/easybuilder/built/BuiltItem.java | 0 .../midohra/entity/EntityTypeWrapper.java | 0 .../midohra/entity/EntityTypes.java | 0 .../midohra/entity/EntityWrapper.java | 0 .../mcpitanlib/midohra/entity/IEntityM.java | 0 .../midohra/entity/ItemEntityWrapper.java | 0 .../mcpitanlib/midohra/entity/SpawnGroup.java | 0 .../midohra/entity/SpawnReason.java | 0 .../entity/SupplierEntityTypeWrapper.java | 0 .../midohra/entity/SupplierEntityWrapper.java | 0 .../SupplierTypedEntityTypeWrapper.java | 0 .../entity/TypedEntityTypeWrapper.java | 0 .../mcpitanlib/midohra/fluid/FluidState.java | 0 .../midohra/fluid/FluidWrapper.java | 0 .../mcpitanlib/midohra/fluid/Fluids.java | 0 .../holder/BlockStatePropertyHolder.java | 0 .../midohra/item/ItemGroupWrapper.java | 0 .../mcpitanlib/midohra/item/ItemGroups.java | 0 .../mcpitanlib/midohra/item/ItemStack.java | 0 .../mcpitanlib/midohra/item/ItemWrapper.java | 0 .../mcpitanlib/midohra/item/Items.java | 0 .../mcpitanlib/midohra/item/MCItems.java | 0 .../item/SupplierItemGroupWrapper.java | 0 .../midohra/item/SupplierItemWrapper.java | 0 .../item/SupplierTypedItemWrapper.java | 0 .../midohra/item/TypedItemWrapper.java | 0 .../midohra/nbt/ElementConvertible.java | 0 .../mcpitanlib/midohra/nbt/NbtCompound.java | 0 .../mcpitanlib/midohra/nbt/NbtElement.java | 0 .../mcpitanlib/midohra/nbt/NbtInteger.java | 0 .../mcpitanlib/midohra/nbt/NbtList.java | 0 .../mcpitanlib/midohra/nbt/NbtString.java | 0 .../midohra/network/CompatPacketByteBuf.java | 0 .../midohra/recipe/CraftingRecipe.java | 0 .../mcpitanlib/midohra/recipe/Ingredient.java | 0 .../mcpitanlib/midohra/recipe/Recipe.java | 0 .../midohra/recipe/RecipeManager.java | 0 .../mcpitanlib/midohra/recipe/RecipeType.java | 0 .../midohra/recipe/ServerRecipeManager.java | 0 .../midohra/recipe/ShapedRecipe.java | 0 .../midohra/recipe/ShapelessRecipe.java | 0 .../recipe/entry/CraftingRecipeEntry.java | 0 .../midohra/recipe/entry/RecipeEntry.java | 0 .../recipe/entry/ShapedRecipeEntry.java | 0 .../recipe/entry/ShapelessRecipeEntry.java | 0 .../input/CraftingRecipeInputOrInventory.java | 0 .../recipe/input/RecipeInputOrInventory.java | 0 .../input/TypedRecipeInputOrInventory.java | 0 .../midohra/registry/MidohraRegistry.java | 0 .../mcpitanlib/midohra/resource/Resource.java | 0 .../midohra/resource/ResourceManager.java | 0 .../mcpitanlib/midohra/server/MCServer.java | 0 .../midohra/server/PlayerManager.java | 0 .../midohra/util/hit/BlockHitResult.java | 0 .../midohra/util/hit/HitResult.java | 0 .../midohra/util/hit/HitResultType.java | 0 .../midohra/util/math/BlockPos.java | 0 .../mcpitanlib/midohra/util/math/Box.java | 0 .../midohra/util/math/ChunkPos.java | 0 .../midohra/util/math/Direction.java | 0 .../midohra/util/math/Vector3d.java | 0 .../midohra/util/math/Vector3f.java | 0 .../midohra/util/math/Vector3i.java | 0 .../midohra/util/math/v0/BlockPos.java | 0 .../midohra/util/shape/VoxelShape.java | 0 .../mcpitanlib/midohra/world/BlockView.java | 0 .../midohra/world/CompatPersistentState.java | 0 .../mcpitanlib/midohra/world/IWorldView.java | 0 .../midohra/world/PersistentStateManager.java | 0 .../midohra/world/PersistentStateWrapper.java | 0 .../midohra/world/RedstoneView.java | 0 .../mcpitanlib/midohra/world/ServerWorld.java | 0 .../mcpitanlib/midohra/world/World.java | 0 .../mcpitanlib/midohra/world/WorldAccess.java | 0 .../mcpitanlib/midohra/world/WorldView.java | 0 .../midohra/world/chunk/ChunkManager.java | 0 .../midohra/world/chunk/ChunkTicketType.java | 0 .../world/chunk/ServerChunkManager.java | 0 .../midohra/world/tick/ScheduledTickView.java | 0 .../AbstractBlock4CompatProviderMixin.java | 0 .../mcpitanlib/mixin/AbstractBlockMixin.java | 0 .../mixin/Block4CompatProviderMixin.java | 0 .../mcpitanlib/mixin/BlockInvoker.java | 0 .../pitan76/mcpitanlib/mixin/BlockMixin.java | 0 .../mcpitanlib/mixin/CraftingRecipeMixin.java | 0 .../pitan76/mcpitanlib/mixin/ItemMixin.java | 0 .../ItemStackComponentizationFixMixin.java | 0 .../mcpitanlib/mixin/ItemStackMixin.java | 0 .../mcpitanlib/mixin/LevelRendererMixin.java | 0 .../mixin/MinecraftServerTimer.java | 0 .../mcpitanlib/mixin/RecipeManagerMixin.java | 0 .../mcpitanlib/mixin/ServerLevelTimer.java | 0 .../mcpitanlib/mixin/UseOnContextMixin.java | 0 .../mcpitanlib/test/ExampleCommand.java | 0 .../mcpitanlib/test/ExampleContainerGui.java | 0 .../test/ExampleContainerGuiScreen.java | 0 .../mcpitanlib/test/ExampleGuiBlock.java | 0 .../mcpitanlib/test/ExampleGuiItem.java | 0 .../pitan76/mcpitanlib/test/ExampleMod.java | 0 .../mcpitanlib/test/ExampleModClient.java | 0 .../mcpitanlib/test/ExampleScreen.java | 0 .../mcpitanlib/test/ExampleScreenHandler.java | 0 .../mplguilib/textures/container/base.png | Bin .../textures/container/base_furnace.png | Bin .../textures/container/gui_parts.png | Bin .../src}/main/resources/fabric.mod.json | 0 {src => common/src}/main/resources/icon.png | Bin .../resources/mcpitanlib-common.mixins.json | 0 .../main/resources/mcpitanlib.accesswidener | 0 fabric/build.gradle | 50 ++-- fabric/gradle.properties | 1 + neoforge/build.gradle | 105 ++++++++ neoforge/gradle.properties | 1 + settings.gradle | 10 +- 676 files changed, 239 insertions(+), 190 deletions(-) rename {src => common/src}/main/java/net/pitan76/easyapi/FileControl.java (100%) rename {src => common/src}/main/java/net/pitan76/easyapi/config/Config.java (100%) rename {src => common/src}/main/java/net/pitan76/easyapi/config/IConfig.java (100%) rename {src => common/src}/main/java/net/pitan76/easyapi/config/JsonConfig.java (100%) rename {src => common/src}/main/java/net/pitan76/easyapi/config/YamlConfig.java (100%) rename {src => common/src}/main/java/net/pitan76/easyapi/config/package-info.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/MCPitanLib.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/Player.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java (96%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java (92%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java (88%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/Logger.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/Dummy.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/World.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java (100%) rename {src => common/src}/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java (100%) rename {src => common/src}/main/resources/assets/mplguilib/textures/container/base.png (100%) rename {src => common/src}/main/resources/assets/mplguilib/textures/container/base_furnace.png (100%) rename {src => common/src}/main/resources/assets/mplguilib/textures/container/gui_parts.png (100%) rename {src => common/src}/main/resources/fabric.mod.json (100%) rename {src => common/src}/main/resources/icon.png (100%) rename {src => common/src}/main/resources/mcpitanlib-common.mixins.json (100%) rename {src => common/src}/main/resources/mcpitanlib.accesswidener (100%) create mode 100644 fabric/gradle.properties create mode 100644 neoforge/build.gradle create mode 100644 neoforge/gradle.properties diff --git a/build.gradle b/build.gradle index 03717edb1..0e32ab931 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,12 @@ plugins { - id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' - id 'maven-publish' + id "architectury-plugin" version "3.5-SNAPSHOT" + id "dev.architectury.loom-no-remap" version "1.14-SNAPSHOT" apply false id 'com.matthewprenger.cursegradle' version '1.5.0-SNAPSHOT' // FORK: maven.pitan76.net id "com.modrinth.minotaur" version "2.+" - id 'com.gradleup.shadow' version '9.4.0' +} + +architectury { + minecraft = rootProject.minecraft_version } def loadProperties(filename) { @@ -16,179 +19,108 @@ def loadProperties(filename) { ext.info = loadProperties("$rootDir/info.properties") -version = info.mod_version + "-" + rootProject.minecraft_version -group = info.maven_group - -base { - archivesName = info.archives_base_name -} - - -repositories { - maven { url "https://maven.pitan76.net/" } - maven { url "https://maven.shedaniel.me/" } +allprojects { + version = info.mod_version + "-" + rootProject.minecraft_version + group = info.maven_group } -loom { - accessWidenerPath = file("src/main/resources/mcpitanlib.accesswidener") -} - -dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - implementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}" - - implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - - implementation 'org.yaml:snakeyaml:2.0' - shadow 'org.yaml:snakeyaml:2.0' - - api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") +subprojects { + apply plugin: "architectury-plugin" + apply plugin: "dev.architectury.loom-no-remap" + apply plugin: "maven-publish" + apply plugin: "com.modrinth.minotaur" + apply plugin: "com.matthewprenger.cursegradle" - implementation("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") { - exclude(group: "net.fabricmc.fabric-api") + base { + // Set up a suffixed format for the mod jar names, e.g. `example-fabric`. + archivesName = info.archives_base_name } - implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") - include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") - include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") -} - -processResources { - inputs.property "version", info.mod_version - inputs.property "minecraft_version", project.minecraft_version - inputs.property "loader_version", project.fabric_loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": info.mod_version, - "minecraft_version": project.minecraft_version, - "loader_version": project.fabric_loader_version - } - - project.version = project.version + "-fabric" -} - -def targetJavaVersion = 25 -tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - it.options.encoding = "UTF-8" - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - it.options.release.set(targetJavaVersion) - } -} -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. - withSourcesJar() -} - -tasks.named("jar") { - archiveClassifier.set("dev-unshadowed") -} - -tasks.named("shadowJar") { - dependsOn tasks.named("jar") - - doFirst { - copy { - from zipTree(tasks.named("jar").get().archiveFile) - include "fabric.mod.json" - into project.sourceSets.main.output.resourcesDir - } - } - - from(zipTree(tasks.named("jar").get().archiveFile)) { - include "META-INF/jars/**" + repositories { + maven { url "https://maven.pitan76.net/" } + maven { url "https://maven.neoforged.net/releases/" } + maven { url "https://maven.shedaniel.me/" } } - relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" - configurations = [project.configurations.shadow] - archiveClassifier.set("") - - duplicatesStrategy = DuplicatesStrategy.INCLUDE -} + dependencies { + minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" -jar { - from("LICENSE") { - rename { "${it}_${info.archives_base_name}" } + // https://mvnrepository.com/artifact/org.yaml/snakeyaml + implementation 'org.yaml:snakeyaml:2.0' } -} -if (System.getenv("CURSEFORGE_TOKEN") != null) { - curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") - project { - id = '682213' - changelog = info.changelog - releaseType = 'beta' - addGameVersion "Fabric" - addGameVersion "26.1" - addGameVersion "26.1.1" - relations { - requiredDependency 'fabric-api' - embeddedLibrary 'compatdatapacks' - embeddedLibrary 'legacyitemmodels' + if (name in "fabric,neoforge".split(",")) { + var modLoader = name + + if (System.getenv("CURSEFORGE_TOKEN") != null) { + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = '682213' + changelog = info.changelog + releaseType = 'beta' + if (modLoader == "fabric") { + addGameVersion "Fabric" + } + if (modLoader == "forge") { + addGameVersion "Forge" + } + if (modLoader == "neoforge") { + addGameVersion "NeoForge" + } + addGameVersion "26.1" + addGameVersion "26.1.1" + addGameVersion "26.1.2" + + relations { + if (modLoader == "fabric") { + requiredDependency "fabric-api" + } + + embeddedLibrary 'cloth-config' + embeddedLibrary 'compatdatapacks' + embeddedLibrary 'legacyitemmodels' + } + + mainArtifact(tasks.jar) + } + options { + forgeGradleIntegration = false + } } - mainArtifact(tasks.shadowJar) } - } -} -if (System.getenv("MODRINTH_TOKEN") != null) { - modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = 'mcpitanlibarch' - versionNumber = info.mod_version + "-fabric-" + rootProject.minecraft_version.toString() - gameVersions = ["26.1", "26.1.1"] - versionType = 'beta' - uploadFile = tasks.shadowJar - changelog = info.changelog - loaders = ["fabric"] - dependencies { - required.project "fabric-api" - embedded.project "compatdatapacks" - embedded.project "legacyitemmodels" + if (System.getenv("MODRINTH_TOKEN") != null) { + modrinth { + token = System.getenv("MODRINTH_TOKEN") + projectId = 'mcpitanlibarch' + versionNumber = info.mod_version + "-" + modLoader + gameVersions = ["26.1", "26.1.1", "26.1.2"] + versionType = 'beta' + uploadFile = tasks.jar + changelog = info.changelog + loaders = [modLoader] + dependencies { + if (modLoader == "fabric") { + required.project "fabric-api" // Fabric API + } + embedded.project "cloth-config" + embedded.project "compatdatapacks" + embedded.project "legacyitemmodels" + } + } } } -} -publishing { - publications { - mavenFabric(MavenPublication) { - artifactId = info.archives_base_name + "-fabric-" + rootProject.minecraft_version - version = info.mod_version - from components.java - } + tasks.withType(JavaCompile).configureEach { + options.encoding = "UTF-8" + options.release = 25 + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 } - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/PTOM76/maven") - credentials { - username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") - password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") - } - } + java { + withSourcesJar() } -} +} \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle index 0c17b9439..2ebebe848 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,9 +1,5 @@ dependencies { - // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies - // Do NOT use other classes from fabric loader - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - // Remove the next line if you don't want to depend on the API -// modApi "dev.architectury:architectury:${rootProject.architectury_version}" + implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" } architectury { diff --git a/src/main/java/net/pitan76/easyapi/FileControl.java b/common/src/main/java/net/pitan76/easyapi/FileControl.java similarity index 100% rename from src/main/java/net/pitan76/easyapi/FileControl.java rename to common/src/main/java/net/pitan76/easyapi/FileControl.java diff --git a/src/main/java/net/pitan76/easyapi/config/Config.java b/common/src/main/java/net/pitan76/easyapi/config/Config.java similarity index 100% rename from src/main/java/net/pitan76/easyapi/config/Config.java rename to common/src/main/java/net/pitan76/easyapi/config/Config.java diff --git a/src/main/java/net/pitan76/easyapi/config/IConfig.java b/common/src/main/java/net/pitan76/easyapi/config/IConfig.java similarity index 100% rename from src/main/java/net/pitan76/easyapi/config/IConfig.java rename to common/src/main/java/net/pitan76/easyapi/config/IConfig.java diff --git a/src/main/java/net/pitan76/easyapi/config/JsonConfig.java b/common/src/main/java/net/pitan76/easyapi/config/JsonConfig.java similarity index 100% rename from src/main/java/net/pitan76/easyapi/config/JsonConfig.java rename to common/src/main/java/net/pitan76/easyapi/config/JsonConfig.java diff --git a/src/main/java/net/pitan76/easyapi/config/YamlConfig.java b/common/src/main/java/net/pitan76/easyapi/config/YamlConfig.java similarity index 100% rename from src/main/java/net/pitan76/easyapi/config/YamlConfig.java rename to common/src/main/java/net/pitan76/easyapi/config/YamlConfig.java diff --git a/src/main/java/net/pitan76/easyapi/config/package-info.java b/common/src/main/java/net/pitan76/easyapi/config/package-info.java similarity index 100% rename from src/main/java/net/pitan76/easyapi/config/package-info.java rename to common/src/main/java/net/pitan76/easyapi/config/package-info.java diff --git a/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java b/common/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java rename to common/src/main/java/net/pitan76/mcpitanlib/MCPitanLib.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/CommonModInitializer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/BlockItemByExtendBlock1215.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlockRenderType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatBlocks.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatChestBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatPillarBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatSlabBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatStairsBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatWaterloggable.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleBlockSettings.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/CompatibleMaterial.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockEntityProvider.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RenderTypeArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/RotateArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/SideInvisibleArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CanPlaceAtArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/CollisionShapeEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/GetComparatorOutputArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/HasComparatorOutputArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/OutlineShapeEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/PlacementStateArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/args/v2/StateForNeighborUpdateArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/BlockSettingsBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatBlockProvider.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatStairsBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/block/v2/CompatibleBlockSettings.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/CompatInventoryScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleHandledScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleInventoryScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleOptionsScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/color/CompatBlockColorProvider.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/WorldRenderRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/BeforeBlockOutlineListener.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipContext.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/ItemTooltipListener.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextImpl.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContextListener.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/ScreenTexts.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatTextFieldWidget.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/CompatibleTexturedButtonWidget.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/RedrawableTexturedButtonWidget.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleListWidget.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/widget/SimpleSliderWidget.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/option/GameOptionsWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/option/KeyCodes.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/EntityRendererRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v2/KeybindingRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/v3/KeybindingRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatRenderLayer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectMV.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/EntityModelLayerContext.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/CompatBlockEntityRenderer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/CompatBlockEntityRendererConstructArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/v2/CompatBlockEntityRenderer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawBackgroundArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawForegroundArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/DrawMouseoverTooltipArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/KeyEventArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/RenderArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/client/render/screen/RenderBackgroundTextureArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/AbstractCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandSettings.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/ConfigCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/LiteralCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BlockCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/BooleanCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/DoubleCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntitiesCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/EntityCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/FloatCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/GreedyStringCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/IntegerCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/ItemCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/LongCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayerCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/PlayersCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/RequiredCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/command/argument/StringCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/datafixer/ItemStackFixer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java b/common/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/enchantment/CompatEnchantment.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatContainerUser.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/EntityTypeBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntityType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttrModifierOperation.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/AttributeModifiersComponentBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifierSlot.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatAttributeModifiersComponent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttribute.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeInstance.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributeModifier.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/attribute/CompatEntityAttributes.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffect.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/entity/effect/CompatStatusEffectInstance.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/BaseEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/BlockCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/BooleanCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/CommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/DoubleCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/EntitiesCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/EntityCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/FloatCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/IntegerCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/ItemCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/LongCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayersCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/RequiredCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/StringCommandEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/AppendPropertiesArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockBreakStartEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockPlacedEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockScheduledTickEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CanPathfindThroughArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/CollisionShapeEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/DroppedStacksArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/EntityCollisionEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/FluidStateArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ItemScattererUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/NeighborUpdateEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/OutlineShapeEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PickStackEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/PlacementStateArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ScreenHandlerCreateEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/ShapesForStatesArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateForNeighborUpdateArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/StateReplacedEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/block/result/BlockBreakResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/DisplayNameArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/CollisionEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/EntityHitEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/entity/InitDataTrackerArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/BonusAttackDamageArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanMineArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CanRepairArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/CraftEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantabilityArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/EnchantableArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/InventoryTickEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarColorArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarVisibleArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemFinishUsingEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnBlockEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/NbtRWArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/ReadNbtArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/nbt/WriteNbtArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/result/EventResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/result/TypedEventResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ClickBlockEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ItemStackActionEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/LivingHurtEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/RecipeManagerEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/BlockEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/RecipeManagerRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/event/AttackEntityEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockBreakTask.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/listener/BlockPlacedTask.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/AbstractEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/BlockEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/ItemEventRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/OrderedEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/event/v2/listener/InventoryTickTask.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gen/OreRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/SlotClickEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/ChestStyleSidedInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/CompatSidedInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/VanillaStyleSidedInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/AvailableSlotsArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanExtractArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/sided/args/CanInsertArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatSlotActionType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/slot/CompatibleSlot.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/ExtendedScreenHandlerFactory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/gui/v2/SimpleScreenHandlerFactory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java b/common/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/helper/SimpleRegister.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/ArmorEquipmentType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatFoodComponent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatItems.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleArmorMaterial.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/CompatibleItemSettings.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendBlockItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendSettings.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/FixedRecipeRemainderItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/FoodItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/args/RarityArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/args/StoppedUsingArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/args/UseActionArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/consume/CompatUseAction.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquipmentAsset.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/CompatEquippableComponent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/equipment/EquippableComponentBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/stack/LoreUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleAxeItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleHoeItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleMiningToolItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatiblePickaxeItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShearsItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleShovelItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleSwordItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/tool/CompatibleToolMaterial.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatArmorMaterial.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatItemProvider.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/CompatibleItemSettings.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ExtendBlockItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v2/ItemSettingsBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatArmorMaterial.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatToolMaterial.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/VanillaCompatToolMaterial.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java b/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java b/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTag.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/nbt/NbtTypeBytes.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ClientNetworking.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/ServerNetworking.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ClientReceiveEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/network/v2/args/ServerReceiveEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java b/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java b/common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/offlineplayer/OfflinePlayerManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/packet/UpdatePacketType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatRecipeType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/recipe/CompatibleRecipeEntry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/recipe/MatchGetter.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/recipe/input/CompatRecipeInput.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeEntry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v2/CompatRecipeNonEntry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/recipe/v3/CompatRecipe.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/CompatRegistryLookup.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistryResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/RegistrySupplier.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/result/SupplierResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/registry/v2/CompatRegistryV2.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/simple/block/SimpleGuiBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/simple/item/SimpleGuiItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatBlockSoundGroup.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundCategory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/sound/CompatSoundEvents.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/sound/RegistryResultCompatSoundEvent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BlockHalfProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/BooleanProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/CompatProperties.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/DirectionProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/EnumProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/IntProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/StairShapeProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java b/common/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/state/property/UnknownProperty.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/MineableToolTags.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/TagKey.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/item/RepairIngredientTag.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKey.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/CompatTagKeyType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/BlockTagKey.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/EntityTagKey.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/FluidTagKey.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tag/v2/typed/ItemTagKey.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatFormatting.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatStyle.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/text/CompatTextColor.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/text/TextComponent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/text/TextConverter.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/text/VariableTextComponent.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/ExtendBlockEntityTicker.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderDataBlockEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/timer/MinecraftServerTimerAccess.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/timer/ServerWorldTimerAccess.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/timer/TimerItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java similarity index 96% rename from src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java index 529f8d472..618784c75 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java @@ -4,7 +4,7 @@ import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric.FabricFluidVariant; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.FabricFluidVariant; public class FabricFluidStorage implements IFluidStorage { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java similarity index 92% rename from src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java index ea29c5b71..2274d37d2 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java @@ -1,4 +1,4 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric; +package net.pitan76.mcpitanlib.api.transfer.fluid.v1; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.minecraft.world.level.material.Fluid; diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java similarity index 88% rename from src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java index 4e92acb14..5b444ac15 100644 --- a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java @@ -3,7 +3,7 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; import net.minecraft.world.level.material.Fluid; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric.FabricFluidVariant; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.FabricFluidVariant; public class FluidStorageUtil { public static IFluidStorage withFixedCapacity(long capacity, Runnable onChange) { diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidStorage.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/IFluidVariant.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ArmorMaterialUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityDataUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityTypeUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockStateUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/BlockViewUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandManagerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CommandUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatActionResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatIdentifier.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatRarity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatStringIdentifiable.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CompatibleRecipeEntryUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/CustomDataUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/DamageSourceUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/DirectionBoolPropertyUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/EnchantmentUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityTypeUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/EquipMaterialUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/FeatureConfigUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidStateUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/FluidUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/HandUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/IdentifierUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/IngredientUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/InteractUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemStackUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ItemUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/Logger.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/LoggerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/MCVersionUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/MathUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/NbtUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ParticleEffectUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/PersistentStateUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/PlacedFutureUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerManagerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/PlayerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/PropertyUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/RecipeUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/RegistryLookupUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ResourceUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ServerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/SimpleInventoryUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/SlotUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/SoundEventUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/StackActionResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/StateManagerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/StatusEffectUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/StyleUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/TextUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/TimerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/ToolMaterialUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/VoxelShapeUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldRandomUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/WorldUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockHitResultUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/block/BlockUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/block/entity/FurnaceUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatBlockHalf.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/block/properties/CompatStairShape.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/BlockEntityRendererUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ClientUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/LanguageUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MatrixStackUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/MouseUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/RenderUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemDisplayContext.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/CompatItemRenderUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexConsumerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/VertexRenderingUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/render/WorldRendererUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/RenderUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/v2/ScreenUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/ClickableWidgetUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/client/widget/TextFieldUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ClippedItemStackList.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/DefaultedListUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatBrightness.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatDyeColor.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/color/CompatMapColor.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/debug/OutputUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ArrowEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/EquipmentSlotUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ItemEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/LivingEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ProjectileEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ServerPlayerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SmallFireballEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SnowballEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/SpectralArrowEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/entity/ThrownItemEntityUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/event/BlockEventGenerator.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/event/ItemEventGenerator.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ClippedInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/CompatPlayerInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ContainerInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/ICompatInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/PlayerInventoryUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/CanInsertArgs.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/item/FuelUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemGroupUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/item/ItemUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BlockRotations.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/BoxUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/DirectionUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PointUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/PosUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3dUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/Vec3iUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/math/random/CompatRandom.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/InvRWUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtListUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/NbtRWUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/nbt/v2/NbtRWUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/CompatParticleTypes.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatItemStackParticleEffect.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/CompatParticleEffect.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/particle/effect/ItemStackParticleEffectUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/CraftingRecipeUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeMatcherUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/RecipeUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/CraftingRecipeInputUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/recipe/input/SingleStackRecipeInputUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/screen/ScreenHandlerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/BlockUtilV1.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/v1/ItemUtilV1.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/BlockUtilV2.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/CustomNameUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/v2/ItemUtilV2.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ChunkManagerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/world/ServerWorldUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/world/TickerUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldAccessUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/world/WorldViewUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java b/common/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/world/CompatiblePersistentState.java diff --git a/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java b/common/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/world/ExtendWorld.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java b/common/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/Dummy.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/Dummy.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java b/common/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/command/CommandResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java b/common/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/datafixer/Pair.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java b/common/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/mc1216/NbtDataConverter.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java b/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java b/common/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/player/ItemCooldown.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java b/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/serialization/CompatMapCodec.java diff --git a/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java rename to common/src/main/java/net/pitan76/mcpitanlib/core/serialization/codecs/CompatBlockMapCodecUtil.java diff --git a/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java b/common/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java rename to common/src/main/java/net/pitan76/mcpitanlib/debug/DebugTool.java diff --git a/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java b/common/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java rename to common/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java b/common/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java rename to common/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiTextures.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/MGLClientNetworks.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/MPLGuiLib.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/IScreenInfo.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/ISimpleScreenInfo.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/NetworkDefines.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/BlockEntityWithContainer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/ExtendedBlockEntityWithContainer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/PartsRenderer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/render/SlotRenderer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java rename to common/src/main/java/net/pitan76/mcpitanlib/guilib/test/TestContainer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/Midohra.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/MidohraAPI.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockState.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockStateM.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/MCBlocks.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/RewritableBlockEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/client/render/CameraWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/component/ItemComponentTypes.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/CustomNameComponentType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/ItemComponentType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/component/item/RarityComponentType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockEntityBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/BlockWithBlockEntityBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/ItemBuilder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltBlockWithEntity.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/easybuilder/built/BuiltItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityTypes.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/ItemEntityWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnGroup.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SpawnReason.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/Fluids.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/holder/BlockStatePropertyHolder.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/MCItems.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemGroupWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/ElementConvertible.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtInteger.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtString.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/CraftingRecipe.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Ingredient.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/RecipeType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ServerRecipeManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapedRecipe.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/ShapelessRecipe.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/CraftingRecipeEntry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/RecipeEntry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapedRecipeEntry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/entry/ShapelessRecipeEntry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/CraftingRecipeInputOrInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/RecipeInputOrInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/input/TypedRecipeInputOrInventory.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/Resource.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/resource/ResourceManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/server/MCServer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/server/PlayerManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/BlockHitResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResult.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/hit/HitResultType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/BlockPos.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Box.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/ChunkPos.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Direction.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3d.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3f.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/Vector3i.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/math/v0/BlockPos.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/BlockView.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/IWorldView.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/PersistentStateWrapper.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/RedstoneView.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/ServerWorld.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/World.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldView.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ChunkTicketType.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/chunk/ServerChunkManager.java diff --git a/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java rename to common/src/main/java/net/pitan76/mcpitanlib/midohra/world/tick/ScheduledTickView.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlock4CompatProviderMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/AbstractBlockMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/Block4CompatProviderMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockInvoker.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/BlockMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/CraftingRecipeMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackComponentizationFixMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/ItemStackMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/MinecraftServerTimer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/RecipeManagerMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/ServerLevelTimer.java diff --git a/src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java rename to common/src/main/java/net/pitan76/mcpitanlib/mixin/UseOnContextMixin.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleCommand.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGui.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleContainerGuiScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiBlock.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleGuiItem.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleMod.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleModClient.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreen.java diff --git a/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java similarity index 100% rename from src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java rename to common/src/main/java/net/pitan76/mcpitanlib/test/ExampleScreenHandler.java diff --git a/src/main/resources/assets/mplguilib/textures/container/base.png b/common/src/main/resources/assets/mplguilib/textures/container/base.png similarity index 100% rename from src/main/resources/assets/mplguilib/textures/container/base.png rename to common/src/main/resources/assets/mplguilib/textures/container/base.png diff --git a/src/main/resources/assets/mplguilib/textures/container/base_furnace.png b/common/src/main/resources/assets/mplguilib/textures/container/base_furnace.png similarity index 100% rename from src/main/resources/assets/mplguilib/textures/container/base_furnace.png rename to common/src/main/resources/assets/mplguilib/textures/container/base_furnace.png diff --git a/src/main/resources/assets/mplguilib/textures/container/gui_parts.png b/common/src/main/resources/assets/mplguilib/textures/container/gui_parts.png similarity index 100% rename from src/main/resources/assets/mplguilib/textures/container/gui_parts.png rename to common/src/main/resources/assets/mplguilib/textures/container/gui_parts.png diff --git a/src/main/resources/fabric.mod.json b/common/src/main/resources/fabric.mod.json similarity index 100% rename from src/main/resources/fabric.mod.json rename to common/src/main/resources/fabric.mod.json diff --git a/src/main/resources/icon.png b/common/src/main/resources/icon.png similarity index 100% rename from src/main/resources/icon.png rename to common/src/main/resources/icon.png diff --git a/src/main/resources/mcpitanlib-common.mixins.json b/common/src/main/resources/mcpitanlib-common.mixins.json similarity index 100% rename from src/main/resources/mcpitanlib-common.mixins.json rename to common/src/main/resources/mcpitanlib-common.mixins.json diff --git a/src/main/resources/mcpitanlib.accesswidener b/common/src/main/resources/mcpitanlib.accesswidener similarity index 100% rename from src/main/resources/mcpitanlib.accesswidener rename to common/src/main/resources/mcpitanlib.accesswidener diff --git a/fabric/build.gradle b/fabric/build.gradle index ba6c830c6..df00eb006 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,5 +1,5 @@ plugins { - id "com.github.johnrengelman.shadow" version "8.1.1" + id "com.gradleup.shadow" version "9.4.0" } architectury { @@ -17,39 +17,50 @@ configurations { canBeConsumed = false } // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. - shadowBundle { + shadowCommon { canBeResolved = true canBeConsumed = false } compileClasspath.extendsFrom common runtimeClasspath.extendsFrom common developmentFabric.extendsFrom common + + apiElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } + runtimeElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } } dependencies { - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - modCompileOnly "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - // Remove the next line if you don't want to depend on the API - modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" + implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + compileOnly "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowBundle(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } - shadowBundle 'org.yaml:snakeyaml:2.0' + shadowCommon 'org.yaml:snakeyaml:2.0' - modApi("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { + api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.cloth_config_version}") - modImplementation("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") { + implementation("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") { exclude(group: "net.fabricmc.fabric-api") } - modImplementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { + implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { + exclude(group: "net.fabricmc.fabric-api") + } + implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { exclude(group: "net.fabricmc.fabric-api") } include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") + include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") } processResources { @@ -67,19 +78,16 @@ shadowJar { exclude "architectury.common.json" - configurations = [project.configurations.shadowBundle] - archiveClassifier.set "dev-shadow" -} + dependsOn(jar) + mainSpec.sourcePaths.clear() + from(zipTree(jar.archiveFile)) -remapJar { - injectAccessWidener = true - inputFile.set shadowJar.archiveFile - dependsOn shadowJar - archiveClassifier.set null + configurations = [project.configurations.shadowCommon] + archiveClassifier.set(null) } jar { - archiveClassifier.set "dev" + setArchiveClassifier("dev") } sourcesJar { @@ -122,7 +130,7 @@ tasks.runClient.doFirst { to.bytes = from.bytes } -tasks.remapJar.doFirst { +tasks.jar.doFirst { if (file("src/main/resources/mcpitanlib.accesswidener").exists()) { delete file("src/main/resources/mcpitanlib.accesswidener") } diff --git a/fabric/gradle.properties b/fabric/gradle.properties new file mode 100644 index 000000000..90ee7a259 --- /dev/null +++ b/fabric/gradle.properties @@ -0,0 +1 @@ +loom.platform=fabric \ No newline at end of file diff --git a/neoforge/build.gradle b/neoforge/build.gradle new file mode 100644 index 000000000..e84cce774 --- /dev/null +++ b/neoforge/build.gradle @@ -0,0 +1,105 @@ +plugins { + id "com.gradleup.shadow" version "9.4.0" +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +loom { + accessWidenerPath = project(":common").loom.accessWidenerPath +} + +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentNeoForge.extendsFrom common + + apiElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } + runtimeElements { + outgoing.artifacts.clear() + outgoing.artifact(shadowJar) + } +} + +dependencies { + neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false } + + shadowCommon 'org.yaml:snakeyaml:2.0' + + include("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.cloth_config_version}") + + include("net.pitan76:compatdatapacks76-neoforge:${rootProject.compatdatapacks76_version}") + include("net.pitan76:legacyitemmodels-neoforge:${rootProject.legacyitemmodels_version}") +} + +processResources { + inputs.property "version", project.version + + filesMatching("META-INF/neoforge.mods.toml") { + expand "version": project.version + } + + project.version = project.version + "-neoforge" +} + +shadowJar { + relocate "org.yaml.snakeyaml", "net.pitan76.mcpitanlib.shadow.yaml.snakeyaml" + + exclude "fabric.mod.json" + exclude "architectury.common.json" + + dependsOn(jar) + mainSpec.sourcePaths.clear() + from(zipTree(jar.archiveFile)) + + configurations = [project.configurations.shadowCommon] + archiveClassifier.set(null) +} + +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 { + mavenNeoForge(MavenPublication) { + artifactId = info.archives_base_name + "-" + project.name + "-" + rootProject.minecraft_version + version = info.mod_version + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/PTOM76/maven") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties new file mode 100644 index 000000000..2914393db --- /dev/null +++ b/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index bae4a571d..befe3057a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,9 +1,15 @@ pluginManagement { repositories { maven { url "https://maven.fabricmc.net/" } -// maven { url "https://maven.architectury.dev/" } -// maven { url "https://maven.minecraftforge.net/" } + maven { url "https://maven.architectury.dev/" } + maven { url "https://maven.minecraftforge.net/" } maven { url "https://maven.pitan76.net/" } gradlePluginPortal() } } + +include("common") +if (fabricEnabled.toBoolean()) + include("fabric") +if (neoforgeEnabled.toBoolean()) + include("neoforge") \ No newline at end of file From 0844886fdbc6dbfcd52681da1929668d818766b8 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 17:01:43 +0900 Subject: [PATCH 084/151] gradle --- fabric/build.gradle | 2 +- neoforge/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fabric/build.gradle b/fabric/build.gradle index df00eb006..713062052 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -39,7 +39,7 @@ dependencies { implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" compileOnly "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - common(project(path: ":common", configuration: "namedElements")) { transitive false } + common(project(path: ":common")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } shadowCommon 'org.yaml:snakeyaml:2.0' diff --git a/neoforge/build.gradle b/neoforge/build.gradle index e84cce774..8e56aff0f 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -31,7 +31,7 @@ configurations { dependencies { neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" - common(project(path: ":common", configuration: "namedElements")) { transitive false } + common(project(path: ":common")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false } shadowCommon 'org.yaml:snakeyaml:2.0' From 42b04356fc543b30332433b072421f7423ca06fb Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 17:03:46 +0900 Subject: [PATCH 085/151] neoforge --- .../neoforge/WorldRenderRegistryImpl.java | 227 ++++++++++++++++++ .../neoforge/CompatRegistryClientImpl.java | 32 +++ .../neoforge/BlockEntityTypeBuilderImpl.java | 14 ++ .../v1/neoforge/FluidStorageUtilImpl.java | 17 ++ .../v1/neoforge/NeoForgeFluidStorage.java | 89 +++++++ .../v1/neoforge/NeoForgeFluidVariant.java | 33 +++ .../api/util/neoforge/PlatformUtilImpl.java | 26 ++ .../neoforge/MCPitanLibNeoForge.java | 29 +++ .../client/MCPitanLibNeoForgeClient.java | 10 + .../resources/META-INF/neoforge.mods.toml | 42 ++++ .../src/main/resources/mcpitanlib.mixins.json | 13 + neoforge/src/main/resources/pack.mcmeta | 8 + 12 files changed, 540 insertions(+) create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java create mode 100644 neoforge/src/main/resources/META-INF/neoforge.mods.toml create mode 100644 neoforge/src/main/resources/mcpitanlib.mixins.json create mode 100644 neoforge/src/main/resources/pack.mcmeta diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java new file mode 100644 index 000000000..0ad42f08c --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java @@ -0,0 +1,227 @@ +package net.pitan76.mcpitanlib.api.client.event.neoforge; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.*; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.world.ClientWorld; +import net.neoforged.neoforge.client.event.ExtractBlockOutlineRenderStateEvent; +import net.neoforged.neoforge.client.event.RenderFrameEvent; +import net.neoforged.neoforge.client.event.RenderLevelStageEvent; +import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineEvent; +import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineListener; +import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContext; +import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContextListener; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import org.joml.Matrix4f; + +import java.util.ArrayList; +import java.util.List; + +public class WorldRenderRegistryImpl { + + public static List beforeBlockOutlineListeners = new ArrayList<>(); + public static List worldRenderAfterLevelListeners = new ArrayList<>(); + + public static void renderOutlineEventBlock(ExtractBlockOutlineRenderStateEvent event) { + for (BeforeBlockOutlineListener listener : beforeBlockOutlineListeners) { + boolean eventContinue = listener.beforeBlockOutline(new BeforeBlockOutlineEvent(new WorldRenderContext() { + @Override + public WorldRenderer getWorldRenderer() { + return event.getLevelRenderer(); + } + + @Override + public MatrixStack getMatrixStack() { + return new MatrixStack(); + } + + @Override + public float getTickDelta() { + return ClientUtil.getClient().getRenderTickCounter().getDynamicDeltaTicks(); + } + + @Override + public Camera getCamera() { + return event.getCamera(); + } + + @Override + public GameRenderer getGameRenderer() { + return MinecraftClient.getInstance().gameRenderer; + } + + @Override + public LightmapTextureManager getLightmapTextureManager() { + return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); + } + + @Deprecated + @Override + public Matrix4f getProjectionMatrix() { + return null; + } + + @Override + public ClientWorld getWorld() { + return MinecraftClient.getInstance().world; + } + + @Deprecated + @Override + public boolean isAdvancedTranslucency() { + return event.isInTranslucentPass(); + } + + @Override + public VertexConsumerProvider getConsumers() { + return ClientUtil.getClient().getBufferBuilders().getOutlineVertexConsumers(); + } + + @Override + public Frustum getFrustum() { + return event.getLevelRenderer().getCapturedFrustum(); + } + }, event.getLevelRenderState().outlineRenderState)); + + if (!eventContinue) { + event.setCanceled(true); + break; + } + } + } +// +// public static void renderOutlineEvent(RenderHighlightEvent.Entity event) { +// for (BeforeBlockOutlineListener listener : beforeBlockOutlineListeners) { +// listener.beforeBlockOutline(new BeforeBlockOutlineEvent(new WorldRenderContext() { +// @Override +// public WorldRenderer getWorldRenderer() { +// return event.getLevelRenderer(); +// } +// +// @Override +// public MatrixStack getMatrixStack() { +// return event.getPoseStack(); +// } +// +// @Override +// public float getTickDelta() { +// return event.getDeltaTracker().getDynamicDeltaTicks(); +// } +// +// @Override +// public Camera getCamera() { +// return event.getCamera(); +// } +// +// @Override +// public GameRenderer getGameRenderer() { +// return MinecraftClient.getInstance().gameRenderer; +// } +// +// @Override +// public LightmapTextureManager getLightmapTextureManager() { +// return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); +// } +// +// @Deprecated +// @Override +// public Matrix4f getProjectionMatrix() { +// return null; +// } +// +// @Override +// public ClientWorld getWorld() { +// return MinecraftClient.getInstance().world; +// } +// +// @Deprecated +// @Override +// public boolean isAdvancedTranslucency() { +// return event.getLevelRenderer().isTerrainRenderComplete(); +// } +// +// @Override +// public VertexConsumerProvider getConsumers() { +// return event.getMultiBufferSource(); +// } +// +// @Override +// public Frustum getFrustum() { +// return event.getLevelRenderer().getFrustum(); +// } +// }, event.getTarget())); +// } +// } + + public static void renderLevelStageEvent(RenderLevelStageEvent.AfterLevel event) { + for (WorldRenderContextListener listener : worldRenderAfterLevelListeners) { + listener.render(new WorldRenderContext() { + @Override + public WorldRenderer getWorldRenderer() { + return event.getLevelRenderer(); + } + + @Override + public MatrixStack getMatrixStack() { + return event.getPoseStack(); + } + + @Override + public float getTickDelta() { + return event.getLevelRenderer().getTicks(); + } + + @Override + public Camera getCamera() { + return MinecraftClient.getInstance().gameRenderer.getCamera(); + } + + @Override + public GameRenderer getGameRenderer() { + return MinecraftClient.getInstance().gameRenderer; + } + + @Override + public LightmapTextureManager getLightmapTextureManager() { + return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); + } + + @Deprecated + @Override + public Matrix4f getProjectionMatrix() { + return event.getModelViewMatrix(); + } + + @Override + public ClientWorld getWorld() { + return MinecraftClient.getInstance().world; + } + + @Deprecated + @Override + public boolean isAdvancedTranslucency() { + return event.getLevelRenderer().isTerrainRenderComplete(); + } + + @Override + public VertexConsumerProvider getConsumers() { + return MinecraftClient.getInstance().getBufferBuilders().getOutlineVertexConsumers(); + } + + @Override + public Frustum getFrustum() { + return event.getLevelRenderer().getCapturedFrustum(); + } + }); + } + } + + public static void _registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { + beforeBlockOutlineListeners.add(listener); + } + + public static void _registerWorldRenderAfterLevel(WorldRenderContextListener listener) { + worldRenderAfterLevelListeners.add(listener); + } +} + diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java new file mode 100644 index 000000000..a639bf61e --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.api.client.registry.neoforge; + +import net.minecraft.block.Block; +import net.minecraft.client.color.block.BlockColorProvider; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; + +import java.util.HashMap; +import java.util.Map; + +public class CompatRegistryClientImpl { + + public static Map blockColorProviders = new HashMap<>(); + + public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { + blockColorProviders.put(provider, blocks); + } + + public static void registerBlockColors(RegisterColorHandlersEvent.Block event){ + if (blockColorProviders.isEmpty()) return; + + for (Map.Entry entry : blockColorProviders.entrySet()) { + BlockColorProvider provider = entry.getKey(); + Block[] blocks = entry.getValue(); + + if (blocks == null || blocks.length == 0) { + event.register(provider); + } else { + event.register(provider, blocks); + } + } + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java new file mode 100644 index 000000000..1d132e365 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.api.tile.neoforge; + +import com.mojang.datafixers.types.Type; +import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; + +public class BlockEntityTypeBuilderImpl { + @Deprecated + public static BlockEntityType build(Type type, BlockEntityTypeBuilder.Factory factory, Block... blocks) { + return new BlockEntityType<>(factory::create, blocks); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java new file mode 100644 index 000000000..594c27330 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; + +import net.minecraft.fluid.Fluid; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.transfer.fluid.FluidStacksResourceHandler; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; + +public class FluidStorageUtilImpl { + public static IFluidStorage withFixedCapacity(long capacity, Runnable onChange) { + return new NeoForgeFluidStorage(new FluidStacksResourceHandler(1, (int) capacity), capacity, onChange); + } + + public static IFluidVariant getVariant(Fluid fluid) { + return new NeoForgeFluidVariant(new FluidStack(fluid, 1)); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java new file mode 100644 index 000000000..5d9c75a00 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidStorage.java @@ -0,0 +1,89 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; + +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.transfer.fluid.FluidResource; +import net.neoforged.neoforge.transfer.fluid.FluidStacksResourceHandler; +import net.neoforged.neoforge.transfer.transaction.Transaction; +import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; +import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; + +public class NeoForgeFluidStorage implements IFluidStorage { + + public final FluidStacksResourceHandler handler; + public FluidStack fluid = FluidStack.EMPTY; + public long capacity; + + public Runnable onChange; + + public NeoForgeFluidStorage(FluidStacksResourceHandler handler, long capacity, Runnable onChange) { + this.handler = handler; + this.onChange = onChange; + this.capacity = capacity; + } + + @Override + public long getAmount() { + return handler.getAmountFrom(fluid); + } + + @Override + public long getCapacity() { + return capacity; + } + + @Override + public IFluidVariant getResource() { + return new NeoForgeFluidVariant(fluid); + } + + @Override + public void setResource(IFluidVariant variant) { + fluid = ((NeoForgeFluidVariant) variant).raw; + } + + @Override + public boolean isResourceBlank() { + return fluid.isEmpty(); + } + + @Override + public long insert(IFluidVariant variant, long maxAmount, boolean simulate) { + if (simulate) + return handler.insert(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, Transaction.open(null)); + + onChange.run(); + long inserted = 0; + + try (Transaction transaction = Transaction.open(null)) { + inserted += handler.insert(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, transaction); + transaction.commit(); + } + return inserted; + } + + @Override + public long extract(IFluidVariant variant, long maxAmount, boolean simulate) { + if (simulate) + return handler.extract(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, Transaction.open(null)); + + onChange.run(); + long extracted = 0; + try (Transaction transaction = Transaction.open(null)) { + extracted += handler.extract(FluidResource.of(((NeoForgeFluidVariant) variant).raw), (int) maxAmount, transaction); + transaction.commit(); + } + return extracted; + } + + @Override + public void writeNbt(WriteNbtArgs args) { + handler.serialize(args.view); + } + + @Override + public void readNbt(ReadNbtArgs args) { + handler.deserialize(args.view); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java new file mode 100644 index 000000000..8c5e0a995 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java @@ -0,0 +1,33 @@ +package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; + +import net.minecraft.fluid.Fluid; +import net.neoforged.neoforge.fluids.FluidStack; +import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; + +public class NeoForgeFluidVariant implements IFluidVariant { + + public final FluidStack raw; + + public NeoForgeFluidVariant() { + this.raw = FluidStack.EMPTY; + } + + public NeoForgeFluidVariant(FluidStack stack) { + this.raw = stack; + } + + @Override + public Fluid getFluid() { + return raw.getFluid(); + } + + @Override + public boolean isBlank() { + return raw.isEmpty(); + } + + @Override + public boolean isSame(Fluid fluid) { + return raw.is(fluid); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java new file mode 100644 index 000000000..6be8273a8 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.util.neoforge; + +import net.neoforged.api.distmarker.Dist; +import net.neoforged.fml.ModList; +import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.fml.loading.FMLPaths; + +import java.nio.file.Path; + +public class PlatformUtilImpl { + public static boolean isClient() { + return FMLEnvironment.getDist() == Dist.CLIENT; + } + + public static boolean isServer() { + return FMLEnvironment.getDist() == Dist.DEDICATED_SERVER; + } + + public static Path getConfigFolder() { + return FMLPaths.CONFIGDIR.get(); + } + + public static boolean isModLoaded(String id) { + return ModList.get().isLoaded(id); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java new file mode 100644 index 000000000..33374d614 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.neoforge; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.common.NeoForge; +import net.pitan76.mcpitanlib.MCPitanLib; +import net.pitan76.mcpitanlib.api.client.event.neoforge.WorldRenderRegistryImpl; +import net.pitan76.mcpitanlib.api.client.registry.neoforge.CompatRegistryClientImpl; +import net.pitan76.mcpitanlib.api.util.PlatformUtil; + +@Mod(MCPitanLib.MOD_ID) +public class MCPitanLibNeoForge { + public MCPitanLibNeoForge(ModContainer modContainer) { + IEventBus bus = modContainer.getEventBus(); + + if (PlatformUtil.isClient()) { + IEventBus nfBus = NeoForge.EVENT_BUS; + // TODO: re-implement outline rendering event +// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEventBlock); +// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEvent); + nfBus.addListener(WorldRenderRegistryImpl::renderLevelStageEvent); + if (bus != null) + bus.addListener(CompatRegistryClientImpl::registerBlockColors); + } + + MCPitanLib.init(); + } +} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java new file mode 100644 index 000000000..d5ae9a7c4 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/client/MCPitanLibNeoForgeClient.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.neoforge.client; + +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; + +public class MCPitanLibNeoForgeClient { + public static void clientInit(FMLClientSetupEvent event) { + //if (PlatformUtil.isDevelopmentEnvironment()) + // ExampleModClient.init(); + } +} diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 000000000..b6d488a0d --- /dev/null +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,42 @@ +modLoader = "javafml" +loaderVersion = "[1,)" +license = "MIT" +issueTrackerURL = "https://github.com/Pitan76/MCPitanLib/issue" + +[[mods]] +modId = "mcpitanlib" +version = "${version}" +displayName = "MCPitanLib" +displayURL = "https://www.curseforge.com/minecraft/mc-mods/mcpitanlibarch" +logoFile = "icon.png" +authors = "Pitan" +description = ''' +Pitan's Minecraft Mod Library +''' + +[[dependencies.mcpitanlib]] +modId = "neoforge" +type = "required" +versionRange = "[20,)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.mcpitanlib]] +modId = "minecraft" +type = "required" +versionRange = "[1.21,)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.mcpitanlib]] +modId = "architectury" +type = "required" +versionRange = "[19.0.0,)" +ordering = "NONE" +side = "BOTH" + +[[mixins]] +config = "mcpitanlib-common.mixins.json" + +[[mixins]] +config = "mcpitanlib.mixins.json" \ No newline at end of file diff --git a/neoforge/src/main/resources/mcpitanlib.mixins.json b/neoforge/src/main/resources/mcpitanlib.mixins.json new file mode 100644 index 000000000..df01c3ab5 --- /dev/null +++ b/neoforge/src/main/resources/mcpitanlib.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "net.pitan76.mcpitanlib.forge.mixin", + "compatibilityLevel": "JAVA_8", + "mixins": [ + ], + "client": [ + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/neoforge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta new file mode 100644 index 000000000..03e89dcaa --- /dev/null +++ b/neoforge/src/main/resources/pack.mcmeta @@ -0,0 +1,8 @@ +{ + "pack": { + "description": "mcpitanlib resources", + "pack_format": 8, + "forge:resource_pack_format": 8, + "forge:data_pack_format": 9 + } +} From 9802ab29e501610bdbc3ac1fbc60104ca22d8871 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 17:48:37 +0900 Subject: [PATCH 086/151] neoforge --- .../api/client/color/BlockColorEvent.java | 9 +-- .../api/client/event/ItemTooltipRegistry.java | 7 +-- .../client/registry/ArchRegistryClient.java | 1 - .../pitan76/mcpitanlib/api/entity/Player.java | 2 +- .../ExtendedNamedScreenHandlerFactory.java | 2 +- .../api/gui/ExtendedScreenHandlerFactory.java | 2 +- .../block/BlockApiLookupWithDirection.java | 56 ------------------ .../lookup/block/BlockApiLookupWrapper.java | 57 ------------------- .../api/network/ClientNetworking.java | 19 +------ .../api/registry/WorldGenRegistry.java | 6 -- .../api/tile/RenderAttachmentBlockEntity.java | 21 ------- .../api/util/ScreenHandlerUtil.java | 2 +- .../core/mc261/ClientPlayNetworking.java | 23 ++++++++ .../core/mc261/ExtendedMenuProvider.java | 8 +++ .../mcpitanlib/core/network/BufPayload.java | 1 - .../event/fabric/ItemTooltipRegistryImpl.java | 12 ++++ .../fabric/ClientPlayNetworkingImpl.java | 36 ++++++++++++ gradle.properties | 2 +- .../neoforge/ItemTooltipRegistryImpl.java | 23 ++++++++ .../neoforge/ClientPlayNetworkingImpl.java | 53 +++++++++++++++++ 20 files changed, 169 insertions(+), 173 deletions(-) delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ClientPlayNetworking.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ExtendedMenuProvider.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/ItemTooltipRegistryImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ClientPlayNetworkingImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/ItemTooltipRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java index 3cf31f142..a0cbe1ee5 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/color/BlockColorEvent.java @@ -1,10 +1,10 @@ package net.pitan76.mcpitanlib.api.client.color; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.renderer.block.BlockAndTintGetter; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.pitan76.mcpitanlib.api.tile.RenderAttachmentBlockEntity; import net.pitan76.mcpitanlib.midohra.world.BlockView; import org.jetbrains.annotations.Nullable; @@ -72,15 +72,12 @@ public Object getRenderData() { return getRenderDataD(getBlockEntity()); } + @ExpectPlatform public static Object getRenderDataD(BlockEntity blockEntity) { - if (blockEntity instanceof RenderAttachmentBlockEntity) { - return ((RenderAttachmentBlockEntity) blockEntity).getCompatRenderData(); - } - if (blockEntity instanceof net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) { return ((net.pitan76.mcpitanlib.api.tile.RenderDataBlockEntity) blockEntity).getCompatRenderData(); } - return blockEntity.getRenderData(); + return null; } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java index d597f4180..ef0efff4e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/ItemTooltipRegistry.java @@ -1,12 +1,11 @@ package net.pitan76.mcpitanlib.api.client.event; -import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.pitan76.mcpitanlib.api.client.event.listener.ItemTooltipListener; public class ItemTooltipRegistry { + @ExpectPlatform public static void registerItemTooltip(ItemTooltipListener listener) { - ItemTooltipCallback.EVENT.register(((stack, tooltipContext, type, texts) -> { - listener.onTooltip(stack, texts, tooltipContext, type); - })); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java index 584211380..3cb5f48b2 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java @@ -2,7 +2,6 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.particle.v1.ParticleProviderRegistry; import net.minecraft.client.renderer.block.BlockModelResolver; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.item.ItemModelResolver; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index e91f59559..c3a58abcf 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -2,7 +2,6 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.component.DataComponents; @@ -45,6 +44,7 @@ import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; import net.pitan76.mcpitanlib.api.util.TextUtil; import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; +import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; import net.pitan76.mcpitanlib.core.player.ItemCooldown; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java index 40a2ba9dc..a1a8b6229 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedNamedScreenHandlerFactory.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.gui; -import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Inventory; @@ -9,6 +8,7 @@ import net.minecraft.world.inventory.MenuConstructor; import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; import org.jetbrains.annotations.Nullable; @Deprecated diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java index da194bf64..08ce5f056 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerFactory.java @@ -1,12 +1,12 @@ package net.pitan76.mcpitanlib.api.gui; -import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; import net.pitan76.mcpitanlib.api.event.container.factory.ExtraDataArgs; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; @Deprecated public interface ExtendedScreenHandlerFactory extends ExtendedMenuProvider { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java b/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java deleted file mode 100644 index 64943d6ab..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWithDirection.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.pitan76.mcpitanlib.api.lookup.block; - -import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.util.math.Direction; -import net.pitan76.mcpitanlib.midohra.world.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.function.BiFunction; - -public class BlockApiLookupWithDirection extends BlockApiLookupWrapper { - - public BlockApiLookupWithDirection(BlockApiLookup<@NotNull A, net.minecraft.core.Direction> lookup) { - super(lookup); - } - - @Deprecated - public static BlockApiLookupWrapper of(BlockApiLookup<@NotNull A, C> lookup) { - return new BlockApiLookupWrapper<>(lookup); - } - - public static BlockApiLookupWithDirection ofDir(BlockApiLookup<@NotNull A, net.minecraft.core.Direction> lookup) { - return new BlockApiLookupWithDirection<>(lookup); - } - - public @Nullable A find(World world, BlockPos pos, Direction direction) { - return super.find(world, pos, direction.toMinecraft()); - } - - public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntity blockEntity, Direction direction) { - return super.find(world, pos, state, blockEntity, direction.toMinecraft()); - } - - public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntityWrapper blockEntity, Direction direction) { - return super.find(world, pos, state, blockEntity, direction.toMinecraft()); - } - - public void registerForBlockEntityM(BiFunction provider, BlockEntityType blockEntityType) { - super.registerForBlockEntity((blockEntity, direction) -> provider.apply(blockEntity, Direction.of(direction)), blockEntityType); - } - - @Deprecated - public void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { - super.registerForBlockEntity(provider, blockEntityType); - } - - public void registerForBlockEntityWrapperM(BiFunction provider, BlockEntityTypeWrapper blockEntityType) { - super.registerForBlockEntityWrapper((blockEntity, direction) -> provider.apply(blockEntity, Direction.of(direction)), blockEntityType); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java deleted file mode 100644 index fbdb36745..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/lookup/block/BlockApiLookupWrapper.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.pitan76.mcpitanlib.api.lookup.block; - -import net.fabricmc.fabric.api.lookup.v1.block.BlockApiLookup; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.pitan76.mcpitanlib.api.util.CompatIdentifier; -import net.pitan76.mcpitanlib.midohra.block.BlockState; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; -import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -import net.pitan76.mcpitanlib.midohra.world.World; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.function.BiFunction; - -public class BlockApiLookupWrapper { - - private final BlockApiLookup<@NotNull A, C> lookup; - - public BlockApiLookupWrapper(BlockApiLookup<@NotNull A, C> lookup) { - this.lookup = lookup; - } - - public BlockApiLookup<@NotNull A, C> getRaw() { - return lookup; - } - - public static BlockApiLookupWrapper of(BlockApiLookup<@NotNull A, C> lookup) { - return new BlockApiLookupWrapper<>(lookup); - } - - public @Nullable A find(World world, BlockPos pos, C context) { - return lookup.find(world.getRaw(), pos.toMinecraft(), context); - } - - public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntity blockEntity, C context) { - return lookup.find(world.getRaw(), pos.toMinecraft(), state.toMinecraft(), blockEntity, context); - } - - public @Nullable A find(World world, BlockPos pos, BlockState state, BlockEntityWrapper blockEntity, C context) { - return lookup.find(world.getRaw(), pos.toMinecraft(), state.toMinecraft(), blockEntity.get(), context); - } - - public void registerForBlockEntity(BiFunction provider, BlockEntityType blockEntityType) { - lookup.registerForBlockEntity(provider, blockEntityType); - } - - public void registerForBlockEntityWrapper(BiFunction provider, BlockEntityTypeWrapper blockEntityWrapperType) { - lookup.registerForBlockEntity((blockEntity, context) -> - provider.apply(BlockEntityWrapper.of(blockEntity), context), blockEntityWrapperType.get()); - } - - public CompatIdentifier getId() { - return CompatIdentifier.fromMinecraft(lookup.getId()); - } -} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java index 218a3756c..47e159cb4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java @@ -1,15 +1,12 @@ package net.pitan76.mcpitanlib.api.network; import io.netty.buffer.Unpooled; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.RegistryFriendlyByteBuf; -import net.minecraft.network.codec.StreamCodec; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.core.mc261.ClientPlayNetworking; import net.pitan76.mcpitanlib.core.network.BufPayload; import java.util.ArrayList; @@ -27,16 +24,7 @@ public static void registerReceiver(Identifier identifier, ClientNetworkHandler BufPayload.Type id = BufPayload.id(identifier); registerC2SPayloadType(identifier); - ClientPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { - FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); - - LocalPlayer player = null; - if (context.player() instanceof LocalPlayer) - player = context.player(); - - handler.receive(Minecraft.getInstance(), player, buf); - buf.release(); - }); + ClientPlayNetworking.registerGlobalReceiver(id, handler); } @FunctionalInterface @@ -50,7 +38,6 @@ public static void registerC2SPayloadType(Identifier identifier) { if (registeredList.contains(identifier)) return; registeredList.add(identifier); - BufPayload.Type id = BufPayload.id(identifier); - PayloadTypeRegistry.clientboundPlay().register(id, BufPayload.getCodec(id)); + ClientPlayNetworking.registerC2SPayloadType(identifier); } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java index e0f9fafd8..f832c691c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/WorldGenRegistry.java @@ -1,12 +1,6 @@ package net.pitan76.mcpitanlib.api.registry; -import net.fabricmc.fabric.api.biome.v1.BiomeModifications; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; -import net.minecraft.core.Holder; import net.minecraft.resources.Identifier; -import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java deleted file mode 100644 index 4a782142f..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.pitan76.mcpitanlib.api.tile; - -import net.fabricmc.fabric.api.blockgetter.v2.RenderDataBlockEntity; -import org.jetbrains.annotations.Nullable; - -public interface RenderAttachmentBlockEntity extends RenderDataBlockEntity { - - @Override - @Nullable - @Deprecated - default Object getRenderData() { - return getCompatRenderData(); - } - - default boolean hasCompatRenderData() { - return getCompatRenderData() != null; - } - - @Nullable - Object getCompatRenderData(); -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java index 35e4b9074..11f21fbb4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/ScreenHandlerUtil.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.api.util; -import net.fabricmc.fabric.api.menu.v1.ExtendedMenuProvider; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; @@ -14,6 +13,7 @@ import net.minecraft.core.NonNullList; import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; import org.jspecify.annotations.Nullable; import java.util.ArrayList; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ClientPlayNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ClientPlayNetworking.java new file mode 100644 index 000000000..823acbcd2 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ClientPlayNetworking.java @@ -0,0 +1,23 @@ +package net.pitan76.mcpitanlib.core.mc261; + +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.network.ClientNetworking; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +public class ClientPlayNetworking { + @ExpectPlatform + public static void send(CustomPacketPayload payload) { + } + + @ExpectPlatform + public static void registerGlobalReceiver(BufPayload.Type type, ClientNetworking.ClientNetworkHandler handler) { + + } + + @ExpectPlatform + public static void registerC2SPayloadType(Identifier identifier) { + + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ExtendedMenuProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ExtendedMenuProvider.java new file mode 100644 index 000000000..a3e5ea84a --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ExtendedMenuProvider.java @@ -0,0 +1,8 @@ +package net.pitan76.mcpitanlib.core.mc261; + +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.MenuProvider; + +public interface ExtendedMenuProvider extends MenuProvider { + D getScreenOpeningData(ServerPlayer player); +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java b/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java index 891659e48..46c550992 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/network/BufPayload.java @@ -5,7 +5,6 @@ import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type; import net.minecraft.resources.Identifier; import java.util.HashMap; diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/ItemTooltipRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/ItemTooltipRegistryImpl.java new file mode 100644 index 000000000..84edd2080 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/ItemTooltipRegistryImpl.java @@ -0,0 +1,12 @@ +package net.pitan76.mcpitanlib.api.client.event.fabric; + +import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; +import net.pitan76.mcpitanlib.api.client.event.listener.ItemTooltipListener; + +public class ItemTooltipRegistryImpl { + public static void registerItemTooltip(ItemTooltipListener listener) { + ItemTooltipCallback.EVENT.register(((stack, tooltipContext, type, texts) -> { + listener.onTooltip(stack, texts, tooltipContext, type); + })); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ClientPlayNetworkingImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ClientPlayNetworkingImpl.java new file mode 100644 index 000000000..9ef0e03bb --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ClientPlayNetworkingImpl.java @@ -0,0 +1,36 @@ +package net.pitan76.mcpitanlib.core.mc261.fabric; + +import io.netty.buffer.Unpooled; +import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; +import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.network.ClientNetworking; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +public class ClientPlayNetworkingImpl { + public static void send(CustomPacketPayload payload) { + ClientPlayNetworking.send(payload); + } + + public static void registerGlobalReceiver(BufPayload.Type type, ClientNetworking.ClientNetworkHandler handler) { + ClientPlayNetworking.registerGlobalReceiver(type, (payload, context) -> { + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); + + LocalPlayer player = null; + if (context.player() instanceof LocalPlayer) + player = context.player(); + + handler.receive(Minecraft.getInstance(), player, buf); + buf.release(); + }); + } + + public static void registerC2SPayloadType(Identifier identifier) { + BufPayload.Type id = BufPayload.id(identifier); + PayloadTypeRegistry.clientboundPlay().register(id, BufPayload.getCodec(id)); + } +} diff --git a/gradle.properties b/gradle.properties index fc0fb9a12..20084edf8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ legacyitemmodels_version=1.0.2.261 littleobffallback_version=0.3.5.261-SNAPSHOT fabricEnabled=true -neoforgeEnabled=false +neoforgeEnabled=true org.gradle.parallel=true org.gradle.workers.max=4 \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/ItemTooltipRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/ItemTooltipRegistryImpl.java new file mode 100644 index 000000000..a9b689eee --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/ItemTooltipRegistryImpl.java @@ -0,0 +1,23 @@ +package net.pitan76.mcpitanlib.api.client.event.neoforge; + +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent; +import net.pitan76.mcpitanlib.api.client.event.listener.ItemTooltipListener; + +import java.util.ArrayList; +import java.util.List; + +public class ItemTooltipRegistryImpl { + private static final List listeners = new ArrayList<>(); + + public static void registerItemTooltip(ItemTooltipListener listener) { + listeners.add(listener); + } + + @SubscribeEvent + public static void onItemTooltip(ItemTooltipEvent event) { + for (ItemTooltipListener listener : listeners) { + listener.onTooltip(event.getItemStack(), event.getToolTip(), event.getContext(), event.getFlags()); + } + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java new file mode 100644 index 000000000..5530aeee9 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java @@ -0,0 +1,53 @@ +package net.pitan76.mcpitanlib.core.mc261.neoforge; + +import io.netty.buffer.Unpooled; +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.neoforge.client.network.ClientPacketDistributor; +import net.neoforged.neoforge.client.network.event.RegisterClientPayloadHandlersEvent; +import net.neoforged.neoforge.network.handling.IPayloadHandler; +import net.pitan76.mcpitanlib.api.network.ClientNetworking; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +import java.util.HashMap; +import java.util.Map; + +public class ClientPlayNetworkingImpl { + public static void send(CustomPacketPayload payload) { + ClientPacketDistributor.sendToServer(payload); + } + + private static final Map, IPayloadHandler> handlerMap = new HashMap<>(); + + public static void registerGlobalReceiver(BufPayload.Type type, ClientNetworking.ClientNetworkHandler handler) { + handlerMap.put(type, (payload, context) -> { + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); + + LocalPlayer player = null; + if (context.player() instanceof LocalPlayer) + player = (LocalPlayer) context.player(); + + handler.receive(Minecraft.getInstance(), player, buf); + buf.release(); + }); + } + + private static final Map> payloadTypeMap = new HashMap<>(); + + public static void registerC2SPayloadType(Identifier identifier) { + BufPayload.Type id = BufPayload.id(identifier); +// PayloadTypeRegistry.clientboundPlay().register(id, BufPayload.getCodec(id)); + payloadTypeMap.put(identifier, id); + } + + @SubscribeEvent + public static void register(RegisterClientPayloadHandlersEvent event) { + for (Map.Entry, IPayloadHandler> entry : handlerMap.entrySet()) { + event.register(entry.getKey(), entry.getValue()); + } + } +} From 3f55b5922186e17c8ba2c125d71d6c0a3151d410 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 17:55:03 +0900 Subject: [PATCH 087/151] littleobffallback_version 0.3.6.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 20084edf8..8d71094eb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.5.261-SNAPSHOT +littleobffallback_version=0.3.6.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true From 53fa4c863a20d8426f399d09f4054c9b6ad38e12 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 22:04:27 +0900 Subject: [PATCH 088/151] bump littleobffallback_version to 0.3.7.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8d71094eb..ee616721a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.6.261-SNAPSHOT +littleobffallback_version=0.3.7.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true From 59545e81fd6557372365445988509b49107ac389 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 22:03:19 +0900 Subject: [PATCH 089/151] bump version 3.6.5 --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 9b7f358b0..eb9d90ac9 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.4 +mod_version=3.6.5 maven_group=net.pitan76 changelog=Update littleobffallback & add APIs From 9df2f67481158c2e7c2cfa12444def5b729c5243 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 22:12:21 +0900 Subject: [PATCH 090/151] feat: add wrappers for various projectile entities and enhance entity handling --- .../api/entity/CompatThrownItemEntity.java | 8 +++ .../midohra/block/BlockWrapper.java | 14 +++++ .../block/entity/BlockEntityWrapper.java | 31 ++++++++++ .../midohra/entity/EntityWrapper.java | 45 ++++++++++++++ .../entity/TypedEntityTypeWrapper.java | 22 +++++++ .../midohra/entity/TypedEntityWrapper.java | 22 +++++++ .../entity/projectile/ArrowEntityWrapper.java | 50 ++++++++++++++++ .../PersistentProjectileEntityWrapper.java | 35 +++++++++++ .../projectile/ProjectileEntityWrapper.java | 49 +++++++++++++++ .../SmallFireballEntityWrapper.java | 50 ++++++++++++++++ .../projectile/SnowballEntityWrapper.java | 58 ++++++++++++++++++ .../SpectralArrowEntityWrapper.java | 50 ++++++++++++++++ .../projectile/ThrownEntityWrapper.java | 22 +++++++ .../projectile/ThrownItemEntityWrapper.java | 60 +++++++++++++++++++ .../mcpitanlib/midohra/item/ItemWrapper.java | 14 +++++ .../midohra/registry/MidohraRegistry.java | 27 +++++++++ gradle.properties | 2 +- 17 files changed, 558 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ArrowEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/PersistentProjectileEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ProjectileEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SmallFireballEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SnowballEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SpectralArrowEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownEntityWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownItemEntityWrapper.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java index 41f1445ff..c90d34027 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java @@ -157,4 +157,12 @@ public void load(ValueInput view) { public Level level() { return super.level(); } + + public void setStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + callSetItem(stack.toMinecraft()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(callGetItem()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java index f2ab6b96c..ea1023c36 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -173,4 +173,18 @@ public boolean instanceOf(BlockWrapper wrapper) { Class clazz = block.getClass(); return clazz.isInstance(get()); } + + public T getCompatBlock(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof CompatBlock) { + CompatBlock compatBlock = (CompatBlock) get(); + if (clazz.isInstance(compatBlock)) + return clazz.cast(compatBlock); + } + return null; + } + + public Optional toCompatBlock(Class clazz) { + return Optional.ofNullable(getCompatBlock(clazz)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java index 15d773cdc..b0e6d25de 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java @@ -5,6 +5,7 @@ import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; +import net.pitan76.mcpitanlib.api.util.world.TickerUtil; import net.pitan76.mcpitanlib.midohra.block.BlockState; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.easybuilder.built.BuiltBlockEntity; @@ -157,4 +158,34 @@ public boolean instanceOf(BlockEntityWrapper wrapper) { Class clazz = blockEntity.getClass(); return clazz.isInstance(get()); } + + public T getCompatBlockEntity(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof CompatBlockEntity) { + CompatBlockEntity blockEntity = (CompatBlockEntity) get(); + if (clazz.isInstance(blockEntity)) + return clazz.cast(blockEntity); + } + return null; + } + + public Optional toCompatBlockEntity(Class clazz) { + return Optional.ofNullable(getCompatBlockEntity(clazz)); + } + + public void tick() { + TickerUtil.tick(get()); + } + + public int getX() { + return getPos().getX(); + } + + public int getY() { + return getPos().getY(); + } + + public int getZ() { + return getPos().getZ(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java index 96777b438..8ff27f939 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java @@ -374,4 +374,49 @@ public boolean instanceOf(EntityWrapper wrapper) { Class clazz = entity.getClass(); return clazz.isInstance(get()); } + + public SpawnGroup getSpawnGroup() { + return SpawnGroup.of(get().getType().getCategory()); + } + + public T getCompatEntity(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof CompatEntity) { + CompatEntity compatEntity = (CompatEntity) get(); + if (clazz.isInstance(compatEntity)) + return clazz.cast(compatEntity); + } + return null; + } + + public Optional toCompatEntity(Class clazz) { + return Optional.ofNullable(getCompatEntity(clazz)); + } + + public boolean isPlayerEntity() { + return get() instanceof net.minecraft.world.entity.player.Player; + } + + public Optional toPlayer() { + if (isPlayerEntity()) { + return Optional.of(new Player((net.minecraft.world.entity.player.Player) get())); + } + return Optional.empty(); + } + + public void tick() { + get().tick(); + } + + public double getX() { + return getPos().getX(); + } + + public double getY() { + return getPos().getY(); + } + + public double getZ() { + return getPos().getZ(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java index d2e44ad35..930f3f110 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java @@ -2,6 +2,11 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; +import org.jspecify.annotations.Nullable; + +import java.util.function.Consumer; public class TypedEntityTypeWrapper extends EntityTypeWrapper { protected TypedEntityTypeWrapper(EntityType type) { @@ -20,4 +25,21 @@ public static TypedEntityTypeWrapper of(EntityTypeWrapper public EntityType get() { return (EntityType) super.get(); } + + public TypedEntityWrapper createEntity(ServerWorld world, SpawnReason spawnReason) { + return TypedEntityWrapper.ofRaw(get().create(world.getRaw(), spawnReason.getRaw())); + } + + public TypedEntityWrapper createEntity(ServerWorld world) { + return createEntity(world, SpawnReason.NATURAL); + } + + public TypedEntityWrapper createTypedEntity(ServerWorld world, @Nullable Consumer> afterConsumer, BlockPos pos, SpawnReason reason, boolean alignPosition, boolean invertY) { + Consumer consumer = afterConsumer != null ? entity -> { + TypedEntityWrapper wrapper = TypedEntityWrapper.ofRaw(entity); + afterConsumer.accept(wrapper); + } : null; + + return TypedEntityWrapper.ofRaw(get().create(world.getRaw(), consumer, pos.toMinecraft(), reason.getRaw(), alignPosition, invertY)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityWrapper.java new file mode 100644 index 000000000..350b9b93c --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityWrapper.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.midohra.entity; + +import net.minecraft.world.entity.Entity; + +public class TypedEntityWrapper extends EntityWrapper { + protected TypedEntityWrapper(T entity) { + super(entity); + } + + public static TypedEntityWrapper ofRaw(T entity) { + return new TypedEntityWrapper<>(entity); + } + + public static TypedEntityWrapper of(EntityWrapper wrapper) { + return new TypedEntityWrapper<>((T) wrapper.get()); + } + + @Override + public T get() { + return (T) super.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ArrowEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ArrowEntityWrapper.java new file mode 100644 index 000000000..da7305c90 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ArrowEntityWrapper.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.arrow.Arrow; +import net.pitan76.mcpitanlib.api.util.entity.ArrowEntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class ArrowEntityWrapper extends PersistentProjectileEntityWrapper { + protected ArrowEntityWrapper(Arrow entity) { + super(entity); + } + + public static ArrowEntityWrapper ofRaw(Arrow entity) { + return new ArrowEntityWrapper(entity); + } + + public static ArrowEntityWrapper ofArrow(EntityWrapper wrapper) { + return new ArrowEntityWrapper((Arrow) wrapper.get()); + } + + public static boolean isArrow(EntityWrapper wrapper) { + return wrapper.get() instanceof Arrow; + } + + public static ArrowEntityWrapper create(World world, double x, double y, double z) { + return new ArrowEntityWrapper(ArrowEntityUtil.create(world.toMinecraft(), x, y, z)); + } + + public static ArrowEntityWrapper create(World world, Vector3d pos) { + return create(world, pos.x, pos.y, pos.z); + } + + public static ArrowEntityWrapper create(World world, double x, double y, double z, ItemStack stack) { + return new ArrowEntityWrapper(ArrowEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft())); + } + + public static ArrowEntityWrapper create(World world, Vector3d pos, ItemStack stack) { + return create(world, pos.x, pos.y, pos.z, stack); + } + + public void setVelocity(double x, double y, double z, float velocity, float divergence) { + ArrowEntityUtil.setVelocity(get(), x, y, z, velocity, divergence); + } + + public void setVelocity(Vector3d velocity, float speed, float uncertainty) { + setVelocity(velocity.x, velocity.y, velocity.z, speed, uncertainty); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/PersistentProjectileEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/PersistentProjectileEntityWrapper.java new file mode 100644 index 000000000..0b451546c --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/PersistentProjectileEntityWrapper.java @@ -0,0 +1,35 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.arrow.AbstractArrow; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; + +public class PersistentProjectileEntityWrapper extends ProjectileEntityWrapper { + protected PersistentProjectileEntityWrapper(T entity) { + super(entity); + } + + public static PersistentProjectileEntityWrapper ofRaw(T entity) { + return new PersistentProjectileEntityWrapper<>(entity); + } + + public static boolean isPersistentProjectile(EntityWrapper wrapper) { + return wrapper.get() instanceof AbstractArrow; + } + + public static PersistentProjectileEntityWrapper ofPersistentProjectile(EntityWrapper wrapper) { + return new PersistentProjectileEntityWrapper<>((T) wrapper.get()); + } + + public int getPierceLevel() { + return get().getPierceLevel(); + } + + public ItemStack getStack() { + return ItemStack.of(get().getWeaponItem()); + } + + public void setDamage(double damage) { + get().setBaseDamage(damage); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ProjectileEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ProjectileEntityWrapper.java new file mode 100644 index 000000000..232653f0f --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ProjectileEntityWrapper.java @@ -0,0 +1,49 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.Projectile; +import net.pitan76.mcpitanlib.api.util.entity.ProjectileEntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.entity.TypedEntityWrapper; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; + +public class ProjectileEntityWrapper extends TypedEntityWrapper { + protected ProjectileEntityWrapper(T entity) { + super(entity); + } + + public static ProjectileEntityWrapper ofRaw(T entity) { + return new ProjectileEntityWrapper<>(entity); + } + + public static ProjectileEntityWrapper ofProjectile(EntityWrapper wrapper) { + return new ProjectileEntityWrapper<>((T) wrapper.get()); + } + + public static boolean isProjectile(EntityWrapper wrapper) { + return wrapper.get() instanceof Projectile; + } + + public void setVelocity(EntityWrapper shooter, float pitch, float yaw, float roll, float speed, float divergence) { + ProjectileEntityUtil.setVelocity(get(), shooter.get(), pitch, yaw, roll, speed, divergence); + } + + public void setVelocity(double x, double y, double z, float power, float uncertainty) { + ProjectileEntityUtil.setVelocity(get(), x, y, z, power, uncertainty); + } + + public void setVelocity(Vector3d velocity, float power, float uncertainty) { + setVelocity(velocity.x, velocity.y, velocity.z, power, uncertainty); + } + + public void setOwner(EntityWrapper owner) { + get().setOwner(owner.get()); + } + + public boolean hasOwner() { + return get().getOwner() != null; + } + + public EntityWrapper getOwner() { + return EntityWrapper.of(get().getOwner()); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SmallFireballEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SmallFireballEntityWrapper.java new file mode 100644 index 000000000..9d1cfe17f --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SmallFireballEntityWrapper.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.hurtingprojectile.SmallFireball; +import net.pitan76.mcpitanlib.api.util.entity.SmallFireballEntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class SmallFireballEntityWrapper extends ProjectileEntityWrapper { + protected SmallFireballEntityWrapper(SmallFireball entity) { + super(entity); + } + + public static SmallFireballEntityWrapper ofRaw(SmallFireball entity) { + return new SmallFireballEntityWrapper(entity); + } + + public static SmallFireballEntityWrapper ofSmallFireball(EntityWrapper wrapper) { + return new SmallFireballEntityWrapper((SmallFireball) wrapper.get()); + } + + public static boolean isSmallFireball(EntityWrapper wrapper) { + return wrapper.get() instanceof SmallFireball; + } + + public static SmallFireballEntityWrapper create(World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { + return new SmallFireballEntityWrapper(SmallFireballEntityUtil.create(world.toMinecraft(), x, y, z, velocityX, velocityY, velocityZ)); + } + + public static SmallFireballEntityWrapper create(World world, Vector3d pos, Vector3d velocity) { + return create(world, pos.x, pos.y, pos.z, velocity.x, velocity.y, velocity.z); + } + + public void setStack(ItemStack stack) { + SmallFireballEntityUtil.setItem(get(), stack.toMinecraft()); + } + + public ItemStack getStack() { + return ItemStack.of(SmallFireballEntityUtil.getItem(get())); + } + + public void setVelocity(double x, double y, double z, float velocity, float divergence) { + SmallFireballEntityUtil.setVelocity(get(), x, y, z, velocity, divergence); + } + + public void setVelocity(Vector3d velocity, float speed, float uncertainty) { + setVelocity(velocity.x, velocity.y, velocity.z, speed, uncertainty); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SnowballEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SnowballEntityWrapper.java new file mode 100644 index 000000000..e5f791da0 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SnowballEntityWrapper.java @@ -0,0 +1,58 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.throwableitemprojectile.Snowball; +import net.pitan76.mcpitanlib.api.util.entity.SnowballEntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class SnowballEntityWrapper extends ThrownItemEntityWrapper { + protected SnowballEntityWrapper(Snowball entity) { + super(entity); + } + + public static SnowballEntityWrapper ofRaw(Snowball entity) { + return new SnowballEntityWrapper(entity); + } + + public static SnowballEntityWrapper ofSnowball(EntityWrapper wrapper) { + return new SnowballEntityWrapper((Snowball) wrapper.get()); + } + + public static boolean isSnowball(EntityWrapper wrapper) { + return wrapper.get() instanceof Snowball; + } + + public static SnowballEntityWrapper create(World world, double x, double y, double z) { + return new SnowballEntityWrapper(SnowballEntityUtil.create(world.toMinecraft(), x, y, z)); + } + + public static SnowballEntityWrapper create(World world, Vector3d pos) { + return create(world, pos.x, pos.y, pos.z); + } + + public static SnowballEntityWrapper create(World world, double x, double y, double z, ItemStack stack) { + return new SnowballEntityWrapper(SnowballEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft())); + } + + public static SnowballEntityWrapper create(World world, Vector3d pos, ItemStack stack) { + return create(world, pos.x, pos.y, pos.z, stack); + } + + public void setStack(ItemStack stack) { + SnowballEntityUtil.setItem(get(), stack.toMinecraft()); + } + + public ItemStack getStack() { + return ItemStack.of(SnowballEntityUtil.getItem(get())); + } + + public void setVelocity(double x, double y, double z, float velocity, float divergence) { + SnowballEntityUtil.setVelocity(get(), x, y, z, velocity, divergence); + } + + public void setVelocity(Vector3d velocity, float speed, float uncertainty) { + setVelocity(velocity.x, velocity.y, velocity.z, speed, uncertainty); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SpectralArrowEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SpectralArrowEntityWrapper.java new file mode 100644 index 000000000..f15f9b197 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/SpectralArrowEntityWrapper.java @@ -0,0 +1,50 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.arrow.SpectralArrow; +import net.pitan76.mcpitanlib.api.util.entity.SpectralArrowEntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; +import net.pitan76.mcpitanlib.midohra.world.World; + +public class SpectralArrowEntityWrapper extends PersistentProjectileEntityWrapper { + protected SpectralArrowEntityWrapper(SpectralArrow entity) { + super(entity); + } + + public static SpectralArrowEntityWrapper ofRaw(SpectralArrow entity) { + return new SpectralArrowEntityWrapper(entity); + } + + public static SpectralArrowEntityWrapper ofSpectralArrow(EntityWrapper wrapper) { + return new SpectralArrowEntityWrapper((SpectralArrow) wrapper.get()); + } + + public static boolean isSpectralArrow(EntityWrapper wrapper) { + return wrapper.get() instanceof SpectralArrow; + } + + public static SpectralArrowEntityWrapper create(World world, double x, double y, double z) { + return new SpectralArrowEntityWrapper(SpectralArrowEntityUtil.create(world.toMinecraft(), x, y, z)); + } + + public static SpectralArrowEntityWrapper create(World world, Vector3d pos) { + return create(world, pos.x, pos.y, pos.z); + } + + public static SpectralArrowEntityWrapper create(World world, double x, double y, double z, ItemStack stack) { + return new SpectralArrowEntityWrapper(SpectralArrowEntityUtil.create(world.toMinecraft(), x, y, z, stack.toMinecraft())); + } + + public static SpectralArrowEntityWrapper create(World world, Vector3d pos, ItemStack stack) { + return create(world, pos.x, pos.y, pos.z, stack); + } + + public void setVelocity(double x, double y, double z, float velocity, float divergence) { + SpectralArrowEntityUtil.setVelocity(get(), x, y, z, velocity, divergence); + } + + public void setVelocity(Vector3d velocity, float speed, float uncertainty) { + setVelocity(velocity.x, velocity.y, velocity.z, speed, uncertainty); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownEntityWrapper.java new file mode 100644 index 000000000..e80be1e2d --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownEntityWrapper.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.ThrowableProjectile; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; + +public class ThrownEntityWrapper extends ProjectileEntityWrapper { + protected ThrownEntityWrapper(T entity) { + super(entity); + } + + public static ThrownEntityWrapper ofRaw(T entity) { + return new ThrownEntityWrapper<>(entity); + } + + public static ThrownEntityWrapper ofThrown(EntityWrapper wrapper) { + return new ThrownEntityWrapper<>((T) wrapper.get()); + } + + public static boolean isThrown(EntityWrapper wrapper) { + return wrapper.get() instanceof ThrowableProjectile; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownItemEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownItemEntityWrapper.java new file mode 100644 index 000000000..a1ebd0ede --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/projectile/ThrownItemEntityWrapper.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.midohra.entity.projectile; + +import net.minecraft.world.entity.projectile.throwableitemprojectile.ThrowableItemProjectile; +import net.pitan76.mcpitanlib.api.entity.CompatThrownItemEntity; +import net.pitan76.mcpitanlib.api.util.entity.ThrownItemEntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; + +import java.util.Optional; + +public class ThrownItemEntityWrapper extends ThrownEntityWrapper { + protected ThrownItemEntityWrapper(T entity) { + super(entity); + } + + public static ThrownItemEntityWrapper ofRaw(T entity) { + return new ThrownItemEntityWrapper<>(entity); + } + + public static ThrownItemEntityWrapper ofThrownItem(EntityWrapper wrapper) { + return new ThrownItemEntityWrapper<>((T) wrapper.get()); + } + + public static boolean isThrownItem(EntityWrapper wrapper) { + return wrapper.get() instanceof ThrowableItemProjectile; + } + + public void setStack(ItemStack stack) { + ThrownItemEntityUtil.setItem(get(), stack.toMinecraft()); + } + + public ItemStack getStack() { + return ItemStack.of(ThrownItemEntityUtil.getItem(get())); + } + + public void setVelocity(double x, double y, double z, float velocity, float divergence) { + ThrownItemEntityUtil.setVelocity(get(), x, y, z, velocity, divergence); + } + + public void setVelocity(EntityWrapper shooter, float pitch, float yaw, float roll, float speed, float divergence) { + ThrownItemEntityUtil.setVelocity(get(), shooter.get(), pitch, yaw, roll, speed, divergence); + } + + public void setVelocity(Vector3d velocity, float speed, float uncertainty) { + setVelocity(velocity.x, velocity.y, velocity.z, speed, uncertainty); + } + + public boolean isCompatThrownItemEntity() { + return get() instanceof CompatThrownItemEntity; + } + + public Optional asCompatThrownItemEntity() { + if (isCompatThrownItemEntity()) { + return Optional.of((CompatThrownItemEntity) get()); + } else { + return Optional.empty(); + } + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java index fd938c2c3..1ef47f30d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java @@ -189,4 +189,18 @@ public boolean instanceOf(ItemWrapper wrapper) { Class clazz = item.getClass(); return clazz.isInstance(get()); } + + public T getCompatItem(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof CompatItem) { + CompatItem compatItem = (CompatItem) get(); + if (clazz.isInstance(compatItem)) + return clazz.cast(compatItem); + } + return null; + } + + public Optional toCompatItem(Class clazz) { + return Optional.ofNullable(getCompatItem(clazz)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java index 5e908ebc7..a8887d00f 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistry.java @@ -8,12 +8,15 @@ import net.pitan76.mcpitanlib.api.entity.CompatEntity; import net.pitan76.mcpitanlib.api.entity.EntityTypeBuilder; import net.pitan76.mcpitanlib.api.item.v2.CompatItem; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; import net.pitan76.mcpitanlib.midohra.block.SupplierTypedBlockWrapper; @@ -134,6 +137,30 @@ public TypedEntityTypeWrapper registerEntityType(Str return registerEntityType(fixId(id), builder); } + public ItemWrapper registerRawBlockItem(CompatIdentifier id, Supplier block, CompatibleItemSettings settings) { + return registerRawItem(id, () -> ItemUtil.create(block.get(), settings)); + } + + public ItemWrapper registerRawBlockItem(CompatIdentifier id, Supplier block, ItemSettingsBuilder builder) { + return registerRawBlockItem(id, block, builder.build(id)); + } + + public ItemWrapper registerBlockItem(CompatIdentifier id, BlockWrapper block, CompatibleItemSettings settings) { + return registerRawBlockItem(id, block::get, settings); + } + + public ItemWrapper registerBlockItem(CompatIdentifier id, BlockWrapper block, ItemSettingsBuilder builder) { + return registerBlockItem(id, block, builder.build(id)); + } + + public ItemWrapper registerBlockItem(String id, BlockWrapper block, CompatibleItemSettings settings) { + return registerBlockItem(fixId(id), block, settings); + } + + public ItemWrapper registerBlockItem(String id, BlockWrapper block, ItemSettingsBuilder builder) { + return registerBlockItem(fixId(id), block, builder); + } + /** * If the id doesn't contain a namespace, add the default namespace to it. * @param id The id to fix. diff --git a/gradle.properties b/gradle.properties index ee616721a..8d71094eb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.7.261-SNAPSHOT +littleobffallback_version=0.3.6.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true From a3c86bd8b777b70807963598dd4040897c6eb69a Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 22:12:42 +0900 Subject: [PATCH 091/151] littleobffallback_version=0.3.7.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8d71094eb..ee616721a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.6.261-SNAPSHOT +littleobffallback_version=0.3.7.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true From 1d5946c800bbe450f7d1f68fbb361c207ca2ad9a Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 11 Apr 2026 22:46:19 +0900 Subject: [PATCH 092/151] bump littleobffallback_version to 0.3.8.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ee616721a..5934c1802 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.7.261-SNAPSHOT +littleobffallback_version=0.3.8.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true From 3322bfbe33a1735664699ddb4c71f78b516fb0ae Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 12 Apr 2026 13:33:03 +0900 Subject: [PATCH 093/151] fix: update littleobffallback version to 0.3.9.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5934c1802..f3b955bef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.8.261-SNAPSHOT +littleobffallback_version=0.3.9.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true From 16b84bf6c3af896649f4dce7665ad7f8ca271c61 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 12 Apr 2026 23:08:06 +0900 Subject: [PATCH 094/151] fix: update getYaw and getPitch methods to use view rotation --- .../main/java/net/pitan76/mcpitanlib/api/entity/Player.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index c3a58abcf..6a1494036 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -279,11 +279,11 @@ public void heal(float amount) { } public float getYaw() { - return this.getEntity().getYRot(); + return this.getEntity().getViewYRot(0); } public float getPitch() { - return this.getEntity().getXRot(); + return this.getEntity().getXRot(0); } public void playSound(SoundEvent event, SoundSource category, float volume, float pitch) { From 4bd048ea425e406592c02952d8a14a248eb2394b Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 12 Apr 2026 23:12:08 +0900 Subject: [PATCH 095/151] fix: increment mod version to 3.6.5-fix.5 and update changelog --- .../net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java b/common/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java index 4c58dd2f2..89a1d2130 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/mixin/LevelRendererMixin.java @@ -1,25 +1,16 @@ package net.pitan76.mcpitanlib.mixin; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.mojang.blaze3d.buffers.GpuBufferSlice; -import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.WorldBorderRenderer; import net.minecraft.client.renderer.chunk.ChunkSectionsToRender; -import net.minecraft.client.renderer.culling.Frustum; import com.mojang.blaze3d.resource.GraphicsResourceAllocator; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.state.level.CameraRenderState; import net.minecraft.client.renderer.state.level.LevelRenderState; -import net.minecraft.client.renderer.state.level.WorldBorderRenderState; -import net.minecraft.world.phys.Vec3; -import net.minecraft.world.level.border.WorldBorder; import net.pitan76.mcpitanlib.api.client.event.WorldRenderRegistry; import net.pitan76.mcpitanlib.api.client.event.listener.*; import org.jetbrains.annotations.Nullable; From 635ab009ce5f1113cfc79807e12e0812cf37eadc Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 12 Apr 2026 23:15:01 +0900 Subject: [PATCH 096/151] fix: update littleobffallback version to 0.4.1.261-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f3b955bef..976cf57c3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.16.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 -littleobffallback_version=0.3.9.261-SNAPSHOT +littleobffallback_version=0.4.1.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true From 46556903e836d700c89adcd16ab59a630dff4eb2 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Fri, 17 Apr 2026 19:26:01 +0900 Subject: [PATCH 097/151] fix: update getPitch method to use view rotation --- .../src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index 6a1494036..4ee747e21 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -283,7 +283,7 @@ public float getYaw() { } public float getPitch() { - return this.getEntity().getXRot(0); + return this.getEntity().getViewXRot(0); } public void playSound(SoundEvent event, SoundSource category, float volume, float pitch) { From fa6b2375f35c48e510a21703c64c7bb3af6fc95e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Fri, 17 Apr 2026 21:11:40 +0900 Subject: [PATCH 098/151] fix: refactor builder methods to use ExpectPlatform annotation and implement new builder classes --- .../gui/ExtendedScreenHandlerTypeBuilder.java | 10 +++++-- .../api/item/CreativeTabBuilder.java | 18 ++++-------- .../api/tile/BlockEntityTypeBuilder.java | 8 +++-- .../ExtendedScreenHandlerTypeBuilderImpl.java | 12 ++++++++ .../item/fabric/CreativeTabBuilderImpl.java | 29 +++++++++++++++++++ .../fabric/BlockEntityTypeBuilderImpl.java | 3 +- .../ExtendedScreenHandlerTypeBuilderImpl.java | 12 ++++++++ .../item/neoforge/CreativeTabBuilderImpl.java | 28 ++++++++++++++++++ .../neoforge/BlockEntityTypeBuilderImpl.java | 6 ++-- 9 files changed, 104 insertions(+), 22 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/ExtendedScreenHandlerTypeBuilderImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/item/fabric/CreativeTabBuilderImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/ExtendedScreenHandlerTypeBuilderImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/item/neoforge/CreativeTabBuilderImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java index 0c07c0b38..a9a4562d3 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.gui; +import dev.architectury.injectables.annotations.ExpectPlatform; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; import io.netty.buffer.Unpooled; -import net.fabricmc.fabric.api.menu.v1.ExtendedMenuType; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.entity.player.Inventory; @@ -29,8 +29,12 @@ public ExtendedScreenHandlerTypeBuilder(Factory2 factory) { , (buf) -> ByteBufUtil.getBytes(buf.unwrap())); public MenuType build() { -// return MenuRegistry.ofExtended(factory::create); - return new ExtendedMenuType<>(factory::create, CODEC); + return build(factory); + } + + @ExpectPlatform + public static MenuType build(Factory factory) { + throw new AssertionError(); } @FunctionalInterface diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java index 505973982..8020af0cb 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.item; -import net.fabricmc.fabric.api.creativetab.v1.FabricCreativeModeTab; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.item.Item; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; @@ -82,18 +82,12 @@ public void setTexture(String texture) { * @return ItemGroup */ public CreativeModeTab build() { - CreativeModeTab.Builder builder = FabricCreativeModeTab.builder(); - - if (displayName != null) builder.title(displayName); - else builder.title(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); - - if (iconSupplier != null) builder.icon(iconSupplier); - if (noRenderedName) builder.hideTitle(); - if (noScrollbar) builder.noScrollBar(); - if (special) builder.alignedRight(); - if (texture != null) builder.backgroundTexture(IdentifierUtil.id(texture)); + return build(identifier, displayName, iconSupplier, noRenderedName, noScrollbar, special, texture); + } - return builder.build(); + @ExpectPlatform + public static CreativeModeTab build(Identifier identifier, Component displayName, Supplier iconSupplier, boolean noRenderedName, boolean noScrollbar, boolean special, String texture) { + throw new AssertionError(); } @SuppressWarnings("deprecation") diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java index 7b895bf8a..38dbddc79 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/BlockEntityTypeBuilder.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.tile; import com.mojang.datafixers.types.Type; -import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; @@ -49,9 +49,11 @@ public BlockEntityType build(Type type) { } @Deprecated + @ExpectPlatform public static BlockEntityType build(Type type, BlockEntityTypeBuilder.Factory factory, Block... blocks) { - FabricBlockEntityTypeBuilder builder = FabricBlockEntityTypeBuilder.create(factory::create, blocks); - return builder.build(type); +// FabricBlockEntityTypeBuilder builder = FabricBlockEntityTypeBuilder.create(factory::create, blocks); +// return builder.build(type); + throw new AssertionError(); } @FunctionalInterface diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/ExtendedScreenHandlerTypeBuilderImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/ExtendedScreenHandlerTypeBuilderImpl.java new file mode 100644 index 000000000..967ffa3ba --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/ExtendedScreenHandlerTypeBuilderImpl.java @@ -0,0 +1,12 @@ +package net.pitan76.mcpitanlib.api.gui.fabric; + +import net.fabricmc.fabric.api.menu.v1.ExtendedMenuType; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; + +public class ExtendedScreenHandlerTypeBuilderImpl { + public static MenuType build(ExtendedScreenHandlerTypeBuilder.Factory factory) { + return new ExtendedMenuType<>(factory::create, ExtendedScreenHandlerTypeBuilder.CODEC); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/item/fabric/CreativeTabBuilderImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/item/fabric/CreativeTabBuilderImpl.java new file mode 100644 index 000000000..2fd7e3767 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/item/fabric/CreativeTabBuilderImpl.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.api.item.fabric; + +import net.fabricmc.fabric.api.creativetab.v1.FabricCreativeModeTab; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +import java.util.function.Supplier; + +public class CreativeTabBuilderImpl { + + public static CreativeModeTab build(Identifier identifier, Component displayName, Supplier iconSupplier, boolean noRenderedName, boolean noScrollbar, boolean special, String texture) { + CreativeModeTab.Builder builder = FabricCreativeModeTab.builder(); + + if (displayName != null) builder.title(displayName); + else builder.title(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); + + if (iconSupplier != null) builder.icon(iconSupplier); + if (noRenderedName) builder.hideTitle(); + if (noScrollbar) builder.noScrollBar(); + if (special) builder.alignedRight(); + if (texture != null) builder.backgroundTexture(IdentifierUtil.id(texture)); + + return builder.build(); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java index bde486871..f0e546dd4 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/BlockEntityTypeBuilderImpl.java @@ -2,8 +2,9 @@ import com.mojang.datafixers.types.Type; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; -import net.minecraft.block.Block; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; public class BlockEntityTypeBuilderImpl { diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/ExtendedScreenHandlerTypeBuilderImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/ExtendedScreenHandlerTypeBuilderImpl.java new file mode 100644 index 000000000..d9051124d --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/ExtendedScreenHandlerTypeBuilderImpl.java @@ -0,0 +1,12 @@ +package net.pitan76.mcpitanlib.api.gui.neoforge; + +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.neoforged.neoforge.common.extensions.IMenuTypeExtension; +import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; + +public class ExtendedScreenHandlerTypeBuilderImpl { + public static MenuType build(ExtendedScreenHandlerTypeBuilder.Factory factory) { + return IMenuTypeExtension.create(factory::create); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/item/neoforge/CreativeTabBuilderImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/item/neoforge/CreativeTabBuilderImpl.java new file mode 100644 index 000000000..e5a100d9a --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/item/neoforge/CreativeTabBuilderImpl.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.api.item.neoforge; + +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.pitan76.mcpitanlib.api.util.IdentifierUtil; +import net.pitan76.mcpitanlib.api.util.TextUtil; + +import java.util.function.Supplier; + +public class CreativeTabBuilderImpl { + + public static CreativeModeTab build(Identifier identifier, Component displayName, Supplier iconSupplier, boolean noRenderedName, boolean noScrollbar, boolean special, String texture) { + CreativeModeTab.Builder builder = CreativeModeTab.builder(); + + if (displayName != null) builder.title(displayName); + else builder.title(TextUtil.translatable("itemGroup." + identifier.getNamespace() + "." + identifier.getPath())); + + if (iconSupplier != null) builder.icon(iconSupplier); + if (noRenderedName) builder.hideTitle(); + if (noScrollbar) builder.noScrollBar(); + if (special) builder.alignedRight(); + if (texture != null) builder.backgroundTexture(IdentifierUtil.id(texture)); + + return builder.build(); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java index 1d132e365..dee8dcf0c 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/tile/neoforge/BlockEntityTypeBuilderImpl.java @@ -1,9 +1,9 @@ package net.pitan76.mcpitanlib.api.tile.neoforge; import com.mojang.datafixers.types.Type; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; public class BlockEntityTypeBuilderImpl { From 25af015550f785980961cc95e3ab6b8e5fb967b6 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:08:44 +0900 Subject: [PATCH 099/151] fix: update fluid and event handling classes to use new imports and annotations --- .../event/v0/InteractionEventRegistry.java | 30 +++--- .../gui/SimpleScreenHandlerTypeBuilder.java | 9 +- .../fabric/InteractionEventRegistryImpl.java | 42 +++++++++ .../SimpleScreenHandlerTypeBuilderImpl.java | 12 +++ .../fluid/v1/fabric/FabricFluidVariant.java | 2 +- .../fluid/v1/fabric/FluidStorageUtilImpl.java | 2 +- .../InteractionEventRegistryImpl.java | 93 +++++++++++++++++++ .../SimpleScreenHandlerTypeBuilderImpl.java | 12 +++ .../v1/neoforge/FluidStorageUtilImpl.java | 2 +- .../v1/neoforge/NeoForgeFluidVariant.java | 2 +- .../neoforge/ClientPlayNetworkingImpl.java | 2 + 11 files changed, 184 insertions(+), 24 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/InteractionEventRegistryImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/SimpleScreenHandlerTypeBuilderImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/InteractionEventRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/SimpleScreenHandlerTypeBuilderImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java index e4f1d49e5..1bf7e6e9c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/InteractionEventRegistry.java @@ -1,11 +1,6 @@ package net.pitan76.mcpitanlib.api.event.v0; -import net.fabricmc.fabric.api.event.client.player.ClientPlayerBlockBreakEvents; -import net.fabricmc.fabric.api.event.client.player.ClientPreAttackCallback; -import net.fabricmc.fabric.api.event.player.AttackBlockCallback; -import net.fabricmc.fabric.api.event.player.UseBlockCallback; -import net.fabricmc.fabric.api.event.player.UseEntityCallback; -import net.fabricmc.fabric.api.event.player.UseItemCallback; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionHand; @@ -15,34 +10,33 @@ import net.pitan76.mcpitanlib.api.util.CompatActionResult; public class InteractionEventRegistry { + @ExpectPlatform public static void registerRightClickBlock(RightClickBlock rightClickBlock) { - UseBlockCallback.EVENT.register((player, world, hand, result) -> rightClickBlock.click(new ClickBlockEvent(player, hand, result.getBlockPos(), result.getDirection())).toActionResult()); } + @ExpectPlatform public static void registerLeftClickBlock(LeftClickBlock leftClickBlock) { - AttackBlockCallback.EVENT.register((player, world, hand, pos, dir) -> leftClickBlock.click(new ClickBlockEvent(player, hand, pos, dir)).toActionResult()); + } + @ExpectPlatform public static void registerRightClickItem(RightClickItem rightClickItem) { - UseItemCallback.EVENT.register((player, _, hand) - -> rightClickItem.click2(player, hand)); + } + @ExpectPlatform public static void registerClientLeftClickAir(ClientLeftClickAir clientLeftClickAir) { - ClientPreAttackCallback.EVENT.register((_, player, _) -> { - clientLeftClickAir.click(player, player.getUsedItemHand()); - return false; - }); + } + @ExpectPlatform public static void registerClientRightClickAir(ClientRightClickAir clientRightClickAir) { - ClientPlayerBlockBreakEvents.AFTER.register((_, player, _, _) - -> clientRightClickAir.click(player, player.getUsedItemHand())); + } + @ExpectPlatform public static void registerInteractEntity(InteractEntity interactEntity) { - UseEntityCallback.EVENT.register((player, _, hand, entity, _) - -> interactEntity.interact(player, entity, hand)); + } // ---- diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java index d50054a17..c4e340f3c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.gui; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; @@ -19,7 +19,12 @@ public SimpleScreenHandlerTypeBuilder(Factory2 factory) { } public MenuType build() { - return new MenuType<>(factory::create, FeatureFlags.VANILLA_SET); + return build(factory); + } + + @ExpectPlatform + public static MenuType build(Factory factory) { + throw new AssertionError(); } @FunctionalInterface diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/InteractionEventRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/InteractionEventRegistryImpl.java new file mode 100644 index 000000000..fa79404fc --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/InteractionEventRegistryImpl.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.api.event.v0.fabric; + +import net.fabricmc.fabric.api.event.client.player.ClientPlayerBlockBreakEvents; +import net.fabricmc.fabric.api.event.client.player.ClientPreAttackCallback; +import net.fabricmc.fabric.api.event.player.AttackBlockCallback; +import net.fabricmc.fabric.api.event.player.UseBlockCallback; +import net.fabricmc.fabric.api.event.player.UseEntityCallback; +import net.fabricmc.fabric.api.event.player.UseItemCallback; +import net.pitan76.mcpitanlib.api.event.v0.InteractionEventRegistry.*; +import net.pitan76.mcpitanlib.api.event.v0.event.ClickBlockEvent; + +public class InteractionEventRegistryImpl { + public static void registerRightClickBlock(RightClickBlock rightClickBlock) { + UseBlockCallback.EVENT.register((player, world, hand, result) -> rightClickBlock.click(new ClickBlockEvent(player, hand, result.getBlockPos(), result.getDirection())).toActionResult()); + } + + public static void registerLeftClickBlock(LeftClickBlock leftClickBlock) { + AttackBlockCallback.EVENT.register((player, world, hand, pos, dir) -> leftClickBlock.click(new ClickBlockEvent(player, hand, pos, dir)).toActionResult()); + } + + public static void registerRightClickItem(RightClickItem rightClickItem) { + UseItemCallback.EVENT.register((player, _, hand) + -> rightClickItem.click2(player, hand)); + } + + public static void registerClientLeftClickAir(ClientLeftClickAir clientLeftClickAir) { + ClientPreAttackCallback.EVENT.register((_, player, _) -> { + clientLeftClickAir.click(player, player.getUsedItemHand()); + return false; + }); + } + + public static void registerClientRightClickAir(ClientRightClickAir clientRightClickAir) { + ClientPlayerBlockBreakEvents.AFTER.register((_, player, _, _) + -> clientRightClickAir.click(player, player.getUsedItemHand())); + } + + public static void registerInteractEntity(InteractEntity interactEntity) { + UseEntityCallback.EVENT.register((player, _, hand, entity, _) + -> interactEntity.interact(player, entity, hand)); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/SimpleScreenHandlerTypeBuilderImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/SimpleScreenHandlerTypeBuilderImpl.java new file mode 100644 index 000000000..044c96ebb --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/gui/fabric/SimpleScreenHandlerTypeBuilderImpl.java @@ -0,0 +1,12 @@ +package net.pitan76.mcpitanlib.api.gui.fabric; + +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; + +public class SimpleScreenHandlerTypeBuilderImpl { + public static MenuType build(SimpleScreenHandlerTypeBuilder.Factory factory) { + return new MenuType<>(factory::create, FeatureFlags.VANILLA_SET); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidVariant.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidVariant.java index fe003ced9..ea29c5b71 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidVariant.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidVariant.java @@ -1,7 +1,7 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1.fabric; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.material.Fluid; import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; public class FabricFluidVariant implements IFluidVariant { diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FluidStorageUtilImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FluidStorageUtilImpl.java index c5d494ab7..ae5b9ae98 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FluidStorageUtilImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FluidStorageUtilImpl.java @@ -2,7 +2,7 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.material.Fluid; import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/InteractionEventRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/InteractionEventRegistryImpl.java new file mode 100644 index 000000000..c53ba09df --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/InteractionEventRegistryImpl.java @@ -0,0 +1,93 @@ +package net.pitan76.mcpitanlib.api.event.v0.neoforge; + +import net.pitan76.mcpitanlib.api.event.result.EventResult; +import net.pitan76.mcpitanlib.api.event.v0.InteractionEventRegistry.*; +import net.pitan76.mcpitanlib.api.event.v0.event.ClickBlockEvent; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib") +public class InteractionEventRegistryImpl { + + private static final List rightClickBlockListeners = new ArrayList<>(); + private static final List leftClickBlockListeners = new ArrayList<>(); + private static final List rightClickItemListeners = new ArrayList<>(); + private static final List clientLeftClickAirListeners = new ArrayList<>(); + private static final List clientRightClickAirListeners = new ArrayList<>(); + private static final List interactEntityListeners = new ArrayList<>(); + + public static void registerRightClickBlock(RightClickBlock rightClickBlock) { + rightClickBlockListeners.add(rightClickBlock); + } + + public static void registerLeftClickBlock(LeftClickBlock leftClickBlock) { + leftClickBlockListeners.add(leftClickBlock); + } + + public static void registerRightClickItem(RightClickItem rightClickItem) { + rightClickItemListeners.add(rightClickItem); + } + + public static void registerClientLeftClickAir(ClientLeftClickAir clientLeftClickAir) { + clientLeftClickAirListeners.add(clientLeftClickAir); + } + + public static void registerClientRightClickAir(ClientRightClickAir clientRightClickAir) { + clientRightClickAirListeners.add(clientRightClickAir); + } + + public static void registerInteractEntity(InteractEntity interactEntity) { + interactEntityListeners.add(interactEntity); + } + + @SubscribeEvent + public static void onRightClickBlock(PlayerInteractEvent.RightClickBlock event) { + for (RightClickBlock listener : rightClickBlockListeners) { + EventResult result = listener.click(new ClickBlockEvent(event.getEntity(), event.getHand(), event.getPos(), event.getFace())); + if (result != EventResult.pass()) { + event.setCanceled(true); + event.setCancellationResult(result.toActionResult()); + return; + } + } + } + + @SubscribeEvent + public static void onLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) { + for (LeftClickBlock listener : leftClickBlockListeners) { + listener.click(new ClickBlockEvent(event.getEntity(), event.getHand(), event.getPos(), event.getFace())); + } + } + + @SubscribeEvent + public static void onRightClickItem(PlayerInteractEvent.RightClickItem event) { + for (RightClickItem listener : rightClickItemListeners) { + listener.click2(event.getEntity(), event.getHand()); + } + } + + @SubscribeEvent + public static void onClientLeftClickAir(PlayerInteractEvent.LeftClickEmpty event) { + for (ClientLeftClickAir listener : clientLeftClickAirListeners) { + listener.click(event.getEntity(), event.getHand()); + } + } + + @SubscribeEvent + public static void onClientRightClickAir(PlayerInteractEvent.RightClickEmpty event) { + for (ClientRightClickAir listener : clientRightClickAirListeners) { + listener.click(event.getEntity(), event.getHand()); + } + } + + @SubscribeEvent + public static void onInteractEntity(PlayerInteractEvent.EntityInteract event) { + for (InteractEntity listener : interactEntityListeners) { + listener.interact(event.getEntity(), event.getTarget(), event.getHand()); + } + } +} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/SimpleScreenHandlerTypeBuilderImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/SimpleScreenHandlerTypeBuilderImpl.java new file mode 100644 index 000000000..6024ef5f0 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/gui/neoforge/SimpleScreenHandlerTypeBuilderImpl.java @@ -0,0 +1,12 @@ +package net.pitan76.mcpitanlib.api.gui.neoforge; + +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; + +public class SimpleScreenHandlerTypeBuilderImpl { + public static MenuType build(SimpleScreenHandlerTypeBuilder.Factory factory) { + return new MenuType<>(factory::create, FeatureFlags.VANILLA_SET); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java index 594c27330..ef0526a30 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/FluidStorageUtilImpl.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.material.Fluid; import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.transfer.fluid.FluidStacksResourceHandler; import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidStorage; diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java index 8c5e0a995..51a988b03 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/neoforge/NeoForgeFluidVariant.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1.neoforge; -import net.minecraft.fluid.Fluid; +import net.minecraft.world.level.material.Fluid; import net.neoforged.neoforge.fluids.FluidStack; import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java index 5530aeee9..55871a0e2 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java @@ -7,6 +7,7 @@ import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.Identifier; import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.client.network.ClientPacketDistributor; import net.neoforged.neoforge.client.network.event.RegisterClientPayloadHandlersEvent; import net.neoforged.neoforge.network.handling.IPayloadHandler; @@ -16,6 +17,7 @@ import java.util.HashMap; import java.util.Map; +@EventBusSubscriber(modid = "mcpitanlib") public class ClientPlayNetworkingImpl { public static void send(CustomPacketPayload payload) { ClientPacketDistributor.sendToServer(payload); From 8c5641b4c3f7115f47e768e171a5df7aa5777f83 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:24:34 +0900 Subject: [PATCH 100/151] fix: refactor registry client methods to use ExpectPlatform annotation and implement event-based registration --- .../client/registry/CompatRegistryClient.java | 67 +++------- .../client/registry/KeybindingRegistry.java | 5 +- .../fabric/CompatRegistryClientImpl.java | 102 +++++++++++++-- .../fabric/KeybindingRegistryImpl.java | 10 ++ .../neoforge/CompatRegistryClientImpl.java | 123 ++++++++++++++++-- .../neoforge/KeybindingRegistryImpl.java | 27 ++++ 6 files changed, 260 insertions(+), 74 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/KeybindingRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java index 2c68c6f32..c208bd14e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java @@ -1,16 +1,10 @@ package net.pitan76.mcpitanlib.api.client.registry; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.particle.v1.ParticleProviderRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.BlockColorRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.ModelLayerRegistry; import net.minecraft.client.color.block.BlockTintSource; -import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.renderer.block.BlockModelResolver; -import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; -import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.resources.model.sprite.SpriteGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; @@ -20,7 +14,6 @@ import net.minecraft.client.gui.screens.inventory.MenuAccess; import net.minecraft.client.renderer.item.ItemModelResolver; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.particle.ParticleProvider; import net.minecraft.client.particle.SpriteSet; import net.minecraft.client.renderer.chunk.ChunkSectionLayer; @@ -46,7 +39,6 @@ import net.minecraft.world.inventory.MenuType; import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; -import net.minecraft.util.RandomSource; import net.pitan76.mcpitanlib.MCPitanLib; import net.pitan76.mcpitanlib.api.client.color.CompatBlockColorProvider; import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; @@ -61,53 +53,33 @@ public static registerScreen(MCPitanLib.MOD_ID, type, factory); } + @ExpectPlatform public static > void registerScreen(String modId, MenuType type, ScreenFactory factory) { - MenuScreens.register(type, factory::create); + throw new AssertionError(); } public interface ScreenFactory> { S create(H handler, Inventory inventory, Component text); } + @ExpectPlatform public static void registerParticle(ParticleType type, ParticleProvider factory) { - ParticleProviderRegistry.getInstance().register(type, factory); + throw new AssertionError(); } + @ExpectPlatform public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { - ParticleProviderRegistry.getInstance().register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { - @Override - public TextureAtlas getAtlas() { - return spriteSet.getAtlas(); - } - - @Override - public List getSprites() { - return spriteSet.getSprites(); - } - - @Override - public TextureAtlasSprite get(int age, int maxAge) { - return spriteSet.get(age, maxAge); - } - - @Override - public TextureAtlasSprite get(RandomSource random) { - return spriteSet.get(random); - } - - @Override - public TextureAtlasSprite first() { - return spriteSet.first(); - } - })); + throw new AssertionError(); } + @ExpectPlatform public static void registerEntityModelLayer(ModelLayerLocation layer, EntityModelLayerContext context) { - ModelLayerRegistry.registerModelLayer(layer, () -> LayerDefinition.create(context.getData(), context.getWidth(), context.getHeight())); + throw new AssertionError(); } + @ExpectPlatform public static void registerEntityRenderer(Supplier> type, EntityRendererProvider provider) { - EntityRenderers.register(type.get(), provider); + throw new AssertionError(); } @FunctionalInterface @@ -137,10 +109,9 @@ public static void registryClientSprite(Identifier atlasId, TextureAtlasSprite s // ~1.19.2 } + @ExpectPlatform public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRenderers.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache() - ))); + throw new AssertionError(); } @FunctionalInterface @@ -242,10 +213,9 @@ public static void registerCutoutBlock(Block block) { registerRenderTypeBlock(RenderTypes.cutoutMovingBlock(), block); } + @ExpectPlatform public static void registerCompatBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRendererRegistry.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache() - ))); + } public static void registerRenderTypeBlock(CompatRenderLayer layer, Block block) { @@ -256,12 +226,9 @@ public static void registerRenderTypeFluid(CompatRenderLayer layer, Fluid fluid) registerRenderTypeFluid(layer.layer, fluid); } + @ExpectPlatform public static void registerColorProviderBlock(List provider, Block... blocks) { - if (blocks == null || blocks.length == 0) { - BlockColorRegistry.register(provider); - } else { - BlockColorRegistry.register(provider, blocks); - } + throw new AssertionError(); } public static void registerColorProviderBlock(CompatBlockColorProvider provider, Block... blocks) { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java index 7b43db57d..dca6d41e1 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/KeybindingRegistry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.client.registry; -import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.client.KeyMapping; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; @@ -8,8 +8,9 @@ import net.pitan76.mcpitanlib.api.network.PacketByteUtil; public class KeybindingRegistry { + @ExpectPlatform public static void register(KeyMapping keyBinding) { - KeyMappingHelper.registerKeyMapping(keyBinding); + } public static void register(KeyMapping keyBinding, ClientTickEventRegistry.Client client) { diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java index 15de7ac95..9173f1121 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/CompatRegistryClientImpl.java @@ -1,25 +1,101 @@ package net.pitan76.mcpitanlib.api.client.registry.fabric; -import dev.architectury.registry.client.gui.MenuScreenRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; -import net.minecraft.block.Block; -import net.minecraft.client.color.block.BlockColorProvider; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; +import net.fabricmc.fabric.api.client.particle.v1.ParticleProviderRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.BlockColorRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.ModelLayerRegistry; +import net.minecraft.client.color.block.BlockTintSource; +import net.minecraft.client.gui.screens.MenuScreens; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.MenuAccess; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.EntityRenderers; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.api.client.render.EntityModelLayerContext; + +import java.util.List; +import java.util.function.Supplier; public class CompatRegistryClientImpl { - public static > void registerScreen(String modId, ScreenHandlerType type, CompatRegistryClient.ScreenFactory factory) { - MenuScreenRegistry.registerScreenFactory(type, factory::create); + public static > void registerScreen(String modId, MenuType type, CompatRegistryClient.ScreenFactory factory) { + MenuScreens.register(type, factory::create); + } + + public static void registerParticle(ParticleType type, ParticleProvider factory) { + ParticleProviderRegistry.getInstance().register(type, factory); + } + + public static void registerParticle(ParticleType type, CompatRegistryClient.DeferredParticleProvider provider) { + ParticleProviderRegistry.getInstance().register(type, spriteSet -> provider.create(new CompatRegistryClient.ExtendedSpriteSet() { + @Override + public TextureAtlas getAtlas() { + return spriteSet.getAtlas(); + } + + @Override + public List getSprites() { + return spriteSet.getSprites(); + } + + @Override + public TextureAtlasSprite get(int age, int maxAge) { + return spriteSet.get(age, maxAge); + } + + @Override + public TextureAtlasSprite get(RandomSource random) { + return spriteSet.get(random); + } + + @Override + public TextureAtlasSprite first() { + return spriteSet.first(); + } + })); + } + + public static void registerEntityModelLayer(ModelLayerLocation layer, EntityModelLayerContext context) { + ModelLayerRegistry.registerModelLayer(layer, () -> LayerDefinition.create(context.getData(), context.getWidth(), context.getHeight())); + } + + public static void registerEntityRenderer(Supplier> type, EntityRendererProvider provider) { + EntityRenderers.register(type.get(), provider); + } + + public static void registerBlockEntityRenderer(BlockEntityType type, CompatRegistryClient.BlockEntityRendererFactory provider) { + BlockEntityRenderers.register(type, ctx -> provider.create(new CompatRegistryClient.BlockEntityRendererFactory.Context( + ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache() + ))); + } + + public static void registerCompatBlockEntityRenderer(BlockEntityType type, CompatRegistryClient.BlockEntityRendererFactory provider) { + BlockEntityRendererRegistry.register(type, ctx -> provider.create(new CompatRegistryClient.BlockEntityRendererFactory.Context( + ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache() + ))); } - public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { + public static void registerColorProviderBlock(List provider, Block... blocks) { if (blocks == null || blocks.length == 0) { - ColorProviderRegistry.BLOCK.register(provider); + BlockColorRegistry.register(provider); } else { - ColorProviderRegistry.BLOCK.register(provider, blocks); + BlockColorRegistry.register(provider, blocks); } } } diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/KeybindingRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/KeybindingRegistryImpl.java new file mode 100644 index 000000000..c4be00558 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/registry/fabric/KeybindingRegistryImpl.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.client.registry.fabric; + +import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper; +import net.minecraft.client.KeyMapping; + +public class KeybindingRegistryImpl { + public static void register(KeyMapping keyBinding) { + KeyMappingHelper.registerKeyMapping(keyBinding); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java index a639bf61e..1a9f9c5e1 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java @@ -1,25 +1,130 @@ package net.pitan76.mcpitanlib.api.client.registry.neoforge; -import net.minecraft.block.Block; -import net.minecraft.client.color.block.BlockColorProvider; +import net.minecraft.client.color.block.BlockTintSource; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.MenuAccess; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.particle.ParticleProvider; +import net.minecraft.client.renderer.blockentity.state.BlockEntityRenderState; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; +import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; +import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent; +import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.api.client.render.EntityModelLayerContext; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import java.util.function.Consumer; +import java.util.function.Supplier; +@EventBusSubscriber(modid = "mcpitanlib", value = Dist.CLIENT) public class CompatRegistryClientImpl { + // ジェネリクス地獄を避けるため、「イベントが来たら実行する処理」をそのままListに溜め込みます + private static final List> screenRegistrations = new ArrayList<>(); + private static final List> particleRegistrations = new ArrayList<>(); + private static final List> layerRegistrations = new ArrayList<>(); + private static final List> rendererRegistrations = new ArrayList<>(); - public static Map blockColorProviders = new HashMap<>(); + public static Map, Block[]> blockColorProviders = new HashMap<>(); - public static void registerColorProviderBlock(BlockColorProvider provider, Block... blocks) { + // --- 登録メソッド(Listへの追加処理に変更) --- + + public static > void registerScreen(String modId, MenuType type, CompatRegistryClient.ScreenFactory factory) { + screenRegistrations.add(event -> event.register(type, factory::create)); + } + + public static void registerParticle(ParticleType type, ParticleProvider factory) { + particleRegistrations.add(event -> event.registerSpecial(type, factory)); + } + + public static void registerParticle(ParticleType type, CompatRegistryClient.DeferredParticleProvider provider) { + particleRegistrations.add(event -> event.registerSpriteSet(type, spriteSet -> provider.create(new CompatRegistryClient.ExtendedSpriteSet() { + @Override + public TextureAtlas getAtlas() { return null; } + @Override + public List getSprites() { return Collections.emptyList(); } + @Override + public TextureAtlasSprite get(int age, int maxAge) { return spriteSet.get(age, maxAge); } + @Override + public TextureAtlasSprite get(RandomSource random) { return spriteSet.get(random); } + @Override + public TextureAtlasSprite first() { return spriteSet.first(); } + }))); + } + + public static void registerEntityModelLayer(ModelLayerLocation layer, EntityModelLayerContext context) { + layerRegistrations.add(event -> event.registerLayerDefinition(layer, () -> LayerDefinition.create(context.getData(), context.getWidth(), context.getHeight()))); + } + + public static void registerEntityRenderer(Supplier> type, EntityRendererProvider provider) { + rendererRegistrations.add(event -> event.registerEntityRenderer(type.get(), provider)); + } + + public static void registerBlockEntityRenderer(BlockEntityType type, CompatRegistryClient.BlockEntityRendererFactory provider) { + rendererRegistrations.add(event -> event.registerBlockEntityRenderer(type, ctx -> provider.create(new CompatRegistryClient.BlockEntityRendererFactory.Context( + ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font(), ctx.sprites(), ctx.playerSkinRenderCache() + )))); + } + + public static void registerCompatBlockEntityRenderer(BlockEntityType type, CompatRegistryClient.BlockEntityRendererFactory provider) { + registerBlockEntityRenderer(type, provider); // 上と同じ処理に回す + } + + public static void registerColorProviderBlock(List provider, Block... blocks) { blockColorProviders.put(provider, blocks); } - public static void registerBlockColors(RegisterColorHandlersEvent.Block event){ + @SubscribeEvent + public static void onRegisterMenuScreens(RegisterMenuScreensEvent event) { + for (Consumer reg : screenRegistrations) { + reg.accept(event); + } + } + + @SubscribeEvent + public static void onRegisterParticleProviders(RegisterParticleProvidersEvent event) { + for (Consumer reg : particleRegistrations) { + reg.accept(event); + } + } + + @SubscribeEvent + public static void onRegisterLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { + for (Consumer reg : layerRegistrations) { + reg.accept(event); + } + } + + @SubscribeEvent + public static void onRegisterRenderers(EntityRenderersEvent.RegisterRenderers event) { + for (Consumer reg : rendererRegistrations) { + reg.accept(event); + } + } + + @SubscribeEvent + public static void onRegisterBlockColors(RegisterColorHandlersEvent.BlockTintSources event){ if (blockColorProviders.isEmpty()) return; - for (Map.Entry entry : blockColorProviders.entrySet()) { - BlockColorProvider provider = entry.getKey(); + for (Map.Entry, Block[]> entry : blockColorProviders.entrySet()) { + List provider = entry.getKey(); Block[] blocks = entry.getValue(); if (blocks == null || blocks.length == 0) { diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java new file mode 100644 index 000000000..0af3944dd --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java @@ -0,0 +1,27 @@ +package net.pitan76.mcpitanlib.api.client.registry.neoforge; + +import net.minecraft.client.KeyMapping; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib",value = Dist.CLIENT) +public class KeybindingRegistryImpl { + + private static final List keyMappings = new ArrayList<>(); + + public static void register(KeyMapping keyBinding) { + keyMappings.add(keyBinding); + } + + @SubscribeEvent + public static void onRegisterKeyMappings(RegisterKeyMappingsEvent event) { + for (KeyMapping keyMapping : keyMappings) { + event.register(keyMapping); + } + } +} \ No newline at end of file From 9d867ff936a4f616a611f3863cc565a8486975d4 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:27:30 +0900 Subject: [PATCH 101/151] fix: implement ClientTickEventRegistry for NeoForge and add event registration methods --- .../api/event/v0/ClientTickEventRegistry.java | 14 ++-- .../fabric/ClientTickEventRegistryImpl.java | 22 ++++++ .../neoforge/ClientTickEventRegistryImpl.java | 73 +++++++++++++++++++ 3 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/ClientTickEventRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/ClientTickEventRegistryImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java index 0db724876..2d05a102a 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/ClientTickEventRegistry.java @@ -1,25 +1,29 @@ package net.pitan76.mcpitanlib.api.event.v0; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.minecraft.client.Minecraft; public class ClientTickEventRegistry { + @ExpectPlatform public static void registerPost(Client client) { - ClientTickEvents.END_CLIENT_TICK.register(client::tick); + } + @ExpectPlatform public static void registerPre(Client client) { - ClientTickEvents.START_CLIENT_TICK.register(client::tick); + } + @ExpectPlatform public static void registerLevelPost(ClientLevel world) { - ClientTickEvents.END_LEVEL_TICK.register(world::tick); + } + @ExpectPlatform public static void registerLevelPre(ClientLevel world) { - ClientTickEvents.START_LEVEL_TICK.register(world::tick); + } @Environment(EnvType.CLIENT) diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/ClientTickEventRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/ClientTickEventRegistryImpl.java new file mode 100644 index 000000000..ab67e82b5 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/ClientTickEventRegistryImpl.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.api.event.v0.fabric; + +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; + +public class ClientTickEventRegistryImpl { + public static void registerPost(ClientTickEventRegistry.Client client) { + ClientTickEvents.END_CLIENT_TICK.register(client::tick); + } + + public static void registerPre(ClientTickEventRegistry.Client client) { + ClientTickEvents.START_CLIENT_TICK.register(client::tick); + } + + public static void registerLevelPost(ClientTickEventRegistry.ClientLevel world) { + ClientTickEvents.END_LEVEL_TICK.register(world::tick); + } + + public static void registerLevelPre(ClientTickEventRegistry.ClientLevel world) { + ClientTickEvents.START_LEVEL_TICK.register(world::tick); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/ClientTickEventRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/ClientTickEventRegistryImpl.java new file mode 100644 index 000000000..0a79b71d5 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/ClientTickEventRegistryImpl.java @@ -0,0 +1,73 @@ +package net.pitan76.mcpitanlib.api.event.v0.neoforge; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.ClientTickEvent; +import net.neoforged.neoforge.event.tick.LevelTickEvent; +import net.pitan76.mcpitanlib.api.event.v0.ClientTickEventRegistry; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib", value = Dist.CLIENT) +public class ClientTickEventRegistryImpl { + + private static final List preClients = new ArrayList<>(); + private static final List postClients = new ArrayList<>(); + private static final List preLevels = new ArrayList<>(); + private static final List postLevels = new ArrayList<>(); + + public static void registerPre(ClientTickEventRegistry.Client client) { + preClients.add(client); + } + + public static void registerPost(ClientTickEventRegistry.Client client) { + postClients.add(client); + } + + public static void registerLevelPre(ClientTickEventRegistry.ClientLevel world) { + preLevels.add(world); + } + + public static void registerLevelPost(ClientTickEventRegistry.ClientLevel world) { + postLevels.add(world); + } + + @SubscribeEvent + public static void onClientTickPre(ClientTickEvent.Pre event) { + Minecraft mc = Minecraft.getInstance(); + for (ClientTickEventRegistry.Client listener : preClients) { + listener.tick(mc); + } + } + + @SubscribeEvent + public static void onClientTickPost(ClientTickEvent.Post event) { + Minecraft mc = Minecraft.getInstance(); + for (ClientTickEventRegistry.Client listener : postClients) { + listener.tick(mc); + } + } + + @SubscribeEvent + public static void onLevelTickPre(LevelTickEvent.Pre event) { + // LevelTickEventはサーバー側のワールドでも発火するため、クライアントワールドかどうかの判定が必須 + if (event.getLevel() instanceof ClientLevel clientLevel) { + for (ClientTickEventRegistry.ClientLevel listener : preLevels) { + listener.tick(clientLevel); + } + } + } + + @SubscribeEvent + public static void onLevelTickPost(LevelTickEvent.Post event) { + if (event.getLevel() instanceof ClientLevel clientLevel) { + for (ClientTickEventRegistry.ClientLevel listener : postLevels) { + listener.tick(clientLevel); + } + } + } +} \ No newline at end of file From 1552ea9e65e8bd52f196fbe8acaae56c08ad2be0 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:32:01 +0900 Subject: [PATCH 102/151] fix: refactor command registration to use ExpectPlatform annotation and implement NeoForge compatibility --- .../api/command/CommandRegistry.java | 31 ++-------- .../command/fabric/CommandRegistryImpl.java | 44 ++++++++++++++ .../command/neoforge/CommandRegistryImpl.java | 59 +++++++++++++++++++ 3 files changed, 109 insertions(+), 25 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/command/fabric/CommandRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/command/neoforge/CommandRegistryImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java index f15d95dce..0e64f0485 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/command/CommandRegistry.java @@ -2,7 +2,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.Commands; import net.minecraft.commands.CommandSourceStack; @@ -16,37 +16,18 @@ public class CommandRegistry { @Deprecated public static CommandBuildContext latestCommandRegistryAccess; + @ExpectPlatform public static void register(String name, LiteralCommand command) { - CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> { - latestCommandRegistryAccess = registry; - CommandSettings settings = new CommandSettings(); - command.init(settings); - - LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(name).requires(settings::requires) - .executes(context -> { - ServerCommandEvent event = new ServerCommandEvent(); - event.setContext(context); - command.execute(event); - return command.isSuccess; - }); - - forArgsCmd(command, builder); - - //register(builder); - dispatcher.register(builder); - }); } + @ExpectPlatform public static void register(LiteralArgumentBuilder builder) { - CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> { - latestCommandRegistryAccess = registry; - dispatcher.register(builder); - } - ); + } - private static > void forArgsCmd(AbstractCommand absCmd, ArgumentBuilder builder) { + @Deprecated + public static > void forArgsCmd(AbstractCommand absCmd, ArgumentBuilder builder) { if (!absCmd.getArgumentCommands().isEmpty()) { // 引数コマンド diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/command/fabric/CommandRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/command/fabric/CommandRegistryImpl.java new file mode 100644 index 000000000..1aac2c12d --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/command/fabric/CommandRegistryImpl.java @@ -0,0 +1,44 @@ +package net.pitan76.mcpitanlib.api.command.fabric; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.minecraft.commands.CommandSourceStack; +import net.pitan76.mcpitanlib.api.command.CommandSettings; +import net.pitan76.mcpitanlib.api.command.LiteralCommand; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +import static net.pitan76.mcpitanlib.api.command.CommandRegistry.forArgsCmd; +import static net.pitan76.mcpitanlib.api.command.CommandRegistry.latestCommandRegistryAccess; + +public class CommandRegistryImpl { + + public static void register(String name, LiteralCommand command) { + CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> { + latestCommandRegistryAccess = registry; + + CommandSettings settings = new CommandSettings(); + command.init(settings); + + LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(name).requires(settings::requires) + .executes(context -> { + ServerCommandEvent event = new ServerCommandEvent(); + event.setContext(context); + command.execute(event); + return command.isSuccess; + }); + + forArgsCmd(command, builder); + + //register(builder); + dispatcher.register(builder); + }); + } + + public static void register(LiteralArgumentBuilder builder) { + CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> { + latestCommandRegistryAccess = registry; + dispatcher.register(builder); + } + ); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/command/neoforge/CommandRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/command/neoforge/CommandRegistryImpl.java new file mode 100644 index 000000000..6947b68c6 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/command/neoforge/CommandRegistryImpl.java @@ -0,0 +1,59 @@ +package net.pitan76.mcpitanlib.api.command.neoforge; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import net.minecraft.commands.CommandSourceStack; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.RegisterCommandsEvent; +import net.pitan76.mcpitanlib.api.command.CommandSettings; +import net.pitan76.mcpitanlib.api.command.LiteralCommand; +import net.pitan76.mcpitanlib.api.event.ServerCommandEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +import static net.pitan76.mcpitanlib.api.command.CommandRegistry.forArgsCmd; +import static net.pitan76.mcpitanlib.api.command.CommandRegistry.latestCommandRegistryAccess; + +@EventBusSubscriber(modid = "mcpitanlib") +public class CommandRegistryImpl { + + private static final List> commandRegistrations = new ArrayList<>(); + + public static void register(String name, LiteralCommand command) { + commandRegistrations.add(event -> { + latestCommandRegistryAccess = event.getBuildContext(); + + CommandSettings settings = new CommandSettings(); + command.init(settings); + + LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(name) + .requires(settings::requires) + .executes(context -> { + ServerCommandEvent cmdEvent = new ServerCommandEvent(); + cmdEvent.setContext(context); + command.execute(cmdEvent); + return command.isSuccess; + }); + + forArgsCmd(command, builder); + + event.getDispatcher().register(builder); + }); + } + + public static void register(LiteralArgumentBuilder builder) { + commandRegistrations.add(event -> { + latestCommandRegistryAccess = event.getBuildContext(); + event.getDispatcher().register(builder); + }); + } + + @SubscribeEvent + public static void onRegisterCommands(RegisterCommandsEvent event) { + for (Consumer registration : commandRegistrations) { + registration.accept(event); + } + } +} \ No newline at end of file From f5f12faf87ba08e26589998d801288a72d8f0e9a Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:35:29 +0900 Subject: [PATCH 103/151] fix: refactor AttackEntityEventRegistry to use ExpectPlatform annotation and implement AttackEntityEventRegistryImpl --- .../event/v0/AttackEntityEventRegistry.java | 5 +- .../api/item/DefaultItemGroups.java | 52 +++++++++++++------ .../fabric/AttackEntityEventRegistryImpl.java | 10 ++++ 3 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/AttackEntityEventRegistryImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java index ff79a348e..66575afd4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/AttackEntityEventRegistry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.v0; -import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; @@ -12,8 +12,9 @@ @Deprecated public class AttackEntityEventRegistry { + @ExpectPlatform public static void register(AttackEntity attackEntity) { - AttackEntityCallback.EVENT.register(attackEntity::attack); + } public interface AttackEntity { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java index 727a81c42..47dfed0ec 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/DefaultItemGroups.java @@ -1,24 +1,46 @@ package net.pitan76.mcpitanlib.api.item; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.core.registries.BuiltInRegistries; public class DefaultItemGroups { - public static final CreativeModeTab BUILDING_BLOCKS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.BUILDING_BLOCKS); - public static final CreativeModeTab COLORED_BLOCKS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.COLORED_BLOCKS); // if 1.19.2 and below, BUILDING_BLOCKS - public static final CreativeModeTab NATURAL = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.NATURAL_BLOCKS); // if 1.19.2 and below, DECORATIONS - public static final CreativeModeTab FUNCTIONAL = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.FUNCTIONAL_BLOCKS); // if 1.19.2 and below, TRANSPORTATION - public static final CreativeModeTab REDSTONE = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.REDSTONE_BLOCKS); - public static final CreativeModeTab HOTBAR = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.HOTBAR); - public static final CreativeModeTab SEARCH = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.SEARCH); - public static final CreativeModeTab TOOLS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.TOOLS_AND_UTILITIES); - public static final CreativeModeTab COMBAT = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.COMBAT); - public static final CreativeModeTab FOOD_AND_DRINK = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.FOOD_AND_DRINKS); // if 1.19.2 and below, FOOD - public static final CreativeModeTab INGREDIENTS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.INGREDIENTS); // if 1.19.2 and below, MISC - public static final CreativeModeTab SPAWN_EGGS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.SPAWN_EGGS); // if 1.19.2 and below, MISC - public static final CreativeModeTab OPERATOR = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.OP_BLOCKS); // if 1.19.2 and below, MISC - public static final CreativeModeTab INVENTORY = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(CreativeModeTabs.INVENTORY); + + private static final ResourceKey _BUILDING_BLOCKS = createKey("building_blocks"); + private static final ResourceKey _COLORED_BLOCKS = createKey("colored_blocks"); + private static final ResourceKey _NATURAL_BLOCKS = createKey("natural_blocks"); + private static final ResourceKey _FUNCTIONAL_BLOCKS = createKey("functional_blocks"); + private static final ResourceKey _REDSTONE_BLOCKS = createKey("redstone_blocks"); + private static final ResourceKey _HOTBAR = createKey("hotbar"); + private static final ResourceKey _SEARCH = createKey("search"); + private static final ResourceKey _TOOLS_AND_UTILITIES = createKey("tools_and_utilities"); + private static final ResourceKey _COMBAT = createKey("combat"); + private static final ResourceKey _FOOD_AND_DRINKS = createKey("food_and_drinks"); + private static final ResourceKey _INGREDIENTS = createKey("ingredients"); + private static final ResourceKey _SPAWN_EGGS = createKey("spawn_eggs"); + private static final ResourceKey _OP_BLOCKS = createKey("op_blocks"); + private static final ResourceKey _INVENTORY = createKey("inventory"); + + private static ResourceKey createKey(final String id) { + return ResourceKey.create(Registries.CREATIVE_MODE_TAB, Identifier.withDefaultNamespace(id)); + } + + public static final CreativeModeTab BUILDING_BLOCKS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_BUILDING_BLOCKS); + public static final CreativeModeTab COLORED_BLOCKS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_COLORED_BLOCKS); // if 1.19.2 and below, BUILDING_BLOCKS + public static final CreativeModeTab NATURAL = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_NATURAL_BLOCKS); // if 1.19.2 and below, DECORATIONS + public static final CreativeModeTab FUNCTIONAL = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_FUNCTIONAL_BLOCKS); // if 1.19.2 and below, TRANSPORTATION + public static final CreativeModeTab REDSTONE = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_REDSTONE_BLOCKS); + public static final CreativeModeTab HOTBAR = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_HOTBAR); + public static final CreativeModeTab SEARCH = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_SEARCH); + public static final CreativeModeTab TOOLS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_TOOLS_AND_UTILITIES); + public static final CreativeModeTab COMBAT = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_COMBAT); + public static final CreativeModeTab FOOD_AND_DRINK = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_FOOD_AND_DRINKS); // if 1.19.2 and below, FOOD + public static final CreativeModeTab INGREDIENTS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_INGREDIENTS); // if 1.19.2 and below, MISC + public static final CreativeModeTab SPAWN_EGGS = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_SPAWN_EGGS); // if 1.19.2 and below, MISC + public static final CreativeModeTab OPERATOR = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_OP_BLOCKS); // if 1.19.2 and below, MISC + public static final CreativeModeTab INVENTORY = BuiltInRegistries.CREATIVE_MODE_TAB.getValue(_INVENTORY); // ~1.19.2 Item Group public static final CreativeModeTab BREWING = FOOD_AND_DRINK; diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/AttackEntityEventRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/AttackEntityEventRegistryImpl.java new file mode 100644 index 000000000..606bdda7d --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/AttackEntityEventRegistryImpl.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event.v0.fabric; + +import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import net.pitan76.mcpitanlib.api.event.v0.AttackEntityEventRegistry; + +public class AttackEntityEventRegistryImpl { + public static void register(AttackEntityEventRegistry.AttackEntity attackEntity) { + AttackEntityCallback.EVENT.register(attackEntity::attack); + } +} From e19df23e487279cf08663834677f8b558f80d4dd Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:40:21 +0900 Subject: [PATCH 104/151] fix: refactor event registration to use ExpectPlatform annotation and implement NeoForge compatibility --- .../api/event/v0/EventRegistry.java | 28 +++-- .../event/v0/event/ServerConnectionEvent.java | 10 +- .../fabric/ServerConnectionEventImpl.java | 16 +++ .../EventRegistryServerLifecycleImpl.java | 41 +++++++ .../neoforge/ServerConnectionEventImpl.java | 43 +++++++ .../EventRegistryServerLifecycleImpl.java | 111 ++++++++++++++++++ 6 files changed, 231 insertions(+), 18 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/fabric/ServerConnectionEventImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/EventRegistryServerLifecycleImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/neoforge/ServerConnectionEventImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/EventRegistryServerLifecycleImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java index 731335ca9..533e6982b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/EventRegistry.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.event.v0; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; @@ -43,36 +42,39 @@ public interface ItemStackDamageState { public static class ServerLifecycle { // Architectury: LifecycleEvent + @ExpectPlatform public static void serverStarted(ServerState state) { - ServerLifecycleEvents.SERVER_STARTED.register(state::stateChanged); + } + @ExpectPlatform public static void serverStarting(ServerState state) { - ServerLifecycleEvents.SERVER_STARTING.register(state::stateChanged); + } + @ExpectPlatform public static void serverStopped(ServerState state) { - ServerLifecycleEvents.SERVER_STOPPED.register(state::stateChanged); + } + @ExpectPlatform public static void serverStopping(ServerState state) { - ServerLifecycleEvents.SERVER_STOPPING.register(state::stateChanged); + } + @ExpectPlatform public static void serverWorldLoad(ServerWorldState state) { - ServerLevelEvents.LOAD.register((_, level) -> state.act(level)); + } + @ExpectPlatform public static void serverWorldSave(ServerWorldState state) { - ServerLifecycleEvents.AFTER_SAVE.register((server, _, _) -> { - for (ServerLevel level : server.getAllLevels()) { - state.act(level); - } - }); + } + @ExpectPlatform public static void serverWorldUnload(ServerWorldState state) { - ServerLevelEvents.UNLOAD.register((_, level) -> state.act(level)); + } public interface ServerState extends InstanceState { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java index 276d597be..06eed0e8b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/ServerConnectionEvent.java @@ -1,17 +1,17 @@ package net.pitan76.mcpitanlib.api.event.v0.event; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; public class ServerConnectionEvent { // Architectury: PlayerEvent + @ExpectPlatform public static void join(EventRegistry.ServerConnection.PlayerJoin state) { - ServerPlayConnectionEvents.JOIN.register(((listener, _, _) - -> state.join(listener.getPlayer()))); + } + @ExpectPlatform public static void quit(EventRegistry.ServerConnection.PlayerQuit state) { - ServerPlayConnectionEvents.DISCONNECT.register(((listener, _) - -> state.quit(listener.getPlayer()))); + } } diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/fabric/ServerConnectionEventImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/fabric/ServerConnectionEventImpl.java new file mode 100644 index 000000000..f7707c4cd --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/fabric/ServerConnectionEventImpl.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.event.v0.event.fabric; + +import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; +import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; + +public class ServerConnectionEventImpl { + public static void join(EventRegistry.ServerConnection.PlayerJoin state) { + ServerPlayConnectionEvents.JOIN.register(((listener, _, _) + -> state.join(listener.getPlayer()))); + } + + public static void quit(EventRegistry.ServerConnection.PlayerQuit state) { + ServerPlayConnectionEvents.DISCONNECT.register(((listener, _) + -> state.quit(listener.getPlayer()))); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/EventRegistryServerLifecycleImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/EventRegistryServerLifecycleImpl.java new file mode 100644 index 000000000..8b5e92085 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/EventRegistryServerLifecycleImpl.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.api.event.v0.fabric; + +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; +import net.minecraft.server.level.ServerLevel; +import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; + +public class EventRegistryServerLifecycleImpl { + public static void serverStarted(EventRegistry.ServerLifecycle.ServerState state) { + ServerLifecycleEvents.SERVER_STARTED.register(state::stateChanged); + } + + + public static void serverStarting(EventRegistry.ServerLifecycle.ServerState state) { + ServerLifecycleEvents.SERVER_STARTING.register(state::stateChanged); + } + + public static void serverStopped(EventRegistry.ServerLifecycle.ServerState state) { + ServerLifecycleEvents.SERVER_STOPPED.register(state::stateChanged); + } + + public static void serverStopping(EventRegistry.ServerLifecycle.ServerState state) { + ServerLifecycleEvents.SERVER_STOPPING.register(state::stateChanged); + } + + public static void serverWorldLoad(EventRegistry.ServerLifecycle.ServerWorldState state) { + ServerLevelEvents.LOAD.register((_, level) -> state.act(level)); + } + + public static void serverWorldSave(EventRegistry.ServerLifecycle.ServerWorldState state) { + ServerLifecycleEvents.AFTER_SAVE.register((server, _, _) -> { + for (ServerLevel level : server.getAllLevels()) { + state.act(level); + } + }); + } + + public static void serverWorldUnload(EventRegistry.ServerLifecycle.ServerWorldState state) { + ServerLevelEvents.UNLOAD.register((_, level) -> state.act(level)); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/neoforge/ServerConnectionEventImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/neoforge/ServerConnectionEventImpl.java new file mode 100644 index 000000000..bfcf820ea --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/event/neoforge/ServerConnectionEventImpl.java @@ -0,0 +1,43 @@ +package net.pitan76.mcpitanlib.api.event.v0.event.neoforge; + +import net.minecraft.server.level.ServerPlayer; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.entity.player.PlayerEvent; +import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib") +public class ServerConnectionEventImpl { + + private static final List joinListeners = new ArrayList<>(); + private static final List quitListeners = new ArrayList<>(); + + public static void join(EventRegistry.ServerConnection.PlayerJoin state) { + joinListeners.add(state); + } + + public static void quit(EventRegistry.ServerConnection.PlayerQuit state) { + quitListeners.add(state); + } + + @SubscribeEvent + public static void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) { + if (event.getEntity() instanceof ServerPlayer serverPlayer) { + for (EventRegistry.ServerConnection.PlayerJoin listener : joinListeners) { + listener.join(serverPlayer); + } + } + } + + @SubscribeEvent + public static void onPlayerQuit(PlayerEvent.PlayerLoggedOutEvent event) { + if (event.getEntity() instanceof ServerPlayer serverPlayer) { + for (EventRegistry.ServerConnection.PlayerQuit listener : quitListeners) { + listener.quit(serverPlayer); + } + } + } +} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/EventRegistryServerLifecycleImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/EventRegistryServerLifecycleImpl.java new file mode 100644 index 000000000..8a33a8b73 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/EventRegistryServerLifecycleImpl.java @@ -0,0 +1,111 @@ +package net.pitan76.mcpitanlib.api.event.v0.neoforge; + +import net.minecraft.server.level.ServerLevel; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.level.LevelEvent; +import net.neoforged.neoforge.event.server.ServerStartedEvent; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import net.neoforged.neoforge.event.server.ServerStoppedEvent; +import net.neoforged.neoforge.event.server.ServerStoppingEvent; +import net.pitan76.mcpitanlib.api.event.v0.EventRegistry; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib") +public class EventRegistryServerLifecycleImpl { + + private static final List serverStartedListeners = new ArrayList<>(); + private static final List serverStartingListeners = new ArrayList<>(); + private static final List serverStoppedListeners = new ArrayList<>(); + private static final List serverStoppingListeners = new ArrayList<>(); + + private static final List worldLoadListeners = new ArrayList<>(); + private static final List worldSaveListeners = new ArrayList<>(); + private static final List worldUnloadListeners = new ArrayList<>(); + + public static void serverStarted(EventRegistry.ServerLifecycle.ServerState state) { + serverStartedListeners.add(state); + } + + public static void serverStarting(EventRegistry.ServerLifecycle.ServerState state) { + serverStartingListeners.add(state); + } + + public static void serverStopped(EventRegistry.ServerLifecycle.ServerState state) { + serverStoppedListeners.add(state); + } + + public static void serverStopping(EventRegistry.ServerLifecycle.ServerState state) { + serverStoppingListeners.add(state); + } + + public static void serverWorldLoad(EventRegistry.ServerLifecycle.ServerWorldState state) { + worldLoadListeners.add(state); + } + + public static void serverWorldSave(EventRegistry.ServerLifecycle.ServerWorldState state) { + worldSaveListeners.add(state); + } + + public static void serverWorldUnload(EventRegistry.ServerLifecycle.ServerWorldState state) { + worldUnloadListeners.add(state); + } + + @SubscribeEvent + public static void onServerStarting(ServerStartingEvent event) { + for (EventRegistry.ServerLifecycle.ServerState listener : serverStartingListeners) { + listener.stateChanged(event.getServer()); + } + } + + @SubscribeEvent + public static void onServerStarted(ServerStartedEvent event) { + for (EventRegistry.ServerLifecycle.ServerState listener : serverStartedListeners) { + listener.stateChanged(event.getServer()); + } + } + + @SubscribeEvent + public static void onServerStopping(ServerStoppingEvent event) { + for (EventRegistry.ServerLifecycle.ServerState listener : serverStoppingListeners) { + listener.stateChanged(event.getServer()); + } + } + + @SubscribeEvent + public static void onServerStopped(ServerStoppedEvent event) { + for (EventRegistry.ServerLifecycle.ServerState listener : serverStoppedListeners) { + listener.stateChanged(event.getServer()); + } + } + + @SubscribeEvent + public static void onLevelLoad(LevelEvent.Load event) { + // TODO: クライアント側のワールド読み込みでも発火するため、ServerLevelかどうかの判定の確認するべきかも + if (event.getLevel() instanceof ServerLevel serverLevel) { + for (EventRegistry.ServerLifecycle.ServerWorldState listener : worldLoadListeners) { + listener.act(serverLevel); + } + } + } + + @SubscribeEvent + public static void onLevelSave(LevelEvent.Save event) { + if (event.getLevel() instanceof ServerLevel serverLevel) { + for (EventRegistry.ServerLifecycle.ServerWorldState listener : worldSaveListeners) { + listener.act(serverLevel); + } + } + } + + @SubscribeEvent + public static void onLevelUnload(LevelEvent.Unload event) { + if (event.getLevel() instanceof ServerLevel serverLevel) { + for (EventRegistry.ServerLifecycle.ServerWorldState listener : worldUnloadListeners) { + listener.act(serverLevel); + } + } + } +} \ No newline at end of file From 4859b4e1b01409b3cef404a6fc4e7e5b12158448 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:50:19 +0900 Subject: [PATCH 105/151] fix: refactor AttackEntityEventRegistry and LivingHurtEventRegistry to use ExpectPlatform annotation and implement NeoForge compatibility --- .../api/event/v0/LivingHurtEventRegistry.java | 5 ++- .../event/v1/AttackEntityEventRegistry.java | 5 ++- .../api/event/v1/LivingHurtEventRegistry.java | 5 ++- .../fabric/LivingHurtEventRegistryImpl.java | 10 +++++ .../fabric/AttackEntityEventRegistryImpl.java | 10 +++++ .../fabric/LivingHurtEventRegistryImpl.java | 10 +++++ .../neoforge/LivingHurtEventRegistryImpl.java | 38 ++++++++++++++++++ .../AttackEntityEventRegistryImpl.java | 39 +++++++++++++++++++ .../neoforge/LivingHurtEventRegistryImpl.java | 39 +++++++++++++++++++ 9 files changed, 155 insertions(+), 6 deletions(-) create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/LivingHurtEventRegistryImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/AttackEntityEventRegistryImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/LivingHurtEventRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/LivingHurtEventRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/AttackEntityEventRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/LivingHurtEventRegistryImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java index 6d4ed9711..68956b8ea 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v0/LivingHurtEventRegistry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.v0; -import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.damagesource.DamageSource; @@ -9,8 +9,9 @@ @Deprecated public class LivingHurtEventRegistry { + @ExpectPlatform public static void register(LivingHurt livingHurt) { - ServerLivingEntityEvents.ALLOW_DAMAGE.register(livingHurt::hurt); + } public interface LivingHurt { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java index 8fb8e4b33..ca5b033ac 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/AttackEntityEventRegistry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.event.v1; -import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; @@ -11,8 +11,9 @@ import org.jetbrains.annotations.Nullable; public class AttackEntityEventRegistry { + @ExpectPlatform public static void register(AttackEntity attackEntity) { - AttackEntityCallback.EVENT.register(attackEntity::attack); + } public interface AttackEntity { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java index 6426fbeff..54cdbcd2e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/v1/LivingHurtEventRegistry.java @@ -1,14 +1,15 @@ package net.pitan76.mcpitanlib.api.event.v1; -import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.damagesource.DamageSource; import net.pitan76.mcpitanlib.api.event.v0.event.LivingHurtEvent; public class LivingHurtEventRegistry { + @ExpectPlatform public static void register(LivingHurt livingHurt) { - ServerLivingEntityEvents.ALLOW_DAMAGE.register(livingHurt::hurt); + } public interface LivingHurt { diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/LivingHurtEventRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/LivingHurtEventRegistryImpl.java new file mode 100644 index 000000000..3344307f8 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v0/fabric/LivingHurtEventRegistryImpl.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event.v0.fabric; + +import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents; +import net.pitan76.mcpitanlib.api.event.v0.LivingHurtEventRegistry; + +public class LivingHurtEventRegistryImpl { + public static void register(LivingHurtEventRegistry.LivingHurt livingHurt) { + ServerLivingEntityEvents.ALLOW_DAMAGE.register(livingHurt::hurt); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/AttackEntityEventRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/AttackEntityEventRegistryImpl.java new file mode 100644 index 000000000..4085df0d6 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/AttackEntityEventRegistryImpl.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event.v1.fabric; + +import net.fabricmc.fabric.api.event.player.AttackEntityCallback; +import net.pitan76.mcpitanlib.api.event.v1.AttackEntityEventRegistry; + +public class AttackEntityEventRegistryImpl { + public static void register(AttackEntityEventRegistry.AttackEntity attackEntity) { + AttackEntityCallback.EVENT.register(attackEntity::attack); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/LivingHurtEventRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/LivingHurtEventRegistryImpl.java new file mode 100644 index 000000000..b61bd34e4 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/event/v1/fabric/LivingHurtEventRegistryImpl.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.event.v1.fabric; + +import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents; +import net.pitan76.mcpitanlib.api.event.v1.LivingHurtEventRegistry; + +public class LivingHurtEventRegistryImpl { + public static void register(LivingHurtEventRegistry.LivingHurt livingHurt) { + ServerLivingEntityEvents.ALLOW_DAMAGE.register(livingHurt::hurt); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/LivingHurtEventRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/LivingHurtEventRegistryImpl.java new file mode 100644 index 000000000..0fe018459 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v0/neoforge/LivingHurtEventRegistryImpl.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.event.v0.neoforge; + +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; +import net.pitan76.mcpitanlib.api.event.v0.LivingHurtEventRegistry; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib") +public class LivingHurtEventRegistryImpl { + + private static final List listeners = new ArrayList<>(); + + public static void register(LivingHurtEventRegistry.LivingHurt livingHurt) { + listeners.add(livingHurt); + } + + @SubscribeEvent + public static void onLivingHurt(LivingIncomingDamageEvent event) { + if (!event.getEntity().level().isClientSide()) { + for (LivingHurtEventRegistry.LivingHurt listener : listeners) { + boolean allow = listener.hurt( + event.getEntity(), + event.getSource(), + event.getAmount() + ); + + if (!allow) { + event.setCanceled(true); + return; + } + } + + } + } +} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/AttackEntityEventRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/AttackEntityEventRegistryImpl.java new file mode 100644 index 000000000..08040b14a --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/AttackEntityEventRegistryImpl.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.api.event.v1.neoforge; + +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.entity.player.AttackEntityEvent; +import net.pitan76.mcpitanlib.api.event.v1.AttackEntityEventRegistry; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib") +public class AttackEntityEventRegistryImpl { + + private static final List listeners = new ArrayList<>(); + + public static void register(AttackEntityEventRegistry.AttackEntity attackEntity) { + listeners.add(attackEntity); + } + + @SubscribeEvent + public static void onAttackEntity(AttackEntityEvent event) { + for (AttackEntityEventRegistry.AttackEntity listener : listeners) { + InteractionResult result = listener.attack( + event.getEntity(), + event.getEntity().level(), + InteractionHand.MAIN_HAND, + event.getTarget(), + null + ); + + if (result != InteractionResult.PASS) { + event.setCanceled(true); + return; + } + } + } +} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/LivingHurtEventRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/LivingHurtEventRegistryImpl.java new file mode 100644 index 000000000..45e8d9c36 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/event/v1/neoforge/LivingHurtEventRegistryImpl.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.api.event.v1.neoforge; + +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; +import net.pitan76.mcpitanlib.api.event.v1.LivingHurtEventRegistry; + +import java.util.ArrayList; +import java.util.List; + +@EventBusSubscriber(modid = "mcpitanlib") +public class LivingHurtEventRegistryImpl { + + private static final List listeners = new ArrayList<>(); + + public static void register(LivingHurtEventRegistry.LivingHurt livingHurt) { + listeners.add(livingHurt); + } + + @SubscribeEvent + public static void onLivingHurt(LivingIncomingDamageEvent event) { + + if (!event.getEntity().level().isClientSide()) { + for (LivingHurtEventRegistry.LivingHurt listener : listeners) { + boolean allow = listener.hurt( + event.getEntity(), + event.getSource(), + event.getAmount() + ); + + if (!allow) { + event.setCanceled(true); + return; + } + } + + } + } +} \ No newline at end of file From bddf65c9742fd4a245f7a01c9c7b618bd1ab2e36 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:51:17 +0900 Subject: [PATCH 106/151] remove extra --- .../extra/transfer/util/FluidStorageUtil.java | 99 ------------------- 1 file changed, 99 deletions(-) delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java deleted file mode 100644 index 26f3697ee..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java +++ /dev/null @@ -1,99 +0,0 @@ -package net.pitan76.mcpitanlib.api.extra.transfer.util; - -import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; -import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; -import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.material.FluidState; -import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; -import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; - -public class FluidStorageUtil { - public static SingleFluidStorage withFixedCapacity(long capacity, Runnable onChange) { - return SingleFluidStorage.withFixedCapacity(capacity, onChange); - } - - public static void readNbt(SingleFluidStorage storage, NbtRWArgs args) { - if (args instanceof ReadNbtArgs) - storage.readValue(((ReadNbtArgs) args).view); - } - - public static void writeNbt(SingleFluidStorage storage, NbtRWArgs args) { - if (args instanceof WriteNbtArgs) - storage.writeValue(((WriteNbtArgs) args).view); - } - - public static void readNbt(SingleFluidStorage storage, CompoundTag nbt, CompatRegistryLookup registryLookup) { - storage.readValue(NbtDataConverter.nbt2readData(nbt, registryLookup)); - } - - public static void writeNbt(SingleFluidStorage storage, CompoundTag nbt, CompatRegistryLookup registryLookup) { - storage.writeValue(NbtDataConverter.nbt2writeData(nbt, registryLookup)); - } - - /** - * @deprecated Use {@link #readNbt(SingleFluidStorage, NbtRWArgs)} instead - */ - @Deprecated - public static void readNbt(SingleFluidStorage storage, CompoundTag nbt, Level world) { - readNbt(storage, nbt, new CompatRegistryLookup(world.registryAccess())); - } - - /** - * @deprecated Use {@link #writeNbt(SingleFluidStorage, NbtRWArgs)} instead - */ - @Deprecated - public static void writeNbt(SingleFluidStorage storage, CompoundTag nbt, Level world) { - writeNbt(storage, nbt, new CompatRegistryLookup(world.registryAccess())); - } - - public static long getAmount(SingleFluidStorage storage) { - return storage.getAmount(); - } - - public static long getCapacity(SingleFluidStorage storage) { - return storage.getCapacity(); - } - - public static FluidVariant getResource(SingleFluidStorage storage) { - return storage.getResource(); - } - - public static boolean isResourceBlank(SingleFluidStorage storage) { - return storage.isResourceBlank(); - } - - public static long insert(SingleFluidStorage storage, FluidVariant insertedVariant, long maxAmount, Transaction transaction) { - return storage.insert(insertedVariant, maxAmount, transaction); - } - - public static long extract(SingleFluidStorage storage, FluidVariant extractedVariant, long maxAmount, Transaction transaction) { - return storage.extract(extractedVariant, maxAmount, transaction); - } - - public static void insert(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { - try (Transaction transaction = Transaction.openOuter()) { - insert(storage, FluidVariant.of(fluidState.getType()), maxAmount, transaction); - transaction.commit(); - } - } - - public static void extract(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { - try (Transaction transaction = Transaction.openOuter()) { - extract(storage, FluidVariant.of(fluidState.getType()), maxAmount, transaction); - transaction.commit(); - } - } - - public static boolean isEmpty(SingleFluidStorage storage) { - return getAmount(storage) == 0; - } - - public static boolean isFull(SingleFluidStorage storage) { - return getAmount(storage) >= getCapacity(storage); - } -} From ea962e8afa1117e7a0fbb04aa5a0a3d562e80ed5 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 19:54:58 +0900 Subject: [PATCH 107/151] fix: refactor FluidStorageUtil to use ExpectPlatform annotation and update NBT handling methods --- .../api/network/ClientNetworking.java | 2 - .../transfer/fluid/v1/FabricFluidStorage.java | 78 ------------------- .../transfer/fluid/v1/FabricFluidVariant.java | 33 -------- .../transfer/fluid/v1/FluidStorageUtil.java | 12 +-- .../extra/transfer/util/FluidStorageUtil.java | 32 ++++---- 5 files changed, 22 insertions(+), 135 deletions(-) delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java delete mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java index 47e159cb4..679f470fe 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ClientNetworking.java @@ -1,7 +1,5 @@ package net.pitan76.mcpitanlib.api.network; -import io.netty.buffer.Unpooled; -import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.FriendlyByteBuf; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java deleted file mode 100644 index 618784c75..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidStorage.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1; - -import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; -import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; -import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; -import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.FabricFluidVariant; - -public class FabricFluidStorage implements IFluidStorage { - - public final SingleFluidStorage storage; - - public FabricFluidStorage(SingleFluidStorage storage) { - this.storage = storage; - } - - @Override - public long getAmount() { - return storage.getAmount(); - } - - @Override - public long getCapacity() { - return storage.getCapacity(); - } - - @Override - public IFluidVariant getResource() { - return new FabricFluidVariant(storage.getResource()); - } - - @Override - public void setResource(IFluidVariant variant) { - storage.variant = ((FabricFluidVariant) variant).raw; - } - - @Override - public boolean isResourceBlank() { - return storage.isResourceBlank(); - } - - @Override - public long insert(IFluidVariant variant, long maxAmount, boolean simulate) { - if (simulate) - return storage.insert(((FabricFluidVariant) variant).raw, maxAmount, Transaction.openOuter()); - - long inserted = 0; - try (Transaction transaction = Transaction.openOuter()) { - inserted += storage.insert(((FabricFluidVariant) variant).raw, maxAmount, transaction); - transaction.commit(); - } - return inserted; - } - - @Override - public long extract(IFluidVariant variant, long maxAmount, boolean simulate) { - if (simulate) - return storage.extract(((FabricFluidVariant) variant).raw, maxAmount, Transaction.openOuter()); - - long extracted = 0; - try (Transaction transaction = Transaction.openOuter()) { - extracted += storage.extract(((FabricFluidVariant) variant).raw, maxAmount, transaction); - transaction.commit(); - } - return extracted; - } - - @Override - public void writeNbt(WriteNbtArgs args) { - storage.writeValue(args.view); - } - - @Override - public void readNbt(ReadNbtArgs args) { - storage.readValue(args.view); - - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java deleted file mode 100644 index 2274d37d2..000000000 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FabricFluidVariant.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.pitan76.mcpitanlib.api.transfer.fluid.v1; - -import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; -import net.minecraft.world.level.material.Fluid; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.IFluidVariant; - -public class FabricFluidVariant implements IFluidVariant { - - public final FluidVariant raw; - - public FabricFluidVariant() { - this.raw = FluidVariant.blank(); - } - - public FabricFluidVariant(FluidVariant variant) { - this.raw = variant; - } - - @Override - public Fluid getFluid() { - return raw.getFluid(); - } - - @Override - public boolean isBlank() { - return raw.isBlank(); - } - - @Override - public boolean isSame(Fluid fluid) { - return raw.isOf(fluid); - } -} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java index 5b444ac15..5d78aaacf 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/FluidStorageUtil.java @@ -1,16 +1,16 @@ package net.pitan76.mcpitanlib.api.transfer.fluid.v1; -import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; -import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.level.material.Fluid; -import net.pitan76.mcpitanlib.api.transfer.fluid.v1.FabricFluidVariant; public class FluidStorageUtil { + @ExpectPlatform public static IFluidStorage withFixedCapacity(long capacity, Runnable onChange) { - return new FabricFluidStorage(SingleFluidStorage.withFixedCapacity(capacity, onChange)); + throw new AssertionError(); } + @ExpectPlatform public static IFluidVariant getVariant(Fluid fluid) { - return new FabricFluidVariant(FluidVariant.of(fluid)); + throw new AssertionError(); } -} +} \ No newline at end of file diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java index 0d85026f5..8760877af 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/extra/transfer/util/FluidStorageUtil.java @@ -3,9 +3,9 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; import net.fabricmc.fabric.api.transfer.v1.fluid.base.SingleFluidStorage; import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction; -import net.minecraft.fluid.FluidState; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.world.World; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.material.FluidState; import net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs; import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; @@ -19,36 +19,36 @@ public static SingleFluidStorage withFixedCapacity(long capacity, Runnable onCha public static void readNbt(SingleFluidStorage storage, NbtRWArgs args) { if (args instanceof ReadNbtArgs) - storage.readData(((ReadNbtArgs) args).view); + storage.readValue(((ReadNbtArgs) args).view); } public static void writeNbt(SingleFluidStorage storage, NbtRWArgs args) { if (args instanceof WriteNbtArgs) - storage.writeData(((WriteNbtArgs) args).view); + storage.writeValue(((WriteNbtArgs) args).view); } - public static void readNbt(SingleFluidStorage storage, NbtCompound nbt, CompatRegistryLookup registryLookup) { - storage.readData(NbtDataConverter.nbt2readData(nbt, registryLookup)); + public static void readNbt(SingleFluidStorage storage, CompoundTag nbt, CompatRegistryLookup registryLookup) { + storage.readValue(NbtDataConverter.nbt2readData(nbt, registryLookup)); } - public static void writeNbt(SingleFluidStorage storage, NbtCompound nbt, CompatRegistryLookup registryLookup) { - storage.writeData(NbtDataConverter.nbt2writeData(nbt, registryLookup)); + public static void writeNbt(SingleFluidStorage storage, CompoundTag nbt, CompatRegistryLookup registryLookup) { + storage.writeValue(NbtDataConverter.nbt2writeData(nbt, registryLookup)); } /** * @deprecated Use {@link #readNbt(SingleFluidStorage, NbtRWArgs)} instead */ @Deprecated - public static void readNbt(SingleFluidStorage storage, NbtCompound nbt, World world) { - readNbt(storage, nbt, new CompatRegistryLookup(world.getRegistryManager())); + public static void readNbt(SingleFluidStorage storage, CompoundTag nbt, Level world) { + readNbt(storage, nbt, new CompatRegistryLookup(world.registryAccess())); } /** * @deprecated Use {@link #writeNbt(SingleFluidStorage, NbtRWArgs)} instead */ @Deprecated - public static void writeNbt(SingleFluidStorage storage, NbtCompound nbt, World world) { - writeNbt(storage, nbt, new CompatRegistryLookup(world.getRegistryManager())); + public static void writeNbt(SingleFluidStorage storage, CompoundTag nbt, Level world) { + writeNbt(storage, nbt, new CompatRegistryLookup(world.registryAccess())); } public static long getAmount(SingleFluidStorage storage) { @@ -77,14 +77,14 @@ public static long extract(SingleFluidStorage storage, FluidVariant extractedVar public static void insert(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { try (Transaction transaction = Transaction.openOuter()) { - insert(storage, FluidVariant.of(fluidState.getFluid()), maxAmount, transaction); + insert(storage, FluidVariant.of(fluidState.getType()), maxAmount, transaction); transaction.commit(); } } public static void extract(SingleFluidStorage storage, FluidState fluidState, long maxAmount) { try (Transaction transaction = Transaction.openOuter()) { - extract(storage, FluidVariant.of(fluidState.getFluid()), maxAmount, transaction); + extract(storage, FluidVariant.of(fluidState.getType()), maxAmount, transaction); transaction.commit(); } } @@ -96,4 +96,4 @@ public static boolean isEmpty(SingleFluidStorage storage) { public static boolean isFull(SingleFluidStorage storage) { return getAmount(storage) >= getCapacity(storage); } -} +} \ No newline at end of file From 06560b468c709c759f5251c30e2e71d21eb69e4d Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 20:54:56 +0900 Subject: [PATCH 108/151] fix: refactor ArchRegistryClient to use CompatRegistryClient for particle and block entity renderer registration --- .../api/client/registry/ArchRegistryClient.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java index 3cb5f48b2..e2868c3ee 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/ArchRegistryClient.java @@ -3,7 +3,6 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.renderer.block.BlockModelResolver; -import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.item.ItemModelResolver; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; @@ -55,7 +54,7 @@ public static void registerParticle(ParticleType } public static void registerParticle(ParticleType type, DeferredParticleProvider provider) { - ParticleProviderRegistry.getInstance().register(type, spriteSet -> provider.create(new ExtendedSpriteSet() { + CompatRegistryClient.registerParticle(type, (spriteSet -> provider.create(new ExtendedSpriteSet() { @Override public TextureAtlas getAtlas() { return spriteSet.getAtlas(); @@ -67,8 +66,8 @@ public List getSprites() { } @Override - public TextureAtlasSprite get(int age, int maxAge) { - return spriteSet.get(age, maxAge); + public TextureAtlasSprite get(int index, int max) { + return spriteSet.get(index, max); } @Override @@ -80,7 +79,7 @@ public TextureAtlasSprite get(RandomSource random) { public TextureAtlasSprite first() { return spriteSet.first(); } - })); + }))); } public static void registerEntityRenderer(Supplier> type, EntityRendererProvider provider) { @@ -115,9 +114,7 @@ public static void registryClientSprite(Identifier atlasId, TextureAtlasSprite s } public static void registerBlockEntityRenderer(BlockEntityType type, BlockEntityRendererFactory provider) { - BlockEntityRenderers.register(type, ctx -> provider.create(new BlockEntityRendererFactory.Context( - ctx.blockEntityRenderDispatcher(), ctx.blockModelResolver(), ctx.itemModelResolver(), ctx.entityRenderer(), ctx.entityModelSet(), ctx.font() - ))); + CompatRegistryClient.registerBlockEntityRenderer(type, (ctx) -> provider.create(new BlockEntityRendererFactory.Context(ctx.getRenderDispatcher(), ctx.getRenderManager(), ctx.getItemModelManager(), ctx.getEntityRenderDispatcher(), ctx.getLayerRenderDispatcher(), ctx.getTextRenderer()))); } @FunctionalInterface From d7380f3e9374a459167765cd76ce9029546aaecd Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 18 Apr 2026 21:40:58 +0900 Subject: [PATCH 109/151] feat: implement CreativeModeTab event registration and refactor networking for NeoForge compatibility --- .../api/item/CreativeTabManager.java | 29 ++++---- .../api/network/ServerNetworking.java | 20 ++---- .../mc261/CreativeModeTabEventRegistry.java | 21 ++++++ .../core/mc261/ServerPlayNetworking.java | 25 +++++++ .../core/registry/FuelRegistry.java | 9 +-- .../CreativeModeTabEventRegistryImpl.java | 19 +++++ .../fabric/ServerPlayNetworkingImpl.java | 39 +++++++++++ .../registry/fabric/FuelRegistryImpl.java | 14 ++++ .../neoforge/CompatRegistryClientImpl.java | 5 +- .../neoforge/KeybindingRegistryImpl.java | 2 +- .../neoforge/ClientPlayNetworkingImpl.java | 24 ++++++- .../CreativeModeTabEventRegistryImpl.java | 42 +++++++++++ .../neoforge/ServerPlayNetworkingImpl.java | 69 +++++++++++++++++++ .../registry/neoforge/FuelRegistryImpl.java | 28 ++++++++ 14 files changed, 304 insertions(+), 42 deletions(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/mc261/CreativeModeTabEventRegistry.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ServerPlayNetworking.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/CreativeModeTabEventRegistryImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ServerPlayNetworkingImpl.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java index bfcc4ccc8..fe9069bc5 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabManager.java @@ -1,13 +1,14 @@ package net.pitan76.mcpitanlib.api.item; -import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.resources.Identifier; -import net.pitan76.mcpitanlib.api.util.ItemUtil; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.item.ItemGroupUtil; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; +import net.pitan76.mcpitanlib.core.mc261.CreativeModeTabEventRegistry; import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; import java.util.ArrayList; @@ -74,8 +75,7 @@ public CreativeModeTab getItemGroup() { public static void allRegister() { if (!MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.isEmpty()) { for (Map.Entry, List> entry : MCPLRegistry1_20.ITEM_GROUP_ITEM_ID_CACHE.entrySet()) { - CreativeModeTabEvents.modifyOutputEvent(entry.getKey()).register(entries -> - entries.acceptAll(entry.getValue().stream().map(id -> new ItemStack(ItemUtil.fromId(id))).toList())); + CreativeModeTabEventRegistry.addStacks(entry.getKey(), () -> entry.getValue().stream().map(id -> new ItemStack(ItemUtil.fromId(CompatIdentifier.fromMinecraft(id)))).toList()); } } @@ -83,9 +83,10 @@ public static void allRegister() { for (BookingItem bookingItem : bookingItems) { // CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, ItemGroupUtil.toID(bookingItem.getItemGroup())); - CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { - entries.accept(new ItemStack(ItemUtil.fromId(bookingItem.identifier))); - }); + CreativeModeTabEventRegistry.addStack(key, () -> new ItemStack(ItemUtil.fromId(CompatIdentifier.fromMinecraft(bookingItem.identifier)))); +// CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { +// entries.accept(new ItemStack(ItemUtil.fromId(bookingItem.identifier))); +// }); } bookingItems = new ArrayList<>(); } @@ -94,9 +95,10 @@ public static void allRegister() { for (BookingStack bookingStack : bookingStacks) { // CreativeTabRegistry.appendBuiltinStack(bookingStack.getItemGroup(), bookingStack.stack); ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, ItemGroupUtil.toID(bookingStack.getItemGroup())); - CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { - entries.accept(bookingStack.stack); - }); + CreativeModeTabEventRegistry.addStack(key, () -> bookingStack.stack); +// CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { +// entries.accept(bookingStack.stack); +// }); } bookingStacks = new ArrayList<>(); } @@ -108,9 +110,10 @@ public static void register(Identifier identifier) { if (!bookingItem.identifier.toString().equals(identifier.toString())) continue; // CreativeTabRegistry.appendBuiltin(bookingItem.getItemGroup(), ItemUtil.fromId(bookingItem.identifier)); ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, ItemGroupUtil.toID(bookingItem.getItemGroup())); - CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { - entries.accept(new ItemStack(ItemUtil.fromId(bookingItem.identifier))); - }); + CreativeModeTabEventRegistry.addStack(key, () -> new ItemStack(ItemUtil.fromId(CompatIdentifier.fromMinecraft(bookingItem.identifier)))); +// CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> { +// entries.accept(new ItemStack(ItemUtil.fromId(bookingItem.identifier))); +// }); bookingItems.remove(bookingItem); break; } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java index 9264a4ad8..e2763152a 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/network/ServerNetworking.java @@ -1,12 +1,10 @@ package net.pitan76.mcpitanlib.api.network; -import io.netty.buffer.Unpooled; -import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.core.mc261.ServerPlayNetworking; import net.pitan76.mcpitanlib.core.network.BufPayload; import java.util.ArrayList; @@ -37,14 +35,8 @@ public static void registerReceiver(Identifier identifier, ServerNetworkHandler registerS2CPayloadType(identifier); BufPayload.Type id = BufPayload.id(identifier); - ServerPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { - FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); - - ServerPlayer player = null; - if (context.player() instanceof ServerPlayer) - player = context.player(); - - handler.receive(context.player().level().getServer(), player, buf); + ServerPlayNetworking.registerGlobalReceiver(id, (server, player, buf) -> { + handler.receive(server, player, buf); buf.release(); }); } @@ -52,11 +44,7 @@ public static void registerReceiver(Identifier identifier, ServerNetworkHandler private static final List registeredList = new ArrayList<>(); public static void registerS2CPayloadType(Identifier identifier) { - if (registeredList.contains(identifier)) return; - registeredList.add(identifier); - - BufPayload.Type id = BufPayload.id(identifier); - PayloadTypeRegistry.serverboundPlay().register(id, BufPayload.getCodec(id)); + ServerPlayNetworking.registerS2CPayloadType(identifier); } @FunctionalInterface diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/CreativeModeTabEventRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/CreativeModeTabEventRegistry.java new file mode 100644 index 000000000..98af67a7d --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/CreativeModeTabEventRegistry.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.core.mc261; + +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; + +import java.util.List; +import java.util.function.Supplier; + +public class CreativeModeTabEventRegistry { + @ExpectPlatform + public static void addStack(ResourceKey key, Supplier supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static void addStacks(ResourceKey key, Supplier> supplier) { + throw new AssertionError(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ServerPlayNetworking.java b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ServerPlayNetworking.java new file mode 100644 index 000000000..4587eb0ef --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/mc261/ServerPlayNetworking.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.core.mc261; + +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerPlayer; +import net.pitan76.mcpitanlib.api.network.ServerNetworking; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +public class ServerPlayNetworking { + @ExpectPlatform + public static void send(ServerPlayer player, CustomPacketPayload payload) { + + } + + @ExpectPlatform + public static void registerGlobalReceiver(CustomPacketPayload.Type id, ServerNetworking.ServerNetworkHandler handler) { + + } + + @ExpectPlatform + public static void registerS2CPayloadType(Identifier identifier) { + + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java index edc318578..72b62330e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.core.registry; -import net.fabricmc.fabric.api.registry.FuelValueEvents; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.level.ItemLike; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -10,12 +10,9 @@ private FuelRegistry() { } + @ExpectPlatform public static void register(int time, ItemLike... item) { - FuelValueEvents.BUILD.register(((builder, context) -> { - for (ItemLike i : item) { - builder.add(i.asItem(), context.baseSmeltTime() * time); - } - })); + } @Deprecated diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/CreativeModeTabEventRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/CreativeModeTabEventRegistryImpl.java new file mode 100644 index 000000000..3aa7f09f3 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/CreativeModeTabEventRegistryImpl.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.core.mc261.fabric; + +import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; + +import java.util.List; +import java.util.function.Supplier; + +public class CreativeModeTabEventRegistryImpl { + public static void addStack(ResourceKey key, Supplier supplier) { + CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> entries.accept(supplier.get())); + } + + public static void addStacks(ResourceKey key, Supplier> supplier) { + CreativeModeTabEvents.modifyOutputEvent(key).register(entries -> entries.acceptAll(supplier.get())); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ServerPlayNetworkingImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ServerPlayNetworkingImpl.java new file mode 100644 index 000000000..4efffea06 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/core/mc261/fabric/ServerPlayNetworkingImpl.java @@ -0,0 +1,39 @@ +package net.pitan76.mcpitanlib.core.mc261.fabric; + +import io.netty.buffer.Unpooled; +import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; +import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerPlayer; +import net.pitan76.mcpitanlib.api.network.ServerNetworking; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +import java.util.ArrayList; +import java.util.List; + +public class ServerPlayNetworkingImpl { + + public static void send(ServerPlayer player, CustomPacketPayload payload) { + ServerPlayNetworking.send(player, payload); + } + + public static void registerGlobalReceiver(CustomPacketPayload.Type id, ServerNetworking.ServerNetworkHandler handler) { + ServerPlayNetworking.registerGlobalReceiver(id, (payload, context) -> { + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); + handler.receive(context.server(), context.player(), buf); + buf.release(); + }); + } + + private static final List registeredList = new ArrayList<>(); + + public static void registerS2CPayloadType(Identifier identifier) { + if (registeredList.contains(identifier)) return; + registeredList.add(identifier); + + BufPayload.Type id = BufPayload.id(identifier); + PayloadTypeRegistry.serverboundPlay().register(id, BufPayload.getCodec(id)); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java new file mode 100644 index 000000000..6b8c11c1b --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.core.registry.fabric; + +import net.fabricmc.fabric.api.registry.FuelValueEvents; +import net.minecraft.world.level.ItemLike; + +public class FuelRegistryImpl { + public static void register(int time, ItemLike... item) { + FuelValueEvents.BUILD.register(((builder, context) -> { + for (ItemLike i : item) { + builder.add(i.asItem(), context.baseSmeltTime() * time); + } + })); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java index 1a9f9c5e1..5a25bd562 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/CompatRegistryClientImpl.java @@ -36,7 +36,6 @@ @EventBusSubscriber(modid = "mcpitanlib", value = Dist.CLIENT) public class CompatRegistryClientImpl { - // ジェネリクス地獄を避けるため、「イベントが来たら実行する処理」をそのままListに溜め込みます private static final List> screenRegistrations = new ArrayList<>(); private static final List> particleRegistrations = new ArrayList<>(); private static final List> layerRegistrations = new ArrayList<>(); @@ -44,8 +43,6 @@ public class CompatRegistryClientImpl { public static Map, Block[]> blockColorProviders = new HashMap<>(); - // --- 登録メソッド(Listへの追加処理に変更) --- - public static > void registerScreen(String modId, MenuType type, CompatRegistryClient.ScreenFactory factory) { screenRegistrations.add(event -> event.register(type, factory::create)); } @@ -84,7 +81,7 @@ public static void registerBlockEntityRenderer(BlockEnti } public static void registerCompatBlockEntityRenderer(BlockEntityType type, CompatRegistryClient.BlockEntityRendererFactory provider) { - registerBlockEntityRenderer(type, provider); // 上と同じ処理に回す + registerBlockEntityRenderer(type, provider); } public static void registerColorProviderBlock(List provider, Block... blocks) { diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java index 0af3944dd..cca48c33b 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/registry/neoforge/KeybindingRegistryImpl.java @@ -9,7 +9,7 @@ import java.util.ArrayList; import java.util.List; -@EventBusSubscriber(modid = "mcpitanlib",value = Dist.CLIENT) +@EventBusSubscriber(modid = "mcpitanlib", value = Dist.CLIENT) public class KeybindingRegistryImpl { private static final List keyMappings = new ArrayList<>(); diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java index 55871a0e2..8fe9fbba6 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java @@ -6,18 +6,21 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.Identifier; +import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.client.network.ClientPacketDistributor; import net.neoforged.neoforge.client.network.event.RegisterClientPayloadHandlersEvent; +import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent; import net.neoforged.neoforge.network.handling.IPayloadHandler; +import net.neoforged.neoforge.network.registration.PayloadRegistrar; import net.pitan76.mcpitanlib.api.network.ClientNetworking; import net.pitan76.mcpitanlib.core.network.BufPayload; import java.util.HashMap; import java.util.Map; -@EventBusSubscriber(modid = "mcpitanlib") +@EventBusSubscriber(modid = "mcpitanlib", value = Dist.CLIENT) public class ClientPlayNetworkingImpl { public static void send(CustomPacketPayload payload) { ClientPacketDistributor.sendToServer(payload); @@ -40,9 +43,10 @@ public static void registerGlobalReceiver(BufPayload.Type type, Clie private static final Map> payloadTypeMap = new HashMap<>(); + public static void registerC2SPayloadType(Identifier identifier) { BufPayload.Type id = BufPayload.id(identifier); -// PayloadTypeRegistry.clientboundPlay().register(id, BufPayload.getCodec(id)); + if (payloadTypeMap.containsKey(identifier)) return; payloadTypeMap.put(identifier, id); } @@ -52,4 +56,20 @@ public static void register(RegisterClientPayloadHandlersEvent event) { event.register(entry.getKey(), entry.getValue()); } } + + @SubscribeEvent + public static void registerPayloads(RegisterPayloadHandlersEvent event) { + final PayloadRegistrar registrar = event.registrar("1"); + + payloadTypeMap.forEach((_, type) -> { + registrar.playToClient(type, BufPayload.getCodec(type), handlerMap.get(type)); + }); + + // ダミー + payloadTypeMap.forEach((_, type) -> { + if (!handlerMap.containsKey(type)) { + registrar.playToServer(type, BufPayload.getCodec(type), (_, _) -> {}); + } + }); + } } diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java new file mode 100644 index 000000000..a0263235f --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.core.mc261.neoforge; + +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; +import java.util.function.Supplier; + +@EventBusSubscriber(modid = "mcpitanlib") +public class CreativeModeTabEventRegistryImpl { + + private static final List> tabModifiers = new ArrayList<>(); + + public static void addStack(ResourceKey key, Supplier supplier) { + tabModifiers.add(event -> { + if (event.getTabKey() == key) { + event.accept(supplier.get()); + } + }); + } + + public static void addStacks(ResourceKey key, Supplier> supplier) { + tabModifiers.add(event -> { + if (event.getTabKey() == key) { + event.acceptAll(supplier.get()); + } + }); + } + + @SubscribeEvent + public static void onBuildCreativeTabContents(BuildCreativeModeTabContentsEvent event) { + for (Consumer modifier : tabModifiers) { + modifier.accept(event); + } + } +} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java new file mode 100644 index 000000000..f7ee9074c --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java @@ -0,0 +1,69 @@ +package net.pitan76.mcpitanlib.core.mc261.neoforge; + +import io.netty.buffer.Unpooled; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.Identifier; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.network.PacketDistributor; +import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent; +import net.neoforged.neoforge.network.handling.IPayloadHandler; +import net.neoforged.neoforge.network.registration.PayloadRegistrar; +import net.pitan76.mcpitanlib.api.network.ServerNetworking; +import net.pitan76.mcpitanlib.core.network.BufPayload; + +import java.util.HashMap; +import java.util.Map; + +@EventBusSubscriber(modid = "mcpitanlib") +public class ServerPlayNetworkingImpl { + + public static void send(ServerPlayer player, CustomPacketPayload payload) { + PacketDistributor.sendToPlayer(player, payload); + } + + private static final Map, IPayloadHandler> handlerMap = new HashMap<>(); + private static final Map> payloadTypeMap = new HashMap<>(); + + public static void registerGlobalReceiver(CustomPacketPayload.Type id, ServerNetworking.ServerNetworkHandler handler) { + handlerMap.put(id, (payload, context) -> { + FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(payload.getData())); + + ServerPlayer player = null; + MinecraftServer server = null; + if (context.player() instanceof ServerPlayer serverPlayer) { + player = serverPlayer; + server = serverPlayer.level().getServer(); + } + + handler.receive(server, player, buf); + + buf.release(); + }); + } + + public static void registerS2CPayloadType(Identifier identifier) { + if (payloadTypeMap.containsKey(identifier)) return; + BufPayload.Type id = BufPayload.id(identifier); + payloadTypeMap.put(identifier, id); + } + + @SubscribeEvent + public static void registerPayloads(RegisterPayloadHandlersEvent event) { + final PayloadRegistrar registrar = event.registrar("1"); + + handlerMap.forEach((type, handler) -> { + registrar.playToServer(type, BufPayload.getCodec(type), handler); + }); + + // ダミー + payloadTypeMap.forEach((_, type) -> { + if (!handlerMap.containsKey(type)) { + registrar.playToClient(type, BufPayload.getCodec(type), (_, _) -> {}); + } + }); + } +} \ No newline at end of file diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java new file mode 100644 index 000000000..e2d95ed3c --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java @@ -0,0 +1,28 @@ +package net.pitan76.mcpitanlib.core.registry.neoforge; + +import net.minecraft.world.item.Item; +import net.minecraft.world.level.ItemLike; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.furnace.FurnaceFuelBurnTimeEvent; + +import java.util.HashMap; +import java.util.Map; + +@EventBusSubscriber(modid = "mcpitanlib") +public class FuelRegistryImpl { + private static final Map FUEL_TIMES = new HashMap<>(); + + public static void register(int time, ItemLike... items) { + int burnTimeTicks = 200 * time; + for (ItemLike itemLike : items) { + FUEL_TIMES.put(itemLike.asItem(), burnTimeTicks); + } + } + + @SubscribeEvent + public static void onFurnaceFuelBurnTime(FurnaceFuelBurnTimeEvent event) { + Item item = event.getItemStack().getItem(); + if (FUEL_TIMES.containsKey(item)) event.setBurnTime(FUEL_TIMES.get(item)); + } +} \ No newline at end of file From 6d25e76b769d62feb6f02d480c5524159629bbec Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:00:51 +0900 Subject: [PATCH 110/151] update compatdatapacks76 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 976cf57c3..1787c8f04 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ neoforge_version=26.1.0.1-beta cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ -compatdatapacks76_version=1.0.16.261-SNAPSHOT +compatdatapacks76_version=1.0.17.261-SNAPSHOT legacyitemmodels_version=1.0.2.261 littleobffallback_version=0.4.1.261-SNAPSHOT From 7ac311c5b3f631a98db043761e645d983afb34c5 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:13:36 +0900 Subject: [PATCH 111/151] refactor: update method names and imports for consistency with Fabric API --- .../event/fabric/WorldRenderRegistryImpl.java | 137 ------------------ .../api/tile/RenderAttachmentBlockEntity.java | 2 +- .../fabric/RenderDataBlockEntityImpl.java | 2 +- .../fluid/v1/fabric/FabricFluidStorage.java | 4 +- .../neoforge/WorldRenderRegistryImpl.java | 68 ++++----- 5 files changed, 34 insertions(+), 179 deletions(-) delete mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/WorldRenderRegistryImpl.java diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/WorldRenderRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/WorldRenderRegistryImpl.java deleted file mode 100644 index 866fe1109..000000000 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/client/event/fabric/WorldRenderRegistryImpl.java +++ /dev/null @@ -1,137 +0,0 @@ -package net.pitan76.mcpitanlib.api.client.event.fabric; - -import net.fabricmc.fabric.api.client.rendering.v1.world.WorldRenderEvents; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; -import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineEvent; -import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineListener; -import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContext; -import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContextListener; -import net.pitan76.mcpitanlib.api.util.client.ClientUtil; -import org.jetbrains.annotations.Nullable; -import org.joml.Matrix4f; - -public class WorldRenderRegistryImpl { - public static void _registerWorldRenderBeforeBlockOutline(BeforeBlockOutlineListener listener) { - WorldRenderEvents.BEFORE_BLOCK_OUTLINE.register(((worldRenderContext, renderState) -> listener.beforeBlockOutline(new BeforeBlockOutlineEvent( - new WorldRenderContext() { - @Override - public WorldRenderer getWorldRenderer() { - return worldRenderContext.worldRenderer(); - } - - @Override - public MatrixStack getMatrixStack() { - return worldRenderContext.matrices(); - } - - @Override - public float getTickDelta() { - return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); - } - - @Override - public Camera getCamera() { - return worldRenderContext.gameRenderer().getCamera(); - } - - @Override - public GameRenderer getGameRenderer() { - return worldRenderContext.gameRenderer(); - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return getGameRenderer().getLightmapTextureManager(); - } - - @Override - public Matrix4f getProjectionMatrix() { - return worldRenderContext.gameRenderer().getBasicProjectionMatrix(0); - } - - @Override - public ClientWorld getWorld() { - return ClientUtil.getWorld(); - } - - @Override - public boolean isAdvancedTranslucency() { - return renderState.isTranslucent(); - } - - @Override - public VertexConsumerProvider getConsumers() { - return worldRenderContext.consumers(); - } - - @Override - public Frustum getFrustum() { - return worldRenderContext.worldRenderer().getCapturedFrustum(); - } - }, renderState)))); - } - - public static void _registerWorldRenderAfterLevel(WorldRenderContextListener listener) { - WorldRenderEvents.END_MAIN.register((context -> { - listener.render(new WorldRenderContext() { - @Override - public WorldRenderer getWorldRenderer() { - return context.worldRenderer(); - } - - @Override - public MatrixStack getMatrixStack() { - return context.matrices(); - } - - @Override - public float getTickDelta() { - return MinecraftClient.getInstance().getRenderTickCounter().getDynamicDeltaTicks(); - } - - @Override - public Camera getCamera() { - return context.gameRenderer().getCamera(); - } - - @Override - public GameRenderer getGameRenderer() { - return context.gameRenderer(); - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return getGameRenderer().getLightmapTextureManager(); - } - - @Override - public Matrix4f getProjectionMatrix() { - return context.gameRenderer().getBasicProjectionMatrix(0); - } - - @Override - public ClientWorld getWorld() { - return ClientUtil.getWorld(); - } - - @Override - public boolean isAdvancedTranslucency() { - return true; - } - - @Override - public @Nullable VertexConsumerProvider getConsumers() { - return context.consumers(); - } - - @Override - public @Nullable Frustum getFrustum() { - return context.worldRenderer().getCapturedFrustum(); - } - }); - })); - } -} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java index 94bf987ba..4a782142f 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/RenderAttachmentBlockEntity.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.tile; -import net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity; +import net.fabricmc.fabric.api.blockgetter.v2.RenderDataBlockEntity; import org.jetbrains.annotations.Nullable; public interface RenderAttachmentBlockEntity extends RenderDataBlockEntity { diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/RenderDataBlockEntityImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/RenderDataBlockEntityImpl.java index 45966b733..11763ed2a 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/RenderDataBlockEntityImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/tile/fabric/RenderDataBlockEntityImpl.java @@ -1,6 +1,6 @@ package net.pitan76.mcpitanlib.api.tile.fabric; -import net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity; +import net.fabricmc.fabric.api.blockgetter.v2.RenderDataBlockEntity; @Deprecated public interface RenderDataBlockEntityImpl extends RenderDataBlockEntity { diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidStorage.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidStorage.java index c42266ec7..8c9bdf68e 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidStorage.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/transfer/fluid/v1/fabric/FabricFluidStorage.java @@ -68,12 +68,12 @@ public long extract(IFluidVariant variant, long maxAmount, boolean simulate) { @Override public void writeNbt(WriteNbtArgs args) { - storage.writeData(args.view); + storage.writeValue(args.view); } @Override public void readNbt(ReadNbtArgs args) { - storage.readData(args.view); + storage.readValue(args.view); } } diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java index 0ad42f08c..d2265f2cf 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/client/event/neoforge/WorldRenderRegistryImpl.java @@ -1,17 +1,20 @@ package net.pitan76.mcpitanlib.api.client.event.neoforge; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Camera; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.culling.Frustum; import net.neoforged.neoforge.client.event.ExtractBlockOutlineRenderStateEvent; -import net.neoforged.neoforge.client.event.RenderFrameEvent; import net.neoforged.neoforge.client.event.RenderLevelStageEvent; import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineEvent; import net.pitan76.mcpitanlib.api.client.event.listener.BeforeBlockOutlineListener; import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContext; import net.pitan76.mcpitanlib.api.client.event.listener.WorldRenderContextListener; import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import java.util.ArrayList; @@ -26,18 +29,18 @@ public static void renderOutlineEventBlock(ExtractBlockOutlineRenderStateEvent e for (BeforeBlockOutlineListener listener : beforeBlockOutlineListeners) { boolean eventContinue = listener.beforeBlockOutline(new BeforeBlockOutlineEvent(new WorldRenderContext() { @Override - public WorldRenderer getWorldRenderer() { + public LevelRenderer getWorldRenderer() { return event.getLevelRenderer(); } @Override - public MatrixStack getMatrixStack() { - return new MatrixStack(); + public PoseStack getMatrixStack() { + return new PoseStack(); } @Override public float getTickDelta() { - return ClientUtil.getClient().getRenderTickCounter().getDynamicDeltaTicks(); + return ClientUtil.getClient().getDeltaTracker().getGameTimeDeltaTicks(); } @Override @@ -47,12 +50,7 @@ public Camera getCamera() { @Override public GameRenderer getGameRenderer() { - return MinecraftClient.getInstance().gameRenderer; - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); + return ClientUtil.getClient().gameRenderer; } @Deprecated @@ -62,8 +60,8 @@ public Matrix4f getProjectionMatrix() { } @Override - public ClientWorld getWorld() { - return MinecraftClient.getInstance().world; + public ClientLevel getWorld() { + return ClientUtil.getClient().level; } @Deprecated @@ -73,15 +71,15 @@ public boolean isAdvancedTranslucency() { } @Override - public VertexConsumerProvider getConsumers() { - return ClientUtil.getClient().getBufferBuilders().getOutlineVertexConsumers(); + public @Nullable MultiBufferSource getConsumers() { + return ClientUtil.getClient().renderBuffers().bufferSource(); } @Override public Frustum getFrustum() { - return event.getLevelRenderer().getCapturedFrustum(); + return ClientUtil.getClient().gameRenderer.getMainCamera().getCapturedFrustum(); } - }, event.getLevelRenderState().outlineRenderState)); + }, event.getLevelRenderState().blockOutlineRenderState)); if (!eventContinue) { event.setCanceled(true); @@ -157,12 +155,12 @@ public static void renderLevelStageEvent(RenderLevelStageEvent.AfterLevel event) for (WorldRenderContextListener listener : worldRenderAfterLevelListeners) { listener.render(new WorldRenderContext() { @Override - public WorldRenderer getWorldRenderer() { + public LevelRenderer getWorldRenderer() { return event.getLevelRenderer(); } @Override - public MatrixStack getMatrixStack() { + public PoseStack getMatrixStack() { return event.getPoseStack(); } @@ -173,44 +171,38 @@ public float getTickDelta() { @Override public Camera getCamera() { - return MinecraftClient.getInstance().gameRenderer.getCamera(); + return ClientUtil.getGameRenderer().getMainCamera(); } @Override public GameRenderer getGameRenderer() { - return MinecraftClient.getInstance().gameRenderer; - } - - @Override - public LightmapTextureManager getLightmapTextureManager() { - return MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager(); + return ClientUtil.getGameRenderer(); } - @Deprecated @Override public Matrix4f getProjectionMatrix() { - return event.getModelViewMatrix(); + return null; } @Override - public ClientWorld getWorld() { - return MinecraftClient.getInstance().world; + public ClientLevel getWorld() { + return ClientUtil.getWorld(); } @Deprecated @Override public boolean isAdvancedTranslucency() { - return event.getLevelRenderer().isTerrainRenderComplete(); + return false; } @Override - public VertexConsumerProvider getConsumers() { - return MinecraftClient.getInstance().getBufferBuilders().getOutlineVertexConsumers(); + public @Nullable MultiBufferSource getConsumers() { + return ClientUtil.getClient().renderBuffers().bufferSource(); } @Override public Frustum getFrustum() { - return event.getLevelRenderer().getCapturedFrustum(); + return ClientUtil.getGameRenderer().getMainCamera().getCapturedFrustum(); } }); } From 477e5534e249dac168e628c2960fc9f2b9dac376 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:21:18 +0900 Subject: [PATCH 112/151] gradle --- fabric/build.gradle | 6 ++---- neoforge/build.gradle | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/fabric/build.gradle b/fabric/build.gradle index 713062052..4c09c933a 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -96,10 +96,8 @@ sourcesJar { from commonSources.archiveFile.map { zipTree(it) } } -components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } +shadow { + addShadowVariantIntoJavaComponent = false } publishing { diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 8e56aff0f..aaaf0d7a2 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -76,10 +76,8 @@ sourcesJar { from commonSources.archiveFile.map { zipTree(it) } } -components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } +shadow { + addShadowVariantIntoJavaComponent = false } publishing { From 9cac7b4988bb0f29ab02224ff2b9ee8945f0acd5 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:30:17 +0900 Subject: [PATCH 113/151] gradle --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1787c8f04..81a7e29aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.17.261-SNAPSHOT -legacyitemmodels_version=1.0.2.261 +legacyitemmodels_version=1.0.3.261-SNAPSHOT littleobffallback_version=0.4.1.261-SNAPSHOT fabricEnabled=true From 890d812e416702e84a2f846709be9f6fb803cde8 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:32:26 +0900 Subject: [PATCH 114/151] gradle --- fabric/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fabric/build.gradle b/fabric/build.gradle index 4c09c933a..13869abe0 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -84,6 +84,8 @@ shadowJar { configurations = [project.configurations.shadowCommon] archiveClassifier.set(null) + + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } jar { From a779961bf2264562c0e5539b0486d1dd19f8b02f Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:35:10 +0900 Subject: [PATCH 115/151] fix --- common/src/main/resources/fabric.mod.json | 40 ------------------- fabric/build.gradle | 2 - .../neoforge/MCPitanLibNeoForge.java | 4 +- 3 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 common/src/main/resources/fabric.mod.json diff --git a/common/src/main/resources/fabric.mod.json b/common/src/main/resources/fabric.mod.json deleted file mode 100644 index 9e5722dff..000000000 --- a/common/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "schemaVersion": 1, - "id": "mcpitanlib", - "version": "${version}", - "name": "MCPitanLib", - "description": "Pitan's Minecraft Mod Library", - "authors": [ - "Pitan" - ], - "contact": { - "website": "https://www.curseforge.com/minecraft/mc-mods/mcpitanlibarch", - "repo": "https://github.com/Pitan76/MCPitanLib", - "issues": "https://github.com/Pitan76/MCPitanLib/issue" - }, - "license": "MIT", - "icon": "icon.png", - "environment": "*", - "entrypoints": { - "main": [ - "net.pitan76.mcpitanlib.fabric.MCPitanLibFabric" - ] - }, - "provides": [ - "mcpitanlibarch", - "mcpitanlib-impl" - ], - "custom": { - "modmenu": { - "badges": ["library"] - } - }, - "mixins": [ - "mcpitanlib-common.mixins.json" - ], - "accessWidener": "mcpitanlib.accesswidener", - "depends": { - "minecraft": ">=26", - "fabricloader": "*" - } -} diff --git a/fabric/build.gradle b/fabric/build.gradle index 13869abe0..4c09c933a 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -84,8 +84,6 @@ shadowJar { configurations = [project.configurations.shadowCommon] archiveClassifier.set(null) - - duplicatesStrategy = DuplicatesStrategy.EXCLUDE } jar { diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java index 33374d614..bcac9c522 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java @@ -19,9 +19,7 @@ public MCPitanLibNeoForge(ModContainer modContainer) { // TODO: re-implement outline rendering event // nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEventBlock); // nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEvent); - nfBus.addListener(WorldRenderRegistryImpl::renderLevelStageEvent); - if (bus != null) - bus.addListener(CompatRegistryClientImpl::registerBlockColors); +// nfBus.addListener(WorldRenderRegistryImpl::renderLevelStageEvent); } MCPitanLib.init(); From 6dc0f990935b20159a78439fb27c1282b292180e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:36:10 +0900 Subject: [PATCH 116/151] fix --- .../neoforge/MCPitanLibNeoForge.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java index bcac9c522..db0224277 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/neoforge/MCPitanLibNeoForge.java @@ -1,26 +1,21 @@ package net.pitan76.mcpitanlib.neoforge; -import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.common.NeoForge; import net.pitan76.mcpitanlib.MCPitanLib; -import net.pitan76.mcpitanlib.api.client.event.neoforge.WorldRenderRegistryImpl; -import net.pitan76.mcpitanlib.api.client.registry.neoforge.CompatRegistryClientImpl; -import net.pitan76.mcpitanlib.api.util.PlatformUtil; @Mod(MCPitanLib.MOD_ID) public class MCPitanLibNeoForge { public MCPitanLibNeoForge(ModContainer modContainer) { - IEventBus bus = modContainer.getEventBus(); - - if (PlatformUtil.isClient()) { - IEventBus nfBus = NeoForge.EVENT_BUS; - // TODO: re-implement outline rendering event -// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEventBlock); -// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEvent); -// nfBus.addListener(WorldRenderRegistryImpl::renderLevelStageEvent); - } +// IEventBus bus = modContainer.getEventBus(); +// +// if (PlatformUtil.isClient()) { +// IEventBus nfBus = NeoForge.EVENT_BUS; +// // TODO: re-implement outline rendering event +//// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEventBlock); +//// nfBus.addListener(WorldRenderRegistryImpl::renderOutlineEvent); +//// nfBus.addListener(WorldRenderRegistryImpl::renderLevelStageEvent); +// } MCPitanLib.init(); } From 1acdfdfeb9f17d3b4272baa74bb4b7f52274e57a Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:39:35 +0900 Subject: [PATCH 117/151] info --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index eb9d90ac9..0ce686da1 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib mod_version=3.6.5 maven_group=net.pitan76 -changelog=Update littleobffallback & add APIs +changelog=add APIs \ No newline at end of file From aa4a61871611f70d9923e21bce8f03745f60c181 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 12:40:00 +0900 Subject: [PATCH 118/151] [cp] bump version 3.6.6 --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 0ce686da1..0ac92740e 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.5 +mod_version=3.6.6 maven_group=net.pitan76 changelog=add APIs \ No newline at end of file From 30bcdf8efbbd67bdd16d5a3611e2dfbf14d95296 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 13:08:05 +0900 Subject: [PATCH 119/151] add support for Supplier wrappers in Typed*Wrapper classes and enhance CreativeTabBuilder with icon setting methods --- .../api/item/CreativeTabBuilder.java | 30 +++++++++++++++++++ .../midohra/block/TypedBlockWrapper.java | 5 ++++ .../entity/TypedBlockEntityTypeWrapper.java | 5 ++++ .../block/entity/TypedBlockEntityWrapper.java | 5 ++++ .../entity/TypedEntityTypeWrapper.java | 5 ++++ .../midohra/item/TypedItemWrapper.java | 5 ++++ 6 files changed, 55 insertions(+) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java index 8020af0cb..a009ed1e2 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java @@ -11,6 +11,8 @@ import net.pitan76.mcpitanlib.api.util.TextUtil; import net.pitan76.mcpitanlib.core.registry.MCPLRegistry1_20; import net.pitan76.mcpitanlib.midohra.item.ItemGroupWrapper; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.item.SupplierItemWrapper; import java.util.function.Supplier; @@ -105,4 +107,32 @@ public Identifier getIdentifier() { public CompatIdentifier getCompatIdentifier() { return CompatIdentifier.fromMinecraft(identifier); } + + /** + * Set icon + * @param iconSupplier Icon supplier + * @return CreativeTabBuilder + */ + public CreativeTabBuilder setIconM(Supplier iconSupplier) { + this.iconSupplier = () -> iconSupplier.get().toMinecraft(); + return this; + } + + /** + * Set icon (Already registered item only) + * @param item Item + * @return CreativeTabBuilder + */ + public CreativeTabBuilder setIcon(ItemWrapper item) { + return setIcon(() -> item.createStack().toMinecraft()); + } + + /** + * Set icon (Already registered item only) + * @param item Item + * @return CreativeTabBuilder + */ + public CreativeTabBuilder setIcon(SupplierItemWrapper item) { + return setIcon(() -> item.createStack().toMinecraft()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java index da5ab6ae5..09d00338d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java @@ -12,6 +12,11 @@ public static TypedBlockWrapper ofRaw(T item) { } public static TypedBlockWrapper of(BlockWrapper wrapper) { + if (wrapper instanceof SupplierBlockWrapper) { + SupplierBlockWrapper supplierWrapper = (SupplierBlockWrapper) wrapper; + return SupplierTypedBlockWrapper.of(supplierWrapper); + } + return new TypedBlockWrapper<>((T) wrapper.get()); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java index d492cc9be..26d0a7f3d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityTypeWrapper.java @@ -16,6 +16,11 @@ public static TypedBlockEntityTypeWrapper ofRaw(Block } public static TypedBlockEntityTypeWrapper of(BlockEntityTypeWrapper wrapper) { + if (wrapper instanceof SupplierBlockEntityTypeWrapper) { + SupplierBlockEntityTypeWrapper supplierWrapper = (SupplierBlockEntityTypeWrapper) wrapper; + return SupplierTypedBlockEntityTypeWrapper.of(supplierWrapper); + } + return new TypedBlockEntityTypeWrapper<>((BlockEntityType) wrapper.get()); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java index 9e8c37bdb..056796e36 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/TypedBlockEntityWrapper.java @@ -12,6 +12,11 @@ public static TypedBlockEntityWrapper ofRaw(T blockEn } public static TypedBlockEntityWrapper of(BlockEntityWrapper wrapper) { + if (wrapper instanceof SupplierBlockEntityWrapper) { + SupplierBlockEntityWrapper supplierWrapper = (SupplierBlockEntityWrapper) wrapper; + return SupplierTypedBlockEntityWrapper.of(supplierWrapper); + } + return new TypedBlockEntityWrapper<>((T) wrapper.get()); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java index 930f3f110..9e89a8d6d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/TypedEntityTypeWrapper.java @@ -18,6 +18,11 @@ public static TypedEntityTypeWrapper ofRaw(EntityType t } public static TypedEntityTypeWrapper of(EntityTypeWrapper wrapper) { + if (wrapper instanceof SupplierEntityTypeWrapper) { + SupplierEntityTypeWrapper supplierWrapper = (SupplierEntityTypeWrapper) wrapper; + return SupplierTypedEntityTypeWrapper.of(supplierWrapper); + } + return new TypedEntityTypeWrapper<>((EntityType) wrapper.get()); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java index 823f0ef3d..6fcccd5bc 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedItemWrapper.java @@ -16,6 +16,11 @@ public static TypedItemWrapper ofRaw(T item) { } public static TypedItemWrapper of(ItemWrapper wrapper) { + if (wrapper instanceof SupplierItemWrapper) { + SupplierItemWrapper supplierWrapper = (SupplierItemWrapper) wrapper; + return SupplierTypedItemWrapper.of(supplierWrapper); + } + return new TypedItemWrapper<>((T) wrapper.get()); } From 95543261d43a3b744c0f1571f2868fb6c6447707 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 16:24:16 +0900 Subject: [PATCH 120/151] [cp] add setDisplayName method to CreativeTabBuilder for improved text handling --- .../net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java index a009ed1e2..9f9601c58 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/CreativeTabBuilder.java @@ -6,6 +6,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.IdentifierUtil; import net.pitan76.mcpitanlib.api.util.TextUtil; @@ -135,4 +136,8 @@ public CreativeTabBuilder setIcon(ItemWrapper item) { public CreativeTabBuilder setIcon(SupplierItemWrapper item) { return setIcon(() -> item.createStack().toMinecraft()); } + + public CreativeTabBuilder setDisplayName(TextComponent text) { + return setDisplayName(text.getText()); + } } From 01ea628df3b7fc272f4ac5e496c027d64e491789 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 17:05:32 +0900 Subject: [PATCH 121/151] [cp] add constructors and utility methods to enhance compatibility and shape handling in various classes --- .../mcpitanlib/api/entity/CompatEntity.java | 5 ++++ .../api/entity/CompatThrownItemEntity.java | 5 ++++ .../api/event/block/BlockUseEvent.java | 4 +++ .../api/event/block/TileCreateEvent.java | 22 ++++++++++++++++ .../api/tile/CompatBlockEntity.java | 5 ++++ .../midohra/util/shape/VoxelShape.java | 26 +++++++++++++++++++ .../mcpitanlib/midohra/world/WorldAccess.java | 4 +++ 7 files changed, 71 insertions(+) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java index 6b99202db..6236e6eba 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java @@ -17,6 +17,7 @@ import net.pitan76.mcpitanlib.api.event.nbt.ReadNbtArgs; import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; public class CompatEntity extends Entity { @@ -132,4 +133,8 @@ public Vector3d getMidohraPos() { public net.pitan76.mcpitanlib.midohra.world.ServerWorld getMidohraServerWorld() { return net.pitan76.mcpitanlib.midohra.world.ServerWorld.of(getServerWorld()); } + + public CompatEntity(EntityTypeWrapper type, net.pitan76.mcpitanlib.midohra.world.World world) { + super(type.get(), world.toMinecraft()); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java index c90d34027..d44118232 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java @@ -19,6 +19,7 @@ import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.entity.IEntityM; public abstract class CompatThrownItemEntity extends ThrowableItemProjectile implements IEntityM { @@ -165,4 +166,8 @@ public void setStack(net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(callGetItem()); } + + public CompatThrownItemEntity(EntityTypeWrapper type, net.pitan76.mcpitanlib.midohra.world.World world) { + this((EntityType) type.get(), world.toMinecraft()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java index 40e528a8b..73506b118 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/BlockUseEvent.java @@ -139,4 +139,8 @@ public Item getItem() { public ItemWrapper getItemWrapper() { return ItemWrapper.of(getItem()); } + + public BlockUseEvent(net.pitan76.mcpitanlib.midohra.block.BlockState state, net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + this(state.toMinecraft(), world.toMinecraft(), pos.toMinecraft(), player.getEntity(), hand, hit); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java index d92f4d888..64c13ad7e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/block/TileCreateEvent.java @@ -63,4 +63,26 @@ public boolean hasBlockState() { return (blockState != null); } // ---- + + public TileCreateEvent(net.pitan76.mcpitanlib.midohra.util.math.BlockPos blockPos, net.pitan76.mcpitanlib.midohra.block.BlockState blockState) { + this.blockView = null; + this.blockPos = blockPos.toMinecraft(); + this.blockState = blockState.toMinecraft(); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getBlockPosM() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getBlockPos()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getBlockStateM() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getBlockState()); + } + + public void setBlockPos(net.pitan76.mcpitanlib.midohra.util.math.BlockPos blockPos) { + setBlockPos(blockPos.toMinecraft()); + } + + public void setBlockState(net.pitan76.mcpitanlib.midohra.block.BlockState blockState) { + setBlockState(blockState.toMinecraft()); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java index c3948bc5b..c782d4d8c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java @@ -22,6 +22,7 @@ import net.pitan76.mcpitanlib.api.util.NbtUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; import org.jetbrains.annotations.Nullable; public class CompatBlockEntity extends BlockEntity { @@ -195,4 +196,8 @@ public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState() { public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraCachedState() { return net.pitan76.mcpitanlib.midohra.block.BlockState.of(callGetCachedState()); } + + public CompatBlockEntity(BlockEntityTypeWrapper type, TileCreateEvent event) { + this(type.get(), event.getBlockPos(), event.getBlockState()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java index c194b761d..0a91e3000 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/util/shape/VoxelShape.java @@ -1,5 +1,7 @@ package net.pitan76.mcpitanlib.midohra.util.shape; +import net.pitan76.mcpitanlib.api.util.VoxelShapeUtil; +import net.pitan76.mcpitanlib.midohra.util.math.Box; import net.pitan76.mcpitanlib.midohra.util.math.Direction; public class VoxelShape { @@ -73,4 +75,28 @@ public static VoxelShape union(VoxelShape... shapes) { } return of(result); } + + public static VoxelShape cuboid(double x1, double y1, double z1, double x2, double y2, double z2) { + return of(VoxelShapeUtil.cuboid(x1, y1, z1, x2, y2, z2)); + } + + public static VoxelShape cuboid(double size) { + return of(VoxelShapeUtil.cuboid(size)); + } + + public static VoxelShape cuboid(double x1, double y1, double z1, double size) { + return of(VoxelShapeUtil.cuboid(x1, y1, z1, size)); + } + + public static VoxelShape centeredCuboid(double x, double y, double z, double size) { + return of(VoxelShapeUtil.centeredCuboid(x, y, z, size)); + } + + public static VoxelShape blockCuboid(double x1, double y1, double z1, double x2, double y2, double z2) { + return of(VoxelShapeUtil.blockCuboid(x1, y1, z1, x2, y2, z2)); + } + + public Box getBoundingBox() { + return new Box(VoxelShapeUtil.getBoundingBox(raw())); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java index 134154f55..95663681f 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/WorldAccess.java @@ -204,4 +204,8 @@ public List getAnimals(Box box) { public int getLuminance(BlockPos pos) { return getBlockState(pos).getLuminance(); } + + public List getLivingEntities(Box box) { + return getEntitiesByClassM(LivingEntity.class, box); + } } From a81036882d94f5019de52bf8342486276dcfbefa Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 17:05:47 +0900 Subject: [PATCH 122/151] [cp] add InventoryWrapper class and integrate it into Player for enhanced inventory handling --- .../pitan76/mcpitanlib/api/entity/Player.java | 35 ++++++++++ .../util/inventory/args/InventoryWrapper.java | 67 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index 4ee747e21..483417742 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -43,7 +43,10 @@ import net.pitan76.mcpitanlib.api.util.NbtUtil; import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; import net.pitan76.mcpitanlib.api.util.TextUtil; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; +import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; +import net.pitan76.mcpitanlib.api.util.inventory.args.InventoryWrapper; import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; import net.pitan76.mcpitanlib.core.player.ItemCooldown; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; @@ -580,4 +583,36 @@ public ItemStack getEquippedStack(ArmorEquipmentType type) { public net.pitan76.mcpitanlib.midohra.item.ItemStack getEquippedStackM(ArmorEquipmentType type) { return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getEquippedStack(type)); } + + public ItemStackList getMainAsM() { + return ItemStackList.of(getMain()); + } + + public ItemStackList getOffHandAsM() { + return ItemStackList.of(getOffHand()); + } + + public ItemStackList getArmorAsM() { + return ItemStackList.of(getArmor()); + } + + public ICompatInventory getInventoryAsM() { + return InventoryWrapper.of(getInv()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMainHandStackAsM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getMainHandStack()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getOffHandStackAsM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getOffHandStack()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.Direction getHorizontalFacingM() { + return net.pitan76.mcpitanlib.midohra.util.math.Direction.of(getHorizontalFacing()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getCursorStackAsM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getCursorStack()); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java new file mode 100644 index 000000000..d7eed3914 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java @@ -0,0 +1,67 @@ +package net.pitan76.mcpitanlib.api.util.inventory.args; + +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; + +public class InventoryWrapper implements ICompatInventory { + private final Inventory inventory; + + public InventoryWrapper(Inventory inventory) { + this.inventory = inventory; + } + + public static InventoryWrapper of(Inventory inventory) { + return new InventoryWrapper(inventory); + } + + public Inventory getInventory() { + return inventory; + } + + @Override + public int getContainerSize() { + return inventory.getContainerSize(); + } + + @Override + public boolean isEmpty() { + return inventory.isEmpty(); + } + + @Override + public ItemStack getItem(int slot) { + return inventory.getItem(slot); + } + + @Override + public ItemStack removeItem(int slot, int count) { + return inventory.removeItem(slot, count); + } + + @Override + public ItemStack removeItemNoUpdate(int slot) { + return inventory.removeItemNoUpdate(slot); + } + + @Override + public void setItem(int slot, ItemStack itemStack) { + inventory.setItem(slot, itemStack); + } + + @Override + public void setChanged() { + inventory.setChanged(); + } + + @Override + public boolean stillValid(Player player) { + return inventory.stillValid(player); + } + + @Override + public void clearContent() { + inventory.clearContent(); + } +} From 48db651a83224a5aa44c23f2d300c6cfc51e2db7 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 17:16:45 +0900 Subject: [PATCH 123/151] refactor InventoryWrapper to use Container instead of Inventory for improved compatibility --- .../api/util/inventory/args/InventoryWrapper.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java index d7eed3914..f12f5dbd6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java @@ -1,14 +1,15 @@ package net.pitan76.mcpitanlib.api.util.inventory.args; +import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; public class InventoryWrapper implements ICompatInventory { - private final Inventory inventory; + private final Container inventory; - public InventoryWrapper(Inventory inventory) { + public InventoryWrapper(Container inventory) { this.inventory = inventory; } @@ -16,7 +17,7 @@ public static InventoryWrapper of(Inventory inventory) { return new InventoryWrapper(inventory); } - public Inventory getInventory() { + public Container getInventory() { return inventory; } From 45ad322aa71ee64890d57f7bf7b32ba8f12b8e2e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 17:16:54 +0900 Subject: [PATCH 124/151] [cp] replace InventoryWrapper with CompatPlayerInventory in getInventoryAsM method for improved inventory compatibility --- .../main/java/net/pitan76/mcpitanlib/api/entity/Player.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index 483417742..10429a56b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -45,6 +45,7 @@ import net.pitan76.mcpitanlib.api.util.TextUtil; import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; import net.pitan76.mcpitanlib.api.util.inventory.args.InventoryWrapper; import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; @@ -597,7 +598,7 @@ public ItemStackList getArmorAsM() { } public ICompatInventory getInventoryAsM() { - return InventoryWrapper.of(getInv()); + return new CompatPlayerInventory(getInv()); } public net.pitan76.mcpitanlib.midohra.item.ItemStack getMainHandStackAsM() { From 4ff0eb798c52abe5d57f0a6340f8fee03cac4b38 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 17:19:30 +0900 Subject: [PATCH 125/151] remove arch api --- fabric/src/main/resources/fabric.mod.json | 5 ++--- neoforge/src/main/resources/META-INF/neoforge.mods.toml | 9 +-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 43d653478..e85f5ff22 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -35,8 +35,7 @@ ], "accessWidener": "mcpitanlib.accesswidener", "depends": { - "minecraft": ">1.21.10", - "fabricloader": "*", - "architectury": "*" + "minecraft": ">=26.1", + "fabricloader": "*" } } diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index b6d488a0d..45b5e7143 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -24,14 +24,7 @@ side = "BOTH" [[dependencies.mcpitanlib]] modId = "minecraft" type = "required" -versionRange = "[1.21,)" -ordering = "NONE" -side = "BOTH" - -[[dependencies.mcpitanlib]] -modId = "architectury" -type = "required" -versionRange = "[19.0.0,)" +versionRange = "[26.1,)" ordering = "NONE" side = "BOTH" From 342229ea1a34ac0e92e4722596846d9a6d5e2278 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 17:23:43 +0900 Subject: [PATCH 126/151] fix wrapper --- .../main/java/net/pitan76/mcpitanlib/api/entity/Player.java | 1 - .../api/util/inventory/{args => }/InventoryWrapper.java | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) rename common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/{args => }/InventoryWrapper.java (92%) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index 10429a56b..c0e874708 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -47,7 +47,6 @@ import net.pitan76.mcpitanlib.api.util.entity.LivingEntityUtil; import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; -import net.pitan76.mcpitanlib.api.util.inventory.args.InventoryWrapper; import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; import net.pitan76.mcpitanlib.core.player.ItemCooldown; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/InventoryWrapper.java similarity index 92% rename from common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java rename to common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/InventoryWrapper.java index f12f5dbd6..e6d1198e3 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/args/InventoryWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/InventoryWrapper.java @@ -1,10 +1,9 @@ -package net.pitan76.mcpitanlib.api.util.inventory.args; +package net.pitan76.mcpitanlib.api.util.inventory; import net.minecraft.world.Container; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; public class InventoryWrapper implements ICompatInventory { private final Container inventory; From 9af95d02e804f9fd08ff787ea576811e0930970d Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 18:51:13 +0900 Subject: [PATCH 127/151] refactor PlatformUtil and PlatformUtilImpl for improved platform detection and compatibility --- .../mcpitanlib/api/util/PlatformUtil.java | 17 ++++++++-- .../api/util/fabric/PlatformUtilImpl.java | 33 +++++++++++++++++++ .../api/util/neoforge/PlatformUtilImpl.java | 31 +++++++++++++++++ 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java index 1b2daea4a..150536356 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/PlatformUtil.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.api.util; +import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.loader.api.FabricLoader; @@ -8,44 +9,53 @@ import java.util.Collection; public class PlatformUtil { + @ExpectPlatform public static boolean isDevelopmentEnvironment() { return FabricLoader.getInstance().isDevelopmentEnvironment(); } + @ExpectPlatform public static boolean isFabric() { - return true; + return false; } + @ExpectPlatform public static boolean isForge() { return false; } + @ExpectPlatform public static boolean isNeoForge() { return false; } + @ExpectPlatform public static boolean isClient() { return FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT; } + @ExpectPlatform public static boolean isServer() { return FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER; } + @ExpectPlatform public static Path getConfigFolder() { return FabricLoader.getInstance().getConfigDir(); } + @ExpectPlatform public static boolean isModLoaded(String id) { return FabricLoader.getInstance().isModLoaded(id); } + @ExpectPlatform public static Path getGameFolder() { return FabricLoader.getInstance().getGameDir(); } public static Path getModsFolder() { - return FabricLoader.getInstance().getGameDir().resolve("mods"); + return getGameFolder().resolve("mods"); } public static File getConfigFolderAsFile() { @@ -60,14 +70,17 @@ public static File getModsFolderAsFile() { return getModsFolder().toFile(); } + @ExpectPlatform public static Collection getModIds() { return FabricLoader.getInstance().getAllMods().stream().map(modContainer -> modContainer.getMetadata().getId()).toList(); } + @ExpectPlatform public static EnvType getEnv() { return FabricLoader.getInstance().getEnvironmentType(); } + @ExpectPlatform public static String getGameVersion() { return FabricLoader.getInstance().getRawGameVersion(); } diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/api/util/fabric/PlatformUtilImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/api/util/fabric/PlatformUtilImpl.java index 5645a7e76..bc2118aa1 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/api/util/fabric/PlatformUtilImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/api/util/fabric/PlatformUtilImpl.java @@ -4,6 +4,7 @@ import net.fabricmc.loader.api.FabricLoader; import java.nio.file.Path; +import java.util.Collection; public class PlatformUtilImpl { public static boolean isClient() { @@ -21,4 +22,36 @@ public static Path getConfigFolder() { public static boolean isModLoaded(String id) { return FabricLoader.getInstance().isModLoaded(id); } + + public static boolean isDevelopmentEnvironment() { + return FabricLoader.getInstance().isDevelopmentEnvironment(); + } + + public static Path getGameFolder() { + return FabricLoader.getInstance().getGameDir(); + } + + public static Collection getModIds() { + return FabricLoader.getInstance().getAllMods().stream().map(modContainer -> modContainer.getMetadata().getId()).toList(); + } + + public static EnvType getEnv() { + return FabricLoader.getInstance().getEnvironmentType(); + } + + public static String getGameVersion() { + return FabricLoader.getInstance().getRawGameVersion(); + } + + public static boolean isFabric() { + return true; + } + + public static boolean isForge() { + return false; + } + + public static boolean isNeoForge() { + return false; + } } diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java index 6be8273a8..e78c37310 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/api/util/neoforge/PlatformUtilImpl.java @@ -3,9 +3,12 @@ import net.neoforged.api.distmarker.Dist; import net.neoforged.fml.ModList; import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.fml.loading.FMLLoader; import net.neoforged.fml.loading.FMLPaths; +import net.neoforged.fml.loading.moddiscovery.ModInfo; import java.nio.file.Path; +import java.util.Collection; public class PlatformUtilImpl { public static boolean isClient() { @@ -23,4 +26,32 @@ public static Path getConfigFolder() { public static boolean isModLoaded(String id) { return ModList.get().isLoaded(id); } + + public static boolean isDevelopmentEnvironment() { + return !FMLEnvironment.isProduction(); + } + + public static Path getGameFolder() { + return FMLLoader.getCurrent().getGameDir(); + } + + public static Collection getModIds() { + return FMLLoader.getCurrent().getLoadingModList().getMods().stream().map(ModInfo::getModId).toList(); + } + + public static String getGameVersion() { + return FMLLoader.getCurrent().getVersionInfo().mcVersion(); + } + + public static boolean isFabric() { + return false; + } + + public static boolean isForge() { + return false; + } + + public static boolean isNeoForge() { + return true; + } } From 1ea929629cf74afa4d86f020e7a889ad4b37da3e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 18:52:43 +0900 Subject: [PATCH 128/151] gradle --- build.gradle | 105 ++++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/build.gradle b/build.gradle index 0e32ab931..712eb97b8 100644 --- a/build.gradle +++ b/build.gradle @@ -49,65 +49,68 @@ subprojects { implementation 'org.yaml:snakeyaml:2.0' } - if (name in "fabric,neoforge".split(",")) { - var modLoader = name - - if (System.getenv("CURSEFORGE_TOKEN") != null) { - curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") - project { - id = '682213' - changelog = info.changelog - releaseType = 'beta' - if (modLoader == "fabric") { - addGameVersion "Fabric" - } - if (modLoader == "forge") { - addGameVersion "Forge" - } - if (modLoader == "neoforge") { - addGameVersion "NeoForge" - } - addGameVersion "26.1" - addGameVersion "26.1.1" - addGameVersion "26.1.2" - - relations { + afterEvaluate { + + if (name in "fabric,neoforge".split(",")) { + var modLoader = name + + if (System.getenv("CURSEFORGE_TOKEN") != null) { + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = '682213' + changelog = info.changelog + releaseType = 'beta' if (modLoader == "fabric") { - requiredDependency "fabric-api" + addGameVersion "Fabric" + } + if (modLoader == "forge") { + addGameVersion "Forge" + } + if (modLoader == "neoforge") { + addGameVersion "NeoForge" + } + addGameVersion "26.1" + addGameVersion "26.1.1" + addGameVersion "26.1.2" + + relations { + if (modLoader == "fabric") { + requiredDependency "fabric-api" + } + + embeddedLibrary 'cloth-config' + embeddedLibrary 'compatdatapacks' + embeddedLibrary 'legacyitemmodels' } - embeddedLibrary 'cloth-config' - embeddedLibrary 'compatdatapacks' - embeddedLibrary 'legacyitemmodels' + mainArtifact(tasks.named("shadowJar").get().archiveFile.get().asFile) + } + options { + forgeGradleIntegration = false } - - mainArtifact(tasks.jar) - } - options { - forgeGradleIntegration = false } - } - } + } - if (System.getenv("MODRINTH_TOKEN") != null) { - modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = 'mcpitanlibarch' - versionNumber = info.mod_version + "-" + modLoader - gameVersions = ["26.1", "26.1.1", "26.1.2"] - versionType = 'beta' - uploadFile = tasks.jar - changelog = info.changelog - loaders = [modLoader] - dependencies { - if (modLoader == "fabric") { - required.project "fabric-api" // Fabric API + if (System.getenv("MODRINTH_TOKEN") != null) { + modrinth { + token = System.getenv("MODRINTH_TOKEN") + projectId = 'mcpitanlibarch' + versionNumber = info.mod_version + "-" + modLoader + gameVersions = ["26.1", "26.1.1", "26.1.2"] + versionType = 'beta' + uploadFile = tasks.named("shadowJar").get().archiveFile.get().asFile + changelog = info.changelog + loaders = [modLoader] + dependencies { + if (modLoader == "fabric") { + required.project "fabric-api" // Fabric API + } + embedded.project "cloth-config" + embedded.project "compatdatapacks" + embedded.project "legacyitemmodels" } - embedded.project "cloth-config" - embedded.project "compatdatapacks" - embedded.project "legacyitemmodels" } } } From b8fe33abd9cfd15fbbd52bd4aeb1f0409024de38 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 21:58:54 +0900 Subject: [PATCH 129/151] update dependencies in build.gradle and gradle.properties for improved compatibility --- fabric/build.gradle | 4 ++-- gradle.properties | 3 ++- neoforge/build.gradle | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fabric/build.gradle b/fabric/build.gradle index 4c09c933a..47aa9c013 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -55,12 +55,12 @@ dependencies { implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { exclude(group: "net.fabricmc.fabric-api") } - implementation("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") { + implementation("net.pitan76:littleintermediaryfallback-fabric:${rootProject.littleintermediaryfallback_version}") { exclude(group: "net.fabricmc.fabric-api") } include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") include("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") - include("net.pitan76:littleobffallback-fabric:${rootProject.littleobffallback_version}") + include("net.pitan76:littleintermediaryfallback:${rootProject.littleintermediaryfallback_version}") } processResources { diff --git a/gradle.properties b/gradle.properties index 81a7e29aa..0a186d97c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,8 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.17.261-SNAPSHOT legacyitemmodels_version=1.0.3.261-SNAPSHOT -littleobffallback_version=0.4.1.261-SNAPSHOT +littleintermediaryfallback_version=1.0.0.261-SNAPSHOT +littleoldnamedfallback_version=1.0.0.261-SNAPSHOT fabricEnabled=true neoforgeEnabled=true diff --git a/neoforge/build.gradle b/neoforge/build.gradle index aaaf0d7a2..d30f9cf8d 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -40,6 +40,8 @@ dependencies { include("net.pitan76:compatdatapacks76-neoforge:${rootProject.compatdatapacks76_version}") include("net.pitan76:legacyitemmodels-neoforge:${rootProject.legacyitemmodels_version}") + include("net.pitan76:legacyitemmodels-neoforge:${rootProject.legacyitemmodels_version}") + include("net.pitan76:littleoldnamedfallback:${rootProject.littleoldnamedfallback_version}") } processResources { From 27684d5787c614a69095e538ca28ce7d3e2be42d Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 22:24:24 +0900 Subject: [PATCH 130/151] refactor registry methods for improved structure and platform compatibility --- .../core/registry/MCPLRegistry.java | 22 ++--- .../mcpitanlib/core/registry/Registry.java | 64 +++++++++++++ .../core/registry/fabric/RegistryImpl.java | 57 ++++++++++++ .../core/registry/neoforge/RegistryImpl.java | 89 +++++++++++++++++++ 4 files changed, 219 insertions(+), 13 deletions(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java create mode 100644 fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java create mode 100644 neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java index 5b0098811..5f28f2d61 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry.java @@ -1,8 +1,5 @@ package net.pitan76.mcpitanlib.core.registry; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.item.enchantment.Enchantment; @@ -11,7 +8,6 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.item.Item; import net.minecraft.core.particles.ParticleType; -import net.minecraft.core.registries.Registries; import net.minecraft.world.inventory.MenuType; import net.minecraft.sounds.SoundEvent; import net.minecraft.resources.Identifier; @@ -26,35 +22,35 @@ public MCPLRegistry(String MOD_ID) { } public RegistrySupplier registryItem(Identifier id, Supplier supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.ITEM, ResourceKey.create(Registries.ITEM, id), supplier.get())); + return Registry.registryItem(id, supplier); } public RegistrySupplier registryBlock(Identifier id, Supplier supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.BLOCK, ResourceKey.create(Registries.BLOCK, id), supplier.get())); + return Registry.registryBlock(id, supplier); } public RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.MENU, ResourceKey.create(Registries.MENU, id), supplier.get())); + return Registry.registryScreenHandlerType(id, supplier); } public RegistrySupplier> registryBlockEntityType(Identifier id, Supplier> supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, ResourceKey.create(Registries.BLOCK_ENTITY_TYPE, id), supplier.get())); + return Registry.registryBlockEntityType(id, supplier); } public RegistrySupplier> registryEntityType(Identifier id, Supplier> supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.ENTITY_TYPE, ResourceKey.create(Registries.ENTITY_TYPE, id), supplier.get())); + return Registry.registryEntityType(id, supplier); } public RegistrySupplier registrySoundEvent(Identifier id, Supplier supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.SOUND_EVENT, ResourceKey.create(Registries.SOUND_EVENT, id), supplier.get())); + return Registry.registrySoundEvent(id, supplier); } public RegistrySupplier registryFluid(Identifier id, Supplier supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.FLUID, ResourceKey.create(Registries.FLUID, id), supplier.get())); + return Registry.registryFluid(id, supplier); } public RegistrySupplier> registryParticleType(Identifier id, Supplier> supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.PARTICLE_TYPE, ResourceKey.create(Registries.PARTICLE_TYPE, id), supplier.get())); + return Registry.registryParticleType(id, supplier); } public RegistrySupplier registryEnchantment(Identifier id, Supplier supplier) { @@ -63,7 +59,7 @@ public RegistrySupplier registryEnchantment(Identifier id, Supplier } public RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { - return new RegistrySupplier<>(Registry.register(BuiltInRegistries.MOB_EFFECT, ResourceKey.create(Registries.MOB_EFFECT, id), supplier.get())); + return Registry.registryStatusEffect(id, supplier); } public void allRegister1_16() { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java new file mode 100644 index 000000000..b145e33a6 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java @@ -0,0 +1,64 @@ +package net.pitan76.mcpitanlib.core.registry; + +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.resources.Identifier; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.material.Fluid; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class Registry { + + @ExpectPlatform + public static RegistrySupplier registryItem(Identifier id, Supplier supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier registryBlock(Identifier id, Supplier supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier> registryBlockEntityType(Identifier id, Supplier> supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier> registryEntityType(Identifier id, Supplier> supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier registrySoundEvent(Identifier id, Supplier supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier registryFluid(Identifier id, Supplier supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier> registryParticleType(Identifier id, Supplier> supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { + throw new AssertionError(); + } +} diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java new file mode 100644 index 000000000..0ec110ab0 --- /dev/null +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java @@ -0,0 +1,57 @@ +package net.pitan76.mcpitanlib.core.registry.fabric; + +import net.minecraft.core.Registry; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.material.Fluid; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class RegistryImpl { + public static RegistrySupplier registryItem(Identifier id, Supplier supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.ITEM, ResourceKey.create(Registries.ITEM, id), supplier.get())); + } + + public static RegistrySupplier registryBlock(Identifier id, Supplier supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.BLOCK, ResourceKey.create(Registries.BLOCK, id), supplier.get())); + } + + public static RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.MENU, ResourceKey.create(Registries.MENU, id), supplier.get())); + } + + public static RegistrySupplier> registryBlockEntityType(Identifier id, Supplier> supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, ResourceKey.create(Registries.BLOCK_ENTITY_TYPE, id), supplier.get())); + } + + public static RegistrySupplier> registryEntityType(Identifier id, Supplier> supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.ENTITY_TYPE, ResourceKey.create(Registries.ENTITY_TYPE, id), supplier.get())); + } + + public static RegistrySupplier registrySoundEvent(Identifier id, Supplier supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.SOUND_EVENT, ResourceKey.create(Registries.SOUND_EVENT, id), supplier.get())); + } + + public static RegistrySupplier registryFluid(Identifier id, Supplier supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.FLUID, ResourceKey.create(Registries.FLUID, id), supplier.get())); + } + + public static RegistrySupplier> registryParticleType(Identifier id, Supplier> supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.PARTICLE_TYPE, ResourceKey.create(Registries.PARTICLE_TYPE, id), supplier.get())); + } + + public static RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.MOB_EFFECT, ResourceKey.create(Registries.MOB_EFFECT, id), supplier.get())); + } +} diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java new file mode 100644 index 000000000..a156514c8 --- /dev/null +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java @@ -0,0 +1,89 @@ +package net.pitan76.mcpitanlib.core.registry.neoforge; + +import net.minecraft.core.Registry; +import net.minecraft.core.particles.ParticleType; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.material.Fluid; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.registries.RegisterEvent; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import org.jetbrains.annotations.NotNull; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Supplier; + +@EventBusSubscriber(modid = "mcpitanlib") +public class RegistryImpl { + + private static final Map>, Map> PENDING_REGISTRIES = new HashMap<>(); + + private static RegistrySupplier register(ResourceKey<@NotNull Registry> registryKey, Identifier id, Supplier supplier) { + T instance = supplier.get(); + + PENDING_REGISTRIES.computeIfAbsent(registryKey, _ -> new HashMap<>()) + .put(id, instance); + + return new RegistrySupplier<>(instance); + } + + public static RegistrySupplier registryItem(Identifier id, Supplier supplier) { + return register(Registries.ITEM, id, supplier); + } + + public static RegistrySupplier registryBlock(Identifier id, Supplier supplier) { + return register(Registries.BLOCK, id, supplier); + } + + public static RegistrySupplier> registryScreenHandlerType(Identifier id, Supplier> supplier) { + return register(Registries.MENU, id, supplier); + } + + public static RegistrySupplier> registryBlockEntityType(Identifier id, Supplier> supplier) { + return register(Registries.BLOCK_ENTITY_TYPE, id, supplier); + } + + public static RegistrySupplier> registryEntityType(Identifier id, Supplier> supplier) { + return register(Registries.ENTITY_TYPE, id, supplier); + } + + public static RegistrySupplier registrySoundEvent(Identifier id, Supplier supplier) { + return register(Registries.SOUND_EVENT, id, supplier); + } + + public static RegistrySupplier registryFluid(Identifier id, Supplier supplier) { + return register(Registries.FLUID, id, supplier); + } + + public static RegistrySupplier> registryParticleType(Identifier id, Supplier> supplier) { + return register(Registries.PARTICLE_TYPE, id, supplier); + } + + public static RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { + return register(Registries.MOB_EFFECT, id, supplier); + } + + @SubscribeEvent + @SuppressWarnings({"unchecked", "rawtypes"}) + public static void onRegister(RegisterEvent event) { + ResourceKey> key = event.getRegistryKey(); + + if (PENDING_REGISTRIES.containsKey(key)) { + Map entries = PENDING_REGISTRIES.get(key); + + for (Map.Entry entry : entries.entrySet()) { + event.register((ResourceKey) key, entry.getKey(), () -> entry.getValue()); + } + } + } +} \ No newline at end of file From efa2707ab974e27db5e61416ff679b140e540054 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 22:34:32 +0900 Subject: [PATCH 131/151] refactor registry methods for improved structure and consistency --- .../core/registry/MCPLRegistry1_20.java | 9 +++------ .../core/registry/MCPLRegistry1_21.java | 11 +++++------ .../mcpitanlib/core/registry/Registry.java | 19 +++++++++++++++++++ .../core/registry/fabric/RegistryImpl.java | 16 ++++++++++++++++ .../core/registry/neoforge/RegistryImpl.java | 17 +++++++++++++++++ 5 files changed, 60 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java index 92cd14a22..6700b13d1 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_20.java @@ -1,7 +1,5 @@ package net.pitan76.mcpitanlib.core.registry; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.CreativeModeTab; @@ -43,8 +41,7 @@ public void register() { public RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, id); - RegistrySupplier itemGroup = - new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, supplier.get())); + RegistrySupplier itemGroup = Registry.registryItemGroup(id, supplier); // RegistrySupplier itemGroup = ITEM_GROUP.register(id, supplier); REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(key, itemGroup); return itemGroup; @@ -52,8 +49,8 @@ public RegistrySupplier registryItemGroup(Identifier id, Suppli public RegistrySupplier registryItemGroup(Identifier id, CreativeTabBuilder builder) { ResourceKey key = ResourceKey.create(Registries.CREATIVE_MODE_TAB, id); - RegistrySupplier itemGroup = - new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, builder.build())); + RegistrySupplier itemGroup = Registry.registryItemGroup(id, builder::build); +// new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, key, builder.build())); // RegistrySupplier itemGroup = ITEM_GROUP.register(id, builder::build); REGISTRY_SUPPLIER_ITEM_GROUP_CACHE.put(key, itemGroup); return itemGroup; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java index 6b1577892..5eade58ce 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/MCPLRegistry1_21.java @@ -1,8 +1,6 @@ package net.pitan76.mcpitanlib.core.registry; -import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponentType; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.minecraft.resources.ResourceKey; @@ -28,13 +26,14 @@ public void register() { public RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { ResourceKey> key = ResourceKey.create(Registries.DATA_COMPONENT_TYPE, id); - DataComponentType dataComponentType = Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, key, supplier.get()); - return new RegistrySupplier<>(dataComponentType); + return Registry.registryDataComponentType(id, supplier); } public Supplier> registryChunkTicketType(Identifier id, Supplier> supplier) { ResourceKey key = ResourceKey.create(Registries.TICKET_TYPE, id); - net.minecraft.server.level.TicketType ticketType = Registry.register(BuiltInRegistries.TICKET_TYPE, key, supplier.get().getRaw()); - return () -> ChunkTicketType.of(ticketType); +// net.minecraft.server.level.TicketType ticketType = Registry.register(BuiltInRegistries.TICKET_TYPE, key, supplier.get().getRaw()); +// net.minecraft.server.level.TicketType ticketType = ; + + return Registry.registryChunkTicketType(id, () -> supplier.get().getRaw()); } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java index b145e33a6..5b0819f10 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/Registry.java @@ -1,17 +1,21 @@ package net.pitan76.mcpitanlib.core.registry; import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.core.component.DataComponentType; import net.minecraft.core.particles.ParticleType; import net.minecraft.resources.Identifier; +import net.minecraft.server.level.TicketType; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.EntityType; import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.material.Fluid; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; import java.util.function.Supplier; @@ -61,4 +65,19 @@ public static RegistrySupplier> registryParticleType(Identifier public static RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { throw new AssertionError(); } + + @ExpectPlatform + public static RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { + throw new AssertionError(); + } + + @ExpectPlatform + public static Supplier> registryChunkTicketType(Identifier id, Supplier supplier) { + throw new AssertionError(); + } } diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java index 0ec110ab0..899cb3277 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/RegistryImpl.java @@ -1,20 +1,24 @@ package net.pitan76.mcpitanlib.core.registry.fabric; import net.minecraft.core.Registry; +import net.minecraft.core.component.DataComponentType; import net.minecraft.core.particles.ParticleType; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.TicketType; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.EntityType; import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.material.Fluid; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; import java.util.function.Supplier; @@ -54,4 +58,16 @@ public static RegistrySupplier> registryParticleType(Identifier public static RegistrySupplier registryStatusEffect(Identifier id, Supplier supplier) { return new RegistrySupplier<>(Registry.register(BuiltInRegistries.MOB_EFFECT, ResourceKey.create(Registries.MOB_EFFECT, id), supplier.get())); } + + public static RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.CREATIVE_MODE_TAB, ResourceKey.create(Registries.CREATIVE_MODE_TAB, id), supplier.get())); + } + + public static RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { + return new RegistrySupplier<>(Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceKey.create(Registries.DATA_COMPONENT_TYPE, id), supplier.get())); + } + + public static Supplier> registryChunkTicketType(Identifier id, Supplier supplier) { + return () -> ChunkTicketType.of(Registry.register(BuiltInRegistries.TICKET_TYPE, ResourceKey.create(Registries.TICKET_TYPE, id), supplier.get())); + } } diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java index a156514c8..f8e815883 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java @@ -1,14 +1,17 @@ package net.pitan76.mcpitanlib.core.registry.neoforge; import net.minecraft.core.Registry; +import net.minecraft.core.component.DataComponentType; import net.minecraft.core.particles.ParticleType; import net.minecraft.core.registries.Registries; import net.minecraft.resources.Identifier; import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.TicketType; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.EntityType; import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -17,6 +20,7 @@ import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.neoforge.registries.RegisterEvent; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.world.chunk.ChunkTicketType; import org.jetbrains.annotations.NotNull; import java.util.HashMap; @@ -73,6 +77,19 @@ public static RegistrySupplier registryStatusEffect(Identifier id, Su return register(Registries.MOB_EFFECT, id, supplier); } + public static RegistrySupplier registryItemGroup(Identifier id, Supplier supplier) { + return register(Registries.CREATIVE_MODE_TAB, id, supplier); + } + + public static RegistrySupplier> registryDataComponentType(Identifier id, Supplier> supplier) { + return register(Registries.DATA_COMPONENT_TYPE, id, supplier); + } + + public static Supplier> registryChunkTicketType(Identifier id, Supplier supplier) { + RegistrySupplier supplier1 = register(Registries.TICKET_TYPE, id, supplier); + return () -> ChunkTicketType.of(supplier1.get()); + } + @SubscribeEvent @SuppressWarnings({"unchecked", "rawtypes"}) public static void onRegister(RegisterEvent event) { From 841c15b6a48584d5da09c796bd8ca9047d50702e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 22:45:02 +0900 Subject: [PATCH 132/151] refactor registry implementation to use a pending entry structure for improved registration handling --- .../core/registry/neoforge/RegistryImpl.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java index f8e815883..e59f68af6 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/RegistryImpl.java @@ -30,15 +30,25 @@ @EventBusSubscriber(modid = "mcpitanlib") public class RegistryImpl { - private static final Map>, Map> PENDING_REGISTRIES = new HashMap<>(); + private static class PendingEntry { + final Supplier factory; + final RegistrySupplier wrapper; + + PendingEntry(Supplier factory, RegistrySupplier wrapper) { + this.factory = factory; + this.wrapper = wrapper; + } + } + + private static final Map>, Map>> PENDING_REGISTRIES = new HashMap<>(); private static RegistrySupplier register(ResourceKey<@NotNull Registry> registryKey, Identifier id, Supplier supplier) { - T instance = supplier.get(); + RegistrySupplier registrySupplier = new RegistrySupplier<>(); PENDING_REGISTRIES.computeIfAbsent(registryKey, _ -> new HashMap<>()) - .put(id, instance); + .put(id, new PendingEntry<>(supplier, registrySupplier)); - return new RegistrySupplier<>(instance); + return registrySupplier; } public static RegistrySupplier registryItem(Identifier id, Supplier supplier) { @@ -96,10 +106,16 @@ public static void onRegister(RegisterEvent event) { ResourceKey> key = event.getRegistryKey(); if (PENDING_REGISTRIES.containsKey(key)) { - Map entries = PENDING_REGISTRIES.get(key); + Map> entries = PENDING_REGISTRIES.get(key); + + for (Map.Entry> mapEntry : entries.entrySet()) { + PendingEntry pending = mapEntry.getValue(); + event.register((ResourceKey) key, mapEntry.getKey(), () -> { + Object instance = pending.factory.get(); + ((RegistrySupplier) pending.wrapper).set(instance); - for (Map.Entry entry : entries.entrySet()) { - event.register((ResourceKey) key, entry.getKey(), () -> entry.getValue()); + return instance; + }); } } } From 36ce79dda4e2a1ade39a272d23e9c41f3f0eb1cc Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 22:48:51 +0900 Subject: [PATCH 133/151] comment out unused payload registration code in ClientPlayNetworkingImpl and ServerPlayNetworkingImpl --- .../core/mc261/neoforge/ClientPlayNetworkingImpl.java | 10 +++++----- .../core/mc261/neoforge/ServerPlayNetworkingImpl.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java index 8fe9fbba6..cd74db173 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java @@ -66,10 +66,10 @@ public static void registerPayloads(RegisterPayloadHandlersEvent event) { }); // ダミー - payloadTypeMap.forEach((_, type) -> { - if (!handlerMap.containsKey(type)) { - registrar.playToServer(type, BufPayload.getCodec(type), (_, _) -> {}); - } - }); +// payloadTypeMap.forEach((_, type) -> { +// if (!handlerMap.containsKey(type)) { +// registrar.playToServer(type, BufPayload.getCodec(type), (_, _) -> {}); +// } +// }); } } diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java index f7ee9074c..0d3e0aafb 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ServerPlayNetworkingImpl.java @@ -60,10 +60,10 @@ public static void registerPayloads(RegisterPayloadHandlersEvent event) { }); // ダミー - payloadTypeMap.forEach((_, type) -> { - if (!handlerMap.containsKey(type)) { - registrar.playToClient(type, BufPayload.getCodec(type), (_, _) -> {}); - } - }); +// payloadTypeMap.forEach((_, type) -> { +// if (!handlerMap.containsKey(type)) { +// registrar.playToClient(type, BufPayload.getCodec(type), (_, _) -> {}); +// } +// }); } } \ No newline at end of file From 97cc9436888a1b9d491b4e0068287f70a7d52563 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 22:51:31 +0900 Subject: [PATCH 134/151] comment out unused register method in ClientPlayNetworkingImpl --- .../mc261/neoforge/ClientPlayNetworkingImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java index cd74db173..0576ecac0 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/ClientPlayNetworkingImpl.java @@ -50,12 +50,12 @@ public static void registerC2SPayloadType(Identifier identifier) { payloadTypeMap.put(identifier, id); } - @SubscribeEvent - public static void register(RegisterClientPayloadHandlersEvent event) { - for (Map.Entry, IPayloadHandler> entry : handlerMap.entrySet()) { - event.register(entry.getKey(), entry.getValue()); - } - } +// @SubscribeEvent +// public static void register(RegisterClientPayloadHandlersEvent event) { +// for (Map.Entry, IPayloadHandler> entry : handlerMap.entrySet()) { +// event.register(entry.getKey(), entry.getValue()); +// } +// } @SubscribeEvent public static void registerPayloads(RegisterPayloadHandlersEvent event) { From a319ef89d952b7e8fa98c428356d1620bef7fad5 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 19 Apr 2026 22:59:42 +0900 Subject: [PATCH 135/151] fix: use equals method for tab key comparison in CreativeModeTabEventRegistryImpl --- .../core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java index a0263235f..9249a121b 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/mc261/neoforge/CreativeModeTabEventRegistryImpl.java @@ -19,7 +19,7 @@ public class CreativeModeTabEventRegistryImpl { public static void addStack(ResourceKey key, Supplier supplier) { tabModifiers.add(event -> { - if (event.getTabKey() == key) { + if (event.getTabKey().equals(key)) { event.accept(supplier.get()); } }); @@ -27,7 +27,7 @@ public static void addStack(ResourceKey key, Supplier key, Supplier> supplier) { tabModifiers.add(event -> { - if (event.getTabKey() == key) { + if (event.getTabKey().equals(key)) { event.acceptAll(supplier.get()); } }); From df50c985399b85bbd9582a7e66d38579ad6c9cd3 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Mon, 20 Apr 2026 01:51:19 +0900 Subject: [PATCH 136/151] gradle --- build.gradle | 2 +- fabric/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 712eb97b8..150cd9bf8 100644 --- a/build.gradle +++ b/build.gradle @@ -97,7 +97,7 @@ subprojects { modrinth { token = System.getenv("MODRINTH_TOKEN") projectId = 'mcpitanlibarch' - versionNumber = info.mod_version + "-" + modLoader + versionNumber = info.mod_version + "-" + modLoader + "-" + project.minecraft_version gameVersions = ["26.1", "26.1.1", "26.1.2"] versionType = 'beta' uploadFile = tasks.named("shadowJar").get().archiveFile.get().asFile diff --git a/fabric/build.gradle b/fabric/build.gradle index 47aa9c013..e458f5909 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -55,7 +55,7 @@ dependencies { implementation("net.pitan76:legacyitemmodels-fabric:${rootProject.legacyitemmodels_version}") { exclude(group: "net.fabricmc.fabric-api") } - implementation("net.pitan76:littleintermediaryfallback-fabric:${rootProject.littleintermediaryfallback_version}") { + implementation("net.pitan76:littleintermediaryfallback:${rootProject.littleintermediaryfallback_version}") { exclude(group: "net.fabricmc.fabric-api") } include("net.pitan76:compatdatapacks76-fabric:${rootProject.compatdatapacks76_version}") From 3b1b151b05ff33008cbc480dda49d41204459780 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Mon, 20 Apr 2026 02:09:15 +0900 Subject: [PATCH 137/151] gradle --- build.gradle | 74 +++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index 150cd9bf8..af96849e2 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id "dev.architectury.loom-no-remap" version "1.14-SNAPSHOT" apply false id 'com.matthewprenger.cursegradle' version '1.5.0-SNAPSHOT' // FORK: maven.pitan76.net id "com.modrinth.minotaur" version "2.+" + id "com.gradleup.shadow" version "9.4.0" } architectury { @@ -30,6 +31,7 @@ subprojects { apply plugin: "maven-publish" apply plugin: "com.modrinth.minotaur" apply plugin: "com.matthewprenger.cursegradle" + apply plugin: "com.gradleup.shadow" base { // Set up a suffixed format for the mod jar names, e.g. `example-fabric`. @@ -49,50 +51,52 @@ subprojects { implementation 'org.yaml:snakeyaml:2.0' } - afterEvaluate { + if (name in "fabric,neoforge".split(",")) { + var modLoader = name - if (name in "fabric,neoforge".split(",")) { - var modLoader = name + if (System.getenv("CURSEFORGE_TOKEN") != null) { + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = '682213' + changelog = info.changelog + releaseType = 'beta' + if (modLoader == "fabric") { + addGameVersion "Fabric" + } + if (modLoader == "forge") { + addGameVersion "Forge" + } + if (modLoader == "neoforge") { + addGameVersion "NeoForge" + } + addGameVersion "26.1" + addGameVersion "26.1.1" + addGameVersion "26.1.2" - if (System.getenv("CURSEFORGE_TOKEN") != null) { - curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") - project { - id = '682213' - changelog = info.changelog - releaseType = 'beta' + relations { if (modLoader == "fabric") { - addGameVersion "Fabric" - } - if (modLoader == "forge") { - addGameVersion "Forge" - } - if (modLoader == "neoforge") { - addGameVersion "NeoForge" - } - addGameVersion "26.1" - addGameVersion "26.1.1" - addGameVersion "26.1.2" - - relations { - if (modLoader == "fabric") { - requiredDependency "fabric-api" - } - - embeddedLibrary 'cloth-config' - embeddedLibrary 'compatdatapacks' - embeddedLibrary 'legacyitemmodels' + requiredDependency "fabric-api" } - mainArtifact(tasks.named("shadowJar").get().archiveFile.get().asFile) - } - options { - forgeGradleIntegration = false + embeddedLibrary 'cloth-config' + embeddedLibrary 'compatdatapacks' + embeddedLibrary 'legacyitemmodels' } - } + mainArtifact(shadowJar) + } + options { + forgeGradleIntegration = false + } } + } + + + afterEvaluate { + + if (System.getenv("MODRINTH_TOKEN") != null) { modrinth { token = System.getenv("MODRINTH_TOKEN") From 6e5675dc5e6d8d9961f6c86cd994771dc3634672 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 21 Apr 2026 14:34:39 +0900 Subject: [PATCH 138/151] feat: implement ExtendModInitializer and MCPitanLibFabric classes --- .../mcpitanlib/fabric/ExtendModInitializer.java | 2 +- .../mcpitanlib/fabric/MCPitanLibFabric.java | 0 fabric/src/main/resources/fabric.mod.json | 1 - fabric/src/main/resources/mcpitanlib.mixins.json | 14 -------------- gradle.properties | 2 +- 5 files changed, 2 insertions(+), 17 deletions(-) rename {common => fabric}/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java (99%) rename {common => fabric}/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java (100%) delete mode 100644 fabric/src/main/resources/mcpitanlib.mixins.json diff --git a/common/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java b/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java similarity index 99% rename from common/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java rename to fabric/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java index f9c5389a6..c8deb4a3b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/ExtendModInitializer.java @@ -65,4 +65,4 @@ public void debug(String message) { public void trace(String message) { logger.trace(message); } -} +} \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java b/fabric/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java similarity index 100% rename from common/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java rename to fabric/src/main/java/net/pitan76/mcpitanlib/fabric/MCPitanLibFabric.java diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index e85f5ff22..7a3a430c5 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -30,7 +30,6 @@ } }, "mixins": [ - "mcpitanlib.mixins.json", "mcpitanlib-common.mixins.json" ], "accessWidener": "mcpitanlib.accesswidener", diff --git a/fabric/src/main/resources/mcpitanlib.mixins.json b/fabric/src/main/resources/mcpitanlib.mixins.json deleted file mode 100644 index 0a36c5829..000000000 --- a/fabric/src/main/resources/mcpitanlib.mixins.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "net.pitan76.mcpitanlib.fabric.mixin", - "compatibilityLevel": "JAVA_8", - "mixins": [ - "RecipeMixin" - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/gradle.properties b/gradle.properties index 0a186d97c..784f528fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ cloth_config_version=26.1.154 # https://maven.pitan76.net/net/pitan76/compatdatapacks76/ compatdatapacks76_version=1.0.17.261-SNAPSHOT legacyitemmodels_version=1.0.3.261-SNAPSHOT -littleintermediaryfallback_version=1.0.0.261-SNAPSHOT +littleintermediaryfallback_version=1.0.0.261-20260419.164849-3 littleoldnamedfallback_version=1.0.0.261-SNAPSHOT fabricEnabled=true From 05711e295c85714a55d91cb74b7f90e41a911b05 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 21 Apr 2026 14:54:06 +0900 Subject: [PATCH 139/151] gradle --- build.gradle | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.gradle b/build.gradle index af96849e2..584ca6d0c 100644 --- a/build.gradle +++ b/build.gradle @@ -93,10 +93,7 @@ subprojects { } - afterEvaluate { - - if (System.getenv("MODRINTH_TOKEN") != null) { modrinth { token = System.getenv("MODRINTH_TOKEN") From 424a88c1d25ba5290c3e08241318a865fbcd6d52 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 26 Apr 2026 17:39:09 +0900 Subject: [PATCH 140/151] tmp patch --- next.patch | 1008 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1008 insertions(+) create mode 100644 next.patch diff --git a/next.patch b/next.patch new file mode 100644 index 000000000..49ec1ec36 --- /dev/null +++ b/next.patch @@ -0,0 +1,1008 @@ +Subject: [PATCH] gradle +--- +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java +new file mode 100644 +--- /dev/null (date 1777189056266) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java (date 1777189056266) +@@ -0,0 +1,48 @@ ++package net.pitan76.mcpitanlib.api.client.render; ++ ++import net.pitan76.mcpitanlib.api.util.MathUtil; ++import org.joml.Matrix3x2fStack; ++ ++public class CompatMatrix3x2fStack extends CompatMatrixStack { ++ private final Matrix3x2fStack matrices; ++ ++ public CompatMatrix3x2fStack(Matrix3x2fStack matrices) { ++ super(null); ++ this.matrices = matrices; ++ } ++ ++ @Deprecated ++ public Matrix3x2fStack get3x2fRaw() { ++ return matrices; ++ } ++ ++ public CompatMatrix3x2fStack push() { ++ get3x2fRaw().pushMatrix(); ++ return this; ++ } ++ ++ public CompatMatrix3x2fStack pop() { ++ get3x2fRaw().popMatrix(); ++ return this; ++ } ++ ++ public CompatMatrix3x2fStack translate(double x, double y, double z) { ++ get3x2fRaw().translate((float) x, (float) y); ++ return this; ++ } ++ ++ @Override ++ public CompatMatrixStack translate(float x, float y, float z) { ++ get3x2fRaw().translate(x, y); ++ return this; ++ } ++ ++ public CompatMatrix3x2fStack scale(float x, float y, float z) { ++ get3x2fRaw().scale(x, y); ++ return this; ++ } ++ ++ public CompatMatrix3x2fStack multiply(MathUtil.RotationAxisType type, float deg) { ++ return this; ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java (date 1777189232790) +@@ -19,6 +19,7 @@ + import net.minecraft.core.BlockPos; + import net.minecraft.world.phys.AABB; + import net.minecraft.world.phys.shapes.VoxelShape; ++import net.pitan76.mcpitanlib.api.client.render.CompatMatrixStack; + import net.pitan76.mcpitanlib.api.util.VoxelShapeUtil; + import net.pitan76.mcpitanlib.api.util.client.render.VertexRenderingUtil; + import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; +@@ -108,6 +109,10 @@ + getMatrixStack().popPose(); + } + ++ default CompatMatrixStack getCompatMatrices() { ++ return CompatMatrixStack.of(getMatrixStack()); ++ } ++ + default Optional getVertexConsumer() { + if (getConsumers() == null) + return Optional.empty(); +Index: common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java +new file mode 100644 +--- /dev/null (date 1777189486869) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java (date 1777189486869) +@@ -0,0 +1,41 @@ ++package net.pitan76.mcpitanlib.api.util.math; ++ ++import net.minecraft.util.Mth; ++ ++public class MathUtil { ++ public static double clamp(double value, double min, double max) { ++ return Mth.clamp(value, min, max); ++ } ++ ++ public static float clamp(float value, float min, float max) { ++ return Mth.clamp(value, min, max); ++ } ++ ++ public static int clamp(int value, int min, int max) { ++ return Mth.clamp(value, min, max); ++ } ++ ++ public static long clamp(long value, long min, long max) { ++ return Mth.clamp(value, min, max); ++ } ++ ++ public static double lerp(double a, double b, double t) { ++ return Mth.lerp(t, a, b); ++ } ++ ++ public static float lerp(float a, float b, float t) { ++ return Mth.lerp(t, a, b); ++ } ++ ++ public static double inverseLerp(double a, double b, double value) { ++ return Mth.inverseLerp(a, b, value); ++ } ++ ++ public static int hsvToRgb(float hue, float saturation, float value) { ++ return Mth.hsvToRgb(hue, saturation, value); ++ } ++ ++ public static float hsvToArgb(float hue, float saturation, float value, int alpha) { ++ return Mth.hsvToArgb(hue, saturation, value, alpha); ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java +new file mode 100644 +--- /dev/null (date 1777191810794) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java (date 1777191810794) +@@ -0,0 +1,26 @@ ++package net.pitan76.mcpitanlib.api.client.render.handledscreen; ++ ++import net.minecraft.client.input.MouseButtonInfo; ++ ++public class MouseClickedArgs extends MouseButtonArgs { ++ public boolean doubleClick; ++ ++ public MouseClickedArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo, boolean doubleClick) { ++ super(mouseX, mouseY, buttonInfo); ++ this.doubleClick = doubleClick; ++ } ++ ++ public MouseClickedArgs(double mouseX, double mouseY, int button, boolean doubleClick) { ++ super(mouseX, mouseY, button); ++ this.doubleClick = doubleClick; ++ } ++ ++ public MouseClickedArgs(double mouseX, double mouseY, int button) { ++ this(mouseX, mouseY, button, false); ++ } ++ ++ @Deprecated ++ public boolean isDoubleClick() { ++ return doubleClick; ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java +new file mode 100644 +--- /dev/null (date 1777190665057) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java (date 1777190665057) +@@ -0,0 +1,21 @@ ++package net.pitan76.mcpitanlib.api.client.render.handledscreen; ++ ++public class CharEventArgs { ++ private final int character; ++ ++ public CharEventArgs(char character, int modifiers) { ++ this.character = character; ++ } ++ ++ public CharEventArgs(int codepoint) { ++ this.character = codepoint; ++ } ++ ++ public int getCharacter() { ++ return character; ++ } ++ ++ public char getChar() { ++ return (char) character; ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java (date 1777187815951) +@@ -1,5 +1,10 @@ + package net.pitan76.mcpitanlib.midohra.block; + ++import net.pitan76.mcpitanlib.api.util.block.BlockUtil; ++ ++import java.util.List; ++import java.util.stream.Collectors; ++ + public class Blocks { + public static BlockWrapper AIR = of(net.minecraft.world.level.block.Blocks.AIR); + public static BlockWrapper STONE = of(net.minecraft.world.level.block.Blocks.STONE); +@@ -768,4 +773,8 @@ + public static BlockWrapper of(net.minecraft.world.level.block.Block block) { + return BlockWrapper.of(block); + } ++ ++ public static List getBlocks() { ++ return BlockUtil.getBlocks().stream().map(BlockWrapper::of).collect(Collectors.toList()); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java (date 1777192306521) +@@ -3,6 +3,7 @@ + import net.minecraft.world.entity.player.Inventory; + import net.minecraft.world.level.Level; + import net.pitan76.mcpitanlib.api.entity.Player; ++import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; + + public class CreateMenuEvent { + public int syncId; +@@ -54,4 +55,12 @@ + public Level getWorld() { + return getPlayer().getWorld(); + } ++ ++ public CompatPlayerInventory getCompatPlayerInventory() { ++ return new CompatPlayerInventory(getPlayerInventory()); ++ } ++ ++ public net.pitan76.mcpitanlib.midohra.world.World getWorldM() { ++ return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java (date 1777192630370) +@@ -270,6 +270,18 @@ + public static FriendlyByteBuf writeBlockPos(FriendlyByteBuf buf, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { + return writeBlockPos(buf, pos.toMinecraft()); + } ++ ++ public static boolean isReadable(FriendlyByteBuf buf) {; ++ return buf.isReadable(); ++ } ++ ++ public static boolean isWritable(FriendlyByteBuf buf) { ++ return buf.isWritable(); ++ } ++ ++ public static boolean isReadable(FriendlyByteBuf buf, int size) { ++ return buf.isReadable(size); ++ } + } + + +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java +new file mode 100644 +--- /dev/null (date 1777189232799) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java (date 1777189232799) +@@ -0,0 +1,51 @@ ++package net.pitan76.mcpitanlib.api.client.render; ++ ++import net.pitan76.mcpitanlib.api.util.MathUtil; ++import net.pitan76.mcpitanlib.api.util.client.MatrixStackUtil; ++ ++public class CompatMatrixStack { ++ private final com.mojang.blaze3d.vertex.PoseStack matrices; ++ ++ public CompatMatrixStack(com.mojang.blaze3d.vertex.PoseStack matrices) { ++ this.matrices = matrices; ++ } ++ ++ public static CompatMatrixStack of(com.mojang.blaze3d.vertex.PoseStack matrixStack) { ++ return new CompatMatrixStack(matrixStack); ++ } ++ ++ @Deprecated ++ public com.mojang.blaze3d.vertex.PoseStack getRaw() { ++ return matrices; ++ } ++ ++ public CompatMatrixStack push() { ++ MatrixStackUtil.push(getRaw()); ++ return this; ++ } ++ ++ public CompatMatrixStack pop() { ++ MatrixStackUtil.pop(getRaw()); ++ return this; ++ } ++ ++ public CompatMatrixStack translate(double x, double y, double z) { ++ MatrixStackUtil.translate(getRaw(), x, y, z); ++ return this; ++ } ++ ++ public CompatMatrixStack translate(float x, float y, float z) { ++ getRaw().translate(x, y, z); ++ return this; ++ } ++ ++ public CompatMatrixStack scale(float x, float y, float z) { ++ MatrixStackUtil.scale(getRaw(), x, y, z); ++ return this; ++ } ++ ++ public CompatMatrixStack multiply(MathUtil.RotationAxisType type, float deg) { ++ MatrixStackUtil.multiply(getRaw(), type, deg); ++ return this; ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java (date 1777192460461) +@@ -5,6 +5,7 @@ + import net.pitan76.mcpitanlib.api.entity.Player; + import net.pitan76.mcpitanlib.api.event.BaseEvent; + import net.pitan76.mcpitanlib.api.network.PacketByteUtil; ++import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; + + public class ExtraDataArgs extends BaseEvent { + public FriendlyByteBuf buf; +@@ -52,4 +53,8 @@ + public void writeVar(Object obj) { + PacketByteUtil.writeVar(getBuf(), obj); + } ++ ++ public CompatPacketByteBuf getCompatBuf() { ++ return CompatPacketByteBuf.of(getBuf()); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java (date 1777187202278) +@@ -1,6 +1,7 @@ + package net.pitan76.mcpitanlib.api.client.option; + + import net.minecraft.client.KeyMapping; ++import net.minecraft.client.input.KeyEvent; + import net.minecraft.network.chat.Component; + import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +@@ -75,4 +76,8 @@ + public KeyMapping getRaw() { + return keyBinding; + } ++ ++ public boolean matches(int keyCode, int scanCode, int modifiers) { ++ return keyBinding.matches(new KeyEvent(keyCode, scanCode, modifiers)); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java (date 1777192065101) +@@ -8,7 +8,9 @@ + import net.minecraft.client.gui.narration.NarratableEntry; + import net.minecraft.client.gui.screens.Screen; + import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; ++import net.minecraft.client.input.CharacterEvent; + import net.minecraft.client.input.KeyEvent; ++import net.minecraft.client.input.MouseButtonEvent; + import net.minecraft.client.renderer.item.ItemModelResolver; + import net.minecraft.world.entity.player.Inventory; + import net.minecraft.world.inventory.AbstractContainerMenu; +@@ -362,4 +364,54 @@ + public Component getPlayerInvTitle() { + return playerInventoryTitle; + } ++ ++ public boolean charTyped(CharEventArgs args) { ++ return super.charTyped(new CharacterEvent(args.getCharacter())); ++ } ++ ++ @Deprecated ++ @Override ++ public boolean charTyped(CharacterEvent event) { ++ return charTyped(new CharEventArgs(event.codepoint())); ++ } ++ ++ public boolean mouseScrolled(MouseScrolledArgs args) { ++ return super.mouseScrolled(args.getMouseX(), args.getMouseY(), args.getScrollX(), args.getScrollY()); ++ } ++ ++ @Deprecated ++ @Override ++ public boolean mouseScrolled(double x, double y, double scrollX, double scrollY) { ++ return mouseScrolled(new MouseScrolledArgs(x, y, scrollX, scrollY)); ++ } ++ ++ public boolean mouseClicked(MouseClickedArgs args) { ++ return super.mouseClicked(new MouseButtonEvent(args.getX(), args.getY(), args.getButtonInfo()), args.isDoubleClick()); ++ } ++ ++ @Deprecated ++ @Override ++ public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) { ++ return mouseClicked(new MouseClickedArgs(event.x(), event.y(), event.buttonInfo(), doubleClick)); ++ } ++ ++ public boolean mouseDragged(MouseDraggedArgs args) { ++ return super.mouseDragged(new MouseButtonEvent(args.getX(), args.getY(), args.getButtonInfo()), args.getDeltaX(), args.getDeltaY()); ++ } ++ ++ @Deprecated ++ @Override ++ public boolean mouseDragged(MouseButtonEvent event, double dx, double dy) { ++ return mouseDragged(new MouseDraggedArgs(event.x(), event.y(), event.buttonInfo(), dx, dy)); ++ } ++ ++ public boolean mouseReleased(MouseReleasedArgs args) { ++ return super.mouseReleased(new MouseButtonEvent(args.getX(), args.getY(), args.getButtonInfo())); ++ } ++ ++ @Deprecated ++ @Override ++ public boolean mouseReleased(MouseButtonEvent event) { ++ return mouseReleased(new MouseReleasedArgs(event.x(), event.y(), event.buttonInfo())); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java (date 1777189771891) +@@ -9,6 +9,8 @@ + import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; + import org.joml.Matrix3x2fStack; + ++import java.util.List; ++ + public class DrawObjectDM { + private PoseStack stack; + private Matrix3x2fStack matrix3x2fStack; +@@ -86,6 +88,10 @@ + RendererUtil.drawTooltip(this, text, x, y); + } + ++ public void drawTooltip(List texts, int x, int y) { ++ RendererUtil.drawTooltip2(this, texts, x, y); ++ } ++ + public void drawBorder(int x, int y, int width, int height, int color) { + RendererUtil.drawBorder(this, x, y, width, height, color); + } +@@ -97,4 +103,8 @@ + public int getHeight() { + return hasScreen() ? screen.height : -1; + } ++ ++ public CompatMatrixStack getMatrixStack() { ++ return new CompatMatrix3x2fStack(context.pose()); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java +new file mode 100644 +--- /dev/null (date 1777191944644) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java (date 1777191944644) +@@ -0,0 +1,29 @@ ++package net.pitan76.mcpitanlib.api.client.render.handledscreen; ++ ++import net.minecraft.client.input.MouseButtonInfo; ++ ++public class MouseDraggedArgs extends MouseButtonArgs { ++ ++ public final double dx; ++ public final double dy; ++ ++ public MouseDraggedArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo, double dx, double dy) { ++ super(mouseX, mouseY, buttonInfo); ++ this.dx = dx; ++ this.dy = dy; ++ } ++ ++ public MouseDraggedArgs(double mouseX, double mouseY, int button, double dx, double dy) { ++ super(mouseX, mouseY, button); ++ this.dx = dx; ++ this.dy = dy; ++ } ++ ++ public double getDeltaX() { ++ return dx; ++ } ++ ++ public double getDeltaY() { ++ return dy; ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java (date 1777189771870) +@@ -16,9 +16,11 @@ + import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; + import net.pitan76.mcpitanlib.api.text.TextComponent; + import net.pitan76.mcpitanlib.api.util.CompatIdentifier; ++import net.pitan76.mcpitanlib.midohra.item.ItemStack; + import org.jetbrains.annotations.Nullable; + + import java.util.List; ++import java.util.stream.Collectors; + + @Environment(EnvType.CLIENT) + public class ScreenUtil { +@@ -207,6 +209,74 @@ + public static void drawTooltip(DrawObjectDM drawObjectDM, List texts, int x, int y) { + drawObjectDM.getContext().setComponentTooltipForNextFrame(getTextRenderer(), texts, x, y); + } ++ ++ public static void drawTooltip2(DrawObjectDM drawObjectDM, List texts, int x, int y) { ++ drawTooltip(drawObjectDM, texts.stream().map(TextComponent::getText).collect(Collectors.toList()), x, y); ++ } ++ ++ public static void drawItem(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y) { ++ drawItem(drawObjectDM, stack.toMinecraft(), x, y); ++ } ++ ++ public static void drawItem(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y) { ++ drawObjectDM.getContext().item(stack, x, y); ++ } ++ ++ public static void drawItem(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y, int seed) { ++ drawItem(drawObjectDM, stack.toMinecraft(), x, y, seed); ++ } ++ ++ public static void drawItem(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y, int seed) { ++ drawObjectDM.getContext().item(stack, x, y, seed); ++ } ++ ++ public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y) { ++ drawItemWithoutEntity(drawObjectDM, stack.toMinecraft(), x, y); ++ } ++ ++ public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y) { ++ drawObjectDM.getContext().fakeItem(stack, x, y, 0); ++ } ++ ++ public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y, int seed) { ++ drawItemWithoutEntity(drawObjectDM, stack.toMinecraft(), x, y, seed); ++ } ++ ++ public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y, int seed) { ++ drawObjectDM.getContext().fakeItem(stack, x, y, seed); ++ } ++ ++ public static void drawItemInSlot(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y) { ++ drawItemInSlot(drawObjectDM, stack.toMinecraft(), x, y); ++ } ++ ++ public static void drawItemInSlot(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y) { ++ drawObjectDM.getContext().itemDecorations(getTextRenderer(), stack, x, y); ++ } ++ ++ public static void drawItemInSlot(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y, String countText) { ++ drawItemInSlot(drawObjectDM, stack.toMinecraft(), x, y, countText); ++ } ++ ++ public static void drawItemInSlot(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y, String countText) { ++ drawObjectDM.getContext().itemDecorations(getTextRenderer(), stack, x, y, countText); ++ } ++ ++ public static void enableScissor(DrawObjectDM drawObjectDM, int x0, int y0, int x1, int y1) { ++ drawObjectDM.getContext().enableScissor(x0, y0, x1, y1); ++ } ++ ++ public static void disableScissor(DrawObjectDM drawObjectDM) { ++ drawObjectDM.getContext().disableScissor(); ++ } ++ ++ public static void fill(DrawObjectDM drawObjectDM, int x0, int y0, int x1, int y1, int color) { ++ drawObjectDM.getContext().fill(x0, y0, x1, y1, fixColor(color)); ++ } ++ ++ public static void fillGradient(DrawObjectDM drawObjectDM, int x0, int y0, int x1, int y1, int color0, int color1) { ++ drawObjectDM.getContext().fillGradient(x0, y0, x1, y1, fixColor(color0), fixColor(color1)); ++ } + } + + public static int getWidth(Component text) { +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java +new file mode 100644 +--- /dev/null (date 1777191460210) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java (date 1777191460210) +@@ -0,0 +1,37 @@ ++package net.pitan76.mcpitanlib.api.client.render.handledscreen; ++ ++public class MouseScrolledArgs { ++ private final double mouseX; ++ private final double mouseY; ++ private final double scrollX; ++ private final double scrollY; ++ private final double amount; ++ ++ public MouseScrolledArgs(double mouseX, double mouseY, double scrollX, double scrollY) { ++ this.mouseX = mouseX; ++ this.mouseY = mouseY; ++ this.scrollX = scrollX; ++ this.scrollY = scrollY; ++ this.amount = Math.sqrt(scrollX * scrollX + scrollY * scrollY); ++ } ++ ++ public double getMouseX() { ++ return mouseX; ++ } ++ ++ public double getMouseY() { ++ return mouseY; ++ } ++ ++ public double getScrollX() { ++ return scrollX; ++ } ++ ++ public double getScrollY() { ++ return scrollY; ++ } ++ ++ public double getAmount() { ++ return amount; ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java (date 1777187365008) +@@ -39,4 +39,16 @@ + public static void close() { + getWindow().close(); + } ++ ++ public static int getX() { ++ return getWindow().getX(); ++ } ++ ++ public static int getY() { ++ return getWindow().getY(); ++ } ++ ++ public static double getScaleFactor() { ++ return getWindow().getGuiScale(); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java +new file mode 100644 +--- /dev/null (date 1777192065068) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java (date 1777192065068) +@@ -0,0 +1,14 @@ ++package net.pitan76.mcpitanlib.api.client.render.handledscreen; ++ ++import net.minecraft.client.input.MouseButtonInfo; ++ ++public class MouseReleasedArgs extends MouseButtonArgs { ++ ++ public MouseReleasedArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo) { ++ super(mouseX, mouseY, buttonInfo); ++ } ++ ++ public MouseReleasedArgs(double mouseX, double mouseY, int button) { ++ super(mouseX, mouseY, button); ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java +new file mode 100644 +--- /dev/null (date 1777191810769) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java (date 1777191810769) +@@ -0,0 +1,38 @@ ++package net.pitan76.mcpitanlib.api.client.render.handledscreen; ++ ++import net.minecraft.client.input.MouseButtonInfo; ++ ++public class MouseButtonArgs { ++ public final double mouseX, mouseY; ++ public MouseButtonInfo buttonInfo = null; ++ ++ public MouseButtonArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo) { ++ this.mouseX = mouseX; ++ this.mouseY = mouseY; ++ this.buttonInfo = buttonInfo; ++ } ++ ++ public MouseButtonArgs(double mouseX, double mouseY, int button) { ++ this.mouseX = mouseX; ++ this.mouseY = mouseY; ++ this.buttonInfo = new MouseButtonInfo(button, 0); ++ } ++ ++ public double getX() { ++ return mouseX; ++ } ++ ++ public double getY() { ++ return mouseY; ++ } ++ ++ public int getButton() { ++ if (getButtonInfo() == null) return -1; ++ return getButtonInfo().button(); ++ } ++ ++ @Deprecated ++ public MouseButtonInfo getButtonInfo() { ++ return buttonInfo; ++ } ++} +Index: common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java (date 1777189589604) +@@ -1,8 +1,13 @@ + package net.pitan76.mcpitanlib.midohra.item; + ++import net.pitan76.mcpitanlib.api.text.TextComponent; + import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + import net.pitan76.mcpitanlib.api.util.item.ItemGroupUtil; + ++import java.util.Collection; ++import java.util.Collections; ++import java.util.stream.Collectors; ++ + public class ItemGroupWrapper { + private final net.minecraft.world.item.CreativeModeTab itemGroup; + +@@ -68,4 +73,40 @@ + ItemGroupWrapper other = (ItemGroupWrapper) obj; + return rawEquals(other); + } ++ ++ public ItemWrapper getIconItem() { ++ return getIcon().getItem(); ++ } ++ ++ public Type getType() { ++ if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.CATEGORY)) { ++ return Type.CATEGORY; ++ } else if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.INVENTORY)) { ++ return Type.INVENTORY; ++ } else if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.HOTBAR)) { ++ return Type.HOTBAR; ++ } else if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.SEARCH)) { ++ return Type.SEARCH; ++ } ++ ++ return Type.EMPTY; ++ } ++ ++ public Collection getDisplayItems() { ++ if (isEmpty()) return Collections.emptyList(); ++ return get().getDisplayItems().stream().map(ItemStack::of).collect(Collectors.toList()); ++ } ++ ++ public TextComponent getDisplayName() { ++ if (isEmpty()) return new TextComponent(""); ++ return new TextComponent(get().getDisplayName()); ++ } ++ ++ public static enum Type { ++ EMPTY, ++ CATEGORY, ++ INVENTORY, ++ HOTBAR, ++ SEARCH, ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java (date 1777192630393) +@@ -123,4 +123,21 @@ + PacketByteUtil.writeNbt(this, nbt); + return this; + } ++ ++ public CompatPacketByteBuf writeVar(Object obj) { ++ PacketByteUtil.writeVar(this, obj); ++ return this; ++ } ++ ++ public boolean isReadable() { ++ return PacketByteUtil.isReadable(this); ++ } ++ ++ public boolean isWritable() { ++ return PacketByteUtil.isWritable(this); ++ } ++ ++ public boolean isReadable(int size) { ++ return PacketByteUtil.isReadable(this, size); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java (date 1777187815967) +@@ -1,7 +1,11 @@ + package net.pitan76.mcpitanlib.midohra.item; + ++import net.minecraft.world.item.CreativeModeTabs; + import net.pitan76.mcpitanlib.api.item.DefaultItemGroups; + ++import java.util.List; ++import java.util.stream.Collectors; ++ + public class ItemGroups { + public static final ItemGroupWrapper BUILDING_BLOCKS = of(DefaultItemGroups.BUILDING_BLOCKS); + public static final ItemGroupWrapper COLORED_BLOCKS = of(DefaultItemGroups.COLORED_BLOCKS); +@@ -27,4 +31,12 @@ + private static ItemGroupWrapper of(net.minecraft.world.item.CreativeModeTab itemGroup) { + return ItemGroupWrapper.of(itemGroup); + } ++ ++ public static List getGroupsToDisplay() { ++ return CreativeModeTabs.allTabs().stream().map(ItemGroupWrapper::of).collect(Collectors.toList()); ++ } ++ ++ public static List getGroups() { ++ return CreativeModeTabs.tabs().stream().map(ItemGroupWrapper::of).collect(Collectors.toList()); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java (date 1777189962211) +@@ -1,6 +1,7 @@ + package net.pitan76.mcpitanlib.midohra.item; + + import net.minecraft.world.item.Item; ++import net.minecraft.world.item.TooltipFlag; + import net.minecraft.world.level.ItemLike; + import net.minecraft.nbt.CompoundTag; + import net.minecraft.network.chat.Component; +@@ -9,10 +10,12 @@ + import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; + import net.pitan76.mcpitanlib.api.text.TextComponent; + import net.pitan76.mcpitanlib.api.util.*; ++import net.pitan76.mcpitanlib.api.util.client.ClientUtil; + import org.jetbrains.annotations.Nullable; + + import java.util.List; + import java.util.Map; ++import java.util.stream.Collectors; + + public class ItemStack { + private final net.minecraft.world.item.ItemStack stack; +@@ -259,4 +262,9 @@ + Class clazz = item.getClass(); + return clazz.isInstance(getRawItem()); + } ++ ++ public List getTooltip() { ++ return stack.getTooltipLines(Item.TooltipContext.EMPTY, ClientUtil.getClientPlayer(), ClientUtil.getOptions().getRaw().advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL) ++ .stream().map(TextComponent::new).collect(Collectors.toList()); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java (date 1777187815988) +@@ -1,5 +1,10 @@ + package net.pitan76.mcpitanlib.midohra.item; + ++import net.pitan76.mcpitanlib.api.util.item.ItemUtil; ++ ++import java.util.List; ++import java.util.stream.Collectors; ++ + public class Items { + public static ItemWrapper AIR = of(net.minecraft.world.item.Items.AIR); + public static ItemWrapper STONE = of(net.minecraft.world.item.Items.STONE); +@@ -981,4 +986,8 @@ + public static ItemWrapper of(net.minecraft.world.item.Item item) { + return ItemWrapper.of(item); + } ++ ++ public static List getItems() { ++ return ItemUtil.getItems().stream().map(ItemWrapper::of).collect(Collectors.toList()); ++ } + } +Index: common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java +--- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java (revision 05711e295c85714a55d91cb74b7f90e41a911b05) ++++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java (date 1777189232766) +@@ -13,6 +13,7 @@ + import net.minecraft.world.item.ItemStack; + import net.minecraft.core.BlockPos; + import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; ++import net.pitan76.mcpitanlib.api.client.render.CompatMatrixStack; + import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; + import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; + import net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer; +@@ -122,6 +123,10 @@ + MatrixStackUtil.scale(matrices, x, y, z); + } + ++ public CompatMatrixStack getCompatMatrices() { ++ return CompatMatrixStack.of(matrices); ++ } ++ + public ItemModelResolver getItemRenderer() { + return ClientUtil.getItemRenderer(); + } From f37998f7f2b0232849b58e8c1f0a4a3db257d300 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Tue, 28 Apr 2026 23:53:46 +0900 Subject: [PATCH 141/151] fix --- .../mcpitanlib/api/util/inventory/InventoryWrapper.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/InventoryWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/InventoryWrapper.java index e6d1198e3..5c9dab56b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/InventoryWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/inventory/InventoryWrapper.java @@ -1,7 +1,6 @@ package net.pitan76.mcpitanlib.api.util.inventory; import net.minecraft.world.Container; -import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -12,7 +11,7 @@ public InventoryWrapper(Container inventory) { this.inventory = inventory; } - public static InventoryWrapper of(Inventory inventory) { + public static InventoryWrapper of(Container inventory) { return new InventoryWrapper(inventory); } From 98d89b70001b6a4ac7e4b9bed396af4eb322d354 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 2 May 2026 17:47:41 +0900 Subject: [PATCH 142/151] [cp] feat: introduce compatibility interfaces and enhance existing classes with compatibility methods --- .../mcpitanlib/api/block/ExtendBlock.java | 2 +- .../api/block/ExtendBlockProvider.java | 2 +- .../mcpitanlib/api/block/ICompatBlock.java | 10 +++ .../mcpitanlib/api/block/v3/CompatBlock.java | 60 ++++++++++++++++ .../event/listener/WorldRenderContext.java | 5 ++ .../gui/screen/SimpleHandledScreen.java | 52 ++++++++++++++ .../api/client/option/CompatKeyBinding.java | 5 ++ .../client/render/CompatMatrix3x2fStack.java | 48 +++++++++++++ .../api/client/render/CompatMatrixStack.java | 51 ++++++++++++++ .../api/client/render/DrawObjectDM.java | 10 +++ .../entity/event/BlockEntityRenderEvent.java | 5 ++ .../render/handledscreen/CharEventArgs.java | 21 ++++++ .../render/handledscreen/MouseButtonArgs.java | 38 ++++++++++ .../handledscreen/MouseClickedArgs.java | 26 +++++++ .../handledscreen/MouseDraggedArgs.java | 29 ++++++++ .../handledscreen/MouseReleasedArgs.java | 14 ++++ .../handledscreen/MouseScrolledArgs.java | 37 ++++++++++ .../mcpitanlib/api/entity/CompatEntity.java | 2 +- .../api/entity/CompatThrownItemEntity.java | 2 +- .../mcpitanlib/api/entity/ExtendEntity.java | 2 +- .../mcpitanlib/api/entity/ICompatEntity.java | 16 +++++ .../pitan76/mcpitanlib/api/entity/Player.java | 10 +++ .../api/event/PlayerCommandEvent.java | 10 +++ .../api/event/ServerCommandEvent.java | 9 +++ .../container/factory/ExtraDataArgs.java | 5 ++ .../event/item/ItemAppendTooltipEvent.java | 13 ++++ .../api/event/item/ItemBarStepArgs.java | 4 ++ .../api/event/item/ItemUseOnEntityEvent.java | 5 ++ .../api/event/item/PostHitEvent.java | 18 +++++ .../api/event/item/PostMineEvent.java | 40 +++++++++++ .../api/event/tile/TileTickEvent.java | 11 +++ .../api/gui/args/CreateMenuEvent.java | 9 +++ .../api/gui/inventory/IInventory.java | 7 ++ .../mcpitanlib/api/item/ExtendItem.java | 5 +- .../api/item/ExtendItemProvider.java | 2 +- .../mcpitanlib/api/item/ICompatItem.java | 10 +++ .../args/tool/MiningSpeedMultiplierArgs.java | 23 ++++++ .../api/item/args/tool/SuitableForArgs.java | 21 ++++++ .../mcpitanlib/api/item/v3/CompatItem.java | 19 +++++ .../api/item/v3/tool/CompatAxeItem.java | 48 +++++++++++++ .../api/item/v3/tool/CompatHoeItem.java | 48 +++++++++++++ .../item/v3/tool/CompatMiningToolItem.java | 60 ++++++++++++++++ .../api/item/v3/tool/CompatPickaxeItem.java | 48 +++++++++++++ .../api/item/v3/tool/CompatShearsItem.java | 47 +++++++++++++ .../api/item/v3/tool/CompatShovelItem.java | 48 +++++++++++++ .../api/item/v3/tool/CompatSwordItem.java | 48 +++++++++++++ .../api/item/v3/tool/CompatToolItem.java | 48 +++++++++++++ .../api/network/PacketByteUtil.java | 12 ++++ .../mcpitanlib/api/registry/FuelRegistry.java | 2 +- .../api/tile/CompatBlockEntity.java | 2 +- .../api/tile/CompatChestBlockEntity.java | 24 ++++++- .../api/tile/ICompatBlockEntity.java | 16 +++++ .../mcpitanlib/api/util/EntityUtil.java | 5 ++ .../mcpitanlib/api/util/InventoryUtil.java | 28 ++++++++ .../api/util/client/ScreenUtil.java | 70 +++++++++++++++++++ .../api/util/client/WindowUtil.java | 12 ++++ .../api/util/collection/ItemStackList.java | 24 +++++++ .../mcpitanlib/api/util/math/MathUtil.java | 41 +++++++++++ .../core/registry/FuelRegistry.java | 10 ++- .../midohra/block/BlockWrapper.java | 15 ++++ .../mcpitanlib/midohra/block/Blocks.java | 9 +++ .../block/entity/BlockEntityWrapper.java | 19 +++++ .../midohra/entity/EntityWrapper.java | 51 ++++++++++++++ .../mcpitanlib/midohra/entity/IEntityM.java | 1 - .../midohra/item/ItemGroupWrapper.java | 41 +++++++++++ .../mcpitanlib/midohra/item/ItemGroups.java | 12 ++++ .../mcpitanlib/midohra/item/ItemStack.java | 33 +++++++++ .../mcpitanlib/midohra/item/ItemWrapper.java | 15 ++++ .../mcpitanlib/midohra/item/Items.java | 9 +++ .../mcpitanlib/midohra/nbt/NbtCompound.java | 25 +++++++ .../mcpitanlib/midohra/nbt/NbtElement.java | 13 ++++ .../mcpitanlib/midohra/nbt/NbtList.java | 18 +++++ .../midohra/network/CompatPacketByteBuf.java | 17 +++++ .../mcpitanlib/midohra/recipe/Recipe.java | 25 +++++++ .../midohra/world/CompatPersistentState.java | 9 +++ .../registry/fabric/FuelRegistryImpl.java | 10 ++- .../registry/neoforge/FuelRegistryImpl.java | 17 +++-- 77 files changed, 1611 insertions(+), 27 deletions(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/ICompatBlock.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlock.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/entity/ICompatEntity.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/ICompatItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/MiningSpeedMultiplierArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/SuitableForArgs.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatAxeItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatHoeItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatMiningToolItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatPickaxeItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShearsItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShovelItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatSwordItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatToolItem.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/tile/ICompatBlockEntity.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java index 85ea4b1c4..651d24e4d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlock.java @@ -42,7 +42,7 @@ import java.util.List; -public class ExtendBlock extends Block { +public class ExtendBlock extends Block implements ICompatBlock { public CompatibleBlockSettings compatSettings; public ExtendBlock(Properties settings) { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java index 23b91bb5c..f3b62aad2 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ExtendBlockProvider.java @@ -13,7 +13,7 @@ import java.util.List; -public interface ExtendBlockProvider { +public interface ExtendBlockProvider extends ICompatBlock { /** * get collision voxel shape diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/ICompatBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ICompatBlock.java new file mode 100644 index 000000000..7647e49a5 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/block/ICompatBlock.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.block; + +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; + +public interface ICompatBlock { + default BlockWrapper getWrapper() { + return this instanceof Block ? BlockWrapper.of((Block) this) : BlockWrapper.of(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlock.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlock.java new file mode 100644 index 000000000..f040d159d --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlock.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.api.block.v3; + +import net.pitan76.mcpitanlib.api.block.args.v2.CollisionShapeEvent; +import net.pitan76.mcpitanlib.api.block.args.v2.OutlineShapeEvent; +import net.pitan76.mcpitanlib.api.block.v2.BlockSettingsBuilder; +import net.pitan76.mcpitanlib.api.block.v2.CompatibleBlockSettings; +import net.pitan76.mcpitanlib.api.event.block.FluidStateArgs; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.fluid.FluidState; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; +import net.pitan76.mcpitanlib.midohra.util.shape.VoxelShape; + +public class CompatBlock extends net.pitan76.mcpitanlib.api.block.v2.CompatBlock { + + public CompatBlock(CompatibleBlockSettings settings) { + super(settings); + } + + public CompatBlock(BlockSettingsBuilder builder, CompatIdentifier id) { + super(builder.build(id)); + } + + public CompatBlock(BlockSettingsBuilder builder) { + super(builder.build()); + } + + public ItemWrapper getItemWrapper() { + return getWrapper().asItem(); + } + + public VoxelShape getCollisionShapeM(CollisionShapeEvent e) { + return VoxelShape.of(super.getCollisionShape(e)); + } + + public VoxelShape getOutlineShapeM(OutlineShapeEvent e) { + return VoxelShape.of(super.getOutlineShape(e)); + } + + public FluidState getFluidStateM(FluidStateArgs args) { + return FluidState.of(super.getFluidState(args)); + } + + @Override + @Deprecated + public net.minecraft.world.phys.shapes.VoxelShape getCollisionShape(CollisionShapeEvent e) { + return getCollisionShapeM(e).raw(); + } + + @Override + @Deprecated + public net.minecraft.world.phys.shapes.VoxelShape getOutlineShape(OutlineShapeEvent e) { + return getOutlineShapeM(e).raw(); + } + + @Override + @Deprecated + public net.minecraft.world.level.material.FluidState getFluidState(FluidStateArgs args) { + return getFluidStateM(args).getRaw(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java index c426de214..ce15a1e54 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/event/listener/WorldRenderContext.java @@ -19,6 +19,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.shapes.VoxelShape; +import net.pitan76.mcpitanlib.api.client.render.CompatMatrixStack; import net.pitan76.mcpitanlib.api.util.VoxelShapeUtil; import net.pitan76.mcpitanlib.api.util.client.render.VertexRenderingUtil; import net.pitan76.mcpitanlib.midohra.client.render.CameraWrapper; @@ -108,6 +109,10 @@ default void pop() { getMatrixStack().popPose(); } + default CompatMatrixStack getCompatMatrices() { + return CompatMatrixStack.of(getMatrixStack()); + } + default Optional getVertexConsumer() { if (getConsumers() == null) return Optional.empty(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java index 11493031f..b00c715a6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java @@ -8,7 +8,9 @@ import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.input.CharacterEvent; import net.minecraft.client.input.KeyEvent; +import net.minecraft.client.input.MouseButtonEvent; import net.minecraft.client.renderer.item.ItemModelResolver; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -362,4 +364,54 @@ public ItemModelResolver callGetItemRenderer() { public Component getPlayerInvTitle() { return playerInventoryTitle; } + + public boolean charTyped(CharEventArgs args) { + return super.charTyped(new CharacterEvent(args.getCharacter())); + } + + @Deprecated + @Override + public boolean charTyped(CharacterEvent event) { + return charTyped(new CharEventArgs(event.codepoint())); + } + + public boolean mouseScrolled(MouseScrolledArgs args) { + return super.mouseScrolled(args.getMouseX(), args.getMouseY(), args.getScrollX(), args.getScrollY()); + } + + @Deprecated + @Override + public boolean mouseScrolled(double x, double y, double scrollX, double scrollY) { + return mouseScrolled(new MouseScrolledArgs(x, y, scrollX, scrollY)); + } + + public boolean mouseClicked(MouseClickedArgs args) { + return super.mouseClicked(new MouseButtonEvent(args.getX(), args.getY(), args.getButtonInfo()), args.isDoubleClick()); + } + + @Deprecated + @Override + public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) { + return mouseClicked(new MouseClickedArgs(event.x(), event.y(), event.buttonInfo(), doubleClick)); + } + + public boolean mouseDragged(MouseDraggedArgs args) { + return super.mouseDragged(new MouseButtonEvent(args.getX(), args.getY(), args.getButtonInfo()), args.getDeltaX(), args.getDeltaY()); + } + + @Deprecated + @Override + public boolean mouseDragged(MouseButtonEvent event, double dx, double dy) { + return mouseDragged(new MouseDraggedArgs(event.x(), event.y(), event.buttonInfo(), dx, dy)); + } + + public boolean mouseReleased(MouseReleasedArgs args) { + return super.mouseReleased(new MouseButtonEvent(args.getX(), args.getY(), args.getButtonInfo())); + } + + @Deprecated + @Override + public boolean mouseReleased(MouseButtonEvent event) { + return mouseReleased(new MouseReleasedArgs(event.x(), event.y(), event.buttonInfo())); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java index 6139f1cec..1681b0053 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/option/CompatKeyBinding.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.api.client.option; import net.minecraft.client.KeyMapping; +import net.minecraft.client.input.KeyEvent; import net.minecraft.network.chat.Component; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; @@ -75,4 +76,8 @@ public KeyMapping toMinecraft() { public KeyMapping getRaw() { return keyBinding; } + + public boolean matches(int keyCode, int scanCode, int modifiers) { + return keyBinding.matches(new KeyEvent(keyCode, scanCode, modifiers)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java new file mode 100644 index 000000000..10fefbc48 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrix3x2fStack.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.client.render; + +import net.pitan76.mcpitanlib.api.util.MathUtil; +import org.joml.Matrix3x2fStack; + +public class CompatMatrix3x2fStack extends CompatMatrixStack { + private final Matrix3x2fStack matrices; + + public CompatMatrix3x2fStack(Matrix3x2fStack matrices) { + super(null); + this.matrices = matrices; + } + + @Deprecated + public Matrix3x2fStack get3x2fRaw() { + return matrices; + } + + public CompatMatrix3x2fStack push() { + get3x2fRaw().pushMatrix(); + return this; + } + + public CompatMatrix3x2fStack pop() { + get3x2fRaw().popMatrix(); + return this; + } + + public CompatMatrix3x2fStack translate(double x, double y, double z) { + get3x2fRaw().translate((float) x, (float) y); + return this; + } + + @Override + public CompatMatrixStack translate(float x, float y, float z) { + get3x2fRaw().translate(x, y); + return this; + } + + public CompatMatrix3x2fStack scale(float x, float y, float z) { + get3x2fRaw().scale(x, y); + return this; + } + + public CompatMatrix3x2fStack multiply(MathUtil.RotationAxisType type, float deg) { + return this; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java new file mode 100644 index 000000000..ad3962cac --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/CompatMatrixStack.java @@ -0,0 +1,51 @@ +package net.pitan76.mcpitanlib.api.client.render; + +import net.pitan76.mcpitanlib.api.util.MathUtil; +import net.pitan76.mcpitanlib.api.util.client.MatrixStackUtil; + +public class CompatMatrixStack { + private final com.mojang.blaze3d.vertex.PoseStack matrices; + + public CompatMatrixStack(com.mojang.blaze3d.vertex.PoseStack matrices) { + this.matrices = matrices; + } + + public static CompatMatrixStack of(com.mojang.blaze3d.vertex.PoseStack matrixStack) { + return new CompatMatrixStack(matrixStack); + } + + @Deprecated + public com.mojang.blaze3d.vertex.PoseStack getRaw() { + return matrices; + } + + public CompatMatrixStack push() { + MatrixStackUtil.push(getRaw()); + return this; + } + + public CompatMatrixStack pop() { + MatrixStackUtil.pop(getRaw()); + return this; + } + + public CompatMatrixStack translate(double x, double y, double z) { + MatrixStackUtil.translate(getRaw(), x, y, z); + return this; + } + + public CompatMatrixStack translate(float x, float y, float z) { + getRaw().translate(x, y, z); + return this; + } + + public CompatMatrixStack scale(float x, float y, float z) { + MatrixStackUtil.scale(getRaw(), x, y, z); + return this; + } + + public CompatMatrixStack multiply(MathUtil.RotationAxisType type, float deg) { + MatrixStackUtil.multiply(getRaw(), type, deg); + return this; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java index 8ebc49d3e..8b50aeb1a 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/DrawObjectDM.java @@ -9,6 +9,8 @@ import net.pitan76.mcpitanlib.api.util.client.ScreenUtil.RendererUtil; import org.joml.Matrix3x2fStack; +import java.util.List; + public class DrawObjectDM { private PoseStack stack; private Matrix3x2fStack matrix3x2fStack; @@ -86,6 +88,10 @@ public void drawTooltip(TextComponent text, int x, int y) { RendererUtil.drawTooltip(this, text, x, y); } + public void drawTooltip(List texts, int x, int y) { + RendererUtil.drawTooltip2(this, texts, x, y); + } + public void drawBorder(int x, int y, int width, int height, int color) { RendererUtil.drawBorder(this, x, y, width, height, color); } @@ -97,4 +103,8 @@ public int getWidth() { public int getHeight() { return hasScreen() ? screen.height : -1; } + + public CompatMatrixStack getMatrixStack() { + return new CompatMatrix3x2fStack(context.pose()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java index 150a61c0d..6928a24c4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/block/entity/event/BlockEntityRenderEvent.java @@ -13,6 +13,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.core.BlockPos; import net.pitan76.mcpitanlib.api.client.registry.CompatRegistryClient; +import net.pitan76.mcpitanlib.api.client.render.CompatMatrixStack; import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; import net.pitan76.mcpitanlib.api.client.render.DrawObjectMV; import net.pitan76.mcpitanlib.api.client.render.block.entity.CompatBlockEntityRenderer; @@ -122,6 +123,10 @@ public void scale(float x, float y, float z) { MatrixStackUtil.scale(matrices, x, y, z); } + public CompatMatrixStack getCompatMatrices() { + return CompatMatrixStack.of(matrices); + } + public ItemModelResolver getItemRenderer() { return ClientUtil.getItemRenderer(); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java new file mode 100644 index 000000000..5495b6bb3 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +public class CharEventArgs { + private final int character; + + public CharEventArgs(char character, int modifiers) { + this.character = character; + } + + public CharEventArgs(int codepoint) { + this.character = codepoint; + } + + public int getCharacter() { + return character; + } + + public char getChar() { + return (char) character; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java new file mode 100644 index 000000000..f1560c4f9 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseButtonArgs.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.minecraft.client.input.MouseButtonInfo; + +public class MouseButtonArgs { + public final double mouseX, mouseY; + public MouseButtonInfo buttonInfo = null; + + public MouseButtonArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo) { + this.mouseX = mouseX; + this.mouseY = mouseY; + this.buttonInfo = buttonInfo; + } + + public MouseButtonArgs(double mouseX, double mouseY, int button) { + this.mouseX = mouseX; + this.mouseY = mouseY; + this.buttonInfo = new MouseButtonInfo(button, 0); + } + + public double getX() { + return mouseX; + } + + public double getY() { + return mouseY; + } + + public int getButton() { + if (getButtonInfo() == null) return -1; + return getButtonInfo().button(); + } + + @Deprecated + public MouseButtonInfo getButtonInfo() { + return buttonInfo; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java new file mode 100644 index 000000000..5e3a494c0 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseClickedArgs.java @@ -0,0 +1,26 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.minecraft.client.input.MouseButtonInfo; + +public class MouseClickedArgs extends MouseButtonArgs { + public boolean doubleClick; + + public MouseClickedArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo, boolean doubleClick) { + super(mouseX, mouseY, buttonInfo); + this.doubleClick = doubleClick; + } + + public MouseClickedArgs(double mouseX, double mouseY, int button, boolean doubleClick) { + super(mouseX, mouseY, button); + this.doubleClick = doubleClick; + } + + public MouseClickedArgs(double mouseX, double mouseY, int button) { + this(mouseX, mouseY, button, false); + } + + @Deprecated + public boolean isDoubleClick() { + return doubleClick; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java new file mode 100644 index 000000000..f7889533e --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseDraggedArgs.java @@ -0,0 +1,29 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.minecraft.client.input.MouseButtonInfo; + +public class MouseDraggedArgs extends MouseButtonArgs { + + public final double dx; + public final double dy; + + public MouseDraggedArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo, double dx, double dy) { + super(mouseX, mouseY, buttonInfo); + this.dx = dx; + this.dy = dy; + } + + public MouseDraggedArgs(double mouseX, double mouseY, int button, double dx, double dy) { + super(mouseX, mouseY, button); + this.dx = dx; + this.dy = dy; + } + + public double getDeltaX() { + return dx; + } + + public double getDeltaY() { + return dy; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java new file mode 100644 index 000000000..9fc2948a6 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseReleasedArgs.java @@ -0,0 +1,14 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +import net.minecraft.client.input.MouseButtonInfo; + +public class MouseReleasedArgs extends MouseButtonArgs { + + public MouseReleasedArgs(double mouseX, double mouseY, MouseButtonInfo buttonInfo) { + super(mouseX, mouseY, buttonInfo); + } + + public MouseReleasedArgs(double mouseX, double mouseY, int button) { + super(mouseX, mouseY, button); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java new file mode 100644 index 000000000..0daf0c5b4 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/MouseScrolledArgs.java @@ -0,0 +1,37 @@ +package net.pitan76.mcpitanlib.api.client.render.handledscreen; + +public class MouseScrolledArgs { + private final double mouseX; + private final double mouseY; + private final double scrollX; + private final double scrollY; + private final double amount; + + public MouseScrolledArgs(double mouseX, double mouseY, double scrollX, double scrollY) { + this.mouseX = mouseX; + this.mouseY = mouseY; + this.scrollX = scrollX; + this.scrollY = scrollY; + this.amount = Math.sqrt(scrollX * scrollX + scrollY * scrollY); + } + + public double getMouseX() { + return mouseX; + } + + public double getMouseY() { + return mouseY; + } + + public double getScrollX() { + return scrollX; + } + + public double getScrollY() { + return scrollY; + } + + public double getAmount() { + return amount; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java index 6236e6eba..f0513e362 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatEntity.java @@ -20,7 +20,7 @@ import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; -public class CompatEntity extends Entity { +public class CompatEntity extends Entity implements ICompatEntity { public CompatEntity(EntityType type, Level world) { super(type, world); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java index d44118232..5e0bede7e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/CompatThrownItemEntity.java @@ -22,7 +22,7 @@ import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.entity.IEntityM; -public abstract class CompatThrownItemEntity extends ThrowableItemProjectile implements IEntityM { +public abstract class CompatThrownItemEntity extends ThrowableItemProjectile implements IEntityM, ICompatEntity { public CompatThrownItemEntity(EntityType entityType, Level world) { super(entityType, world); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java index ee004c2e6..afe7c33a7 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ExtendEntity.java @@ -14,7 +14,7 @@ import net.pitan76.mcpitanlib.api.nbt.NbtTag; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; -public class ExtendEntity extends Entity { +public class ExtendEntity extends Entity implements ICompatEntity { public ExtendEntity(EntityType type, Level world) { super(type, world); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ICompatEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ICompatEntity.java new file mode 100644 index 000000000..e603e5654 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/ICompatEntity.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.entity; + +import net.minecraft.world.entity.Entity; +import net.pitan76.mcpitanlib.api.util.EntityUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; + +public interface ICompatEntity { + default EntityWrapper getWrapper() { + return this instanceof Entity ? EntityWrapper.of((Entity) this) : EntityWrapper.of(); + } + + default EntityTypeWrapper getTypeWrapper() { + return EntityTypeWrapper.of(EntityUtil.getType((Entity) this)); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index c0e874708..33067a0e7 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -49,6 +49,8 @@ import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; import net.pitan76.mcpitanlib.core.mc261.ExtendedMenuProvider; import net.pitan76.mcpitanlib.core.player.ItemCooldown; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.server.MCServer; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; import java.util.*; @@ -615,4 +617,12 @@ public net.pitan76.mcpitanlib.midohra.util.math.Direction getHorizontalFacingM() public net.pitan76.mcpitanlib.midohra.item.ItemStack getCursorStackAsM() { return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getCursorStack()); } + + public EntityWrapper wrap() { + return EntityWrapper.of(getEntity()); + } + + public MCServer getServer() { + return getMidohraWorld().getMCServer(); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java index d20b974c8..f9ede4ac3 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/PlayerCommandEvent.java @@ -4,6 +4,8 @@ import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.command.argument.PlayerCommand; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; public class PlayerCommandEvent extends RequiredCommandEvent { public Entity getValue() { @@ -13,4 +15,12 @@ public Entity getValue() { throw new RuntimeException(e); } } + + public EntityWrapper getWrapper() { + return EntityWrapper.of(getValue()); + } + + public Player getValueAsPlayer() { + return getWrapper().toPlayer().orElse(null); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java index 8105d8907..a775f63f5 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/ServerCommandEvent.java @@ -12,6 +12,7 @@ import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.TextUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; public class ServerCommandEvent extends CommandEvent { @@ -130,4 +131,12 @@ public void sendSuccess(TextComponent message) { public void sendFailure(TextComponent message) { sendFailure(message.getText()); } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } + + public EntityWrapper getEntityWrapper() { + return EntityWrapper.of(getEntity()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java index 9180deb31..ad67208c4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/container/factory/ExtraDataArgs.java @@ -5,6 +5,7 @@ import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; public class ExtraDataArgs extends BaseEvent { public FriendlyByteBuf buf; @@ -52,4 +53,8 @@ public Player getCompatPlayer() { public void writeVar(Object obj) { PacketByteUtil.writeVar(getBuf(), obj); } + + public CompatPacketByteBuf getCompatBuf() { + return CompatPacketByteBuf.of(getBuf()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java index 588fd19b2..0e4b5d1fb 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemAppendTooltipEvent.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; +import java.util.stream.Collectors; public class ItemAppendTooltipEvent extends BaseEvent { public ItemStack stack; @@ -97,4 +98,16 @@ public void addTooltip(TextComponent textComponent) { public void addTooltip(String text) { addTooltip(TextUtil.literal(text)); } + + public net.pitan76.mcpitanlib.midohra.world.World getWorldM() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } + + public List getCompatTooltip() { + return getTooltip().stream().map(TextComponent::new).collect(Collectors.toList()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java index 5ed860d36..09b0d2971 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemBarStepArgs.java @@ -13,4 +13,8 @@ public ItemBarStepArgs(ItemStack stack) { public ItemStack getStack() { return stack; } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java index 78543e9e1..cd181ac54 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/ItemUseOnEntityEvent.java @@ -7,6 +7,7 @@ import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.event.BaseEvent; import net.pitan76.mcpitanlib.api.util.CompatActionResult; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; public class ItemUseOnEntityEvent extends BaseEvent { @@ -81,4 +82,8 @@ public Item getItem() { public ItemWrapper getItemWrapper() { return ItemWrapper.of(getItem()); } + + public EntityWrapper getEntityWrapper() { + return EntityWrapper.of(getEntity()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java index c396dbc24..c602d0973 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostHitEvent.java @@ -4,6 +4,8 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.api.item.ArmorEquipmentType; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; public class PostHitEvent extends BaseEvent { public ItemStack stack; @@ -36,4 +38,20 @@ public LivingEntity getTarget() { public void damageStack(int amount, EquipmentSlot slot) { stack.hurtAndBreak(amount, attacker, slot); } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } + + public EntityWrapper getAttackerM() { + return EntityWrapper.of(getAttacker()); + } + + public EntityWrapper getTargetM() { + return EntityWrapper.of(getTarget()); + } + + public void damageStack(int amount, ArmorEquipmentType type) { + damageStack(amount, type.getSlot()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java index 684630f08..4fb7744fb 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/item/PostMineEvent.java @@ -14,6 +14,10 @@ import net.pitan76.mcpitanlib.api.tag.TagKey; import net.pitan76.mcpitanlib.api.util.BlockUtil; import net.pitan76.mcpitanlib.api.util.WorldUtil; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityWrapper; +import net.pitan76.mcpitanlib.midohra.world.World; public class PostMineEvent extends BaseEvent { public ItemStack stack; @@ -114,4 +118,40 @@ public boolean isSneaking() { public ItemStack getMainHandStack() { return miner.getMainHandItem(); } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getStack()); + } + + public net.pitan76.mcpitanlib.midohra.item.ItemStack getMainHandStackM() { + return net.pitan76.mcpitanlib.midohra.item.ItemStack.of(getMainHandStack()); + } + + public World getWorldM() { + return World.of(getWorld()); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getStateM() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(getState()); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getPosM() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(getPos()); + } + + public BlockEntityWrapper getBlockEntityM() { + BlockEntity blockEntity = getBlockEntity(); + if (blockEntity != null) { + return BlockEntityWrapper.of(blockEntity); + } + return null; + } + + public EntityWrapper getMinerM() { + return EntityWrapper.of(getMiner()); + } + + public boolean stateIsOf(BlockWrapper block) { + return stateIsOf(block.get()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java index c78a0a69f..1b26b63b2 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/event/tile/TileTickEvent.java @@ -9,6 +9,9 @@ import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; import net.pitan76.mcpitanlib.midohra.holder.BlockStatePropertyHolder; import net.pitan76.mcpitanlib.midohra.world.IWorldView; +import net.pitan76.mcpitanlib.midohra.world.ServerWorld; + +import java.util.Optional; public class TileTickEvent implements BlockStatePropertyHolder { public Level world; @@ -89,4 +92,12 @@ public Block getBlock() { public BlockWrapper getBlockWrapper() { return BlockWrapper.of(getBlock()); } + + public Optional getOptionalServerWorld() { + return getMidohraWorld().toServerWorld(); + } + + public ServerWorld getServerWorld() { + return getOptionalServerWorld().orElse(null); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java index 5ca6bf658..d028a10ba 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/args/CreateMenuEvent.java @@ -3,6 +3,7 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.level.Level; import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; public class CreateMenuEvent { public int syncId; @@ -54,4 +55,12 @@ public boolean isClient() { public Level getWorld() { return getPlayer().getWorld(); } + + public CompatPlayerInventory getCompatPlayerInventory() { + return new CompatPlayerInventory(getPlayerInventory()); + } + + public net.pitan76.mcpitanlib.midohra.world.World getWorldM() { + return net.pitan76.mcpitanlib.midohra.world.World.of(getWorld()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java index 773beb145..6f3627469 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/IInventory.java @@ -6,6 +6,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.core.NonNullList; +import java.util.List; +import java.util.stream.Collectors; + public interface IInventory extends Container { NonNullList getItems(); @@ -74,4 +77,8 @@ default void setChanged() { default boolean stillValid(Player player) { return true; } + + default List getItemsM() { + return getItems().stream().map(net.pitan76.mcpitanlib.midohra.item.ItemStack::of).collect(Collectors.toList()); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java index 81863f2ea..94b50ba06 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItem.java @@ -1,7 +1,5 @@ package net.pitan76.mcpitanlib.api.item; -import net.minecraft.world.item.Item.Properties; -import net.minecraft.world.item.Item.TooltipContext; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.item.component.TooltipDisplay; import net.minecraft.world.entity.Entity; @@ -25,10 +23,9 @@ import net.pitan76.mcpitanlib.core.Dummy; import net.pitan76.mcpitanlib.mixin.UseOnContextMixin; -import java.util.List; import java.util.function.Consumer; -public class ExtendItem extends Item { +public class ExtendItem extends Item implements ICompatItem { public ExtendItem(Properties settings) { super(settings); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java index b5a366ad9..b553d08b4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ExtendItemProvider.java @@ -6,7 +6,7 @@ import net.pitan76.mcpitanlib.api.util.CompatActionResult; import net.pitan76.mcpitanlib.api.util.StackActionResult; -public interface ExtendItemProvider { +public interface ExtendItemProvider extends ICompatItem { /** * item right click event diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/ICompatItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ICompatItem.java new file mode 100644 index 000000000..3130b8fdc --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/ICompatItem.java @@ -0,0 +1,10 @@ +package net.pitan76.mcpitanlib.api.item; + +import net.minecraft.world.item.Item; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; + +public interface ICompatItem { + default ItemWrapper getWrapper() { + return this instanceof Item ? ItemWrapper.of((Item) this) : ItemWrapper.of(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/MiningSpeedMultiplierArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/MiningSpeedMultiplierArgs.java new file mode 100644 index 000000000..6ef871d2c --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/MiningSpeedMultiplierArgs.java @@ -0,0 +1,23 @@ +package net.pitan76.mcpitanlib.api.item.args.tool; + +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; + +public class MiningSpeedMultiplierArgs extends BaseEvent { + public ItemStack stack; + public BlockState state; + + public MiningSpeedMultiplierArgs(ItemStack stack, BlockState state) { + this.stack = stack; + this.state = state; + } + + public BlockState getState() { + return state; + } + + public ItemStack getStack() { + return stack; + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/SuitableForArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/SuitableForArgs.java new file mode 100644 index 000000000..29f7b6b78 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/args/tool/SuitableForArgs.java @@ -0,0 +1,21 @@ +package net.pitan76.mcpitanlib.api.item.args.tool; + +import net.pitan76.mcpitanlib.api.event.BaseEvent; +import net.pitan76.mcpitanlib.midohra.block.BlockState; +import net.pitan76.mcpitanlib.midohra.block.BlockWrapper; + +public class SuitableForArgs extends BaseEvent { + public BlockState state; + + public SuitableForArgs(BlockState state) { + this.state = state; + } + + public BlockState getState() { + return state; + } + + public BlockWrapper getBlock() { + return state.getBlock(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatItem.java new file mode 100644 index 000000000..5de0fd647 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/CompatItem.java @@ -0,0 +1,19 @@ +package net.pitan76.mcpitanlib.api.item.v3; + +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatItem extends net.pitan76.mcpitanlib.api.item.v2.CompatItem { + public CompatItem(CompatibleItemSettings settings) { + super(settings); + } + + public CompatItem(ItemSettingsBuilder builder, CompatIdentifier id) { + super(builder.build(id)); + } + + public CompatItem(ItemSettingsBuilder builder) { + super(builder.build()); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatAxeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatAxeItem.java new file mode 100644 index 000000000..fe745bee9 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatAxeItem.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleAxeItem; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatAxeItem extends CompatibleAxeItem { + + public CompatAxeItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings); + } + + public CompatAxeItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, ItemSettingsBuilder builder, CompatIdentifier id) { + this(material, attackDamage, attackSpeed, builder.build(id)); + } + + public CompatAxeItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, ItemSettingsBuilder builder) { + this(material, attackDamage, attackSpeed, builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatHoeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatHoeItem.java new file mode 100644 index 000000000..ab101244c --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatHoeItem.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleHoeItem; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatHoeItem extends CompatibleHoeItem { + + public CompatHoeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings); + } + + public CompatHoeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, ItemSettingsBuilder builder, CompatIdentifier id) { + this(material, attackDamage, attackSpeed, builder.build(id)); + } + + public CompatHoeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, ItemSettingsBuilder builder) { + this(material, attackDamage, attackSpeed, builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatMiningToolItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatMiningToolItem.java new file mode 100644 index 000000000..72fdb5c03 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatMiningToolItem.java @@ -0,0 +1,60 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleMiningToolItem; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.tag.TagKey; +import net.pitan76.mcpitanlib.api.tag.v2.CompatTagKey; +import net.pitan76.mcpitanlib.api.tag.v2.typed.BlockTagKey; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatMiningToolItem extends CompatibleMiningToolItem { + + public CompatMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, TagKey tagKey, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, tagKey, settings); + } + + public CompatMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatTagKey tagKey, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, tagKey, settings); + } + + public CompatMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, BlockTagKey tagKey, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, tagKey, settings); + } + + public CompatMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, TagKey tagKey, ItemSettingsBuilder builder, CompatIdentifier id) { + this(material, attackDamage, attackSpeed, tagKey, builder.build(id)); + } + + public CompatMiningToolItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, TagKey tagKey, ItemSettingsBuilder builder) { + this(material, attackDamage, attackSpeed, tagKey, builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatPickaxeItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatPickaxeItem.java new file mode 100644 index 000000000..674398e16 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatPickaxeItem.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatiblePickaxeItem; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatPickaxeItem extends CompatiblePickaxeItem { + + public CompatPickaxeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings); + } + + public CompatPickaxeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, ItemSettingsBuilder builder, CompatIdentifier id) { + this(material, attackDamage, attackSpeed, builder.build(id)); + } + + public CompatPickaxeItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, ItemSettingsBuilder builder) { + this(material, attackDamage, attackSpeed, builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShearsItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShearsItem.java new file mode 100644 index 000000000..f51ddf2cd --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShearsItem.java @@ -0,0 +1,47 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleShearsItem; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatShearsItem extends CompatibleShearsItem { + + public CompatShearsItem(CompatibleItemSettings settings) { + super(settings); + } + + public CompatShearsItem(ItemSettingsBuilder builder, CompatIdentifier id) { + this(builder.build(id)); + } + + public CompatShearsItem(ItemSettingsBuilder builder) { + this(builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShovelItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShovelItem.java new file mode 100644 index 000000000..522c8a87f --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatShovelItem.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleShovelItem; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatShovelItem extends CompatibleShovelItem { + + public CompatShovelItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings); + } + + public CompatShovelItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, ItemSettingsBuilder builder, CompatIdentifier id) { + this(material, attackDamage, attackSpeed, builder.build(id)); + } + + public CompatShovelItem(CompatibleToolMaterial material, float attackDamage, float attackSpeed, ItemSettingsBuilder builder) { + this(material, attackDamage, attackSpeed, builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatSwordItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatSwordItem.java new file mode 100644 index 000000000..0a52e8121 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatSwordItem.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleSwordItem; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatSwordItem extends CompatibleSwordItem { + + public CompatSwordItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, CompatibleItemSettings settings) { + super(material, attackDamage, attackSpeed, settings); + } + + public CompatSwordItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, ItemSettingsBuilder builder, CompatIdentifier id) { + this(material, attackDamage, attackSpeed, builder.build(id)); + } + + public CompatSwordItem(CompatibleToolMaterial material, int attackDamage, float attackSpeed, ItemSettingsBuilder builder) { + this(material, attackDamage, attackSpeed, builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatToolItem.java b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatToolItem.java new file mode 100644 index 000000000..58174dc9e --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/item/v3/tool/CompatToolItem.java @@ -0,0 +1,48 @@ +package net.pitan76.mcpitanlib.api.item.v3.tool; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.item.args.tool.MiningSpeedMultiplierArgs; +import net.pitan76.mcpitanlib.api.item.args.tool.SuitableForArgs; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolItem; +import net.pitan76.mcpitanlib.api.item.tool.CompatibleToolMaterial; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; + +public class CompatToolItem extends CompatibleToolItem { + + public CompatToolItem(CompatibleToolMaterial material, CompatibleItemSettings settings) { + super(material, settings); + } + + public CompatToolItem(CompatibleToolMaterial material, ItemSettingsBuilder builder, CompatIdentifier id) { + super(material, builder.build(id)); + } + + public CompatToolItem(CompatibleToolMaterial material, ItemSettingsBuilder builder) { + super(material, builder.build()); + } + + public float getMiningSpeedMultiplier(MiningSpeedMultiplierArgs args) { + return super.overrideGetMiningSpeedMultiplier(args.stack.toMinecraft(), args.state.toMinecraft()); + } + + @Override + @Deprecated + public float overrideGetMiningSpeedMultiplier(ItemStack stack, BlockState state) { + return getMiningSpeedMultiplier( + new MiningSpeedMultiplierArgs(net.pitan76.mcpitanlib.midohra.item.ItemStack.of(stack), + net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } + + public boolean isSuitableFor(SuitableForArgs args) { + return super.overrideIsSuitableFor(args.state.toMinecraft()); + } + + @Override + @Deprecated + public boolean overrideIsSuitableFor(BlockState state) { + return isSuitableFor(new SuitableForArgs(net.pitan76.mcpitanlib.midohra.block.BlockState.of(state))); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java index c742ce045..390cfb287 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/network/PacketByteUtil.java @@ -270,6 +270,18 @@ public static net.pitan76.mcpitanlib.midohra.util.math.BlockPos readBlockPosM(Fr public static FriendlyByteBuf writeBlockPos(FriendlyByteBuf buf, net.pitan76.mcpitanlib.midohra.util.math.BlockPos pos) { return writeBlockPos(buf, pos.toMinecraft()); } + + public static boolean isReadable(FriendlyByteBuf buf) {; + return buf.isReadable(); + } + + public static boolean isWritable(FriendlyByteBuf buf) { + return buf.isWritable(); + } + + public static boolean isReadable(FriendlyByteBuf buf, int size) { + return buf.isReadable(size); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java index 78bdf9da3..3e05afcd8 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/registry/FuelRegistry.java @@ -23,7 +23,7 @@ public static void allRegister(String namespace) { Map, Integer> map = FUEL_MAP.get(namespace); for (Map.Entry, Integer> entry : map.entrySet()) { - net.pitan76.mcpitanlib.core.registry.FuelRegistry.register(entry.getValue(), entry.getKey().get()); + net.pitan76.mcpitanlib.core.registry.FuelRegistry.register(entry.getValue(), entry.getKey()); } FUEL_MAP.remove(namespace); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java index c782d4d8c..304d535b8 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatBlockEntity.java @@ -25,7 +25,7 @@ import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; import org.jetbrains.annotations.Nullable; -public class CompatBlockEntity extends BlockEntity { +public class CompatBlockEntity extends BlockEntity implements ICompatBlockEntity { public CompatBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java index bb3e44f3a..10c5987b2 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/CompatChestBlockEntity.java @@ -16,11 +16,13 @@ import net.pitan76.mcpitanlib.api.event.nbt.WriteNbtArgs; import net.pitan76.mcpitanlib.api.packet.UpdatePacketType; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; import net.pitan76.mcpitanlib.api.util.NbtUtil; import net.pitan76.mcpitanlib.core.mc1216.NbtDataConverter; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; import org.jetbrains.annotations.Nullable; -public class CompatChestBlockEntity extends ChestBlockEntity { +public class CompatChestBlockEntity extends ChestBlockEntity implements ICompatBlockEntity { protected CompatChestBlockEntity(BlockEntityType blockEntityType, BlockPos blockPos, BlockState blockState) { super(blockEntityType, blockPos, blockState); } @@ -108,4 +110,24 @@ public void readNbt(CompoundTag nbt, HolderLookup.Provider registryLookup) { readNbtOverride(nbt); // ---- } + + public net.pitan76.mcpitanlib.midohra.world.World getMidohraWorld() { + return net.pitan76.mcpitanlib.midohra.world.World.of(BlockEntityUtil.getWorld(this)); + } + + public net.pitan76.mcpitanlib.midohra.util.math.BlockPos getMidohraPos() { + return net.pitan76.mcpitanlib.midohra.util.math.BlockPos.of(BlockEntityUtil.getPos(this)); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraBlockState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(BlockEntityUtil.getBlockState(this)); + } + + public net.pitan76.mcpitanlib.midohra.block.BlockState getMidohraCachedState() { + return net.pitan76.mcpitanlib.midohra.block.BlockState.of(BlockEntityUtil.getCachedState(this)); + } + + public CompatChestBlockEntity(BlockEntityTypeWrapper type, TileCreateEvent event) { + this(type.get(), event.getBlockPos(), event.getBlockState()); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ICompatBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ICompatBlockEntity.java new file mode 100644 index 000000000..51847ce14 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/ICompatBlockEntity.java @@ -0,0 +1,16 @@ +package net.pitan76.mcpitanlib.api.tile; + +import net.minecraft.world.level.block.entity.BlockEntity; +import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityWrapper; + +public interface ICompatBlockEntity { + default BlockEntityWrapper getWrapper() { + return this instanceof BlockEntity ? BlockEntityWrapper.of((BlockEntity) this) : BlockEntityWrapper.of(); + } + + default BlockEntityTypeWrapper getTypeWrapper() { + return BlockEntityTypeWrapper.of(BlockEntityUtil.getType((BlockEntity) this)); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java index 58aaba7e7..a4506ce68 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/EntityUtil.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.api.util; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Relative; @@ -361,4 +362,8 @@ public static void teleport(Entity entity, ServerLevel world, Vector3d pos, floa public static void teleport(Entity entity, ServerLevel raw, BlockPos pos, float yaw, float pitch, boolean resetCamera) { teleport(entity, raw, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch, resetCamera); } + + public static EntityType getType(Entity entity) { + return entity.getType(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java index ac6674b4a..16dabe77b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/InventoryUtil.java @@ -199,4 +199,32 @@ public static void clear(Container inventory) { public static void markDirty(Container inventory) { inventory.setChanged(); } + + public static net.pitan76.mcpitanlib.midohra.nbt.NbtCompound writeNbt(CompatRegistryLookup registryLookup, net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, NonNullList stacks, boolean setIfEmpty) { + return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(writeNbt(registryLookup, nbt.toMinecraft(), stacks, setIfEmpty)); + } + + public static net.pitan76.mcpitanlib.midohra.nbt.NbtCompound writeNbt(CompatRegistryLookup registryLookup, net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, NonNullList stacks) { + return writeNbt(registryLookup, nbt, stacks, true); + } + + public static void readNbt(CompatRegistryLookup registryLookup, net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, NonNullList stacks) { + readNbt(registryLookup, nbt.toMinecraft(), stacks); + } + + public static net.pitan76.mcpitanlib.midohra.nbt.NbtCompound writeNbt(net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs args, net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, NonNullList stacks, boolean setIfEmpty) { + return net.pitan76.mcpitanlib.midohra.nbt.NbtCompound.of(writeNbt(args, nbt.toMinecraft(), stacks, setIfEmpty)); + } + + public static net.pitan76.mcpitanlib.midohra.nbt.NbtCompound writeNbt(net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs args, net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, NonNullList stacks) { + return writeNbt(args, nbt, stacks, true); + } + + public static void readNbt(net.pitan76.mcpitanlib.api.event.nbt.NbtRWArgs args, net.pitan76.mcpitanlib.midohra.nbt.NbtCompound nbt, NonNullList stacks) { + readNbt(args, nbt.toMinecraft(), stacks); + } + + public static boolean canMergeItems(net.pitan76.mcpitanlib.midohra.item.ItemStack first, net.pitan76.mcpitanlib.midohra.item.ItemStack second) { + return canMergeItems(first.toMinecraft(), second.toMinecraft()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java index 270c418cd..cf1a96038 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/ScreenUtil.java @@ -16,9 +16,11 @@ import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; import org.jetbrains.annotations.Nullable; import java.util.List; +import java.util.stream.Collectors; @Environment(EnvType.CLIENT) public class ScreenUtil { @@ -207,6 +209,74 @@ public static void drawTooltip(DrawObjectDM drawObjectDM, TextComponent text, in public static void drawTooltip(DrawObjectDM drawObjectDM, List texts, int x, int y) { drawObjectDM.getContext().setComponentTooltipForNextFrame(getTextRenderer(), texts, x, y); } + + public static void drawTooltip2(DrawObjectDM drawObjectDM, List texts, int x, int y) { + drawTooltip(drawObjectDM, texts.stream().map(TextComponent::getText).collect(Collectors.toList()), x, y); + } + + public static void drawItem(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y) { + drawItem(drawObjectDM, stack.toMinecraft(), x, y); + } + + public static void drawItem(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y) { + drawObjectDM.getContext().item(stack, x, y); + } + + public static void drawItem(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y, int seed) { + drawItem(drawObjectDM, stack.toMinecraft(), x, y, seed); + } + + public static void drawItem(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y, int seed) { + drawObjectDM.getContext().item(stack, x, y, seed); + } + + public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y) { + drawItemWithoutEntity(drawObjectDM, stack.toMinecraft(), x, y); + } + + public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y) { + drawObjectDM.getContext().fakeItem(stack, x, y, 0); + } + + public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y, int seed) { + drawItemWithoutEntity(drawObjectDM, stack.toMinecraft(), x, y, seed); + } + + public static void drawItemWithoutEntity(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y, int seed) { + drawObjectDM.getContext().fakeItem(stack, x, y, seed); + } + + public static void drawItemInSlot(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y) { + drawItemInSlot(drawObjectDM, stack.toMinecraft(), x, y); + } + + public static void drawItemInSlot(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y) { + drawObjectDM.getContext().itemDecorations(getTextRenderer(), stack, x, y); + } + + public static void drawItemInSlot(DrawObjectDM drawObjectDM, ItemStack stack, int x, int y, String countText) { + drawItemInSlot(drawObjectDM, stack.toMinecraft(), x, y, countText); + } + + public static void drawItemInSlot(DrawObjectDM drawObjectDM, net.minecraft.world.item.ItemStack stack, int x, int y, String countText) { + drawObjectDM.getContext().itemDecorations(getTextRenderer(), stack, x, y, countText); + } + + public static void enableScissor(DrawObjectDM drawObjectDM, int x0, int y0, int x1, int y1) { + drawObjectDM.getContext().enableScissor(x0, y0, x1, y1); + } + + public static void disableScissor(DrawObjectDM drawObjectDM) { + drawObjectDM.getContext().disableScissor(); + } + + public static void fill(DrawObjectDM drawObjectDM, int x0, int y0, int x1, int y1, int color) { + drawObjectDM.getContext().fill(x0, y0, x1, y1, fixColor(color)); + } + + public static void fillGradient(DrawObjectDM drawObjectDM, int x0, int y0, int x1, int y1, int color0, int color1) { + drawObjectDM.getContext().fillGradient(x0, y0, x1, y1, fixColor(color0), fixColor(color1)); + } } public static int getWidth(Component text) { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java index cb892b5ed..02d1565c3 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/client/WindowUtil.java @@ -39,4 +39,16 @@ public static void setTitle(String title) { public static void close() { getWindow().close(); } + + public static int getX() { + return getWindow().getX(); + } + + public static int getY() { + return getWindow().getY(); + } + + public static double getScaleFactor() { + return getWindow().getGuiScale(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java index bfac1d570..cb6f47ea6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/collection/ItemStackList.java @@ -5,7 +5,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.core.NonNullList; import net.pitan76.mcpitanlib.api.gui.inventory.IInventory; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.api.util.InventoryUtil; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; +import net.pitan76.mcpitanlib.api.util.inventory.CompatInventory; +import net.pitan76.mcpitanlib.api.util.inventory.ICompatInventory; +import net.pitan76.mcpitanlib.api.util.inventory.InventoryWrapper; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; import org.apache.commons.lang3.Validate; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -219,4 +225,22 @@ public void set(int index, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) public boolean isEmpty(int index) { return get(index).isEmpty(); } + + public void writeNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + InventoryUtil.writeNbt(registryLookup, nbt, this); + } + + public void readNbt(NbtCompound nbt, CompatRegistryLookup registryLookup) { + InventoryUtil.readNbt(registryLookup, nbt, this); + } + + public static ItemStackList fromNbt(NbtCompound nbt, CompatRegistryLookup registryLookup, int size) { + ItemStackList list = ItemStackList.ofSize(size); + list.readNbt(nbt, registryLookup); + return list; + } + + public ICompatInventory toCompatInventory() { + return InventoryWrapper.of(toInventory()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java new file mode 100644 index 000000000..aa3f34151 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/util/math/MathUtil.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.api.util.math; + +import net.minecraft.util.Mth; + +public class MathUtil { + public static double clamp(double value, double min, double max) { + return Mth.clamp(value, min, max); + } + + public static float clamp(float value, float min, float max) { + return Mth.clamp(value, min, max); + } + + public static int clamp(int value, int min, int max) { + return Mth.clamp(value, min, max); + } + + public static long clamp(long value, long min, long max) { + return Mth.clamp(value, min, max); + } + + public static double lerp(double a, double b, double t) { + return Mth.lerp(t, a, b); + } + + public static float lerp(float a, float b, float t) { + return Mth.lerp(t, a, b); + } + + public static double inverseLerp(double a, double b, double value) { + return Mth.inverseLerp(a, b, value); + } + + public static int hsvToRgb(float hue, float saturation, float value) { + return Mth.hsvToRgb(hue, saturation, value); + } + + public static float hsvToArgb(float hue, float saturation, float value, int alpha) { + return Mth.hsvToArgb(hue, saturation, value, alpha); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java index 72b62330e..f9065e45f 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java @@ -5,16 +5,24 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import java.util.function.Supplier; + public class FuelRegistry { private FuelRegistry() { } @ExpectPlatform - public static void register(int time, ItemLike... item) { + public static void register(int time, Supplier item) { } + public static void register(int time, ItemLike... item) { + for (ItemLike i : item) { + register(time, () -> i); + } + } + @Deprecated public static int get(ItemStack stack) { return 0; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java index ea1023c36..4e4c0b3ce 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/BlockWrapper.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.midohra.block; import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.api.block.ICompatBlock; import net.pitan76.mcpitanlib.api.block.v2.CompatBlock; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.block.BlockUtil; @@ -187,4 +188,18 @@ public T getCompatBlock(Class clazz) { public Optional toCompatBlock(Class clazz) { return Optional.ofNullable(getCompatBlock(clazz)); } + + public T getICompatBlock(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof ICompatBlock) { + ICompatBlock compatBlock = (ICompatBlock) get(); + if (clazz.isInstance(compatBlock)) + return clazz.cast(compatBlock); + } + return null; + } + + public Optional toICompatBlock(Class clazz) { + return Optional.ofNullable(getICompatBlock(clazz)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java index 693ffa8cf..609786364 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/Blocks.java @@ -1,5 +1,10 @@ package net.pitan76.mcpitanlib.midohra.block; +import net.pitan76.mcpitanlib.api.util.block.BlockUtil; + +import java.util.List; +import java.util.stream.Collectors; + public class Blocks { public static BlockWrapper AIR = of(net.minecraft.world.level.block.Blocks.AIR); public static BlockWrapper STONE = of(net.minecraft.world.level.block.Blocks.STONE); @@ -768,4 +773,8 @@ public class Blocks { public static BlockWrapper of(net.minecraft.world.level.block.Block block) { return BlockWrapper.of(block); } + + public static List getBlocks() { + return BlockUtil.getBlocks().stream().map(BlockWrapper::of).collect(Collectors.toList()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java index b0e6d25de..be5585a64 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/BlockEntityWrapper.java @@ -3,6 +3,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.api.tile.ICompatBlockEntity; import net.pitan76.mcpitanlib.api.util.BlockEntityUtil; import net.pitan76.mcpitanlib.api.util.RegistryLookupUtil; import net.pitan76.mcpitanlib.api.util.world.TickerUtil; @@ -188,4 +189,22 @@ public int getY() { public int getZ() { return getPos().getZ(); } + + public BlockEntityTypeWrapper getType() { + return BlockEntityTypeWrapper.of(BlockEntityUtil.getType(get())); + } + + public T getICompatBlockEntity(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof ICompatBlockEntity) { + ICompatBlockEntity blockEntity = (ICompatBlockEntity) get(); + if (clazz.isInstance(blockEntity)) + return clazz.cast(blockEntity); + } + return null; + } + + public Optional toICompatBlockEntity(Class clazz) { + return Optional.ofNullable(getICompatBlockEntity(clazz)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java index 8ff27f939..d13581990 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/EntityWrapper.java @@ -3,6 +3,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.pitan76.mcpitanlib.api.entity.CompatEntity; +import net.pitan76.mcpitanlib.api.entity.ICompatEntity; import net.pitan76.mcpitanlib.api.entity.Player; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.EntityUtil; @@ -419,4 +420,54 @@ public double getY() { public double getZ() { return getPos().getZ(); } + + public T getICompatEntity(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof ICompatEntity) { + ICompatEntity compatEntity = (ICompatEntity) get(); + if (clazz.isInstance(compatEntity)) + return clazz.cast(compatEntity); + } + return null; + } + + public Optional toICompatEntity(Class clazz) { + return Optional.ofNullable(getICompatEntity(clazz)); + } + + public Vector3d getRotationVector() { + return Vector3d.of(EntityUtil.getRotationVector(get())); + } + + public void setFallDistance(float fallDistance) { + EntityUtil.setFallDistance(get(), fallDistance); + } + + public void setVelocityModified(boolean velocityModified) { + EntityUtil.setVelocityModified(get(), velocityModified); + } + + public void setSwimming(boolean swimming) { + EntityUtil.setSwimming(get(), swimming); + } + + public void setSprinting(boolean sprinting) { + EntityUtil.setSprinting(get(), sprinting); + } + + public void setSneaking(boolean sneaking) { + EntityUtil.setSneaking(get(), sneaking); + } + + public void setOnGround(boolean onGround) { + EntityUtil.setOnGround(get(), onGround); + } + + public void setUuid(UUID uuid) { + EntityUtil.setUuid(get(), uuid); + } + + public void setCustomName(String name) { + EntityUtil.setCustomName(get(), name); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java index 11fb703be..1178c01f6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/IEntityM.java @@ -1,6 +1,5 @@ package net.pitan76.mcpitanlib.midohra.entity; -import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; import net.pitan76.mcpitanlib.midohra.util.math.Vector3d; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java index 747ec716e..6c9d5810d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroupWrapper.java @@ -1,8 +1,13 @@ package net.pitan76.mcpitanlib.midohra.item; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.item.ItemGroupUtil; +import java.util.Collection; +import java.util.Collections; +import java.util.stream.Collectors; + public class ItemGroupWrapper { private final net.minecraft.world.item.CreativeModeTab itemGroup; @@ -68,4 +73,40 @@ public boolean equals(Object obj) { ItemGroupWrapper other = (ItemGroupWrapper) obj; return rawEquals(other); } + + public ItemWrapper getIconItem() { + return getIcon().getItem(); + } + + public Type getType() { + if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.CATEGORY)) { + return Type.CATEGORY; + } else if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.INVENTORY)) { + return Type.INVENTORY; + } else if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.HOTBAR)) { + return Type.HOTBAR; + } else if (get().getType().equals(net.minecraft.world.item.CreativeModeTab.Type.SEARCH)) { + return Type.SEARCH; + } + + return Type.EMPTY; + } + + public Collection getDisplayItems() { + if (isEmpty()) return Collections.emptyList(); + return get().getDisplayItems().stream().map(ItemStack::of).collect(Collectors.toList()); + } + + public TextComponent getDisplayName() { + if (isEmpty()) return new TextComponent(""); + return new TextComponent(get().getDisplayName()); + } + + public static enum Type { + EMPTY, + CATEGORY, + INVENTORY, + HOTBAR, + SEARCH, + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java index 9647ee005..44a155291 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemGroups.java @@ -1,7 +1,11 @@ package net.pitan76.mcpitanlib.midohra.item; +import net.minecraft.world.item.CreativeModeTabs; import net.pitan76.mcpitanlib.api.item.DefaultItemGroups; +import java.util.List; +import java.util.stream.Collectors; + public class ItemGroups { public static final ItemGroupWrapper BUILDING_BLOCKS = of(DefaultItemGroups.BUILDING_BLOCKS); public static final ItemGroupWrapper COLORED_BLOCKS = of(DefaultItemGroups.COLORED_BLOCKS); @@ -27,4 +31,12 @@ public class ItemGroups { private static ItemGroupWrapper of(net.minecraft.world.item.CreativeModeTab itemGroup) { return ItemGroupWrapper.of(itemGroup); } + + public static List getGroupsToDisplay() { + return CreativeModeTabs.allTabs().stream().map(ItemGroupWrapper::of).collect(Collectors.toList()); + } + + public static List getGroups() { + return CreativeModeTabs.tabs().stream().map(ItemGroupWrapper::of).collect(Collectors.toList()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java index 6f3e08a58..19645501e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.midohra.item; import net.minecraft.world.item.Item; +import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.ItemLike; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -9,10 +10,13 @@ import net.pitan76.mcpitanlib.api.item.stack.LoreUtil; import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.*; +import net.pitan76.mcpitanlib.api.util.client.ClientUtil; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class ItemStack { private final net.minecraft.world.item.ItemStack stack; @@ -259,4 +263,33 @@ public boolean instanceOf(ItemWrapper wrapper) { Class clazz = item.getClass(); return clazz.isInstance(getRawItem()); } + + public List getTooltip() { + return stack.getTooltipLines(Item.TooltipContext.EMPTY, ClientUtil.getClientPlayer(), ClientUtil.getOptions().getRaw().advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL) + .stream().map(TextComponent::new).collect(Collectors.toList()); + } + + public void putCustomNbt(String key, T value) { + CustomDataUtil.put(stack, key, value); + } + + public void putCustomNbt(String key, NbtCompound value) { + CustomDataUtil.put(stack, key, value.toMinecraft()); + } + + public T getCustomNbt(String key, Class clazz) { + return CustomDataUtil.get(stack, key, clazz); + } + + public NbtCompound getCustomNbt(String key) { + return NbtCompound.of(CustomDataUtil.get(stack, key)); + } + + public boolean hasCustomNbt(String key) { + return CustomDataUtil.has(stack, key); + } + + public void removeCustomNbt(String key) { + CustomDataUtil.remove(stack, key); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java index 1ef47f30d..d946d8a3c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemWrapper.java @@ -1,6 +1,7 @@ package net.pitan76.mcpitanlib.midohra.item; import net.minecraft.world.item.Item; +import net.pitan76.mcpitanlib.api.item.ICompatItem; import net.pitan76.mcpitanlib.api.item.v2.CompatItem; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.ItemStackUtil; @@ -203,4 +204,18 @@ public T getCompatItem(Class clazz) { public Optional toCompatItem(Class clazz) { return Optional.ofNullable(getCompatItem(clazz)); } + + public T getICompatItem(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof ICompatItem) { + ICompatItem compatItem = (ICompatItem) get(); + if (clazz.isInstance(compatItem)) + return clazz.cast(compatItem); + } + return null; + } + + public Optional toICompatItem(Class clazz) { + return Optional.ofNullable(getICompatItem(clazz)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java index 838320040..0d540109e 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/Items.java @@ -1,5 +1,10 @@ package net.pitan76.mcpitanlib.midohra.item; +import net.pitan76.mcpitanlib.api.util.item.ItemUtil; + +import java.util.List; +import java.util.stream.Collectors; + public class Items { public static ItemWrapper AIR = of(net.minecraft.world.item.Items.AIR); public static ItemWrapper STONE = of(net.minecraft.world.item.Items.STONE); @@ -981,4 +986,8 @@ public class Items { public static ItemWrapper of(net.minecraft.world.item.Item item) { return ItemWrapper.of(item); } + + public static List getItems() { + return ItemUtil.getItems().stream().map(ItemWrapper::of).collect(Collectors.toList()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java index 1d62e90d0..54eea2ee7 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtCompound.java @@ -152,4 +152,29 @@ public void putSimpleItemStack(String key, ItemStack stack) { public Optional getSimpleItemStack(String key) { return NbtUtil.getSimpleItemStack(nbt, key).map(ItemStack::of); } + + public NbtList getList(String key) { + return new NbtList(NbtUtil.getList(nbt, key)); + } + + public NbtList getList(String key, int type) { + return new NbtList(NbtUtil.getList(nbt, key, type)); + } + + public NbtList getNbtCompoundList(String key) { + return new NbtList(NbtUtil.getNbtCompoundList(nbt, key)); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + NbtCompound that = (NbtCompound) obj; + return nbt.equals(that.nbt); + } + + @Override + public int hashCode() { + return nbt.hashCode(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java index 32beba043..98301de48 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtElement.java @@ -117,4 +117,17 @@ public NbtInteger asNbtIntegerOrDefault(NbtInteger defaultInteger) { NbtInteger integer = asNbtInteger(); return integer != null ? integer : defaultInteger; } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + NbtElement that = (NbtElement) obj; + return nbt.equals(that.nbt); + } + + @Override + public int hashCode() { + return nbt.hashCode(); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java index cfa1403e8..1ca1c6841 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/nbt/NbtList.java @@ -1,5 +1,7 @@ package net.pitan76.mcpitanlib.midohra.nbt; +import net.pitan76.mcpitanlib.api.util.NbtUtil; + import java.util.AbstractList; import java.util.Optional; @@ -107,4 +109,20 @@ public net.minecraft.nbt.ListTag toMinecraft() { public NbtElement toElement() { return NbtElement.of(nbtList); } + + public static NbtList of() { + return new NbtList(NbtUtil.createNbtList()); + } + + public boolean add(ElementConvertible element) { + return add(element.toMinecraftNbtElement()); + } + + public void add(int index, ElementConvertible element) { + add(index, element.toMinecraftNbtElement()); + } + + public NbtElement set(int index, ElementConvertible element) { + return NbtElement.of(nbtList.set(index, element.toMinecraftNbtElement())); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java index 8a82ae9a2..30cf1d426 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java @@ -123,4 +123,21 @@ public CompatPacketByteBuf writeNbt(NbtCompound nbt) { PacketByteUtil.writeNbt(this, nbt); return this; } + + public CompatPacketByteBuf writeVar(Object obj) { + PacketByteUtil.writeVar(this, obj); + return this; + } + + public boolean isReadable() { + return PacketByteUtil.isReadable(this); + } + + public boolean isWritable() { + return PacketByteUtil.isWritable(this); + } + + public boolean isReadable(int size) { + return PacketByteUtil.isReadable(this, size); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java index 8d97c6c2b..f12f943c3 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java @@ -3,12 +3,14 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeInput; +import net.pitan76.mcpitanlib.api.util.inventory.CompatInventory; import net.pitan76.mcpitanlib.midohra.item.ItemStack; import net.pitan76.mcpitanlib.midohra.recipe.input.RecipeInputOrInventory; import net.pitan76.mcpitanlib.midohra.recipe.input.TypedRecipeInputOrInventory; import net.pitan76.mcpitanlib.midohra.world.World; import java.util.List; +import java.util.stream.Collectors; public class Recipe { private final net.minecraft.world.item.crafting.Recipe recipe; @@ -88,4 +90,27 @@ public RecipeType getType() { public List getInputs() { return getRaw().placementInfo().ingredients(); } + + public ItemStack getOutput(World world) { + List ingredients = getInputs().stream() + .map(net.pitan76.mcpitanlib.midohra.recipe.Ingredient::of) + .collect(Collectors.toList()); + + CompatInventory inventory = new CompatInventory(ingredients.size()); + for (int i = 0; i < ingredients.size(); i++) { + ItemStack stack = ingredients.get(i).getMatchingStacksAsMidohra()[0]; + inventory.callSetStack(i, stack); + } + + return craftMidohra(RecipeInputOrInventory.of(inventory), world); + } + + private ItemStack cachedOutput = null; + + public ItemStack getCachedOutput(World world) { + if (cachedOutput == null) + cachedOutput = getOutput(world); + + return cachedOutput; + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java index 8be69bf92..a0cfd79fc 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/world/CompatPersistentState.java @@ -7,6 +7,15 @@ public abstract class CompatPersistentState extends CompatiblePersistentState { + @Deprecated + public CompatPersistentState() { + super(); + } + + public CompatPersistentState(String name) { + super(name); + } + @Deprecated @Override public CompoundTag writeNbt(WriteNbtArgs args) { diff --git a/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java index 6b8c11c1b..a07eb226f 100644 --- a/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java +++ b/fabric/src/main/java/net/pitan76/mcpitanlib/core/registry/fabric/FuelRegistryImpl.java @@ -3,12 +3,10 @@ import net.fabricmc.fabric.api.registry.FuelValueEvents; import net.minecraft.world.level.ItemLike; +import java.util.function.Supplier; + public class FuelRegistryImpl { - public static void register(int time, ItemLike... item) { - FuelValueEvents.BUILD.register(((builder, context) -> { - for (ItemLike i : item) { - builder.add(i.asItem(), context.baseSmeltTime() * time); - } - })); + public static void register(int time, Supplier item) { + FuelValueEvents.BUILD.register((builder, context) -> builder.add(item.get(), context.baseSmeltTime() * time)); } } diff --git a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java index e2d95ed3c..ee359d213 100644 --- a/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java +++ b/neoforge/src/main/java/net/pitan76/mcpitanlib/core/registry/neoforge/FuelRegistryImpl.java @@ -1,5 +1,6 @@ package net.pitan76.mcpitanlib.core.registry.neoforge; +import com.google.common.base.Supplier; import net.minecraft.world.item.Item; import net.minecraft.world.level.ItemLike; import net.neoforged.bus.api.SubscribeEvent; @@ -11,18 +12,22 @@ @EventBusSubscriber(modid = "mcpitanlib") public class FuelRegistryImpl { - private static final Map FUEL_TIMES = new HashMap<>(); + private static final Map, Integer> FUEL_TIMES = new HashMap<>(); - public static void register(int time, ItemLike... items) { + public static void register(int time, Supplier item) { int burnTimeTicks = 200 * time; - for (ItemLike itemLike : items) { - FUEL_TIMES.put(itemLike.asItem(), burnTimeTicks); - } + FUEL_TIMES.put(item, burnTimeTicks); } @SubscribeEvent public static void onFurnaceFuelBurnTime(FurnaceFuelBurnTimeEvent event) { Item item = event.getItemStack().getItem(); - if (FUEL_TIMES.containsKey(item)) event.setBurnTime(FUEL_TIMES.get(item)); + for (Map.Entry, Integer> entry : FUEL_TIMES.entrySet()) { + ItemLike itemLike = entry.getKey().get(); + if (itemLike != null && itemLike.asItem().equals(item)) { + event.setBurnTime(entry.getValue()); + break; + } + } } } \ No newline at end of file From 3e3028433d235810cb0d08fd2e7f2e169b6317d9 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 2 May 2026 17:47:59 +0900 Subject: [PATCH 143/151] [cp] bump version 3.6.7 --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index 0ac92740e..b61225f82 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.6 +mod_version=3.6.7 maven_group=net.pitan76 changelog=add APIs \ No newline at end of file From aa961e6a987ba09625a1803478b2f4ff5dc31f3a Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 2 May 2026 21:49:54 +0900 Subject: [PATCH 144/151] feat: add getModifiers method to CharEventArgs --- .../api/client/render/handledscreen/CharEventArgs.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java index 5495b6bb3..934f2a628 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/render/handledscreen/CharEventArgs.java @@ -18,4 +18,8 @@ public int getCharacter() { public char getChar() { return (char) character; } + + public int getModifiers() { + return 0; + } } From bcf1dfed7dd0c4e3eee4eb434abfe9c746a437a5 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sat, 2 May 2026 23:16:41 +0900 Subject: [PATCH 145/151] gradle --- common/build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/build.gradle b/common/build.gradle index 2ebebe848..e5a5c5525 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -10,6 +10,14 @@ loom { accessWidenerPath = file("src/main/resources/mcpitanlib.accesswidener") } +tasks.shadowJar { + enabled = false +} + +tasks.jar { + setArchiveClassifier(null) +} + publishing { publications { mavenCommon(MavenPublication) { From 920bf98f4ecc06a28a578463023c44b0ed3cf4db Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 3 May 2026 14:04:41 +0900 Subject: [PATCH 146/151] [cp] feat: add new FluidState and ITyped wrappers for enhanced fluid and block handling --- .../pitan76/mcpitanlib/api/entity/Player.java | 4 + .../midohra/block/ITypedBlockWrapper.java | 32 ++++ .../block/SupplierITypedBlockWrapper.java | 55 ++++++ .../block/SupplierTypedBlockWrapper.java | 2 +- .../midohra/block/TypedBlockWrapper.java | 8 +- .../SupplierTypedBlockEntityTypeWrapper.java | 2 +- .../SupplierTypedBlockEntityWrapper.java | 2 +- .../SupplierTypedEntityTypeWrapper.java | 2 +- .../mcpitanlib/midohra/fluid/FluidState.java | 24 +++ .../midohra/fluid/FluidWrapper.java | 4 + .../midohra/item/ITypedItemWrapper.java | 32 ++++ .../item/SupplierITypedItemWrapper.java | 55 ++++++ .../item/SupplierTypedBlockItemWrapper.java | 56 ++++++ .../item/SupplierTypedItemWrapper.java | 2 +- .../midohra/item/TypedBlockItemWrapper.java | 46 +++++ .../midohra/registry/MidohraRegistryV2.java | 163 ++++++++++++++++++ 16 files changed, 480 insertions(+), 9 deletions(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/ITypedBlockWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ITypedItemWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java index 33067a0e7..1098b3d55 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/entity/Player.java @@ -625,4 +625,8 @@ public EntityWrapper wrap() { public MCServer getServer() { return getMidohraWorld().getMCServer(); } + + public Optional getCurrentHandItemM() { + return getCurrentHandItem().map(net.pitan76.mcpitanlib.midohra.item.ItemStack::of); + } } \ No newline at end of file diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/ITypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/ITypedBlockWrapper.java new file mode 100644 index 000000000..fca9c46ad --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/ITypedBlockWrapper.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.api.block.ICompatBlock; + +public class ITypedBlockWrapper extends BlockWrapper { + protected ITypedBlockWrapper(T block) { + super((Block) block); + } + + public static ITypedBlockWrapper ofRaw(T item) { + return new ITypedBlockWrapper<>(item); + } + + public static ITypedBlockWrapper of(BlockWrapper wrapper) { + if (wrapper instanceof SupplierBlockWrapper) { + SupplierBlockWrapper supplierWrapper = (SupplierBlockWrapper) wrapper; + return SupplierITypedBlockWrapper.of(supplierWrapper); + } + + return new ITypedBlockWrapper<>((T) wrapper.get()); + } + + @Override + public Block get() { + return super.get(); + } + + public T getICompat() { + return (T) super.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java new file mode 100644 index 000000000..517edeba1 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.midohra.block; + +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.api.block.ICompatBlock; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierITypedBlockWrapper extends ITypedBlockWrapper { + private final Supplier supplier; + + protected SupplierITypedBlockWrapper(Supplier supplier) { + super(null); + this.supplier = supplier; + } + + public static ITypedBlockWrapper of(BlockWrapper wrapper) { + if (wrapper instanceof SupplierBlockWrapper) { + SupplierBlockWrapper supplierWrapper = (SupplierBlockWrapper) wrapper; + return SupplierITypedBlockWrapper.of(supplierWrapper); + } + + return new SupplierITypedBlockWrapper<>(() -> (T) wrapper.get()); + } + + public static SupplierITypedBlockWrapper of(Supplier supplier) { + return new SupplierITypedBlockWrapper<>(supplier); + } + + public static SupplierITypedBlockWrapper of(RegistryResult result) { + return new SupplierITypedBlockWrapper<>(result::get); + } + + public static SupplierITypedBlockWrapper of(RegistrySupplier result) { + return new SupplierITypedBlockWrapper<>(result::get); + } + + public static SupplierITypedBlockWrapper of(SupplierBlockWrapper result) { + return new SupplierITypedBlockWrapper<>(() -> (T) result.get()); + } + + public SupplierBlockWrapper asNonTyped() { + return SupplierBlockWrapper.of(this::get); + } + + @Override + public Block get() { + return (Block) supplier.get(); + } + + public T getICompat() { + return supplier.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java index 4e3dc94f4..b863d762c 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java @@ -31,7 +31,7 @@ public static SupplierTypedBlockWrapper of(SupplierBlockWra } public SupplierBlockWrapper asNonTyped() { - return SupplierBlockWrapper.of(supplier::get); + return SupplierBlockWrapper.of(this::get); } @Override diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java index 09d00338d..21b5255f9 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/TypedBlockWrapper.java @@ -3,12 +3,12 @@ import net.minecraft.world.level.block.Block; public class TypedBlockWrapper extends BlockWrapper { - protected TypedBlockWrapper(T item) { - super(item); + protected TypedBlockWrapper(T block) { + super(block); } - public static TypedBlockWrapper ofRaw(T item) { - return new TypedBlockWrapper<>(item); + public static TypedBlockWrapper ofRaw(T block) { + return new TypedBlockWrapper<>(block); } public static TypedBlockWrapper of(BlockWrapper wrapper) { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java index 7b08f0d6a..87f72addd 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java @@ -32,7 +32,7 @@ public static SupplierTypedBlockEntityTypeWrapper of( } public SupplierBlockEntityTypeWrapper asNonTyped() { - return SupplierBlockEntityTypeWrapper.of(supplier::get); + return SupplierBlockEntityTypeWrapper.of(this::get); } @Override diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java index f8b122a95..ea2525e06 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java @@ -31,7 +31,7 @@ public static SupplierTypedBlockEntityWrapper of(Supp } public SupplierBlockEntityWrapper asNonTyped() { - return SupplierBlockEntityWrapper.of(supplier::get); + return SupplierBlockEntityWrapper.of(this::get); } @Override diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java index 879b6c991..c646e3c1d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java @@ -32,7 +32,7 @@ public static SupplierTypedEntityTypeWrapper of(SupplierEn } public SupplierEntityTypeWrapper asNonTyped() { - return SupplierEntityTypeWrapper.of(supplier::get); + return SupplierEntityTypeWrapper.of(this::get); } @Override diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java index 5738f8d26..0a11e2bdc 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidState.java @@ -81,4 +81,28 @@ public boolean equals(Object obj) { FluidState other = (FluidState) obj; return getRaw().equals(other.getRaw()); } + + public FluidState(FluidWrapper fluid) { + this.fluidState = fluid.getDefaultState(); + } + + public static FluidState of(FluidWrapper fluid) { + return new FluidState(fluid); + } + + public static FluidState water() { + return of(Fluids.WATER); + } + + public static FluidState lava() { + return of(Fluids.LAVA); + } + + public static FluidState flowingWater() { + return of(Fluids.FLOWING_WATER); + } + + public static FluidState flowingLava() { + return of(Fluids.FLOWING_LAVA); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java index 703665cc1..75f2dd376 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/fluid/FluidWrapper.java @@ -101,4 +101,8 @@ public boolean equals(Object obj) { FluidWrapper other = (FluidWrapper) obj; return rawEquals(other); } + + public net.pitan76.mcpitanlib.midohra.fluid.FluidState createFluidState() { + return net.pitan76.mcpitanlib.midohra.fluid.FluidState.of(getDefaultState()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ITypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ITypedItemWrapper.java new file mode 100644 index 000000000..055d10ad5 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ITypedItemWrapper.java @@ -0,0 +1,32 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.world.item.Item; +import net.pitan76.mcpitanlib.api.item.ICompatItem; + +public class ITypedItemWrapper extends ItemWrapper { + protected ITypedItemWrapper(T item) { + super((Item) item); + } + + public static ITypedItemWrapper ofRaw(T item) { + return new ITypedItemWrapper<>(item); + } + + public static ITypedItemWrapper of(ItemWrapper wrapper) { + if (wrapper instanceof SupplierItemWrapper) { + SupplierItemWrapper supplierWrapper = (SupplierItemWrapper) wrapper; + return SupplierITypedItemWrapper.of(supplierWrapper); + } + + return new ITypedItemWrapper<>((T) wrapper.get()); + } + + @Override + public Item get() { + return super.get(); + } + + public T getICompat() { + return (T) super.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java new file mode 100644 index 000000000..ab30966dd --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java @@ -0,0 +1,55 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.world.item.Item; +import net.pitan76.mcpitanlib.api.item.ICompatItem; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; + +import java.util.function.Supplier; + +public class SupplierITypedItemWrapper extends ITypedItemWrapper { + private final Supplier supplier; + + protected SupplierITypedItemWrapper(Supplier supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierITypedItemWrapper of(ItemWrapper wrapper) { + if (wrapper instanceof SupplierItemWrapper) { + SupplierItemWrapper supplierWrapper = (SupplierItemWrapper) wrapper; + return SupplierITypedItemWrapper.of(supplierWrapper); + } + + return new SupplierITypedItemWrapper<>(() -> (T) wrapper.get()); + } + + public static SupplierITypedItemWrapper of(Supplier supplier) { + return new SupplierITypedItemWrapper<>(supplier); + } + + public static SupplierITypedItemWrapper of(RegistryResult result) { + return new SupplierITypedItemWrapper<>(result::get); + } + + public static SupplierITypedItemWrapper of(RegistrySupplier result) { + return new SupplierITypedItemWrapper<>(result::get); + } + + public static SupplierITypedItemWrapper of(SupplierItemWrapper result) { + return new SupplierITypedItemWrapper<>(() -> (T) result.get()); + } + + public SupplierItemWrapper asNonTyped() { + return SupplierItemWrapper.of(this::get); + } + + @Override + public Item get() { + return (Item) supplier.get(); + } + + public T getICompat() { + return supplier.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java new file mode 100644 index 000000000..1f65d5852 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java @@ -0,0 +1,56 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.block.SupplierTypedBlockWrapper; + +import java.util.function.Supplier; + +public class SupplierTypedBlockItemWrapper extends TypedBlockItemWrapper { + private final Supplier supplier; + + protected SupplierTypedBlockItemWrapper(Supplier supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierTypedBlockItemWrapper of(ItemWrapper wrapper) { + if (wrapper instanceof SupplierItemWrapper) { + return SupplierTypedBlockItemWrapper.of((SupplierItemWrapper) wrapper); + } + + return SupplierTypedBlockItemWrapper.of(() -> (T) wrapper.asBlock().get()); + } + + public static SupplierTypedBlockItemWrapper of(Supplier supplier) { + return new SupplierTypedBlockItemWrapper<>(supplier); + } + + public static SupplierTypedBlockItemWrapper of(RegistryResult result) { + return new SupplierTypedBlockItemWrapper<>(result::get); + } + + public static SupplierTypedBlockItemWrapper of(RegistrySupplier result) { + return new SupplierTypedBlockItemWrapper<>(result::get); + } + + public static SupplierTypedBlockItemWrapper of(SupplierItemWrapper result) { + return new SupplierTypedBlockItemWrapper<>(() -> (T) ((BlockItem) result.get()).getBlock()); + } + + public SupplierItemWrapper asNonTyped() { + return SupplierItemWrapper.of(() -> get().asItem()); + } + + @Override + public SupplierTypedBlockWrapper asBlock() { + return SupplierTypedBlockWrapper.of(supplier); + } + + @Override + public BlockItem get() { + return (BlockItem) supplier.get().asItem(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java index 6b22b4b9e..99cd491c6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java @@ -31,7 +31,7 @@ public static SupplierTypedItemWrapper of(SupplierItemWrappe } public SupplierItemWrapper asNonTyped() { - return SupplierItemWrapper.of(supplier::get); + return SupplierItemWrapper.of(this::get); } @Override diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java new file mode 100644 index 000000000..6b7282206 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java @@ -0,0 +1,46 @@ +package net.pitan76.mcpitanlib.midohra.item; + +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.level.block.Block; +import net.pitan76.mcpitanlib.midohra.block.TypedBlockWrapper; + +public class TypedBlockItemWrapper extends ItemWrapper { + protected T block; + + protected TypedBlockItemWrapper(T block) { + super(block.asItem()); + this.block = block; + } + + public static TypedBlockItemWrapper ofRaw(T block) { + return new TypedBlockItemWrapper<>(block); + } + + public static TypedBlockItemWrapper of(TypedBlockWrapper wrapper) { + return ofRaw(wrapper.get()); + } + + public static TypedBlockItemWrapper of(ItemWrapper wrapper) { + if (wrapper instanceof SupplierItemWrapper) { + SupplierItemWrapper supplierWrapper = (SupplierItemWrapper) wrapper; + return SupplierTypedBlockItemWrapper.of(supplierWrapper); + } + + return TypedBlockItemWrapper.ofRaw((T) wrapper.asBlock().get()); + } + + @Override + public TypedBlockWrapper asBlock() { + return TypedBlockWrapper.ofRaw(block); + } + + @Override + public boolean isBlock() { + return true; + } + + @Override + public BlockItem get() { + return (BlockItem) super.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java new file mode 100644 index 000000000..c17a7ab3a --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java @@ -0,0 +1,163 @@ +package net.pitan76.mcpitanlib.midohra.registry; + +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.block.ICompatBlock; +import net.pitan76.mcpitanlib.api.entity.CompatEntity; +import net.pitan76.mcpitanlib.api.entity.EntityTypeBuilder; +import net.pitan76.mcpitanlib.api.item.ICompatItem; +import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; +import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; +import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.tile.BlockEntityTypeBuilder; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.block.*; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.SupplierTypedBlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.block.entity.TypedBlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.SupplierTypedEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.entity.TypedEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.item.*; + +import java.util.function.Supplier; + +public class MidohraRegistryV2 { + protected final MidohraRegistry registry; + + public MidohraRegistryV2(MidohraRegistry registry) { + this.registry = registry; + } + + public MidohraRegistryV2(CompatRegistryV2 registry) { + this(MidohraRegistry.of(registry)); + } + + public static MidohraRegistryV2 of(CompatRegistryV2 registry) { + return new MidohraRegistryV2(registry); + } + + public MidohraRegistry getMidohraRegistryV1() { + return registry; + } + + public CompatRegistryV2 getCompatRegistry() { + return getMidohraRegistryV1().getCompatRegistry(); + } + + public ItemWrapper registerRawItem(CompatIdentifier id, Supplier supplier) { + return registry.registerRawItem(id, supplier); + } + + public ItemWrapper registerRawItem(String id, Supplier supplier) { + return registry.registerRawItem(id, supplier); + } + + public SupplierITypedItemWrapper registerItem(CompatIdentifier id, Supplier supplier) { + ItemWrapper wrapper = registerRawItem(id, () -> (Item) supplier.get()); + return SupplierITypedItemWrapper.of(wrapper); + } + + public SupplierITypedItemWrapper registerItem(String id, Supplier supplier) { + return registerItem(fixId(id), supplier); + } + + public BlockWrapper registerRawBlock(CompatIdentifier id, Supplier supplier) { + return registry.registerRawBlock(id, supplier); + } + + public BlockWrapper registerRawBlock(String id, Supplier supplier) { + return registry.registerRawBlock(id, supplier); + } + + public ITypedBlockWrapper registerBlock(CompatIdentifier id, Supplier supplier) { + BlockWrapper wrapper = registerRawBlock(id, () -> (Block) supplier.get()); + return SupplierITypedBlockWrapper.of(wrapper); + } + + public ITypedBlockWrapper registerBlock(String id, Supplier supplier) { + return registerBlock(fixId(id), supplier); + } + + public BlockEntityTypeWrapper registerRawBlockEntityType(CompatIdentifier id, Supplier> supplier) { + return registry.registerRawBlockEntityType(id, supplier); + } + + public BlockEntityTypeWrapper registerRawBlockEntityType(String id, Supplier> supplier) { + return registry.registerRawBlockEntityType(id, supplier); + } + + public BlockEntityTypeWrapper registerRawBlockEntityType(CompatIdentifier id, BlockEntityTypeBuilder builder) { + return registry.registerRawBlockEntityType(id, builder); + } + + public BlockEntityTypeWrapper registerRawBlockEntityType(String id, BlockEntityTypeBuilder builder) { + return registry.registerRawBlockEntityType(id, builder); + } + + public TypedBlockEntityTypeWrapper registerBlockEntityType0(CompatIdentifier id, BlockEntityTypeBuilder builder) { + BlockEntityTypeWrapper wrapper = registerRawBlockEntityType(id, builder); + return SupplierTypedBlockEntityTypeWrapper.of(() -> (BlockEntityType) wrapper.get()); + } + + public EntityTypeWrapper registerRawEntityType(CompatIdentifier id, Supplier> supplier) { + return registry.registerRawEntityType(id, supplier); + } + + public EntityTypeWrapper registerRawEntityType(String id, Supplier> supplier) { + return registry.registerRawEntityType(id, supplier); + } + + public EntityTypeWrapper registerRawEntityType(CompatIdentifier id, EntityTypeBuilder builder) { + return registry.registerRawEntityType(id, builder); + } + + public EntityTypeWrapper registerRawEntityType(String id, EntityTypeBuilder builder) { + return registry.registerRawEntityType(id, builder); + } + + public TypedEntityTypeWrapper registerEntityType0(CompatIdentifier id, EntityTypeBuilder builder) { + EntityTypeWrapper wrapper = registerRawEntityType(id, builder); + return SupplierTypedEntityTypeWrapper.of(() -> (EntityType) wrapper.get()); + } + + public TypedEntityTypeWrapper registerEntityType0(String id, EntityTypeBuilder builder) { + return registerEntityType0(fixId(id), builder); + } + + public ItemWrapper registerRawBlockItem(CompatIdentifier id, Supplier block, CompatibleItemSettings settings) { + return registry.registerRawBlockItem(id, block, settings); + } + + public ItemWrapper registerRawBlockItem(CompatIdentifier id, Supplier block, ItemSettingsBuilder builder) { + return registry.registerRawBlockItem(id, block, builder); + } + + public SupplierTypedBlockItemWrapper registerBlockItem(CompatIdentifier id, BlockWrapper block, CompatibleItemSettings settings) { + return SupplierTypedBlockItemWrapper.of(registerRawBlockItem(id, block::get, settings)); + } + + public SupplierTypedBlockItemWrapper registerBlockItem(CompatIdentifier id, BlockWrapper block, ItemSettingsBuilder builder) { + return registerBlockItem(id, block, builder.build(id)); + } + + public SupplierTypedBlockItemWrapper registerBlockItem(String id, BlockWrapper block, CompatibleItemSettings settings) { + return registerBlockItem(fixId(id), block, settings); + } + + public SupplierTypedBlockItemWrapper registerBlockItem(String id, BlockWrapper block, ItemSettingsBuilder builder) { + return registerBlockItem(fixId(id), block, builder); + } + + /** + * If the id doesn't contain a namespace, add the default namespace to it. + * @param id The id to fix. + * @return The fixed id. + */ + public CompatIdentifier fixId(String id) { + return registry.fixId(id); + } +} From a6df298b83a9d45ddb7a9dd2b4145c77bb345c2e Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 3 May 2026 14:05:02 +0900 Subject: [PATCH 147/151] [cp] chore: bump version 3.6.8 --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index b61225f82..d9f1dc8c1 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.7 +mod_version=3.6.8 maven_group=net.pitan76 changelog=add APIs \ No newline at end of file From 5ad03909fb2b73b1ec4474929053347c040792d8 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 10 May 2026 13:38:22 +0900 Subject: [PATCH 148/151] [cp] feat: introduce INonTypedSupplier interface and enhance item, block, and entity wrappers --- .../api/block/v3/CompatBlockEntity.java | 34 +++ .../mcpitanlib/api/client/SimpleScreen.java | 5 + .../gui/screen/CompatInventoryScreen.java | 6 + .../gui/screen/SimpleHandledScreen.java | 5 + .../gui/screen/SimpleInventoryScreen.java | 6 + .../client/registry/CompatRegistryClient.java | 21 ++ .../api/gui/ExtendedScreenHandler.java | 18 ++ .../gui/ExtendedScreenHandlerTypeBuilder.java | 19 ++ .../api/gui/SimpleScreenHandler.java | 30 ++ .../gui/SimpleScreenHandlerTypeBuilder.java | 5 + .../api/gui/inventory/CompatIInventory.java | 62 ++++ .../gui/v3/ExtendedScreenHandlerFactory.java | 25 ++ .../gui/v3/SimpleScreenHandlerFactory.java | 24 ++ .../api/tile/v2/BlockEntityTypeBuilder.java | 19 +- .../core/registry/FuelRegistry.java | 13 + .../mcpitanlib/guilib/GuiRegistry.java | 29 ++ .../entity/v2/BlockEntityWithContainer.java | 15 + .../v2/ExtendedBlockEntityWithContainer.java | 41 +++ .../container/BlockEntityContainerGui.java | 20 +- .../guilib/api/container/ContainerGui.java | 9 + .../ExtendedBlockEntityContainerGui.java | 18 +- .../api/container/SimpleContainerGui.java | 9 + .../v2/ExtendedBlockEntityContainerGui.java | 31 ++ .../screen/BlockEntityContainerGuiScreen.java | 22 ++ .../guilib/api/screen/ContainerGuiScreen.java | 6 + .../api/screen/SimpleContainerGuiScreen.java | 6 + .../midohra/block/SupplierBlockWrapper.java | 8 +- .../block/SupplierITypedBlockWrapper.java | 6 +- .../block/SupplierTypedBlockWrapper.java | 4 +- .../SupplierBlockEntityTypeWrapper.java | 8 +- .../entity/SupplierBlockEntityWrapper.java | 8 +- .../SupplierTypedBlockEntityTypeWrapper.java | 4 +- .../SupplierTypedBlockEntityWrapper.java | 4 +- .../midohra/core/INonTypedSupplier.java | 5 + .../entity/SupplierEntityTypeWrapper.java | 8 +- .../midohra/entity/SupplierEntityWrapper.java | 8 +- .../SupplierTypedEntityTypeWrapper.java | 4 +- .../mcpitanlib/midohra/item/ItemStack.java | 8 + .../item/SupplierITypedItemWrapper.java | 4 +- .../midohra/item/SupplierItemWrapper.java | 8 +- .../item/SupplierTypedBlockItemWrapper.java | 12 +- .../item/SupplierTypedItemWrapper.java | 4 +- .../midohra/item/TypedBlockItemWrapper.java | 6 +- .../midohra/network/CompatPacketByteBuf.java | 2 +- .../mcpitanlib/midohra/network/IByteBuf.java | 42 +++ .../midohra/network/PacketByteBuf.java | 266 ++++++++++++++++++ .../mcpitanlib/midohra/recipe/Recipe.java | 4 +- .../midohra/registry/MidohraRegistryV2.java | 38 ++- .../screen/ScreenHandlerTypeWrapper.java | 63 +++++ .../midohra/screen/ScreenHandlerWrapper.java | 121 ++++++++ .../SupplierScreenHandlerTypeWrapper.java | 38 +++ ...SupplierTypedScreenHandlerTypeWrapper.java | 44 +++ .../screen/TypedScreenHandlerTypeWrapper.java | 33 +++ .../screen/TypedScreenHandlerWrapper.java | 17 ++ 54 files changed, 1236 insertions(+), 39 deletions(-) create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlockEntity.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/CompatIInventory.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/ExtendedScreenHandlerFactory.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/SimpleScreenHandlerFactory.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/BlockEntityWithContainer.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/ExtendedBlockEntityWithContainer.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/BlockEntityContainerGuiScreen.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/core/INonTypedSupplier.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/network/IByteBuf.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/network/PacketByteBuf.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerTypeWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierScreenHandlerTypeWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierTypedScreenHandlerTypeWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerTypeWrapper.java create mode 100644 common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerWrapper.java diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlockEntity.java b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlockEntity.java new file mode 100644 index 000000000..493a6fc08 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/block/v3/CompatBlockEntity.java @@ -0,0 +1,34 @@ +package net.pitan76.mcpitanlib.api.block.v3; + +import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.registry.CompatRegistryLookup; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; + +public class CompatBlockEntity extends net.pitan76.mcpitanlib.api.tile.CompatBlockEntity { + public CompatBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + } + + public CompatBlockEntity(BlockEntityType type, TileCreateEvent event) { + super(type, event); + } + + public CompatBlockEntity(BlockEntityTypeWrapper type, TileCreateEvent event) { + super(type, event); + } + + public NbtCompound toInitChunkDataNbt(CompatRegistryLookup registryLookup) { + return NbtCompound.of(super.toInitialChunkDataNbt(registryLookup)); + } + + @Override + @Deprecated + public CompoundTag toInitialChunkDataNbt(CompatRegistryLookup registryLookup) { + return toInitChunkDataNbt(registryLookup).toMinecraft(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java index 2eaf8989a..cc0f9f2cf 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/SimpleScreen.java @@ -15,6 +15,7 @@ import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.client.render.handledscreen.*; import net.pitan76.mcpitanlib.api.client.render.screen.RenderBackgroundTextureArgs; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.IdentifierUtil; import net.pitan76.mcpitanlib.api.util.client.RenderUtil; @@ -35,6 +36,10 @@ public SimpleScreen(Component title) { this.title = title; } + public SimpleScreen(TextComponent title) { + this(title.getText()); + } + public T addDrawableChild_compatibility(T drawableElement) { return super.addRenderableWidget(drawableElement); // addButton diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java index 9e55ffc07..9691117f6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/CompatInventoryScreen.java @@ -6,7 +6,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; public abstract class CompatInventoryScreen extends SimpleInventoryScreen { @@ -15,6 +17,10 @@ public CompatInventoryScreen(S handler, Inventory inventory, Component title) { super(handler, inventory, title); } + public CompatInventoryScreen(S handler, CompatPlayerInventory inventory, TextComponent title) { + this(handler, inventory.getRaw(), title.getText()); + } + public abstract CompatIdentifier getCompatTexture(); @Deprecated diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java index b00c715a6..788253e2f 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleHandledScreen.java @@ -26,6 +26,7 @@ import net.pitan76.mcpitanlib.api.util.client.ClientUtil; import net.pitan76.mcpitanlib.api.util.client.RenderUtil; import net.pitan76.mcpitanlib.api.util.client.ScreenUtil; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import net.pitan76.mcpitanlib.core.datafixer.Pair; public abstract class SimpleHandledScreen extends AbstractContainerScreen { @@ -44,6 +45,10 @@ public SimpleHandledScreen(S handler, Inventory inventory, Component title) { this.title = title; } + public SimpleHandledScreen(S handler, CompatPlayerInventory inventory, TextComponent title) { + this(handler, inventory.getRaw(), title.getText()); + } + @Deprecated @Override public S getMenu() { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java index d91656e9b..39b5f47a4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/gui/screen/SimpleInventoryScreen.java @@ -7,7 +7,9 @@ import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawMouseoverTooltipArgs; import net.pitan76.mcpitanlib.api.client.render.handledscreen.RenderArgs; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.client.RenderUtil; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; public abstract class SimpleInventoryScreen extends SimpleHandledScreen { @@ -15,6 +17,10 @@ public SimpleInventoryScreen(S handler, Inventory inventory, Component title) { super(handler, inventory, title); } + public SimpleInventoryScreen(S handler, CompatPlayerInventory inventory, TextComponent title) { + this(handler, inventory.getRaw(), title.getText()); + } + public abstract Identifier getTexture(); @Override diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java index c208bd14e..cad03cf8b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/client/registry/CompatRegistryClient.java @@ -41,8 +41,12 @@ import net.minecraft.resources.Identifier; import net.pitan76.mcpitanlib.MCPitanLib; import net.pitan76.mcpitanlib.api.client.color.CompatBlockColorProvider; +import net.pitan76.mcpitanlib.api.client.gui.screen.SimpleHandledScreen; import net.pitan76.mcpitanlib.api.client.render.CompatRenderLayer; import net.pitan76.mcpitanlib.api.client.render.EntityModelLayerContext; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import java.util.List; import java.util.function.Supplier; @@ -53,15 +57,32 @@ public static registerScreen(MCPitanLib.MOD_ID, type, factory); } + public static & MenuAccess> void registerScreen(MenuType type, ScreenFactory2 factory) { + registerScreen(MCPitanLib.MOD_ID, type, factory); + } + @ExpectPlatform public static > void registerScreen(String modId, MenuType type, ScreenFactory factory) { throw new AssertionError(); } + public static & MenuAccess> void registerScreen(String modId, MenuType type, ScreenFactory2 factory) { + registerScreen(modId, type, factory); + } + public interface ScreenFactory> { S create(H handler, Inventory inventory, Component text); } + public interface ScreenFactory2 & MenuAccess> extends ScreenFactory { + @Override + default S create(H handler, Inventory inventory, Component text) { + return create(handler, new CompatPlayerInventory(inventory), new TextComponent(text)); + } + + S create(H handler, CompatPlayerInventory inventory, TextComponent text); + } + @ExpectPlatform public static void registerParticle(ParticleType type, ParticleProvider factory) { throw new AssertionError(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java index 73ef4de9b..6454e86e5 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandler.java @@ -2,6 +2,8 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.midohra.network.IByteBuf; +import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; import org.jetbrains.annotations.Nullable; public class ExtendedScreenHandler extends SimpleScreenHandler { @@ -12,4 +14,20 @@ protected ExtendedScreenHandler(@Nullable MenuType type, int syncId, Friendly protected ExtendedScreenHandler(@Nullable MenuType type, int syncId) { super(type, syncId); } + + protected ExtendedScreenHandler(@Nullable MenuType type, int syncId, IByteBuf buf) { + this(type, syncId, buf.toRaw()); + } + + protected ExtendedScreenHandler(ScreenHandlerTypeWrapper type, int syncId) { + this(type.get(), syncId); + } + + protected ExtendedScreenHandler(ScreenHandlerTypeWrapper type, int syncId, IByteBuf buf) { + this(type.get(), syncId, buf); + } + + protected ExtendedScreenHandler(ScreenHandlerTypeWrapper type, int syncId, net.pitan76.mcpitanlib.midohra.network.PacketByteBuf buf) { + this(type.get(), syncId, buf); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java index a9a4562d3..1b79983a4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/ExtendedScreenHandlerTypeBuilder.java @@ -11,6 +11,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.midohra.screen.TypedScreenHandlerTypeWrapper; public class ExtendedScreenHandlerTypeBuilder { @@ -24,6 +25,10 @@ public ExtendedScreenHandlerTypeBuilder(Factory2 factory) { this.factory = factory; } + public ExtendedScreenHandlerTypeBuilder(Factory3 factory) { + this.factory = factory; + } + public static StreamCodec CODEC = ByteBufCodecs.BYTE_ARRAY.map( (data) -> new FriendlyByteBuf(Unpooled.wrappedBuffer(data)) , (buf) -> ByteBufUtil.getBytes(buf.unwrap())); @@ -37,6 +42,10 @@ public static MenuType build(Factory fac throw new AssertionError(); } + public TypedScreenHandlerTypeWrapper buildWrapper() { + return TypedScreenHandlerTypeWrapper.ofRaw(build(factory)); + } + @FunctionalInterface public interface Factory { T create(int syncId, Inventory inventory, FriendlyByteBuf buf); @@ -51,4 +60,14 @@ default T create(int syncId, Inventory inventory, FriendlyByteBuf buf) { return create(new CreateMenuEvent(syncId, inventory), buf); } } + + @FunctionalInterface + public interface Factory3 extends Factory2 { + T create(CreateMenuEvent e, net.pitan76.mcpitanlib.midohra.network.PacketByteBuf buf); + + @Override + default T create(CreateMenuEvent e, FriendlyByteBuf buf) { + return create(e, net.pitan76.mcpitanlib.midohra.network.PacketByteBuf.of(buf)); + } + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java index f0ea77dc5..5772c90a5 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandler.java @@ -13,6 +13,8 @@ import net.pitan76.mcpitanlib.api.util.ItemStackUtil; import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; import net.pitan76.mcpitanlib.api.util.SlotUtil; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; +import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -304,4 +306,32 @@ public boolean canInsertIntoSlotOverride(net.pitan76.mcpitanlib.midohra.item.Ite public boolean canInsertIntoSlotOverride(Slot slot) { return super.canDragTo(slot); } + + /** + * Add player main inventory slots + * @param inventory target player inventory + * @param x start x + * @param y start y + */ + protected List addPlayerMainInventorySlots(CompatPlayerInventory inventory, int x, int y) { + return this.addPlayerMainInventorySlots(inventory.getRaw(), x, y); + } + + /** + * Add player hotbar slots + * @param inventory target player inventory + * @param x start x + * @param y start y + */ + protected List addPlayerHotbarSlots(CompatPlayerInventory inventory, int x, int y) { + return this.addPlayerHotbarSlots(inventory.getRaw(), x, y); + } + + protected SimpleScreenHandler(ScreenHandlerTypeWrapper type, int syncId) { + super(type.get(), syncId); + } + + protected SimpleScreenHandler(ScreenHandlerTypeWrapper type, CreateMenuEvent e) { + this(type, e.getSyncId()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java index c4e340f3c..a03ae4c4a 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/SimpleScreenHandlerTypeBuilder.java @@ -5,6 +5,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.midohra.screen.TypedScreenHandlerTypeWrapper; public class SimpleScreenHandlerTypeBuilder { @@ -22,6 +23,10 @@ public MenuType build() { return build(factory); } + public TypedScreenHandlerTypeWrapper buildWrapper() { + return TypedScreenHandlerTypeWrapper.ofRaw(build(factory)); + } + @ExpectPlatform public static MenuType build(Factory factory) { throw new AssertionError(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/CompatIInventory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/CompatIInventory.java new file mode 100644 index 000000000..4a052d2b6 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/inventory/CompatIInventory.java @@ -0,0 +1,62 @@ +package net.pitan76.mcpitanlib.api.gui.inventory; + +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; + +public interface CompatIInventory extends IInventory { + static CompatIInventory of(ItemStackList items) { + return () -> items; + } + + static CompatIInventory ofSize(int size) { + return of(ItemStackList.ofSize(size)); + } + + default int callSize() { + return getContainerSize(); + } + + default boolean callIsEmpty() { + return isEmpty(); + } + + default ItemStack getStackM(int slot) { + return ItemStack.of(getItem(slot)); + } + + + default ItemStack removeStackM(int slot, int count) { + return ItemStack.of(removeItem(slot, count)); + } + + default ItemStack removeStackM(int slot) { + return ItemStack.of(removeItemNoUpdate(slot)); + } + + default void setStack(int slot, ItemStack stack) { + setItem(slot, stack.toMinecraft()); + } + + default void callClearCII() { + clearContent(); + } + + default void callMarkDirtyCII() { + setChanged(); + } + + default boolean canPlayerUseCII(Player player) { + return true; + } + + @Deprecated + @Override + default boolean stillValid(net.minecraft.world.entity.player.Player player) { + return canPlayerUseCII(new Player(player)); + } + + default ItemStackList getCompatItems() { + return ItemStackList.of(getItemsM()); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/ExtendedScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/ExtendedScreenHandlerFactory.java new file mode 100644 index 000000000..c8beb6c7b --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/ExtendedScreenHandlerFactory.java @@ -0,0 +1,25 @@ +package net.pitan76.mcpitanlib.api.gui.v3; + +import net.minecraft.network.chat.Component; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.text.TextComponent; + +public interface ExtendedScreenHandlerFactory extends net.pitan76.mcpitanlib.api.gui.v2.ExtendedScreenHandlerFactory { + TextComponent getDisplayText(DisplayNameArgs args); + + @Deprecated + @Override + default Component getDisplayName(DisplayNameArgs args) { + return getDisplayText(args).getText(); + } + + @Override + default Component getDisplayName() { + return getDisplayText(new DisplayNameArgs()).getText(); + } + + @Override + SimpleScreenHandler createMenu(CreateMenuEvent event); +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/SimpleScreenHandlerFactory.java b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/SimpleScreenHandlerFactory.java new file mode 100644 index 000000000..52b8f807d --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/gui/v3/SimpleScreenHandlerFactory.java @@ -0,0 +1,24 @@ +package net.pitan76.mcpitanlib.api.gui.v3; + +import net.minecraft.network.chat.Component; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.text.TextComponent; + +public interface SimpleScreenHandlerFactory extends net.pitan76.mcpitanlib.api.gui.v2.SimpleScreenHandlerFactory { + TextComponent getDisplayText(DisplayNameArgs args); + + @Deprecated + @Override + default Component getDisplayName(DisplayNameArgs args) { + return getDisplayText(args).getText(); + } + + @Override + default Component getDisplayName() { + return getDisplayText(new DisplayNameArgs()).getText(); + } + + SimpleScreenHandler createMenu(CreateMenuEvent event); +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java index 0b308d60f..352e58bf4 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/api/tile/v2/BlockEntityTypeBuilder.java @@ -5,6 +5,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.midohra.block.SupplierBlockWrapper; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.ArrayList; import java.util.List; @@ -32,14 +33,22 @@ public static BlockEntityTypeBuilder create(BlockEnti } public static BlockEntityTypeBuilder createA(BlockEntityTypeBuilder.Factory factory, Supplier block) { - return new BlockEntityTypeBuilder<>(factory, blocks -> { - blocks.add(block.get()); - }); + return new BlockEntityTypeBuilder<>(factory, blocks -> blocks.add(block.get())); } public static BlockEntityTypeBuilder create(BlockEntityTypeBuilder.Factory factory, SupplierBlockWrapper wrapper) { - return new BlockEntityTypeBuilder<>(factory, blocks -> { - blocks.add(wrapper.get()); + return new BlockEntityTypeBuilder<>(factory, blocks -> blocks.add(wrapper.get())); + } + + public static BlockEntityTypeBuilder create(BlockEntityTypeBuilder.Factory factory, INonTypedSupplier wrapper) { + return create(factory, wrapper.asNonTyped()); + } + + public static BlockEntityTypeBuilder create(BlockEntityTypeBuilder.Factory factory, INonTypedSupplier... wrappers) { + return create(factory, blocks -> { + for (INonTypedSupplier wrapper : wrappers) { + blocks.add(wrapper.asNonTyped().get()); + } }); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java index f9065e45f..72a2877ae 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/core/registry/FuelRegistry.java @@ -4,6 +4,7 @@ import net.minecraft.world.level.ItemLike; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import net.pitan76.mcpitanlib.midohra.item.ItemWrapper; import java.util.function.Supplier; @@ -35,4 +36,16 @@ public static int get(Level world, ItemStack stack) { public static boolean isFuel(Level world, ItemStack stack) { return world.fuelValues().isFuel(stack); } + + public static void register(int time, ItemWrapper item) { + register(time, item::get); + } + + public static int get(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return get(world.toMinecraft(), stack.toMinecraft()); + } + + public static boolean isFuel(net.pitan76.mcpitanlib.midohra.world.World world, net.pitan76.mcpitanlib.midohra.item.ItemStack stack) { + return isFuel(world.toMinecraft(), stack.toMinecraft()); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java index f0b1bc976..da99c43b7 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java @@ -14,6 +14,7 @@ import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; import net.pitan76.mcpitanlib.guilib.api.screen.SimpleContainerGuiScreen; +import net.pitan76.mcpitanlib.midohra.screen.SupplierTypedScreenHandlerTypeWrapper; import java.util.function.Supplier; @@ -36,6 +37,26 @@ public static void registerSimpleContainerGui(Str CompatRegistryClient.registerScreen(id, type, SimpleContainerGuiScreen::new); } + @Environment(EnvType.CLIENT) + public static > void register(String id, SupplierResult> type, CompatRegistryClient.ScreenFactory factory) { + register(id, type.get(), factory); + } + + @Environment(EnvType.CLIENT) + public static void registerSimpleContainerGui(String id, SupplierResult> type) { + registerSimpleContainerGui(id, type.get()); + } + + @Environment(EnvType.CLIENT) + public static > void register(String id, SupplierTypedScreenHandlerTypeWrapper type, CompatRegistryClient.ScreenFactory factory) { + register(id, type.get(), factory); + } + + @Environment(EnvType.CLIENT) + public static void registerSimpleContainerGui(String id, SupplierTypedScreenHandlerTypeWrapper type) { + registerSimpleContainerGui(id, type.get()); + } + public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { return registry.registerScreenHandlerType(id, builder); } @@ -43,4 +64,12 @@ public static SupplierResult> regi public static SupplierResult> register(CompatRegistryV2 registry, CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { return registry.registerScreenHandlerType(id, builder); } + + public static SupplierTypedScreenHandlerTypeWrapper registerM(CompatRegistryV2 registry, CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { + return SupplierTypedScreenHandlerTypeWrapper.of(register(registry, id, builder)); + } + + public static SupplierTypedScreenHandlerTypeWrapper registerM(CompatRegistryV2 registry, CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { + return SupplierTypedScreenHandlerTypeWrapper.of(register(registry, id, builder)); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/BlockEntityWithContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/BlockEntityWithContainer.java new file mode 100644 index 000000000..965dcd771 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/BlockEntityWithContainer.java @@ -0,0 +1,15 @@ +package net.pitan76.mcpitanlib.guilib.api.block.entity.v2; + +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; + +public abstract class BlockEntityWithContainer extends net.pitan76.mcpitanlib.guilib.api.block.entity.BlockEntityWithContainer { + public BlockEntityWithContainer(BlockEntityType type, TileCreateEvent e) { + super(type, e); + } + + public BlockEntityWithContainer(BlockEntityTypeWrapper type, TileCreateEvent e) { + super(type.get(), e); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/ExtendedBlockEntityWithContainer.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/ExtendedBlockEntityWithContainer.java new file mode 100644 index 000000000..94b574bc7 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/block/entity/v2/ExtendedBlockEntityWithContainer.java @@ -0,0 +1,41 @@ +package net.pitan76.mcpitanlib.guilib.api.block.entity.v2; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.pitan76.mcpitanlib.api.entity.Player; +import net.pitan76.mcpitanlib.api.event.block.TileCreateEvent; +import net.pitan76.mcpitanlib.api.event.container.factory.DisplayNameArgs; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.gui.v3.ExtendedScreenHandlerFactory; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; +import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; + +public abstract class ExtendedBlockEntityWithContainer extends net.pitan76.mcpitanlib.guilib.api.block.entity.ExtendedBlockEntityWithContainer implements ExtendedScreenHandlerFactory { + public ExtendedBlockEntityWithContainer(BlockEntityType type, TileCreateEvent e) { + super(type, e); + } + + public ExtendedBlockEntityWithContainer(BlockEntityTypeWrapper type, TileCreateEvent e) { + super(type.get(), e); + } + + @Override + public void sync(Player player, FriendlyByteBuf buf) { + sync(player, CompatPacketByteBuf.of(buf)); + } + + public abstract void sync(Player player, CompatPacketByteBuf buf); + + @Override + public SimpleScreenHandler createMenu(CreateMenuEvent event) { + return null; + } + + @Override + public TextComponent getDisplayText(DisplayNameArgs args) { + if (getMidohraBlockState().isEmpty()) return TextComponent.of("unknown"); + return new TextComponent(getMidohraBlockState().getName()); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java index e83ae3b09..3279f09be 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/BlockEntityContainerGui.java @@ -2,10 +2,28 @@ import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; +import net.pitan76.mcpitanlib.midohra.block.entity.TypedBlockEntityWrapper; +import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; + +public abstract class BlockEntityContainerGui extends ContainerGui implements ISimpleScreenInfo { + + public T blockEntity; -public abstract class BlockEntityContainerGui extends ContainerGui implements ISimpleScreenInfo { protected BlockEntityContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } + + protected BlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e) { + super(type, e); + } + + public T getBlockEntity() { + return blockEntity; + } + + public TypedBlockEntityWrapper getBlockEntityWrapper() { + return TypedBlockEntityWrapper.ofRaw(blockEntity); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java index 82d4d223b..bd124f7e6 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ContainerGui.java @@ -8,6 +8,7 @@ import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.guilib.api.IScreenInfo; +import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; import java.util.ArrayList; import java.util.List; @@ -24,6 +25,14 @@ protected ContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } + protected ContainerGui(ScreenHandlerTypeWrapper type, int syncId) { + super(type, syncId); + } + + protected ContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e) { + super(type, e); + } + @Override public boolean canUse(Player player) { return true; diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java index 49d648d8f..0aa1c802d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/ExtendedBlockEntityContainerGui.java @@ -10,10 +10,10 @@ import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.api.util.WorldUtil; import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; +import net.pitan76.mcpitanlib.midohra.network.IByteBuf; +import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; -public abstract class ExtendedBlockEntityContainerGui extends BlockEntityContainerGui implements ISimpleScreenInfo { - - public T blockEntity; +public abstract class ExtendedBlockEntityContainerGui extends BlockEntityContainerGui implements ISimpleScreenInfo { public ExtendedBlockEntityContainerGui(MenuType type, CreateMenuEvent e, FriendlyByteBuf buf) { this(type, e); @@ -35,5 +35,17 @@ protected ExtendedBlockEntityContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } + public ExtendedBlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e, IByteBuf buf) { + this(type.get(), e, buf.toCompat()); + } + + public ExtendedBlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e, net.pitan76.mcpitanlib.midohra.network.PacketByteBuf buf) { + this(type.get(), e, buf.toCompat()); + } + + protected ExtendedBlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e) { + this(type.get(), e); + } + public abstract void receiveSync(FriendlyByteBuf buf); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java index 93cef2eeb..02451b523 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/SimpleContainerGui.java @@ -3,6 +3,7 @@ import net.minecraft.world.inventory.MenuType; import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; +import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; public abstract class SimpleContainerGui extends ContainerGui implements ISimpleScreenInfo { @@ -13,4 +14,12 @@ protected SimpleContainerGui(MenuType type, int syncId) { protected SimpleContainerGui(MenuType type, CreateMenuEvent e) { super(type, e); } + + protected SimpleContainerGui(ScreenHandlerTypeWrapper type, int syncId) { + this(type.get(), syncId); + } + + protected SimpleContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e) { + this(type.get(), e); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java new file mode 100644 index 000000000..cae230a68 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java @@ -0,0 +1,31 @@ +package net.pitan76.mcpitanlib.guilib.api.container.v2; + +import net.minecraft.network.FriendlyByteBuf; +import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; +import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; +import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; +import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; +import net.pitan76.mcpitanlib.midohra.network.IByteBuf; +import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; + +public abstract class ExtendedBlockEntityContainerGui extends net.pitan76.mcpitanlib.guilib.api.container.ExtendedBlockEntityContainerGui implements ISimpleScreenInfo { + + public ExtendedBlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e, IByteBuf buf) { + super(type.get(), e, buf.toCompat()); + } + + public ExtendedBlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e, net.pitan76.mcpitanlib.midohra.network.PacketByteBuf buf) { + super(type.get(), e, buf.toCompat()); + } + + protected ExtendedBlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateMenuEvent e) { + super(type.get(), e); + } + + public abstract void receiveSync(IByteBuf buf); + + @Override + public void receiveSync(FriendlyByteBuf buf) { + receiveSync((IByteBuf) new CompatPacketByteBuf(buf)); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/BlockEntityContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/BlockEntityContainerGuiScreen.java new file mode 100644 index 000000000..2dfdd1829 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/BlockEntityContainerGuiScreen.java @@ -0,0 +1,22 @@ +package net.pitan76.mcpitanlib.guilib.api.screen; + +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.pitan76.mcpitanlib.api.block.v3.CompatBlockEntity; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; +import net.pitan76.mcpitanlib.guilib.api.container.BlockEntityContainerGui; + +public class BlockEntityContainerGuiScreen, B extends CompatBlockEntity> extends ContainerGuiScreen { + public BlockEntityContainerGuiScreen(T handler, Inventory inventory, Component title) { + super(handler, inventory, title); + } + + public BlockEntityContainerGuiScreen(T handler, CompatPlayerInventory inventory, TextComponent title) { + this(handler, inventory.getRaw(), title.getText()); + } + + public B getBlockEntity() { + return handler.getBlockEntity(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java index a724eedc2..1642245e0 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/ContainerGuiScreen.java @@ -6,8 +6,10 @@ import net.pitan76.mcpitanlib.api.client.render.DrawObjectDM; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawBackgroundArgs; import net.pitan76.mcpitanlib.api.client.render.handledscreen.DrawForegroundArgs; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import net.pitan76.mcpitanlib.guilib.GuiTextures; import net.pitan76.mcpitanlib.guilib.api.container.ContainerGui; import net.pitan76.mcpitanlib.guilib.api.render.SlotRenderer; @@ -29,6 +31,10 @@ public ContainerGuiScreen(T handler, Inventory inventory, Component title) { setTitleY(handler.getScreenTitleY()); } + public ContainerGuiScreen(T handler, CompatPlayerInventory inventory, TextComponent title) { + this(handler, inventory.getRaw(), title.getText()); + } + @Override public void initOverride() { super.initOverride(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java index eaf6812f3..18dba7eef 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/screen/SimpleContainerGuiScreen.java @@ -2,6 +2,8 @@ import net.minecraft.world.entity.player.Inventory; import net.minecraft.network.chat.Component; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; public class SimpleContainerGuiScreen extends ContainerGuiScreen { @@ -9,6 +11,10 @@ public SimpleContainerGuiScreen(SimpleContainerGui handler, Inventory inventory, super(handler, inventory, title); } + public SimpleContainerGuiScreen(SimpleContainerGui handler, CompatPlayerInventory inventory, TextComponent title) { + super(handler, inventory, title); + } + @Override public void initOverride() { super.initOverride(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java index 4c798f789..3e85fe120 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierBlockWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.level.block.Block; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierBlockWrapper extends BlockWrapper { +public class SupplierBlockWrapper extends BlockWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierBlockWrapper(Supplier supplier) { @@ -25,6 +26,11 @@ public static SupplierBlockWrapper of(RegistrySupplier result) { return new SupplierBlockWrapper(result::get); } + @Override + public SupplierBlockWrapper asNonTyped() { + return this; + } + @Override public Block get() { return supplier.get(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java index 517edeba1..e6e930fec 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierITypedBlockWrapper.java @@ -4,10 +4,11 @@ import net.pitan76.mcpitanlib.api.block.ICompatBlock; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierITypedBlockWrapper extends ITypedBlockWrapper { +public class SupplierITypedBlockWrapper extends ITypedBlockWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierITypedBlockWrapper(Supplier supplier) { @@ -15,7 +16,7 @@ protected SupplierITypedBlockWrapper(Supplier supplier) { this.supplier = supplier; } - public static ITypedBlockWrapper of(BlockWrapper wrapper) { + public static SupplierITypedBlockWrapper of(BlockWrapper wrapper) { if (wrapper instanceof SupplierBlockWrapper) { SupplierBlockWrapper supplierWrapper = (SupplierBlockWrapper) wrapper; return SupplierITypedBlockWrapper.of(supplierWrapper); @@ -40,6 +41,7 @@ public static SupplierITypedBlockWrapper of(Supplier return new SupplierITypedBlockWrapper<>(() -> (T) result.get()); } + @Override public SupplierBlockWrapper asNonTyped() { return SupplierBlockWrapper.of(this::get); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java index b863d762c..f02e45c6a 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/SupplierTypedBlockWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.level.block.Block; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierTypedBlockWrapper extends TypedBlockWrapper { +public class SupplierTypedBlockWrapper extends TypedBlockWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierTypedBlockWrapper(Supplier supplier) { @@ -30,6 +31,7 @@ public static SupplierTypedBlockWrapper of(SupplierBlockWra return new SupplierTypedBlockWrapper<>(() -> (T) result.get()); } + @Override public SupplierBlockWrapper asNonTyped() { return SupplierBlockWrapper.of(this::get); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java index c9c267555..aa04508d9 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityTypeWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierBlockEntityTypeWrapper extends BlockEntityTypeWrapper { +public class SupplierBlockEntityTypeWrapper extends BlockEntityTypeWrapper implements INonTypedSupplier { private final Supplier> supplier; protected SupplierBlockEntityTypeWrapper(Supplier> supplier) { @@ -25,6 +26,11 @@ public static SupplierBlockEntityTypeWrapper of(RegistrySupplier get() { return supplier.get(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java index 9c8b68639..62008af08 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierBlockEntityWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierBlockEntityWrapper extends BlockEntityWrapper { +public class SupplierBlockEntityWrapper extends BlockEntityWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierBlockEntityWrapper(Supplier supplier) { @@ -25,6 +26,11 @@ public static SupplierBlockEntityWrapper of(RegistrySupplier result return new SupplierBlockEntityWrapper(result::get); } + @Override + public SupplierBlockEntityWrapper asNonTyped() { + return this; + } + @Override public BlockEntity get() { return supplier.get(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java index 87f72addd..6885dd71d 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityTypeWrapper.java @@ -4,10 +4,11 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierTypedBlockEntityTypeWrapper extends TypedBlockEntityTypeWrapper { +public class SupplierTypedBlockEntityTypeWrapper extends TypedBlockEntityTypeWrapper implements INonTypedSupplier { private final Supplier> supplier; protected SupplierTypedBlockEntityTypeWrapper(Supplier> supplier) { @@ -31,6 +32,7 @@ public static SupplierTypedBlockEntityTypeWrapper of( return new SupplierTypedBlockEntityTypeWrapper<>(() -> (BlockEntityType) result.get()); } + @Override public SupplierBlockEntityTypeWrapper asNonTyped() { return SupplierBlockEntityTypeWrapper.of(this::get); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java index ea2525e06..3aa680cbf 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/block/entity/SupplierTypedBlockEntityWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierTypedBlockEntityWrapper extends TypedBlockEntityWrapper { +public class SupplierTypedBlockEntityWrapper extends TypedBlockEntityWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierTypedBlockEntityWrapper(Supplier supplier) { @@ -30,6 +31,7 @@ public static SupplierTypedBlockEntityWrapper of(Supp return new SupplierTypedBlockEntityWrapper<>(() -> (T) result.get()); } + @Override public SupplierBlockEntityWrapper asNonTyped() { return SupplierBlockEntityWrapper.of(this::get); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/core/INonTypedSupplier.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/core/INonTypedSupplier.java new file mode 100644 index 000000000..ec505117d --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/core/INonTypedSupplier.java @@ -0,0 +1,5 @@ +package net.pitan76.mcpitanlib.midohra.core; + +public interface INonTypedSupplier { + T asNonTyped(); +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java index 8ccd81cad..973669b4b 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityTypeWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.entity.EntityType; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierEntityTypeWrapper extends EntityTypeWrapper { +public class SupplierEntityTypeWrapper extends EntityTypeWrapper implements INonTypedSupplier { private final Supplier> supplier; protected SupplierEntityTypeWrapper(Supplier> supplier) { @@ -25,6 +26,11 @@ public static SupplierEntityTypeWrapper of(RegistrySupplier> resul return new SupplierEntityTypeWrapper(result::get); } + @Override + public SupplierEntityTypeWrapper asNonTyped() { + return this; + } + @Override public EntityType get() { return supplier.get(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java index 409919b14..ea1c4d9ff 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierEntityWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.entity.Entity; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierEntityWrapper extends EntityWrapper { +public class SupplierEntityWrapper extends EntityWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierEntityWrapper(Supplier supplier) { @@ -25,6 +26,11 @@ public static SupplierEntityWrapper of(RegistrySupplier result) { return new SupplierEntityWrapper(result::get); } + @Override + public SupplierEntityWrapper asNonTyped() { + return this; + } + @Override public Entity get() { return supplier.get(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java index c646e3c1d..fa362a1e0 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/entity/SupplierTypedEntityTypeWrapper.java @@ -4,10 +4,11 @@ import net.minecraft.world.entity.EntityType; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierTypedEntityTypeWrapper extends TypedEntityTypeWrapper { +public class SupplierTypedEntityTypeWrapper extends TypedEntityTypeWrapper implements INonTypedSupplier { private final Supplier> supplier; protected SupplierTypedEntityTypeWrapper(Supplier> supplier) { @@ -31,6 +32,7 @@ public static SupplierTypedEntityTypeWrapper of(SupplierEn return new SupplierTypedEntityTypeWrapper<>(() -> (EntityType) result.get()); } + @Override public SupplierEntityTypeWrapper asNonTyped() { return SupplierEntityTypeWrapper.of(this::get); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java index 19645501e..3769ec767 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/ItemStack.java @@ -292,4 +292,12 @@ public boolean hasCustomNbt(String key) { public void removeCustomNbt(String key) { CustomDataUtil.remove(stack, key); } + + public boolean areItemsEqual(ItemStack other) { + return ItemStackUtil.areItemsEqual(this.stack, other.stack); + } + + public boolean areNbtOrComponentEqual(ItemStack other) { + return ItemStackUtil.areNbtOrComponentEqual(this.stack, other.stack); + } } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java index ab30966dd..306c47a01 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierITypedItemWrapper.java @@ -4,10 +4,11 @@ import net.pitan76.mcpitanlib.api.item.ICompatItem; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierITypedItemWrapper extends ITypedItemWrapper { +public class SupplierITypedItemWrapper extends ITypedItemWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierITypedItemWrapper(Supplier supplier) { @@ -40,6 +41,7 @@ public static SupplierITypedItemWrapper of(SupplierIt return new SupplierITypedItemWrapper<>(() -> (T) result.get()); } + @Override public SupplierItemWrapper asNonTyped() { return SupplierItemWrapper.of(this::get); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java index 2d8e6fd82..651f28160 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierItemWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierItemWrapper extends ItemWrapper { +public class SupplierItemWrapper extends ItemWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierItemWrapper(Supplier supplier) { @@ -25,6 +26,11 @@ public static SupplierItemWrapper of(RegistrySupplier result) { return new SupplierItemWrapper(result::get); } + @Override + public SupplierItemWrapper asNonTyped() { + return this; + } + @Override public Item get() { return supplier.get(); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java index 1f65d5852..ca99f3122 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedBlockItemWrapper.java @@ -5,10 +5,11 @@ import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; import net.pitan76.mcpitanlib.midohra.block.SupplierTypedBlockWrapper; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierTypedBlockItemWrapper extends TypedBlockItemWrapper { +public class SupplierTypedBlockItemWrapper extends TypedBlockItemWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierTypedBlockItemWrapper(Supplier supplier) { @@ -17,8 +18,8 @@ protected SupplierTypedBlockItemWrapper(Supplier supplier) { } public static SupplierTypedBlockItemWrapper of(ItemWrapper wrapper) { - if (wrapper instanceof SupplierItemWrapper) { - return SupplierTypedBlockItemWrapper.of((SupplierItemWrapper) wrapper); + if (wrapper instanceof INonTypedSupplier) { + return SupplierTypedBlockItemWrapper.of(((INonTypedSupplier) wrapper)); } return SupplierTypedBlockItemWrapper.of(() -> (T) wrapper.asBlock().get()); @@ -40,6 +41,11 @@ public static SupplierTypedBlockItemWrapper of(SupplierItem return new SupplierTypedBlockItemWrapper<>(() -> (T) ((BlockItem) result.get()).getBlock()); } + public static SupplierTypedBlockItemWrapper of(INonTypedSupplier result) { + return new SupplierTypedBlockItemWrapper<>(() -> (T) ((BlockItem) result.asNonTyped().get()).getBlock()); + } + + @Override public SupplierItemWrapper asNonTyped() { return SupplierItemWrapper.of(() -> get().asItem()); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java index 99cd491c6..242034e33 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/SupplierTypedItemWrapper.java @@ -3,10 +3,11 @@ import net.minecraft.world.item.Item; import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; import java.util.function.Supplier; -public class SupplierTypedItemWrapper extends TypedItemWrapper { +public class SupplierTypedItemWrapper extends TypedItemWrapper implements INonTypedSupplier { private final Supplier supplier; protected SupplierTypedItemWrapper(Supplier supplier) { @@ -30,6 +31,7 @@ public static SupplierTypedItemWrapper of(SupplierItemWrappe return new SupplierTypedItemWrapper<>(() -> (T) result.get()); } + @Override public SupplierItemWrapper asNonTyped() { return SupplierItemWrapper.of(this::get); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java index 6b7282206..588f05c63 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/item/TypedBlockItemWrapper.java @@ -3,6 +3,7 @@ import net.minecraft.world.item.BlockItem; import net.minecraft.world.level.block.Block; import net.pitan76.mcpitanlib.midohra.block.TypedBlockWrapper; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; public class TypedBlockItemWrapper extends ItemWrapper { protected T block; @@ -21,9 +22,8 @@ public static TypedBlockItemWrapper of(TypedBlockWrapper } public static TypedBlockItemWrapper of(ItemWrapper wrapper) { - if (wrapper instanceof SupplierItemWrapper) { - SupplierItemWrapper supplierWrapper = (SupplierItemWrapper) wrapper; - return SupplierTypedBlockItemWrapper.of(supplierWrapper); + if (wrapper instanceof INonTypedSupplier) { + return SupplierTypedBlockItemWrapper.of((INonTypedSupplier) wrapper); } return TypedBlockItemWrapper.ofRaw((T) wrapper.asBlock().get()); diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java index 30cf1d426..9f279f882 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/CompatPacketByteBuf.java @@ -5,7 +5,7 @@ import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; -public class CompatPacketByteBuf extends FriendlyByteBuf { +public class CompatPacketByteBuf extends FriendlyByteBuf implements IByteBuf { public CompatPacketByteBuf(FriendlyByteBuf buf) { super(buf); } diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/IByteBuf.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/IByteBuf.java new file mode 100644 index 000000000..4c3db9f8a --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/IByteBuf.java @@ -0,0 +1,42 @@ +package net.pitan76.mcpitanlib.midohra.network; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufConvertible; +import net.minecraft.network.FriendlyByteBuf; + +public interface IByteBuf extends ByteBufConvertible { + default CompatPacketByteBuf toCompat() { + if (this instanceof CompatPacketByteBuf) + return (CompatPacketByteBuf) this; + else if (this instanceof FriendlyByteBuf) + return new CompatPacketByteBuf((FriendlyByteBuf) this); + else + throw new UnsupportedOperationException("This IByteBuf cannot be converted to CompatPacketByteBuf"); + } + + default FriendlyByteBuf toRaw() { + if (this instanceof FriendlyByteBuf) + return (FriendlyByteBuf) this; + else + throw new UnsupportedOperationException("This IByteBuf is not a FriendlyByteBuf"); + } + + default net.pitan76.mcpitanlib.midohra.network.PacketByteBuf toMidohra() { + if (this instanceof net.pitan76.mcpitanlib.midohra.network.PacketByteBuf) + return (net.pitan76.mcpitanlib.midohra.network.PacketByteBuf) this; + else if (this instanceof CompatPacketByteBuf) + return new net.pitan76.mcpitanlib.midohra.network.PacketByteBuf((CompatPacketByteBuf) this); + else if (this instanceof FriendlyByteBuf) + return new net.pitan76.mcpitanlib.midohra.network.PacketByteBuf((FriendlyByteBuf) this); + else + throw new UnsupportedOperationException("This IByteBuf cannot be converted to PacketByteBuf"); + } + + @Override + default ByteBuf asByteBuf() { + if (this instanceof ByteBuf) + return (ByteBuf) this; + else + throw new UnsupportedOperationException("This IByteBuf cannot be converted to ByteBuf"); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/PacketByteBuf.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/PacketByteBuf.java new file mode 100644 index 000000000..a2ba4554f --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/network/PacketByteBuf.java @@ -0,0 +1,266 @@ +package net.pitan76.mcpitanlib.midohra.network; + +import net.minecraft.network.FriendlyByteBuf; +import net.pitan76.mcpitanlib.api.network.PacketByteUtil; +import net.pitan76.mcpitanlib.api.text.TextComponent; +import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; +import net.pitan76.mcpitanlib.midohra.nbt.NbtCompound; +import net.pitan76.mcpitanlib.midohra.nbt.NbtElement; +import net.pitan76.mcpitanlib.midohra.util.math.BlockPos; + +public class PacketByteBuf implements IByteBuf { + private final CompatPacketByteBuf buf; + + public PacketByteBuf() { + this.buf = new CompatPacketByteBuf(); + } + + public PacketByteBuf(CompatPacketByteBuf buf) { + this.buf = buf; + } + + public PacketByteBuf(FriendlyByteBuf buf) { + this.buf = new CompatPacketByteBuf(buf); + } + + public static PacketByteBuf of() { + return new PacketByteBuf(); + } + + public static PacketByteBuf of(CompatPacketByteBuf buf) { + return new PacketByteBuf(buf); + } + + public static PacketByteBuf of(FriendlyByteBuf buf) { + return new PacketByteBuf(buf); + } + + public CompatPacketByteBuf getBuf() { + return buf; + } + + @Override + public CompatPacketByteBuf toCompat() { + return getBuf(); + } + + @Override + public FriendlyByteBuf toRaw() { + return getBuf().getRaw(); + } + + @Override + public PacketByteBuf toMidohra() { + return this; + } + + @Override + public int hashCode() { + return getBuf().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + PacketByteBuf other = (PacketByteBuf) obj; + return getBuf().equals(other.getBuf()); + } + + public PacketByteBuf writeInt(int value) { + PacketByteUtil.writeInt(getBuf(), value); + return this; + } + + public int readInt() { + return PacketByteUtil.readInt(getBuf()); + } + + public PacketByteBuf writeLong(long value) { + PacketByteUtil.writeLong(getBuf(), value); + return this; + } + + public long readLong() { + return PacketByteUtil.readLong(getBuf()); + } + + public PacketByteBuf writeBool(boolean value) { + PacketByteUtil.writeBoolean(getBuf(), value); + return this; + } + + public boolean readBool() { + return PacketByteUtil.readBoolean(getBuf()); + } + + public PacketByteBuf writeFloat(float value) { + PacketByteUtil.writeFloat(getBuf(), value); + return this; + } + + public float readFloat() { + return PacketByteUtil.readFloat(getBuf()); + } + + public PacketByteBuf writeDouble(double value) { + PacketByteUtil.writeDouble(getBuf(), value); + return this; + } + + public double readDouble() { + return PacketByteUtil.readDouble(getBuf()); + } + + public PacketByteBuf writeString(String value) { + PacketByteUtil.writeString(getBuf(), value); + return this; + } + + public String readString() { + return PacketByteUtil.readString(getBuf()); + } + + public PacketByteBuf writeByte(byte bytes) { + PacketByteUtil.writeByte(getBuf(), bytes); + return this; + } + + public byte readByte() { + return PacketByteUtil.readByte(getBuf()); + } + + public PacketByteBuf writeBytes(byte[] bytes) { + PacketByteUtil.writeByteArray(getBuf(), bytes); + return this; + } + + public byte[] readBytes() { + return PacketByteUtil.readByteArray(getBuf()); + } + + public PacketByteBuf writeShort(short value) { + PacketByteUtil.writeShort(getBuf(), value); + return this; + } + + public short readShort() { + return PacketByteUtil.readShort(getBuf()); + } + + public PacketByteBuf writeVarInt(int value) { + PacketByteUtil.writeVarInt(getBuf(), value); + return this; + } + + public int readVarInt() { + return PacketByteUtil.readVarInt(getBuf()); + } + + public PacketByteBuf writeVarLong(long value) { + PacketByteUtil.writeVarLong(getBuf(), value); + return this; + } + + public long readVarLong() { + return PacketByteUtil.readVarLong(getBuf()); + } + + public PacketByteBuf writeVar(Object value) { + PacketByteUtil.writeVar(getBuf(), value); + return this; + } + + public ItemStack readItemStack() { + return ItemStack.of(PacketByteUtil.readItemStack(getBuf())); + } + + public PacketByteBuf writeItemStack(ItemStack stack) { + PacketByteUtil.writeItemStack(getBuf(), stack.toMinecraft()); + return this; + } + + public NbtCompound readNbt() { + return PacketByteUtil.readNbtM(getBuf()); + } + + public PacketByteBuf writeNbt(NbtCompound nbt) { + PacketByteUtil.writeNbt(getBuf(), nbt); + return this; + } + + public NbtElement readUnlimitedNbt() { + return NbtElement.of(PacketByteUtil.readUnlimitedNbt(getBuf())); + } + + public BlockPos readBlockPos() { + return PacketByteUtil.readBlockPosM(getBuf()); + } + + public PacketByteBuf writeBlockPos(BlockPos pos) { + PacketByteUtil.writeBlockPos(getBuf(), pos); + return this; + } + + public boolean isReadable() { + return PacketByteUtil.isReadable(getBuf()); + } + + public boolean isWritable() { + return PacketByteUtil.isWritable(getBuf()); + } + + public boolean isReadable(int size) { + return PacketByteUtil.isReadable(getBuf(), size); + } + + public boolean isWritable(int size) { + return getBuf().isWritable(size); + } + + public PacketByteBuf writeIntArray(int[] ints) { + PacketByteUtil.writeIntArray(getBuf(), ints); + return this; + } + + public int[] readIntArray() { + return PacketByteUtil.readIntArray(getBuf()); + } + + public PacketByteBuf writeLongArray(long[] longs) { + PacketByteUtil.writeLongArray(getBuf(), longs); + return this; + } + + public long[] readLongArray() { + return PacketByteUtil.readLongArray(getBuf()); + } + + public PacketByteBuf writeByteArray(byte[] bytes) { + PacketByteUtil.writeByteArray(getBuf(), bytes); + return this; + } + + public byte[] readByteArray() { + return PacketByteUtil.readByteArray(getBuf()); + } + + public PacketByteBuf writeId(CompatIdentifier id) { + PacketByteUtil.writeIdentifier(getBuf(), id.toMinecraft()); + return this; + } + + public CompatIdentifier readId() { + return CompatIdentifier.of(PacketByteUtil.readIdentifier(getBuf())); + } + + public PacketByteBuf writeText(TextComponent text) { + PacketByteUtil.writeText(getBuf(), text.getText()); + return this; + } + + public TextComponent readText() { + return new TextComponent(PacketByteUtil.readText(getBuf())); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java index f12f943c3..93c35c736 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/recipe/Recipe.java @@ -68,11 +68,11 @@ public ItemStack craftMidohra(RecipeInputOrInventory input, World world) { } public boolean matches(TypedRecipeInputOrInventory input, World world) { - return ((net.minecraft.world.item.crafting.Recipe)getRaw()).matches(input.getRecipeInput(), world.getRaw()); + return getRaw().matches(input.getRecipeInput(), world.getRaw()); } public net.minecraft.world.item.ItemStack craft(TypedRecipeInputOrInventory input, World world) { - return ((net.minecraft.world.item.crafting.Recipe)getRaw()).assemble(input.getRecipeInput()); + return getRaw().assemble(input.getRecipeInput()); } public ItemStack craftMidohra(TypedRecipeInputOrInventory input, World world) { diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java index c17a7ab3a..cfd0b0892 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/registry/MidohraRegistryV2.java @@ -1,12 +1,16 @@ package net.pitan76.mcpitanlib.midohra.registry; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.pitan76.mcpitanlib.api.block.ICompatBlock; import net.pitan76.mcpitanlib.api.entity.CompatEntity; import net.pitan76.mcpitanlib.api.entity.EntityTypeBuilder; +import net.pitan76.mcpitanlib.api.gui.ExtendedScreenHandlerTypeBuilder; +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; import net.pitan76.mcpitanlib.api.item.ICompatItem; import net.pitan76.mcpitanlib.api.item.v2.CompatibleItemSettings; import net.pitan76.mcpitanlib.api.item.v2.ItemSettingsBuilder; @@ -17,11 +21,10 @@ import net.pitan76.mcpitanlib.midohra.block.*; import net.pitan76.mcpitanlib.midohra.block.entity.BlockEntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.block.entity.SupplierTypedBlockEntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.block.entity.TypedBlockEntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.entity.EntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.entity.SupplierTypedEntityTypeWrapper; -import net.pitan76.mcpitanlib.midohra.entity.TypedEntityTypeWrapper; import net.pitan76.mcpitanlib.midohra.item.*; +import net.pitan76.mcpitanlib.midohra.screen.SupplierTypedScreenHandlerTypeWrapper; import java.util.function.Supplier; @@ -73,12 +76,12 @@ public BlockWrapper registerRawBlock(String id, Supplier supplier) { return registry.registerRawBlock(id, supplier); } - public ITypedBlockWrapper registerBlock(CompatIdentifier id, Supplier supplier) { + public SupplierITypedBlockWrapper registerBlock(CompatIdentifier id, Supplier supplier) { BlockWrapper wrapper = registerRawBlock(id, () -> (Block) supplier.get()); return SupplierITypedBlockWrapper.of(wrapper); } - public ITypedBlockWrapper registerBlock(String id, Supplier supplier) { + public SupplierITypedBlockWrapper registerBlock(String id, Supplier supplier) { return registerBlock(fixId(id), supplier); } @@ -98,7 +101,7 @@ public BlockEntityTypeWrapper registerRawBlockEnti return registry.registerRawBlockEntityType(id, builder); } - public TypedBlockEntityTypeWrapper registerBlockEntityType0(CompatIdentifier id, BlockEntityTypeBuilder builder) { + public SupplierTypedBlockEntityTypeWrapper registerBlockEntityType0(CompatIdentifier id, BlockEntityTypeBuilder builder) { BlockEntityTypeWrapper wrapper = registerRawBlockEntityType(id, builder); return SupplierTypedBlockEntityTypeWrapper.of(() -> (BlockEntityType) wrapper.get()); } @@ -119,12 +122,12 @@ public EntityTypeWrapper registerRawEntityType(String i return registry.registerRawEntityType(id, builder); } - public TypedEntityTypeWrapper registerEntityType0(CompatIdentifier id, EntityTypeBuilder builder) { + public SupplierTypedEntityTypeWrapper registerEntityType0(CompatIdentifier id, EntityTypeBuilder builder) { EntityTypeWrapper wrapper = registerRawEntityType(id, builder); return SupplierTypedEntityTypeWrapper.of(() -> (EntityType) wrapper.get()); } - public TypedEntityTypeWrapper registerEntityType0(String id, EntityTypeBuilder builder) { + public SupplierTypedEntityTypeWrapper registerEntityType0(String id, EntityTypeBuilder builder) { return registerEntityType0(fixId(id), builder); } @@ -152,6 +155,27 @@ public SupplierTypedBlockItemWrapper registerBlockItem(Stri return registerBlockItem(fixId(id), block, builder); } + public SupplierTypedScreenHandlerTypeWrapper registerRawScreenHandlerType(CompatIdentifier id, Supplier> supplier) { + Supplier> result = getCompatRegistry().registerScreenHandlerTypeSavingGenerics(id, supplier); + return SupplierTypedScreenHandlerTypeWrapper.of(result); + } + + public SupplierTypedScreenHandlerTypeWrapper registerScreenHandlerType(CompatIdentifier id, SimpleScreenHandlerTypeBuilder builder) { + return registerRawScreenHandlerType(id, builder::build); + } + + public SupplierTypedScreenHandlerTypeWrapper registerScreenHandlerType(CompatIdentifier id, ExtendedScreenHandlerTypeBuilder builder) { + return registerRawScreenHandlerType(id, builder::build); + } + + public SupplierTypedScreenHandlerTypeWrapper registerScreenHandlerType(String id, SimpleScreenHandlerTypeBuilder builder) { + return registerScreenHandlerType(fixId(id), builder); + } + + public SupplierTypedScreenHandlerTypeWrapper registerScreenHandlerType(String id, ExtendedScreenHandlerTypeBuilder builder) { + return registerScreenHandlerType(fixId(id), builder); + } + /** * If the id doesn't contain a namespace, add the default namespace to it. * @param id The id to fix. diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerTypeWrapper.java new file mode 100644 index 000000000..7ddb2288b --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerTypeWrapper.java @@ -0,0 +1,63 @@ +package net.pitan76.mcpitanlib.midohra.screen; + +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; + +public class ScreenHandlerTypeWrapper { + private final net.minecraft.world.inventory.MenuType type; + + public static final ScreenHandlerTypeWrapper EMPTY = new ScreenHandlerTypeWrapper(); + + protected ScreenHandlerTypeWrapper() { + this.type = null; + } + + protected ScreenHandlerTypeWrapper(net.minecraft.world.inventory.MenuType screenHandlerType) { + this.type = screenHandlerType; + } + + public static ScreenHandlerTypeWrapper of(net.minecraft.world.inventory.MenuType screenHandlerType) { + return new ScreenHandlerTypeWrapper(screenHandlerType); + } + + public static ScreenHandlerTypeWrapper of() { + return EMPTY; + } + + public net.minecraft.world.inventory.MenuType get() { + return type; + } + + public boolean isEmpty() { + return get() == null; + } + + public boolean isPresent() { + return get() != null; + } + + public ScreenHandlerWrapper createScreenHandler(int syncId, net.minecraft.world.entity.player.Inventory playerInventory) { + if (isEmpty()) return ScreenHandlerWrapper.EMPTY; + return ScreenHandlerWrapper.of(get().create(syncId, playerInventory)); + } + + public ScreenHandlerWrapper createScreenHandler(int syncId, CompatPlayerInventory playerInventory) { + return createScreenHandler(syncId, playerInventory.getRaw()); + } + + @Override + public int hashCode() { + return isEmpty() ? 0 : get().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + + ScreenHandlerTypeWrapper other = (ScreenHandlerTypeWrapper) obj; + if (isEmpty() && other.isEmpty()) return true; + if (isEmpty() || other.isEmpty()) return false; + + return get().equals(other.get()); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerWrapper.java new file mode 100644 index 000000000..1f771e5d6 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/ScreenHandlerWrapper.java @@ -0,0 +1,121 @@ +package net.pitan76.mcpitanlib.midohra.screen; + +import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandler; +import net.pitan76.mcpitanlib.api.util.ScreenHandlerUtil; +import net.pitan76.mcpitanlib.api.util.collection.ItemStackList; +import net.pitan76.mcpitanlib.midohra.item.ItemStack; + +import java.util.Optional; + +public class ScreenHandlerWrapper { + private final net.minecraft.world.inventory.AbstractContainerMenu screenHandler; + + public static final ScreenHandlerWrapper EMPTY = new ScreenHandlerWrapper(); + + protected ScreenHandlerWrapper() { + this.screenHandler = null; + } + + protected ScreenHandlerWrapper(net.minecraft.world.inventory.AbstractContainerMenu screenHandler) { + this.screenHandler = screenHandler; + } + + public static ScreenHandlerWrapper of(net.minecraft.world.inventory.AbstractContainerMenu screenHandler) { + return new ScreenHandlerWrapper(screenHandler); + } + + public static ScreenHandlerWrapper of() { + return EMPTY; + } + + public net.minecraft.world.inventory.AbstractContainerMenu get() { + return screenHandler; + } + + public ItemStackList getStacks() { + return ItemStackList.of(get().getItems()); + } + + public ItemStack getCursorStack() { + return ScreenHandlerUtil.getCursorStackM(get()); + } + + public void setCursorStack(ItemStack stack) { + ScreenHandlerUtil.setCursorStackM(get(), stack); + } + + public boolean isPresent() { + return get() != null; + } + + public boolean isEmpty() { + return get() == null; + } + + public int getSyncId() { + if (isEmpty()) return -1; + return get().containerId; + } + + @Override + public int hashCode() { + return isEmpty() ? 0 : get().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + + ScreenHandlerWrapper other = (ScreenHandlerWrapper) obj; + if (isEmpty() && other.isEmpty()) return true; + if (isEmpty() || other.isEmpty()) return false; + + return get().equals(other.get()); + } + + public ScreenHandlerTypeWrapper getType() { + if (isEmpty()) return ScreenHandlerTypeWrapper.EMPTY; + return ScreenHandlerTypeWrapper.of(get().getType()); + } + + /** + * instanceof check for the screen handler of this wrapper. + * @param clazz the class of the screen handler to check + * @return true if the screen handler of this wrapper is an instance of the given class, false otherwise + */ + public boolean instanceOf(Class clazz) { + if (isEmpty()) return false; + + return clazz.isInstance(get()); + } + + /** + * instanceof check for the screen handler of this wrapper. + * @param wrapper the screen handler to check + * @return true if the screen handler of this wrapper is an instance of the given screen handler, false otherwise + */ + public boolean instanceOf(ScreenHandlerWrapper wrapper) { + if (isEmpty()) return false; + + ScreenHandlerWrapper other = wrapper; + if (other.isEmpty()) return false; + + Class clazz = other.get().getClass(); + return clazz.isInstance(get()); + } + + public T getSimpleScreenHandler(Class clazz) { + if (isEmpty()) return null; + if (get() instanceof SimpleScreenHandler) { + SimpleScreenHandler screenHandler = (SimpleScreenHandler) get(); + if (clazz.isInstance(screenHandler)) + return clazz.cast(screenHandler); + } + return null; + } + + public Optional toSimpleScreenHandler(Class clazz) { + return Optional.ofNullable(getSimpleScreenHandler(clazz)); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierScreenHandlerTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierScreenHandlerTypeWrapper.java new file mode 100644 index 000000000..58254e2d1 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierScreenHandlerTypeWrapper.java @@ -0,0 +1,38 @@ +package net.pitan76.mcpitanlib.midohra.screen; + +import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; + +import java.util.function.Supplier; + +public class SupplierScreenHandlerTypeWrapper extends ScreenHandlerTypeWrapper implements INonTypedSupplier { + private final Supplier> supplier; + + protected SupplierScreenHandlerTypeWrapper(Supplier> supplier) { + this.supplier = supplier; + } + + public static SupplierScreenHandlerTypeWrapper of(Supplier> supplier) { + return new SupplierScreenHandlerTypeWrapper(supplier); + } + + public static SupplierScreenHandlerTypeWrapper of(RegistryResult> result) { + return new SupplierScreenHandlerTypeWrapper(result::get); + } + + public static SupplierScreenHandlerTypeWrapper of(RegistrySupplier> result) { + return new SupplierScreenHandlerTypeWrapper(result::get); + } + + @Override + public SupplierScreenHandlerTypeWrapper asNonTyped() { + return this; + } + + @Override + public MenuType get() { + return supplier.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierTypedScreenHandlerTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierTypedScreenHandlerTypeWrapper.java new file mode 100644 index 000000000..2e33fc97c --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/SupplierTypedScreenHandlerTypeWrapper.java @@ -0,0 +1,44 @@ +package net.pitan76.mcpitanlib.midohra.screen; + +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.api.registry.result.RegistryResult; +import net.pitan76.mcpitanlib.api.registry.result.RegistrySupplier; +import net.pitan76.mcpitanlib.midohra.core.INonTypedSupplier; + +import java.util.function.Supplier; + +public class SupplierTypedScreenHandlerTypeWrapper extends TypedScreenHandlerTypeWrapper implements INonTypedSupplier { + private final Supplier> supplier; + + protected SupplierTypedScreenHandlerTypeWrapper(Supplier> supplier) { + super(null); + this.supplier = supplier; + } + + public static SupplierTypedScreenHandlerTypeWrapper of(Supplier> supplier) { + return new SupplierTypedScreenHandlerTypeWrapper<>(supplier); + } + + public static SupplierTypedScreenHandlerTypeWrapper of(RegistryResult> result) { + return new SupplierTypedScreenHandlerTypeWrapper<>(result::get); + } + + public static SupplierTypedScreenHandlerTypeWrapper of(RegistrySupplier> result) { + return new SupplierTypedScreenHandlerTypeWrapper<>(result::get); + } + + public static SupplierTypedScreenHandlerTypeWrapper of(SupplierScreenHandlerTypeWrapper wrapper) { + return new SupplierTypedScreenHandlerTypeWrapper<>(() -> (MenuType) wrapper.get()); + } + + @Override + public SupplierScreenHandlerTypeWrapper asNonTyped() { + return SupplierScreenHandlerTypeWrapper.of(this::get); + } + + @Override + public MenuType get() { + return supplier.get(); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerTypeWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerTypeWrapper.java new file mode 100644 index 000000000..417b1c475 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerTypeWrapper.java @@ -0,0 +1,33 @@ +package net.pitan76.mcpitanlib.midohra.screen; + +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; + +public class TypedScreenHandlerTypeWrapper extends ScreenHandlerTypeWrapper { + protected TypedScreenHandlerTypeWrapper(MenuType type) { + super(type); + } + + public static TypedScreenHandlerTypeWrapper ofRaw(MenuType type) { + return new TypedScreenHandlerTypeWrapper<>(type); + } + + public static TypedScreenHandlerTypeWrapper of(ScreenHandlerTypeWrapper wrapper) { + if (wrapper instanceof SupplierScreenHandlerTypeWrapper) { + SupplierScreenHandlerTypeWrapper supplierWrapper = (SupplierScreenHandlerTypeWrapper) wrapper; + return SupplierTypedScreenHandlerTypeWrapper.of(supplierWrapper); + } + + return new TypedScreenHandlerTypeWrapper<>((MenuType) wrapper.get()); + } + + @Override + public MenuType get() { + return (MenuType) super.get(); + } + + public T create(int syncId, CompatPlayerInventory playerInventory) { + return get().create(syncId, playerInventory.getRaw()); + } +} diff --git a/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerWrapper.java b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerWrapper.java new file mode 100644 index 000000000..45fce9826 --- /dev/null +++ b/common/src/main/java/net/pitan76/mcpitanlib/midohra/screen/TypedScreenHandlerWrapper.java @@ -0,0 +1,17 @@ +package net.pitan76.mcpitanlib.midohra.screen; + +import net.minecraft.world.inventory.AbstractContainerMenu; + +public class TypedScreenHandlerWrapper extends ScreenHandlerWrapper { + protected TypedScreenHandlerWrapper(T screenHandler) { + super(screenHandler); + } + + public static TypedScreenHandlerWrapper ofRaw(T screenHandler) { + return new TypedScreenHandlerWrapper<>(screenHandler); + } + + public static TypedScreenHandlerWrapper of(ScreenHandlerWrapper wrapper) { + return new TypedScreenHandlerWrapper<>((T) wrapper.get()); + } +} From 7a5f8f6c2c28d15ae7d2f247ee721711f65d4654 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 10 May 2026 13:38:46 +0900 Subject: [PATCH 149/151] [cp] bump version 3.6.9 --- info.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.properties b/info.properties index d9f1dc8c1..2d2f516d4 100644 --- a/info.properties +++ b/info.properties @@ -1,4 +1,4 @@ archives_base_name=mcpitanlib -mod_version=3.6.8 +mod_version=3.6.9 maven_group=net.pitan76 changelog=add APIs \ No newline at end of file From de96ba8aa4c1e312e395ff2c09f75a39ff12d2dd Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 10 May 2026 14:42:35 +0900 Subject: [PATCH 150/151] feat: enhance SimpleContainerGui registration with custom ScreenFactory --- .../java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java index da99c43b7..36a496407 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/GuiRegistry.java @@ -11,7 +11,9 @@ import net.pitan76.mcpitanlib.api.gui.SimpleScreenHandlerTypeBuilder; import net.pitan76.mcpitanlib.api.registry.result.SupplierResult; import net.pitan76.mcpitanlib.api.registry.v2.CompatRegistryV2; +import net.pitan76.mcpitanlib.api.text.TextComponent; import net.pitan76.mcpitanlib.api.util.CompatIdentifier; +import net.pitan76.mcpitanlib.api.util.inventory.CompatPlayerInventory; import net.pitan76.mcpitanlib.guilib.api.container.SimpleContainerGui; import net.pitan76.mcpitanlib.guilib.api.screen.SimpleContainerGuiScreen; import net.pitan76.mcpitanlib.midohra.screen.SupplierTypedScreenHandlerTypeWrapper; @@ -34,7 +36,12 @@ public static @Environment(EnvType.CLIENT) public static void registerSimpleContainerGui(String id, MenuType type) { - CompatRegistryClient.registerScreen(id, type, SimpleContainerGuiScreen::new); + CompatRegistryClient.registerScreen(id, type, new CompatRegistryClient.ScreenFactory2<>() { + @Override + public SimpleContainerGuiScreen create(SimpleContainerGui handler, CompatPlayerInventory inventory, TextComponent text) { + return new SimpleContainerGuiScreen(handler, inventory, text); + } + }); } @Environment(EnvType.CLIENT) From c84461944f4efa2dab9809df67b057af6f3f45c3 Mon Sep 17 00:00:00 2001 From: PTOM76 Date: Sun, 10 May 2026 14:42:47 +0900 Subject: [PATCH 151/151] [cp] refactor: update receiveSync method to use PacketByteBuf for improved network handling --- .../api/container/v2/ExtendedBlockEntityContainerGui.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java index cae230a68..9e9f31a13 100644 --- a/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java +++ b/common/src/main/java/net/pitan76/mcpitanlib/guilib/api/container/v2/ExtendedBlockEntityContainerGui.java @@ -4,7 +4,6 @@ import net.pitan76.mcpitanlib.api.gui.args.CreateMenuEvent; import net.pitan76.mcpitanlib.api.tile.CompatBlockEntity; import net.pitan76.mcpitanlib.guilib.api.ISimpleScreenInfo; -import net.pitan76.mcpitanlib.midohra.network.CompatPacketByteBuf; import net.pitan76.mcpitanlib.midohra.network.IByteBuf; import net.pitan76.mcpitanlib.midohra.screen.ScreenHandlerTypeWrapper; @@ -22,10 +21,10 @@ protected ExtendedBlockEntityContainerGui(ScreenHandlerTypeWrapper type, CreateM super(type.get(), e); } - public abstract void receiveSync(IByteBuf buf); + public abstract void receiveSync(net.pitan76.mcpitanlib.midohra.network.PacketByteBuf buf); @Override public void receiveSync(FriendlyByteBuf buf) { - receiveSync((IByteBuf) new CompatPacketByteBuf(buf)); + receiveSync(net.pitan76.mcpitanlib.midohra.network.PacketByteBuf.of(buf)); } }